File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 103103#define FEATURE_GLXVAL_SHIFT 14
104104#define FEATURE_GLXVAL_MASK (0x03ULL << FEATURE_GLXVAL_SHIFT)
105105
106+ /* Extended Feature 2 Bits */
107+ #define FEATURE_SNPAVICSUP_SHIFT 5
108+ #define FEATURE_SNPAVICSUP_MASK (0x07ULL << FEATURE_SNPAVICSUP_SHIFT)
109+ #define FEATURE_SNPAVICSUP_GAM (x ) \
110+ ((x & FEATURE_SNPAVICSUP_MASK) >> FEATURE_SNPAVICSUP_SHIFT == 0x1)
111+
106112/* Note:
107113 * The current driver only support 16-bit PASID.
108114 * Currently, hardware only implement upto 16-bit PASID
165171#define CONTROL_GAINT_EN 29
166172#define CONTROL_XT_EN 50
167173#define CONTROL_INTCAPXT_EN 51
174+ #define CONTROL_SNPAVIC_EN 61
168175
169176#define CTRL_INV_TO_MASK (7 << CONTROL_INV_TIMEOUT)
170177#define CTRL_INV_TO_NONE 0
Original file line number Diff line number Diff line change @@ -2794,13 +2794,22 @@ static void enable_iommus_vapic(void)
27942794 return ;
27952795 }
27962796
2797- /* Enabling GAM support */
2797+ if (amd_iommu_snp_en &&
2798+ !FEATURE_SNPAVICSUP_GAM (amd_iommu_efr2 )) {
2799+ pr_warn ("Force to disable Virtual APIC due to SNP\n" );
2800+ amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY_GA ;
2801+ return ;
2802+ }
2803+
2804+ /* Enabling GAM and SNPAVIC support */
27982805 for_each_iommu (iommu ) {
27992806 if (iommu_init_ga_log (iommu ) ||
28002807 iommu_ga_log_enable (iommu ))
28012808 return ;
28022809
28032810 iommu_feature_enable (iommu , CONTROL_GAM_EN );
2811+ if (amd_iommu_snp_en )
2812+ iommu_feature_enable (iommu , CONTROL_SNPAVIC_EN );
28042813 }
28052814
28062815 amd_iommu_irq_ops .capability |= (1 << IRQ_POSTING_CAP );
You can’t perform that action at this time.
0 commit comments