diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 8084862f60..d09f35723a 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1137,7 +1137,7 @@ detection of systems known to misbehave upon accesses to that port. > Default: `new` unless directed-EOI is supported ### iommu -> `= List of [ | force | required | intremap | intpost | qinval | snoop | sharept | dom0-passthrough | dom0-strict | amd-iommu-perdev-intremap | workaround_bios_bug | igfx | crash-disable | verbose | debug ]` +> `= List of [ | force | required | quarantine | intremap | intpost | qinval | snoop | sharept | dom0-passthrough | dom0-strict | amd-iommu-perdev-intremap | workaround_bios_bug | igfx | crash-disable | verbose | debug ]` > Sub-options: @@ -1157,6 +1157,15 @@ detection of systems known to misbehave upon accesses to that port. >> Don't continue booting unless IOMMU support is found and can be initialized >> successfully. +> `quarantine` + +> Default: `true` + +>> Control Xen's behavior when de-assigning devices from guests. If enabled, +>> Xen always quarantines such devices; they must be explicitly assigned back +>> to Dom0 before they can be used there again. If disabled, Xen will only +>> quarantine devices the toolstack hass arranged for getting quarantined. + > `intremap` > Default: `true` diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 8027d96f1c..132bbb3762 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -52,6 +52,7 @@ custom_param("iommu", parse_iommu_param); bool_t __initdata iommu_enable = 1; bool_t __read_mostly iommu_enabled; bool_t __read_mostly force_iommu; +bool __read_mostly iommu_quarantine = true; bool_t __hwdom_initdata iommu_dom0_strict; bool_t __read_mostly iommu_verbose; bool_t __read_mostly iommu_workaround_bios_bug; @@ -99,6 +100,8 @@ static int __init parse_iommu_param(const char *s) else if ( !cmdline_strcmp(s, "force") || !cmdline_strcmp(s, "required") ) force_iommu = val; + else if ( !cmdline_strcmp(s, "quarantine") ) + iommu_quarantine = val; else if ( !cmdline_strcmp(s, "workaround_bios_bug") ) iommu_workaround_bios_bug = val; else if ( !cmdline_strcmp(s, "igfx") ) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b7b8aea9a3..482ee1633e 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1511,7 +1511,8 @@ int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn) return -ENODEV; /* De-assignment from dom_io should de-quarantine the device */ - target = (pdev->quarantine && pdev->domain != dom_io) ? + target = ((pdev->quarantine || iommu_quarantine) && + pdev->domain != dom_io) ? dom_io : hardware_domain; while ( pdev->phantom_stride ) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 33c8b221dc..235d2a620b 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -29,7 +29,7 @@ #include extern bool_t iommu_enable, iommu_enabled; -extern bool_t force_iommu, iommu_verbose; +extern bool force_iommu, iommu_quarantine, iommu_verbose; extern bool_t iommu_workaround_bios_bug, iommu_igfx, iommu_passthrough; extern bool_t iommu_snoop, iommu_qinval, iommu_intremap, iommu_intpost; extern bool_t iommu_hap_pt_share;