From nobody Thu Sep 19 01:15:08 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=1722007931; cv=none; d=zohomail.com; s=zohoarc; b=VjXCWdHFLj8lWXrZRowUN+E5UxhZRTK+nOndoEtRbnNGDVtdtL9cDaMvXlgu899J8JJAG4LDe4cFOvczHCROaZyoBxVB1UOsT0DVoSmRvRKtf2NVxYdqTegOLkzPGH+2TphcF/bUJycpOk2lrfgLkvM7wx9tgPHlpQnkmgh+RIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722007931; 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=oS3y4Ocny/CCyKe8xJHGMa6gk6B7qtxm6NZOH5KyGFA=; b=G/W2/D5fRNA7oUMc76ewfecKs4Gy25VzFqJgqNYDY0CeSNhPG6qY7KenrkQW9Q3ED0RKV5pHSX1yaDMkOXY+q17KyxdDtMCkcydX5dMPn3YyvweYIXYjqKtucVPPDJ6NZrMbLmW1XY6ZWBpHqklCeBWlalhx2ZaN0H80iZGmpPI= 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 1722007931476168.91948144088246; Fri, 26 Jul 2024 08:32:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.765519.1176197 (Exim 4.92) (envelope-from ) id 1sXMv9-0002PZ-3G; Fri, 26 Jul 2024 15:31:51 +0000 Received: by outflank-mailman (output) from mailman id 765519.1176197; Fri, 26 Jul 2024 15:31:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sXMv8-0002Nc-Sa; Fri, 26 Jul 2024 15:31:50 +0000 Received: by outflank-mailman (input) for mailman id 765519; Fri, 26 Jul 2024 15:31:49 +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 1sXMv7-00084T-IB for xen-devel@lists.xenproject.org; Fri, 26 Jul 2024 15:31:49 +0000 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [2607:f8b0:4864:20::32c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2b975213-4b64-11ef-8776-851b0ebba9a2; Fri, 26 Jul 2024 17:31:47 +0200 (CEST) Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-7093abb12edso645859a34.3 for ; Fri, 26 Jul 2024 08:31:47 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb3faf858csm17506806d6.128.2024.07.26.08.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 08:31:45 -0700 (PDT) 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: 2b975213-4b64-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1722007906; x=1722612706; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oS3y4Ocny/CCyKe8xJHGMa6gk6B7qtxm6NZOH5KyGFA=; b=FweycZPOEeJWazdD7sZvnpe5b2hxzBOz9JV55v4lpo3KnNJVIr3kBlJCJv2aLTIKEF R9p5fiQTIcUBP4c9kSxkrMo2b8QfMb6+PIaHIhEggeisOvYXXGCaqd5uKfd8Et546XB2 /2hEWHETZgVex5ho7aD42df2Ri2FdNzw9K+jA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722007906; x=1722612706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oS3y4Ocny/CCyKe8xJHGMa6gk6B7qtxm6NZOH5KyGFA=; b=s2hVURYr8jyDsHUTXuL53bUEdfyb7DzqD733k2oEawwrnOg6WJooD2DxOhQx0TziGA wtVu82uomwsletNTd9QGSCWo1Pv5zlY+bOhRpvuvaCHTDeTzrVf66QTxvxWHmhzRelHD BZRxGPMY4sjt786ODRyUctXJnklHL9EK2QTvh2rwkQpEWO4Xu+DDxB4fSJE143m68xB6 M2VAT4UALiRUrrBUFJyBgdp7LKyYvNptZk6SQYrQ6q/ibBL09fwpJK7qeifngGmLlpM4 TXFvA4f7I4kV3jHRF5PbQP0FxWm6JR2lrdHnF5nfNdjQfLHkW6I3Gq40GMAHxeb4YZuD NyDg== X-Gm-Message-State: AOJu0YwzxYsEATVJWUA/aZh98A2CoNHtzm3ToUL/9gPwM/7xfq4X5KdP ho2Fu2DK4jf7WN0NXjSGmz84RjdolHFlhBwCtzeA0KqM7MymcsESaTbIY+cwJguUqdoZrIBbuAs 0 X-Google-Smtp-Source: AGHT+IEI/SmxM1OVVQwG596ftYXa8ugL3WbsTaRvUruPRnqPk3jpUVflDTDvv9TDG0yYGgBR1OTsCQ== X-Received: by 2002:a05:6830:668b:b0:703:5c2d:56a7 with SMTP id 46e09a7af769-7093248b4b5mr6952622a34.24.1722007906135; Fri, 26 Jul 2024 08:31:46 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: alejandro.vallejo@cloud.com, Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 09/22] x86/pv: untie issuing FLUSH_ROOT_PGTBL from XPTI Date: Fri, 26 Jul 2024 17:21:53 +0200 Message-ID: <20240726152206.28411-10-roger.pau@citrix.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240726152206.28411-1-roger.pau@citrix.com> References: <20240726152206.28411-1-roger.pau@citrix.com> 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: 1722007933613116600 The current logic gates issuing flush TLB requests with the FLUSH_ROOT_PGTBL flag to XPTI being enabled. In preparation for FLUSH_ROOT_PGTBL also being needed when not using XPTI, untie it from the xpti domain boolean and instead introduce a new flush_roo= t_pt field. No functional change intended, as flush_root_pt =3D=3D xpti. Signed-off-by: Roger Pau Monn=C3=A9 --- xen/arch/x86/include/asm/domain.h | 2 ++ xen/arch/x86/include/asm/flushtlb.h | 2 +- xen/arch/x86/mm.c | 2 +- xen/arch/x86/pv/domain.c | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/d= omain.h index f5daeb182baa..9dd2e047f4de 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -283,6 +283,8 @@ struct pv_domain bool pcid; /* Mitigate L1TF with shadow/crashing? */ bool check_l1tf; + /* Issue FLUSH_ROOT_PGTBL for root page-table changes. */ + bool flush_root_pt; =20 /* map_domain_page() mapping cache. */ struct mapcache_domain mapcache; diff --git a/xen/arch/x86/include/asm/flushtlb.h b/xen/arch/x86/include/asm= /flushtlb.h index bb0ad58db49b..1b98d03decdc 100644 --- a/xen/arch/x86/include/asm/flushtlb.h +++ b/xen/arch/x86/include/asm/flushtlb.h @@ -177,7 +177,7 @@ void flush_area_mask(const cpumask_t *mask, const void = *va, =20 #define flush_root_pgtbl_domain(d) \ { \ - if ( is_pv_domain(d) && (d)->arch.pv.xpti ) \ + if ( is_pv_domain(d) && (d)->arch.pv.flush_root_pt ) \ flush_mask((d)->dirty_cpumask, FLUSH_ROOT_PGTBL); \ } =20 diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index c01b6712143e..a1ac7bdc5b44 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4167,7 +4167,7 @@ long do_mmu_update( cmd =3D=3D MMU_PT_UPDATE_PRESERVE_AD= , v); if ( !rc ) flush_linear_pt =3D true; - if ( !rc && pt_owner->arch.pv.xpti ) + if ( !rc && pt_owner->arch.pv.flush_root_pt ) { bool local_in_use =3D false; =20 diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index 6ff71f14a2f2..46ee10a8a4c2 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -384,6 +384,8 @@ int pv_domain_initialise(struct domain *d) =20 d->arch.ctxt_switch =3D &pv_csw; =20 + d->arch.pv.flush_root_pt =3D d->arch.pv.xpti; + if ( !is_pv_32bit_domain(d) && use_invpcid && cpu_has_pcid ) switch ( ACCESS_ONCE(opt_pcid) ) { --=20 2.45.2