From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: [PATCH v3 3/4] x86/pvh: Handle hypercalls for 32b PVH guests Date: Fri, 10 Jul 2015 18:20:52 -0400 Message-ID: <1436566853-8444-4-git-send-email-boris.ostrovsky@oracle.com> References: <1436566853-8444-1-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436566853-8444-1-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: elena.ufimtseva@oracle.com, wei.liu2@citrix.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, boris.ostrovsky@oracle.com, roger.pau@citrix.com List-Id: xen-devel@lists.xenproject.org Signed-off-by: Boris Ostrovsky --- Changes in v3: * Defined compat_mmuext_op(). (XEN_GUEST_HANDLE_PARAM(mmuext_op_compat_t) is not defined in header files so I used 'void' type. I am not convinced this is the best solution) xen/arch/x86/hvm/hvm.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 6f247a0..a4e7185 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4931,7 +4931,6 @@ static hvm_hypercall_t *const hvm_hypercall32_table[NR_hypercalls] = { [ __HYPERVISOR_arch_1 ] = (hvm_hypercall_t *)paging_domctl_continuation }; -/* PVH 32bitfixme. */ static hvm_hypercall_t *const pvh_hypercall64_table[NR_hypercalls] = { HYPERCALL(platform_op), HYPERCALL(memory_op), @@ -4951,6 +4950,29 @@ static hvm_hypercall_t *const pvh_hypercall64_table[NR_hypercalls] = { [ __HYPERVISOR_arch_1 ] = (hvm_hypercall_t *)paging_domctl_continuation }; +extern int compat_mmuext_op(XEN_GUEST_HANDLE_PARAM(void) cmp_uops, + unsigned int count, + XEN_GUEST_HANDLE_PARAM(uint) pdone, + unsigned int foreigndom); +static hvm_hypercall_t *const pvh_hypercall32_table[NR_hypercalls] = { + HYPERCALL(platform_op), + COMPAT_CALL(memory_op), + HYPERCALL(xen_version), + HYPERCALL(console_io), + [ __HYPERVISOR_grant_table_op ] = + (hvm_hypercall_t *)hvm_grant_table_op_compat32, + COMPAT_CALL(vcpu_op), + COMPAT_CALL(mmuext_op), + HYPERCALL(xsm_op), + COMPAT_CALL(sched_op), + HYPERCALL(event_channel_op), + [ __HYPERVISOR_physdev_op ] = (hvm_hypercall_t *)hvm_physdev_op_compat32, + HYPERCALL(hvm_op), + HYPERCALL(sysctl), + HYPERCALL(domctl), + [ __HYPERVISOR_arch_1 ] = (hvm_hypercall_t *)paging_domctl_continuation +}; + extern const uint8_t hypercall_args_table[], compat_hypercall_args_table[]; int hvm_do_hypercall(struct cpu_user_regs *regs) @@ -4981,7 +5003,7 @@ int hvm_do_hypercall(struct cpu_user_regs *regs) return viridian_hypercall(regs); if ( (eax >= NR_hypercalls) || - (is_pvh_domain(currd) ? !pvh_hypercall64_table[eax] + (is_pvh_domain(currd) ? !pvh_hypercall32_table[eax] : !hvm_hypercall32_table[eax]) ) { regs->eax = -ENOSYS; @@ -5037,8 +5059,6 @@ int hvm_do_hypercall(struct cpu_user_regs *regs) } #endif } - else if ( unlikely(is_pvh_domain(currd)) ) - regs->_eax = -ENOSYS; /* PVH 32bitfixme. */ else { unsigned int ebx = regs->_ebx; @@ -5064,7 +5084,10 @@ int hvm_do_hypercall(struct cpu_user_regs *regs) } #endif - regs->_eax = hvm_hypercall32_table[eax](ebx, ecx, edx, esi, edi, ebp); + regs->_eax = (is_pvh_vcpu(curr) + ? pvh_hypercall32_table + : hvm_hypercall32_table)[eax](ebx, ecx, edx, + esi, edi, ebp); #ifndef NDEBUG if ( !curr->arch.hvm_vcpu.hcall_preempted ) -- 1.8.1.4