|
84 | 84 |
|
85 | 85 |
|
86 | 86 | /* Extended Feature Bits */
|
87 |
| -#define FEATURE_PREFETCH (1ULL<<0) |
88 |
| -#define FEATURE_PPR (1ULL<<1) |
89 |
| -#define FEATURE_X2APIC (1ULL<<2) |
90 |
| -#define FEATURE_NX (1ULL<<3) |
91 |
| -#define FEATURE_GT (1ULL<<4) |
92 |
| -#define FEATURE_IA (1ULL<<6) |
93 |
| -#define FEATURE_GA (1ULL<<7) |
94 |
| -#define FEATURE_HE (1ULL<<8) |
95 |
| -#define FEATURE_PC (1ULL<<9) |
| 87 | +#define FEATURE_PREFETCH BIT_ULL(0) |
| 88 | +#define FEATURE_PPR BIT_ULL(1) |
| 89 | +#define FEATURE_X2APIC BIT_ULL(2) |
| 90 | +#define FEATURE_NX BIT_ULL(3) |
| 91 | +#define FEATURE_GT BIT_ULL(4) |
| 92 | +#define FEATURE_IA BIT_ULL(6) |
| 93 | +#define FEATURE_GA BIT_ULL(7) |
| 94 | +#define FEATURE_HE BIT_ULL(8) |
| 95 | +#define FEATURE_PC BIT_ULL(9) |
96 | 96 | #define FEATURE_GATS_SHIFT (12)
|
97 | 97 | #define FEATURE_GATS_MASK (3ULL)
|
98 |
| -#define FEATURE_GAM_VAPIC (1ULL<<21) |
99 |
| -#define FEATURE_GIOSUP (1ULL<<48) |
100 |
| -#define FEATURE_EPHSUP (1ULL<<50) |
101 |
| -#define FEATURE_SNP (1ULL<<63) |
| 98 | +#define FEATURE_GAM_VAPIC BIT_ULL(21) |
| 99 | +#define FEATURE_GIOSUP BIT_ULL(48) |
| 100 | +#define FEATURE_EPHSUP BIT_ULL(50) |
| 101 | +#define FEATURE_SNP BIT_ULL(63) |
102 | 102 |
|
103 | 103 | #define FEATURE_PASID_SHIFT 32
|
104 | 104 | #define FEATURE_PASID_MASK (0x1fULL << FEATURE_PASID_SHIFT)
|
|
120 | 120 | #define PASID_MASK 0x0000ffff
|
121 | 121 |
|
122 | 122 | /* MMIO status bits */
|
123 |
| -#define MMIO_STATUS_EVT_OVERFLOW_INT_MASK (1 << 0) |
124 |
| -#define MMIO_STATUS_EVT_INT_MASK (1 << 1) |
125 |
| -#define MMIO_STATUS_COM_WAIT_INT_MASK (1 << 2) |
126 |
| -#define MMIO_STATUS_PPR_INT_MASK (1 << 6) |
127 |
| -#define MMIO_STATUS_GALOG_RUN_MASK (1 << 8) |
128 |
| -#define MMIO_STATUS_GALOG_OVERFLOW_MASK (1 << 9) |
129 |
| -#define MMIO_STATUS_GALOG_INT_MASK (1 << 10) |
| 123 | +#define MMIO_STATUS_EVT_OVERFLOW_INT_MASK BIT(0) |
| 124 | +#define MMIO_STATUS_EVT_INT_MASK BIT(1) |
| 125 | +#define MMIO_STATUS_COM_WAIT_INT_MASK BIT(2) |
| 126 | +#define MMIO_STATUS_PPR_INT_MASK BIT(6) |
| 127 | +#define MMIO_STATUS_GALOG_RUN_MASK BIT(8) |
| 128 | +#define MMIO_STATUS_GALOG_OVERFLOW_MASK BIT(9) |
| 129 | +#define MMIO_STATUS_GALOG_INT_MASK BIT(10) |
130 | 130 |
|
131 | 131 | /* event logging constants */
|
132 | 132 | #define EVENT_ENTRY_SIZE 0x10
|
|
370 | 370 | /*
|
371 | 371 | * Bit value definition for I/O PTE fields
|
372 | 372 | */
|
373 |
| -#define IOMMU_PTE_PR (1ULL << 0) |
374 |
| -#define IOMMU_PTE_U (1ULL << 59) |
375 |
| -#define IOMMU_PTE_FC (1ULL << 60) |
376 |
| -#define IOMMU_PTE_IR (1ULL << 61) |
377 |
| -#define IOMMU_PTE_IW (1ULL << 62) |
| 373 | +#define IOMMU_PTE_PR BIT_ULL(0) |
| 374 | +#define IOMMU_PTE_U BIT_ULL(59) |
| 375 | +#define IOMMU_PTE_FC BIT_ULL(60) |
| 376 | +#define IOMMU_PTE_IR BIT_ULL(61) |
| 377 | +#define IOMMU_PTE_IW BIT_ULL(62) |
378 | 378 |
|
379 | 379 | /*
|
380 | 380 | * Bit value definition for DTE fields
|
381 | 381 | */
|
382 |
| -#define DTE_FLAG_V (1ULL << 0) |
383 |
| -#define DTE_FLAG_TV (1ULL << 1) |
384 |
| -#define DTE_FLAG_IR (1ULL << 61) |
385 |
| -#define DTE_FLAG_IW (1ULL << 62) |
386 |
| - |
387 |
| -#define DTE_FLAG_IOTLB (1ULL << 32) |
388 |
| -#define DTE_FLAG_GIOV (1ULL << 54) |
389 |
| -#define DTE_FLAG_GV (1ULL << 55) |
| 382 | +#define DTE_FLAG_V BIT_ULL(0) |
| 383 | +#define DTE_FLAG_TV BIT_ULL(1) |
| 384 | +#define DTE_FLAG_IR BIT_ULL(61) |
| 385 | +#define DTE_FLAG_IW BIT_ULL(62) |
| 386 | + |
| 387 | +#define DTE_FLAG_IOTLB BIT_ULL(32) |
| 388 | +#define DTE_FLAG_GIOV BIT_ULL(54) |
| 389 | +#define DTE_FLAG_GV BIT_ULL(55) |
390 | 390 | #define DTE_FLAG_MASK (0x3ffULL << 32)
|
391 | 391 | #define DTE_GLX_SHIFT (56)
|
392 | 392 | #define DTE_GLX_MASK (3)
|
|
440 | 440 | #define MAX_DOMAIN_ID 65536
|
441 | 441 |
|
442 | 442 | /* Protection domain flags */
|
443 |
| -#define PD_DMA_OPS_MASK (1UL << 0) /* domain used for dma_ops */ |
444 |
| -#define PD_DEFAULT_MASK (1UL << 1) /* domain is a default dma_ops |
| 443 | +#define PD_DMA_OPS_MASK BIT(0) /* domain used for dma_ops */ |
| 444 | +#define PD_DEFAULT_MASK BIT(1) /* domain is a default dma_ops |
445 | 445 | domain for an IOMMU */
|
446 |
| -#define PD_PASSTHROUGH_MASK (1UL << 2) /* domain has no page |
| 446 | +#define PD_PASSTHROUGH_MASK BIT(2) /* domain has no page |
447 | 447 | translation */
|
448 |
| -#define PD_IOMMUV2_MASK (1UL << 3) /* domain has gcr3 table */ |
449 |
| -#define PD_GIOV_MASK (1UL << 4) /* domain enable GIOV support */ |
| 448 | +#define PD_IOMMUV2_MASK BIT(3) /* domain has gcr3 table */ |
| 449 | +#define PD_GIOV_MASK BIT(4) /* domain enable GIOV support */ |
450 | 450 |
|
451 | 451 | extern bool amd_iommu_dump;
|
452 | 452 | #define DUMP_printk(format, arg...) \
|
|
0 commit comments