From nobody Sat Apr 20 05:00:23 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1557422823; cv=none; d=zoho.com; s=zohoarc; b=dqZ421fUVdKNk7ixvg8xXooMHGWGCU3jySf8p3kl+JhkUzAkx91gm3iW2K3+CVir9FlEHlowgt0GyM6NLISzeHkhjWHbpkozeygeQ0xS3C2+i78g8Im0vN2qWzE16WQtEpu8mNv1HEupnI7C9790Lwe6D6m2ZU+yzIjdVVr+oCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557422823; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8GSqSCvtUq5oWFqtH2dv77lnebvm+tV/XueBNpcx8NY=; b=FBfO9E/JVw1zrXwl1lGtjjLRAOH3UJ4MoPSWr7cyyAGgJH0uT8/Bd3VET/sJlfbfgMy115lH1Sqk6JV+LjDaEi4HywTo6CkwtwARIp6ekLBl3JAXVUW+I0gkgfoK4Z5XARbTDgDPMv6JNKkoba2F2S5qgfpmC0c4sp5+p9GymQo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1557422823097353.7831604712061; Thu, 9 May 2019 10:27:03 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hOmng-0000bR-4r; Thu, 09 May 2019 17:25:44 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hOmne-0000b0-LU for xen-devel@lists.xenproject.org; Thu, 09 May 2019 17:25:42 +0000 Received: from userp2130.oracle.com (unknown [156.151.31.86]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 77e6b686-727f-11e9-8980-bc764e045a96; Thu, 09 May 2019 17:25:41 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49HJKhR151507; Thu, 9 May 2019 17:25:39 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2s94bgcedr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 17:25:39 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x49HP4sf119423; Thu, 9 May 2019 17:25:38 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2scpy5t219-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 May 2019 17:25:38 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x49HPbcl031171; Thu, 9 May 2019 17:25:37 GMT Received: from aa1-ca-oracle-com.ca.oracle.com (/10.156.75.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 May 2019 10:25:37 -0700 X-Inumbo-ID: 77e6b686-727f-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=3LSWyrB/R95u7v5C2K7eIXIMxZmvnIpEVypvxjtlHBI=; b=JVdmi8QsftBJ0Q8P8nrZ3UOGM4ChJ2oHVC2jHqIjXA7hlWcP3V7XVP+BPgxBmw0OBkmi q8mHb+8dFtinIqg2+S5tH7QqXjJolNbx+jUQoGrCkfMQ0EMWNHkubC5+MloMANBbsSWY 9GmwLYsYI/MMaE11sol6srMfeC0hHa9aS0+qkl0C6WeuI7tWKzAeldNpuN6f3CnJR3kr +fxge1FZAEn3h66ygqcJL4KiB+NwFSBDmZbfOZrYH9/S3kEGhNpwPDEHAFMzRXF8xNLm WdLj9EFy6eSoZGzSnM24st5NL+KJGU/ZcHkHSfqv7HNQ3DKwvSOQYjWRHHZrCHYBWwH2 wA== From: Ankur Arora To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Date: Thu, 9 May 2019 10:25:27 -0700 Message-Id: <20190509172540.12398-4-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190509172540.12398-1-ankur.a.arora@oracle.com> References: <20190509172540.12398-1-ankur.a.arora@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905090100 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9252 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905090100 Subject: [Xen-devel] [RFC PATCH 03/16] x86/xen: make hypercall_page generic X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, sstabellini@kernel.org, konrad.wilk@oracle.com, ankur.a.arora@oracle.com, pbonzini@redhat.com, boris.ostrovsky@oracle.com, joao.m.martins@oracle.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Make hypercall_page a generic interface which can be implemented by other hypervisors. With this change, hypercall_page now points to the newly introduced xen_hypercall_page which is seeded by Xen, or to one that is filled in by a different hypervisor. Signed-off-by: Ankur Arora --- arch/x86/include/asm/xen/hypercall.h | 12 +++++++----- arch/x86/xen/enlighten.c | 1 + arch/x86/xen/enlighten_hvm.c | 3 ++- arch/x86/xen/enlighten_pv.c | 1 + arch/x86/xen/enlighten_pvh.c | 3 ++- arch/x86/xen/xen-asm_32.S | 2 +- arch/x86/xen/xen-asm_64.S | 2 +- arch/x86/xen/xen-head.S | 8 ++++---- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xe= n/hypercall.h index ef05bea7010d..1a3cd6680e6f 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h @@ -86,11 +86,13 @@ struct xen_dm_op_buf; * there aren't more than 5 arguments...) */ =20 -extern struct { char _entry[32]; } hypercall_page[]; +struct hypercall_entry { char _entry[32]; }; +extern struct hypercall_entry xen_hypercall_page[128]; +extern struct hypercall_entry *hypercall_page; =20 -#define __HYPERCALL "call hypercall_page+%c[offset]" +#define __HYPERCALL CALL_NOSPEC #define __HYPERCALL_ENTRY(x) \ - [offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0])) + [thunk_target] "0" (hypercall_page + __HYPERVISOR_##x) =20 #ifdef CONFIG_X86_32 #define __HYPERCALL_RETREG "eax" @@ -116,7 +118,7 @@ extern struct { char _entry[32]; } hypercall_page[]; register unsigned long __arg4 asm(__HYPERCALL_ARG4REG) =3D __arg4; \ register unsigned long __arg5 asm(__HYPERCALL_ARG5REG) =3D __arg5; =20 -#define __HYPERCALL_0PARAM "=3Dr" (__res), ASM_CALL_CONSTRAINT +#define __HYPERCALL_0PARAM "=3D&r" (__res), ASM_CALL_CONSTRAINT #define __HYPERCALL_1PARAM __HYPERCALL_0PARAM, "+r" (__arg1) #define __HYPERCALL_2PARAM __HYPERCALL_1PARAM, "+r" (__arg2) #define __HYPERCALL_3PARAM __HYPERCALL_2PARAM, "+r" (__arg3) @@ -208,7 +210,7 @@ xen_single_call(unsigned int call, =20 asm volatile(CALL_NOSPEC : __HYPERCALL_5PARAM - : [thunk_target] "a" (&hypercall_page[call]) + : [thunk_target] "0" (hypercall_page + call) : __HYPERCALL_CLOBBER5); =20 return (long)__res; diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 750f46ad018a..e9dc92e79afa 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -20,6 +20,7 @@ #include "smp.h" #include "pmu.h" =20 +struct hypercall_entry *hypercall_page; EXPORT_SYMBOL_GPL(hypercall_page); =20 /* diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index ffc5791675b2..4d85cd2ff261 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -115,8 +115,9 @@ static void __init init_hvm_pv_info(void) =20 pv_info.name =3D "Xen HVM"; msr =3D cpuid_ebx(base + 2); - pfn =3D __pa(hypercall_page); + pfn =3D __pa(xen_hypercall_page); wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); + hypercall_page =3D xen_hypercall_page; } =20 xen_setup_features(); diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index a4e04b0cc596..3239e8452ede 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1217,6 +1217,7 @@ asmlinkage __visible void __init xen_start_kernel(voi= d) =20 if (!xen_start_info) return; + hypercall_page =3D xen_hypercall_page; =20 xenhost_register(xenhost_r1, &xh_pv_ops); =20 diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c index c07eba169572..e47866fcb7ea 100644 --- a/arch/x86/xen/enlighten_pvh.c +++ b/arch/x86/xen/enlighten_pvh.c @@ -46,8 +46,9 @@ void __init xen_pvh_init(void) xen_start_flags =3D pvh_start_info.flags; =20 msr =3D cpuid_ebx(xen_cpuid_base() + 2); - pfn =3D __pa(hypercall_page); + pfn =3D __pa(xen_hypercall_page); wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); + hypercall_page =3D xen_hypercall_page; } =20 void __init mem_map_via_hcall(struct boot_params *boot_params_p) diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S index c15db060a242..ee4998055ea9 100644 --- a/arch/x86/xen/xen-asm_32.S +++ b/arch/x86/xen/xen-asm_32.S @@ -121,7 +121,7 @@ xen_iret_end_crit: =20 hyper_iret: /* put this out of line since its very rarely used */ - jmp hypercall_page + __HYPERVISOR_iret * 32 + jmp xen_hypercall_page + __HYPERVISOR_iret * 32 =20 .globl xen_iret_start_crit, xen_iret_end_crit =20 diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S index 1e9ef0ba30a5..2172d6aec9a3 100644 --- a/arch/x86/xen/xen-asm_64.S +++ b/arch/x86/xen/xen-asm_64.S @@ -70,7 +70,7 @@ ENTRY(xen_early_idt_handler_array) END(xen_early_idt_handler_array) __FINIT =20 -hypercall_iret =3D hypercall_page + __HYPERVISOR_iret * 32 +hypercall_iret =3D xen_hypercall_page + __HYPERVISOR_iret * 32 /* * Xen64 iret frame: * diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 5077ead5e59c..7ff5437bd83f 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -58,18 +58,18 @@ END(startup_xen) =20 .pushsection .text .balign PAGE_SIZE -ENTRY(hypercall_page) +ENTRY(xen_hypercall_page) .rept (PAGE_SIZE / 32) UNWIND_HINT_EMPTY .skip 32 .endr =20 #define HYPERCALL(n) \ - .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \ + .equ xen_hypercall_##n, xen_hypercall_page + __HYPERVISOR_##n * 32; \ .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32 #include #undef HYPERCALL -END(hypercall_page) +END(xen_hypercall_page) .popsection =20 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") @@ -85,7 +85,7 @@ END(hypercall_page) #ifdef CONFIG_XEN_PV ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen) #endif - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page) + ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR xen_hypercall_page) ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .ascii "!writable_page_tables|pae_pgdir_above_4gb") ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel