From: "Wei Wang2" <wei.wang2@amd.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com, "Zhai, Edwin" <edwin.zhai@intel.com>
Subject: Re: Re: [PATCH][HVM] pass-through PCI device hotplug support
Date: Fri, 15 Feb 2008 18:19:51 +0100 [thread overview]
Message-ID: <1203095991.4789.34.camel@gran.amd.com> (raw)
In-Reply-To: <C3DB5401.1C8F6%Keir.Fraser@cl.cam.ac.uk>
[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]
Keir,
c/s 17056 also works for AMD-IOMMU, attached patch introduces a new
vendor independent interface for device detachment.
Thanks,
Wei
--
AMD Saxony, Dresden, Germany
Operating System Research Center
Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
Dr. Hans-R. Deppe, Thomas McCoy
On Fri, 2008-02-15 at 14:36 +0000, Keir Fraser wrote:
> On 15/2/08 13:32, "Zhai, Edwin" <edwin.zhai@intel.com> wrote:
>
> > This patch is the new version against 17051 to enable HVM guest VT-d device
> > hotplug.
> >
> > ** Currently only 2 virtual pci slots(6~7) are made as being capable of
> > hotplug,
> > so more than 2 vtd dev can't be hotplugged, but we can easily extend it in
> > future.
>
> Now applied, but perhaps too hastily. I found it broke the
> !CONFIG_PASSTHROUGH build and in fixing that I noticed that you dumped code
> in a bunch of random places in qemu. Perhaps all passthrough stuff should be
> gathered in one place? Alternatively at least the device model changes (in
> piix4acpi.c) should be decoupled a bit from the backend logic in
> passthrough.c, so the former can cleanly build without the latter. I also
> killed pt_uninit() because I couldn't even find where pci_cleanup() was
> defined. No passthrough function should be in vl.c: I #ifdef'ed in the for
> now but the functions should probably be moved. And you did a big dump of
> random crap into vl.h.
>
> -- Keir
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>
[-- Attachment #2: hotplugin.patch --]
[-- Type: text/plain, Size: 3237 bytes --]
diff -r 1cb8d51b4d77 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Fri Feb 15 14:31:20 2008 +0000
+++ b/xen/arch/x86/domctl.c Fri Feb 15 18:15:46 2008 +0100
@@ -601,7 +601,7 @@ long arch_do_domctl(
if ( !device_assigned(bus, devfn) )
break;
- reassign_device_ownership(d, dom0, bus, devfn);
+ deassign_device(d, bus, devfn);
gdprintk(XENLOG_INFO, "XEN_DOMCTL_deassign_device: bdf = %x:%x:%x\n",
bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
put_domain(d);
diff -r 1cb8d51b4d77 xen/arch/x86/hvm/iommu.c
--- a/xen/arch/x86/hvm/iommu.c Fri Feb 15 14:31:20 2008 +0000
+++ b/xen/arch/x86/hvm/iommu.c Fri Feb 15 18:15:46 2008 +0100
@@ -133,3 +133,13 @@ int iommu_unmap_page(struct domain *d, u
return hd->platform_ops->unmap_page(d, gfn);
}
+
+void deassign_device(struct domain *d, u8 bus, u8 devfn)
+{
+ struct hvm_iommu *hd = domain_hvm_iommu(d);
+
+ if ( !iommu_enabled || !hd->platform_ops)
+ return;
+
+ return hd->platform_ops->reassign_device(d, dom0, bus, devfn);
+}
diff -r 1cb8d51b4d77 xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c
--- a/xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c Fri Feb 15 14:31:20 2008 +0000
+++ b/xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c Fri Feb 15 18:15:46 2008 +0100
@@ -562,10 +562,17 @@ void amd_iommu_domain_destroy(struct dom
release_domain_devices(d);
}
+void amd_iommu_return_device(struct domain *s, struct domain *t, u8 bus, u8 devfn)
+{
+ pdev_flr(bus, devfn);
+ reassign_device(s, t, bus, devfn);
+}
+
struct iommu_ops amd_iommu_ops = {
.init = amd_iommu_domain_init,
.assign_device = amd_iommu_assign_device,
.teardown = amd_iommu_domain_destroy,
.map_page = amd_iommu_map_page,
.unmap_page = amd_iommu_unmap_page,
+ .reassign_device = amd_iommu_return_device,
};
diff -r 1cb8d51b4d77 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Fri Feb 15 14:31:20 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Fri Feb 15 18:15:46 2008 +0100
@@ -2164,6 +2164,7 @@ struct iommu_ops intel_iommu_ops = {
.teardown = iommu_domain_teardown,
.map_page = intel_iommu_map_page,
.unmap_page = intel_iommu_unmap_page,
+ .reassign_device = reassign_device_ownership,
};
/*
diff -r 1cb8d51b4d77 xen/include/asm-x86/iommu.h
--- a/xen/include/asm-x86/iommu.h Fri Feb 15 14:31:20 2008 +0000
+++ b/xen/include/asm-x86/iommu.h Fri Feb 15 18:15:46 2008 +0100
@@ -74,6 +74,7 @@ void iommu_domain_destroy(struct domain
void iommu_domain_destroy(struct domain *d);
int device_assigned(u8 bus, u8 devfn);
int assign_device(struct domain *d, u8 bus, u8 devfn);
+void deassign_device(struct domain *d, u8 bus, u8 devfn);
void reassign_device_ownership(struct domain *source,
struct domain *target,
u8 bus, u8 devfn);
@@ -102,6 +103,7 @@ struct iommu_ops {
void (*teardown)(struct domain *d);
int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn);
int (*unmap_page)(struct domain *d, unsigned long gfn);
+ void (*reassign_device)(struct domain *s, struct domain *t, u8 bus, u8 devfn);
};
#endif /* _IOMMU_H_ */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2008-02-15 17:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-15 13:32 [PATCH][HVM] pass-through PCI device hotplug support Zhai, Edwin
2008-02-15 14:36 ` Keir Fraser
2008-02-15 17:19 ` Wei Wang2 [this message]
2008-02-15 17:33 ` Wei Wang2
2008-02-17 15:34 ` Zhai, Edwin
2008-02-17 16:43 ` Keir Fraser
2008-02-18 12:53 ` Yosuke Iwamatsu
2008-02-20 3:56 ` Zhai, Edwin
2008-02-20 4:45 ` Yosuke Iwamatsu
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=1203095991.4789.34.camel@gran.amd.com \
--to=wei.wang2@amd.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=edwin.zhai@intel.com \
--cc=xen-devel@lists.xensource.com \
/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.