IOMMU: restrict visibility/scope if certain variables
v2 cover IOMMU: restrict visibility/scope if certain variables
A number of the command line controlled variables are x86- or even x86-HVM-specific. Don't have those variables elsewhere in the first place (in some cases replace them by a #define), and as a result also don't silently accept such "iommu=" sub-options which in fact have no effect.
1: iommu_intremap is x86-only
2: iommu_intpost is x86/HVM-only
3: iommu_igfx is x86-only
4: iommu_qinval is x86-only
5: iommu_snoop is x86-only
The series contextually depends on "AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode"
v2 addresses review comments, at least as far as agreement was reached. See individual patches.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/5 IOMMU: iommu_intremap is x86-only
Provide a #define for other cases; it didn't seem worthwhile to me to introduce an IOMMU_INTREMAP Kconfig option at this point.
---
v2: Refine doc adjustment.
docs/misc/xen-command-line.pandoc +2 -0
@@ -1299,6 +1299,8 @@ boolean (e.g. `iommu=no`) can override t generation of IOMMUs only supported DMA remapping, and Interrupt Remapping appeared in the second generation. + This option is only valid on x86. + * The `intpost` boolean controls the Posted Interrupt sub-feature. In combination with APIC acceleration (VT-x APICV, SVM AVIC), the IOMMU can be configured to deliver interrupts from assigned PCI devices directly
xen/drivers/passthrough/iommu.c +9 -1
@@ -35,7 +35,6 @@ bool __read_mostly iommu_quarantine = trbool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ; -enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;
@@ -90,8 +89,10 @@ static int __init parse_iommu_param(cons iommu_snoop = val; else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) iommu_qinval = val; +#ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off; +#endif else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val;#ifdef CONFIG_KEXEC
@@ -474,8 +475,11 @@ int __init iommu_setup(void) rc =iommu_hardware_setup (); iommu_enabled = (rc ==0 ); } + +#ifndef iommu_intremapif ( !iommu_enabled ) iommu_intremap = iommu_intremap_off; +#endif if ( (force_iommu && !iommu_enabled) || (force_intremap && !iommu_intremap) )
@@ -500,7 +504,9 @@ int __init iommu_setup(void)printk (" - Dom0 mode: %s\n" , iommu_hwdom_passthrough ?"Passthrough" : iommu_hwdom_strict ?"Strict" :"Relaxed" ); +#ifndef iommu_intremapprintk ("Interrupt remapping %sabled\n" , iommu_intremap ?"en" :"dis" ); +#endif tasklet_init (&iommu_pt_cleanup_tasklet, iommu_free_pagetables,NULL ); }
@@ -558,7 +564,9 @@ void iommu_crash_shutdown(void)if ( iommu_enabled )iommu_get_ops ()->crash_shutdown (); iommu_enabled = iommu_intpost =0 ; +#ifndef iommu_intremap iommu_intremap = iommu_intremap_off; +#endif }int iommu_get_reserved_device_memory (iommu_grdm_t *func,void *ctxt)
xen/drivers/passthrough/x86/iommu.c +2 -0
@@ -27,6 +27,8 @@const struct iommu_init_ops *__initdata iommu_init_ops;struct iommu_ops __read_mostly iommu_ops; +enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +int __init iommu_hardware_setup (void ) {struct IO_APIC_route_entry **ioapic_entries =NULL ;
xen/include/xen/iommu.h +5 -2
@@ -55,21 +55,24 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx;extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; + +#ifdef CONFIG_X86 extern enum __packed iommu_intremap { /* * In order to allow traditional boolean uses of the iommu_intremap * variable, the "off" value has to come first (yielding a value of zero). */ iommu_intremap_off, -#ifdef CONFIG_X86 /* * Interrupt remapping enabled, but only able to generate interrupts * with an 8-bit APIC ID. */ iommu_intremap_restricted, -#endif iommu_intremap_full, } iommu_intremap; +#else +# define iommu_intremap false +#endif #if defined(CONFIG_IOMMU_FORCE_PT_SHARE) #define iommu_hap_pt_share true
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 1/5] IOMMU: iommu_intremap is x86-only
Quoted 10 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:43
To: [email protected]
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH v2 1/5] IOMMU:iommu_intremapis x86-only
Quoted 4 lines
Provide a #define for other cases; it didn't seem worthwhile to me to introduce an
IOMMU_INTREMAPKconfigoption at this point.Signed-off-by Jan Beulich <[email protected]>
Quoted 97 lines
---
v2: Refine doc adjustment.docs/misc/xen-command-line.pandoc +2
-0@@ -1299,6 +1299,8 @@ boolean (e.g. `iommu=no`) can override t generation of IOMMUs only supported DMA remapping, and Interrupt Remapping appeared in the second generation. + This option is only valid on x86. + * The `intpost` boolean controls the Posted Interrupt sub-feature. In combination with APIC acceleration (VT-x APICV, SVM AVIC), the IOMMU can be configured to deliver interrupts from assigned PCI devices directlyxen/drivers/passthrough/iommu.c +9
-1@@ -35,7 +35,6 @@ bool __read_mostly iommu_quarantine = trbool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ; -enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;@@ -90,8 +89,10 @@ static int __init parse_iommu_param(cons iommu_snoop = val; else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) iommu_qinval = val; +#ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off; +#endif else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val;#ifdef CONFIG_KEXEC @@ -474,8 +475,11 @@ int __init iommu_setup(void) rc =iommu_hardware_setup (); iommu_enabled = (rc ==0 ); } + +#ifndef iommu_intremapif ( !iommu_enabled ) iommu_intremap = iommu_intremap_off; +#endif if ( (force_iommu && !iommu_enabled) || (force_intremap && !iommu_intremap) )@@ -500,7 +504,9 @@ int __init iommu_setup(void)printk (" - Dom0 mode: %s\n" , iommu_hwdom_passthrough ?"Passthrough" : iommu_hwdom_strict ?"Strict" :"Relaxed" ); +#ifndef iommu_intremapprintk ("Interrupt remapping %sabled\n" , iommu_intremap ?"en" :"dis" ); +#endif tasklet_init (&iommu_pt_cleanup_tasklet, iommu_free_pagetables,NULL ); }@@ -558,7 +564,9 @@ void iommu_crash_shutdown(void)if ( iommu_enabled )iommu_get_ops ()->crash_shutdown (); iommu_enabled = iommu_intpost =0 ; +#ifndef iommu_intremap iommu_intremap = iommu_intremap_off; +#endif }int iommu_get_reserved_device_memory (iommu_grdm_t *func,void *ctxt)xen/drivers/passthrough/x86/iommu.c +2
-0@@ -27,6 +27,8 @@const struct iommu_init_ops *__initdata iommu_init_ops;struct iommu_ops __read_mostly iommu_ops; +enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +int __init iommu_hardware_setup (void ) {struct IO_APIC_route_entry **ioapic_entries =NULL ;xen/include/xen/iommu.h +2
-1@@ -55,21 +55,24 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx;extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; + +#ifdef CONFIG_X86 extern enum __packed iommu_intremap {/* * In order to allow traditional boolean uses of the iommu_intremap * variable, the "off" value has to come first (yielding a value of zero). */ iommu_intremap_off, -#ifdef CONFIG_X86/* * Interrupt remapping enabled, but only able to generate interrupts * with an 8-bit APIC ID. */
xen/include/xen/iommu.h static inline bool_t dfn_eq(dfn_t x, dfn · line 78
Quoted 10 lines
xen/include/xen/iommu.h +3
-1iommu_intremap_restricted, -#endif iommu_intremap_full, } iommu_intremap; +#else +# define iommu_intremap false +#endif #if defined(CONFIG_IOMMU_FORCE_PT_SHARE )#define iommu_hap_pt_share true
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/5 IOMMU: iommu_intpost is x86/HVM-only
In reply to Jan BeulichProvide a #define for all other cases.
---
v2: Refine doc adjustment.
docs/misc/xen-command-line.pandoc +2 -0
@@ -1309,6 +1309,8 @@ boolean (e.g. `iommu=no`) can override t This option depends on `intremap`, and is disabled by default due to some corner cases in the implementation which have yet to be resolved. + This option is only valid on x86, and only builds of Xen with HVM support. + * The `crash-disable` boolean controls disabling IOMMU functionality (DMAR/IR/QI) before switching to a crash kernel. This option is inactive by default and is for compatibility with older kdump kernels only. Modern kernels copy
xen/drivers/passthrough/iommu.c +8 -9
@@ -43,14 +43,6 @@ bool __read_mostly iommu_hwdom_passthrou bool __hwdom_initdata iommu_hwdom_inclusive; int8_t __hwdom_initdata iommu_hwdom_reserved = -1; -/* -* In the current implementation of VT-d posted interrupts, in some extreme -* cases, the per cpu list which saves the blocked vCPU will be very long, -* and this will affect the interrupt latency, so let this feature off by -* default until we find a good solution to resolve it. -*/ -bool_t __read_mostly iommu_intpost; -#ifndef iommu_hap_pt_sharebool __read_mostly iommu_hap_pt_share = true;#endif
@@ -93,8 +85,10 @@ static int __init parse_iommu_param(cons else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;#endif +#ifndef iommu_intpost else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val; +#endif #ifdef CONFIG_KEXEC else if ( (val = parse_boolean("crash-disable", s, ss)) >= 0 ) iommu_crash_disable = val;
@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" ); +#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ; +#endif printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" );if ( !iommu_enabled )
@@ -563,10 +559,13 @@ void iommu_crash_shutdown(void)if ( iommu_enabled )iommu_get_ops ()->crash_shutdown (); - iommu_enabled = iommu_intpost =0 ; + iommu_enabled = false;#ifndef iommu_intremap iommu_intremap = iommu_intremap_off;#endif +#ifndef iommu_intpost + iommu_intpost = false; +#endif }int iommu_get_reserved_device_memory (iommu_grdm_t *func,void *ctxt)
xen/drivers/passthrough/vtd/iommu.c +8 -2
@@ -2297,13 +2297,15 @@ static int __init vtd_setup(void)if ( iommu_intremap && !ecap_intr_remap (iommu->ecap) ) iommu_intremap = iommu_intremap_off; +#ifndef iommu_intpost/* * We cannot use posted interrupt if X86_FEATURE_CX16 is * not supported, since we count on this feature to * atomically update 16-byte IRTE in posted format. */ if ( !cap_intr_post (iommu->cap) || !iommu_intremap || !cpu_has_cx16 ) - iommu_intpost =0 ; + iommu_intpost = false; +#endif if ( !vtd_ept_page_compatible (iommu) )clear_iommu_hap_pt_share ();
@@ -2330,7 +2332,9 @@ static int __init vtd_setup(void)P (iommu_hwdom_passthrough,"Dom0 DMA Passthrough" );P (iommu_qinval,"Queued Invalidation" );P (iommu_intremap,"Interrupt Remapping" ); +#ifndef iommu_intpostP (iommu_intpost,"Posted Interrupt" ); +#endif P (iommu_hap_pt_share,"Shared EPT tables" );#undef P
@@ -2348,7 +2352,9 @@ static int __init vtd_setup(void) iommu_hwdom_passthrough = false; iommu_qinval =0 ; iommu_intremap = iommu_intremap_off; - iommu_intpost =0 ; +#ifndef iommu_intpost + iommu_intpost = false; +#endif return ret; }
xen/drivers/passthrough/x86/iommu.c +10 -0
@@ -29,6 +29,16 @@ struct iommu_ops __read_mostly iommu_opsenum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +#ifndef iommu_intpost +/* +* In the current implementation of VT-d posted interrupts, in some extreme +* cases, the per cpu list which saves the blocked vCPU will be very long, +* and this will affect the interrupt latency, so let this feature off by +* default until we find a good solution to resolve it. +*/ +bool __read_mostly iommu_intpost; +#endif +int __init iommu_hardware_setup (void ) {struct IO_APIC_route_entry **ioapic_entries =NULL ;
xen/include/xen/iommu.h +7 -1
@@ -54,7 +54,7 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; -extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; +extern bool_t iommu_snoop, iommu_qinval;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {
@@ -74,6 +74,12 @@ extern enum __packed iommu_intremap {# define iommu_intremap false#endif +#if defined(CONFIG_X86 ) && defined(CONFIG_HVM ) +extern bool iommu_intpost; +#else +# define iommu_intpost false +#endif +#if defined(CONFIG_IOMMU_FORCE_PT_SHARE )#define iommu_hap_pt_share true#elif defined(CONFIG_HVM )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
Quoted 125 lines
From: Jan Beulich <[email protected]>
Sent: Monday, March 9, 2020 6:43 PMProvide a #define for all other cases.
Signed-off-by Jan Beulich <[email protected]>---
v2: Refine doc adjustment.docs/misc/xen-command-line.pandoc +2
-0@@ -1309,6 +1309,8 @@ boolean (e.g. `iommu=no`) can override t This option depends on `intremap`, and is disabled by default due to some corner cases in the implementation which have yet to be resolved. + This option is only valid on x86, and only builds of Xen with HVM support. + * The `crash-disable` boolean controls disabling IOMMU functionality (DMAR/IR/QI) before switching to a crash kernel. This option is inactive by default andis for compatibility with older kdump kernels only. Modern kernels copy
xen/drivers/passthrough/iommu.c +8
-9@@ -43,14 +43,6 @@ bool __read_mostly iommu_hwdom_passthrou bool __hwdom_initdata iommu_hwdom_inclusive; int8_t __hwdom_initdata iommu_hwdom_reserved = -1; -/* -* In the current implementation of VT-d posted interrupts, in some extreme -* cases, the per cpu list which saves the blocked vCPU will be very long, -* and this will affect the interrupt latency, so let this feature off by -* default until we find a good solution to resolve it. -*/ -bool_t __read_mostly iommu_intpost; -#ifndef iommu_hap_pt_sharebool __read_mostly iommu_hap_pt_share = true;#endif @@ -93,8 +85,10 @@ static int __init parse_iommu_param(cons else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;#endif +#ifndef iommu_intpost else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val; +#endif #ifdef CONFIG_KEXEC else if ( (val = parse_boolean("crash-disable", s, ss)) >= 0 ) iommu_crash_disable = val;@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" ); +#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ; +#endif printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" );if ( !iommu_enabled )@@ -563,10 +559,13 @@ void iommu_crash_shutdown(void)if ( iommu_enabled )iommu_get_ops ()->crash_shutdown (); - iommu_enabled = iommu_intpost =0 ; + iommu_enabled = false;#ifndef iommu_intremap iommu_intremap = iommu_intremap_off;#endif +#ifndef iommu_intpost + iommu_intpost = false; +#endif }int iommu_get_reserved_device_memory (iommu_grdm_t *func,void *ctxt)xen/drivers/passthrough/vtd/iommu.c +8
-2@@ -2297,13 +2297,15 @@ static int __init vtd_setup(void)if ( iommu_intremap && !ecap_intr_remap (iommu->ecap) ) iommu_intremap = iommu_intremap_off; +#ifndef iommu_intpost/* * We cannot use posted interrupt if X86_FEATURE_CX16 is * not supported, since we count on this feature to * atomically update 16-byte IRTE in posted format. */ if ( !cap_intr_post (iommu->cap) || !iommu_intremap || !cpu_has_cx16 ) - iommu_intpost =0 ; + iommu_intpost = false; +#endif if ( !vtd_ept_page_compatible (iommu) )clear_iommu_hap_pt_share ();@@ -2330,7 +2332,9 @@ static int __init vtd_setup(void)P (iommu_hwdom_passthrough,"Dom0 DMA Passthrough" );P (iommu_qinval,"Queued Invalidation" );P (iommu_intremap,"Interrupt Remapping" ); +#ifndef iommu_intpostP (iommu_intpost,"Posted Interrupt" ); +#endif P (iommu_hap_pt_share,"Shared EPT tables" );#undef P@@ -2348,7 +2352,9 @@ static int __init vtd_setup(void) iommu_hwdom_passthrough = false; iommu_qinval =0 ; iommu_intremap = iommu_intremap_off; - iommu_intpost =0 ; +#ifndef iommu_intpost + iommu_intpost = false; +#endif return ret; }xen/drivers/passthrough/x86/iommu.c +3
-0@@ -29,6 +29,16 @@ struct iommu_ops __read_mostly iommu_opsenum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +#ifndef iommu_intpost +/* +* In the current implementation of VT-d posted interrupts, in some
Quoted 5 lines
extreme
+ * cases, the per cpu list which saves the blocked vCPU will be very long,
+ * and this will affect the interrupt latency, so let this feature off by
+ * default until we find a good solution to resolve it.
+ */
Is above comment really VT-d specific? may take this chance to refine it together.
Quoted 20 lines
xen/drivers/passthrough/x86/iommu.c +3
-0+bool __read_mostly iommu_intpost; +#endif +int __init iommu_hardware_setup (void ) {struct IO_APIC_route_entry **ioapic_entries =NULL ;xen/include/xen/iommu.h +1
-1@@ -54,7 +54,7 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; -extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; +extern bool_t iommu_snoop, iommu_qinval;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {@@ -74,6 +74,12 @@ extern enum __packed iommu_intremap {# define iommu_intremap false#endif
xen/include/xen/iommu.h extern enum __packed iommu_intremap { · line 85
Quoted 10 lines
xen/include/xen/iommu.h +6
-0+#if defined(CONFIG_X86 ) && defined(CONFIG_HVM ) +extern bool iommu_intpost; +#else +# define iommu_intpost false +#endif +#if defined(CONFIG_IOMMU_FORCE_PT_SHARE )#define iommu_hap_pt_share true#elif defined(CONFIG_HVM )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
Quoted 10 lines · Kevin
Quoted 10 lines
From: Jan Beulich <[email protected]>
Sent: Monday, March 9, 2020 6:43 PMxen/drivers/passthrough/x86/iommu.c +0
-0@@ -29,6 +29,16 @@ struct iommu_ops __read_mostly iommu_opsenum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
Quoted 11 lines
Quoted 8 lines
xen/drivers/passthrough/x86/iommu.c +3
-0+#ifndef iommu_intpost +/* +* In the current implementation of VT-d posted interrupts, in some extreme
+ * cases, the per cpu list which saves the blocked vCPU will be very long,
+ * and this will affect the interrupt latency, so let this feature off by
+ * default until we find a good solution to resolve it.
+ */Is above comment really VT-d specific? may take this chance to refine it together.
At the moment it is, as we still don't have any AMD side counterpart code.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
In reply to Jan BeulichQuoted 56 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:43
To: [email protected]
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH v2 2/5] IOMMU:iommu_intpostis x86/HVM-onlyProvide a #define for all other cases.
Signed-off-by Jan Beulich <[email protected]>---
v2: Refine doc adjustment.docs/misc/xen-command-line.pandoc +2
-0@@ -1309,6 +1309,8 @@ boolean (e.g. `iommu=no`) can override t This option depends on `intremap`, and is disabled by default due to some corner cases in the implementation which have yet to be resolved. + This option is only valid on x86, and only builds of Xen with HVM support. + * The `crash-disable` boolean controls disabling IOMMU functionality (DMAR/IR/QI) before switching to a crash kernel. This option is inactive by default and is for compatibility with older kdump kernels only. Modern kernels copyxen/drivers/passthrough/iommu.c +2
-8@@ -43,14 +43,6 @@ bool __read_mostly iommu_hwdom_passthrou bool __hwdom_initdata iommu_hwdom_inclusive; int8_t __hwdom_initdata iommu_hwdom_reserved = -1; -/* -* In the current implementation of VT-d posted interrupts, in some extreme -* cases, the per cpu list which saves the blocked vCPU will be very long, -* and this will affect the interrupt latency, so let this feature off by -* default until we find a good solution to resolve it. -*/ -bool_t __read_mostly iommu_intpost; -#ifndef iommu_hap_pt_sharebool __read_mostly iommu_hap_pt_share = true;#endif @@ -93,8 +85,10 @@ static int __init parse_iommu_param(cons else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;#endif +#ifndef iommu_intpost else if ( (val = parse_boolean("intpost", s, ss)) >= 0 ) iommu_intpost = val; +#endif #ifdef CONFIG_KEXEC else if ( (val = parse_boolean("crash-disable", s, ss)) >= 0 ) iommu_crash_disable = val;
xen/drivers/passthrough/iommu.c int __init iommu_setup(void) · line 485
Quoted 6 lines
xen/drivers/passthrough/iommu.c +1
-0@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" ); +#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ;
Nit: 0 -> false
With that fixed...
Quoted 92 lines
xen/drivers/passthrough/iommu.c +5
-1+#endif printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" );if ( !iommu_enabled )@@ -563,10 +559,13 @@ void iommu_crash_shutdown(void)if ( iommu_enabled )iommu_get_ops ()->crash_shutdown (); - iommu_enabled = iommu_intpost =0 ; + iommu_enabled = false;#ifndef iommu_intremap iommu_intremap = iommu_intremap_off;#endif +#ifndef iommu_intpost + iommu_intpost = false; +#endif }int iommu_get_reserved_device_memory (iommu_grdm_t *func,void *ctxt)xen/drivers/passthrough/vtd/iommu.c +8
-2@@ -2297,13 +2297,15 @@ static int __init vtd_setup(void)if ( iommu_intremap && !ecap_intr_remap (iommu->ecap) ) iommu_intremap = iommu_intremap_off; +#ifndef iommu_intpost/* * We cannot use posted interrupt if X86_FEATURE_CX16 is * not supported, since we count on this feature to * atomically update 16-byte IRTE in posted format. */ if ( !cap_intr_post (iommu->cap) || !iommu_intremap || !cpu_has_cx16 ) - iommu_intpost =0 ; + iommu_intpost = false; +#endif if ( !vtd_ept_page_compatible (iommu) )clear_iommu_hap_pt_share ();@@ -2330,7 +2332,9 @@ static int __init vtd_setup(void)P (iommu_hwdom_passthrough,"Dom0 DMA Passthrough" );P (iommu_qinval,"Queued Invalidation" );P (iommu_intremap,"Interrupt Remapping" ); +#ifndef iommu_intpostP (iommu_intpost,"Posted Interrupt" ); +#endif P (iommu_hap_pt_share,"Shared EPT tables" );#undef P@@ -2348,7 +2352,9 @@ static int __init vtd_setup(void) iommu_hwdom_passthrough = false; iommu_qinval =0 ; iommu_intremap = iommu_intremap_off; - iommu_intpost =0 ; +#ifndef iommu_intpost + iommu_intpost = false; +#endif return ret; }xen/drivers/passthrough/x86/iommu.c +10
-0@@ -29,6 +29,16 @@ struct iommu_ops __read_mostly iommu_opsenum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +#ifndef iommu_intpost +/* +* In the current implementation of VT-d posted interrupts, in some extreme +* cases, the per cpu list which saves the blocked vCPU will be very long, +* and this will affect the interrupt latency, so let this feature off by +* default until we find a good solution to resolve it. +*/ +bool __read_mostly iommu_intpost; +#endif +int __init iommu_hardware_setup (void ) {struct IO_APIC_route_entry **ioapic_entries =NULL ;xen/include/xen/iommu.h +1
-1@@ -54,7 +54,7 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; -extern bool_t iommu_snoop, iommu_qinval, iommu_intpost; +extern bool_t iommu_snoop, iommu_qinval;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {@@ -74,6 +74,12 @@ extern enum __packed iommu_intremap {# define iommu_intremap false#endif
xen/include/xen/iommu.h extern enum __packed iommu_intremap { · line 85
Quoted 10 lines
xen/include/xen/iommu.h +6
-0+#if defined(CONFIG_X86 ) && defined(CONFIG_HVM ) +extern bool iommu_intpost; +#else +# define iommu_intpost false +#endif +#if defined(CONFIG_IOMMU_FORCE_PT_SHARE )#define iommu_hap_pt_share true#elif defined(CONFIG_HVM )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
Quoted 8 lines · Paul Durrant
Quoted 8 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:43xen/drivers/passthrough/iommu.c +0
-0@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" );
Quoted 5 lines
xen/drivers/passthrough/iommu.c int __init iommu_setup(void) · line 485
Quoted 3 lines
xen/drivers/passthrough/iommu.c +1
-0+#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ;Nit: 0 -> false
Hmm, I'm not touching this line, and the goal of the patch isn't to (also) switch _all_ assignments to the variable. There is at least one more (in vmcs.c), and doing the adjustment here (as being not otherwise motivated, e.g. because of touching the line anyway) would then, for consistency, seem to call for correcting that other instance too. This, however, would seem too unrelated a change to make here for my taste. Hence ...
Quoted 3 lines
With that fixed...
Reviewed-by Paul Durrant <[email protected]>
... please clarify whether I may leave the line untouched.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
Quoted 19 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 10 March 2020 11:02
To: [email protected]
Cc: [email protected]; 'Kevin Tian' <[email protected]>; 'Stefano Stabellini' <[email protected]>; 'Julien Grall' <[email protected]>; 'Wei Liu' <[email protected]>; 'Konrad Wilk' <[email protected]>; 'George Dunlap' <[email protected]>; 'Andrew Cooper' <[email protected]>; 'Ian Jackson' <[email protected]>
Subject: Re: [PATCH v2 2/5] IOMMU:iommu_intpostis x86/HVM-onlyQuoted 8 lines · Paul Durrant
Quoted 8 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:43xen/drivers/passthrough/iommu.c +0
-0@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" );
Quoted 8 lines
Quoted 5 lines
xen/drivers/passthrough/iommu.c int __init iommu_setup(void) · line 485
Quoted 3 lines
xen/drivers/passthrough/iommu.c +1
-0+#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ;Nit: 0 -> false
Hmm, I'm not touching this line, and the goal of the patch isn't to (also) switch _all_ assignments to the variable.
Yes, but it is in context and you normally ask for fix-ups where they are in context. In this case it’s a pretty trivial addition to the patch.
Quoted 5 lines
There is at
least one more (invmcs.c), and doing the adjustment here (as being not otherwise motivated, e.g. because of touching the line anyway) would then, for consistency, seem to call for correcting that other instance too.
No, I'm not suggesting a wholesale conversion (although I'm not against it)... just tidying as we go.
Quoted 8 lines
This, however, would seem too unrelated
a change to make here for my taste. Hence ...Quoted 3 lines
With that fixed...
Reviewed-by Paul Durrant <[email protected]>... please clarify whether I may leave the line untouched.
Since it's in context I'd prefer it fixed, but I'm not going to insist so you can keep the R-b.
Paul
Quoted 2 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 2/5] IOMMU: iommu_intpost is x86/HVM-only
Quoted 25 lines · Paul Durrant
Quoted 25 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 10 March 2020 11:02
To: [email protected]
Cc: [email protected]; 'Kevin Tian' <[email protected]>; 'Stefano Stabellini' <[email protected]>; 'Julien Grall' <[email protected]>; 'Wei Liu' <[email protected]>; 'Konrad Wilk' <[email protected]>; 'George Dunlap' <[email protected]>; 'Andrew Cooper' <[email protected]>; 'Ian Jackson' <[email protected]>
Subject: Re: [PATCH v2 2/5] IOMMU:iommu_intpostis x86/HVM-onlyQuoted 13 lines · Paul Durrant
xen/drivers/passthrough/iommu.c int __init iommu_setup(void) · line 485
Quoted 11 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:43xen/drivers/passthrough/iommu.c +1
-0@@ -486,8 +480,10 @@ int __init iommu_setup(void)panic ("Couldn't enable %s and iommu=required/force\n" , !iommu_enabled ?"IOMMU" :"Interrupt Remapping" ); +#ifndef iommu_intpostif ( !iommu_intremap ) iommu_intpost =0 ;Nit: 0 -> false
Quoted 5 lines
Quoted 2 lines
Hmm, I'm not touching this line, and the goal of the patch isn't to (also) switch _all_ assignments to the variable.
Yes, but it is in context and you normally ask for fix-ups where they are in context. In this case it’s a pretty trivial addition to the patch.
Hmm, I now notice that in another place I already do such an in-context adjustment, so I'll do so here too. Normally I (try to) restrict such (requests) to lines touched anyway.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/5 IOMMU: iommu_igfx is x86-only
In reply to Jan BeulichIn fact it's VT-d specific, but we don't have a way yet to build code for just one vendor.
xen/drivers/passthrough/iommu.c +2 -1
@@ -32,7 +32,6 @@ bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true; -bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_crash_disable;
@@ -73,8 +72,10 @@ static int __init parse_iommu_param(cons force_iommu = val; else if ( (val = parse_boolean("quarantine", s, ss)) >= 0 ) iommu_quarantine = val; +#ifdef CONFIG_X86 else if ( (val = parse_boolean("igfx", s, ss)) >= 0 ) iommu_igfx = val; +#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; else if ( (val = parse_boolean("snoop", s, ss)) >= 0 )
xen/drivers/passthrough/vtd/iommu.c +2 -0
@@ -50,6 +50,8 @@ struct mapped_rmrr {/* Possible unfiltered LAPIC/MSI messages from untrusted sources? */ bool __read_mostly untrusted_msi; +bool __read_mostly iommu_igfx = true; +int nr_iommus;static struct tasklet vtd_fault_tasklet;
xen/include/xen/iommu.h +2 -1
@@ -53,7 +53,7 @@ static inline bool_t dfn_eq(dfn_t x, dfn }extern bool_t iommu_enable, iommu_enabled; -extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; +extern bool force_iommu, iommu_quarantine, iommu_verbose;extern bool_t iommu_snoop, iommu_qinval;#ifdef CONFIG_X86
@@ -70,6 +70,7 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted, iommu_intremap_full, } iommu_intremap; +extern bool iommu_igfx;#else # define iommu_intremap false#endif
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 3/5] IOMMU: iommu_igfx is x86-only
Quoted 10 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:44
To: [email protected]
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH v2 3/5] IOMMU:iommu_igfxis x86-only
Quoted 4 lines
In fact it's VT-d specific, but we don't have a way yet to build code for just one vendor.
Signed-off-by Jan Beulich <[email protected]>
Quoted 45 lines
xen/drivers/passthrough/iommu.c +2
-1@@ -32,7 +32,6 @@ bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true; -bool_t __read_mostly iommu_igfx =1 ;bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_crash_disable;@@ -73,8 +72,10 @@ static int __init parse_iommu_param(cons force_iommu = val; else if ( (val = parse_boolean("quarantine", s, ss)) >= 0 ) iommu_quarantine = val; +#ifdef CONFIG_X86 else if ( (val = parse_boolean("igfx", s, ss)) >= 0 ) iommu_igfx = val; +#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; else if ( (val = parse_boolean("snoop", s, ss)) >= 0 )xen/drivers/passthrough/vtd/iommu.c +2
-0@@ -50,6 +50,8 @@ struct mapped_rmrr {/* Possible unfiltered LAPIC/MSI messages from untrusted sources? */ bool __read_mostly untrusted_msi; +bool __read_mostly iommu_igfx = true; +int nr_iommus;static struct tasklet vtd_fault_tasklet;xen/include/xen/iommu.h +1
-1@@ -53,7 +53,7 @@ static inline bool_t dfn_eq(dfn_t x, dfn }extern bool_t iommu_enable, iommu_enabled; -extern bool force_iommu, iommu_quarantine, iommu_verbose, iommu_igfx; +extern bool force_iommu, iommu_quarantine, iommu_verbose;extern bool_t iommu_snoop, iommu_qinval;#ifdef CONFIG_X86
xen/include/xen/iommu.h extern enum __packed iommu_intremap { · line 76
Quoted 7 lines
xen/include/xen/iommu.h +1
-0@@ -70,6 +70,7 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted, iommu_intremap_full, } iommu_intremap; +extern bool iommu_igfx;#else # define iommu_intremap false#endif
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 4/5 IOMMU: iommu_qinval is x86-only
In reply to Jan BeulichIn fact it's VT-d specific, but we don't have a way yet to build code for just one vendor.
xen/drivers/passthrough/iommu.c +2 -3
@@ -33,7 +33,6 @@ bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true;bool_t __read_mostly iommu_snoop =1 ; -bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;
@@ -75,13 +74,13 @@ static int __init parse_iommu_param(cons#ifdef CONFIG_X86 else if ( (val = parse_boolean("igfx", s, ss)) >= 0 ) iommu_igfx = val; + else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) + iommu_qinval = val;#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; else if ( (val = parse_boolean("snoop", s, ss)) >= 0 ) iommu_snoop = val; - else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) - iommu_qinval = val;#ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;
xen/drivers/passthrough/vtd/iommu.c +1 -0
@@ -51,6 +51,7 @@ struct mapped_rmrr {bool __read_mostly untrusted_msi;bool __read_mostly iommu_igfx = true; +bool __read_mostly iommu_qinval = true;int nr_iommus;
xen/include/xen/iommu.h +2 -2
@@ -54,7 +54,7 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose; -extern bool_t iommu_snoop, iommu_qinval; +extern bool_t iommu_snoop;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {
@@ -70,7 +70,7 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted, iommu_intremap_full, } iommu_intremap; -extern bool iommu_igfx; +extern bool iommu_igfx, iommu_qinval;#else # define iommu_intremap false#endif
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 4/5] IOMMU: iommu_qinval is x86-only
Quoted 10 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:44
To: [email protected]
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH v2 4/5] IOMMU:iommu_qinvalis x86-only
Quoted 4 lines
In fact it's VT-d specific, but we don't have a way yet to build code for just one vendor.
Signed-off-by Jan Beulich <[email protected]>
Quoted 49 lines
xen/drivers/passthrough/iommu.c +2
-3@@ -33,7 +33,6 @@ bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true;bool_t __read_mostly iommu_snoop =1 ; -bool_t __read_mostly iommu_qinval =1 ;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;@@ -75,13 +74,13 @@ static int __init parse_iommu_param(cons#ifdef CONFIG_X86 else if ( (val = parse_boolean("igfx", s, ss)) >= 0 ) iommu_igfx = val; + else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) + iommu_qinval = val;#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; else if ( (val = parse_boolean("snoop", s, ss)) >= 0 ) iommu_snoop = val; - else if ( (val = parse_boolean("qinval", s, ss)) >= 0 ) - iommu_qinval = val;#ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;xen/drivers/passthrough/vtd/iommu.c +1
-0@@ -51,6 +51,7 @@ struct mapped_rmrr {bool __read_mostly untrusted_msi;bool __read_mostly iommu_igfx = true; +bool __read_mostly iommu_qinval = true;int nr_iommus;xen/include/xen/iommu.h +1
-1@@ -54,7 +54,7 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose; -extern bool_t iommu_snoop, iommu_qinval; +extern bool_t iommu_snoop;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {
xen/include/xen/iommu.h extern enum __packed iommu_intremap { · line 76
Quoted 8 lines
xen/include/xen/iommu.h +1
-1@@ -70,7 +70,7 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted, iommu_intremap_full, } iommu_intremap; -extern bool iommu_igfx; +extern bool iommu_igfx, iommu_qinval;#else # define iommu_intremap false#endif
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 5/5 IOMMU: iommu_snoop is x86-only
In reply to Jan BeulichIn fact it's VT-d specific, but we don't have a way yet to build code for just one vendor. Provide a #define for the opposite case.
---
v2: The option isn't HVM-specific, after all.
xen/drivers/passthrough/iommu.c +5 -2
@@ -32,7 +32,6 @@ bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true; -bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;
@@ -79,8 +78,10 @@ static int __init parse_iommu_param(cons#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; +#ifndef iommu_snoop else if ( (val = parse_boolean("snoop", s, ss)) >= 0 ) iommu_snoop = val; +#endif #ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;
@@ -488,7 +489,9 @@ int __init iommu_setup(void)printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" );if ( !iommu_enabled ) { - iommu_snoop =0 ; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_hwdom_strict = false; }
xen/drivers/passthrough/vtd/iommu.c +11 -2
@@ -52,6 +52,9 @@ bool __read_mostly untrusted_msi;bool __read_mostly iommu_igfx = true;bool __read_mostly iommu_qinval = true; +#ifndef iommu_snoop +bool __read_mostly iommu_snoop = true; +#endif int nr_iommus;
@@ -2288,8 +2291,10 @@ static int __init vtd_setup(void)cap_sps_2mb (iommu->cap) ?", 2MB" :"" , cap_sps_1gb(iommu->cap) ? ", 1GB" : ""); +#ifndef iommu_snoopif ( iommu_snoop && !ecap_snp_ctl (iommu->ecap) ) - iommu_snoop =0 ; + iommu_snoop = false; +#endif if ( iommu_hwdom_passthrough && !ecap_pass_thru (iommu->ecap) ) iommu_hwdom_passthrough = false;
@@ -2331,7 +2336,9 @@ static int __init vtd_setup(void) }#define P (p,s) printk("Intel VT-d %s %senabled.\n", s, (p)? "" : "not ") +#ifndef iommu_snoopP (iommu_snoop,"Snoop Control" ); +#endif P (iommu_hwdom_passthrough,"Dom0 DMA Passthrough" );P (iommu_qinval,"Queued Invalidation" );P (iommu_intremap,"Interrupt Remapping" );
@@ -2351,7 +2358,9 @@ static int __init vtd_setup(void) error: iommu_enabled =0 ; - iommu_snoop =0 ; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_qinval =0 ; iommu_intremap = iommu_intremap_off;
xen/include/xen/iommu.h +2 -2
@@ -54,7 +54,6 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose; -extern bool_t iommu_snoop;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {
@@ -70,9 +69,10 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted, iommu_intremap_full, } iommu_intremap; -extern bool iommu_igfx, iommu_qinval; +extern bool iommu_igfx, iommu_qinval, iommu_snoop;#else # define iommu_intremap false +# define iommu_snoop false#endif #if defined(CONFIG_X86 ) && defined(CONFIG_HVM )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2 5/5] IOMMU: iommu_snoop is x86-only
Quoted 10 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 09 March 2020 10:45
To: [email protected]
Cc: Kevin Tian <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Wei Liu <[email protected]>; Konrad Wilk <[email protected]>; George Dunlap <[email protected]>; Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Paul Durrant <[email protected]>
Subject: [PATCH v2 5/5] IOMMU:iommu_snoopis x86-only
Quoted 4 lines
In fact it's VT-d specific, but we don't have a way yet to build code for just one vendor. Provide a #define for the opposite case.
Signed-off-by Jan Beulich <[email protected]>
Quoted 92 lines
---
v2: The option isn't HVM-specific, after all.xen/drivers/passthrough/iommu.c +5
-2@@ -32,7 +32,6 @@ bool_t __read_mostly iommu_enabled;bool_t __read_mostly force_iommu;bool_t __read_mostly iommu_verbose;bool __read_mostly iommu_quarantine = true; -bool_t __read_mostly iommu_snoop =1 ;bool_t __read_mostly iommu_crash_disable; static bool __hwdom_initdata iommu_hwdom_none;@@ -79,8 +78,10 @@ static int __init parse_iommu_param(cons#endif else if ( (val = parse_boolean("verbose", s, ss)) >= 0 ) iommu_verbose = val; +#ifndef iommu_snoop else if ( (val = parse_boolean("snoop", s, ss)) >= 0 ) iommu_snoop = val; +#endif #ifndef iommu_intremap else if ( (val = parse_boolean("intremap", s, ss)) >= 0 ) iommu_intremap = val ? iommu_intremap_full : iommu_intremap_off;@@ -488,7 +489,9 @@ int __init iommu_setup(void)printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" );if ( !iommu_enabled ) { - iommu_snoop =0 ; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_hwdom_strict = false; }xen/drivers/passthrough/vtd/iommu.c +11
-2@@ -52,6 +52,9 @@ bool __read_mostly untrusted_msi;bool __read_mostly iommu_igfx = true;bool __read_mostly iommu_qinval = true; +#ifndef iommu_snoop +bool __read_mostly iommu_snoop = true; +#endif int nr_iommus;@@ -2288,8 +2291,10 @@ static int __init vtd_setup(void)cap_sps_2mb (iommu->cap) ?", 2MB" :"" , cap_sps_1gb(iommu->cap) ? ", 1GB" : ""); +#ifndef iommu_snoopif ( iommu_snoop && !ecap_snp_ctl (iommu->ecap) ) - iommu_snoop =0 ; + iommu_snoop = false; +#endif if ( iommu_hwdom_passthrough && !ecap_pass_thru (iommu->ecap) ) iommu_hwdom_passthrough = false;@@ -2331,7 +2336,9 @@ static int __init vtd_setup(void) }#define P (p,s) printk("Intel VT-d %s %senabled.\n", s, (p)? "" : "not ") +#ifndef iommu_snoopP (iommu_snoop,"Snoop Control" ); +#endif P (iommu_hwdom_passthrough,"Dom0 DMA Passthrough" );P (iommu_qinval,"Queued Invalidation" );P (iommu_intremap,"Interrupt Remapping" );@@ -2351,7 +2358,9 @@ static int __init vtd_setup(void) error: iommu_enabled =0 ; - iommu_snoop =0 ; +#ifndef iommu_snoop + iommu_snoop = false; +#endif iommu_hwdom_passthrough = false; iommu_qinval =0 ; iommu_intremap = iommu_intremap_off;xen/include/xen/iommu.h +0
-1@@ -54,7 +54,6 @@ static inline bool_t dfn_eq(dfn_t x, dfnextern bool_t iommu_enable, iommu_enabled;extern bool force_iommu, iommu_quarantine, iommu_verbose; -extern bool_t iommu_snoop;#ifdef CONFIG_X86 extern enum __packed iommu_intremap {@@ -70,9 +69,10 @@ extern enum __packed iommu_intremap { iommu_intremap_restricted,
xen/include/xen/iommu.h extern enum __packed iommu_intremap { · line 78
Quoted 10 lines
xen/include/xen/iommu.h +2
-1iommu_intremap_full, } iommu_intremap; -extern bool iommu_igfx, iommu_qinval; +extern bool iommu_igfx, iommu_qinval, iommu_snoop;#else # define iommu_intremap false +# define iommu_snoop false#endif #if defined(CONFIG_X86 ) && defined(CONFIG_HVM )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 15 lines
From: Jan Beulich <[email protected]>
Sent: Monday, March 9, 2020 6:40 PMA number of the command line controlled variables are x86- or even x86-HVM-specific. Don't have those variables elsewhere in the first place (in some cases replace them by a #define), and as a result also don't silently accept such "iommu=" sub-options which in fact have no effect.
1:
iommu_intremapis x86-only
2:iommu_intpostis x86/HVM-only
3:iommu_igfxis x86-only
4:iommu_qinvalis x86-only
5:iommu_snoopis x86-only
Quoted 6 lines
The series contextually depends on "AMD/IOMMU: without XT, x2APIC needs to be forced into physical mode"
v2 addresses review comments, at least as far as agreement was reached. See individual patches.
series.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel