[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/hvm: Improve physdev_op hypercall dispatching
commit 909c219944e944f086ec0a89938a7397e2aa4cb0 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Feb 13 11:49:30 2017 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Feb 14 14:34:27 2017 +0000 x86/hvm: Improve physdev_op hypercall dispatching hvm_physdev_op() and hvm_physdev_op_compat32() are almost identical, but there is no need to have two functions instantiated at the end of different function pointers. Combine the two into a single hvm_physdev_op() and dispatch to {do,compat}_physdev_op() based on the hcall_64bit setting. This also fixes an inconsistency where 64bit PVH hardware domains were permitted access to extra physdev ops, but 32bit domains weren't. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/hvm/hypercall.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 85fa92d..5dbd54a 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -73,10 +73,12 @@ static long hvm_grant_table_op( static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { + const struct vcpu *curr = current; + switch ( cmd ) { default: - if ( !is_pvh_vcpu(current) || !is_hardware_domain(current->domain) ) + if ( !is_pvh_vcpu(curr) || !is_hardware_domain(curr->domain) ) return -ENOSYS; /* fall through */ case PHYSDEVOP_map_pirq: @@ -84,26 +86,13 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) case PHYSDEVOP_eoi: case PHYSDEVOP_irq_status_query: case PHYSDEVOP_get_free_pirq: - return do_physdev_op(cmd, arg); - } -} - -static long hvm_physdev_op_compat32( - int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) -{ - switch ( cmd ) - { - case PHYSDEVOP_map_pirq: - case PHYSDEVOP_unmap_pirq: - case PHYSDEVOP_eoi: - case PHYSDEVOP_irq_status_query: - case PHYSDEVOP_get_free_pirq: - return compat_physdev_op(cmd, arg); - break; - default: - return -ENOSYS; break; } + + if ( curr->arch.hvm_vcpu.hcall_64bit ) + return do_physdev_op(cmd, arg); + else + return compat_physdev_op(cmd, arg); } #define HYPERCALL(x) \ @@ -118,15 +107,13 @@ static long hvm_physdev_op_compat32( [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x, \ (hypercall_fn_t *) compat_ ## x } -#define do_physdev_op hvm_physdev_op -#define compat_physdev_op hvm_physdev_op_compat32 #define do_arch_1 paging_domctl_continuation static const hypercall_table_t hvm_hypercall_table[] = { HVM_CALL(memory_op), HVM_CALL(grant_table_op), COMPAT_CALL(vcpu_op), - COMPAT_CALL(physdev_op), + HVM_CALL(physdev_op), COMPAT_CALL(xen_version), HYPERCALL(console_io), HYPERCALL(event_channel_op), @@ -146,8 +133,6 @@ static const hypercall_table_t hvm_hypercall_table[] = { HYPERCALL(arch_1) }; -#undef do_physdev_op -#undef compat_physdev_op #undef do_arch_1 #undef HYPERCALL -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |