From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Brian Woods <brian.woods@amd.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v4 4/5] amd/iommu: assign iommu devices to Xen
Date: Wed, 14 Nov 2018 12:57:39 +0100 [thread overview]
Message-ID: <20181114115740.1050-5-roger.pau@citrix.com> (raw)
In-Reply-To: <20181114115740.1050-1-roger.pau@citrix.com>
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 are not behind an IOMMU, and conceptually it's also wrong
to give the hardware domain ownership of those devices since they are
in use by Xen.
Fix this by assigning the PCI IOMMU devices to Xen.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Brian Woods <brian.woods@amd.com>
---
xen/drivers/passthrough/amd/iommu_init.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 15c10b0929..c74c1566d9 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -993,6 +993,16 @@ static void * __init allocate_ppr_log(struct amd_iommu *iommu)
static int __init amd_iommu_init_one(struct amd_iommu *iommu)
{
+ struct pci_dev *pdev;
+
+ pcidevs_lock();
+ pdev = pci_get_pdev(iommu->seg, PCI_BUS(iommu->bdf),
+ PCI_DEVFN2(iommu->bdf));
+ if ( pdev )
+ /* Assign the IOMMU PCI device to Xen */
+ pdev->domain = dom_xen;
+ pcidevs_unlock();
+
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
next prev parent reply other threads:[~2018-11-14 11:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 11:57 [PATCH v4 0/5] x86/pvh: fix fixes for PVH Dom0 Roger Pau Monne
2018-11-14 11:57 ` [PATCH v4 1/5] vpci: fix updating the command register Roger Pau Monne
2018-11-16 12:00 ` Jan Beulich
2018-11-16 14:32 ` Roger Pau Monné
2018-11-19 8:26 ` Jan Beulich
2018-11-19 11:09 ` Roger Pau Monné
2018-11-19 11:31 ` Jan Beulich
2018-11-14 11:57 ` [PATCH v4 2/5] vpci: fix deferral of long operations Roger Pau Monne
2018-11-14 12:08 ` Paul Durrant
2018-11-16 12:11 ` Jan Beulich
2018-11-16 14:57 ` Roger Pau Monné
2018-11-19 8:27 ` Jan Beulich
2018-11-14 11:57 ` [PATCH v4 3/5] vpci/msix: carve p2m hole for MSIX MMIO regions Roger Pau Monne
2018-11-19 14:56 ` Jan Beulich
2018-11-20 14:35 ` Roger Pau Monné
2018-11-14 11:57 ` Roger Pau Monne [this message]
2018-11-14 12:33 ` [PATCH v4 4/5] amd/iommu: assign iommu devices to Xen Andrew Cooper
2018-11-14 13:53 ` Jan Beulich
2018-11-14 16:09 ` Roger Pau Monné
2018-11-15 15:34 ` Jan Beulich
2018-11-15 16:00 ` Roger Pau Monné
2018-11-14 11:57 ` [PATCH v4 5/5] amd/iommu: skip bridge devices when updating IOMMU page tables Roger Pau Monne
2018-11-15 15:40 ` Jan Beulich
2018-11-15 15:48 ` Roger Pau Monné
2018-11-15 16:13 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181114115740.1050-5-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=brian.woods@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.