From nobody Fri Mar 29 11:42:28 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=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1642099734; cv=none; d=zohomail.com; s=zohoarc; b=m+L1ZXMSc1hG6LVzZcz9JSXojSiBeDiA7VLjWj0sf6IRuXPFH2hQ2PIlAH655AOt0Gf6J/Dr8F7XZdYsvlvy8jSkQWfBX3ujimxbUkvirpG7sRKRxAvO6zoCivYL1W4w7IOl3NRr60iO5kNkGtgub1CndATfhFLWwgm/bTl3KWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642099734; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=VXrDJJYFq3kYJZOsZL7KWHMAV9xKMeyaeO0hXvB77tU=; b=FqICyy22xZB6wfsLL2jpoeeljzeXnIeFtoeACTooAL5beyDOPiv9uc9H2LVqrF5Rfz6UiitJTg7fsbTQB++CEsQ3LInNuaqAzcDCDnBaZtLVlZtVRyUDF+Zh7nyAPVv9nrgI/e7uIXioGYZkIJ21ChxojONQEBlJSwgLOCAIRG8= 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=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1642099734557176.28494792036497; Thu, 13 Jan 2022 10:48:54 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.257341.442170 (Exim 4.92) (envelope-from ) id 1n858z-0001dw-36; Thu, 13 Jan 2022 18:48:17 +0000 Received: by outflank-mailman (output) from mailman id 257341.442170; Thu, 13 Jan 2022 18:48: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 1n858y-0001dp-VZ; Thu, 13 Jan 2022 18:48:16 +0000 Received: by outflank-mailman (input) for mailman id 257341; Thu, 13 Jan 2022 18:48: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 1n858x-0001dj-8A for xen-devel@lists.xenproject.org; Thu, 13 Jan 2022 18:48:15 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5b78cc33-74a1-11ec-a563-1748fde96b53; Thu, 13 Jan 2022 19:48:13 +0100 (CET) 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: 5b78cc33-74a1-11ec-a563-1748fde96b53 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1642099693; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Gk1R1KBs8dczG/7CrCNbCq9t4i0qahB2y9rb298DHFk=; b=JnHoRCdDevzUxdCbLl1YHT7r3soF/cyQYuJ09w7K133nTTcCVls07cE1 G3pktFMOAiPBTXlC43Hs1SDRVrp6NCOjiqbmoxmhPNDT7c8zeKyHIF7mo ePEeYfkGBJ7aIgf9rBhWHGfi1s0yPzNmuPuBPQmINPMX05Xa5D86ufiZU I=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: fP/dlcoMLXVLUaBa7C+AHwamvSYjZybBit8b0KRP73K9WKiCVBW74zKEROduYCBQULzz32UScY UDLeEIGzYrL62zBvsudDXSLpJRPKbgdlyKdztPdeS/J1gH/z+Qd9uGis+hOlTy/QhLDZgj0K1E gG1DbXZVAJ6euEd01fGwwObqB6ENlC7m7L+2Tl6+nJ1I05TrQxZKqZU/xKvWpE0XwlqMEiQQDe YR0wLeN4Sn8PxjCI2yN7uikRg3gPl//55kxKBDC7ohA4Hz1XLsjaii+Ll8vLT65gsD/Zf605+5 Aysu5Tv5R2GV5zxNbhfIUTkE X-SBRS: 5.2 X-MesageID: 61949781 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:eOMPqa3vSmrbG7nAaPbD5UJ2kn2cJEfYwER7XKvMYLTBsI5bp2BRn 2BNCmmFOqqCM2D2f40nbIq1phgO68XTyNFiQAU6pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCanAZqTNMEn9700o6wrVh2OaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhg/5Jw utAjt+LWSAIZZXBhOEFA0dGHHQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1Er8IvNsT0eqgYvWlt12rxBvc6W5HTBa7N4Le02R9u35ESTKmOP qL1bxJpbyXLZBxmFW5IDZZk27froXyleQNx/Qf9Sa0fvDGIkV0ZPKLWGMbcf9WRbdlWmkueq XP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kR3c CSfg7DPhugEy0fPG5bp+aMhAQaJaUwyhS13 IronPort-HdrOrdr: A9a23:IHQaNKvuMqX8Ir1hsNITF8z87skDeNV00zEX/kB9WHVpmszxra GTdZMgpHnJYVcqKRYdcL+7Scq9qB/nmqKdgrNhWYtKPjOW2ldARbsKheCJrlHd8kXFh5dgPM xbE5SWZuefMbEDt7ee3DWF X-IronPort-AV: E=Sophos;i="5.88,286,1635220800"; d="scan'208";a="61949781" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Tamas K Lengyel , Jun Nakajima , Kevin Tian Subject: [PATCH] x86/hvm: Drop .is_singlestep_supported() callback Date: Thu, 13 Jan 2022 18:48:00 +0000 Message-ID: <20220113184800.29456-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1642099735643100001 There is absolutely no need for a function pointer call here. Drop the hook, introduce a singlestep_supported boolean, and configure it in start_vmx() like all other optional functionality. No functional change, but rather more efficient logic. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Tamas K Lengyel --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Tamas K Lengyel CC: Jun Nakajima CC: Kevin Tian Based on Jan's "altcall all hvm ops" patch, but not logically related. This had escaped my previous attempts to drop inappropriate function pointer use. The hvm_funcs data fields are a mess. All the booleans and 'hvm_capabiliti= es' want merging into a single bitfield, so we're not wasting 8 bytes of space = to hold 6 bits of information. --- xen/arch/x86/hvm/vmx/vmx.c | 8 ++------ xen/arch/x86/include/asm/hvm/hvm.h | 7 +++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index a7a0d662342a..1c46669762b0 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2120,11 +2120,6 @@ static void vmx_enable_msr_interception(struct domai= n *d, uint32_t msr) vmx_set_msr_intercept(v, msr, VMX_MSR_W); } =20 -static bool_t vmx_is_singlestep_supported(void) -{ - return !!cpu_has_monitor_trap_flag; -} - static void vmx_vcpu_update_eptp(struct vcpu *v) { struct domain *d =3D v->domain; @@ -2454,7 +2449,6 @@ static struct hvm_function_table __initdata vmx_funct= ion_table =3D { .nhvm_domain_relinquish_resources =3D nvmx_domain_relinquish_resources, .nhvm_hap_walk_L1_p2m =3D nvmx_hap_walk_L1_p2m, .enable_msr_interception =3D vmx_enable_msr_interception, - .is_singlestep_supported =3D vmx_is_singlestep_supported, .altp2m_vcpu_update_p2m =3D vmx_vcpu_update_eptp, .altp2m_vcpu_update_vmfunc_ve =3D vmx_vcpu_update_vmfunc_ve, .altp2m_vcpu_emulate_ve =3D vmx_vcpu_emulate_ve, @@ -2661,6 +2655,8 @@ const struct hvm_function_table * __init start_vmx(vo= id) return NULL; } =20 + vmx_function_table.singlestep_supported =3D cpu_has_monitor_trap_flag; + if ( cpu_has_vmx_dt_exiting ) vmx_function_table.set_descriptor_access_exiting =3D vmx_set_descriptor_access_exiting; diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/= hvm/hvm.h index b26302d9e769..9338cf25a657 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -97,6 +97,7 @@ struct hvm_function_table { =20 /* Necessary hardware support for alternate p2m's? */ bool altp2m_supported; + bool singlestep_supported; =20 /* Hardware virtual interrupt delivery enable? */ bool virtual_intr_delivery_enabled; @@ -208,7 +209,6 @@ struct hvm_function_table { uint8_t *p2m_acc, struct npfec npfec); =20 void (*enable_msr_interception)(struct domain *d, uint32_t msr); - bool_t (*is_singlestep_supported)(void); =20 /* Alternate p2m */ void (*altp2m_vcpu_update_p2m)(struct vcpu *v); @@ -644,10 +644,9 @@ static inline void hvm_enable_msr_interception(struct = domain *d, uint32_t msr) alternative_vcall(hvm_funcs.enable_msr_interception, d, msr); } =20 -static inline bool_t hvm_is_singlestep_supported(void) +static inline bool hvm_is_singlestep_supported(void) { - return (hvm_funcs.is_singlestep_supported && - alternative_call(hvm_funcs.is_singlestep_supported)); + return hvm_funcs.singlestep_supported; } =20 static inline bool hvm_hap_supported(void) --=20 2.11.0