[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/hypercall: Make the HVM hcall_64bit boolean common
HVM guests currently make use of arch.hvm_vcpu.hcall_64bit to track the ABI of the hypercall in use. The rest of Xen deals in terms of the comat ABI or not, so rename the boolean and make it common, guared by CONFIG_COMPAT to avoid bloat if a compat ABI is not wanted/needed. Set hcall_compat uniformly for PV guests as well as HVM guests. This removes the remaining piece of guest-type-specific knowledge from hypercall_create_continuation(), allowing it to operate only in terms of the hypercall ABI in use. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- xen/arch/x86/domain.c | 4 +--- xen/arch/x86/hvm/hvm.c | 9 +++------ xen/arch/x86/hvm/hypercall.c | 11 +++++------ xen/arch/x86/hypercall.c | 2 ++ xen/include/asm-x86/hvm/vcpu.h | 2 -- xen/include/xen/sched.h | 4 ++++ 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 08c5813..3209eb3 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2226,9 +2226,7 @@ unsigned long hypercall_create_continuation( regs->rax = op; - if ( is_pv_vcpu(curr) ? - !is_pv_32bit_vcpu(curr) : - curr->arch.hvm_vcpu.hcall_64bit ) + if ( !curr->hcall_compat ) { for ( i = 0; *p != '\0'; i++ ) { diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 266f708..4d29e3c 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3254,8 +3254,7 @@ unsigned long copy_to_user_hvm(void *to, const void *from, unsigned int len) { int rc; - if ( !current->arch.hvm_vcpu.hcall_64bit && - is_compat_arg_xlat_range(to, len) ) + if ( current->hcall_compat && is_compat_arg_xlat_range(to, len) ) { memcpy(to, from, len); return 0; @@ -3269,8 +3268,7 @@ unsigned long clear_user_hvm(void *to, unsigned int len) { int rc; - if ( !current->arch.hvm_vcpu.hcall_64bit && - is_compat_arg_xlat_range(to, len) ) + if ( current->hcall_compat && is_compat_arg_xlat_range(to, len) ) { memset(to, 0x00, len); return 0; @@ -3284,8 +3282,7 @@ unsigned long copy_from_user_hvm(void *to, const void *from, unsigned len) { int rc; - if ( !current->arch.hvm_vcpu.hcall_64bit && - is_compat_arg_xlat_range(from, len) ) + if ( current->hcall_compat && is_compat_arg_xlat_range(from, len) ) { memcpy(to, from, len); return 0; diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index fe7802b..0f7c310 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -35,7 +35,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return -ENOSYS; } - if ( curr->arch.hvm_vcpu.hcall_64bit ) + if ( !curr->hcall_compat ) rc = do_memory_op(cmd, arg); else rc = compat_memory_op(cmd, arg); @@ -65,7 +65,7 @@ static long hvm_grant_table_op( return -ENOSYS; } - if ( current->arch.hvm_vcpu.hcall_64bit ) + if ( !current->hcall_compat ) return do_grant_table_op(cmd, uop, count); else return compat_grant_table_op(cmd, uop, count); @@ -89,7 +89,7 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) break; } - if ( curr->arch.hvm_vcpu.hcall_64bit ) + if ( !curr->hcall_compat ) return do_physdev_op(cmd, arg); else return compat_physdev_op(cmd, arg); @@ -203,12 +203,9 @@ int hvm_hypercall(struct cpu_user_regs *regs) } #endif - curr->arch.hvm_vcpu.hcall_64bit = 1; regs->rax = hvm_hypercall_table[eax].native(rdi, rsi, rdx, r10, r8, r9); - curr->arch.hvm_vcpu.hcall_64bit = 0; - #ifndef NDEBUG if ( !curr->hcall_preempted ) { @@ -250,8 +247,10 @@ int hvm_hypercall(struct cpu_user_regs *regs) } #endif + curr->hcall_compat = true; regs->rax = hvm_hypercall_table[eax].compat(ebx, ecx, edx, esi, edi, ebp); + curr->hcall_compat = false; #ifndef NDEBUG if ( !curr->hcall_preempted ) diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c index 945afa0..c0718f8 100644 --- a/xen/arch/x86/hypercall.c +++ b/xen/arch/x86/hypercall.c @@ -234,7 +234,9 @@ void pv_hypercall(struct cpu_user_regs *regs) __trace_hypercall(TRC_PV_HYPERCALL_V2, eax, args); } + curr->hcall_compat = true; regs->_eax = pv_hypercall_table[eax].compat(ebx, ecx, edx, esi, edi, ebp); + curr->hcall_compat = false; #ifndef NDEBUG if ( !curr->hcall_preempted ) diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index 6d5553d..6c54773 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -166,8 +166,6 @@ struct hvm_vcpu { bool debug_state_latch; bool single_step; - bool hcall_64bit; - struct hvm_vcpu_asid n1asid; u32 msr_tsc_aux; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 5b62238..738bb43 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -204,6 +204,10 @@ struct vcpu bool affinity_broken; /* A hypercall has been preempted. */ bool hcall_preempted; +#ifdef CONFIG_COMPAT + /* A hypercall is using the compat ABI? */ + bool hcall_compat; +#endif /* -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |