From nobody Tue Dec 16 11:46:17 2025 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 header.i=teddy.astie@vates.tech; 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=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1747387932; cv=none; d=zohomail.com; s=zohoarc; b=exzMhdQjIG6NQ5+Pw8AYOYAAM9yU/H0o5MHi/TnhaG7YV4mKUUqOFDGCpXlXkZk6EfAmHZDN234Yhj5IYoZGPJPANrWrwL1pNS4+l9cFuUXY46/BRgHDcGFA5b8fjt5/0jsjBgc+z6c+/EH+30BvAhjLtFlFAPmWv1FIrStxmNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747387932; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iMtHB+smiJdOQ9laMMAKQ5QBEFSycIXeep/kGpJ45n8=; b=M9oKhmzcqVZB0xq4xHRLxtYrvWZ+HM3d/+RFuRDNjlC3AGk1actqqs4l7heQ51KeOd2SL4t4FBvtS2/tL9GqKunfH4/v/hubQqObPMCPxfIxkjm9NqjEpDR9vWDJOAJ5vPqu2/Y4l8GG7S2VdHMXvMHuJj5PTmoMVlShav2his8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; 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 17473879328224.31163705523727; Fri, 16 May 2025 02:32:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.986621.1372181 (Exim 4.92) (envelope-from ) id 1uFrPx-00008Q-Rd; Fri, 16 May 2025 09:31:49 +0000 Received: by outflank-mailman (output) from mailman id 986621.1372181; Fri, 16 May 2025 09:31:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uFrPx-00007Y-JH; Fri, 16 May 2025 09:31:49 +0000 Received: by outflank-mailman (input) for mailman id 986621; Fri, 16 May 2025 09:31:48 +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 1uFrPw-0007iv-Ca for xen-devel@lists.xenproject.org; Fri, 16 May 2025 09:31:48 +0000 Received: from mail133-28.atl131.mandrillapp.com (mail133-28.atl131.mandrillapp.com [198.2.133.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 962df48f-3238-11f0-9eb6-5ba50f476ded; Fri, 16 May 2025 11:31:46 +0200 (CEST) Received: from pmta13.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail133-28.atl131.mandrillapp.com (Mailchimp) with ESMTP id 4ZzMKQ4409zMQxdhF for ; Fri, 16 May 2025 09:31:38 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id f0ae509aaf1c4bf3846e2e2ff59eca25; Fri, 16 May 2025 09:31:38 +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: 962df48f-3238-11f0-9eb6-5ba50f476ded DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1747387898; x=1747657898; bh=iMtHB+smiJdOQ9laMMAKQ5QBEFSycIXeep/kGpJ45n8=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=uoRmOpPM/u6zliOBEwflrIMPb6kr6kvAPf6jiQBWy6u4KRRuEWFnUqK3wy4JL+HuR WMbr3/iBZDaJ6sApqvWfI3T+GcFWB5DRWsiv19IzRHmpBqFiF+V+PlF+cfEMSvShZa Ty1CfuIK2W1ePpdNVVbXEp+a5qmzUxZmNFUerRvQPI71NjHcDZL49rbou8l7k16w3I N/faXzuTwSE6JgEqGWLphz0hLry6sAg6nOQJm8onJIX60wJJg/2jELwBif4j0mjZ0f C6GPd7siFqMI+CArNR2IegMp6bmyWvAem6V5mcbXg4kIqecoKI1WzoNQ3ePPwTMUsH C6hSBrAWW0+Ig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1747387898; x=1747648398; i=teddy.astie@vates.tech; bh=iMtHB+smiJdOQ9laMMAKQ5QBEFSycIXeep/kGpJ45n8=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=BE8kb2VeB4bxMGNM7bH0/vjoAH5LhtRH1WJuogcWVAjSVVMgaKl8AuWi2JAs/2rkw Rtoy7yDvPbLwduHgfecCp3UsLHrV0P2bXbN1bJ/DSyf255UHEGzwtLaoAfSzExrRIV fyYSZoUN5y28egsMZwOKAGtcc84qw7IK8FhA47mJHARefJUEc9HX+DA5tIReYkPD0M TQIoTad1XhRpzDU/Z4YrJQv4vNVItlDGkACeAfUiZysctBJbMDto8taGO3E5YUUzlB KCYw8Lqr+JxL/Mye7xXfl8sAykMpVmEWQQrYwmcVBa99Lt7ERkLQe1q0HNTVzKD2PS Wb6K9oZLpwK1g== From: "Teddy Astie" Subject: =?utf-8?Q?[RFC=20PATCH=2006/16]=20vmx:=20Introduce=20vcpu=20single=20context=20VPID=20invalidation?= X-Mailer: git-send-email 2.49.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1747387897605 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <85727bf1e1df2feeba2af34aa3c7c951982121d6.1747312394.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f0ae509aaf1c4bf3846e2e2ff59eca25?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20250516:md Date: Fri, 16 May 2025 09:31:38 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @mandrillapp.com) (identity teddy.astie@vates.tech) X-ZM-MESSAGEID: 1747387934790116600 Content-Type: text/plain; charset="utf-8" Introduce vpid_sync_vcpu_context to do a single-context invalidation on the vpid attached to the vcpu as a alternative to per-gva and all-context invlidations. Signed-off-by: Teddy Astie --- This will be used on Intel platforms for the ASID management rework. --- xen/arch/x86/include/asm/hvm/vmx/vmx.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/= asm/hvm/vmx/vmx.h index d85b52b9d5..a55a31b42d 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h @@ -451,6 +451,27 @@ static inline void ept_sync_all(void) =20 void ept_sync_domain(struct p2m_domain *p2m); =20 +static inline void vpid_sync_vcpu_context(struct vcpu *v) +{ + int type =3D INVVPID_SINGLE_CONTEXT; + + /* + * If single context invalidation is not supported, we escalate to + * use all context invalidation. + */ + if ( likely(cpu_has_vmx_vpid_invvpid_single_context) ) + goto execute_invvpid; + + /* + * If single context invalidation is not supported, we escalate to + * use all context invalidation. + */ + type =3D INVVPID_ALL_CONTEXT; + +execute_invvpid: + __invvpid(type, v->arch.hvm.n1asid.asid, (u64)gva); +} + static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva) { int type =3D INVVPID_INDIVIDUAL_ADDR; --=20 2.49.0 Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech