debuggers.hg
changeset 17097:bf19616b2ae8
amd iommu: Allow device deassignment.
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Signed-off-by: Wei Wang <wei.wang2@amd.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Mon Feb 18 09:33:40 2008 +0000 (2008-02-18) |
parents | 1cb8d51b4d77 |
children | eb418cb71d4b |
files | xen/arch/x86/domctl.c xen/arch/x86/hvm/iommu.c xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c xen/arch/x86/hvm/vmx/vtd/intel-iommu.c xen/include/asm-x86/iommu.h |
line diff
1.1 --- a/xen/arch/x86/domctl.c Fri Feb 15 14:31:20 2008 +0000 1.2 +++ b/xen/arch/x86/domctl.c Mon Feb 18 09:33:40 2008 +0000 1.3 @@ -601,7 +601,7 @@ long arch_do_domctl( 1.4 if ( !device_assigned(bus, devfn) ) 1.5 break; 1.6 1.7 - reassign_device_ownership(d, dom0, bus, devfn); 1.8 + deassign_device(d, bus, devfn); 1.9 gdprintk(XENLOG_INFO, "XEN_DOMCTL_deassign_device: bdf = %x:%x:%x\n", 1.10 bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); 1.11 put_domain(d);
2.1 --- a/xen/arch/x86/hvm/iommu.c Fri Feb 15 14:31:20 2008 +0000 2.2 +++ b/xen/arch/x86/hvm/iommu.c Mon Feb 18 09:33:40 2008 +0000 2.3 @@ -133,3 +133,13 @@ int iommu_unmap_page(struct domain *d, u 2.4 2.5 return hd->platform_ops->unmap_page(d, gfn); 2.6 } 2.7 + 2.8 +void deassign_device(struct domain *d, u8 bus, u8 devfn) 2.9 +{ 2.10 + struct hvm_iommu *hd = domain_hvm_iommu(d); 2.11 + 2.12 + if ( !iommu_enabled || !hd->platform_ops) 2.13 + return; 2.14 + 2.15 + return hd->platform_ops->reassign_device(d, dom0, bus, devfn); 2.16 +}
3.1 --- a/xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c Fri Feb 15 14:31:20 2008 +0000 3.2 +++ b/xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c Mon Feb 18 09:33:40 2008 +0000 3.3 @@ -562,10 +562,17 @@ void amd_iommu_domain_destroy(struct dom 3.4 release_domain_devices(d); 3.5 } 3.6 3.7 +void amd_iommu_return_device(struct domain *s, struct domain *t, u8 bus, u8 devfn) 3.8 +{ 3.9 + pdev_flr(bus, devfn); 3.10 + reassign_device(s, t, bus, devfn); 3.11 +} 3.12 + 3.13 struct iommu_ops amd_iommu_ops = { 3.14 .init = amd_iommu_domain_init, 3.15 .assign_device = amd_iommu_assign_device, 3.16 .teardown = amd_iommu_domain_destroy, 3.17 .map_page = amd_iommu_map_page, 3.18 .unmap_page = amd_iommu_unmap_page, 3.19 + .reassign_device = amd_iommu_return_device, 3.20 };
4.1 --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Fri Feb 15 14:31:20 2008 +0000 4.2 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Mon Feb 18 09:33:40 2008 +0000 4.3 @@ -2164,6 +2164,7 @@ struct iommu_ops intel_iommu_ops = { 4.4 .teardown = iommu_domain_teardown, 4.5 .map_page = intel_iommu_map_page, 4.6 .unmap_page = intel_iommu_unmap_page, 4.7 + .reassign_device = reassign_device_ownership, 4.8 }; 4.9 4.10 /*
5.1 --- a/xen/include/asm-x86/iommu.h Fri Feb 15 14:31:20 2008 +0000 5.2 +++ b/xen/include/asm-x86/iommu.h Mon Feb 18 09:33:40 2008 +0000 5.3 @@ -74,6 +74,7 @@ int iommu_domain_init(struct domain *d); 5.4 void iommu_domain_destroy(struct domain *d); 5.5 int device_assigned(u8 bus, u8 devfn); 5.6 int assign_device(struct domain *d, u8 bus, u8 devfn); 5.7 +void deassign_device(struct domain *d, u8 bus, u8 devfn); 5.8 void reassign_device_ownership(struct domain *source, 5.9 struct domain *target, 5.10 u8 bus, u8 devfn); 5.11 @@ -102,6 +103,7 @@ struct iommu_ops { 5.12 void (*teardown)(struct domain *d); 5.13 int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn); 5.14 int (*unmap_page)(struct domain *d, unsigned long gfn); 5.15 + void (*reassign_device)(struct domain *s, struct domain *t, u8 bus, u8 devfn); 5.16 }; 5.17 5.18 #endif /* _IOMMU_H_ */