xen: Add global irq_vector_map option, set if using AMD global intremap tables
PATCH 1/1 xen: Add global irq_vector_map option, set if using AMD global intremap tables
As mentioned in previous changesets, AMD IOMMU interrupt remapping tables only look at the vector, not the destination id of an interrupt. This means that all IRQs going through the same interrupt remapping table need to *not* share vectors.
The irq "vector map" functionality was originally introduced after a patch which disabled global AMD IOMMUs entirely. That patch has since been reverted, meaning that AMD intremap tables can either be per-device or global.
This patch therefore introduces a global irq vector map option, and enables it if we're using an AMD IOMMU with a global interrupt remapping table.
This patch removes the "irq-perdev-vector-map" boolean command-line optino and replaces it with "irq_vector_map", which can have one of three values: none, global, or per-device.
Setting the irq_vector_map to any value will override the default that the AMD code sets.
docs/src/user.tex +4 -0
@@ -2280,6 +2280,10 @@ writing to the VGA console after domain \item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of vcpu migration in microseconds (default 0). This parameter avoids agressive vcpu migration. For example, the linux kernel uses 0.5ms by default. +\item [ irq_vector_map=xxx ] Enable irq vector non-sharing maps. Setting 'global' + will ensure that no IRQs will share vectors. Setting 'per-device' will ensure + that no IRQs from the same device will share vectors. Setting to 'none' will + disable it entirely, overriding any defaults the IOMMU code may set. \end{description} In addition, the following options may be specified on the Xen command
xen/arch/x86/irq.c +103 -11
191 lines not on this page · raw message
xen/drivers/passthrough/amd/pci_amd_iommu.c +24 -7
@@ -167,18 +167,35 @@ int __init amd_iov_detect(void)return -ENODEV ; } -/* Enable use of per-device vector map unless otherwise -* specified */ -if ( iommu_amd_perdev_vector_map ) +/* +* AMD IOMMUs don't distinguish between vectors destined for +* different cpus when doing interrupt remapping. This means +* that interrupts going through the same intremap table +* can't share the same vector. +* +* If irq_vector_map isn't specified, choose a sensible default: +* - If we're using per-device interemap tables, per-device +* vector non-sharing maps +* - If we're using a global interemap table, global vector +* non-sharing map +*/ +if ( opt_irq_vector_map ==OPT_IRQ_VECTOR_MAP_DEFAULT ) { -printk ("AMD-Vi: Enabling per-device vector maps\n" ); - opt_irq_perdev_vector_map=1 ; +if ( amd_iommu_perdev_intremap ) + { +printk ("AMD-Vi: Enabling per-device vector maps\n" ); + opt_irq_vector_map =OPT_IRQ_VECTOR_MAP_PERDEV ; + } +else + { +printk ("AMD-Vi: Enabling global vector map\n" ); + opt_irq_vector_map =OPT_IRQ_VECTOR_MAP_GLOBAL ; + } }else { -printk ("AMD-Vi: WARNING - not enabling per-device vector maps\n" ); +printk ("AMD-Vi: Not overriding irq_vector_map setting\n" ); } -return scan_pci_devices (); }
xen/include/asm-x86/irq.h +7 -0
@@ -46,6 +46,13 @@ extern u8 *irq_vector;extern bool_t opt_noirqbalance; +#define OPT_IRQ_VECTOR_MAP_DEFAULT 0/* Do the default thing */ +#define OPT_IRQ_VECTOR_MAP_NONE 1/* None */ +#define OPT_IRQ_VECTOR_MAP_GLOBAL 2/* One global vector map (no vector sharing) */ +#define OPT_IRQ_VECTOR_MAP_PERDEV 3/* Per-device vetor map (no vector sharing w/in a device) */ + +extern int opt_irq_vector_map; +/* * Per-cpu current frame pointer - the location of the last exception frame on * the stack