don't allow Dom0 access to IOMMUs' MMIO pages
PATCH 1/1 don't allow Dom0 access to IOMMUs' MMIO pages
Just like for LAPIC, IO-APIC, MSI, and HT we shouldn't be granting Dom0 access to these. This implicitly results in these pages also getting marked reserved in the machine memory map Dom0 uses to determine the ranges where PCI devices can have their MMIO ranges placed.
xen/drivers/passthrough/amd/pci_amd_iommu.c +8 -0
@@ -19,6 +19,7 @@*/ #include <xen/sched.h> +#include <xen/iocap.h> #include <xen/pci.h> #include <xen/pci_regs.h> #include <xen/paging.h>
@@ -283,6 +284,7 @@ static int amd_iommu_domain_init(struct static void __hwdom_init amd_iommu_hwdom_init(struct domain *d) {unsigned long i; +const struct amd_iommu *iommu;if ( !iommu_passthrough && !need_iommu (d) ) {
@@ -304,6 +306,12 @@ static void __hwdom_init amd_iommu_hwdom } } +for_each_amd_iommu ( iommu ) + if ( iomem_deny_access(d, PFN_DOWN(iommu->mmio_base_phys), + PFN_DOWN(iommu->mmio_base_phys + + IOMMU_MMIO_REGION_LENGTH - 1)) ) + BUG(); +setup_hwdom_pci_devices (d, amd_iommu_setup_hwdom_device); }
xen/drivers/passthrough/vtd/iommu.c +4 -0
@@ -23,6 +23,7 @@#include <xen/sched.h> #include <xen/xmalloc.h> #include <xen/domain_page.h> +#include <xen/iocap.h> #include <xen/iommu.h> #include <asm/hvm/iommu.h> #include <xen/numa.h>
@@ -1258,6 +1259,9 @@ static void __hwdom_init intel_iommu_hwdfor_each_drhd_unit ( drhd ) { +if (iomem_deny_access (d,PFN_DOWN (drhd->address), +PFN_DOWN (drhd->address)) ) +BUG ();iommu_enable_translation (drhd); } }
don't allow Dom0 access to IOMMUs' MMIO pages
Just like for LAPIC, IO-APIC, MSI, and HT we shouldn't be granting Dom0 access to these. This implicitly results in these pages also getting marked reserved in the machine memory map Dom0 uses to determine the ranges where PCI devices can have their MMIO ranges placed.
xen/drivers/passthrough/amd/pci_amd_iommu.c +8 -0
@@ -19,6 +19,7 @@*/ #include <xen/sched.h> +#include <xen/iocap.h> #include <xen/pci.h> #include <xen/pci_regs.h> #include <xen/paging.h>
@@ -283,6 +284,7 @@ static int amd_iommu_domain_init(struct static void __hwdom_init amd_iommu_hwdom_init(struct domain *d) {unsigned long i; +const struct amd_iommu *iommu;if ( !iommu_passthrough && !need_iommu (d) ) {
@@ -304,6 +306,12 @@ static void __hwdom_init amd_iommu_hwdom } } +for_each_amd_iommu ( iommu ) + if ( iomem_deny_access(d, PFN_DOWN(iommu->mmio_base_phys), + PFN_DOWN(iommu->mmio_base_phys + + IOMMU_MMIO_REGION_LENGTH - 1)) ) + BUG(); +setup_hwdom_pci_devices (d, amd_iommu_setup_hwdom_device); }
xen/drivers/passthrough/vtd/iommu.c +4 -0
@@ -23,6 +23,7 @@#include <xen/sched.h> #include <xen/xmalloc.h> #include <xen/domain_page.h> +#include <xen/iocap.h> #include <xen/iommu.h> #include <asm/hvm/iommu.h> #include <xen/numa.h>
@@ -1258,6 +1259,9 @@ static void __hwdom_init intel_iommu_hwdfor_each_drhd_unit ( drhd ) { +if (iomem_deny_access (d,PFN_DOWN (drhd->address), +PFN_DOWN (drhd->address)) ) +BUG ();iommu_enable_translation (drhd); } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines · Jan Beulich
Just like for LAPIC, IO-APIC, MSI, and HT we shouldn't be granting Dom0 access to these. This implicitly results in these pages also getting marked reserved in the machine memory map Dom0 uses to determine the ranges where PCI devices can have their MMIO ranges placed.
Signed-off-by Jan Beulich <[email protected]>
Quoted 57 lines
xen/drivers/passthrough/amd/pci_amd_iommu.c +8
-0@@ -19,6 +19,7 @@*/ #include <xen/sched.h> +#include <xen/iocap.h> #include <xen/pci.h> #include <xen/pci_regs.h> #include <xen/paging.h> @@ -283,6 +284,7 @@ static int amd_iommu_domain_init(struct static void __hwdom_init amd_iommu_hwdom_init(struct domain *d) {unsigned long i; +const struct amd_iommu *iommu;if ( !iommu_passthrough && !need_iommu (d) ) {@@ -304,6 +306,12 @@ static void __hwdom_init amd_iommu_hwdom } } +for_each_amd_iommu ( iommu ) + if ( iomem_deny_access(d, PFN_DOWN(iommu->mmio_base_phys), + PFN_DOWN(iommu->mmio_base_phys + + IOMMU_MMIO_REGION_LENGTH - 1)) ) + BUG(); +setup_hwdom_pci_devices (d, amd_iommu_setup_hwdom_device); }xen/drivers/passthrough/vtd/iommu.c +4
-0@@ -23,6 +23,7 @@#include <xen/sched.h> #include <xen/xmalloc.h> #include <xen/domain_page.h> +#include <xen/iocap.h> #include <xen/iommu.h> #include <asm/hvm/iommu.h> #include <xen/numa.h> @@ -1258,6 +1259,9 @@ static void __hwdom_init intel_iommu_hwdfor_each_drhd_unit ( drhd ) { +if (iomem_deny_access (d,PFN_DOWN (drhd->address), +PFN_DOWN (drhd->address)) ) +BUG ();iommu_enable_translation (drhd); } }
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, October 02, 2014 6:35 AMJust like for LAPIC, IO-APIC, MSI, and HT we shouldn't be granting Dom0 access to these. This implicitly results in these pages also getting marked reserved in the machine memory map Dom0 uses to determine the ranges where PCI devices can have their MMIO ranges placed.
Signed-off-by Jan Beulich <[email protected]>
Quoted 56 lines
xen/drivers/passthrough/amd/pci_amd_iommu.c +9
-0@@ -19,6 +19,7 @@*/ #include <xen/sched.h> +#include <xen/iocap.h> #include <xen/pci.h> #include <xen/pci_regs.h> #include <xen/paging.h> @@ -283,6 +284,7 @@ static int amd_iommu_domain_init(struct static void __hwdom_init amd_iommu_hwdom_init(struct domain *d) {unsigned long i; +const struct amd_iommu *iommu;if ( !iommu_passthrough && !need_iommu (d) ) {@@ -304,6 +306,12 @@ static void __hwdom_init amd_iommu_hwdom } } +for_each_amd_iommu ( iommu ) + if ( iomem_deny_access(d, PFN_DOWN(iommu->mmio_base_phys), + PFN_DOWN(iommu->mmio_base_phys + + IOMMU_MMIO_REGION_LENGTH - 1)) ) + BUG(); +setup_hwdom_pci_devices (d, amd_iommu_setup_hwdom_device); }xen/drivers/passthrough/vtd/iommu.c +4
-0@@ -23,6 +23,7 @@#include <xen/sched.h> #include <xen/xmalloc.h> #include <xen/domain_page.h> +#include <xen/iocap.h> #include <xen/iommu.h> #include <asm/hvm/iommu.h> #include <xen/numa.h> @@ -1258,6 +1259,9 @@ static void __hwdom_init intel_iommu_hwdfor_each_drhd_unit ( drhd ) { +if (iomem_deny_access (d,PFN_DOWN (drhd->address), +PFN_DOWN (drhd->address)) ) +BUG ();iommu_enable_translation (drhd); } }