[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] passthrough/pci: properly qualify the mem_sharing_enabled check...
...in assign_device(). The check of arch.hvm.mem_sharing_enabled flag at the top of drivers/passthrough/pci.c:assign_device() does not make sure that the domain is actually an HVM domain. This patch fixes the issue by moving the definition of the mem_sharing_enabled() macro from mem_sharing.c into asm-86/hvm/domain.h and then using that instead. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: Wei Liu <wl@xxxxxxx> Cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx> --- xen/arch/x86/mm/mem_sharing.c | 3 --- xen/drivers/passthrough/pci.c | 2 +- xen/include/asm-x86/hvm/domain.h | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index f16a3f5324..db02f4dfd5 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -149,9 +149,6 @@ static inline shr_handle_t get_next_handle(void) return x + 1; } -#define mem_sharing_enabled(d) \ - (is_hvm_domain(d) && (d)->arch.hvm.mem_sharing_enabled) - static atomic_t nr_saved_mfns = ATOMIC_INIT(0); static atomic_t nr_shared_mfns = ATOMIC_INIT(0); diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index e88689425d..7697ec440d 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1450,7 +1450,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag) /* Prevent device assign if mem paging or mem sharing have been * enabled for this domain */ - if ( unlikely(d->arch.hvm.mem_sharing_enabled || + if ( unlikely(mem_sharing_enabled(d) || vm_event_check_ring(d->vm_event_paging) || p2m_get_hostp2m(d)->global_logdirty) ) return -EXDEV; diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index 6c7c4f5aa6..1e6e3ce078 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -197,8 +197,11 @@ struct hvm_domain { #ifdef CONFIG_HVM #define hap_enabled(d) (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled) +#define mem_sharing_enabled(d) \ + (is_hvm_domain(d) && (d)->arch.hvm.mem_sharing_enabled) #else #define hap_enabled(d) ({(void)(d); false;}) +#define mem_sharing_enabled(d) ({(void)(d); false;}) #endif #endif /* __ASM_X86_HVM_DOMAIN_H__ */ -- 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |