From nobody Wed May 1 04:53:33 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=1638978993; cv=none; d=zohomail.com; s=zohoarc; b=nIqA6dYVWNie7php9U77q+6pIUQMenrOLp3lJO9SSxjHJJ3SfSQg+8W7F81J++Q8VBK9IZWrVXIAeb4w6z/UA1gQOVfsE2JbUmY/lwKHzxfkH3o/XLFv0Q9DH3H/oF4wybsBZzmRQcNwLf8bETij6u+lugzKtSJnQQBUGh43wfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978993; 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=FlS8C8pTHUC6JbtaYLzXhbhXJUoUDmpJnMmf+HYN34I=; b=bwZl4vQS89XHezSP91Scnt8AkmMJHCe8CAfES0kX4/N107WRwdxWVd2c3KUjNSAnSld86akAFwmWQ/8RNBw4F+P2IX2s1RZuFBCAbFqV/CYY5YGmj+nvB4OPzcQIF+h8/+fMyT608RrvCV0iasUyHnca7Uym3a+bohs1Kud30lU= 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 1638978993581531.390058159047; Wed, 8 Dec 2021 07:56:33 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242355.419191 (Exim 4.92) (envelope-from ) id 1muzIi-0001Oi-RW; Wed, 08 Dec 2021 15:56:12 +0000 Received: by outflank-mailman (output) from mailman id 242355.419191; Wed, 08 Dec 2021 15:56:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIi-0001Nc-Lm; Wed, 08 Dec 2021 15:56:12 +0000 Received: by outflank-mailman (input) for mailman id 242355; Wed, 08 Dec 2021 15:56:11 +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 1muzIh-0001Lz-Nc for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:11 +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 5c9fec9a-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:10 +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 1EE312113A; Wed, 8 Dec 2021 15:56:10 +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 CBC8913F91; Wed, 8 Dec 2021 15:56:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uMW1MJnVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:09 +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: 5c9fec9a-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978970; 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=FlS8C8pTHUC6JbtaYLzXhbhXJUoUDmpJnMmf+HYN34I=; b=ooH4SqaphRsimhkuvj7/qhy4maS6M2xcLNkXiqUvRfGW+pAgWCs6ZTxPDTt2XYwwzxtCwE pueabQML9WkYAXfoBGjVcPG8grZZ6rMUnLwCWHCpdLaBYfuXnF3ShjpYCDkAtDkYTellxA Ph5ExecRE1zwLjucV7tcGxE38lh30Po= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 01/13] xen: move do_vcpu_op() to arch specific code Date: Wed, 8 Dec 2021 16:55:54 +0100 Message-Id: <20211208155606.20029-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978994110100005 Content-Type: text/plain; charset="utf-8" Today Arm is using another entry point for the vcpu_op hypercall as x86, as some of the common sub-ops are not supported on Arm. The Arm specific handler filetrs 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. Additionally the single user of HYPERCALL_ARM() can be modified and HYPERCALL_ARM() can be removed. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- xen/arch/arm/domain.c | 15 ++++++++------- xen/arch/arm/traps.c | 7 +------ xen/arch/x86/domain.c | 11 +++++++---- xen/arch/x86/x86_64/domain.c | 16 ++++++++++++---- xen/common/compat/domain.c | 14 ++++++-------- xen/common/domain.c | 11 ++++------- xen/include/asm-arm/hypercall.h | 2 -- xen/include/asm-x86/hypercall.h | 2 +- xen/include/xen/hypercall.h | 2 +- 9 files changed, 40 insertions(+), 40 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 96e1b23550..691a14277e 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -1074,23 +1074,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/traps.c b/xen/arch/arm/traps.c index 219ab3c3fb..7abc28848e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1351,11 +1351,6 @@ typedef struct { .nr_args =3D _nr_args, \ } =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 @@ -1386,7 +1381,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 ef1812dc14..e1440ec2f5 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1488,11 +1488,14 @@ 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 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 ) { @@ -1544,7 +1547,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/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 98b8c15cea..1119534679 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -38,14 +38,12 @@ CHECK_vcpu_hvm_context; =20 #endif =20 -int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(vo= id) 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 ) { @@ -102,7 +100,7 @@ int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GU= EST_HANDLE_PARAM(void) ar 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: @@ -133,7 +131,7 @@ int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GU= EST_HANDLE_PARAM(void) ar } =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 093bb4403f..5fadd5c196 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1558,14 +1558,11 @@ int default_initialise_vcpu(struct vcpu *v, XEN_GUE= ST_HANDLE_PARAM(void) arg) return rc; } =20 -long 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 ) { @@ -1737,7 +1734,7 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUE= ST_HANDLE_PARAM(void) arg) } =20 default: - rc =3D arch_do_vcpu_op(cmd, v, arg); + rc =3D -ENOSYS; break; } =20 diff --git a/xen/include/asm-arm/hypercall.h b/xen/include/asm-arm/hypercal= l.h index a0c5a31a2f..9fd13c6b2c 100644 --- a/xen/include/asm-arm/hypercall.h +++ b/xen/include/asm-arm/hypercall.h @@ -4,8 +4,6 @@ #include /* for arch_do_domctl */ int do_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/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index 5d394d4923..e614f7c78c 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/hypercall.h @@ -152,7 +152,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 compat_mmuext_op( diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index 07b10ec230..30558d3c61 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.26.2 From nobody Wed May 1 04:53:33 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=1638978997; cv=none; d=zohomail.com; s=zohoarc; b=DQXx/drW4Un+yoqzD6Zakeja7QNhZPwN82aQ/pmhU5BohWorpockCpE5FGy3NpczJodKCp3adbfX2QW+y7kKWtM1kLLHyzRSr+9/encG+9BgEHVQWC/ioDWmK75ebD0sl941++mivJI69H2ikuz3dHgiZZOkNvI9u9F/bSaZsDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978997; 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=5RvWk4roYW8A4zrziOmqX0VjX+cRK9Rbg79f3SbZ5HQ=; b=CxksWda6bFsiNuzRdLHmsXDhKfstr3dOUbKBu0+i0fUIPxjBCk+34iqZf6elyrLqOrgUhylmyda4XRfhbMG3zR/Kg2pGnhxHltKC+Qbllewc230Gjr283BSdn2w5GI0b3hcQTDTbJiGSrQh3zJyk7u3zRpSRa30lR/mMusgCeQ8= 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 1638978997942829.1454260804949; Wed, 8 Dec 2021 07:56:37 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242356.419200 (Exim 4.92) (envelope-from ) id 1muzIj-0001cQ-I1; Wed, 08 Dec 2021 15:56:13 +0000 Received: by outflank-mailman (output) from mailman id 242356.419200; Wed, 08 Dec 2021 15:56:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIj-0001ZZ-88; Wed, 08 Dec 2021 15:56:13 +0000 Received: by outflank-mailman (input) for mailman id 242356; Wed, 08 Dec 2021 15:56:12 +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 1muzIi-0001LM-8H for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:12 +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 5cf46439-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:10 +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 85A881FD56; Wed, 8 Dec 2021 15:56:10 +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 2694F13C8E; Wed, 8 Dec 2021 15:56:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oNRBCJrVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:10 +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: 5cf46439-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978970; 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=5RvWk4roYW8A4zrziOmqX0VjX+cRK9Rbg79f3SbZ5HQ=; b=aYWl+u2THaZ1bA1oeNVptIpjGPkv1tO5nATYVwVTEG1SwLAL0l1D8mtiM3e78+b/ipZSj8 QyoyBun/SFXY7t5WlzOeYi2LauyEooS5xmrI/Ms8zvI5s+Dlunm0rQg40Cij8lpBRPTL3G gxDpnDZFrHnd+RRAFRx/laevCEYqUM4= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Christopher Clark Subject: [PATCH v3 02/13] xen: harmonize return types of hypercall handlers Date: Wed, 8 Dec 2021 16:55:55 +0100 Message-Id: <20211208155606.20029-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978998950100021 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. 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 do_physdev_op() prototype from both architecture dependant headers to the common one. Move the compat_platform_op() prototype to the common header. Switch some non style compliant types (u32, s32, s64) to style compliant ones. 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) --- xen/arch/arm/physdev.c | 2 +- xen/arch/x86/domctl.c | 4 +-- xen/arch/x86/hvm/hypercall.c | 8 ++--- xen/arch/x86/hypercall.c | 2 +- xen/arch/x86/mm/paging.c | 3 +- xen/arch/x86/pv/callback.c | 20 +++++------ 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 | 2 +- xen/common/argo.c | 12 +++---- xen/common/kexec.c | 6 ++-- xen/include/asm-arm/hypercall.h | 1 - xen/include/asm-x86/hypercall.h | 43 +++++++++++------------- xen/include/asm-x86/paging.h | 3 -- xen/include/xen/hypercall.h | 26 +++++++------- 17 files changed, 74 insertions(+), 83 deletions(-) diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c index f9aa274dda..5a7593fa8f 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) +long do_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/x86/domctl.c b/xen/arch/x86/domctl.c index 7d102e0647..b01ea81373 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 1f04ffb272..9d3b193bad 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -120,8 +120,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 { @@ -154,11 +152,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 @@ -296,7 +292,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/mm/paging.c b/xen/arch/x86/mm/paging.c index dd6b2bdf6f..6cc2636bf4 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 @@ -756,7 +757,7 @@ int paging_domctl(struct domain *d, struct xen_domctl_s= hadow_op *sc, return shadow_domctl(d, sc, u_domctl); } =20 -long paging_domctl_continuation(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_dom= ctl) +long do_paging_domctl_cont(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) { struct xen_domctl op; struct domain *d; diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index 42a6aa0831..6d60263dbc 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -207,9 +207,9 @@ long do_set_callbacks(unsigned long event_address, #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 compat_callback_op(int cmd, XEN_GUEST_HANDLE(void) arg) +int compat_callback_op(int cmd, XEN_GUEST_HANDLE(const_void) arg) { - long ret; + int ret; =20 switch ( cmd ) { @@ -321,10 +321,10 @@ long compat_callback_op(int cmd, XEN_GUEST_HANDLE(voi= d) arg) return ret; } =20 -long compat_set_callbacks(unsigned long event_selector, - unsigned long event_address, - unsigned long failsafe_selector, - unsigned long failsafe_address) +int compat_set_callbacks(unsigned long event_selector, + unsigned long event_address, + unsigned long failsafe_selector, + unsigned long failsafe_address) { struct compat_callback_register event =3D { .type =3D CALLBACKTYPE_event, diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 8ba65178e9..e0d74365f2 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -22,12 +22,12 @@ #include #include #include +#include #include =20 #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index 16a77e3a35..7e99dbda34 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -40,8 +40,6 @@ #define COMPAT_CALL(x) HYPERCALL(x) #endif =20 -#define do_arch_1 paging_domctl_continuation - const pv_hypercall_table_t pv_hypercall_table[] =3D { COMPAT_CALL(set_trap_table), HYPERCALL(mmu_update), @@ -102,11 +100,10 @@ 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 29a2f7cc45..90946c4629 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 do_iret(void) +long do_iret(void) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); struct iret_context iret_saved; @@ -105,7 +105,7 @@ unsigned long do_iret(void) } =20 #ifdef CONFIG_PV32 -unsigned int 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 5dade24726..aaaf70eb63 100644 --- a/xen/arch/x86/pv/misc-hypercalls.c +++ b/xen/arch/x86/pv/misc-hypercalls.c @@ -28,12 +28,16 @@ long do_set_debugreg(int reg, unsigned long value) return set_debugreg(current, reg, value); } =20 -unsigned long do_get_debugreg(int reg) +long 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 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 fbba893a47..f84252bac6 100644 --- a/xen/arch/x86/x86_64/platform_hypercall.c +++ b/xen/arch/x86/x86_64/platform_hypercall.c @@ -4,10 +4,10 @@ =20 EMIT_FILE; =20 +#include #include #include =20 -DEFINE_XEN_GUEST_HANDLE(compat_platform_op_t); #define xen_platform_op compat_platform_op #define xen_platform_op_t compat_platform_op_t #define do_platform_op(x) compat_platform_op(_##x) diff --git a/xen/common/argo.c b/xen/common/argo.c index eaea7ba888..bf6aac7655 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 -compat_argo_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, - XEN_GUEST_HANDLE_PARAM(void) arg2, unsigned long arg3, - unsigned long arg4) +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) { 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 c63db618a7..d7373233e1 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 do_kexec_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) uarg) +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 compat_kexec_op(unsigned long 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/include/asm-arm/hypercall.h b/xen/include/asm-arm/hypercal= l.h index 9fd13c6b2c..cadafd76c7 100644 --- a/xen/include/asm-arm/hypercall.h +++ b/xen/include/asm-arm/hypercall.h @@ -2,7 +2,6 @@ #define __ASM_ARM_HYPERCALL_H__ =20 #include /* for arch_do_domctl */ -int do_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/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index e614f7c78c..9c0981defd 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/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); @@ -88,7 +90,7 @@ do_set_debugreg( int reg, unsigned long value); =20 -extern unsigned long +extern long do_get_debugreg( int reg); =20 @@ -102,17 +104,13 @@ do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc); extern long do_update_va_mapping( unsigned long va, - u64 val64, + uint64_t val64, unsigned long flags); =20 -extern long -do_physdev_op( - int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - extern long do_update_va_mapping_otherdomain( unsigned long va, - u64 val64, + uint64_t val64, unsigned long flags, domid_t domid); =20 @@ -126,7 +124,7 @@ do_mmuext_op( extern long do_callback_op( int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg); =20 -extern unsigned long +extern long do_iret( void); =20 @@ -141,16 +139,18 @@ do_set_segment_base( unsigned int which, unsigned long base); =20 +long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); + +long do_xenpmu_op(unsigned int op, + XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg); + +long do_paging_domctl_cont(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); + #ifdef CONFIG_COMPAT =20 #include #include =20 -extern int -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); @@ -161,17 +161,14 @@ extern int compat_mmuext_op( XEN_GUEST_HANDLE_PARAM(uint) pdone, unsigned int foreigndom); =20 -extern int compat_platform_op( - XEN_GUEST_HANDLE_PARAM(void) u_xenpf_op); - -extern long compat_callback_op( - int cmd, XEN_GUEST_HANDLE(void) arg); +extern int compat_callback_op( + int cmd, XEN_GUEST_HANDLE(const_void) arg); =20 extern int 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 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 compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) trap= s); @@ -180,13 +177,13 @@ extern int compat_set_gdt( XEN_GUEST_HANDLE_PARAM(uint) frame_list, unsigned int entries); =20 extern int 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 compat_iret(void); +extern int compat_iret(void); =20 extern int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) ar= g); =20 -extern long compat_set_callbacks( +extern int compat_set_callbacks( unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address); =20 diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h index 308f1115dd..9cc5d383a4 100644 --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/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 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/include/xen/hypercall.h b/xen/include/xen/hypercall.h index 30558d3c61..9266bc86e9 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 -do_nmi_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - extern long do_hvm_op( unsigned long op, @@ -126,13 +121,15 @@ do_hvm_op( =20 extern long do_kexec_op( - unsigned long op, + unsigned int op, XEN_GUEST_HANDLE_PARAM(void) uarg); =20 extern long do_xsm_op( XEN_GUEST_HANDLE_PARAM(void) u_xsm_op); =20 +long do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); + #ifdef CONFIG_ARGO extern long do_argo_op( unsigned int cmd, @@ -145,9 +142,6 @@ extern long do_argo_op( extern long do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern long -do_xenpmu_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg= ); - extern long do_dm_op( domid_t domid, @@ -198,21 +192,27 @@ compat_sched_op( =20 extern int compat_set_timer_op( - u32 lo, - s32 hi); + uint32_t lo, + int32_t hi); =20 extern int compat_xsm_op( XEN_GUEST_HANDLE_PARAM(void) op); =20 -extern int compat_kexec_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) = uarg); +extern int compat_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) u= arg); =20 DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t); extern int 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 compat_argo_op( +extern int compat_argo_op( unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg1, XEN_GUEST_HANDLE_PARAM(void) arg2, --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978994; cv=none; d=zohomail.com; s=zohoarc; b=VE/rq/qMvb9nVYUaG562HbB7DXEn7emYj7DkyIDLnBYCd+MUncTluNK4jjmxv33oZip36tUhuxlOpHgg+ZSgZyzVdpYk7LeXC+mXDCLq2TWSze+DT3ZeHOtgbKqZ1TUE9kWT9qANrYH2j0l//EgLwJqy3IobD89cUg7xB+fnOmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978994; 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=OHFpmR9wp02Vyhbj7JkBTr1KG9po1JxW5r7fKYlpm3I=; b=JhfAYX+fqOivqjfMOE0T94x3RGxtGkQBCwOeW2EP3gtR1mT+KGcdtCelkL2jqHwE7It4BezB2oyO68uXtHf0X9uNEiDosiCWZNyn6XZywSuuVQ4NHJMstxkNt7dMcosFNrLCrqpUOclnPExhJRs6NqHx7c481RRVDP84j1n8Qww= 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 1638978994398867.6940574276308; Wed, 8 Dec 2021 07:56:34 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242358.419216 (Exim 4.92) (envelope-from ) id 1muzIk-0001xW-V6; Wed, 08 Dec 2021 15:56:14 +0000 Received: by outflank-mailman (output) from mailman id 242358.419216; Wed, 08 Dec 2021 15:56:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIk-0001vX-Ho; Wed, 08 Dec 2021 15:56:14 +0000 Received: by outflank-mailman (input) for mailman id 242358; Wed, 08 Dec 2021 15:56:13 +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 1muzIj-0001LM-6e for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:13 +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 5d14d6db-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:11 +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 C6EA421891; Wed, 8 Dec 2021 15:56:10 +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 7F12413F91; Wed, 8 Dec 2021 15:56:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sDvdHZrVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:10 +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: 5d14d6db-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978970; 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=OHFpmR9wp02Vyhbj7JkBTr1KG9po1JxW5r7fKYlpm3I=; b=rQhIGyAAp5Aau9323oAldUQAEF+l4SEAMX+pUH4PEwbEgJ4Bx8qxp/hwPJeSqfidrcXzhw BkbpFzAy49vH0rgOd8MA+RDJX1FHeVB4Vm+mt+FQ2QqNWwPPqqx09oGX/rylxf/hpVJmUP vtIPDribGDwlEz08+oiiWYhBA5wxO7U= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 03/13] xen: don't include asm/hypercall.h from C sources Date: Wed, 8 Dec 2021 16:55:56 +0100 Message-Id: <20211208155606.20029-4-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978996138100007 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 --- 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/platform_hypercall.c | 1 + xen/arch/x86/cpu/vpmu.c | 1 + 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/common/compat/grant_table.c | 1 + xen/common/compat/multicall.c | 2 +- xen/common/event_channel.c | 1 + xen/common/grant_table.c | 1 + xen/common/multicall.c | 1 + xen/include/asm-arm/hypercall.h | 4 ++++ xen/include/asm-x86/hypercall.h | 4 ++++ 16 files changed, 20 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/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 8ec4547bed..73768b09a7 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/mm.c b/xen/arch/x86/mm.c index 4a9ac8d5e6..4a44af7199 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 284c2dfb9e..08e9ffa104 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 90946c4629..316a23e77e 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 2ddcd95dce..f8bdc57433 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 215e96aba0..13dfa94fee 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/common/compat/grant_table.c b/xen/common/compat/grant_tabl= e.c index ff1d678f01..989fdef65b 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/compat/multicall.c b/xen/common/compat/multicall.c index a0e9918f48..c5982baf76 100644 --- a/xen/common/compat/multicall.c +++ b/xen/common/compat/multicall.c @@ -4,6 +4,7 @@ =20 EMIT_FILE; =20 +#include #include #include #include @@ -19,7 +20,6 @@ static inline void xlat_multicall_entry(struct mc_state *= mcs) mcs->compat_call.args[i] =3D mcs->call.args[i]; } =20 -DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t); #define multicall_entry compat_multicall_entry #define multicall_entry_t multicall_entry_compat_t #define do_multicall_call compat_multicall_call diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index da88ad141a..12006f592e 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 0262f2c48a..4d8adf7faa 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 5a199ebf8f..7b20717c88 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/include/asm-arm/hypercall.h b/xen/include/asm-arm/hypercal= l.h index cadafd76c7..ccd26c5184 100644 --- a/xen/include/asm-arm/hypercall.h +++ b/xen/include/asm-arm/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/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index 9c0981defd..efe5963ee5 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/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 --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978992; cv=none; d=zohomail.com; s=zohoarc; b=Gb5EUVise/SJJp02ZOi4+mzV0D799flPIR5XtgR8dcmId/JFHQuInpYTX7Av28t79UN5eeh2Gxpz/ubVo393XGDt3czxiizLRVtmttgHnoe/+Pw/JlLTrfsus9DIwhBIcFwBoJZqrCauWIivQZjlf1qkrzdh5fO9A62oZe0b5lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978992; 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=uDgmq3e5kxnaWyOpwcnlt0BHxsMjaRjGQqbPnSZ9GF0=; b=Sr43Sc4FzyulF4sxef3eOlvRm/OYuEfJgDDSzrSemNgRvpd9Ip+hdcFX7LLep2M3VNeagMHWx4PopEmy4VFF9EHOQqaH/s6gqkYTgqx1rMg7Mxb/NpZT98bCV+uWOwr8wUBSY/2wrMClXiqnlmzP4wiqRRyBJl4WcFBV/DrIGHc= 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 1638978992958323.9794063015071; Wed, 8 Dec 2021 07:56:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242357.419208 (Exim 4.92) (envelope-from ) id 1muzIk-0001iP-3q; Wed, 08 Dec 2021 15:56:14 +0000 Received: by outflank-mailman (output) from mailman id 242357.419208; Wed, 08 Dec 2021 15:56:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIj-0001gA-Md; Wed, 08 Dec 2021 15:56:13 +0000 Received: by outflank-mailman (input) for mailman id 242357; Wed, 08 Dec 2021 15:56:12 +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 1muzIi-0001Lz-Ga for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:12 +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 5d38a5f9-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:11 +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 1519A218A4; Wed, 8 Dec 2021 15:56:11 +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 CCF3213C8E; Wed, 8 Dec 2021 15:56:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QFTgMJrVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:10 +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: 5d38a5f9-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978971; 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=uDgmq3e5kxnaWyOpwcnlt0BHxsMjaRjGQqbPnSZ9GF0=; b=stH2mzWlG4CKR9NjdwiHUBQ+EoTU9Vz5DsGuKvtdNthKTam502EsC7Qd8vhmE0ECMBaWE9 k8+DFhFUVj3fuO0TX0m41q9aap2m4w2qSi8UfMHvZubYPGTjAdbxzvJ6wsEoyqflim+GZl 7lcaMyXhxFlZddaLyWpTP8tMTFmvapE= 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 v3 04/13] xen: include compat/platform.h from hypercall.h Date: Wed, 8 Dec 2021 16:55:57 +0100 Message-Id: <20211208155606.20029-5-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978993732100001 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 9266bc86e9..459172f6a5 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 @@ -207,7 +210,6 @@ extern int 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.26.2 From nobody Wed May 1 04:53:33 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=1638978996; cv=none; d=zohomail.com; s=zohoarc; b=Vn1irR7t2Uwyj8kn006xXR2F6iSet0CSAKWcsLp25h24WTU59pA2MYM7idN7EtkmSrMYy70DjGeBo3837oKKu4XKNHvkiJKWE1PMtGmGWzINPpPgxwLbDOQuq3d5Y30ZmQVSwBtm9iQ0RjTWB2a2K2QFqFC+OsiRWBlCVC+Aq2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978996; 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=CIDOpO3po9yKGOWvtAC97v30FOkIvG2d9oKuboxtRX8=; b=AMDBBssCdST3cQSE8F96wfxoAPJk5KN18Jn3MSL87wDmyVCfsPHbFAQsyICA41Bb39k3HD/tn+D8ZjoDZXJHicEsBOhH7+oHHJ/Q12QV0FhP4JEN+mm4HY/i2bGCd3ByIG2bYKZOiSDt0oTMePyzo7lMIIErZidCWINIsBZ/yhs= 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 1638978996854738.7414053053399; Wed, 8 Dec 2021 07:56:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242359.419224 (Exim 4.92) (envelope-from ) id 1muzIl-00025n-Ml; Wed, 08 Dec 2021 15:56:15 +0000 Received: by outflank-mailman (output) from mailman id 242359.419224; Wed, 08 Dec 2021 15:56:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIl-000232-3V; Wed, 08 Dec 2021 15:56:15 +0000 Received: by outflank-mailman (input) for mailman id 242359; Wed, 08 Dec 2021 15:56:13 +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 1muzIj-0001Lz-Gh for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:13 +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 5d6abf92-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:11 +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 5E926218A8; Wed, 8 Dec 2021 15:56:11 +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 1D28413F91; Wed, 8 Dec 2021 15:56:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4JL1BZvVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:11 +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: 5d6abf92-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978971; 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=CIDOpO3po9yKGOWvtAC97v30FOkIvG2d9oKuboxtRX8=; b=Ph9JI3yUq1Au13NxX+csiCC697zeHgdkNyiHHkkYcHK3HaerM/GK17jcwRvIbZ8dklQUPM mQYuh+I1a9wc7dNRyntf/wv3V8EuOB6ejAcsTpCfPtPyZqvUu0WXBlPTwSech1C8bOsrUg 8qsgAh1kvK3HD3xqM1znTk9xMBcGr9k= 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 v3 05/13] xen: generate hypercall interface related code Date: Wed, 8 Dec 2021 16:55:58 +0100 Message-Id: <20211208155606.20029-6-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978998630100017 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 --- 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) Signed-off-by: Juergen Gross --- .gitignore | 1 + xen/include/Makefile | 13 ++ xen/include/hypercall-defs.c | 280 ++++++++++++++++++++++++++++++ xen/scripts/gen_hypercall.awk | 314 ++++++++++++++++++++++++++++++++++ 4 files changed, 608 insertions(+) create mode 100644 xen/include/hypercall-defs.c create mode 100644 xen/scripts/gen_hypercall.awk diff --git a/.gitignore b/.gitignore index 9513506dd9..753a602e29 100644 --- a/.gitignore +++ b/.gitignore @@ -336,6 +336,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 95daa8a289..43509131b9 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -77,6 +77,18 @@ compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) conf= ig/auto.conf Makefile cat $(filter %.h,$^) >$@.new mv -f $@.new $@ =20 +quiet_cmd_genhyp =3D GEN $@ +define cmd_genhyp + awk -f ../scripts/gen_hypercall.awk <$< >$@ +endef + +all: xen/hypercall-defs.h + +xen/hypercall-defs.h: hypercall-defs.i ../scripts/gen_hypercall.awk FORCE + $(call if_changed,genhyp) + +targets +=3D xen/hypercall-defs.h + ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) =20 all: headers.chk headers99.chk headers++.chk @@ -133,4 +145,5 @@ endif =20 clean:: rm -rf compat config generated headers*.chk + rm -f xen/hypercall-defs.h hypercall-defs.i rm -f $(BASEDIR)/include/xen/lib/x86/cpuid-autogen.h diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c new file mode 100644 index 0000000000..e08b0a343a --- /dev/null +++ b/xen/include/hypercall-defs.c @@ -0,0 +1,280 @@ +/* + * 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 +#else +#define PREFIX_dep +#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 +physdev_op(int cmd, void *arg) +#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 +#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..34840c514f --- /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 %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.26.2 From nobody Wed May 1 04:53:33 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=1638978995; cv=none; d=zohomail.com; s=zohoarc; b=akdDc+4LQCj3kFjEtkoJY6jZNXxLSoFxuecVv+GtavpgrZ4RPUYgi1X6X+u3XdxGQwprPMGlT4LFXxUDM2cX7okKupaw5caFMUNWh7NRVOvC+ay7jYKhY25pCgDga1UHuZV61OtDsJkIIhtA5MO2bjmYOUfi+HHb1sDmB24/zBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978995; 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=Z6gh2zcV51PUmntndcjGT7MfpyJvBSFGHJiq128xk6Q=; b=kxp8mGGtF+KWTezL5lVaRfDINs7yEEnEpc4tuDnooLpoBDE/qDNka/DAlmi9+JTYdgRTy5vWushS13IYleHiy+hR8mdtAd+MYLBrHbwXnJfniibMfI0MDCgytFsSKKew5TF9dOt74taiG0184IkUj/qzrjAEU8hPdSyLVMvgorg= 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 16389789950381009.1659645331835; Wed, 8 Dec 2021 07:56:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242363.419261 (Exim 4.92) (envelope-from ) id 1muzIp-0002yO-Iw; Wed, 08 Dec 2021 15:56:19 +0000 Received: by outflank-mailman (output) from mailman id 242363.419261; Wed, 08 Dec 2021 15:56:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIo-0002ut-JM; Wed, 08 Dec 2021 15:56:18 +0000 Received: by outflank-mailman (input) for mailman id 242363; Wed, 08 Dec 2021 15:56:15 +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 1muzIl-0001Lz-Gp for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:15 +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 5d92812d-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:11 +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 A283B218B0; Wed, 8 Dec 2021 15:56:11 +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 6565413C8E; Wed, 8 Dec 2021 15:56:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GKGTF5vVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:11 +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: 5d92812d-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978971; 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=Z6gh2zcV51PUmntndcjGT7MfpyJvBSFGHJiq128xk6Q=; b=VLNfcRrxdHj0gDgfesgcZLN+JVXEv1kxC/MDnVuLTMCwuhPGWhzpyRFFyKpSsMDm2JxtIV RdYWPV/dhqC5MG+emgRmR75W13dCETXhysRXh9tTUlxOI5PIpmp2qSI0kyIlIVNeiS3rbS Xydz4lHFbWb3z9h0CQF5ncPwkYkzc1E= 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 v3 06/13] xen: use generated prototypes for hypercall handlers Date: Wed, 8 Dec 2021 16:55:59 +0100 Message-Id: <20211208155606.20029-7-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978996299100011 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 --- xen/arch/x86/hvm/hypercall.c | 6 +- xen/include/asm-x86/hypercall.h | 133 ------------------------ xen/include/xen/hypercall.h | 178 +------------------------------- 3 files changed, 5 insertions(+), 312 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 9d3b193bad..85b7a33523 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -31,7 +31,7 @@ #include #include =20 -static long 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 @@ static long hvm_memory_op(unsigned long cmd, XEN_GUEST_HA= NDLE_PARAM(void) arg) } =20 #ifdef CONFIG_GRANT_TABLE -static long 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 @@ static long hvm_grant_table_op( } #endif =20 -static long 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/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index efe5963ee5..2547572ccd 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/hypercall.h @@ -52,104 +52,6 @@ void pv_ring3_init_hypercall_page(void *ptr); */ #define MMU_UPDATE_PREEMPTED (~(~0U>>1)) =20 -extern long -do_event_channel_op_compat( - XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop); - -/* Legacy hypercall (as of 0x00030202). */ -extern long do_physdev_op_compat( - XEN_GUEST_HANDLE(physdev_op_t) uop); - -/* Legacy hypercall (as of 0x00030101). */ -extern long do_sched_op_compat( - int cmd, unsigned long arg); - -extern long -do_set_trap_table( - XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps); - -extern long -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 -do_set_gdt( - XEN_GUEST_HANDLE_PARAM(xen_ulong_t) frame_list, - unsigned int entries); - -extern long -do_stack_switch( - unsigned long ss, - unsigned long esp); - -extern long -do_fpu_taskswitch( - int set); - -extern long -do_set_debugreg( - int reg, - unsigned long value); - -extern long -do_get_debugreg( - int reg); - -extern long -do_update_descriptor( - uint64_t gaddr, seg_desc_t desc); - -extern long -do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc); - -extern long -do_update_va_mapping( - unsigned long va, - uint64_t val64, - unsigned long flags); - -extern long -do_update_va_mapping_otherdomain( - unsigned long va, - uint64_t val64, - unsigned long flags, - domid_t domid); - -extern long -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 do_callback_op( - int cmd, XEN_GUEST_HANDLE_PARAM(const_void) arg); - -extern long -do_iret( - void); - -extern long -do_set_callbacks( - unsigned long event_address, - unsigned long failsafe_address, - unsigned long syscall_address); - -extern long -do_set_segment_base( - unsigned int which, - unsigned long base); - -long do_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -long do_xenpmu_op(unsigned int op, - XEN_GUEST_HANDLE_PARAM(xen_pmu_params_t) arg); - -long do_paging_domctl_cont(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl); - #ifdef CONFIG_COMPAT =20 #include @@ -159,41 +61,6 @@ extern int compat_common_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); =20 -extern int compat_mmuext_op( - XEN_GUEST_HANDLE_PARAM(void) arg, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(uint) pdone, - unsigned int foreigndom); - -extern int compat_callback_op( - int cmd, XEN_GUEST_HANDLE(const_void) arg); - -extern int compat_update_va_mapping( - unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags); - -extern int 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 compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) trap= s); - -extern int compat_set_gdt( - XEN_GUEST_HANDLE_PARAM(uint) frame_list, unsigned int entries); - -extern int compat_update_descriptor( - uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi); - -extern int compat_iret(void); - -extern int compat_nmi_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) ar= g); - -extern int 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 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 459172f6a5..f307dfb597 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -21,33 +21,19 @@ #include #include =20 -extern long -do_sched_op( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -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 -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 -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,171 +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 -do_memory_op( - unsigned long cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -do_multicall( - XEN_GUEST_HANDLE_PARAM(multicall_entry_t) call_list, - unsigned int nr_calls); - -extern long -do_set_timer_op( - s_time_t timeout); - -extern long -do_event_channel_op( - int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -do_xen_version( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -do_console_io( - unsigned int cmd, - unsigned int count, - XEN_GUEST_HANDLE_PARAM(char) buffer); - -extern long -do_grant_table_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count); - -extern long -do_vm_assist( - unsigned int cmd, - unsigned int type); - -extern long -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 -do_hvm_op( - unsigned long op, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -do_kexec_op( - unsigned int op, - XEN_GUEST_HANDLE_PARAM(void) uarg); - -extern long -do_xsm_op( - XEN_GUEST_HANDLE_PARAM(void) u_xsm_op); - -long do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg); - -#ifdef CONFIG_ARGO -extern long 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 -do_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern long -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 -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 -compat_memory_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int -compat_grant_table_op( - unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count); - -extern int -compat_vcpu_op( - int cmd, - unsigned int vcpuid, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int -compat_xenoprof_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int -compat_xen_version( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int -compat_sched_op( - int cmd, - XEN_GUEST_HANDLE_PARAM(void) arg); - -extern int -compat_set_timer_op( - uint32_t lo, - int32_t hi); - -extern int compat_xsm_op( - XEN_GUEST_HANDLE_PARAM(void) op); - -extern int compat_kexec_op(unsigned int op, XEN_GUEST_HANDLE_PARAM(void) u= arg); - -DEFINE_XEN_GUEST_HANDLE(multicall_entry_compat_t); -extern int 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 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 -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.26.2 From nobody Wed May 1 04:53:33 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=1638978996; cv=none; d=zohomail.com; s=zohoarc; b=dJS2szUkSj6ouL520k7lDfKQIm9WIZH0KEWPVg2S6CyaNNhH5u3Yh9zYTO3fWogv8JCMnKMpl/99MlhjUHNUGxH4uMjB9dSbF0KWZP9+IYiIMIY2XIUVYOCOwy4COVEP0O2vKc4FSXE8gJWsgtrrxWvPN4ohXTuVxHwFzWplVj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978996; 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=nEFyO5REy98yyXsf4CZGnr9ARPg0xXVeuhj3Ow7aEFk=; b=e8EkI0cI2X7xip+lBR0MfmxyQy0cAS8nxkdhcdBhTsFOpTIVMVvYzd/xAPIoGygfppekkXkF+O6GJ8GAUiui2T38kaPXaGpQmyH4FSC/XciJvGz9Alyy/KjlW1V1XjqeRV542R6aBL1e0M4zEtKcVnrFVGlJaacjPuywO2o3VqI= 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 1638978996794873.8363728264105; Wed, 8 Dec 2021 07:56:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242360.419236 (Exim 4.92) (envelope-from ) id 1muzIm-0002OA-Kz; Wed, 08 Dec 2021 15:56:16 +0000 Received: by outflank-mailman (output) from mailman id 242360.419236; Wed, 08 Dec 2021 15:56:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIm-0002Ki-7K; Wed, 08 Dec 2021 15:56:16 +0000 Received: by outflank-mailman (input) for mailman id 242360; Wed, 08 Dec 2021 15:56:14 +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 1muzIk-0001LM-6Y for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:14 +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 5db621af-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:12 +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 E0C781FD5B; Wed, 8 Dec 2021 15:56:11 +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 A8B8413C8E; Wed, 8 Dec 2021 15:56:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4DkdKJvVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:11 +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: 5db621af-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978971; 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=nEFyO5REy98yyXsf4CZGnr9ARPg0xXVeuhj3Ow7aEFk=; b=LTGeeP9QCTW2+cX+mEPR9joCgQvdR6Blyo2yOC9blPOIQxB2Q3CcgDsBZw7zGzuNrrGbQG 7+Lgh4j5cJWlpgMYIR944ZV03lxi99EwTOBlgpQOySZ0QgBQa2aWH6JikTNOriff7sLrJl ivjLi5ue6NxKgZgFJYX0plwdguR7F0I= 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 v3 07/13] x86/pv-shim: don't modify hypercall table Date: Wed, 8 Dec 2021 16:56:00 +0100 Message-Id: <20211208155606.20029-8-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978998609100016 Content-Type: text/plain; charset="utf-8" When running as pv-shim the hypercall is modified today in order to replace the functions for __HYPERVISOR_event_channel_op and __HYPERVISOR_grant_table_op hypercalls. Change this to call the related functions from the normal handlers instead when running as shim. The performance implications are not really relevant, as a normal production hypervisor will not be configured to support shim mode, so the related calls will be dropped due to optimization of the compiler. Note that for the CONFIG_PV_SHIM_EXCLUSIVE case there is a dummy wrapper do_grant_table_op() needed, as in this case grant_table.c isn't being built. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V2: - add test for pv_shim to wrappers (Jan Beulich) - add grant_table_op to hypercall table if CONFIG_PV_SHIM (Jan Beulich) V3: - add [un]likely() to pv_shim tests (Jan Beulich) --- xen/arch/x86/pv/hypercall.c | 2 +- xen/arch/x86/pv/shim.c | 54 +++++++++++++++++------------------ xen/common/event_channel.c | 9 ++++++ xen/common/grant_table.c | 9 ++++++ xen/include/asm-x86/pv/shim.h | 3 ++ 5 files changed, 49 insertions(+), 28 deletions(-) diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index 7e99dbda34..abe4dd7839 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -62,7 +62,7 @@ const pv_hypercall_table_t pv_hypercall_table[] =3D { COMPAT_CALL(xen_version), HYPERCALL(console_io), COMPAT_CALL(physdev_op_compat), -#ifdef CONFIG_GRANT_TABLE +#if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM) COMPAT_CALL(grant_table_op), #endif HYPERCALL(vm_assist), diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index d9704121a7..9a4a257d4c 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -56,11 +56,6 @@ static DEFINE_SPINLOCK(balloon_lock); =20 static struct platform_bad_page __initdata reserved_pages[2]; =20 -static long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)= arg); -static long pv_shim_grant_table_op(unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count); - /* * By default give the shim 1MB of free memory slack. Some users may wish = to * tune this constants for better memory utilization. This can be achieved @@ -203,7 +198,6 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pgen= try_t *l4start, start_info_t *si) { bool compat =3D is_pv_32bit_domain(d); - pv_hypercall_table_t *rw_pv_hypercall_table; uint64_t param =3D 0; long rc; =20 @@ -249,23 +243,6 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pge= ntry_t *l4start, consoled_set_ring_addr(page); } =20 - /* - * Locate pv_hypercall_table[] (usually .rodata) in the directmap (whi= ch - * is writeable) and insert some shim-specific hypercall handlers. - */ - rw_pv_hypercall_table =3D __va(__pa(pv_hypercall_table)); - rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].native =3D - (hypercall_fn_t *)pv_shim_event_channel_op; - rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].native =3D - (hypercall_fn_t *)pv_shim_grant_table_op; - -#ifdef CONFIG_PV32 - rw_pv_hypercall_table[__HYPERVISOR_event_channel_op].compat =3D - (hypercall_fn_t *)pv_shim_event_channel_op; - rw_pv_hypercall_table[__HYPERVISOR_grant_table_op].compat =3D - (hypercall_fn_t *)pv_shim_grant_table_op; -#endif - guest =3D d; =20 /* @@ -435,7 +412,7 @@ int pv_shim_shutdown(uint8_t reason) return 0; } =20 -static long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void)= arg) +long pv_shim_event_channel_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) { struct domain *d =3D current->domain; struct evtchn_close close; @@ -683,9 +660,9 @@ void pv_shim_inject_evtchn(unsigned int port) # define compat_handle_okay guest_handle_okay #endif =20 -static long pv_shim_grant_table_op(unsigned int cmd, - XEN_GUEST_HANDLE_PARAM(void) uop, - unsigned int count) +long pv_shim_grant_table_op(unsigned int cmd, + XEN_GUEST_HANDLE_PARAM(void) uop, + unsigned int count) { struct domain *d =3D current->domain; long rc =3D 0; @@ -845,6 +822,29 @@ static long pv_shim_grant_table_op(unsigned int cmd, return rc; } =20 +#ifndef CONFIG_GRANT_TABLE +/* Thin wrapper(s) needed. */ +long do_grant_table_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, + unsigned int count) +{ + if ( likely(!pv_shim) ) + return -ENOSYS; + + return pv_shim_grant_table_op(cmd, uop, count); +} + +#ifdef CONFIG_PV32 +int compat_grant_table_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) u= op, + unsigned int count) +{ + if ( likely(!pv_shim) ) + return -ENOSYS; + + return pv_shim_grant_table_op(cmd, uop, count); +} +#endif +#endif + long pv_shim_cpu_up(void *data) { struct vcpu *v =3D data; diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 12006f592e..0e4973f800 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -32,6 +32,10 @@ #include #include =20 +#ifdef CONFIG_PV_SHIM +#include +#endif + #define ERROR_EXIT(_errno) \ do { \ gdprintk(XENLOG_WARNING, \ @@ -1190,6 +1194,11 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_P= ARAM(void) arg) { int rc; =20 +#ifdef CONFIG_PV_SHIM + if ( unlikely(pv_shim) ) + return pv_shim_event_channel_op(cmd, arg); +#endif + switch ( cmd ) { case EVTCHNOP_alloc_unbound: { diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 4d8adf7faa..e5641608ad 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -45,6 +45,10 @@ #include #include =20 +#ifdef CONFIG_PV_SHIM +#include +#endif + /* Per-domain grant information. */ struct grant_table { /* @@ -3543,6 +3547,11 @@ do_grant_table_op( long rc; unsigned int opaque_in =3D cmd & GNTTABOP_ARG_MASK, opaque_out =3D 0; =20 +#ifdef CONFIG_PV_SHIM + if ( unlikely(pv_shim) ) + return pv_shim_grant_table_op(cmd, uop, count); +#endif + if ( (int)count < 0 ) return -EINVAL; =20 diff --git a/xen/include/asm-x86/pv/shim.h b/xen/include/asm-x86/pv/shim.h index 8a91f4f9df..6415f8068e 100644 --- a/xen/include/asm-x86/pv/shim.h +++ b/xen/include/asm-x86/pv/shim.h @@ -19,6 +19,7 @@ #ifndef __X86_PV_SHIM_H__ #define __X86_PV_SHIM_H__ =20 +#include #include =20 #if defined(CONFIG_PV_SHIM_EXCLUSIVE) @@ -45,6 +46,8 @@ domid_t get_initial_domain_id(void); uint64_t pv_shim_mem(uint64_t avail); void pv_shim_fixup_e820(struct e820map *e820); const struct platform_bad_page *pv_shim_reserved_pages(unsigned int *size); +typeof(do_event_channel_op) pv_shim_event_channel_op; +typeof(do_grant_table_op) pv_shim_grant_table_op; =20 #else =20 --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978992; cv=none; d=zohomail.com; s=zohoarc; b=IhmV0JW+AwFw3k3Jln3LItcVE2GOUXSftJWoqKIMObq5K34NtMYWvVV/e24fiW9FRvfXXdFrp/YT62ruGcCaOZfmmkOMwNvXNjdY6YaEM63BOf5ZZQUVVzGn1gBYU1GG8pxp8ElrkJ1MdYHRchjSsmn9pDt2BDbFBOUsYn7qqUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978992; 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=EIALndOIsMPGW+C03aHxK3+A8bGfi8rpQdK0dJq1lXo=; b=HvT6rDAjm+SKcBfOeRtLM+gCm37JU9jMi+/QxERSTshUx47G9Pd7Ggvi8re+F7/DbHdonvgAjMEKkBRHDWYbkyO7c2Ies/JHEScuIUh8USuDOuar8OozXtNzMugeE5rlqasauI4KCPiVnjBr9eJ46kOW3cXK6X9FY3Qijc2xNhw= 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 1638978992618736.7489691641159; Wed, 8 Dec 2021 07:56:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242361.419244 (Exim 4.92) (envelope-from ) id 1muzIn-0002cA-EC; Wed, 08 Dec 2021 15:56:17 +0000 Received: by outflank-mailman (output) from mailman id 242361.419244; Wed, 08 Dec 2021 15:56:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIn-0002Yv-2d; Wed, 08 Dec 2021 15:56:17 +0000 Received: by outflank-mailman (input) for mailman id 242361; Wed, 08 Dec 2021 15:56:14 +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 1muzIk-0001Lz-Gh for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:14 +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 5dd204a4-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:12 +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 2133A1FDFC; Wed, 8 Dec 2021 15:56:12 +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 E6EF513F91; Wed, 8 Dec 2021 15:56:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KBcvN5vVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:11 +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: 5dd204a4-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978972; 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=EIALndOIsMPGW+C03aHxK3+A8bGfi8rpQdK0dJq1lXo=; b=F2O0KfVMzGi7qjHBRUBkioSWQPYhFfgd35aEJkr92TkQ6A0H9JVickueP2ztqX/JaERtuE MaG4C/jsF/KazmVUsNn+VGMd4WEev6wZ0KCfZ7q2tS4mcAQTf5jq9Z5dzpUU4K6G96o9EL LuNJxO9oEWcWyOYyGzopF8TYn93V46s= 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 v3 08/13] xen/x86: don't use hypercall table for calling compat hypercalls Date: Wed, 8 Dec 2021 16:56:01 +0100 Message-Id: <20211208155606.20029-9-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978993760100002 Content-Type: text/plain; charset="utf-8" Today the *_op_compat hypercalls call the modern handler functions by using the entries from the hypercall table. This is resulting in a not needed indirect function call which can be avoided by using the correct handler function directly. This is basically a revert of commit 1252e282311734 ("86/pv: Export pv_hypercall_table[] rather than working around it in several ways"), which reasoning no longer applies, as shim no longer modifies the hypercall table. The hypercall table can now be made static as there is no external reference to it any longer. Commit 834cb8761051f7 ("x86/PV32: fix physdev_op_compat handling") can be reverted, too, as using the direct call of the correct handler is already handled fine without that patch. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- xen/arch/x86/compat.c | 14 ++++---------- xen/arch/x86/pv/hypercall.c | 9 ++++++++- xen/arch/x86/x86_64/compat.c | 1 - xen/include/asm-x86/hypercall.h | 8 -------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/compat.c b/xen/arch/x86/compat.c index 58b202f701..939b449dec 100644 --- a/xen/arch/x86/compat.c +++ b/xen/arch/x86/compat.c @@ -17,14 +17,12 @@ typedef long ret_t; /* Legacy hypercall (as of 0x00030202). */ ret_t do_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physdev_op_t) uop) { - typeof(do_physdev_op) *fn =3D - (void *)pv_hypercall_table[__HYPERVISOR_physdev_op].native; struct physdev_op op; =20 if ( unlikely(copy_from_guest(&op, uop, 1) !=3D 0) ) return -EFAULT; =20 - return fn(op.cmd, guest_handle_from_ptr(&uop.p->u, void)); + return do_physdev_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void)); } =20 #ifndef COMPAT @@ -32,14 +30,11 @@ ret_t do_physdev_op_compat(XEN_GUEST_HANDLE_PARAM(physd= ev_op_t) uop) /* Legacy hypercall (as of 0x00030101). */ long do_sched_op_compat(int cmd, unsigned long arg) { - typeof(do_sched_op) *fn =3D - (void *)pv_hypercall_table[__HYPERVISOR_sched_op].native; - switch ( cmd ) { case SCHEDOP_yield: case SCHEDOP_block: - return fn(cmd, guest_handle_from_ptr(NULL, void)); + return do_sched_op(cmd, guest_handle_from_ptr(NULL, void)); =20 case SCHEDOP_shutdown: TRACE_3D(TRC_SCHED_SHUTDOWN, @@ -57,8 +52,6 @@ long do_sched_op_compat(int cmd, unsigned long arg) /* Legacy hypercall (as of 0x00030202). */ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop) { - typeof(do_event_channel_op) *fn =3D - (void *)pv_hypercall_table[__HYPERVISOR_event_channel_op].native; struct evtchn_op op; =20 if ( unlikely(copy_from_guest(&op, uop, 1) !=3D 0) ) @@ -76,7 +69,8 @@ long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(ev= tchn_op_t) uop) case EVTCHNOP_bind_ipi: case EVTCHNOP_bind_vcpu: case EVTCHNOP_unmask: - return fn(op.cmd, guest_handle_from_ptr(&uop.p->u, void)); + return do_event_channel_op(op.cmd, + guest_handle_from_ptr(&uop.p->u, void)); =20 default: return -ENOSYS; diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index abe4dd7839..c391d18130 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -27,6 +27,13 @@ #include #include =20 +typedef struct { + hypercall_fn_t *native; +#ifdef CONFIG_PV32 + hypercall_fn_t *compat; +#endif +} pv_hypercall_table_t; + #ifdef CONFIG_PV32 #define HYPERCALL(x) \ [ __HYPERVISOR_ ## x ] =3D { (hypercall_fn_t *) do_ ## x, \ @@ -40,7 +47,7 @@ #define COMPAT_CALL(x) HYPERCALL(x) #endif =20 -const pv_hypercall_table_t pv_hypercall_table[] =3D { +static const pv_hypercall_table_t pv_hypercall_table[] =3D { COMPAT_CALL(set_trap_table), HYPERCALL(mmu_update), COMPAT_CALL(set_gdt), diff --git a/xen/arch/x86/x86_64/compat.c b/xen/arch/x86/x86_64/compat.c index fcbc1cc0d7..0e4c71f2aa 100644 --- a/xen/arch/x86/x86_64/compat.c +++ b/xen/arch/x86/x86_64/compat.c @@ -12,7 +12,6 @@ EMIT_FILE; #define physdev_op_t physdev_op_compat_t #define do_physdev_op compat_physdev_op #define do_physdev_op_compat(x) compat_physdev_op_compat(_##x) -#define native compat =20 #define COMPAT #define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index 2547572ccd..eb2907b5b6 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/hypercall.h @@ -21,13 +21,6 @@ typedef unsigned long hypercall_fn_t( unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); =20 -typedef struct { - hypercall_fn_t *native; -#ifdef CONFIG_PV32 - hypercall_fn_t *compat; -#endif -} pv_hypercall_table_t; - typedef struct { uint8_t native; #ifdef CONFIG_COMPAT @@ -38,7 +31,6 @@ typedef struct { extern const hypercall_args_t hypercall_args_table[NR_hypercalls]; =20 #ifdef CONFIG_PV -extern const pv_hypercall_table_t pv_hypercall_table[]; void pv_hypercall(struct cpu_user_regs *regs); #endif =20 --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638979003; cv=none; d=zohomail.com; s=zohoarc; b=KgGkEst51BnYg3ssrO4q+Z7pvndeJWHBYboqofGekj2oWUOxZ0ErFba47cGkmA3RlprY1SuFLfoTZGBZlblUif43Ipy6fZ4u0MHwxPHvgLaM95y0fwdmv1jeprWwhqG3cpVyd4i5S3mlcj3xTuLEAdMaDyp3GkWnSGorUtp18ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638979003; 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=3himJFRfurQYBLo8Y8yogcKWRO02wPAeaAXCAVac6Xg=; b=SKPHe38GcS7vFZaRKCQgs8Vw+QqGqreWDDq6fNpOpEfSRAoD4yxEailNVJj4k0/3YgD/kREw19M7GafHs1nZhwDwhJ09EUzl02x78GKfi+0k4NeRJToc1vUN4fhUDbgOtrKO+oIbciI89VQ3V2sJfW0iw49lSfIn5Ftt9mv0hZs= 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 1638979003246733.0121115806044; Wed, 8 Dec 2021 07:56:43 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242367.419307 (Exim 4.92) (envelope-from ) id 1muzIy-0004i6-9g; Wed, 08 Dec 2021 15:56:28 +0000 Received: by outflank-mailman (output) from mailman id 242367.419307; Wed, 08 Dec 2021 15:56: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 1muzIw-0004a5-L2; Wed, 08 Dec 2021 15:56:26 +0000 Received: by outflank-mailman (input) for mailman id 242367; Wed, 08 Dec 2021 15:56:18 +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 1muzIo-0001LM-7D for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:18 +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 5e04d5dd-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:12 +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 66EBF1FE01; Wed, 8 Dec 2021 15:56:12 +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 27CC713C8E; Wed, 8 Dec 2021 15:56:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yIiSCJzVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:12 +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: 5e04d5dd-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978972; 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=3himJFRfurQYBLo8Y8yogcKWRO02wPAeaAXCAVac6Xg=; b=lLdE/c7QZmoIhyA8h6+RG3FFOPOtZF/ovaVQf1T6J5AlT+E+NnFbjZq3iGsbP94cIJ/gXM LIotb3hC/DQU+FUGCtBenk0buyRL7s5jKy8L9oaAf3yfDgS9O5rt0DaLv0qoNBwxP6t6EL 16F3wbXlNVG0SRU+mqAKvliOu9oHQzU= 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 v3 09/13] xen/x86: call hypercall handlers via generated macro Date: Wed, 8 Dec 2021 16:56:02 +0100 Message-Id: <20211208155606.20029-10-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638979004192100003 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/pv/hypercall.c | 184 +++----------------------------- xen/include/asm-x86/hypercall.h | 55 +++++++--- 4 files changed, 76 insertions(+), 388 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 85b7a33523..5952172476 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -108,56 +108,10 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(v= oid) 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) { @@ -203,23 +157,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. @@ -230,85 +167,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); @@ -327,31 +206,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/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index c391d18130..ef92266620 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) diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercal= l.h index eb2907b5b6..2077e28d23 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/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 @@ -55,4 +42,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__ */ --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978996; cv=none; d=zohomail.com; s=zohoarc; b=gocKexedxoZbnI9BJ1/qWHmmLyks4i4WEo76uOJtJvi/6HVF8j+p3O3qznuzOnpAm9bHy3jd5iaiNxutkXmnrxLDDXjzOKaw5G7Kkh16yiYQmG6zTV0HGJc/G1YrYHZisjFAWf2A50SSJYsfzBH/vHiA4hrIuN1EYP5L0Ah/6/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978996; 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=2n/9xey2IT4ZAnuW1PqFqQUspNgB5vGE/l2Zzlja0vw=; b=axR1Gqwl4LzDtbJwsS/C/VhipxnjPk5wKwtf931HY1xH+1meKxB+8Li5k8vV0YH9eNIdaYvtquqbK51RYvUjbd3EmNpUjFJuM/+a2gVmJz7dXeeaBz3sI5Y3gfTlnwhWCX+1cXuhYgBeHGcWE3jVu4NIgVxXS0lmYO71WUva50Q= 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 1638978996214267.00663773673875; Wed, 8 Dec 2021 07:56:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242364.419272 (Exim 4.92) (envelope-from ) id 1muzIr-0003PK-5B; Wed, 08 Dec 2021 15:56:21 +0000 Received: by outflank-mailman (output) from mailman id 242364.419272; Wed, 08 Dec 2021 15:56:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIq-0003HI-D6; Wed, 08 Dec 2021 15:56:20 +0000 Received: by outflank-mailman (input) for mailman id 242364; Wed, 08 Dec 2021 15:56:16 +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 1muzIm-0001LM-76 for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:16 +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 5e2e218c-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:13 +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 9ED941FE03; Wed, 8 Dec 2021 15:56:12 +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 6D3CC13C8E; Wed, 8 Dec 2021 15:56:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CKp/GZzVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:12 +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: 5e2e218c-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978972; 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=2n/9xey2IT4ZAnuW1PqFqQUspNgB5vGE/l2Zzlja0vw=; b=bkecxq9dHRAdMvoFFLkP2I1NXt3D/CTDUrKNFqqh4EEaPWeBHpHoDAg+8EaIA30+K+TbIq ObX3Td6NJRulPGk2ur1aSWeAL7zLqXCnV/iRxLKhJWC8JdNrp1CDvzkm/MRBcK4ThBY/Bp Hc3+uxypgu4nVCkdJhdueQTGJHkPZHk= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel Subject: [PATCH v3 10/13] xen/arm: call hypercall handlers via generated macro Date: Wed, 8 Dec 2021 16:56:03 +0100 Message-Id: <20211208155606.20029-11-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978998417100013 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 --- V2: - make hypercall_args[] const (Jan Beulich) --- xen/arch/arm/traps.c | 119 ++++++++++--------------------------------- 1 file changed, 26 insertions(+), 93 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 7abc28848e..00af76cf14 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1337,62 +1337,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 -/* - * 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(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) @@ -1431,7 +1389,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 @@ -1439,52 +1396,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(); } @@ -1521,7 +1466,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) ) { @@ -1538,28 +1486,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(!psr_mode_is_user(guest_cpu_user_regs())) ? mc_continue : mc_preempt; --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638979002; cv=none; d=zohomail.com; s=zohoarc; b=j7eYQVvRvl+2Dw4Qrm1OdHeFqxLsZp/zYcYe02qg/9Mc8UnXHXuJzP9MhWBttazMu3VVGLNh5J6KQomMfC0zlVdl23UzfIsg4vucYDOxxFxjgu6zqlFWMPU9Ez/mSnas26OqOCVjuxTAh0qUKXd3tfIdVtkHDN2rJv/zAO5yywQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638979002; 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=dJr8Fztf5T8hrG+mezGu/5MmsW11cX9HygUkaO7iFT0=; b=jZjcCC7tIHV9PyBQ4y/LYPKHFQQhDGisW7qrKJ7AEYRjbCaPv/56VJhTKPLcHRFazMkZDlhq6o36IfyMbuplZC1q/m0qbwlibZhzrebT4BbGQwkDqsfRm/2RliBWf38P/OtHsc6rAoaqydokjorK+i4UgCeOybXtQ+O1oHyb4wU= 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 1638979002067597.013578984565; Wed, 8 Dec 2021 07:56:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242362.419257 (Exim 4.92) (envelope-from ) id 1muzIo-0002p0-Np; Wed, 08 Dec 2021 15:56:18 +0000 Received: by outflank-mailman (output) from mailman id 242362.419257; Wed, 08 Dec 2021 15:56:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIn-0002mW-Rh; Wed, 08 Dec 2021 15:56:17 +0000 Received: by outflank-mailman (input) for mailman id 242362; Wed, 08 Dec 2021 15:56:15 +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 1muzIl-0001LM-6n for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:15 +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 5e4440f7-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:13 +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 D24A3218B5; Wed, 8 Dec 2021 15:56:12 +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 A411713C8E; Wed, 8 Dec 2021 15:56:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KEngJpzVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:12 +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: 5e4440f7-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978972; 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=dJr8Fztf5T8hrG+mezGu/5MmsW11cX9HygUkaO7iFT0=; b=MxPCuDts/lw/W3BQmkzM22HUXyY30mCR7tGlzT6OvNhK+v32RBcn/XQ5fxaD7NNgltGK68 Rs2Sr2CF6djMdkWUUZGU78oOxgPyKyOkQocT0+4Z9R77TfCFYoCEXCFvwdIz6QfTwxc2Yl LiLWg+d2Bmf3Jv4Bj3bSSU9FS13T2aw= 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 v3 11/13] xen/x86: add hypercall performance counters for hvm, correct pv Date: Wed, 8 Dec 2021 16:56:04 +0100 Message-Id: <20211208155606.20029-12-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638979003843100001 Content-Type: text/plain; charset="utf-8" The HVM hypercall handler is missing incrementing the per hypercall counters. Add that. The counters for PV are handled wrong, as they are not using perf_incra() with the number of the hypercall as index, but are incrementing the first hypercall entry (set_trap_table) for each hypercall. Fix that. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- xen/arch/x86/hvm/hypercall.c | 2 ++ xen/arch/x86/pv/hypercall.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 5952172476..37f60238d2 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -200,6 +200,8 @@ int hvm_hypercall(struct cpu_user_regs *regs) ioreq_signal_mapcache_invalidate(); } =20 + perfc_incra(hypercalls, eax); + return curr->hcall_preempted ? HVM_HCALL_preempted : HVM_HCALL_complet= ed; } =20 diff --git a/xen/arch/x86/pv/hypercall.c b/xen/arch/x86/pv/hypercall.c index ef92266620..bf64bb41bb 100644 --- a/xen/arch/x86/pv/hypercall.c +++ b/xen/arch/x86/pv/hypercall.c @@ -102,7 +102,7 @@ _pv_hypercall(struct cpu_user_regs *regs, bool compat) if ( curr->hcall_preempted ) regs->rip -=3D 2; =20 - perfc_incr(hypercalls); + perfc_incra(hypercalls, eax); } =20 enum mc_disposition pv_do_multicall_call(struct mc_state *state) --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978996; cv=none; d=zohomail.com; s=zohoarc; b=hhrge0gFmK3XoYnv/m3YNTQrAvxc5brNL9HkX0ZcvCRaKqHX8YFHZYz9uhpUgiENTavTpBy5UQg54pw7eaJ4R5hnl2NvU3M4kzRx/TT5+mFxn96bmUoOai0iCNEA+Xn9AC7/l23+m43sLQWVrwX+0vdd1IZYwIetw28DP2ybDBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978996; 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=0EFSnHVw6cnDzHQVQhnjfL6RwtaM6YAZunMTPJmxhog=; b=gBBmSKZBBuLmMtMXXG57CbYnQx1JZVcnULmOz4vn8dO44BQss25/psJTXsB5LJIM9pd+7Z2BDhpYTxQ3ArBJetsiYr7tB3lexOGE0cTK7k03m3G1hJKdWo2fZL6/FBlFpEwIgg16t/9JzmBU+xl6AaewRvymRgUtqnZJf36BqMw= 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 1638978996979632.1040408822098; Wed, 8 Dec 2021 07:56:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242365.419280 (Exim 4.92) (envelope-from ) id 1muzIs-0003hu-JJ; Wed, 08 Dec 2021 15:56:22 +0000 Received: by outflank-mailman (output) from mailman id 242365.419280; Wed, 08 Dec 2021 15:56:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIr-0003cp-TF; Wed, 08 Dec 2021 15:56:21 +0000 Received: by outflank-mailman (input) for mailman id 242365; Wed, 08 Dec 2021 15:56:16 +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 1muzIm-0001Lz-Gx for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:16 +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 5e67c314-583f-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 16:56:13 +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 1E4241FE0C; Wed, 8 Dec 2021 15:56:13 +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 D8D4C13C8E; Wed, 8 Dec 2021 15:56:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yLyrM5zVsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:12 +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: 5e67c314-583f-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978973; 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=0EFSnHVw6cnDzHQVQhnjfL6RwtaM6YAZunMTPJmxhog=; b=s0EWc156YyrnRi9jWgnsTFzBP5o3+MdaGEu9kmrwqCwH/hnjXqvY0QRWhxDNM5+QM7+GRo sypHZRtfN0oTrd4ozI89r3gwDc++ja1iUJpCisduLUj2ggN3Qyp47QxAoek42Co5DE1C9z peAvux6CsxhqlY4vz0H38Aif5P46Rx8= 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 v3 12/13] xen: drop calls_to_multicall performance counter Date: Wed, 8 Dec 2021 16:56:05 +0100 Message-Id: <20211208155606.20029-13-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638978998594100015 Content-Type: text/plain; charset="utf-8" The calls_to_multicall performance counter is basically redundant to the multicall hypercall counter. The only difference is the counting of continuation calls, which isn't really that interesting. Drop the calls_to_multicall performance counter. Suggested-by: Jan Beulich Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V2: - new patch --- xen/common/multicall.c | 1 - xen/include/xen/perfc_defn.h | 1 - 2 files changed, 2 deletions(-) diff --git a/xen/common/multicall.c b/xen/common/multicall.c index 7b20717c88..2e66f9f0c1 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -114,7 +114,6 @@ do_multicall( if ( unlikely(disp =3D=3D mc_preempt) && i < nr_calls ) goto preempted; =20 - perfc_incr(calls_to_multicall); perfc_add(calls_from_multicall, i); mcs->flags =3D 0; return rc; diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h index 08b182ccd9..eb6152859e 100644 --- a/xen/include/xen/perfc_defn.h +++ b/xen/include/xen/perfc_defn.h @@ -6,7 +6,6 @@ =20 PERFCOUNTER_ARRAY(hypercalls, "hypercalls", NR_hypercalls) =20 -PERFCOUNTER(calls_to_multicall, "calls to multicall") PERFCOUNTER(calls_from_multicall, "calls from multicall") =20 PERFCOUNTER(irqs, "#interrupts") --=20 2.26.2 From nobody Wed May 1 04:53:33 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=1638978999; cv=none; d=zohomail.com; s=zohoarc; b=oCqCiakqJVcqF38MJKgWBUuV95F96bfw3tq5rwzZQdt+dG4B+TeFrlRVKwd6/cQXXslnzSxV11trX9kuZRzqAxOqYo1KCklu0kM8WF1PNeRL/8BXpeyy6n7b6toI/GdiilKE3BLkJsh9wAhSIo4ee7K54Jk86YnuDqgiuUQ13aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638978999; 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=ZW7CF/kM5fAK9CnX8HECoM3KdS2qty2F3E2zABI0ze4=; b=jgQhJDa4M9oR0TfTyrSgwl4fLHaqM4QEonsaHnR+kILEWsRC0+MmZSRKivd2rxxboEz1Sjj013pDMgvFkp5A0h7NgQGpgVEEZXBOTwmTFw7N71/HFlotvs0j4Vms05f5EhA+Hf7FCOZBLk5PzjTvlHHAgGxhe6jk6pwO7siHUzg= 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 1638978999935738.4892366147179; Wed, 8 Dec 2021 07:56:39 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242366.419296 (Exim 4.92) (envelope-from ) id 1muzIu-00047d-Vh; Wed, 08 Dec 2021 15:56:25 +0000 Received: by outflank-mailman (output) from mailman id 242366.419296; Wed, 08 Dec 2021 15:56:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muzIt-0003y7-I7; Wed, 08 Dec 2021 15:56:23 +0000 Received: by outflank-mailman (input) for mailman id 242366; Wed, 08 Dec 2021 15:56:17 +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 1muzIn-0001LM-76 for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 15:56:17 +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 5e8c5538-583f-11ec-a831-37629979565c; Wed, 08 Dec 2021 16:56:13 +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 518E22113A; Wed, 8 Dec 2021 15:56:13 +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 23FF013C8E; Wed, 8 Dec 2021 15:56:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wNGTB53VsGHIXwAAMHmgww (envelope-from ); Wed, 08 Dec 2021 15:56:13 +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: 5e8c5538-583f-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638978973; 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=ZW7CF/kM5fAK9CnX8HECoM3KdS2qty2F3E2zABI0ze4=; b=jm+mLf5mJ6XLyj6H6NUQFb9MiFSpRUc3FjYwvvqh8Wqp5Rp6Rmsmb/vQ6ssFAOSMy5ZOG4 axriK8aY9HQlQmE06hSb9OrMTu452eZdq7xP0hc+wDkPtAfNa8wZ5eMUB6+Q0A1ewCuUeC i6dRxv9WLTAQik70wZyjbts3gPd5FmA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Jan Beulich Subject: [PATCH v3 13/13] tools/xenperf: update hypercall names Date: Wed, 8 Dec 2021 16:56:06 +0100 Message-Id: <20211208155606.20029-14-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208155606.20029-1-jgross@suse.com> References: <20211208155606.20029-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638979001241100001 Content-Type: text/plain; charset="utf-8" The hypercall names need some update. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- V2: - new patch --- tools/misc/xenperf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/misc/xenperf.c b/tools/misc/xenperf.c index a5fbdaa45f..2ad737e661 100644 --- a/tools/misc/xenperf.c +++ b/tools/misc/xenperf.c @@ -57,6 +57,11 @@ const char *hypercall_name_table[64] =3D X(sysctl), X(domctl), X(kexec_op), + X(tmem_op), + X(argo_op), + X(xenpmu_op), + X(dm_op), + X(hypfs_op), X(arch_0), X(arch_1), X(arch_2), --=20 2.26.2