@@ -63,7 +63,7 @@ typedef struct {
63
63
/* Memory maps. Ref CXL Appendix A */
64
64
65
65
/* PSL Privilege 1 Memory Map */
66
- /* Configuration and Control area */
66
+ /* Configuration and Control area - CAIA 1&2 */
67
67
static const cxl_p1_reg_t CXL_PSL_CtxTime = {0x0000 };
68
68
static const cxl_p1_reg_t CXL_PSL_ErrIVTE = {0x0008 };
69
69
static const cxl_p1_reg_t CXL_PSL_KEY1 = {0x0010 };
@@ -98,11 +98,29 @@ static const cxl_p1_reg_t CXL_XSL_Timebase = {0x0100};
98
98
static const cxl_p1_reg_t CXL_XSL_TB_CTLSTAT = {0x0108 };
99
99
static const cxl_p1_reg_t CXL_XSL_FEC = {0x0158 };
100
100
static const cxl_p1_reg_t CXL_XSL_DSNCTL = {0x0168 };
101
+ /* PSL registers - CAIA 2 */
102
+ static const cxl_p1_reg_t CXL_PSL9_CONTROL = {0x0020 };
103
+ static const cxl_p1_reg_t CXL_XSL9_DSNCTL = {0x0168 };
104
+ static const cxl_p1_reg_t CXL_PSL9_FIR1 = {0x0300 };
105
+ static const cxl_p1_reg_t CXL_PSL9_FIR2 = {0x0308 };
106
+ static const cxl_p1_reg_t CXL_PSL9_Timebase = {0x0310 };
107
+ static const cxl_p1_reg_t CXL_PSL9_DEBUG = {0x0320 };
108
+ static const cxl_p1_reg_t CXL_PSL9_FIR_CNTL = {0x0348 };
109
+ static const cxl_p1_reg_t CXL_PSL9_DSNDCTL = {0x0350 };
110
+ static const cxl_p1_reg_t CXL_PSL9_TB_CTLSTAT = {0x0340 };
111
+ static const cxl_p1_reg_t CXL_PSL9_TRACECFG = {0x0368 };
112
+ static const cxl_p1_reg_t CXL_PSL9_APCDEDALLOC = {0x0378 };
113
+ static const cxl_p1_reg_t CXL_PSL9_APCDEDTYPE = {0x0380 };
114
+ static const cxl_p1_reg_t CXL_PSL9_TNR_ADDR = {0x0388 };
115
+ static const cxl_p1_reg_t CXL_PSL9_GP_CT = {0x0398 };
116
+ static const cxl_p1_reg_t CXL_XSL9_IERAT = {0x0588 };
117
+ static const cxl_p1_reg_t CXL_XSL9_ILPP = {0x0590 };
118
+
101
119
/* 0x7F00:7FFF Reserved PCIe MSI-X Pending Bit Array area */
102
120
/* 0x8000:FFFF Reserved PCIe MSI-X Table Area */
103
121
104
122
/* PSL Slice Privilege 1 Memory Map */
105
- /* Configuration Area */
123
+ /* Configuration Area - CAIA 1&2 */
106
124
static const cxl_p1n_reg_t CXL_PSL_SR_An = {0x00 };
107
125
static const cxl_p1n_reg_t CXL_PSL_LPID_An = {0x08 };
108
126
static const cxl_p1n_reg_t CXL_PSL_AMBAR_An = {0x10 };
@@ -111,17 +129,18 @@ static const cxl_p1n_reg_t CXL_PSL_ID_An = {0x20};
111
129
static const cxl_p1n_reg_t CXL_PSL_SERR_An = {0x28 };
112
130
/* Memory Management and Lookaside Buffer Management - CAIA 1*/
113
131
static const cxl_p1n_reg_t CXL_PSL_SDR_An = {0x30 };
132
+ /* Memory Management and Lookaside Buffer Management - CAIA 1&2 */
114
133
static const cxl_p1n_reg_t CXL_PSL_AMOR_An = {0x38 };
115
- /* Pointer Area */
134
+ /* Pointer Area - CAIA 1&2 */
116
135
static const cxl_p1n_reg_t CXL_HAURP_An = {0x80 };
117
136
static const cxl_p1n_reg_t CXL_PSL_SPAP_An = {0x88 };
118
137
static const cxl_p1n_reg_t CXL_PSL_LLCMD_An = {0x90 };
119
- /* Control Area */
138
+ /* Control Area - CAIA 1&2 */
120
139
static const cxl_p1n_reg_t CXL_PSL_SCNTL_An = {0xA0 };
121
140
static const cxl_p1n_reg_t CXL_PSL_CtxTime_An = {0xA8 };
122
141
static const cxl_p1n_reg_t CXL_PSL_IVTE_Offset_An = {0xB0 };
123
142
static const cxl_p1n_reg_t CXL_PSL_IVTE_Limit_An = {0xB8 };
124
- /* 0xC0:FF Implementation Dependent Area */
143
+ /* 0xC0:FF Implementation Dependent Area - CAIA 1&2 */
125
144
static const cxl_p1n_reg_t CXL_PSL_FIR_SLICE_An = {0xC0 };
126
145
static const cxl_p1n_reg_t CXL_AFU_DEBUG_An = {0xC8 };
127
146
/* 0xC0:FF Implementation Dependent Area - CAIA 1 */
@@ -131,7 +150,7 @@ static const cxl_p1n_reg_t CXL_PSL_RXCTL_A = {0xE0};
131
150
static const cxl_p1n_reg_t CXL_PSL_SLICE_TRACE = {0xE8 };
132
151
133
152
/* PSL Slice Privilege 2 Memory Map */
134
- /* Configuration and Control Area */
153
+ /* Configuration and Control Area - CAIA 1&2 */
135
154
static const cxl_p2n_reg_t CXL_PSL_PID_TID_An = {0x000 };
136
155
static const cxl_p2n_reg_t CXL_CSRP_An = {0x008 };
137
156
/* Configuration and Control Area - CAIA 1 */
@@ -145,17 +164,17 @@ static const cxl_p2n_reg_t CXL_PSL_AMR_An = {0x030};
145
164
static const cxl_p2n_reg_t CXL_SLBIE_An = {0x040 };
146
165
static const cxl_p2n_reg_t CXL_SLBIA_An = {0x048 };
147
166
static const cxl_p2n_reg_t CXL_SLBI_Select_An = {0x050 };
148
- /* Interrupt Registers */
167
+ /* Interrupt Registers - CAIA 1&2 */
149
168
static const cxl_p2n_reg_t CXL_PSL_DSISR_An = {0x060 };
150
169
static const cxl_p2n_reg_t CXL_PSL_DAR_An = {0x068 };
151
170
static const cxl_p2n_reg_t CXL_PSL_DSR_An = {0x070 };
152
171
static const cxl_p2n_reg_t CXL_PSL_TFC_An = {0x078 };
153
172
static const cxl_p2n_reg_t CXL_PSL_PEHandle_An = {0x080 };
154
173
static const cxl_p2n_reg_t CXL_PSL_ErrStat_An = {0x088 };
155
- /* AFU Registers */
174
+ /* AFU Registers - CAIA 1&2 */
156
175
static const cxl_p2n_reg_t CXL_AFU_Cntl_An = {0x090 };
157
176
static const cxl_p2n_reg_t CXL_AFU_ERR_An = {0x098 };
158
- /* Work Element Descriptor */
177
+ /* Work Element Descriptor - CAIA 1&2 */
159
178
static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0 };
160
179
/* 0x0C0:FFF Implementation Dependent Area */
161
180
@@ -182,6 +201,10 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0};
182
201
#define CXL_PSL_SR_An_SF MSR_SF /* 64bit */
183
202
#define CXL_PSL_SR_An_TA (1ull << (63-1)) /* Tags active, GA1: 0 */
184
203
#define CXL_PSL_SR_An_HV MSR_HV /* Hypervisor, GA1: 0 */
204
+ #define CXL_PSL_SR_An_XLAT_hpt (0ull << (63-6))/* Hashed page table (HPT) mode */
205
+ #define CXL_PSL_SR_An_XLAT_roh (2ull << (63-6))/* Radix on HPT mode */
206
+ #define CXL_PSL_SR_An_XLAT_ror (3ull << (63-6))/* Radix on Radix mode */
207
+ #define CXL_PSL_SR_An_BOT (1ull << (63-10)) /* Use the in-memory segment table */
185
208
#define CXL_PSL_SR_An_PR MSR_PR /* Problem state, GA1: 1 */
186
209
#define CXL_PSL_SR_An_ISL (1ull << (63-53)) /* Ignore Segment Large Page */
187
210
#define CXL_PSL_SR_An_TC (1ull << (63-54)) /* Page Table secondary hash */
@@ -298,12 +321,39 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0};
298
321
#define CXL_PSL_DSISR_An_S DSISR_ISSTORE /* Access was afu_wr or afu_zero */
299
322
#define CXL_PSL_DSISR_An_K DSISR_KEYFAULT /* Access not permitted by virtual page class key protection */
300
323
324
+ /****** CXL_PSL_DSISR_An - CAIA 2 ****************************************************/
325
+ #define CXL_PSL9_DSISR_An_TF (1ull << (63-3)) /* Translation fault */
326
+ #define CXL_PSL9_DSISR_An_PE (1ull << (63-4)) /* PSL Error (implementation specific) */
327
+ #define CXL_PSL9_DSISR_An_AE (1ull << (63-5)) /* AFU Error */
328
+ #define CXL_PSL9_DSISR_An_OC (1ull << (63-6)) /* OS Context Warning */
329
+ #define CXL_PSL9_DSISR_An_S (1ull << (63-38)) /* TF for a write operation */
330
+ #define CXL_PSL9_DSISR_PENDING (CXL_PSL9_DSISR_An_TF | CXL_PSL9_DSISR_An_PE | CXL_PSL9_DSISR_An_AE | CXL_PSL9_DSISR_An_OC)
331
+ /*
332
+ * NOTE: Bits 56:63 (Checkout Response Status) are valid when DSISR_An[TF] = 1
333
+ * Status (0:7) Encoding
334
+ */
335
+ #define CXL_PSL9_DSISR_An_CO_MASK 0x00000000000000ffULL
336
+ #define CXL_PSL9_DSISR_An_SF 0x0000000000000080ULL /* Segment Fault 0b10000000 */
337
+ #define CXL_PSL9_DSISR_An_PF_SLR 0x0000000000000088ULL /* PTE not found (Single Level Radix) 0b10001000 */
338
+ #define CXL_PSL9_DSISR_An_PF_RGC 0x000000000000008CULL /* PTE not found (Radix Guest (child)) 0b10001100 */
339
+ #define CXL_PSL9_DSISR_An_PF_RGP 0x0000000000000090ULL /* PTE not found (Radix Guest (parent)) 0b10010000 */
340
+ #define CXL_PSL9_DSISR_An_PF_HRH 0x0000000000000094ULL /* PTE not found (HPT/Radix Host) 0b10010100 */
341
+ #define CXL_PSL9_DSISR_An_PF_STEG 0x000000000000009CULL /* PTE not found (STEG VA) 0b10011100 */
342
+
301
343
/****** CXL_PSL_TFC_An ******************************************************/
302
344
#define CXL_PSL_TFC_An_A (1ull << (63-28)) /* Acknowledge non-translation fault */
303
345
#define CXL_PSL_TFC_An_C (1ull << (63-29)) /* Continue (abort transaction) */
304
346
#define CXL_PSL_TFC_An_AE (1ull << (63-30)) /* Restart PSL with address error */
305
347
#define CXL_PSL_TFC_An_R (1ull << (63-31)) /* Restart PSL transaction */
306
348
349
+ /****** CXL_XSL9_IERAT_ERAT - CAIA 2 **********************************/
350
+ #define CXL_XSL9_IERAT_MLPID (1ull << (63-0)) /* Match LPID */
351
+ #define CXL_XSL9_IERAT_MPID (1ull << (63-1)) /* Match PID */
352
+ #define CXL_XSL9_IERAT_PRS (1ull << (63-4)) /* PRS bit for Radix invalidations */
353
+ #define CXL_XSL9_IERAT_INVR (1ull << (63-3)) /* Invalidate Radix */
354
+ #define CXL_XSL9_IERAT_IALL (1ull << (63-8)) /* Invalidate All */
355
+ #define CXL_XSL9_IERAT_IINPROG (1ull << (63-63)) /* Invalidate in progress */
356
+
307
357
/* cxl_process_element->software_status */
308
358
#define CXL_PE_SOFTWARE_STATE_V (1ul << (31 - 0)) /* Valid */
309
359
#define CXL_PE_SOFTWARE_STATE_C (1ul << (31 - 29)) /* Complete */
@@ -654,25 +704,38 @@ int cxl_pci_reset(struct cxl *adapter);
654
704
void cxl_pci_release_afu (struct device * dev );
655
705
ssize_t cxl_pci_read_adapter_vpd (struct cxl * adapter , void * buf , size_t len );
656
706
657
- /* common == phyp + powernv */
707
+ /* common == phyp + powernv - CAIA 1&2 */
658
708
struct cxl_process_element_common {
659
709
__be32 tid ;
660
710
__be32 pid ;
661
711
__be64 csrp ;
662
- __be64 aurp0 ;
663
- __be64 aurp1 ;
664
- __be64 sstp0 ;
665
- __be64 sstp1 ;
712
+ union {
713
+ struct {
714
+ __be64 aurp0 ;
715
+ __be64 aurp1 ;
716
+ __be64 sstp0 ;
717
+ __be64 sstp1 ;
718
+ } psl8 ; /* CAIA 1 */
719
+ struct {
720
+ u8 reserved2 [8 ];
721
+ u8 reserved3 [8 ];
722
+ u8 reserved4 [8 ];
723
+ u8 reserved5 [8 ];
724
+ } psl9 ; /* CAIA 2 */
725
+ } u ;
666
726
__be64 amr ;
667
- u8 reserved3 [4 ];
727
+ u8 reserved6 [4 ];
668
728
__be64 wed ;
669
729
} __packed ;
670
730
671
- /* just powernv */
731
+ /* just powernv - CAIA 1&2 */
672
732
struct cxl_process_element {
673
733
__be64 sr ;
674
734
__be64 SPOffset ;
675
- __be64 sdr ;
735
+ union {
736
+ __be64 sdr ; /* CAIA 1 */
737
+ u8 reserved1 [8 ]; /* CAIA 2 */
738
+ } u ;
676
739
__be64 haurp ;
677
740
__be32 ctxtime ;
678
741
__be16 ivte_offsets [4 ];
@@ -761,13 +824,30 @@ static inline bool cxl_is_power8(void)
761
824
return false;
762
825
}
763
826
827
+ static inline bool cxl_is_power9 (void )
828
+ {
829
+ /* intermediate solution */
830
+ if (!cxl_is_power8 () &&
831
+ (cpu_has_feature (CPU_FTRS_POWER9 ) ||
832
+ cpu_has_feature (CPU_FTR_POWER9_DD1 )))
833
+ return true;
834
+ return false;
835
+ }
836
+
764
837
static inline bool cxl_is_psl8 (struct cxl_afu * afu )
765
838
{
766
839
if (afu -> adapter -> caia_major == 1 )
767
840
return true;
768
841
return false;
769
842
}
770
843
844
+ static inline bool cxl_is_psl9 (struct cxl_afu * afu )
845
+ {
846
+ if (afu -> adapter -> caia_major == 2 )
847
+ return true;
848
+ return false;
849
+ }
850
+
771
851
ssize_t cxl_pci_afu_read_err_buffer (struct cxl_afu * afu , char * buf ,
772
852
loff_t off , size_t count );
773
853
@@ -794,7 +874,6 @@ int cxl_update_properties(struct device_node *dn, struct property *new_prop);
794
874
795
875
void cxl_remove_adapter_nr (struct cxl * adapter );
796
876
797
- int cxl_alloc_spa (struct cxl_afu * afu );
798
877
void cxl_release_spa (struct cxl_afu * afu );
799
878
800
879
dev_t cxl_get_dev (void );
@@ -832,9 +911,13 @@ int afu_register_irqs(struct cxl_context *ctx, u32 count);
832
911
void afu_release_irqs (struct cxl_context * ctx , void * cookie );
833
912
void afu_irq_name_free (struct cxl_context * ctx );
834
913
914
+ int cxl_attach_afu_directed_psl9 (struct cxl_context * ctx , u64 wed , u64 amr );
835
915
int cxl_attach_afu_directed_psl8 (struct cxl_context * ctx , u64 wed , u64 amr );
916
+ int cxl_activate_dedicated_process_psl9 (struct cxl_afu * afu );
836
917
int cxl_activate_dedicated_process_psl8 (struct cxl_afu * afu );
918
+ int cxl_attach_dedicated_process_psl9 (struct cxl_context * ctx , u64 wed , u64 amr );
837
919
int cxl_attach_dedicated_process_psl8 (struct cxl_context * ctx , u64 wed , u64 amr );
920
+ void cxl_update_dedicated_ivtes_psl9 (struct cxl_context * ctx );
838
921
void cxl_update_dedicated_ivtes_psl8 (struct cxl_context * ctx );
839
922
840
923
#ifdef CONFIG_DEBUG_FS
@@ -845,9 +928,12 @@ int cxl_debugfs_adapter_add(struct cxl *adapter);
845
928
void cxl_debugfs_adapter_remove (struct cxl * adapter );
846
929
int cxl_debugfs_afu_add (struct cxl_afu * afu );
847
930
void cxl_debugfs_afu_remove (struct cxl_afu * afu );
931
+ void cxl_stop_trace_psl9 (struct cxl * cxl );
848
932
void cxl_stop_trace_psl8 (struct cxl * cxl );
933
+ void cxl_debugfs_add_adapter_regs_psl9 (struct cxl * adapter , struct dentry * dir );
849
934
void cxl_debugfs_add_adapter_regs_psl8 (struct cxl * adapter , struct dentry * dir );
850
935
void cxl_debugfs_add_adapter_regs_xsl (struct cxl * adapter , struct dentry * dir );
936
+ void cxl_debugfs_add_afu_regs_psl9 (struct cxl_afu * afu , struct dentry * dir );
851
937
void cxl_debugfs_add_afu_regs_psl8 (struct cxl_afu * afu , struct dentry * dir );
852
938
853
939
#else /* CONFIG_DEBUG_FS */
@@ -879,10 +965,19 @@ static inline void cxl_debugfs_afu_remove(struct cxl_afu *afu)
879
965
{
880
966
}
881
967
968
+ static inline void cxl_stop_trace_psl9 (struct cxl * cxl )
969
+ {
970
+ }
971
+
882
972
static inline void cxl_stop_trace_psl8 (struct cxl * cxl )
883
973
{
884
974
}
885
975
976
+ static inline void cxl_debugfs_add_adapter_regs_psl9 (struct cxl * adapter ,
977
+ struct dentry * dir )
978
+ {
979
+ }
980
+
886
981
static inline void cxl_debugfs_add_adapter_regs_psl8 (struct cxl * adapter ,
887
982
struct dentry * dir )
888
983
{
@@ -893,6 +988,10 @@ static inline void cxl_debugfs_add_adapter_regs_xsl(struct cxl *adapter,
893
988
{
894
989
}
895
990
991
+ static inline void cxl_debugfs_add_afu_regs_psl9 (struct cxl_afu * afu , struct dentry * dir )
992
+ {
993
+ }
994
+
896
995
static inline void cxl_debugfs_add_afu_regs_psl8 (struct cxl_afu * afu , struct dentry * dir )
897
996
{
898
997
}
@@ -938,7 +1037,9 @@ struct cxl_irq_info {
938
1037
};
939
1038
940
1039
void cxl_assign_psn_space (struct cxl_context * ctx );
1040
+ int cxl_invalidate_all_psl9 (struct cxl * adapter );
941
1041
int cxl_invalidate_all_psl8 (struct cxl * adapter );
1042
+ irqreturn_t cxl_irq_psl9 (int irq , struct cxl_context * ctx , struct cxl_irq_info * irq_info );
942
1043
irqreturn_t cxl_irq_psl8 (int irq , struct cxl_context * ctx , struct cxl_irq_info * irq_info );
943
1044
irqreturn_t cxl_fail_irq_psl (struct cxl_afu * afu , struct cxl_irq_info * irq_info );
944
1045
int cxl_register_one_irq (struct cxl * adapter , irq_handler_t handler ,
@@ -951,6 +1052,7 @@ int cxl_data_cache_flush(struct cxl *adapter);
951
1052
int cxl_afu_disable (struct cxl_afu * afu );
952
1053
int cxl_psl_purge (struct cxl_afu * afu );
953
1054
1055
+ void cxl_native_irq_dump_regs_psl9 (struct cxl_context * ctx );
954
1056
void cxl_native_irq_dump_regs_psl8 (struct cxl_context * ctx );
955
1057
void cxl_native_err_irq_dump_regs (struct cxl * adapter );
956
1058
int cxl_pci_vphb_add (struct cxl_afu * afu );
0 commit comments