[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vtd: Fix init/destroy domain hooks.
# HG changeset patch # User Keir Fraser <keir@xxxxxxxxxxxxx> # Date 1190300391 -3600 # Node ID ecbddf7b7896ed0883fe642c159648b69924c184 # Parent 35893e27bdeb717333131102b7ee82eeccdc451b vtd: Fix init/destroy domain hooks. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/arch/x86/domain.c | 9 +++++++++ xen/arch/x86/hvm/hvm.c | 12 +----------- xen/arch/x86/hvm/vmx/vtd/intel-iommu.c | 2 +- xen/arch/x86/hvm/vmx/vtd/io.c | 8 +++----- xen/include/asm-x86/iommu.h | 2 +- 5 files changed, 15 insertions(+), 18 deletions(-) diff -r 35893e27bdeb -r ecbddf7b7896 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu Sep 20 15:52:29 2007 +0100 +++ b/xen/arch/x86/domain.c Thu Sep 20 15:59:51 2007 +0100 @@ -44,6 +44,7 @@ #include <asm/hvm/support.h> #include <asm/msr.h> #include <asm/nmi.h> +#include <asm/iommu.h> #ifdef CONFIG_COMPAT #include <compat/vcpu.h> #endif @@ -505,10 +506,16 @@ int arch_domain_create(struct domain *d) virt_to_page(d->shared_info), d, XENSHARE_writable); } + if ( (rc = iommu_domain_init(d)) != 0 ) + goto fail; + if ( is_hvm_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) + { + iommu_domain_destroy(d); goto fail; + } } else { @@ -537,6 +544,8 @@ void arch_domain_destroy(struct domain * { if ( is_hvm_domain(d) ) hvm_domain_destroy(d); + + iommu_domain_destroy(d); paging_final_teardown(d); diff -r 35893e27bdeb -r ecbddf7b7896 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Sep 20 15:52:29 2007 +0100 +++ b/xen/arch/x86/hvm/hvm.c Thu Sep 20 15:59:51 2007 +0100 @@ -48,7 +48,6 @@ #include <public/hvm/ioreq.h> #include <public/version.h> #include <public/memory.h> -#include <asm/iommu.h> int hvm_enabled __read_mostly; @@ -220,21 +219,13 @@ int hvm_domain_initialise(struct domain if ( rc != 0 ) return rc; - rc = iommu_domain_init(d); - if ( rc != 0 ) - return rc; - vpic_init(d); vioapic_init(d); hvm_init_ioreq_page(d, &d->arch.hvm_domain.ioreq); hvm_init_ioreq_page(d, &d->arch.hvm_domain.buf_ioreq); - rc = hvm_funcs.domain_initialise(d); - if ( rc != 0 ) - release_devices(d); - - return rc; + return hvm_funcs.domain_initialise(d); } void hvm_domain_relinquish_resources(struct domain *d) @@ -250,7 +241,6 @@ void hvm_domain_relinquish_resources(str void hvm_domain_destroy(struct domain *d) { - release_devices(d); hvm_funcs.domain_destroy(d); } diff -r 35893e27bdeb -r ecbddf7b7896 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Thu Sep 20 15:52:29 2007 +0100 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Thu Sep 20 15:59:51 2007 +0100 @@ -972,7 +972,7 @@ int iommu_domain_init(struct domain *dom gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: hardware doesn't support the agaw\n"); agaw = find_next_bit(&sagaw, 5, agaw); - if (agaw >= 5) + if ( agaw >= 5 ) return -ENODEV; } hd->agaw = agaw; diff -r 35893e27bdeb -r ecbddf7b7896 xen/arch/x86/hvm/vmx/vtd/io.c --- a/xen/arch/x86/hvm/vmx/vtd/io.c Thu Sep 20 15:52:29 2007 +0100 +++ b/xen/arch/x86/hvm/vmx/vtd/io.c Thu Sep 20 15:59:51 2007 +0100 @@ -134,19 +134,17 @@ void hvm_dpci_eoi(unsigned int guest_gsi } } -int release_devices(struct domain *d) +void iommu_domain_destroy(struct domain *d) { struct hvm_domain *hd = &d->arch.hvm_domain; uint32_t i; - int ret = 0; if ( !vtd_enabled ) - return ret; + return; for ( i = 0; i < NR_IRQS; i++ ) if ( hd->irq.mirq[i].valid ) - ret = pirq_guest_unbind(d, i); + pirq_guest_unbind(d, i); iommu_domain_teardown(d); - return ret; } diff -r 35893e27bdeb -r ecbddf7b7896 xen/include/asm-x86/iommu.h --- a/xen/include/asm-x86/iommu.h Thu Sep 20 15:52:29 2007 +0100 +++ b/xen/include/asm-x86/iommu.h Thu Sep 20 15:59:51 2007 +0100 @@ -68,8 +68,8 @@ struct iommu { int iommu_setup(void); int iommu_domain_init(struct domain *d); +void iommu_domain_destroy(struct domain *d); int assign_device(struct domain *d, u8 bus, u8 devfn); -int release_devices(struct domain *d); int iommu_map_page(struct domain *d, dma_addr_t gfn, dma_addr_t mfn); int iommu_unmap_page(struct domain *d, dma_addr_t gfn); void iommu_flush(struct domain *d, dma_addr_t gfn, u64 *p2m_entry); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |