[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] amd iommu: Allow device deassignment.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1203327220 0 # Node ID bf19616b2ae87dc268dc767fe09dec0d6cc22592 # Parent 1cb8d51b4d77aba99890b909bf16a01dc3dbcb2a amd iommu: Allow device deassignment. Signed-off-by: Wei Wang <wei.wang2@xxxxxxx> --- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/iommu.c | 10 ++++++++++ xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c | 7 +++++++ xen/arch/x86/hvm/vmx/vtd/intel-iommu.c | 1 + xen/include/asm-x86/iommu.h | 2 ++ 5 files changed, 21 insertions(+), 1 deletion(-) diff -r 1cb8d51b4d77 -r bf19616b2ae8 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 Mon Feb 18 09:33:40 2008 +0000 @@ -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 -r bf19616b2ae8 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 Mon Feb 18 09:33:40 2008 +0000 @@ -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 -r bf19616b2ae8 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 Mon Feb 18 09:33:40 2008 +0000 @@ -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 -r bf19616b2ae8 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 Mon Feb 18 09:33:40 2008 +0000 @@ -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 -r bf19616b2ae8 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 Mon Feb 18 09:33:40 2008 +0000 @@ -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_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |