From nobody Fri Oct 31 09:15:32 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=1748594919; cv=none; d=zohomail.com; s=zohoarc; b=c0a7KIS7/is4Hqyt4tvWDnkKzC0ZefMYEM9D1rZ60rUtbtiMyLnFJD+wuOaGYz6csuXbw4GvMXzRmtlTzk8OnI3/CPStBLK5PXpsOuffFzk4/wjuCKe84chqUwWlrEz0TDHkD1f5VJei43CeefdZV0RcmJ29F6U2b19o0a+Iehs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748594919; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CINTqxmjCzUBSSvhqj+l0XHTYM1/Zj7I0ZRwoJo+6LY=; b=RtjBL2hYnxNe/0NQraFvW7AasjzDmH42lRpSwACU2l8vZPNsbvrcnBj78SLNqX22PRPnnhu0UiZaBkQhOrQVEsVM8VLubfTvzBHpI+5e9k/7KG7ai/VupHdSU0I6Pv3+6FkOeG6dqZNzT6+m2FAIrPLMQSN2mQPrMtK1m12BZYw= 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 1748594919516576.3525949728942; Fri, 30 May 2025 01:48:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1000578.1380807 (Exim 4.92) (envelope-from ) id 1uKvPb-0004aS-U2; Fri, 30 May 2025 08:48:23 +0000 Received: by outflank-mailman (output) from mailman id 1000578.1380807; Fri, 30 May 2025 08:48:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uKvPb-0004aL-PR; Fri, 30 May 2025 08:48:23 +0000 Received: by outflank-mailman (input) for mailman id 1000578; Fri, 30 May 2025 08:48:22 +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 1uKvPa-0004aF-4o for xen-devel@lists.xenproject.org; Fri, 30 May 2025 08:48:22 +0000 Received: from mail145-2.atl61.mandrillapp.com (mail145-2.atl61.mandrillapp.com [198.2.145.2]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d622315a-3d32-11f0-a2ff-13f23c93f187; Fri, 30 May 2025 10:48:20 +0200 (CEST) Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail145-2.atl61.mandrillapp.com (Mailchimp) with ESMTP id 4b7xhz12sHzQXk4xN for ; Fri, 30 May 2025 08:48:19 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 2d2857a00af54ff682a29e4086620663; Fri, 30 May 2025 08:48:19 +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: d622315a-3d32-11f0-a2ff-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1748594899; x=1748864899; bh=CINTqxmjCzUBSSvhqj+l0XHTYM1/Zj7I0ZRwoJo+6LY=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=TDXQJ2YhTyJEFWE0HIvs44Zts+3qw96zYysE7rf+Bmw0WdgyBaV/d8DX97qJUB5j2 YyIQ+igkTjYRo7o5hiFAT1r4zh2NvZYyXr9FJNZ7OOlLugzm0tqBB8tM6MMU/qZ+s4 BOfX8L6bv7lsn99QcnLPhqGa7zQ/91SAGCWJFMgz0cSXK9V22rgx18CmwoE+xsGM+Y k8GBQVJ9ZwlepFvsZVcd02t9n1ZwFUkcYoN46dcPeiqQGhgIGQjJ+pmB6+MGTyschD tRZJeNaxaOkQZJPQ12l3rkb3dTVIUU0WqciRYdZAHNPaMEYkSFk6d8cGjG9Mp5jmxo 3jnpptnN+R3sA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1748594899; x=1748855399; i=teddy.astie@vates.tech; bh=CINTqxmjCzUBSSvhqj+l0XHTYM1/Zj7I0ZRwoJo+6LY=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=d752I994NA1n97Q5ztHwhVlFnBm4PCqoS9bVzT7jYrdClGhZJA3st/SGcg498VySW rg8zOUdNR1q+ME8b26lZ85lugdhRmvIqmRto12cfOrqXhl+voY/8B0H5nmQ+GVUbTz 5AbnNoJPFk34HcoZ+1dqgYdHnqXe1X4gJKCVAMCtKEDtWWTMBvmWc+TIBSCYJWtCEr ukwBvAAso2Eg1I5l9N1CtceUoivvahTnRlqv/T3CjsZAAk+g8tx4e5Dmlr17NE3Zuh /DLwYo1qEthe8QTN0Zvtfde+VcUjlTyKqkP+xa1I/pZ8dJr+fKpO+R4bKWEo+Wzif9 ghtFKoRPfwh1g== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH]=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: 1748594898078 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <83d0e7dfc076e9453fb6537e5948c03d90e947da.1748594036.git.teddy.astie@vates.tech> 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.2d2857a00af54ff682a29e4086620663?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20250530:md Date: Fri, 30 May 2025 08:48:19 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity teddy.astie@vates.tech) (identity @mandrillapp.com) X-ZM-MESSAGEID: 1748594921106116600 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-contex= ts invlidations. Signed-off-by: Teddy Astie --- Extracted from SEV series. This will be used for instance in fixed-ASID patches (in SEV series). --- xen/arch/x86/include/asm/hvm/vmx/vmx.h | 17 +++++++++++++++++ 1 file changed, 17 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..1269c318dc 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h @@ -451,6 +451,23 @@ 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; + + type =3D INVVPID_ALL_CONTEXT; + +execute_invvpid: + __invvpid(type, v->arch.hvm.n1asid.asid, 0); +} + 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