* [PATCH v6 0/2] amd/iommu: fixes for PVH Dom0
@ 2018-11-27 15:24 Roger Pau Monne
2018-11-27 15:24 ` [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen Roger Pau Monne
2018-11-27 15:24 ` [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables Roger Pau Monne
0 siblings, 2 replies; 5+ messages in thread
From: Roger Pau Monne @ 2018-11-27 15:24 UTC (permalink / raw)
To: xen-devel; +Cc: Roger Pau Monne
Hello,
This is the remaining of the PVH Dom0 fixes, which now only contains the
AMD IOMMU patches. The series can be found at:
git://xenbits.xen.org/people/royger/xen.git fixes-pvh-v6
Roger Pau Monne (2):
amd/iommu: assign iommu devices to Xen
amd/iommu: skip bridge devices when updating IOMMU page tables
xen/drivers/passthrough/amd/iommu_init.c | 2 ++
xen/drivers/passthrough/amd/iommu_map.c | 3 +++
2 files changed, 5 insertions(+)
--
2.19.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen
2018-11-27 15:24 [PATCH v6 0/2] amd/iommu: fixes for PVH Dom0 Roger Pau Monne
@ 2018-11-27 15:24 ` Roger Pau Monne
2018-11-29 15:13 ` Woods, Brian
2018-11-27 15:24 ` [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables Roger Pau Monne
1 sibling, 1 reply; 5+ messages in thread
From: Roger Pau Monne @ 2018-11-27 15:24 UTC (permalink / raw)
To: xen-devel; +Cc: Brian Woods, Suravee Suthikulpanit, Roger Pau Monne
AMD IOMMU devices are exposed on the PCI bus, and thus are assigned by
default to the hardware domain. This can cause issues because the
IOMMU devices themselves are not behind an IOMMU, so update_paging_mode will
return an error if Xen tries to expand the page tables of a domain
that has assigned devices not behind an IOMMU. update_paging_mode
failing will cause the domain to be destroyed.
Fix this by hiding PCI IOMMU devices, so they are not assigned to the
hardware domain.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Brian Woods <brian.woods@amd.com>
---
Changes since v4:
- Use pci_hide_device.
- Expand commit message.
---
xen/drivers/passthrough/amd/iommu_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 15c10b0929..17f39552a9 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -993,6 +993,8 @@ static void * __init allocate_ppr_log(struct amd_iommu *iommu)
static int __init amd_iommu_init_one(struct amd_iommu *iommu)
{
+ pci_hide_device(iommu->seg, PCI_BUS(iommu->bdf), PCI_DEVFN2(iommu->bdf));
+
if ( map_iommu_mmio_region(iommu) != 0 )
goto error_out;
--
2.19.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen
2018-11-27 15:24 ` [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen Roger Pau Monne
@ 2018-11-29 15:13 ` Woods, Brian
0 siblings, 0 replies; 5+ messages in thread
From: Woods, Brian @ 2018-11-29 15:13 UTC (permalink / raw)
To: Roger Pau Monne
Cc: xen-devel@lists.xenproject.org, Woods, Brian,
Suthikulpanit, Suravee
On Tue, Nov 27, 2018 at 04:24:40PM +0100, Roger Pau Monne wrote:
> AMD IOMMU devices are exposed on the PCI bus, and thus are assigned by
> default to the hardware domain. This can cause issues because the
> IOMMU devices themselves are not behind an IOMMU, so update_paging_mode will
> return an error if Xen tries to expand the page tables of a domain
> that has assigned devices not behind an IOMMU. update_paging_mode
> failing will cause the domain to be destroyed.
>
> Fix this by hiding PCI IOMMU devices, so they are not assigned to the
> hardware domain.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Brian Woods <brian.woods@amd.com>
--
Brian Woods
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables
2018-11-27 15:24 [PATCH v6 0/2] amd/iommu: fixes for PVH Dom0 Roger Pau Monne
2018-11-27 15:24 ` [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen Roger Pau Monne
@ 2018-11-27 15:24 ` Roger Pau Monne
2018-11-29 15:12 ` Woods, Brian
1 sibling, 1 reply; 5+ messages in thread
From: Roger Pau Monne @ 2018-11-27 15:24 UTC (permalink / raw)
To: xen-devel; +Cc: Brian Woods, Suravee Suthikulpanit, Roger Pau Monne
Bridges are not behind an IOMMU, and are already special cased and
skipped in amd_iommu_add_device. Apply the same special casing when
updating page tables.
This is required or else update_paging_mode will fail and return an
error to the caller (amd_iommu_{un}map_page) which will destroy the
domain.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Brian Woods <brian.woods@amd.com>
---
Changes since v5:
- Remove the hardware domain check.
Changes since v4:
- Invert condition order so they match the order in
amd_iommu_add_device.
- Expand commit message to spell out why this is required.
---
xen/drivers/passthrough/amd/iommu_map.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c
index c1daba8422..e4904bb3c5 100644
--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -612,6 +612,9 @@ static int update_paging_mode(struct domain *d, unsigned long dfn)
/* Update device table entries using new root table and paging mode */
for_each_pdev( d, pdev )
{
+ if ( pdev->type == DEV_TYPE_PCI_HOST_BRIDGE )
+ continue;
+
bdf = PCI_BDF2(pdev->bus, pdev->devfn);
iommu = find_iommu_for_device(pdev->seg, bdf);
if ( !iommu )
--
2.19.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables
2018-11-27 15:24 ` [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables Roger Pau Monne
@ 2018-11-29 15:12 ` Woods, Brian
0 siblings, 0 replies; 5+ messages in thread
From: Woods, Brian @ 2018-11-29 15:12 UTC (permalink / raw)
To: Roger Pau Monne
Cc: xen-devel@lists.xenproject.org, Woods, Brian,
Suthikulpanit, Suravee
On Tue, Nov 27, 2018 at 04:24:41PM +0100, Roger Pau Monne wrote:
> Bridges are not behind an IOMMU, and are already special cased and
> skipped in amd_iommu_add_device. Apply the same special casing when
> updating page tables.
>
> This is required or else update_paging_mode will fail and return an
> error to the caller (amd_iommu_{un}map_page) which will destroy the
> domain.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Brian Woods <brian.woods@amd.com>
--
Brian Woods
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-29 15:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-27 15:24 [PATCH v6 0/2] amd/iommu: fixes for PVH Dom0 Roger Pau Monne
2018-11-27 15:24 ` [PATCH v6 1/2] amd/iommu: assign iommu devices to Xen Roger Pau Monne
2018-11-29 15:13 ` Woods, Brian
2018-11-27 15:24 ` [PATCH v6 2/2] amd/iommu: skip bridge devices when updating IOMMU page tables Roger Pau Monne
2018-11-29 15:12 ` Woods, Brian
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.