From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897691; cv=none; d=zohomail.com; s=zohoarc; b=Odw046SzLpFNbVQFUv96Nfgod0JO0c3oiwee5mKNWCdmiKnrPwcYpXb1t1JWM+dDiDS0kHqkXB31hCZbp//mzqkD8wM/xscETqvA/Xc955sWCK5ryzgSlyddpW97Ezq+CqX0363r+SE1jKQlBCCmJurpKwGPW7Un2PdX9d1ZfzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897691; h=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; bh=LH5iekQAujtfbCT5ppRY8SHnDyE773eE100u+22phKg=; b=QnsgycAd9/udr3rju+iiJM1e7ZtxLuG4FCtwb+ztR634tRoAKeLjVLK8u2sRi7DbRFC5Ir+lgMa0ru2UmYW4NjA+I+Et7FXkC4sjLKLd2CgnJn5QCYrYuF3IVZTQ9+M+732Zxmy/XFhV3OccVm+7+y5Rwa72WKBWMSEuDmGC1WM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897691577995.456368663979; Wed, 9 Mar 2022 23:34:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288151.488615 (Exim 4.92) (envelope-from ) id 1nSDJb-0000dP-Ra; Thu, 10 Mar 2022 07:34:27 +0000 Received: by outflank-mailman (output) from mailman id 288151.488615; Thu, 10 Mar 2022 07:34:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJb-0000c5-JZ; Thu, 10 Mar 2022 07:34:27 +0000 Received: by outflank-mailman (input) for mailman id 288151; Thu, 10 Mar 2022 07:34:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJa-0000ZQ-AR for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:26 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 82788018-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:25 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AEF8B1F443; Thu, 10 Mar 2022 07:34:24 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 806F413FA3; Thu, 10 Mar 2022 07:34:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yHLoHQCqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 82788018-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897664; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LH5iekQAujtfbCT5ppRY8SHnDyE773eE100u+22phKg=; b=fNXoM2VvH1hDPn2/XMCrGU0trY+SNYGEIxO658FKhJA0Eo1c2RLvAmkXnqVsq7z2OGIfof c0a+tIf/rIoixdf64gF6eLSIp2UzbEfCNrDL4hWI+g+uz0tAUhFeSh8DfNdEv0FkXZbicS KBreRyro5YcrP018qp4ekZqG2/BoFFc= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v4 01/11] xen/arm: rename do_phydev_op() to do_arm_physdev_op() Date: Thu, 10 Mar 2022 08:34:10 +0100 Message-Id: <20220310073420.15622-2-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897692415100005 Content-Type: text/plain; charset="utf-8" do_physdev_op() prototypes on Arm and x86 differ in their return type, so rename the Arm one in order to prepare using a common generated header file. Signed-off-by: Juergen Gross Acked-by: Julien Grall --- V4: - new patch --- xen/arch/arm/include/asm/hypercall.h | 2 +- xen/arch/arm/physdev.c | 2 +- xen/arch/arm/traps.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/as= m/hypercall.h index a0c5a31a2f..39d2e7889d 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -2,7 +2,7 @@ #define __ASM_ARM_HYPERCALL_H__ =20 #include /* for arch_do_domctl */ -int do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); +int do_arm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(v= oid) arg); =20 diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c index f9aa274dda..95a8cdc0ee 100644 --- a/xen/arch/arm/physdev.c +++ b/xen/arch/arm/physdev.c @@ -11,7 +11,7 @@ #include =20 =20 -int do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +int do_arm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { #ifdef CONFIG_HAS_PCI return pci_physdev_op(cmd, arg); diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 7a1b679b8c..f8c3ef0ca2 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1371,7 +1371,7 @@ static arm_hypercall_t arm_hypercall_table[] =3D { HYPERCALL(xsm_op, 1), HYPERCALL(event_channel_op, 2), HYPERCALL_DEPRECATED(event_channel_op_compat, 1), - HYPERCALL(physdev_op, 2), + HYPERCALL_ARM(physdev_op, 2), HYPERCALL_DEPRECATED(physdev_op_compat, 1), HYPERCALL(sysctl, 2), HYPERCALL(hvm_op, 2), --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1647846968; cv=none; d=zohomail.com; s=zohoarc; b=boFn8C/kkTSt1Xxmoqsz3vPktvo94BTV5XTu0vL1yHT6CK+7oilGgL4PLEmPB1/2ZfTKrGj1O6yx8s7t2D35YGxZFfmvpe6T4HYGcVGxWQs++oaS76ODW//TS/s02pGnQxnPIqW4qiCqMkI9AIwLULYPg6lXhg0hTxnqE2ptzVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647846968; h=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; bh=h22B5ZgKRwVMXna+wG55MpkmPJwyfUO662E0tM1hy2M=; b=DPgQ11PkRv9qAz63rF/RO6oBdjJRraQ00X4T+itz3luvEz55ktx/auKRPae1M3JE9iuE4Yq1spLeRxjNJIO2gV6DOtLIx182ofNEupEzTUsLVL9/0kR5herfn/qerjJYViOWn7dpKrHTlYSSzpscxVcs7zvTuFtTImP3Rrk3UkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647846968247925.5422075221711; Mon, 21 Mar 2022 00:16:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.292756.497125 (Exim 4.92) (envelope-from ) id 1nWCGL-0000ep-PD; Mon, 21 Mar 2022 07:15:33 +0000 Received: by outflank-mailman (output) from mailman id 292756.497125; Mon, 21 Mar 2022 07:15:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWCGL-0000eh-Ld; Mon, 21 Mar 2022 07:15:33 +0000 Received: by outflank-mailman (input) for mailman id 292756; Mon, 21 Mar 2022 07:15:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nWCGK-0000eJ-EJ for xen-devel@lists.xenproject.org; Mon, 21 Mar 2022 07:15:32 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0c63563-a8e6-11ec-a405-831a346695d4; Mon, 21 Mar 2022 08:15:30 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C606F1F37F; Mon, 21 Mar 2022 07:15:29 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7BF7C139FF; Mon, 21 Mar 2022 07:15:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UYJGHBEmOGKEGgAAMHmgww (envelope-from ); Mon, 21 Mar 2022 07:15:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b0c63563-a8e6-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1647846929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h22B5ZgKRwVMXna+wG55MpkmPJwyfUO662E0tM1hy2M=; b=rmtuAc4Cd6RwwDp/pYAZg3ZcpqX3HiFZFRvp3YXggpZFg2gZdqDqbMWtyBuPoiwSu6aDb5 /LUswavauREErmiUyiLu5/ROQvgPCPf6275ClIphVd79f9Vn524HBuj0dtcRKdnVbyxc59 VI20iFp5qBmeG/Czf2mJLyQIaUEY+EM= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4.1 02/11] xen: move do_vcpu_op() to arch specific code Date: Mon, 21 Mar 2022 08:15:26 +0100 Message-Id: <20220321071527.1946-1-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1647846969824100001 Content-Type: text/plain; charset="utf-8" The entry point used for the vcpu_op hypercall on Arm is different from the one on x86 today, as some of the common sub-ops are not supported on Arm. The Arm specific handler filters out the not supported sub-ops and then calls the common handler. This leads to the weird call hierarchy: do_arm_vcpu_op() do_vcpu_op() arch_do_vcpu_op() Clean this up by renaming do_vcpu_op() to common_vcpu_op() and arch_do_vcpu_op() in each architecture to do_vcpu_op(). This way one of above calls can be avoided without restricting any potential future use of common sub-ops for Arm. Signed-off-by: Juergen Gross --- V4: - don't remove HYPERCALL_ARM() V4.1: - add missing cf_check (Andrew Cooper) --- xen/arch/arm/domain.c | 15 ++++++++------- xen/arch/arm/include/asm/hypercall.h | 2 -- xen/arch/arm/traps.c | 2 +- xen/arch/x86/domain.c | 12 ++++++++---- xen/arch/x86/include/asm/hypercall.h | 2 +- xen/arch/x86/x86_64/domain.c | 18 +++++++++++++----- xen/common/compat/domain.c | 15 ++++++--------- xen/common/domain.c | 12 ++++-------- xen/include/xen/hypercall.h | 2 +- 9 files changed, 42 insertions(+), 38 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 8110c1df86..2f8eaab7b5 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -1079,23 +1079,24 @@ void arch_dump_domain_info(struct domain *d) } =20 =20 -long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(v= oid) arg) +long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void)= arg) { + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; + switch ( cmd ) { case VCPUOP_register_vcpu_info: case VCPUOP_register_runstate_memory_area: - return do_vcpu_op(cmd, vcpuid, arg); + return common_vcpu_op(cmd, v, arg); default: return -EINVAL; } } =20 -long arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void)= arg) -{ - return -ENOSYS; -} - void arch_dump_vcpu_info(struct vcpu *v) { gic_dump_info(v); diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/as= m/hypercall.h index 39d2e7889d..fac4d60f17 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -4,8 +4,6 @@ #include /* for arch_do_domctl */ int do_arm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(v= oid) arg); - long subarch_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); =20 diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index f8c3ef0ca2..deb07784d9 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1380,7 +1380,7 @@ static arm_hypercall_t arm_hypercall_table[] =3D { #endif HYPERCALL(multicall, 2), HYPERCALL(platform_op, 1), - HYPERCALL_ARM(vcpu_op, 3), + HYPERCALL(vcpu_op, 3), HYPERCALL(vm_assist, 2), #ifdef CONFIG_ARGO HYPERCALL(argo_op, 5), diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index a5048ed654..d566fc82b4 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1489,11 +1489,15 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } =20 -long -arch_do_vcpu_op( - int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) +long cf_check do_vcpu_op(int cmd, unsigned int vcpuid, + XEN_GUEST_HANDLE_PARAM(void) arg) { long rc =3D 0; + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; =20 switch ( cmd ) { @@ -1545,7 +1549,7 @@ arch_do_vcpu_op( } =20 default: - rc =3D -ENOSYS; + rc =3D common_vcpu_op(cmd, v, arg); break; } =20 diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 61bf897147..d6daa7e4cb 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -145,7 +145,7 @@ compat_physdev_op( XEN_GUEST_HANDLE_PARAM(void) arg); =20 extern int -arch_compat_vcpu_op( +compat_common_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 extern int cf_check compat_mmuext_op( diff --git a/xen/arch/x86/x86_64/domain.c b/xen/arch/x86/x86_64/domain.c index c46dccc25a..9c559aa3ea 100644 --- a/xen/arch/x86/x86_64/domain.c +++ b/xen/arch/x86/x86_64/domain.c @@ -12,11 +12,15 @@ CHECK_vcpu_get_physid; #undef xen_vcpu_get_physid =20 -int -arch_compat_vcpu_op( - int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) +int cf_check +compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) = arg) { - int rc =3D -ENOSYS; + int rc; + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; =20 switch ( cmd ) { @@ -55,7 +59,11 @@ arch_compat_vcpu_op( } =20 case VCPUOP_get_physid: - rc =3D arch_do_vcpu_op(cmd, v, arg); + rc =3D do_vcpu_op(cmd, vcpuid, arg); + break; + + default: + rc =3D compat_common_vcpu_op(cmd, v, arg); break; } =20 diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index afae27eeba..1119534679 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -38,15 +38,12 @@ CHECK_vcpu_hvm_context; =20 #endif =20 -int cf_check compat_vcpu_op( - int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) +int compat_common_vcpu_op(int cmd, struct vcpu *v, + XEN_GUEST_HANDLE_PARAM(void) arg) { - struct domain *d =3D current->domain; - struct vcpu *v; int rc =3D 0; - - if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) - return -ENOENT; + struct domain *d =3D current->domain; + unsigned int vcpuid =3D v->vcpu_id; =20 switch ( cmd ) { @@ -103,7 +100,7 @@ int cf_check compat_vcpu_op( case VCPUOP_stop_singleshot_timer: case VCPUOP_register_vcpu_info: case VCPUOP_send_nmi: - rc =3D do_vcpu_op(cmd, vcpuid, arg); + rc =3D common_vcpu_op(cmd, v, arg); break; =20 case VCPUOP_get_runstate_info: @@ -134,7 +131,7 @@ int cf_check compat_vcpu_op( } =20 default: - rc =3D arch_compat_vcpu_op(cmd, v, arg); + rc =3D -ENOSYS; break; } =20 diff --git a/xen/common/domain.c b/xen/common/domain.c index 351029f8b2..f9de1be43c 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1570,15 +1570,11 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUE= ST_HANDLE_PARAM(void) arg) return rc; } =20 -long cf_check do_vcpu_op( - int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) +long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) = arg) { - struct domain *d =3D current->domain; - struct vcpu *v; long rc =3D 0; - - if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) - return -ENOENT; + struct domain *d =3D current->domain; + unsigned int vcpuid =3D v->vcpu_id; =20 switch ( cmd ) { @@ -1750,7 +1746,7 @@ long cf_check do_vcpu_op( } =20 default: - rc =3D arch_do_vcpu_op(cmd, v, arg); + rc =3D -ENOSYS; break; } =20 diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index a1b6575976..81aae7a662 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -110,7 +110,7 @@ do_vcpu_op( =20 struct vcpu; extern long -arch_do_vcpu_op(int cmd, +common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897692; cv=none; d=zohomail.com; s=zohoarc; b=ju0glp2gRsDoi7Q8w5PbGqcdMPZtL4+RtQarmGZ+l2XEOf1azdVWkih0JPMeQs8k1MwHWHMLfDk5am1tjMaB01OE16VLL8r82oMSTyVvaiJM5jyYkx+Vfd4YfGI0D05eIo+RAD3KHv3iE7nV+13BF500wXvFtDM3nym8M6v4UDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897692; h=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; bh=mg0IVeDJK5l+42HD2r55olz6U0rWy21oGjPbgxp9ur4=; b=H3o4ylayU6NQxvvXUoXYTHY/07L0OOT9zrNqfWEqhDUocM48D6bg8Kv1mCkjJ1CjRBdzzwboqrXoZ3U/UIZ3h+bScd1QaJLSM2fvohnu2jhKFUO8ZrZuBMNDtG6jydiijATpFhBgFg3S5CJz6W7WuPZKdaLDm32gr34ywMnzv9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897692190974.5972489542918; Wed, 9 Mar 2022 23:34:52 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288153.488628 (Exim 4.92) (envelope-from ) id 1nSDJc-0000s7-Rk; Thu, 10 Mar 2022 07:34:28 +0000 Received: by outflank-mailman (output) from mailman id 288153.488628; Thu, 10 Mar 2022 07:34:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJc-0000pB-Dm; Thu, 10 Mar 2022 07:34:28 +0000 Received: by outflank-mailman (input) for mailman id 288153; Thu, 10 Mar 2022 07:34:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJb-0000ZQ-3d for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:27 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 82a45a74-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:25 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1561D21110; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B505E13FA3; Thu, 10 Mar 2022 07:34:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eOz3KgCqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 82a45a74-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mg0IVeDJK5l+42HD2r55olz6U0rWy21oGjPbgxp9ur4=; b=khPMbExQNW9xjF14IZTxqZgnbDDSgRXjgJJ/mufG7YNC7RbZexBaYM4eiAHzQUANUeYx4S Uf6BLnB0s1IqXAKPDrxwr3th9oWdeKr5hI4jCKfjXMllo6wJBzsjgEFVxfrDdnWXzFW8Jd mkqAryDvQgHq8kRBhRMRU22GRlWZP7U= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 02/11] xen: move do_vcpu_op() to arch specific code Date: Thu, 10 Mar 2022 08:34:11 +0100 Message-Id: <20220310073420.15622-3-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897692467100007 Content-Type: text/plain; charset="utf-8" The entry point used for the vcpu_op hypercall on Arm is different from the one on x86 today, as some of the common sub-ops are not supported on Arm. The Arm specific handler filters out the not supported sub-ops and then calls the common handler. This leads to the weird call hierarchy: do_arm_vcpu_op() do_vcpu_op() arch_do_vcpu_op() Clean this up by renaming do_vcpu_op() to common_vcpu_op() and arch_do_vcpu_op() in each architecture to do_vcpu_op(). This way one of above calls can be avoided without restricting any potential future use of common sub-ops for Arm. Signed-off-by: Juergen Gross --- V4: - don't remove HYPERCALL_ARM() --- xen/arch/arm/domain.c | 15 ++++++++------- xen/arch/arm/include/asm/hypercall.h | 2 -- xen/arch/arm/traps.c | 2 +- xen/arch/x86/domain.c | 12 ++++++++---- xen/arch/x86/include/asm/hypercall.h | 2 +- xen/arch/x86/x86_64/domain.c | 16 ++++++++++++---- xen/common/compat/domain.c | 15 ++++++--------- xen/common/domain.c | 12 ++++-------- xen/include/xen/hypercall.h | 2 +- 9 files changed, 41 insertions(+), 37 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 8110c1df86..2f8eaab7b5 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -1079,23 +1079,24 @@ void arch_dump_domain_info(struct domain *d) } =20 =20 -long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(v= oid) arg) +long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void)= arg) { + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; + switch ( cmd ) { case VCPUOP_register_vcpu_info: case VCPUOP_register_runstate_memory_area: - return do_vcpu_op(cmd, vcpuid, arg); + return common_vcpu_op(cmd, v, arg); default: return -EINVAL; } } =20 -long arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void)= arg) -{ - return -ENOSYS; -} - void arch_dump_vcpu_info(struct vcpu *v) { gic_dump_info(v); diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/as= m/hypercall.h index 39d2e7889d..fac4d60f17 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -4,8 +4,6 @@ #include /* for arch_do_domctl */ int do_arm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -long do_arm_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(v= oid) arg); - long subarch_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); =20 diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index f8c3ef0ca2..deb07784d9 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1380,7 +1380,7 @@ static arm_hypercall_t arm_hypercall_table[] =3D { #endif HYPERCALL(multicall, 2), HYPERCALL(platform_op, 1), - HYPERCALL_ARM(vcpu_op, 3), + HYPERCALL(vcpu_op, 3), HYPERCALL(vm_assist, 2), #ifdef CONFIG_ARGO HYPERCALL(argo_op, 5), diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index a5048ed654..d566fc82b4 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1489,11 +1489,15 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } =20 -long -arch_do_vcpu_op( - int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) +long cf_check do_vcpu_op(int cmd, unsigned int vcpuid, + XEN_GUEST_HANDLE_PARAM(void) arg) { long rc =3D 0; + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; =20 switch ( cmd ) { @@ -1545,7 +1549,7 @@ arch_do_vcpu_op( } =20 default: - rc =3D -ENOSYS; + rc =3D common_vcpu_op(cmd, v, arg); break; } =20 diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 16d8418b57..610c37a0b8 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -145,7 +145,7 @@ compat_physdev_op( XEN_GUEST_HANDLE_PARAM(void) arg); =20 extern int -arch_compat_vcpu_op( +compat_common_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 extern int cf_check compat_mmuext_op( diff --git a/xen/arch/x86/x86_64/domain.c b/xen/arch/x86/x86_64/domain.c index c46dccc25a..62fe51ee74 100644 --- a/xen/arch/x86/x86_64/domain.c +++ b/xen/arch/x86/x86_64/domain.c @@ -13,10 +13,14 @@ CHECK_vcpu_get_physid; #undef xen_vcpu_get_physid =20 int -arch_compat_vcpu_op( - int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) +compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) = arg) { - int rc =3D -ENOSYS; + int rc; + struct domain *d =3D current->domain; + struct vcpu *v; + + if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) + return -ENOENT; =20 switch ( cmd ) { @@ -55,7 +59,11 @@ arch_compat_vcpu_op( } =20 case VCPUOP_get_physid: - rc =3D arch_do_vcpu_op(cmd, v, arg); + rc =3D do_vcpu_op(cmd, vcpuid, arg); + break; + + default: + rc =3D compat_common_vcpu_op(cmd, v, arg); break; } =20 diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index afae27eeba..1119534679 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -38,15 +38,12 @@ CHECK_vcpu_hvm_context; =20 #endif =20 -int cf_check compat_vcpu_op( - int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) +int compat_common_vcpu_op(int cmd, struct vcpu *v, + XEN_GUEST_HANDLE_PARAM(void) arg) { - struct domain *d =3D current->domain; - struct vcpu *v; int rc =3D 0; - - if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) - return -ENOENT; + struct domain *d =3D current->domain; + unsigned int vcpuid =3D v->vcpu_id; =20 switch ( cmd ) { @@ -103,7 +100,7 @@ int cf_check compat_vcpu_op( case VCPUOP_stop_singleshot_timer: case VCPUOP_register_vcpu_info: case VCPUOP_send_nmi: - rc =3D do_vcpu_op(cmd, vcpuid, arg); + rc =3D common_vcpu_op(cmd, v, arg); break; =20 case VCPUOP_get_runstate_info: @@ -134,7 +131,7 @@ int cf_check compat_vcpu_op( } =20 default: - rc =3D arch_compat_vcpu_op(cmd, v, arg); + rc =3D -ENOSYS; break; } =20 diff --git a/xen/common/domain.c b/xen/common/domain.c index 351029f8b2..f9de1be43c 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1570,15 +1570,11 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUE= ST_HANDLE_PARAM(void) arg) return rc; } =20 -long cf_check do_vcpu_op( - int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg) +long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) = arg) { - struct domain *d =3D current->domain; - struct vcpu *v; long rc =3D 0; - - if ( (v =3D domain_vcpu(d, vcpuid)) =3D=3D NULL ) - return -ENOENT; + struct domain *d =3D current->domain; + unsigned int vcpuid =3D v->vcpu_id; =20 switch ( cmd ) { @@ -1750,7 +1746,7 @@ long cf_check do_vcpu_op( } =20 default: - rc =3D arch_do_vcpu_op(cmd, v, arg); + rc =3D -ENOSYS; break; } =20 diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index 4dfd64cf71..82f7f2caeb 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -110,7 +110,7 @@ do_vcpu_op( =20 struct vcpu; extern long -arch_do_vcpu_op(int cmd, +common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897690; cv=none; d=zohomail.com; s=zohoarc; b=e20SLogGXsBowWI+S+SUnrfl5i/m8e1ZQbk+AjM+RLSxuWlUZQb/CDfVFODVZn4bDnw8aBDxy9QnnPAZDn6AknIxsLUNALikYL6WnxvANKIiIWn3XQV5HXIh024ZYRuu1ZHMuDtnMIkFbNq16GrbmZhHP5dPwUC7xuShUZ8El2c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897690; h=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; bh=BEzMzKjCEqWCLH4etovzeszLFEIwdEg6ZM52H2MR7Ho=; b=CC5MgfiqV3sEnTMkUZ0ZYN2HkEQaETBimTiv7yLCI6GI0WoaWVqc97MLUptKeUp9ND5+kwmBPCvkLez+3BGlFcRPylcOTVjc1TI7D4OJf5JhkNfY/Fy0GCJeCGEpM+B8Hwa8jtlB+zs9/E2SVvoiNSh9Q4xoG+nFOHQqw1Zv488= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897690205260.7648862906316; Wed, 9 Mar 2022 23:34:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288152.488619 (Exim 4.92) (envelope-from ) id 1nSDJc-0000nb-9e; Thu, 10 Mar 2022 07:34:28 +0000 Received: by outflank-mailman (output) from mailman id 288152.488619; Thu, 10 Mar 2022 07:34:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJc-0000kZ-1r; Thu, 10 Mar 2022 07:34:28 +0000 Received: by outflank-mailman (input) for mailman id 288152; Thu, 10 Mar 2022 07:34:27 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJb-0000ZP-0h for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:27 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 80a6c3ed-a044-11ec-8539-5f4723681683; Thu, 10 Mar 2022 08:34:22 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 59F7C1F444; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1C68C13FA5; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aDi0BQGqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 80a6c3ed-a044-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BEzMzKjCEqWCLH4etovzeszLFEIwdEg6ZM52H2MR7Ho=; b=WKqgQwFza2uC/HWEuRsXBxOLS5oJiVmLCWkBKGaMLeOAu8BH/j1Bj0yHUoAtAA5lC3rMtT i/Y5DrqTLI1jxCiv+I9YoNIPoL65aC4+xsucIOiVJ/JcH962O0y8UnbGvmGgtmQKZkLVqC b6w/ePPZklxgYjbJ2JwlPZMa1AJ3Hs0= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v4 03/11] xen: switch non style compliant hypercall handler parameter types Date: Thu, 10 Mar 2022 08:34:12 +0100 Message-Id: <20220310073420.15622-4-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897692259100003 Content-Type: text/plain; charset="utf-8" Switch some non style compliant types (u32, s32, s64) of hypercall handler parameters to style compliant ones. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V4: - carved out from following patch (Julien Grall) --- xen/arch/x86/include/asm/hypercall.h | 10 +++++----- xen/include/xen/hypercall.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 610c37a0b8..d6daa7e4cb 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -94,7 +94,7 @@ do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc); extern long cf_check do_update_va_mapping( unsigned long va, - u64 val64, + uint64_t val64, unsigned long flags); =20 extern long cf_check @@ -104,7 +104,7 @@ do_physdev_op( extern long cf_check do_update_va_mapping_otherdomain( unsigned long va, - u64 val64, + uint64_t val64, unsigned long flags, domid_t domid); =20 @@ -162,10 +162,10 @@ extern long cf_check compat_callback_op( int cmd, XEN_GUEST_HANDLE(void) arg); =20 extern int cf_check compat_update_va_mapping( - unsigned int va, u32 lo, u32 hi, unsigned int flags); + unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags); =20 extern int cf_check compat_update_va_mapping_otherdomain( - unsigned int va, u32 lo, u32 hi, unsigned int flags, domid_t domid); + unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags, domid_t= domid); =20 DEFINE_XEN_GUEST_HANDLE(trap_info_compat_t); extern int cf_check compat_set_trap_table( @@ -175,7 +175,7 @@ extern int cf_check compat_set_gdt( XEN_GUEST_HANDLE_PARAM(uint) frame_list, unsigned int entries); =20 extern int cf_check compat_update_descriptor( - u32 pa_lo, u32 pa_hi, u32 desc_lo, u32 desc_hi); + uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi); =20 extern unsigned int cf_check compat_iret(void); =20 diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index 82f7f2caeb..81aae7a662 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -198,8 +198,8 @@ compat_sched_op( =20 extern int cf_check compat_set_timer_op( - u32 lo, - s32 hi); + uint32_t lo, + int32_t hi); =20 extern int cf_check compat_xsm_op( XEN_GUEST_HANDLE_PARAM(void) op); --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897696; cv=none; d=zohomail.com; s=zohoarc; b=Xmdau2fu3KLhgotIbxsH+t0PG3ixw2jjWH5qzaUuAD76FEudYCSnTtg65VjIzn6HS1sArWuy3zRY2e+ZyGCgCP6xJM5lS1ZcFJVjwfgxnslQNFb1BbO9JN97v1I0YRS0jbNgX7ywrjaUB0BvmysjdzNKM0rmy057aTAZfFfgdXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897696; h=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; bh=6kPnP13BoiT67+pIZ2eno/H+dxIX2vBMmQiya/5eZeY=; b=YD5iWMbua3hhppREHHIIoT435AcLsbHfa8T/lizqZVVqO1QUIw7WlKo0mxIDTVZ5X4TGGPS+3h2H6V+hRRm5oqZ61ZKpiReXTE7nk9A1dhDJO3WhayplLVEBn4PvSOLPwFX27b4xTK5WcUIRXVz6+EDsS4uHTHNYo/YuuAA+EJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897696326272.28028590594784; Wed, 9 Mar 2022 23:34:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288157.488667 (Exim 4.92) (envelope-from ) id 1nSDJg-0001z8-Pz; Thu, 10 Mar 2022 07:34:32 +0000 Received: by outflank-mailman (output) from mailman id 288157.488667; Thu, 10 Mar 2022 07:34:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJg-0001tY-DF; Thu, 10 Mar 2022 07:34:32 +0000 Received: by outflank-mailman (input) for mailman id 288157; Thu, 10 Mar 2022 07:34:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJd-0000ZQ-4F for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:29 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 830f5fff-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:26 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A620321118; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6180113FA3; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eM2PFgGqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 830f5fff-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6kPnP13BoiT67+pIZ2eno/H+dxIX2vBMmQiya/5eZeY=; b=n/HJh9+RKnhNyqQ4lu5BtffHDHULhWJ5zJD6sWF3QHNBuLXjL/VOmB6q4sVcP3dnLpuBFn MoYHpfzKAUJJtjH+IVPMhUWupcOfK5T1r1UsFfI2o1RYHltTstZEOuDuMif+/mJqx1XHyE oIElFpKqiKZvTN4SzmAx+lNei8ER6JA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini , Christopher Clark Subject: [PATCH v4 04/11] xen: harmonize return types of hypercall handlers Date: Thu, 10 Mar 2022 08:34:13 +0100 Message-Id: <20220310073420.15622-5-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897697145100003 Content-Type: text/plain; charset="utf-8" Today most hypercall handlers have a return type of long, while the compat ones return an int. There are a few exceptions from that rule, however. Get rid of the exceptions by letting compat handlers always return int and others always return long, with the exception of the Arm specific physdev_op handler. For the compat hvm case use eax instead of rax for the stored result as it should have been from the beginning. Additionally move some prototypes to include/asm-x86/hypercall.h as they are x86 specific. Move the compat_platform_op() prototype to the common header. Rename paging_domctl_continuation() to do_paging_domctl_cont() and add a matching define for the associated hypercall. Make do_callback_op() and compat_callback_op() more similar by adding the const attribute to compat_callback_op()'s 2nd parameter. Change the type of the cmd parameter for [do|compat]_kexec_op() to unsigned int, as this is more appropriate for the compat case. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V2: - rework platform_op compat handling (Jan Beulich) V3: - remove include of types.h (Jan Beulich) V4: - don't move do_physdev_op() (Julien Grall) - carve out non style compliant parameter replacements (Julien Grall) --- xen/arch/x86/domctl.c | 4 +-- xen/arch/x86/hvm/hypercall.c | 8 ++---- xen/arch/x86/hypercall.c | 2 +- xen/arch/x86/include/asm/hypercall.h | 31 ++++++++++++------------ xen/arch/x86/include/asm/paging.h | 3 --- xen/arch/x86/mm/paging.c | 3 ++- xen/arch/x86/pv/callback.c | 14 +++++------ xen/arch/x86/pv/emul-priv-op.c | 2 +- xen/arch/x86/pv/hypercall.c | 5 +--- xen/arch/x86/pv/iret.c | 4 +-- xen/arch/x86/pv/misc-hypercalls.c | 14 +++++++---- xen/arch/x86/x86_64/platform_hypercall.c | 1 + xen/common/argo.c | 6 ++--- xen/common/kexec.c | 6 ++--- xen/include/xen/hypercall.h | 20 +++++++-------- 15 files changed, 59 insertions(+), 64 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index e49f9e91b9..ea7d60ffb6 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -221,8 +221,8 @@ long arch_do_domctl( case XEN_DOMCTL_shadow_op: ret =3D paging_domctl(d, &domctl->u.shadow_op, u_domctl, 0); if ( ret =3D=3D -ERESTART ) - return hypercall_create_continuation(__HYPERVISOR_arch_1, - "h", u_domctl); + return hypercall_create_continuation( + __HYPERVISOR_paging_domctl_cont, "h", u_domctl); copyback =3D true; break; =20 diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 030243810e..7ea1afd8fe 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -124,8 +124,6 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PA= RAM(void) arg) [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ (hypercall_fn_t *) compat_ ## x } =20 -#define do_arch_1 paging_domctl_continuation - static const struct { hypercall_fn_t *native, *compat; } hvm_hypercall_table[] =3D { @@ -158,11 +156,9 @@ static const struct { #ifdef CONFIG_HYPFS HYPERCALL(hypfs_op), #endif - HYPERCALL(arch_1) + HYPERCALL(paging_domctl_cont) }; =20 -#undef do_arch_1 - #undef HYPERCALL #undef HVM_CALL #undef COMPAT_CALL @@ -300,7 +296,7 @@ int hvm_hypercall(struct cpu_user_regs *regs) #endif =20 curr->hcall_compat =3D true; - regs->rax =3D hvm_hypercall_table[eax].compat(ebx, ecx, edx, esi, = edi); + regs->eax =3D hvm_hypercall_table[eax].compat(ebx, ecx, edx, esi, = edi); curr->hcall_compat =3D false; =20 #ifndef NDEBUG diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c index 2370d31d3f..07e1a45ef5 100644 --- a/xen/arch/x86/hypercall.c +++ b/xen/arch/x86/hypercall.c @@ -75,7 +75,7 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls= ] =3D ARGS(dm_op, 3), ARGS(hypfs_op, 5), ARGS(mca, 1), - ARGS(arch_1, 1), + ARGS(paging_domctl_cont, 1), }; =20 #undef COMP diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index d6daa7e4cb..49973820af 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -11,6 +11,8 @@ #include /* for do_mca */ #include =20 +#define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1 + typedef unsigned long hypercall_fn_t( unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); @@ -80,7 +82,7 @@ do_set_debugreg( int reg, unsigned long value); =20 -extern unsigned long cf_check +extern long cf_check do_get_debugreg( int reg); =20 @@ -118,7 +120,7 @@ do_mmuext_op( extern long cf_check do_callback_op( int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg); =20 -extern unsigned long cf_check +extern long cf_check do_iret( void); =20 @@ -133,17 +135,20 @@ do_set_segment_base( unsigned int which, unsigned long base); =20 +long cf_check do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg= ); + +long cf_check do_xenpmu_op(unsigned int op, + XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg); + +long cf_check do_paging_domctl_cont( + XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); + #ifdef CONFIG_COMPAT =20 #include #include #include =20 -extern int cf_check -compat_physdev_op( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - extern int compat_common_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); @@ -154,12 +159,8 @@ extern int cf_check compat_mmuext_op( XEN_GUEST_HANDLE_PARAM(uint) pdone, unsigned int foreigndom); =20 -DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); -extern int cf_check compat_platform_op( - XEN_GUEST_HANDLE_PARAM(compat_platform_op_t) u_xenpf_op); - -extern long cf_check compat_callback_op( - int cmd, XEN_GUEST_HANDLE(void) arg); +extern int cf_check compat_callback_op( + int cmd, XEN_GUEST_HANDLE(const_void) arg); =20 extern int cf_check compat_update_va_mapping( unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags); @@ -177,12 +178,12 @@ extern int cf_check compat_set_gdt( extern int cf_check compat_update_descriptor( uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi); =20 -extern unsigned int cf_check compat_iret(void); +extern int cf_check compat_iret(void); =20 extern int cf_check compat_nmi_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern long cf_check compat_set_callbacks( +extern int cf_check compat_set_callbacks( unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address); =20 diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/p= aging.h index f0b4efc66e..54c440be65 100644 --- a/xen/arch/x86/include/asm/paging.h +++ b/xen/arch/x86/include/asm/paging.h @@ -234,9 +234,6 @@ int paging_domctl(struct domain *d, struct xen_domctl_s= hadow_op *sc, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl, bool_t resuming); =20 -/* Helper hypercall for dealing with continuations. */ -long cf_check paging_domctl_continuation(XEN_GUEST_HANDLE_PARAM(xen_domctl= _t)); - /* Call when destroying a vcpu/domain */ void paging_vcpu_teardown(struct vcpu *v); int paging_teardown(struct domain *d); diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 1f0b94ad21..a7e2707ecc 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -21,6 +21,7 @@ =20 #include #include +#include #include #include #include @@ -759,7 +760,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_s= hadow_op *sc, return shadow_domctl(d, sc, u_domctl); } =20 -long cf_check paging_domctl_continuation( +long cf_check do_paging_domctl_cont( XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { struct xen_domctl op; diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index 55148c7f9e..1be9d3f731 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -207,9 +207,9 @@ long cf_check do_set_callbacks( #include #include =20 -static long compat_register_guest_callback(struct compat_callback_register= *reg) +static int compat_register_guest_callback(struct compat_callback_register = *reg) { - long ret =3D 0; + int ret =3D 0; struct vcpu *curr =3D current; =20 fixup_guest_code_selector(curr->domain, reg->address.cs); @@ -256,10 +256,10 @@ static long compat_register_guest_callback(struct com= pat_callback_register *reg) return ret; } =20 -static long compat_unregister_guest_callback( +static int compat_unregister_guest_callback( struct compat_callback_unregister *unreg) { - long ret; + int ret; =20 switch ( unreg->type ) { @@ -283,9 +283,9 @@ static long compat_unregister_guest_callback( return ret; } =20 -long cf_check compat_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) +int cf_check compat_callback_op(int cmd, XEN_GUEST_HANDLE(const_void) arg) { - long ret; + int ret; =20 switch ( cmd ) { @@ -321,7 +321,7 @@ long cf_check compat_callback_op(int cmd, XEN_GUEST_HAN= DLE(void) arg) return ret; } =20 -long cf_check compat_set_callbacks( +int cf_check compat_set_callbacks( unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address) { diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 22b10dec2a..5da00e24e4 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -22,13 +22,13 @@ #include #include #include +#include #include =20 #include #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index e8fbee7bbb..fe8dfe9e8f 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -47,8 +47,6 @@ typedef struct { #define COMPAT_CALL(x) HYPERCALL(x) #endif =20 -#define do_arch_1 paging_domctl_continuation - static const pv_hypercall_table_t pv_hypercall_table[] =3D { COMPAT_CALL(set_trap_table), HYPERCALL(mmu_update), @@ -109,11 +107,10 @@ static const pv_hypercall_table_t pv_hypercall_table[= ] =3D { #endif HYPERCALL(mca), #ifndef CONFIG_PV_SHIM_EXCLUSIVE - HYPERCALL(arch_1), + HYPERCALL(paging_domctl_cont), #endif }; =20 -#undef do_arch_1 #undef COMPAT_CALL #undef HYPERCALL =20 diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c index dd2965d8f0..55eb6a63bd 100644 --- a/xen/arch/x86/pv/iret.c +++ b/xen/arch/x86/pv/iret.c @@ -48,7 +48,7 @@ static void async_exception_cleanup(struct vcpu *curr) curr->arch.async_exception_state(trap).old_mask; } =20 -unsigned long cf_check do_iret(void) +long cf_check do_iret(void) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); struct iret_context iret_saved; @@ -105,7 +105,7 @@ unsigned long cf_check do_iret(void) } =20 #ifdef CONFIG_PV32 -unsigned int cf_check compat_iret(void) +int cf_check compat_iret(void) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); struct vcpu *v =3D current; diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hyper= calls.c index 5649aaab44..635f5a644a 100644 --- a/xen/arch/x86/pv/misc-hypercalls.c +++ b/xen/arch/x86/pv/misc-hypercalls.c @@ -28,12 +28,16 @@ long cf_check do_set_debugreg(int reg, unsigned long va= lue) return set_debugreg(current, reg, value); } =20 -unsigned long cf_check do_get_debugreg(int reg) +long cf_check do_get_debugreg(int reg) { - unsigned long val; - int res =3D x86emul_read_dr(reg, &val, NULL); - - return res =3D=3D X86EMUL_OKAY ? val : -ENODEV; + /* Avoid implementation defined behavior casting unsigned long to long= . */ + union { + unsigned long val; + long ret; + } u; + int res =3D x86emul_read_dr(reg, &u.val, NULL); + + return res =3D=3D X86EMUL_OKAY ? u.ret : -ENODEV; } =20 long cf_check do_fpu_taskswitch(int set) diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64= /platform_hypercall.c index 966fd27b5f..2c21a3fd05 100644 --- a/xen/arch/x86/x86_64/platform_hypercall.c +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -4,6 +4,7 @@ =20 EMIT_FILE; =20 +#include #include #include #include diff --git a/xen/common/argo.c b/xen/common/argo.c index 297f6d11f0..26a01c2188 100644 --- a/xen/common/argo.c +++ b/xen/common/argo.c @@ -2207,13 +2207,13 @@ do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM= (void) arg1, } =20 #ifdef CONFIG_COMPAT -long cf_check +int cf_check compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3, unsigned long arg4) { struct domain *currd =3D current->domain; - long rc; + int rc; xen_argo_send_addr_t send_addr; xen_argo_iov_t iovs[XEN_ARGO_MAXIOV]; compat_argo_iov_t compat_iovs[XEN_ARGO_MAXIOV]; @@ -2267,7 +2267,7 @@ compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PAR= AM(void) arg1, =20 rc =3D sendv(currd, &send_addr.src, &send_addr.dst, iovs, niov, arg4); out: - argo_dprintk("<-compat_argo_op(%u)=3D%ld\n", cmd, rc); + argo_dprintk("<-compat_argo_op(%u)=3D%d\n", cmd, rc); =20 return rc; } diff --git a/xen/common/kexec.c b/xen/common/kexec.c index a2ffb6530c..41669964d2 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -1213,7 +1213,7 @@ static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) = uarg) return !!test_bit(bit, &kexec_flags); } =20 -static int do_kexec_op_internal(unsigned long op, +static int do_kexec_op_internal(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg, bool_t compat) { @@ -1265,13 +1265,13 @@ static int do_kexec_op_internal(unsigned long op, return ret; } =20 -long cf_check do_kexec_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) u= arg) +long cf_check do_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) ua= rg) { return do_kexec_op_internal(op, uarg, 0); } =20 #ifdef CONFIG_COMPAT -int cf_check compat_kexec_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void= ) uarg) +int cf_check compat_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void)= uarg) { return do_kexec_op_internal(op, uarg, 1); } diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index 81aae7a662..a032ba2b4a 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -114,11 +114,6 @@ common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern long cf_check -do_nmi_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - extern long cf_check do_hvm_op( unsigned long op, @@ -126,7 +121,7 @@ do_hvm_op( =20 extern long cf_check do_kexec_op( - unsigned long op, + unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg); =20 extern long cf_check @@ -145,9 +140,6 @@ extern long cf_check do_argo_op( extern long cf_check do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern long cf_check -do_xenpmu_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg= ); - extern long cf_check do_dm_op( domid_t domid, @@ -205,15 +197,21 @@ extern int cf_check compat_xsm_op( XEN_GUEST_HANDLE_PARAM(void) op); =20 extern int cf_check compat_kexec_op( - unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg); + unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg); =20 DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t); extern int cf_check compat_multicall( XEN_GUEST_HANDLE_PARAM(multicall_entry_compat_t) call_list, uint32_t nr_calls); =20 +int compat_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); + +typedef struct compat_platform_op compat_platform_op_t; +DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); +int compat_platform_op(XEN_GUEST_HANDLE_PARAM(compat_platform_op_t) u_xenp= f_op); + #ifdef CONFIG_ARGO -extern long cf_check compat_argo_op( +extern int cf_check compat_argo_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, XEN_GUEST_HANDLE_PARAM(void) arg2, --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897690; cv=none; d=zohomail.com; s=zohoarc; b=cup0LRWx9WdJObnYjzr9YdZvJFzpUA9CPpa7HeE9HmBd4eqN3VQKvVp8lLNk7OXe6NQMpJlcUkXqeQtMn2rX9AfgndfYQGFXunyAWTesdJGQHkT7Menz5TEsC7oqTiX4gm7DiugNzpdPO/jM6/gG+jLzzdC6NhIhI3gvqY0geLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897690; h=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; bh=KLCDo14R+Scdn/ook0dpDfB9SKTB0wRtoV5guxmQ4bI=; b=lU9ndoNK+4rj8U1ePnoy2DPskWJHaYbviBCqm1mNuyte7BmThmOnhU12w3jp6IJvwt5c/UVzgektnMfD6cSWBPUFInB+j+Fg2lF1rK2ec3+U4FeQtknxvFeGty6UbHS0XQHVgIDU0pzS630FP6lNlsN4Jt37BvzHuyxeVOKA7Zc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897690164267.1649965203774; Wed, 9 Mar 2022 23:34:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288155.488647 (Exim 4.92) (envelope-from ) id 1nSDJe-0001O5-8V; Thu, 10 Mar 2022 07:34:30 +0000 Received: by outflank-mailman (output) from mailman id 288155.488647; Thu, 10 Mar 2022 07:34:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJd-0001NO-TY; Thu, 10 Mar 2022 07:34:29 +0000 Received: by outflank-mailman (input) for mailman id 288155; Thu, 10 Mar 2022 07:34:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJc-0000ZQ-3s for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:28 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 832d176b-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:26 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F2EE71F445; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AB0CD13FA5; Thu, 10 Mar 2022 07:34:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uECTKAGqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 832d176b-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897665; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KLCDo14R+Scdn/ook0dpDfB9SKTB0wRtoV5guxmQ4bI=; b=C/180rQlPW0MtalczNjlx+tnmWxCCJwkkP7dCcCxBWN3IE2FPZ3XeyV9L3zr20zF8gf/96 tqkZ/VsgOsbfPe6W7wtE4ekiNFrdBZmHvh0RDPQLmpVUknFgDlIWWpyIPFIReeOGBkJe3h 0e9BCMpd6es11TRtJ4K/EYZVu8IhZoo= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 05/11] xen: don't include asm/hypercall.h from C sources Date: Thu, 10 Mar 2022 08:34:14 +0100 Message-Id: <20220310073420.15622-6-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897692462100006 Content-Type: text/plain; charset="utf-8" Instead of including asm/hypercall.h always use xen/hypercall.h. Additionally include xen/hypercall.h from all sources containing a hypercall handler. This prepares for generating the handlers' prototypes at build time. Add a guard in asm/hypercall.h to catch direct inclusion. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Acked-by: Julien Grall # arm --- V2: - remove platform_op hunk (Jan Beulich) - remove including of xen/hypervisor.h from arch/x86/x86_64/mm.c (Jan Beulich) - fix include order in common/compat/grant_table.c (Jan Beulich) --- xen/arch/arm/hvm.c | 3 +-- xen/arch/arm/include/asm/hypercall.h | 4 ++++ xen/arch/arm/platform_hypercall.c | 1 + xen/arch/x86/cpu/vpmu.c | 1 + xen/arch/x86/include/asm/hypercall.h | 4 ++++ xen/arch/x86/mm.c | 1 - xen/arch/x86/platform_hypercall.c | 1 + xen/arch/x86/pv/iret.c | 1 + xen/arch/x86/traps.c | 2 +- xen/arch/x86/x86_64/compat/mm.c | 1 + xen/arch/x86/x86_64/mm.c | 2 -- xen/arch/x86/x86_64/platform_hypercall.c | 1 - xen/common/compat/grant_table.c | 1 + xen/common/event_channel.c | 1 + xen/common/grant_table.c | 1 + xen/common/multicall.c | 1 + 16 files changed, 19 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c index 8951b34086..fc1a52767d 100644 --- a/xen/arch/arm/hvm.c +++ b/xen/arch/arm/hvm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include =20 @@ -29,8 +30,6 @@ #include #include =20 -#include - static int hvm_allow_set_param(const struct domain *d, unsigned int param) { switch ( param ) diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/as= m/hypercall.h index fac4d60f17..8182895358 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -1,3 +1,7 @@ +#ifndef __XEN_HYPERCALL_H__ +#error "asm/hypercall.h should not be included directly - include xen/hype= rcall.h instead" +#endif + #ifndef __ASM_ARM_HYPERCALL_H__ #define __ASM_ARM_HYPERCALL_H__ =20 diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hype= rcall.c index 8efac7ee60..403cc84324 100644 --- a/xen/arch/arm/platform_hypercall.c +++ b/xen/arch/arm/platform_hypercall.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index 4fedc7c570..51d171615f 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 49973820af..81ca25f7b3 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -2,6 +2,10 @@ * asm-x86/hypercall.h */ =20 +#ifndef __XEN_HYPERCALL_H__ +#error "asm/hypercall.h should not be included directly - include xen/hype= rcall.h instead" +#endif + #ifndef __ASM_X86_HYPERCALL_H__ #define __ASM_X86_HYPERCALL_H__ =20 diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 2befd0c191..6cc73187ac 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -129,7 +129,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hype= rcall.c index b91ccff589..eeb4f7a20e 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c index 55eb6a63bd..58de9f7922 100644 --- a/xen/arch/x86/pv/iret.c +++ b/xen/arch/x86/pv/iret.c @@ -18,6 +18,7 @@ */ =20 #include +#include #include #include =20 diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index a2278d9499..3ad954991b 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -70,7 +71,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/m= m.c index b3da8fafbb..70b08a832a 100644 --- a/xen/arch/x86/x86_64/compat/mm.c +++ b/xen/arch/x86/x86_64/compat/mm.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 4f225da81e..3510a5affe 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -25,14 +25,12 @@ EMIT_FILE; #include #include #include -#include #include #include #include #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64= /platform_hypercall.c index 2c21a3fd05..f84252bac6 100644 --- a/xen/arch/x86/x86_64/platform_hypercall.c +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -7,7 +7,6 @@ EMIT_FILE; #include #include #include -#include =20 #define xen_platform_op compat_platform_op #define xen_platform_op_t compat_platform_op_t diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_tabl= e.c index c6199e8918..d5787e3719 100644 --- a/xen/common/compat/grant_table.c +++ b/xen/common/compat/grant_table.c @@ -3,6 +3,7 @@ * */ =20 +#include #include =20 #define xen_grant_entry_v1 grant_entry_v1 diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index ffb042a241..0a82eb3ac2 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include =20 diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 1e0762b064..febbe12eab 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/common/multicall.c b/xen/common/multicall.c index e48f46dbe0..9db49092b4 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897693; cv=none; d=zohomail.com; s=zohoarc; b=FxELZldkL5drAa2NaV3bUIosCK7nZ3CtYfl6avA5u66O453wYqg/wqsiqd1l2qUwK7jz2qWrnLTJun8h49/FDFkzMWilA+B/ieKKKWtD0fXgo+PjgjjnYFH8980TPzJX2Ff8lLtENwqMtSpy/SdYDGmKtnRMcTRGsFby4/NT+4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897693; h=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; bh=IfItSZSW0o2H4xQgtklqjsDZtwba90rKZ+jpu4SrJ+k=; b=GZ5Zg1RNwkgkA/GNCpcgDkB7rEuV+lnXL4mzkfisqH8TaeYVlcjzXaDtze1tSVtRLrhiy8bKkz+COJEi8tsy5Om2LwZWyP5YfV/HF9LIxulz5HS8NHMzJ77tmkBVGFXnEubgwIPI4tjw65uIoY3IEFNOEBDNi8/poB7U42j6n5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897692996109.34333841962189; Wed, 9 Mar 2022 23:34:52 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288154.488650 (Exim 4.92) (envelope-from ) id 1nSDJe-0001VR-Oq; Thu, 10 Mar 2022 07:34:30 +0000 Received: by outflank-mailman (output) from mailman id 288154.488650; Thu, 10 Mar 2022 07:34:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJe-0001TT-ER; Thu, 10 Mar 2022 07:34:30 +0000 Received: by outflank-mailman (input) for mailman id 288154; Thu, 10 Mar 2022 07:34:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJc-0000ZP-0K for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:28 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8127106d-a044-11ec-8539-5f4723681683; Thu, 10 Mar 2022 08:34:22 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 43FA81F449; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 06A5713FA3; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IBpcAAKqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8127106d-a044-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897666; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IfItSZSW0o2H4xQgtklqjsDZtwba90rKZ+jpu4SrJ+k=; b=bwX/wwPLDXizevHSvyvYUqd3Q6vxqhy4TKLY7SIiCmojlNVRup3Vx7kZsA445mROLAAOot due1yHXGaln/jlbRCChInS8KOt9h98MiODFgi1oc/Euc/Q3GLt9MisnnJx/Let3SifEMrh rcyRPrm84Y1DKyNf9mKlj3CAAQwG7lo= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini Subject: [PATCH v4 06/11] xen: include compat/platform.h from hypercall.h Date: Thu, 10 Mar 2022 08:34:15 +0100 Message-Id: <20220310073420.15622-7-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897694596100001 Content-Type: text/plain; charset="utf-8" The definition of compat_platform_op_t is in compat/platform.h already, so include that file from hypercall.h instead of repeating the typedef. This allows to remove the related include statement from arch/x86/x86_64/platform_hypercall.c. Signed-off-by: Juergen Gross Acked-by: Jan Beulich --- V3: - new patch --- xen/arch/x86/x86_64/platform_hypercall.c | 1 - xen/include/xen/hypercall.h | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_64/platform_hypercall.c b/xen/arch/x86/x86_64= /platform_hypercall.c index f84252bac6..7631058cce 100644 --- a/xen/arch/x86/x86_64/platform_hypercall.c +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -6,7 +6,6 @@ EMIT_FILE; =20 #include #include -#include =20 #define xen_platform_op compat_platform_op #define xen_platform_op_t compat_platform_op_t diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index a032ba2b4a..ca8ee22717 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -15,6 +15,9 @@ #include #include #include +#ifdef CONFIG_COMPAT +#include +#endif #include #include =20 @@ -206,7 +209,6 @@ extern int cf_check compat_multicall( =20 int compat_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -typedef struct compat_platform_op compat_platform_op_t; DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); int compat_platform_op(XEN_GUEST_HANDLE_PARAM(compat_platform_op_t) u_xenp= f_op); =20 --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897693; cv=none; d=zohomail.com; s=zohoarc; b=k5Uf4QyCJL+Es2Nx4SH9s9PpjJLDmmE8guJ5giDS+bA3XjdOHaI4H2sovVxLTHEfRZTWvRJuQL50xktV1dFMQJ2aQK/z3Z4zxExdG7FnubkrJ3us8CSfkM3wCVnJD5NKF4WwfVE1jdPVjRMyC+L/2IsDaijaPkoFGYt3RRC1HAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897693; h=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; bh=AhjU8N75KhNEeyHRPfbUqSNllPUdHjiBKtRHcOwH+NQ=; b=O78r7E7vORy2XoVrILc4r6X+oX87ZouH/d2bCFxgToJdsHXuBZqCwkENhSVjKAnod4TG6wIEluo4mbQdGZkELBV6p//5TPR3yKHze6lmEBf+h/c32A0i+xbnW0+Ig97/maznQdpDhDr5LkmIOHu3UW6KHbXfW4Vrt5rIKPiy7pA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897693905658.3951265710065; Wed, 9 Mar 2022 23:34:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288156.488661 (Exim 4.92) (envelope-from ) id 1nSDJg-0001l0-2m; Thu, 10 Mar 2022 07:34:32 +0000 Received: by outflank-mailman (output) from mailman id 288156.488661; Thu, 10 Mar 2022 07:34:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJf-0001jL-JX; Thu, 10 Mar 2022 07:34:31 +0000 Received: by outflank-mailman (input) for mailman id 288156; Thu, 10 Mar 2022 07:34:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJd-0000ZP-0Z for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:29 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 815f2fc0-a044-11ec-8539-5f4723681683; Thu, 10 Mar 2022 08:34:23 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9A55921119; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4D28113FA3; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KBeWEQKqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 815f2fc0-a044-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897666; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AhjU8N75KhNEeyHRPfbUqSNllPUdHjiBKtRHcOwH+NQ=; b=l7Bvv7wg/Qnax3Di+qwgc44n7xxH9fb21o/z3Bf4nFM14SjS+0F3+hds1sZ9lqv2/JIAy7 vFYRq68hDT/TNwo514TsuCPC/G+Of86WEtEJhVf4LYrjmGkToE3ogp65xzzKIMNyZxWNov bNHqGqUouhM/1kDYqI/qILUh2ipHswA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v4 07/11] xen: generate hypercall interface related code Date: Thu, 10 Mar 2022 08:34:16 +0100 Message-Id: <20220310073420.15622-8-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897694784100003 Content-Type: text/plain; charset="utf-8" Instead of repeating similar data multiple times use a single source file and a generator script for producing prototypes and call sequences of the hypercalls. As the script already knows the number of parameters used add generating a macro for populating an array with the number of parameters per hypercall. The priorities for the specific hypercalls are based on two benchamrks performed in guests (PV and PVH): - make -j 4 of the Xen hypervisor (resulting in cpu load with lots of processes created) - scp of a large file to the guest (network load) With a small additional debug patch applied the number of the different hypercalls in the guest and in dom0 (for looking at backend activity related hypercalls) were counted while the benchmark in domU was running: PV-hypercall PV-guest build PV-guest scp dom0 build dom0 scp mmu_update 186175729 2865 20936 33725 stack_switch 1273311 62381 108589 270764 multicall 2182803 50 302 524 update_va_mapping 571868 10 60 80 xen_version 73061 850 859 5432 grant_table_op 0 0 35557 139110 iret 75673006 484132 268157 757958 vcpu_op 453037 71199 138224 334988 set_segment_base 1650249 62387 108645 270823 mmuext_op 11225681 188 7239 3426 sched_op 280153 134645 70729 137943 event_channel_op 192327 66204 71409 214191 physdev_op 0 0 7721 4315 (the dom0 values are for the guest running the build or scp test, so dom0 acting as backend) HVM-hypercall PVH-guest build PVH-guest scp vcpu_op 277684 2324 event_channel_op 350233 57383 (the related dom0 counter values are in the same range as with the test running in the PV guest) Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Acked-by: Julien Grall --- V2: - split platform_op for doe and compat prefixes (Jan Beulich) - add "addline:" directive - add priorities to handlers (Jan Beulich) V2.1: - add missing "delete" statement in awk script - optimize case of 2 hypercalls with same priority V2.2: - avoid asort() function (Michal Orzel) V3: - drop "addline:" support, as no longer needed - enclose call sequence macros in "({ ... })" (Jan Beulich) - small style adjustment (Jan Beulich) - move generating to xen/include/Makefile (Anthony PERARD) V4: - generate cf_check attribute for prototype (will be removed in later patch) - add Arm-specific variant of physdev_op() --- .gitignore | 1 + xen/include/Makefile | 13 ++ xen/include/hypercall-defs.c | 285 ++++++++++++++++++++++++++++++ xen/scripts/gen_hypercall.awk | 314 ++++++++++++++++++++++++++++++++++ 4 files changed, 613 insertions(+) create mode 100644 xen/include/hypercall-defs.c create mode 100644 xen/scripts/gen_hypercall.awk diff --git a/.gitignore b/.gitignore index d425be4bd9..c6e5b31b98 100644 --- a/.gitignore +++ b/.gitignore @@ -324,6 +324,7 @@ xen/include/public/public xen/include/xen/*.new xen/include/xen/acm_policy.h xen/include/xen/compile.h +xen/include/xen/hypercall-defs.h xen/include/xen/lib/x86/cpuid-autogen.h xen/test/livepatch/config.h xen/test/livepatch/expect_config.h diff --git a/xen/include/Makefile b/xen/include/Makefile index a3c2511f5f..b52a2da40c 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -77,6 +77,18 @@ $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$= (xlat-y)) $(obj)/config/ cat $(filter %.h,$^) >$@.new mv -f $@.new $@ =20 +quiet_cmd_genhyp =3D GEN $@ +define cmd_genhyp + awk -f $(src)/../scripts/gen_hypercall.awk <$< >$@ +endef + +all: $(obj)/xen/hypercall-defs.h + +$(obj)/xen/hypercall-defs.h: $(obj)/hypercall-defs.i $(src)/../scripts/gen= _hypercall.awk FORCE + $(call if_changed,genhyp) + +targets +=3D xen/hypercall-defs.h + ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) =20 all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk @@ -132,3 +144,4 @@ all: lib-x86-all endif =20 clean-files :=3D compat config generated headers*.chk xen/lib/x86/cpuid-au= togen.h +clean-files +=3D xen/hypercall-defs.h hypercall-defs.i diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c new file mode 100644 index 0000000000..69a1e3c0c9 --- /dev/null +++ b/xen/include/hypercall-defs.c @@ -0,0 +1,285 @@ +/* + * Hypercall interface description: + * Used by scripts/gen_hypercall.awk to generate hypercall prototypes and = call + * sequences. + * + * Syntax is like a prototype, but without return type and without the ";"= at + * the end. Pointer types will be automatically converted to use the + * XEN_GUEST_HANDLE_PARAM() macro. Handlers with no parameters just use a + * definition like "fn()". + * Hypercall/function names are without the leading "__HYPERVISOR_"/"do_" + * strings. + * + * The return type of a class of prototypes using the same prefix is set v= ia: + * rettype: + * Default return type is "long". A return type for a prefix can be set on= ly + * once and it needs to be set before that prefix is being used via the + * "prefix:" directive. + * + * The prefix of the prototypes is set via a line: + * prefix: ... + * Multiple prefixes are possible (restriction see below). Prefixes are wi= thout + * a trailing "_". The current prefix settings are active until a new "pre= fix:" + * line. + * + * Caller macros are suffixed with a selectable name via lines like: + * caller: + * When a caller suffix is active, there is only one active prefix allowed. + * + * With a "defhandle:" line it is possible to add a DEFINE_XEN_GUEST_HANDL= E() + * to the generated header: + * defhandle: [] + * Without specifying only a DEFINE_XEN_GUEST_HANDLE() + * will be generated, otherwise it will be a + * __DEFINE_XEN_GUEST_HANDLE(, ) being generated. Note = that + * the latter will include the related "const" handle "const_= ". + * + * In order to support using coding style compliant pointers in the + * prototypes it is possible to add translation entries to generate the co= rrect + * handle types: + * handle: + * This will result in the prototype translation from " *" to + * "XEN_GUEST_HANDLE_PARAM()". + * + * The hypercall handler calling code will be generated from a final table= in + * the source file, which is started via the line: + * table: ... + * with the s specifying the designated caller macro of each colum= n of + * the table. Any column of a not having been set via a "caller:" + * line will be ignored. + * The first column of the table contains the hypercall/prototype, each + * column contains the prefix for the function to use for that ca= ller. + * A function prefix can be annotated with a priority by adding ":" = to it + * ("1" being the highest priority, higher numbers mean lower priority, no + * priority specified is the lowest priority). The generated code will try= to + * achieve better performance for calling high priority handlers. + * A column not being supported by a is marked with "-". Lines wi= th all + * entries being "-" after removal of inactive columns are ignore= d. + * + * This file is being preprocessed using $(CPP), so #ifdef CONFIG_* condit= ionals + * are possible. + */ + +#ifdef CONFIG_HVM +#define PREFIX_hvm hvm +#else +#define PREFIX_hvm +#endif + +#ifdef CONFIG_COMPAT +#define PREFIX_compat compat +rettype: compat int +#else +#define PREFIX_compat +#endif + +#ifdef CONFIG_ARM +#define PREFIX_dep dep +#define PREFIX_do_arm do_arm +rettype: do_arm int +#else +#define PREFIX_dep +#define PREFIX_do_arm +#endif + +handle: uint unsigned int +handle: const_void const void +handle: const_char const char + +#ifdef CONFIG_COMPAT +defhandle: multicall_entry_compat_t +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +defhandle: compat_platform_op_t +#endif +#endif +#ifdef CONFIG_PV32 +defhandle: trap_info_compat_t +defhandle: physdev_op_compat_t +#endif + +prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm +physdev_op(int cmd, void *arg) + +prefix: do PREFIX_hvm PREFIX_compat +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM) +grant_table_op(unsigned int cmd, void *uop, unsigned int count) +#endif + +prefix: do PREFIX_hvm +memory_op(unsigned long cmd, void *arg) + +prefix: do PREFIX_compat +xen_version(int cmd, void *arg) +vcpu_op(int cmd, unsigned int vcpuid, void *arg) +sched_op(int cmd, void *arg) +xsm_op(void *op) +callback_op(int cmd, const void *arg) +#ifdef CONFIG_ARGO +argo_op(unsigned int cmd, void *arg1, void *arg2, unsigned long arg3, unsi= gned long arg4) +#endif +#ifdef CONFIG_KEXEC +kexec_op(unsigned int op, void *uarg) +#endif +#ifdef CONFIG_PV +iret() +nmi_op(unsigned int cmd, void *arg) +#ifdef CONFIG_XENOPROF +xenoprof_op(int op, void *arg) +#endif +#endif /* CONFIG_PV */ + +#ifdef CONFIG_COMPAT +prefix: compat +set_timer_op(uint32_t lo, int32_t hi) +multicall(multicall_entry_compat_t *call_list, uint32_t nr_calls) +memory_op(unsigned int cmd, void *arg) +#ifdef CONFIG_IOREQ_SERVER +dm_op(domid_t domid, unsigned int nr_bufs, void *bufs) +#endif +mmuext_op(void *arg, unsigned int count, uint *pdone, unsigned int foreign= dom) +#ifdef CONFIG_PV32 +set_trap_table(trap_info_compat_t *traps) +set_gdt(unsigned int *frame_list, unsigned int entries) +set_callbacks(unsigned long event_selector, unsigned long event_address, u= nsigned long failsafe_selector, unsigned long failsafe_address) +update_descriptor(uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32= _t desc_hi) +update_va_mapping(unsigned int va, uint32_t lo, uint32_t hi, unsigned int = flags) +physdev_op_compat(physdev_op_compat_t *uop) +update_va_mapping_otherdomain(unsigned int va, uint32_t lo, uint32_t hi, u= nsigned int flags, domid_t domid) +#endif +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +platform_op(compat_platform_op_t *u_xenpf_op) +#endif +#endif /* CONFIG_COMPAT */ + +#if defined(CONFIG_PV) || defined(CONFIG_ARM) +prefix: do PREFIX_dep +event_channel_op_compat(evtchn_op_t *uop) +physdev_op_compat(physdev_op_t *uop) +/* Legacy hypercall (as of 0x00030101). */ +sched_op_compat(int cmd, unsigned long arg) +#endif + +prefix: do +set_timer_op(s_time_t timeout) +console_io(unsigned int cmd, unsigned int count, char *buffer) +vm_assist(unsigned int cmd, unsigned int type) +event_channel_op(int cmd, void *arg) +mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsi= gned int foreigndom) +multicall(multicall_entry_t *call_list, unsigned int nr_calls) +#ifdef CONFIG_PV +mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, u= nsigned int foreigndom) +stack_switch(unsigned long ss, unsigned long esp) +fpu_taskswitch(int set) +set_debugreg(int reg, unsigned long value) +get_debugreg(int reg) +set_segment_base(unsigned int which, unsigned long base) +mca(xen_mc_t *u_xen_mc) +set_trap_table(const_trap_info_t *traps) +set_gdt(xen_ulong_t *frame_list, unsigned int entries) +set_callbacks(unsigned long event_address, unsigned long failsafe_address,= unsigned long syscall_address) +update_descriptor(uint64_t gaddr, seg_desc_t desc) +update_va_mapping(unsigned long va, uint64_t val64, unsigned long flags) +update_va_mapping_otherdomain(unsigned long va, uint64_t val64, unsigned l= ong flags, domid_t domid) +#endif +#ifdef CONFIG_IOREQ_SERVER +dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t *bufs) +#endif +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +sysctl(xen_sysctl_t *u_sysctl) +domctl(xen_domctl_t *u_domctl) +paging_domctl_cont(xen_domctl_t *u_domctl) +platform_op(xen_platform_op_t *u_xenpf_op) +#endif +#ifdef CONFIG_HVM +hvm_op(unsigned long op, void *arg) +#endif +#ifdef CONFIG_HYPFS +hypfs_op(unsigned int cmd, const char *arg1, unsigned long arg2, void *arg= 3, unsigned long arg4) +#endif +#ifdef CONFIG_X86 +xenpmu_op(unsigned int op, xen_pmu_params_t *arg) +#endif + +#ifdef CONFIG_PV +caller: pv64 +#ifdef CONFIG_PV32 +caller: pv32 +#endif +#endif +#if defined(CONFIG_HVM) && defined(CONFIG_X86) +caller: hvm64 +#ifdef CONFIG_COMPAT +caller: hvm32 +#endif +#endif +#ifdef CONFIG_ARM +caller: arm +#endif + +table: pv32 pv64 hvm32 hvm64 arm +set_trap_table compat do - - - +mmu_update do:1 do:1 - - - +set_gdt compat do - - - +stack_switch do:2 do:2 - - - +set_callbacks compat do - - - +fpu_taskswitch do do - - - +sched_op_compat do do - - dep +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +platform_op compat do compat do do +#endif +set_debugreg do do - - - +get_debugreg do do - - - +update_descriptor compat do - - - +memory_op compat do hvm hvm do +multicall compat:2 do:2 compat do do +update_va_mapping compat do - - - +set_timer_op compat do compat do - +event_channel_op_compat do do - - dep +xen_version compat do compat do do +console_io do do do do do +physdev_op_compat compat do - - dep +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM) +grant_table_op compat do hvm hvm do +#endif +vm_assist do do do do do +update_va_mapping_otherdomain compat do - - - +iret compat:1 do:1 - - - +vcpu_op compat do compat:1 do:1 do +set_segment_base do:2 do:2 - - - +#ifdef CONFIG_PV +mmuext_op compat:2 do:2 compat do - +#endif +xsm_op compat do compat do do +nmi_op compat do - - - +sched_op compat do compat do do +callback_op compat do - - - +#ifdef CONFIG_XENOPROF +xenoprof_op compat do - - - +#endif +event_channel_op do do do:1 do:1 do +physdev_op compat do hvm hvm do_= arm +#ifdef CONFIG_HVM +hvm_op do do do do do +#endif +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +sysctl do do do do do +domctl do do do do do +#endif +#ifdef CONFIG_KEXEC +kexec_op compat do - - - +#endif +tmem_op - - - - - +#ifdef CONFIG_ARGO +argo_op compat do compat do do +#endif +xenpmu_op do do do do - +#ifdef CONFIG_IOREQ_SERVER +dm_op compat do compat do do +#endif +#ifdef CONFIG_HYPFS +hypfs_op do do do do do +#endif +mca do do - - - +#ifndef CONFIG_PV_SHIM_EXCLUSIVE +paging_domctl_cont do do do do - +#endif diff --git a/xen/scripts/gen_hypercall.awk b/xen/scripts/gen_hypercall.awk new file mode 100644 index 0000000000..403758be21 --- /dev/null +++ b/xen/scripts/gen_hypercall.awk @@ -0,0 +1,314 @@ +# awk script to generate hypercall handler prototypes and a macro for doing +# the calls of the handlers inside a switch() statement. + +BEGIN { + printf("/* Generated file, do not edit! */\n\n"); + e =3D 0; + n =3D 0; + p =3D 0; + nc =3D 0; +} + +# Issue error to stderr +function do_err(msg) { + print "Error: "msg": "$0 >"/dev/stderr"; + exit 1; +} + +# Generate handler call +function do_call(f, p, i) { + printf(" ret =3D %s_%s(", pre[f, p], fn[f]); + for (i =3D 1; i <=3D n_args[f]; i++) { + if (i > 1) + printf(", "); + if (ptr[f, i]) + printf("(XEN_GUEST_HANDLE_PARAM(%s)){ _p(a%d) }", typ[f, i], i= ); + else + printf("(%s)(a%d)", typ[f, i], i); + } + printf("); \\\n"); +} + +# Generate case statement for call +function do_case(f, p) { + printf(" case __HYPERVISOR_%s: \\\n", fn[f]); + do_call(f, p); + printf(" break; \\\n"); +} + +# Generate switch statement for calling handlers +function do_switch(ca, p, i) { + printf(" switch ( num ) \\\n"); + printf(" { \\\n"); + for (i =3D 1; i <=3D nc; i++) + if (call[i] =3D=3D ca && call_prio[i] =3D=3D p) + do_case(call_fn[i], call_p[i]); + printf(" default: \\\n"); + printf(" ret =3D -ENOSYS; \\\n"); + printf(" break; \\\n"); + printf(" } \\\n"); +} + +function rest_of_line(par, i, val) { + val =3D $(par); + for (i =3D par + 1; i <=3D NF; i++) + val =3D val " " $(i); + return val; +} + +# Handle comments (multi- and single line) +$1 =3D=3D "/*" { + comment =3D 1; +} +comment =3D=3D 1 { + if ($(NF) =3D=3D "*/") comment =3D 0; + next; +} + +# Skip preprocessing artefacts +$1 =3D=3D "extern" { + next; +} +/^#/ { + next; +} + +# Drop empty lines +NF =3D=3D 0 { + next; +} + +# Handle "handle:" line +$1 =3D=3D "handle:" { + if (NF < 3) + do_err("\"handle:\" requires at least two parameters"); + val =3D rest_of_line(3); + xlate[val] =3D $2; + next; +} + +# Handle "defhandle:" line +$1 =3D=3D "defhandle:" { + if (NF < 2) + do_err("\"defhandle:\" requires at least one parameter"); + e++; + if (NF =3D=3D 2) { + emit[e] =3D sprintf("DEFINE_XEN_GUEST_HANDLE(%s);", $2); + } else { + val =3D rest_of_line(3); + emit[e] =3D sprintf("__DEFINE_XEN_GUEST_HANDLE(%s, %s);", $2, val); + xlate[val] =3D $2; + } + next; +} + +# Handle "rettype:" line +$1 =3D=3D "rettype:" { + if (NF < 3) + do_err("\"rettype:\" requires at least two parameters"); + if ($2 in rettype) + do_err("rettype can be set only once for each prefix"); + rettype[$2] =3D rest_of_line(3); + next; +} + +# Handle "caller:" line +$1 =3D=3D "caller:" { + caller[$2] =3D 1; + next; +} + +# Handle "prefix:" line +$1 =3D=3D "prefix:" { + p =3D NF - 1; + for (i =3D 2; i <=3D NF; i++) { + prefix[i - 1] =3D $(i); + if (!(prefix[i - 1] in rettype)) + rettype[prefix[i - 1]] =3D "long"; + } + next; +} + +# Handle "table:" line +$1 =3D=3D "table:" { + table =3D 1; + for (i =3D 2; i <=3D NF; i++) + col[i - 1] =3D $(i); + n_cols =3D NF - 1; + next; +} + +# Handle table definition line +table =3D=3D 1 { + if (NF !=3D n_cols + 1) + do_err("Table definition line has wrong number of fields"); + for (c =3D 1; c <=3D n_cols; c++) { + if (caller[col[c]] !=3D 1) + continue; + if ($(c + 1) =3D=3D "-") + continue; + pref =3D $(c + 1); + idx =3D index(pref, ":"); + if (idx =3D=3D 0) + prio =3D 100; + else { + prio =3D substr(pref, idx + 1) + 0; + pref =3D substr(pref, 1, idx - 1); + if (prio >=3D 100 || prio < 1) + do_err("Priority must be in the range 1..99"); + } + fnd =3D 0; + for (i =3D 1; i <=3D n; i++) { + if (fn[i] !=3D $1) + continue; + for (j =3D 1; j <=3D n_pre[i]; j++) { + if (pre[i, j] =3D=3D pref) { + prios[col[c], prio]++; + if (prios[col[c], prio] =3D=3D 1) { + n_prios[col[c]]++; + prio_list[col[c], n_prios[col[c]]] =3D prio; + prio_mask[col[c], prio] =3D "(1ULL << __HYPERVISOR= _"$1")"; + } else + prio_mask[col[c], prio] =3D prio_mask[col[c], prio= ] " | (1ULL << __HYPERVISOR_"$1")"; + nc++; + call[nc] =3D col[c]; + call_fn[nc] =3D i; + call_p[nc] =3D j; + call_prio[nc] =3D prio; + fnd =3D 1; + } + } + } + if (fnd =3D=3D 0) + do_err("No prototype for prefix/hypercall combination"); + } + next; +} + +# Prototype line +{ + bro =3D index($0, "("); + brc =3D index($0, ")"); + if (bro < 2 || brc < bro) + do_err("No valid prototype line"); + n++; + fn[n] =3D substr($0, 1, bro - 1); + n_pre[n] =3D p; + for (i =3D 1; i <=3D p; i++) + pre[n, i] =3D prefix[i]; + args =3D substr($0, bro + 1, brc - bro - 1); + n_args[n] =3D split(args, a, ","); + if (n_args[n] > 5) + do_err("Too many parameters"); + for (i =3D 1; i <=3D n_args[n]; i++) { + sub("^ *", "", a[i]); # Remove leading white space + sub(" +", " ", a[i]); # Replace multiple spaces with singl= e ones + sub(" *$", "", a[i]); # Remove trailing white space + ptr[n, i] =3D index(a[i], "*"); # Is it a pointer type? + sub("[*]", "", a[i]); # Remove "*" + if (index(a[i], " ") =3D=3D 0) + do_err("Parameter with no type or no name"); + typ[n, i] =3D a[i]; + sub(" [^ ]+$", "", typ[n, i]); # Remove parameter name + if (ptr[n, i] && (typ[n, i] in xlate)) + typ[n, i] =3D xlate[typ[n, i]]; + arg[n, i] =3D a[i]; + sub("^([^ ]+ )+", "", arg[n, i]); # Remove parameter type + } +} + +# Generate the output +END { + # Verbatim generated lines + for (i =3D 1; i <=3D e; i++) + printf("%s\n", emit[i]); + printf("\n"); + # Generate prototypes + for (i =3D 1; i <=3D n; i++) { + for (p =3D 1; p <=3D n_pre[i]; p++) { + printf("%s cf_check %s_%s(", rettype[pre[i, p]], pre[i, p], fn= [i]); + if (n_args[i] =3D=3D 0) + printf("void"); + else + for (j =3D 1; j <=3D n_args[i]; j++) { + if (j > 1) + printf(", "); + if (ptr[i, j]) + printf("XEN_GUEST_HANDLE_PARAM(%s)", typ[i, j]); + else + printf("%s", typ[i, j]); + printf(" %s", arg[i, j]); + } + printf(");\n"); + } + } + # Generate call sequences and args array contents + for (ca in caller) { + if (caller[ca] !=3D 1) + continue; + need_mask =3D 0; + for (pl =3D 1; pl <=3D n_prios[ca]; pl++) { + for (pll =3D pl; pll > 1; pll--) { + if (prio_list[ca, pl] > p_list[pll - 1]) + break; + else + p_list[pll] =3D p_list[pll - 1]; + } + p_list[pll] =3D prio_list[ca, pl]; + # If any prio but the default one has more than 1 entry we nee= d "mask" + if (p_list[pll] !=3D 100 && prios[ca, p_list[pll]] > 1) + need_mask =3D 1; + } + printf("\n"); + printf("#define call_handlers_%s(num, ret, a1, a2, a3, a4, a5) \\\= n", ca); + printf("({ \\\n"); + if (need_mask) + printf(" uint64_t mask =3D 1ULL << num; \\\n"); + printf(" "); + for (pl =3D 1; pl <=3D n_prios[ca]; pl++) { + if (prios[ca, p_list[pl]] > 1) { + if (pl < n_prios[ca]) { + printf(" if ( likely(mask & (%s)) ) \\\n", prio_mas= k[ca, p_list[pl]]); + printf(" { \\\n"); + } + if (prios[ca, p_list[pl]] =3D=3D 2) { + fnd =3D 0; + for (i =3D 1; i <=3D nc; i++) + if (call[i] =3D=3D ca && call_prio[i] =3D=3D p_lis= t[pl]) { + fnd++; + if (fnd =3D=3D 1) + printf(" if ( num =3D=3D __HYPERVIS= OR_%s ) \\\n", fn[call_fn[i]]); + else + printf(" else \\\n"); + do_call(call_fn[i], call_p[i]); + } + } else { + do_switch(ca, p_list[pl]); + } + if (pl < n_prios[ca]) + printf(" } \\\n"); + } else { + for (i =3D 1; i <=3D nc; i++) + if (call[i] =3D=3D ca && call_prio[i] =3D=3D p_list[pl= ]) { + printf("if ( likely(num =3D=3D __HYPERVISOR_%s) ) = \\\n", fn[call_fn[i]]); + do_call(call_fn[i], call_p[i]); + } + } + if (pl < n_prios[ca] || prios[ca, p_list[pl]] <=3D 2) + printf(" else \\\n"); + } + if (prios[ca, p_list[n_prios[ca]]] <=3D 2) { + printf("\\\n"); + printf(" ret =3D -ENOSYS; \\\n"); + } + printf("})\n"); + delete p_list; + printf("\n"); + printf("#define hypercall_args_%s \\\n", ca); + printf("{ \\\n"); + for (i =3D 1; i <=3D nc; i++) + if (call[i] =3D=3D ca) + printf("[__HYPERVISOR_%s] =3D %d, \\\n", fn[call_fn[i]], n= _args[call_fn[i]]); + printf("}\n"); + } +} --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897697; cv=none; d=zohomail.com; s=zohoarc; b=O2aW/KHGhTqrEvBFzNep1ib5yP4Tr0WWuibjoqPNBFE+tQJJPHAohea2vBSEj6/sbSZxjTA4Apaa4YiuohW5DXOkzHJ2qZtwUezSFmwxegzMEJQI83XKaOxmd6/E/pifKSlrd96xYzeSMAmUzzqJMOFtlMEXpQP6VRjzbh34HN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897697; h=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; bh=fpeb6uD18aovTlXLd3NOy6bT95PYcP/pbwh726wUhUU=; b=fvtadTdJqFUA+zTU1NiijHnm2P5/9dpLHiB1o7//WMl6WWiDgvmDArUsCub3V1I66Q0TTRv7n3dhU25yK0fnhneKZK+gLiK+WDGpTPHoKj9zpiOoP1Q9ludCJ1/9AogrjbKJ9HwINPVmrCkIQV/rVdmtFtWgtdiA70lo8k8cEck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897697802593.2390226420245; Wed, 9 Mar 2022 23:34:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288159.488691 (Exim 4.92) (envelope-from ) id 1nSDJj-0002hE-Os; Thu, 10 Mar 2022 07:34:35 +0000 Received: by outflank-mailman (output) from mailman id 288159.488691; Thu, 10 Mar 2022 07:34:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJj-0002cm-EU; Thu, 10 Mar 2022 07:34:35 +0000 Received: by outflank-mailman (input) for mailman id 288159; Thu, 10 Mar 2022 07:34:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJe-0000ZP-0o for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:30 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 81962ef3-a044-11ec-8539-5f4723681683; Thu, 10 Mar 2022 08:34:23 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E0C6121122; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9567113FA5; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qClbIwKqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 81962ef3-a044-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897666; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fpeb6uD18aovTlXLd3NOy6bT95PYcP/pbwh726wUhUU=; b=rnDeeYz24m2Lmj16sckhmuEFSZzc3nNAt41OPCQvBNGHz0m96r5y67KZL4F9drNFS6e0zM y0DBhnMoE4TEl1TvNXO76ooUMWgd9Hm0tG82W32+lPXQZy/B29/c3RD30q+VN3Iukst87f W7Cg2HsqtVaOFmScbO52O8qCnrN9OpA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v4 08/11] xen: use generated prototypes for hypercall handlers Date: Thu, 10 Mar 2022 08:34:17 +0100 Message-Id: <20220310073420.15622-9-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897699347100002 Content-Type: text/plain; charset="utf-8" Remove the hypercall handler's prototypes in the related header files and use the generated ones instead. Some handlers having been static before need to be made globally visible. Signed-off-by: Juergen Gross Acked-by: Jan Beulich Acked-by: Julien Grall --- xen/arch/arm/include/asm/hypercall.h | 1 - xen/arch/x86/hvm/hypercall.c | 7 +- xen/arch/x86/include/asm/hypercall.h | 141 --------------------- xen/include/xen/hypercall.h | 177 +-------------------------- 4 files changed, 5 insertions(+), 321 deletions(-) diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/as= m/hypercall.h index 8182895358..ccd26c5184 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -6,7 +6,6 @@ #define __ASM_ARM_HYPERCALL_H__ =20 #include /* for arch_do_domctl */ -int do_arm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); =20 long subarch_do_domctl(struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 7ea1afd8fe..a9c9ad721f 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -31,8 +31,7 @@ #include #include =20 -static long cf_check hvm_memory_op( - unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +long cf_check hvm_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void= ) arg) { long rc; =20 @@ -52,7 +51,7 @@ static long cf_check hvm_memory_op( } =20 #ifdef CONFIG_GRANT_TABLE -static long cf_check hvm_grant_table_op( +long cf_check hvm_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) { switch ( cmd ) @@ -78,7 +77,7 @@ static long cf_check hvm_grant_table_op( } #endif =20 -static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +long cf_check hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { const struct vcpu *curr =3D current; const struct domain *currd =3D curr->domain; diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 81ca25f7b3..2d243b48bc 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -44,109 +44,6 @@ void pv_ring3_init_hypercall_page(void *ptr); */ #define MMU_UPDATE_PREEMPTED (~(~0U>>1)) =20 -extern long cf_check -do_event_channel_op_compat( - XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop); - -/* Legacy hypercall (as of 0x00030202). */ -extern long cf_check do_physdev_op_compat( - XEN_GUEST_HANDLE(physdev_op_t) uop); - -/* Legacy hypercall (as of 0x00030101). */ -extern long cf_check do_sched_op_compat( - int cmd, unsigned long arg); - -extern long cf_check -do_set_trap_table( - XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps); - -extern long cf_check -do_mmu_update( - XEN_GUEST_HANDLE_PARAM(mmu_update_t) ureqs, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(uint) pdone, - unsigned int foreigndom); - -extern long cf_check -do_set_gdt( - XEN_GUEST_HANDLE_PARAM(xen_ulong_t) frame_list, - unsigned int entries); - -extern long cf_check -do_stack_switch( - unsigned long ss, - unsigned long esp); - -extern long cf_check -do_fpu_taskswitch( - int set); - -extern long cf_check -do_set_debugreg( - int reg, - unsigned long value); - -extern long cf_check -do_get_debugreg( - int reg); - -extern long cf_check -do_update_descriptor( - uint64_t gaddr, seg_desc_t desc); - -extern long cf_check -do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc); - -extern long cf_check -do_update_va_mapping( - unsigned long va, - uint64_t val64, - unsigned long flags); - -extern long cf_check -do_physdev_op( - int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_update_va_mapping_otherdomain( - unsigned long va, - uint64_t val64, - unsigned long flags, - domid_t domid); - -extern long cf_check -do_mmuext_op( - XEN_GUEST_HANDLE_PARAM(mmuext_op_t) uops, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(uint) pdone, - unsigned int foreigndom); - -extern long cf_check do_callback_op( - int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg); - -extern long cf_check -do_iret( - void); - -extern long cf_check -do_set_callbacks( - unsigned long event_address, - unsigned long failsafe_address, - unsigned long syscall_address); - -extern long cf_check -do_set_segment_base( - unsigned int which, - unsigned long base); - -long cf_check do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg= ); - -long cf_check do_xenpmu_op(unsigned int op, - XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg); - -long cf_check do_paging_domctl_cont( - XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); - #ifdef CONFIG_COMPAT =20 #include @@ -157,44 +54,6 @@ extern int compat_common_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern int cf_check compat_mmuext_op( - XEN_GUEST_HANDLE_PARAM(void) arg, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(uint) pdone, - unsigned int foreigndom); - -extern int cf_check compat_callback_op( - int cmd, XEN_GUEST_HANDLE(const_void) arg); - -extern int cf_check compat_update_va_mapping( - unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags); - -extern int cf_check compat_update_va_mapping_otherdomain( - unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags, domid_t= domid); - -DEFINE_XEN_GUEST_HANDLE(trap_info_compat_t); -extern int cf_check compat_set_trap_table( - XEN_GUEST_HANDLE(trap_info_compat_t) traps); - -extern int cf_check compat_set_gdt( - XEN_GUEST_HANDLE_PARAM(uint) frame_list, unsigned int entries); - -extern int cf_check compat_update_descriptor( - uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi); - -extern int cf_check compat_iret(void); - -extern int cf_check compat_nmi_op( - unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check compat_set_callbacks( - unsigned long event_selector, unsigned long event_address, - unsigned long failsafe_selector, unsigned long failsafe_address); - -DEFINE_XEN_GUEST_HANDLE(physdev_op_compat_t); -extern int cf_check compat_physdev_op_compat( - XEN_GUEST_HANDLE(physdev_op_compat_t) uop); - #endif /* CONFIG_COMPAT */ =20 #endif /* __ASM_X86_HYPERCALL_H__ */ diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index ca8ee22717..f307dfb597 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -21,33 +21,19 @@ #include #include =20 -extern long cf_check -do_sched_op( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_domctl( - XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); +/* Needs to be after asm/hypercall.h. */ +#include =20 extern long arch_do_domctl( struct xen_domctl *domctl, struct domain *d, XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); =20 -extern long cf_check -do_sysctl( - XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl); - extern long arch_do_sysctl( struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl); =20 -extern long cf_check -do_platform_op( - XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op); - extern long pci_physdev_op( int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); @@ -65,170 +51,11 @@ pci_physdev_op( #define MEMOP_EXTENT_SHIFT 6 /* cmd[:6] =3D=3D start_extent */ #define MEMOP_CMD_MASK ((1 << MEMOP_EXTENT_SHIFT) - 1) =20 -extern long cf_check -do_memory_op( - unsigned long cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_multicall( - XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, - unsigned int nr_calls); - -extern long cf_check -do_set_timer_op( - s_time_t timeout); - -extern long cf_check -do_event_channel_op( - int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_xen_version( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_console_io( - unsigned int cmd, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(char) buffer); - -extern long cf_check -do_grant_table_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count); - -extern long cf_check -do_vm_assist( - unsigned int cmd, - unsigned int type); - -extern long cf_check -do_vcpu_op( - int cmd, - unsigned int vcpuid, - XEN_GUEST_HANDLE_PARAM(void) arg); - -struct vcpu; extern long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern long cf_check -do_hvm_op( - unsigned long op, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_kexec_op( - unsigned int op, - XEN_GUEST_HANDLE_PARAM(void) uarg); - -extern long cf_check -do_xsm_op( - XEN_GUEST_HANDLE_PARAM(void) u_xsm_op); - -#ifdef CONFIG_ARGO -extern long cf_check do_argo_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg1, - XEN_GUEST_HANDLE_PARAM(void) arg2, - unsigned long arg3, - unsigned long arg4); -#endif - -extern long cf_check -do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long cf_check -do_dm_op( - domid_t domid, - unsigned int nr_bufs, - XEN_GUEST_HANDLE_PARAM(xen_dm_op_buf_t) bufs); - -#ifdef CONFIG_HYPFS -extern long cf_check -do_hypfs_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(const_char) arg1, - unsigned long arg2, - XEN_GUEST_HANDLE_PARAM(void) arg3, - unsigned long arg4); -#endif - -#ifdef CONFIG_COMPAT - -extern int cf_check -compat_memory_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check -compat_grant_table_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count); - -extern int cf_check -compat_vcpu_op( - int cmd, - unsigned int vcpuid, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check -compat_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check -compat_xen_version( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check -compat_sched_op( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int cf_check -compat_set_timer_op( - uint32_t lo, - int32_t hi); - -extern int cf_check compat_xsm_op( - XEN_GUEST_HANDLE_PARAM(void) op); - -extern int cf_check compat_kexec_op( - unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg); - -DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t); -extern int cf_check compat_multicall( - XEN_GUEST_HANDLE_PARAM(multicall_entry_compat_t) call_list, - uint32_t nr_calls); - -int compat_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); -int compat_platform_op(XEN_GUEST_HANDLE_PARAM(compat_platform_op_t) u_xenp= f_op); - -#ifdef CONFIG_ARGO -extern int cf_check compat_argo_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg1, - XEN_GUEST_HANDLE_PARAM(void) arg2, - unsigned long arg3, - unsigned long arg4); -#endif - -extern int cf_check -compat_dm_op( - domid_t domid, - unsigned int nr_bufs, - XEN_GUEST_HANDLE_PARAM(void) bufs); - -#endif - void arch_get_xen_caps(xen_capabilities_info_t *info); =20 #endif /* __XEN_HYPERCALL_H__ */ --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897703; cv=none; d=zohomail.com; s=zohoarc; b=jjBtFYay9cRWzAD+/MHifV3x/qMHr1Wkw7Y5AFgYVotV9a4YT5tNJIO0ny7Rx8czfpVUMFMlaIkKZcFrgc9WKqZIduTzybVOqkczsfMDEr6QBuh8DO8h3XTPNerC/nuyeM+o4tNvfaYNNVUhk2s2HcI7WpMEWSrJ+zaflzfoMCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897703; h=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; bh=jxFsIOim8YQwQdGouIeDKfpkYqPTH+rehYL0W8dRFU0=; b=KU+rczJ8p4TPh2JEIeSQxqomTyZrciue1GSRIdY+L+gbPLAWDl+cI1+LGGRfym8Yvvf4dSBuKK7d9z8zBZsSMt+SMiZLLMQ50MfAvdZRCaZGObQ72NzFf4SPVgsaJfmGO6SuCoQ5CCO+qARC6bgIbhebL77pOBBBt5VvjIzxMyY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897703878786.7365371064046; Wed, 9 Mar 2022 23:35:03 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288161.488714 (Exim 4.92) (envelope-from ) id 1nSDJn-0003GT-59; Thu, 10 Mar 2022 07:34:39 +0000 Received: by outflank-mailman (output) from mailman id 288161.488714; Thu, 10 Mar 2022 07:34:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJm-0003DS-3P; Thu, 10 Mar 2022 07:34:38 +0000 Received: by outflank-mailman (input) for mailman id 288161; Thu, 10 Mar 2022 07:34:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJf-0000ZP-16 for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:31 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 81b083d8-a044-11ec-8539-5f4723681683; Thu, 10 Mar 2022 08:34:23 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2AD4721123; Thu, 10 Mar 2022 07:34:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E83F713FA3; Thu, 10 Mar 2022 07:34:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cBmANwKqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 81b083d8-a044-11ec-8539-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897667; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jxFsIOim8YQwQdGouIeDKfpkYqPTH+rehYL0W8dRFU0=; b=cGwohySYV8G61ejaXu1amWHW/yoQKRFf4vhEuR85juIRCBfa77/EyAnG0xuth4PodbqLGW fqDXqWbNZpUUz4NZ6K+2DJurzoID3qz/U8uwSvr3GpUIazxJb54Yf9/Q0QmEhcC/dYY8vJ Wq1ucUpCNieWmx6LOZTcbUoWJuWh/+Y= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH v4 09/11] xen/x86: call hypercall handlers via generated macro Date: Thu, 10 Mar 2022 08:34:18 +0100 Message-Id: <20220310073420.15622-10-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897705927100001 Content-Type: text/plain; charset="utf-8" Instead of using a function table use the generated macros for calling the appropriate hypercall handlers. This is beneficial to performance and avoids speculation issues. With calling the handlers using the correct number of parameters now it is possible to do the parameter register clobbering in the NDEBUG case after returning from the handler. With the additional generated data the hard coded hypercall_args_table[] can be replaced by tables using the generated number of parameters. Note that this change modifies behavior of clobbering registers in a minor way: in case a hypercall is returning -ENOSYS (or the unsigned equivalent thereof) for any reason the parameter registers will no longer be clobbered. This should be of no real concern, as those cases ought to be extremely rare and reuse of the registers in those cases seems rather far fetched. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V2: - make hypercall_args_*[] const (Jan Beulich) - make clobber_regs*() independent from NDEBUG (Jan Beulich) - drop "L" suffix for 32-bit register clobber value (Jan Beulich) V3: - add array_access_nospec() (Jan Beulich) - remove local variables in hvm_hypercall() (Andrew Cooper) --- xen/arch/x86/hvm/hypercall.c | 166 +++--------------------- xen/arch/x86/hypercall.c | 59 --------- xen/arch/x86/include/asm/hypercall.h | 55 ++++++-- xen/arch/x86/pv/hypercall.c | 184 +++------------------------ 4 files changed, 76 insertions(+), 388 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index a9c9ad721f..ae601185fc 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -111,56 +111,10 @@ long cf_check hvm_physdev_op(int cmd, XEN_GUEST_HANDL= E_PARAM(void) arg) return compat_physdev_op(cmd, arg); } =20 -#define HYPERCALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ - (hypercall_fn_t *) do_ ## x } - -#define HVM_CALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) hvm_ ## x, \ - (hypercall_fn_t *) hvm_ ## x } - -#define COMPAT_CALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ - (hypercall_fn_t *) compat_ ## x } - -static const struct { - hypercall_fn_t *native, *compat; -} hvm_hypercall_table[] =3D { - HVM_CALL(memory_op), - COMPAT_CALL(multicall), -#ifdef CONFIG_GRANT_TABLE - HVM_CALL(grant_table_op), -#endif - HYPERCALL(vm_assist), - COMPAT_CALL(vcpu_op), - HVM_CALL(physdev_op), - COMPAT_CALL(xen_version), - HYPERCALL(console_io), - HYPERCALL(event_channel_op), - COMPAT_CALL(sched_op), - COMPAT_CALL(set_timer_op), - COMPAT_CALL(xsm_op), - HYPERCALL(hvm_op), - HYPERCALL(sysctl), - HYPERCALL(domctl), -#ifdef CONFIG_ARGO - COMPAT_CALL(argo_op), -#endif - COMPAT_CALL(platform_op), -#ifdef CONFIG_PV - COMPAT_CALL(mmuext_op), -#endif - HYPERCALL(xenpmu_op), - COMPAT_CALL(dm_op), -#ifdef CONFIG_HYPFS - HYPERCALL(hypfs_op), +#ifndef NDEBUG +static const unsigned char hypercall_args_64[] =3D hypercall_args_hvm64; +static const unsigned char hypercall_args_32[] =3D hypercall_args_hvm32; #endif - HYPERCALL(paging_domctl_cont) -}; - -#undef HYPERCALL -#undef HVM_CALL -#undef COMPAT_CALL =20 int hvm_hypercall(struct cpu_user_regs *regs) { @@ -206,23 +160,6 @@ int hvm_hypercall(struct cpu_user_regs *regs) return ret; } =20 - BUILD_BUG_ON(ARRAY_SIZE(hvm_hypercall_table) > - ARRAY_SIZE(hypercall_args_table)); - - if ( eax >=3D ARRAY_SIZE(hvm_hypercall_table) ) - { - regs->rax =3D -ENOSYS; - return HVM_HCALL_completed; - } - - eax =3D array_index_nospec(eax, ARRAY_SIZE(hvm_hypercall_table)); - - if ( !hvm_hypercall_table[eax].native ) - { - regs->rax =3D -ENOSYS; - return HVM_HCALL_completed; - } - /* * Caching is intended for instruction emulation only. Disable it * for any accesses by hypercall argument copy-in / copy-out. @@ -233,85 +170,27 @@ int hvm_hypercall(struct cpu_user_regs *regs) =20 if ( mode =3D=3D 8 ) { - unsigned long rdi =3D regs->rdi; - unsigned long rsi =3D regs->rsi; - unsigned long rdx =3D regs->rdx; - unsigned long r10 =3D regs->r10; - unsigned long r8 =3D regs->r8; - HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%lu(%lx, %lx, %lx, %lx, %lx)", - eax, rdi, rsi, rdx, r10, r8); - -#ifndef NDEBUG - /* Deliberately corrupt parameter regs not used by this hypercall.= */ - switch ( hypercall_args_table[eax].native ) - { - case 0: rdi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 1: rsi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 2: rdx =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 3: r10 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 4: r8 =3D 0xdeadbeefdeadf00dUL; - } -#endif + eax, regs->rdi, regs->rsi, regs->rdx, regs->r10, regs-= >r8); =20 - regs->rax =3D hvm_hypercall_table[eax].native(rdi, rsi, rdx, r10, = r8); + call_handlers_hvm64(eax, regs->rax, regs->rdi, regs->rsi, regs->rd= x, + regs->r10, regs->r8); =20 -#ifndef NDEBUG - if ( !curr->hcall_preempted ) - { - /* Deliberately corrupt parameter regs used by this hypercall.= */ - switch ( hypercall_args_table[eax].native ) - { - case 5: regs->r8 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 4: regs->r10 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 3: regs->rdx =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 2: regs->rsi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 1: regs->rdi =3D 0xdeadbeefdeadf00dUL; - } - } -#endif + if ( !curr->hcall_preempted && regs->rax !=3D -ENOSYS ) + clobber_regs(regs, get_nargs(hypercall_args_64, eax)); } else { - unsigned int ebx =3D regs->ebx; - unsigned int ecx =3D regs->ecx; - unsigned int edx =3D regs->edx; - unsigned int esi =3D regs->esi; - unsigned int edi =3D regs->edi; - HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%lu(%x, %x, %x, %x, %x)", eax, - ebx, ecx, edx, esi, edi); - -#ifndef NDEBUG - /* Deliberately corrupt parameter regs not used by this hypercall.= */ - switch ( hypercall_args_table[eax].compat ) - { - case 0: ebx =3D 0xdeadf00d; fallthrough; - case 1: ecx =3D 0xdeadf00d; fallthrough; - case 2: edx =3D 0xdeadf00d; fallthrough; - case 3: esi =3D 0xdeadf00d; fallthrough; - case 4: edi =3D 0xdeadf00d; - } -#endif + regs->ebx, regs->ecx, regs->edx, regs->esi, regs->edi); =20 curr->hcall_compat =3D true; - regs->eax =3D hvm_hypercall_table[eax].compat(ebx, ecx, edx, esi, = edi); + call_handlers_hvm32(eax, regs->eax, regs->ebx, regs->ecx, regs->ed= x, + regs->esi, regs->edi); curr->hcall_compat =3D false; =20 -#ifndef NDEBUG - if ( !curr->hcall_preempted ) - { - /* Deliberately corrupt parameter regs used by this hypercall.= */ - switch ( hypercall_args_table[eax].compat ) - { - case 5: regs->rdi =3D 0xdeadf00d; fallthrough; - case 4: regs->rsi =3D 0xdeadf00d; fallthrough; - case 3: regs->rdx =3D 0xdeadf00d; fallthrough; - case 2: regs->rcx =3D 0xdeadf00d; fallthrough; - case 1: regs->rbx =3D 0xdeadf00d; - } - } -#endif + if ( !curr->hcall_preempted && regs->eax !=3D -ENOSYS ) + clobber_regs32(regs, get_nargs(hypercall_args_32, eax)); } =20 hvmemul_cache_restore(curr, token); @@ -332,31 +211,20 @@ int hvm_hypercall(struct cpu_user_regs *regs) enum mc_disposition hvm_do_multicall_call(struct mc_state *state) { struct vcpu *curr =3D current; - hypercall_fn_t *func =3D NULL; =20 if ( hvm_guest_x86_mode(curr) =3D=3D 8 ) { struct multicall_entry *call =3D &state->call; =20 - if ( call->op < ARRAY_SIZE(hvm_hypercall_table) ) - func =3D array_access_nospec(hvm_hypercall_table, call->op).na= tive; - if ( func ) - call->result =3D func(call->args[0], call->args[1], call->args= [2], - call->args[3], call->args[4]); - else - call->result =3D -ENOSYS; + call_handlers_hvm64(call->op, call->result, call->args[0], call->a= rgs[1], + call->args[2], call->args[3], call->args[4]); } else { struct compat_multicall_entry *call =3D &state->compat_call; =20 - if ( call->op < ARRAY_SIZE(hvm_hypercall_table) ) - func =3D array_access_nospec(hvm_hypercall_table, call->op).co= mpat; - if ( func ) - call->result =3D func(call->args[0], call->args[1], call->args= [2], - call->args[3], call->args[4]); - else - call->result =3D -ENOSYS; + call_handlers_hvm32(call->op, call->result, call->args[0], call->a= rgs[1], + call->args[2], call->args[3], call->args[4]); } =20 return !hvm_get_cpl(curr) ? mc_continue : mc_preempt; diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c index 07e1a45ef5..6b73cff9b9 100644 --- a/xen/arch/x86/hypercall.c +++ b/xen/arch/x86/hypercall.c @@ -22,65 +22,6 @@ #include #include =20 -#ifdef CONFIG_COMPAT -#define ARGS(x, n) \ - [ __HYPERVISOR_ ## x ] =3D { n, n } -#define COMP(x, n, c) \ - [ __HYPERVISOR_ ## x ] =3D { n, c } -#else -#define ARGS(x, n) [ __HYPERVISOR_ ## x ] =3D { n } -#define COMP(x, n, c) ARGS(x, n) -#endif - -const hypercall_args_t hypercall_args_table[NR_hypercalls] =3D -{ - ARGS(set_trap_table, 1), - ARGS(mmu_update, 4), - ARGS(set_gdt, 2), - ARGS(stack_switch, 2), - COMP(set_callbacks, 3, 4), - ARGS(fpu_taskswitch, 1), - ARGS(sched_op_compat, 2), - ARGS(platform_op, 1), - ARGS(set_debugreg, 2), - ARGS(get_debugreg, 1), - COMP(update_descriptor, 2, 4), - ARGS(memory_op, 2), - ARGS(multicall, 2), - COMP(update_va_mapping, 3, 4), - COMP(set_timer_op, 1, 2), - ARGS(event_channel_op_compat, 1), - ARGS(xen_version, 2), - ARGS(console_io, 3), - ARGS(physdev_op_compat, 1), - ARGS(grant_table_op, 3), - ARGS(vm_assist, 2), - COMP(update_va_mapping_otherdomain, 4, 5), - ARGS(vcpu_op, 3), - COMP(set_segment_base, 2, 0), - ARGS(mmuext_op, 4), - ARGS(xsm_op, 1), - ARGS(nmi_op, 2), - ARGS(sched_op, 2), - ARGS(callback_op, 2), - ARGS(xenoprof_op, 2), - ARGS(event_channel_op, 2), - ARGS(physdev_op, 2), - ARGS(sysctl, 1), - ARGS(domctl, 1), - ARGS(kexec_op, 2), - ARGS(argo_op, 5), - ARGS(xenpmu_op, 2), - ARGS(hvm_op, 2), - ARGS(dm_op, 3), - ARGS(hypfs_op, 5), - ARGS(mca, 1), - ARGS(paging_domctl_cont, 1), -}; - -#undef COMP -#undef ARGS - #define NEXT_ARG(fmt, args) = \ ({ = \ unsigned long __arg; = \ diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index 2d243b48bc..ab8bd12e60 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -17,19 +17,6 @@ =20 #define __HYPERVISOR_paging_domctl_cont __HYPERVISOR_arch_1 =20 -typedef unsigned long hypercall_fn_t( - unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long); - -typedef struct { - uint8_t native; -#ifdef CONFIG_COMPAT - uint8_t compat; -#endif -} hypercall_args_t; - -extern const hypercall_args_t hypercall_args_table[NR_hypercalls]; - #ifdef CONFIG_PV void pv_hypercall(struct cpu_user_regs *regs); #endif @@ -56,4 +43,46 @@ compat_common_vcpu_op( =20 #endif /* CONFIG_COMPAT */ =20 +#ifndef NDEBUG +static inline unsigned int _get_nargs(const unsigned char *tbl, unsigned i= nt c) +{ + return tbl[c]; +} +#define get_nargs(t, c) _get_nargs(t, array_index_nospec(c, ARRAY_SIZE(t))) +#else +#define get_nargs(tbl, c) 0 +#endif + +static inline void clobber_regs(struct cpu_user_regs *regs, + unsigned int nargs) +{ +#ifndef NDEBUG + /* Deliberately corrupt used parameter regs. */ + switch ( nargs ) + { + case 5: regs->r8 =3D 0xdeadbeefdeadf00dUL; fallthrough; + case 4: regs->r10 =3D 0xdeadbeefdeadf00dUL; fallthrough; + case 3: regs->rdx =3D 0xdeadbeefdeadf00dUL; fallthrough; + case 2: regs->rsi =3D 0xdeadbeefdeadf00dUL; fallthrough; + case 1: regs->rdi =3D 0xdeadbeefdeadf00dUL; + } +#endif +} + +static inline void clobber_regs32(struct cpu_user_regs *regs, + unsigned int nargs) +{ +#ifndef NDEBUG + /* Deliberately corrupt used parameter regs. */ + switch ( nargs ) + { + case 5: regs->edi =3D 0xdeadf00dU; fallthrough; + case 4: regs->esi =3D 0xdeadf00dU; fallthrough; + case 3: regs->edx =3D 0xdeadf00dU; fallthrough; + case 2: regs->ecx =3D 0xdeadf00dU; fallthrough; + case 1: regs->ebx =3D 0xdeadf00dU; + } +#endif +} + #endif /* __ASM_X86_HYPERCALL_H__ */ diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index fe8dfe9e8f..bf64bb41bb 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -27,119 +27,22 @@ #include #include =20 -typedef struct { - hypercall_fn_t *native; -#ifdef CONFIG_PV32 - hypercall_fn_t *compat; -#endif -} pv_hypercall_table_t; - +#ifndef NDEBUG +static const unsigned char hypercall_args_64[] =3D hypercall_args_pv64; #ifdef CONFIG_PV32 -#define HYPERCALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ - (hypercall_fn_t *) do_ ## x } -#define COMPAT_CALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ - (hypercall_fn_t *) compat_ ## x } -#else -#define HYPERCALL(x) \ - [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x } -#define COMPAT_CALL(x) HYPERCALL(x) -#endif - -static const pv_hypercall_table_t pv_hypercall_table[] =3D { - COMPAT_CALL(set_trap_table), - HYPERCALL(mmu_update), - COMPAT_CALL(set_gdt), - HYPERCALL(stack_switch), - COMPAT_CALL(set_callbacks), - HYPERCALL(fpu_taskswitch), - HYPERCALL(sched_op_compat), -#ifndef CONFIG_PV_SHIM_EXCLUSIVE - COMPAT_CALL(platform_op), -#endif - HYPERCALL(set_debugreg), - HYPERCALL(get_debugreg), - COMPAT_CALL(update_descriptor), - COMPAT_CALL(memory_op), - COMPAT_CALL(multicall), - COMPAT_CALL(update_va_mapping), - COMPAT_CALL(set_timer_op), - HYPERCALL(event_channel_op_compat), - COMPAT_CALL(xen_version), - HYPERCALL(console_io), - COMPAT_CALL(physdev_op_compat), -#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM) - COMPAT_CALL(grant_table_op), -#endif - HYPERCALL(vm_assist), - COMPAT_CALL(update_va_mapping_otherdomain), - COMPAT_CALL(iret), - COMPAT_CALL(vcpu_op), - HYPERCALL(set_segment_base), - COMPAT_CALL(mmuext_op), - COMPAT_CALL(xsm_op), - COMPAT_CALL(nmi_op), - COMPAT_CALL(sched_op), - COMPAT_CALL(callback_op), -#ifdef CONFIG_XENOPROF - COMPAT_CALL(xenoprof_op), -#endif - HYPERCALL(event_channel_op), - COMPAT_CALL(physdev_op), -#ifndef CONFIG_PV_SHIM_EXCLUSIVE - HYPERCALL(sysctl), - HYPERCALL(domctl), -#endif -#ifdef CONFIG_KEXEC - COMPAT_CALL(kexec_op), +static const unsigned char hypercall_args_32[] =3D hypercall_args_pv32; #endif -#ifdef CONFIG_ARGO - COMPAT_CALL(argo_op), #endif - HYPERCALL(xenpmu_op), -#ifdef CONFIG_HVM - HYPERCALL(hvm_op), - COMPAT_CALL(dm_op), -#endif -#ifdef CONFIG_HYPFS - HYPERCALL(hypfs_op), -#endif - HYPERCALL(mca), -#ifndef CONFIG_PV_SHIM_EXCLUSIVE - HYPERCALL(paging_domctl_cont), -#endif -}; - -#undef COMPAT_CALL -#undef HYPERCALL =20 /* Forced inline to cause 'compat' to be evaluated at compile time. */ static void always_inline _pv_hypercall(struct cpu_user_regs *regs, bool compat) { struct vcpu *curr =3D current; - unsigned long eax =3D compat ? regs->eax : regs->rax; + unsigned long eax; =20 ASSERT(guest_kernel_mode(curr, regs)); =20 - BUILD_BUG_ON(ARRAY_SIZE(pv_hypercall_table) > - ARRAY_SIZE(hypercall_args_table)); - - if ( eax >=3D ARRAY_SIZE(pv_hypercall_table) ) - { - regs->rax =3D -ENOSYS; - return; - } - - eax =3D array_index_nospec(eax, ARRAY_SIZE(pv_hypercall_table)); - - if ( !pv_hypercall_table[eax].native ) - { - regs->rax =3D -ENOSYS; - return; - } - curr->hcall_preempted =3D false; =20 if ( !compat ) @@ -150,17 +53,8 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat) unsigned long r10 =3D regs->r10; unsigned long r8 =3D regs->r8; =20 -#ifndef NDEBUG - /* Deliberately corrupt parameter regs not used by this hypercall.= */ - switch ( hypercall_args_table[eax].native ) - { - case 0: rdi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 1: rsi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 2: rdx =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 3: r10 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 4: r8 =3D 0xdeadbeefdeadf00dUL; - } -#endif + eax =3D regs->rax; + if ( unlikely(tb_init_done) ) { unsigned long args[5] =3D { rdi, rsi, rdx, r10, r8 }; @@ -168,22 +62,10 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat) __trace_hypercall(TRC_PV_HYPERCALL_V2, eax, args); } =20 - regs->rax =3D pv_hypercall_table[eax].native(rdi, rsi, rdx, r10, r= 8); + call_handlers_pv64(eax, regs->rax, rdi, rsi, rdx, r10, r8); =20 -#ifndef NDEBUG - if ( !curr->hcall_preempted ) - { - /* Deliberately corrupt parameter regs used by this hypercall.= */ - switch ( hypercall_args_table[eax].native ) - { - case 5: regs->r8 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 4: regs->r10 =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 3: regs->rdx =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 2: regs->rsi =3D 0xdeadbeefdeadf00dUL; fallthrough; - case 1: regs->rdi =3D 0xdeadbeefdeadf00dUL; - } - } -#endif + if ( !curr->hcall_preempted && regs->rax !=3D -ENOSYS ) + clobber_regs(regs, get_nargs(hypercall_args_64, eax)); } #ifdef CONFIG_PV32 else @@ -194,17 +76,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat) unsigned int esi =3D regs->esi; unsigned int edi =3D regs->edi; =20 -#ifndef NDEBUG - /* Deliberately corrupt parameter regs not used by this hypercall.= */ - switch ( hypercall_args_table[eax].compat ) - { - case 0: ebx =3D 0xdeadf00d; fallthrough; - case 1: ecx =3D 0xdeadf00d; fallthrough; - case 2: edx =3D 0xdeadf00d; fallthrough; - case 3: esi =3D 0xdeadf00d; fallthrough; - case 4: edi =3D 0xdeadf00d; - } -#endif + eax =3D regs->eax; =20 if ( unlikely(tb_init_done) ) { @@ -214,23 +86,11 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat) } =20 curr->hcall_compat =3D true; - regs->eax =3D pv_hypercall_table[eax].compat(ebx, ecx, edx, esi, e= di); + call_handlers_pv32(eax, regs->eax, ebx, ecx, edx, esi, edi); curr->hcall_compat =3D false; =20 -#ifndef NDEBUG - if ( !curr->hcall_preempted ) - { - /* Deliberately corrupt parameter regs used by this hypercall.= */ - switch ( hypercall_args_table[eax].compat ) - { - case 5: regs->edi =3D 0xdeadf00d; fallthrough; - case 4: regs->esi =3D 0xdeadf00d; fallthrough; - case 3: regs->edx =3D 0xdeadf00d; fallthrough; - case 2: regs->ecx =3D 0xdeadf00d; fallthrough; - case 1: regs->ebx =3D 0xdeadf00d; - } - } -#endif + if ( !curr->hcall_preempted && regs->eax !=3D -ENOSYS ) + clobber_regs32(regs, get_nargs(hypercall_args_32, eax)); } #endif /* CONFIG_PV32 */ =20 @@ -256,13 +116,8 @@ enum mc_disposition pv_do_multicall_call(struct mc_sta= te *state) struct compat_multicall_entry *call =3D &state->compat_call; =20 op =3D call->op; - if ( (op < ARRAY_SIZE(pv_hypercall_table)) && - pv_hypercall_table[op].compat ) - call->result =3D pv_hypercall_table[op].compat( - call->args[0], call->args[1], call->args[2], - call->args[3], call->args[4]); - else - call->result =3D -ENOSYS; + call_handlers_pv32(op, call->result, call->args[0], call->args[1], + call->args[2], call->args[3], call->args[4]); } else #endif @@ -270,13 +125,8 @@ enum mc_disposition pv_do_multicall_call(struct mc_sta= te *state) struct multicall_entry *call =3D &state->call; =20 op =3D call->op; - if ( (op < ARRAY_SIZE(pv_hypercall_table)) && - pv_hypercall_table[op].native ) - call->result =3D pv_hypercall_table[op].native( - call->args[0], call->args[1], call->args[2], - call->args[3], call->args[4]); - else - call->result =3D -ENOSYS; + call_handlers_pv64(op, call->result, call->args[0], call->args[1], + call->args[2], call->args[3], call->args[4]); } =20 return unlikely(op =3D=3D __HYPERVISOR_iret) --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897695; cv=none; d=zohomail.com; s=zohoarc; b=DcGUVVHFTsd76ncUy94fU/v78kdVpBWo85r2NA03ZVPNsFkoARr9EK5JL+d29AxfrOegBDN98w7kZp6SgyvOxyGK63ZVSr0zBDYqAMNiaRpsB/PpojO2AypLzwld9ReVfxehe0Oe5we8a9pYVjGcXDM55f72I2J8JTPOO5LspIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897695; h=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; bh=9NMDfmYhtLw/sL7CfosAM4fVar8Ox4MuCe1fU0MA7/w=; b=Nwd/bf//t1gtdbTJS8zjCNUb6WqnWd9JX/6+Z4W6R9QcseyQO2V/KUb9s86HNuHIp6JmOGWvmN+yc6FdxdQKBddVCD9SAQERUF8To3tqlQWLBoM1ivAiDVvDp8/AwChfpU9EfvnlxoytSb6qL4twWHAoQ6L1WOoXhAGeYciMsv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897695882266.2924436738949; Wed, 9 Mar 2022 23:34:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288158.488676 (Exim 4.92) (envelope-from ) id 1nSDJh-00027m-Nt; Thu, 10 Mar 2022 07:34:33 +0000 Received: by outflank-mailman (output) from mailman id 288158.488676; Thu, 10 Mar 2022 07:34:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJh-000249-6k; Thu, 10 Mar 2022 07:34:33 +0000 Received: by outflank-mailman (input) for mailman id 288158; Thu, 10 Mar 2022 07:34:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJe-0000ZQ-4b for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:30 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8404a4ca-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:27 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 62FA71F44B; Thu, 10 Mar 2022 07:34:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 31F7613FA3; Thu, 10 Mar 2022 07:34:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yKD/CgOqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8404a4ca-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897667; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9NMDfmYhtLw/sL7CfosAM4fVar8Ox4MuCe1fU0MA7/w=; b=LPD0Z47JivGhV+0vIBFkTMe1cHUw99QEDF0mlnkQCzc6EbCRgeYMlKCPKVU3etg4GmXKBz dWG+05viWe74dD4kaUuVwUNo9uDmsjHTlBzoz2atTfWhk1riBmgwMJXvQqnIMZbDf9s0hR 2QTV2zU6I8JmTo8k20+MwPV9WO/IfxE= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Michal Orzel Subject: [PATCH v4 10/11] xen/arm: call hypercall handlers via generated macro Date: Thu, 10 Mar 2022 08:34:19 +0100 Message-Id: <20220310073420.15622-11-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897697044100001 Content-Type: text/plain; charset="utf-8" Instead of using a function table use the generated macros for calling the appropriate hypercall handlers. This makes the calls of the handlers type safe. For deprecated hypercalls define stub functions. Signed-off-by: Juergen Gross Tested-by: Michal Orzel Reviewed-by: Julien Grall --- V2: - make hypercall_args[] const (Jan Beulich) --- xen/arch/arm/traps.c | 124 +++++++++---------------------------------- 1 file changed, 26 insertions(+), 98 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index deb07784d9..98eab9a379 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1331,67 +1331,20 @@ static register_t do_deprecated_hypercall(void) return -ENOSYS; } =20 -typedef register_t (*arm_hypercall_fn_t)( - register_t, register_t, register_t, register_t, register_t); - -typedef struct { - arm_hypercall_fn_t fn; - int nr_args; -} arm_hypercall_t; - -#define HYPERCALL(_name, _nr_args) \ - [ __HYPERVISOR_ ## _name ] =3D { \ - .fn =3D (arm_hypercall_fn_t) &do_ ## _name, \ - .nr_args =3D _nr_args, \ - } +long dep_sched_op_compat(int cmd, unsigned long arg) +{ + return do_deprecated_hypercall(); +} =20 -#define HYPERCALL_ARM(_name, _nr_args) \ - [ __HYPERVISOR_ ## _name ] =3D { \ - .fn =3D (arm_hypercall_fn_t) &do_arm_ ## _name, \ - .nr_args =3D _nr_args, \ - } -/* - * Only use this for hypercalls which were deprecated (i.e. replaced - * by something else) before Xen on ARM was created, i.e. *not* for - * hypercalls which are simply not yet used on ARM. - */ -#define HYPERCALL_DEPRECATED(_name, _nr_args) \ - [ __HYPERVISOR_##_name ] =3D { \ - .fn =3D (arm_hypercall_fn_t) &do_deprecated_hypercall, \ - .nr_args =3D _nr_args, \ - } +long dep_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) +{ + return do_deprecated_hypercall(); +} =20 -static arm_hypercall_t arm_hypercall_table[] =3D { - HYPERCALL(memory_op, 2), - HYPERCALL(domctl, 1), - HYPERCALL(sched_op, 2), - HYPERCALL_DEPRECATED(sched_op_compat, 2), - HYPERCALL(console_io, 3), - HYPERCALL(xen_version, 2), - HYPERCALL(xsm_op, 1), - HYPERCALL(event_channel_op, 2), - HYPERCALL_DEPRECATED(event_channel_op_compat, 1), - HYPERCALL_ARM(physdev_op, 2), - HYPERCALL_DEPRECATED(physdev_op_compat, 1), - HYPERCALL(sysctl, 2), - HYPERCALL(hvm_op, 2), -#ifdef CONFIG_GRANT_TABLE - HYPERCALL(grant_table_op, 3), -#endif - HYPERCALL(multicall, 2), - HYPERCALL(platform_op, 1), - HYPERCALL(vcpu_op, 3), - HYPERCALL(vm_assist, 2), -#ifdef CONFIG_ARGO - HYPERCALL(argo_op, 5), -#endif -#ifdef CONFIG_HYPFS - HYPERCALL(hypfs_op, 5), -#endif -#ifdef CONFIG_IOREQ_SERVER - HYPERCALL(dm_op, 3), -#endif -}; +long dep_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) uop) +{ + return do_deprecated_hypercall(); +} =20 #ifndef NDEBUG static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code) @@ -1430,7 +1383,6 @@ static void do_debug_trap(struct cpu_user_regs *regs,= unsigned int code) #define HYPERCALL_ARG3(r) (r)->x2 #define HYPERCALL_ARG4(r) (r)->x3 #define HYPERCALL_ARG5(r) (r)->x4 -#define HYPERCALL_ARGS(r) (r)->x0, (r)->x1, (r)->x2, (r)->x3, (r)->x4 #else #define HYPERCALL_RESULT_REG(r) (r)->r0 #define HYPERCALL_ARG1(r) (r)->r0 @@ -1438,52 +1390,40 @@ static void do_debug_trap(struct cpu_user_regs *reg= s, unsigned int code) #define HYPERCALL_ARG3(r) (r)->r2 #define HYPERCALL_ARG4(r) (r)->r3 #define HYPERCALL_ARG5(r) (r)->r4 -#define HYPERCALL_ARGS(r) (r)->r0, (r)->r1, (r)->r2, (r)->r3, (r)->r4 #endif =20 +static const unsigned char hypercall_args[] =3D hypercall_args_arm; + static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr, const union hsr hsr) { - arm_hypercall_fn_t call =3D NULL; struct vcpu *curr =3D current; =20 - BUILD_BUG_ON(NR_hypercalls < ARRAY_SIZE(arm_hypercall_table) ); - if ( hsr.iss !=3D XEN_HYPERCALL_TAG ) { gprintk(XENLOG_WARNING, "Invalid HVC imm 0x%x\n", hsr.iss); return inject_undef_exception(regs, hsr); } =20 - if ( *nr >=3D ARRAY_SIZE(arm_hypercall_table) ) - { - perfc_incr(invalid_hypercalls); - HYPERCALL_RESULT_REG(regs) =3D -ENOSYS; - return; - } - curr->hcall_preempted =3D false; =20 perfc_incra(hypercalls, *nr); - call =3D arm_hypercall_table[*nr].fn; - if ( call =3D=3D NULL ) - { - HYPERCALL_RESULT_REG(regs) =3D -ENOSYS; - return; - } =20 - HYPERCALL_RESULT_REG(regs) =3D call(HYPERCALL_ARGS(regs)); + call_handlers_arm(*nr, HYPERCALL_RESULT_REG(regs), HYPERCALL_ARG1(regs= ), + HYPERCALL_ARG2(regs), HYPERCALL_ARG3(regs), + HYPERCALL_ARG4(regs), HYPERCALL_ARG5(regs)); =20 #ifndef NDEBUG - if ( !curr->hcall_preempted ) + if ( !curr->hcall_preempted && HYPERCALL_RESULT_REG(regs) !=3D -ENOSYS= ) { /* Deliberately corrupt parameter regs used by this hypercall. */ - switch ( arm_hypercall_table[*nr].nr_args ) { + switch ( hypercall_args[*nr] ) { case 5: HYPERCALL_ARG5(regs) =3D 0xDEADBEEF; case 4: HYPERCALL_ARG4(regs) =3D 0xDEADBEEF; case 3: HYPERCALL_ARG3(regs) =3D 0xDEADBEEF; case 2: HYPERCALL_ARG2(regs) =3D 0xDEADBEEF; case 1: /* Don't clobber x0/r0 -- it's the return value */ + case 0: /* -ENOSYS case */ break; default: BUG(); } @@ -1520,7 +1460,10 @@ static bool check_multicall_32bit_clean(struct multi= call_entry *multi) { int i; =20 - for ( i =3D 0; i < arm_hypercall_table[multi->op].nr_args; i++ ) + if ( multi->op >=3D ARRAY_SIZE(hypercall_args) ) + return true; + + for ( i =3D 0; i < hypercall_args[multi->op]; i++ ) { if ( unlikely(multi->args[i] & 0xffffffff00000000ULL) ) { @@ -1537,28 +1480,13 @@ static bool check_multicall_32bit_clean(struct mult= icall_entry *multi) enum mc_disposition arch_do_multicall_call(struct mc_state *state) { struct multicall_entry *multi =3D &state->call; - arm_hypercall_fn_t call =3D NULL; - - if ( multi->op >=3D ARRAY_SIZE(arm_hypercall_table) ) - { - multi->result =3D -ENOSYS; - return mc_continue; - } - - call =3D arm_hypercall_table[multi->op].fn; - if ( call =3D=3D NULL ) - { - multi->result =3D -ENOSYS; - return mc_continue; - } =20 if ( is_32bit_domain(current->domain) && !check_multicall_32bit_clean(multi) ) return mc_continue; =20 - multi->result =3D call(multi->args[0], multi->args[1], - multi->args[2], multi->args[3], - multi->args[4]); + call_handlers_arm(multi->op, multi->result, multi->args[0], multi->arg= s[1], + multi->args[2], multi->args[3], multi->args[4]); =20 return likely(!regs_mode_is_user(guest_cpu_user_regs())) ? mc_continue : mc_preempt; --=20 2.34.1 From nobody Sat May 18 08:14:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646897698; cv=none; d=zohomail.com; s=zohoarc; b=c2N2hb66JVKaq1eYfOdSm7dOiASVv5pdBjOKshcB8JpKqhfrflji72z6PmmV5kmlYYIeFyFdHgLlDXewot5728LehAHytCXR5H06HoGNqr++9cgZ77MMaQX8KjdLsUfE8tMfFUs3EEbwvW+aZr8FwNpusivv5UWK3CDkk4BqABY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646897698; h=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; bh=McyNTZ+ZMzXXLmxrERYtuCPFQotaQRGzlIAiJNDAfQI=; b=KOfOCf3DUKmRPAePxUAWXVbhRz52qubKBn3BsFJt3dLm44s6BPMUkve24HIdbYlZlw5I6Q4agBh7f8edURR7sMaH+hykzYhzRtvrsF/Y1TaNFjPWGIHPqUFpHO2jtRej/Z2pQX6SoRN659Y0qzxqT6CIAUlYXP5aUj+Gh19bvBQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646897698185802.164261027672; Wed, 9 Mar 2022 23:34:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288160.488702 (Exim 4.92) (envelope-from ) id 1nSDJl-0002w9-0k; Thu, 10 Mar 2022 07:34:37 +0000 Received: by outflank-mailman (output) from mailman id 288160.488702; Thu, 10 Mar 2022 07:34:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJk-0002t5-Hs; Thu, 10 Mar 2022 07:34:36 +0000 Received: by outflank-mailman (input) for mailman id 288160; Thu, 10 Mar 2022 07:34:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nSDJf-0000ZQ-4Y for xen-devel@lists.xenproject.org; Thu, 10 Mar 2022 07:34:31 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 844a8722-a044-11ec-8eba-a37418f5ba1a; Thu, 10 Mar 2022 08:34:28 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C406521125; Thu, 10 Mar 2022 07:34:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6B99C13FA3; Thu, 10 Mar 2022 07:34:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AJIiGQOqKWIkIAAAMHmgww (envelope-from ); Thu, 10 Mar 2022 07:34:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 844a8722-a044-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646897667; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=McyNTZ+ZMzXXLmxrERYtuCPFQotaQRGzlIAiJNDAfQI=; b=FeYej+AE2EJqO5nkkPquFGYfz6rhxCBn35421heYrJl+BWMpglOqoFN6bI//e1sfcM2v7V 9yBUeFaGkwgqUxLBRaU9Bkq2ZK283Q3DL/T4h/e9W9Ixyh9J9AVxXmz6ZUN6wtDdAjn1bs LzteBaXgQYwJKnfgSGKknCaJGf/3W98= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , George Dunlap , Julien Grall , Stefano Stabellini , Christopher Clark , Dario Faggioli , Daniel De Graaf , "Daniel P. Smith" Subject: [PATCH v4 11/11] xen/x86: remove cf_check attribute from hypercall handlers Date: Thu, 10 Mar 2022 08:34:20 +0100 Message-Id: <20220310073420.15622-12-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220310073420.15622-1-jgross@suse.com> References: <20220310073420.15622-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646897699324100001 Content-Type: text/plain; charset="utf-8" Now that the hypercall handlers are all being called directly instead through a function vector, the "cf_check" attribute can be removed. Signed-off-by: Juergen Gross Acked-by: Jan Beulich Reviewed-by: Daniel P. Smith Tested-by: T=C3=A9o Couprie Diaz --- V4: - new patch --- xen/arch/x86/compat.c | 6 +++--- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/vpmu.c | 2 +- xen/arch/x86/domain.c | 3 +-- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/hypercall.c | 6 +++--- xen/arch/x86/mm.c | 12 ++++++------ xen/arch/x86/mm/paging.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/platform_hypercall.c | 2 +- xen/arch/x86/pv/callback.c | 16 ++++++++-------- xen/arch/x86/pv/descriptor-tables.c | 8 ++++---- xen/arch/x86/pv/iret.c | 4 ++-- xen/arch/x86/pv/misc-hypercalls.c | 10 +++++----- xen/arch/x86/pv/shim.c | 4 ++-- xen/arch/x86/x86_64/compat/mm.c | 2 +- xen/common/argo.c | 4 ++-- xen/common/compat/grant_table.c | 2 +- xen/common/compat/kernel.c | 2 +- xen/common/compat/memory.c | 3 +-- xen/common/dm.c | 2 +- xen/common/domain.c | 2 +- xen/common/domctl.c | 2 +- xen/common/event_channel.c | 2 +- xen/common/grant_table.c | 3 +-- xen/common/hypfs.c | 2 +- xen/common/kernel.c | 2 +- xen/common/kexec.c | 4 ++-- xen/common/memory.c | 2 +- xen/common/multicall.c | 3 +-- xen/common/sched/compat.c | 2 +- xen/common/sched/core.c | 4 ++-- xen/common/sysctl.c | 2 +- xen/common/xenoprof.c | 2 +- xen/drivers/char/console.c | 2 +- xen/scripts/gen_hypercall.awk | 2 +- xen/xsm/xsm_core.c | 4 ++-- 38 files changed, 67 insertions(+), 71 deletions(-) diff --git a/xen/arch/x86/compat.c b/xen/arch/x86/compat.c index 28281a262a..a031062830 100644 --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -15,7 +15,7 @@ typedef long ret_t; #endif =20 /* Legacy hypercall (as of 0x00030202). */ -ret_t cf_check do_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) u= op) +ret_t do_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) uop) { struct physdev_op op; =20 @@ -28,7 +28,7 @@ ret_t cf_check do_physdev_op_compat(XEN_GUEST_HANDLE_PARA= M(physdev_op_t) uop) #ifndef COMPAT =20 /* Legacy hypercall (as of 0x00030101). */ -long cf_check do_sched_op_compat(int cmd, unsigned long arg) +long do_sched_op_compat(int cmd, unsigned long arg) { switch ( cmd ) { @@ -50,7 +50,7 @@ long cf_check do_sched_op_compat(int cmd, unsigned long a= rg) } =20 /* Legacy hypercall (as of 0x00030202). */ -long cf_check do_event_channel_op_compat( +long do_event_channel_op_compat( XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) { struct evtchn_op op; diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 275c54be7c..f68e31b643 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -1351,7 +1351,7 @@ CHECK_mcinfo_recovery; # endif /* CONFIG_COMPAT */ =20 /* Machine Check Architecture Hypercall */ -long cf_check do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc) +long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc) { long ret =3D 0; struct xen_mc curop, *op =3D &curop; diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index 51d171615f..d2c03a1104 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -672,7 +672,7 @@ void vpmu_dump(struct vcpu *v) alternative_vcall(vpmu_ops.arch_vpmu_dump, v); } =20 -long cf_check do_xenpmu_op( +long do_xenpmu_op( unsigned int op, XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg) { int ret; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d566fc82b4..ddf969f76e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1489,8 +1489,7 @@ int arch_vcpu_reset(struct vcpu *v) return 0; } =20 -long cf_check do_vcpu_op(int cmd, unsigned int vcpuid, - XEN_GUEST_HANDLE_PARAM(void) arg) +long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void)= arg) { long rc =3D 0; struct domain *d =3D current->domain; diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c index d80975efcf..f8e6089870 100644 --- a/xen/arch/x86/hvm/dm.c +++ b/xen/arch/x86/hvm/dm.c @@ -654,7 +654,7 @@ CHECK_dm_op_relocate_memory; CHECK_dm_op_pin_memory_cacheattr; CHECK_dm_op_nr_vcpus; =20 -int cf_check compat_dm_op( +int compat_dm_op( domid_t domid, unsigned int nr_bufs, XEN_GUEST_HANDLE_PARAM(void) bufs) { struct dmop_args args; diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 709a4191ef..9b3973dad8 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5022,7 +5022,7 @@ static int hvmop_get_mem_type( return rc; } =20 -long cf_check do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) +long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) { long rc =3D 0; =20 diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index ae601185fc..29d1ca7a13 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -31,7 +31,7 @@ #include #include =20 -long cf_check hvm_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void= ) arg) +long hvm_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { long rc; =20 @@ -51,7 +51,7 @@ long cf_check hvm_memory_op(unsigned long cmd, XEN_GUEST_= HANDLE_PARAM(void) arg) } =20 #ifdef CONFIG_GRANT_TABLE -long cf_check hvm_grant_table_op( +long hvm_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) { switch ( cmd ) @@ -77,7 +77,7 @@ long cf_check hvm_grant_table_op( } #endif =20 -long cf_check hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { const struct vcpu *curr =3D current; const struct domain *currd =3D curr->domain; diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 6cc73187ac..a958142d17 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -3377,7 +3377,7 @@ static int vcpumask_to_pcpumask( } } =20 -long cf_check do_mmuext_op( +long do_mmuext_op( XEN_GUEST_HANDLE_PARAM(mmuext_op_t) uops, unsigned int count, XEN_GUEST_HANDLE_PARAM(uint) pdone, @@ -3916,7 +3916,7 @@ long cf_check do_mmuext_op( return rc; } =20 -long cf_check do_mmu_update( +long do_mmu_update( XEN_GUEST_HANDLE_PARAM(mmu_update_t) ureqs, unsigned int count, XEN_GUEST_HANDLE_PARAM(uint) pdone, @@ -4501,7 +4501,7 @@ static int __do_update_va_mapping( return rc; } =20 -long cf_check do_update_va_mapping( +long do_update_va_mapping( unsigned long va, u64 val64, unsigned long flags) { int rc =3D __do_update_va_mapping(va, val64, flags, current->domain); @@ -4513,7 +4513,7 @@ long cf_check do_update_va_mapping( return rc; } =20 -long cf_check do_update_va_mapping_otherdomain( +long do_update_va_mapping_otherdomain( unsigned long va, u64 val64, unsigned long flags, domid_t domid) { struct domain *pg_owner; @@ -4536,7 +4536,7 @@ long cf_check do_update_va_mapping_otherdomain( #endif /* CONFIG_PV */ =20 #ifdef CONFIG_PV32 -int cf_check compat_update_va_mapping( +int compat_update_va_mapping( unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags) { int rc =3D __do_update_va_mapping(va, ((uint64_t)hi << 32) | lo, @@ -4549,7 +4549,7 @@ int cf_check compat_update_va_mapping( return rc; } =20 -int cf_check compat_update_va_mapping_otherdomain( +int compat_update_va_mapping_otherdomain( unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags, domid_t domid) { diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index a7e2707ecc..cb1bfcbde5 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -760,7 +760,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_s= hadow_op *sc, return shadow_domctl(d, sc, u_domctl); } =20 -long cf_check do_paging_domctl_cont( +long do_paging_domctl_cont( XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { struct xen_domctl op; diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index 2ddcf44f33..ea38be8b79 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -174,7 +174,7 @@ int physdev_unmap_pirq(domid_t domid, int pirq) } #endif /* COMPAT */ =20 -ret_t cf_check do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { int irq; ret_t ret; diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hype= rcall.c index eeb4f7a20e..a7341dc3d7 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -214,7 +214,7 @@ void cf_check resource_access(void *info) } #endif =20 -ret_t cf_check do_platform_op( +ret_t do_platform_op( XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op) { ret_t ret; diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index 1be9d3f731..067ee3b795 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -140,7 +140,7 @@ static long unregister_guest_callback(struct callback_u= nregister *unreg) return ret; } =20 -long cf_check do_callback_op(int cmd, XEN_GUEST_HANDLE_PARAM(const_void) a= rg) +long do_callback_op(int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg) { long ret; =20 @@ -178,7 +178,7 @@ long cf_check do_callback_op(int cmd, XEN_GUEST_HANDLE_= PARAM(const_void) arg) return ret; } =20 -long cf_check do_set_callbacks( +long do_set_callbacks( unsigned long event_address, unsigned long failsafe_address, unsigned long syscall_address) { @@ -283,7 +283,7 @@ static int compat_unregister_guest_callback( return ret; } =20 -int cf_check compat_callback_op(int cmd, XEN_GUEST_HANDLE(const_void) arg) +int compat_callback_op(int cmd, XEN_GUEST_HANDLE(const_void) arg) { int ret; =20 @@ -321,7 +321,7 @@ int cf_check compat_callback_op(int cmd, XEN_GUEST_HAND= LE(const_void) arg) return ret; } =20 -int cf_check compat_set_callbacks( +int compat_set_callbacks( unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address) { @@ -348,7 +348,7 @@ int cf_check compat_set_callbacks( =20 #endif /* CONFIG_PV32 */ =20 -long cf_check do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) = traps) +long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps) { struct trap_info cur; struct vcpu *curr =3D current; @@ -394,7 +394,7 @@ long cf_check do_set_trap_table(XEN_GUEST_HANDLE_PARAM(= const_trap_info_t) traps) } =20 #ifdef CONFIG_PV32 -int cf_check compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) tr= aps) +int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) { struct vcpu *curr =3D current; struct compat_trap_info cur; @@ -437,7 +437,7 @@ int cf_check compat_set_trap_table(XEN_GUEST_HANDLE(tra= p_info_compat_t) traps) } #endif =20 -long cf_check do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct xennmi_callback cb; long rc =3D 0; @@ -463,7 +463,7 @@ long cf_check do_nmi_op(unsigned int cmd, XEN_GUEST_HAN= DLE_PARAM(void) arg) } =20 #ifdef CONFIG_PV32 -int cf_check compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) = arg) +int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct compat_nmi_callback cb; int rc =3D 0; diff --git a/xen/arch/x86/pv/descriptor-tables.c b/xen/arch/x86/pv/descript= or-tables.c index 653a61d0b5..b4135b450c 100644 --- a/xen/arch/x86/pv/descriptor-tables.c +++ b/xen/arch/x86/pv/descriptor-tables.c @@ -124,7 +124,7 @@ int pv_set_gdt(struct vcpu *v, const unsigned long fram= es[], return -EINVAL; } =20 -long cf_check do_set_gdt( +long do_set_gdt( XEN_GUEST_HANDLE_PARAM(xen_ulong_t) frame_list, unsigned int entries) { unsigned int nr_frames =3D DIV_ROUND_UP(entries, 512); @@ -151,7 +151,7 @@ long cf_check do_set_gdt( =20 #ifdef CONFIG_PV32 =20 -int cf_check compat_set_gdt( +int compat_set_gdt( XEN_GUEST_HANDLE_PARAM(uint) frame_list, unsigned int entries) { struct vcpu *curr =3D current; @@ -187,7 +187,7 @@ int cf_check compat_set_gdt( return ret; } =20 -int cf_check compat_update_descriptor( +int compat_update_descriptor( uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi) { seg_desc_t d; @@ -299,7 +299,7 @@ int validate_segdesc_page(struct page_info *page) return i =3D=3D 512 ? 0 : -EINVAL; } =20 -long cf_check do_update_descriptor(uint64_t gaddr, seg_desc_t d) +long do_update_descriptor(uint64_t gaddr, seg_desc_t d) { struct domain *currd =3D current->domain; gfn_t gfn =3D gaddr_to_gfn(gaddr); diff --git a/xen/arch/x86/pv/iret.c b/xen/arch/x86/pv/iret.c index 58de9f7922..316a23e77e 100644 --- a/xen/arch/x86/pv/iret.c +++ b/xen/arch/x86/pv/iret.c @@ -49,7 +49,7 @@ static void async_exception_cleanup(struct vcpu *curr) curr->arch.async_exception_state(trap).old_mask; } =20 -long cf_check do_iret(void) +long do_iret(void) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); struct iret_context iret_saved; @@ -106,7 +106,7 @@ long cf_check do_iret(void) } =20 #ifdef CONFIG_PV32 -int cf_check compat_iret(void) +int compat_iret(void) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); struct vcpu *v =3D current; diff --git a/xen/arch/x86/pv/misc-hypercalls.c b/xen/arch/x86/pv/misc-hyper= calls.c index 635f5a644a..aaaf70eb63 100644 --- a/xen/arch/x86/pv/misc-hypercalls.c +++ b/xen/arch/x86/pv/misc-hypercalls.c @@ -23,12 +23,12 @@ =20 #include =20 -long cf_check do_set_debugreg(int reg, unsigned long value) +long do_set_debugreg(int reg, unsigned long value) { return set_debugreg(current, reg, value); } =20 -long cf_check do_get_debugreg(int reg) +long do_get_debugreg(int reg) { /* Avoid implementation defined behavior casting unsigned long to long= . */ union { @@ -40,7 +40,7 @@ long cf_check do_get_debugreg(int reg) return res =3D=3D X86EMUL_OKAY ? u.ret : -ENODEV; } =20 -long cf_check do_fpu_taskswitch(int set) +long do_fpu_taskswitch(int set) { struct vcpu *v =3D current; =20 @@ -175,7 +175,7 @@ long set_debugreg(struct vcpu *v, unsigned int reg, uns= igned long value) return 0; } =20 -long cf_check do_stack_switch(unsigned long ss, unsigned long esp) +long do_stack_switch(unsigned long ss, unsigned long esp) { fixup_guest_stack_selector(current->domain, ss); current->arch.pv.kernel_ss =3D ss; @@ -184,7 +184,7 @@ long cf_check do_stack_switch(unsigned long ss, unsigne= d long esp) return 0; } =20 -long cf_check do_set_segment_base(unsigned int which, unsigned long base) +long do_set_segment_base(unsigned int which, unsigned long base) { struct vcpu *v =3D current; long ret =3D 0; diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index 2ee290a392..2b74fea181 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -824,7 +824,7 @@ long pv_shim_grant_table_op(unsigned int cmd, =20 #ifndef CONFIG_GRANT_TABLE /* Thin wrapper(s) needed. */ -long cf_check do_grant_table_op( +long do_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) { if ( !pv_shim ) @@ -834,7 +834,7 @@ long cf_check do_grant_table_op( } =20 #ifdef CONFIG_PV32 -int cf_check compat_grant_table_op( +int compat_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) { if ( !pv_shim ) diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/m= m.c index 70b08a832a..d54efaad21 100644 --- a/xen/arch/x86/x86_64/compat/mm.c +++ b/xen/arch/x86/x86_64/compat/mm.c @@ -177,7 +177,7 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_= HANDLE_PARAM(void) arg) #ifdef CONFIG_PV DEFINE_XEN_GUEST_HANDLE(mmuext_op_compat_t); =20 -int cf_check compat_mmuext_op( +int compat_mmuext_op( XEN_GUEST_HANDLE_PARAM(void) arg, unsigned int count, XEN_GUEST_HANDLE_PARAM(uint) pdone, unsigned int foreigndom) { diff --git a/xen/common/argo.c b/xen/common/argo.c index 26a01c2188..748b8714d6 100644 --- a/xen/common/argo.c +++ b/xen/common/argo.c @@ -2069,7 +2069,7 @@ sendv(struct domain *src_d, xen_argo_addr_t *src_addr, return ( ret < 0 ) ? ret : len; } =20 -long cf_check +long do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long raw_arg3, unsigned long raw_arg4) @@ -2207,7 +2207,7 @@ do_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(v= oid) arg1, } =20 #ifdef CONFIG_COMPAT -int cf_check +int compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3, unsigned long arg4) diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_tabl= e.c index d5787e3719..4705ee5f76 100644 --- a/xen/common/compat/grant_table.c +++ b/xen/common/compat/grant_table.c @@ -56,7 +56,7 @@ CHECK_gnttab_swap_grant_ref; CHECK_gnttab_cache_flush; #undef xen_gnttab_cache_flush =20 -int cf_check compat_grant_table_op( +int compat_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) cmp_uop, unsigned int c= ount) { int rc =3D 0; diff --git a/xen/common/compat/kernel.c b/xen/common/compat/kernel.c index 8e8c413bf1..804b919bdc 100644 --- a/xen/common/compat/kernel.c +++ b/xen/common/compat/kernel.c @@ -37,7 +37,7 @@ CHECK_TYPE(capabilities_info); =20 CHECK_TYPE(domain_handle); =20 -#define DO(fn) int cf_check compat_##fn +#define DO(fn) int compat_##fn #define COMPAT =20 #include "../kernel.c" diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c index 077ded4a75..ce1de1b307 100644 --- a/xen/common/compat/memory.c +++ b/xen/common/compat/memory.c @@ -53,8 +53,7 @@ static int cf_check get_reserved_device_memory( } #endif =20 -int cf_check compat_memory_op( - unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) +int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) { struct vcpu *curr =3D current; struct domain *currd =3D curr->domain; diff --git a/xen/common/dm.c b/xen/common/dm.c index fcb3a1aa05..201b652deb 100644 --- a/xen/common/dm.c +++ b/xen/common/dm.c @@ -19,7 +19,7 @@ #include #include =20 -long cf_check do_dm_op( +long do_dm_op( domid_t domid, unsigned int nr_bufs, XEN_GUEST_HANDLE_PARAM(xen_dm_op_buf_t) bufs) { diff --git a/xen/common/domain.c b/xen/common/domain.c index f9de1be43c..48a22776a2 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1754,7 +1754,7 @@ long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUES= T_HANDLE_PARAM(void) arg) } =20 #ifdef arch_vm_assist_valid_mask -long cf_check do_vm_assist(unsigned int cmd, unsigned int type) +long do_vm_assist(unsigned int cmd, unsigned int type) { struct domain *currd =3D current->domain; const unsigned long valid =3D arch_vm_assist_valid_mask(currd); diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 9606fa4f1a..879a2adcbe 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -274,7 +274,7 @@ static struct vnuma_info *vnuma_init(const struct xen_d= omctl_vnuma *uinfo, return ERR_PTR(ret); } =20 -long cf_check do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) +long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { long ret =3D 0; bool_t copyback =3D 0; diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 0a82eb3ac2..5e2420fa12 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -1191,7 +1191,7 @@ static int evtchn_set_priority(const struct evtchn_se= t_priority *set_priority) return ret; } =20 -long cf_check do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) ar= g) +long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { int rc; =20 diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index febbe12eab..c71d3ad24b 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -3559,8 +3559,7 @@ gnttab_cache_flush(XEN_GUEST_HANDLE_PARAM(gnttab_cach= e_flush_t) uop, return 0; } =20 -long cf_check -do_grant_table_op( +long do_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count) { long rc; diff --git a/xen/common/hypfs.c b/xen/common/hypfs.c index 0d22396f5d..acd258edf2 100644 --- a/xen/common/hypfs.c +++ b/xen/common/hypfs.c @@ -670,7 +670,7 @@ static int hypfs_write(struct hypfs_entry *entry, return entry->funcs->write(l, uaddr, ulen); } =20 -long cf_check do_hypfs_op( +long do_hypfs_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(const_char) arg1, unsigned long arg2, XEN_GUEST_HANDLE_PARAM(void) arg3, unsigned long a= rg4) { diff --git a/xen/common/kernel.c b/xen/common/kernel.c index adff2d2c77..08bdae082a 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -451,7 +451,7 @@ static int __init cf_check param_init(void) __initcall(param_init); #endif =20 -# define DO(fn) long cf_check do_##fn +# define DO(fn) long do_##fn =20 #endif =20 diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 41669964d2..7095651605 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -1265,13 +1265,13 @@ static int do_kexec_op_internal(unsigned int op, return ret; } =20 -long cf_check do_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) ua= rg) +long do_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg) { return do_kexec_op_internal(op, uarg, 0); } =20 #ifdef CONFIG_COMPAT -int cf_check compat_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void)= uarg) +int compat_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg) { return do_kexec_op_internal(op, uarg, 1); } diff --git a/xen/common/memory.c b/xen/common/memory.c index 69b0cd1e50..963f4df1b6 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -1367,7 +1367,7 @@ static int acquire_resource( return rc; } =20 -long cf_check do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void)= arg) +long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct domain *d, *curr_d =3D current->domain; long rc; diff --git a/xen/common/multicall.c b/xen/common/multicall.c index 9db49092b4..1f0cc4cb26 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -33,8 +33,7 @@ static void trace_multicall_call(multicall_entry_t *call) __trace_multicall_call(call); } =20 -ret_t cf_check -do_multicall( +ret_t do_multicall( XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, uint32_t nr_calls) { struct vcpu *curr =3D current; diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c index 66ba0fe88f..040b4caca2 100644 --- a/xen/common/sched/compat.c +++ b/xen/common/sched/compat.c @@ -39,7 +39,7 @@ static int compat_poll(struct compat_sched_poll *compat) =20 #include "core.c" =20 -int cf_check compat_set_timer_op(u32 lo, s32 hi) +int compat_set_timer_op(u32 lo, s32 hi) { return do_set_timer_op(((s64)hi << 32) | lo); } diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 19ab678181..25885b5640 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1862,7 +1862,7 @@ typedef long ret_t; =20 #endif /* !COMPAT */ =20 -ret_t cf_check do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) +ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { ret_t ret =3D 0; =20 @@ -1999,7 +1999,7 @@ ret_t cf_check do_sched_op(int cmd, XEN_GUEST_HANDLE_= PARAM(void) arg) #ifndef COMPAT =20 /* Per-vcpu oneshot-timer hypercall. */ -long cf_check do_set_timer_op(s_time_t timeout) +long do_set_timer_op(s_time_t timeout) { struct vcpu *v =3D current; s_time_t offset =3D timeout - NOW(); diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index fc4a0b31d6..1ad3c29351 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -29,7 +29,7 @@ #include #include =20 -long cf_check do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) +long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) { long ret =3D 0; int copyback =3D -1; diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index af617f1d0b..1926a92fe4 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -721,7 +721,7 @@ static int xenoprof_op_get_buffer(XEN_GUEST_HANDLE_PARA= M(void) arg) || (op =3D=3D XENOPROF_disable_virq) \ || (op =3D=3D XENOPROF_get_buffer)) =20 -ret_t cf_check do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg) +ret_t do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg) { int ret =3D 0; =20 diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index d9d6556c22..c53fe30313 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -675,7 +675,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(= char) buffer, return 0; } =20 -long cf_check do_console_io( +long do_console_io( unsigned int cmd, unsigned int count, XEN_GUEST_HANDLE_PARAM(char) buf= fer) { long rc; diff --git a/xen/scripts/gen_hypercall.awk b/xen/scripts/gen_hypercall.awk index 403758be21..34840c514f 100644 --- a/xen/scripts/gen_hypercall.awk +++ b/xen/scripts/gen_hypercall.awk @@ -226,7 +226,7 @@ END { # Generate prototypes for (i =3D 1; i <=3D n; i++) { for (p =3D 1; p <=3D n_pre[i]; p++) { - printf("%s cf_check %s_%s(", rettype[pre[i, p]], pre[i, p], fn= [i]); + printf("%s %s_%s(", rettype[pre[i, p]], pre[i, p], fn[i]); if (n_args[i] =3D=3D 0) printf("void"); else diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index 2286a502e3..eaa028109b 100644 --- a/xen/xsm/xsm_core.c +++ b/xen/xsm/xsm_core.c @@ -219,13 +219,13 @@ bool __init has_xsm_magic(paddr_t start) =20 #endif =20 -long cf_check do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op) +long do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op) { return xsm_do_xsm_op(op); } =20 #ifdef CONFIG_COMPAT -int cf_check compat_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op) +int compat_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op) { return xsm_do_compat_op(op); } --=20 2.34.1