[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 12/34] x86/pt: only call some functions for HVM guests
This patch effectively lifts the check out from these functions to its caller. Asserts are added for safety. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/hvm/vmsi.c | 4 +++- xen/arch/x86/hvm/vmx/vmx.c | 8 ++++++-- xen/drivers/passthrough/pci.c | 2 +- xen/drivers/passthrough/vtd/iommu.c | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c index 3001d5c..39c29d3 100644 --- a/xen/arch/x86/hvm/vmsi.c +++ b/xen/arch/x86/hvm/vmsi.c @@ -561,7 +561,9 @@ void msixtbl_init(struct domain *d) { struct hvm_io_handler *handler; - if ( !is_hvm_domain(d) || !has_vlapic(d) || msixtbl_initialised(d) ) + ASSERT(is_hvm_domain(d)); + + if ( !has_vlapic(d) || msixtbl_initialised(d) ) return; INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list); diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 73f0d52..7a3fd62 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -315,7 +315,9 @@ void vmx_pi_hooks_assign(struct domain *d) { struct vcpu *v; - if ( !iommu_intpost || !is_hvm_domain(d) ) + ASSERT(is_hvm_domain(d)); + + if ( !iommu_intpost ) return; ASSERT(!d->arch.hvm_domain.pi_ops.vcpu_block); @@ -354,7 +356,9 @@ void vmx_pi_hooks_deassign(struct domain *d) { struct vcpu *v; - if ( !iommu_intpost || !is_hvm_domain(d) ) + ASSERT(is_hvm_domain(d)); + + if ( !iommu_intpost ) return; ASSERT(d->arch.hvm_domain.pi_ops.vcpu_block); diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index c4890a4..9f99fa2 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1439,7 +1439,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag) goto done; } - if ( pdev->msix ) + if ( pdev->msix && is_hvm_domain(d) ) msixtbl_init(d); pdev->fault.count = 0; diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 1710256..6dcbcf2 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2382,13 +2382,13 @@ static int reassign_device_ownership( if ( ret ) return ret; - if ( !has_arch_pdevs(target) ) + if ( !has_arch_pdevs(target) && is_hvm_domain(target) ) vmx_pi_hooks_assign(target); ret = domain_context_mapping(target, devfn, pdev); if ( ret ) { - if ( !has_arch_pdevs(target) ) + if ( !has_arch_pdevs(target) && is_hvm_domain(target) ) vmx_pi_hooks_deassign(target); return ret; @@ -2400,7 +2400,7 @@ static int reassign_device_ownership( pdev->domain = target; } - if ( !has_arch_pdevs(source) ) + if ( !has_arch_pdevs(source) && is_hvm_domain(source) ) vmx_pi_hooks_deassign(source); return ret; -- git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |