From nobody Mon Dec 2 14:57:13 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=1730194994; cv=none; d=zohomail.com; s=zohoarc; b=TeqJqTLpbfIx00PjA6mDoXi6+jhoZkBVjTvvZNo7zr91jgZ3cYCD1CoUXE56eZxirDWmFuhlMcx7XeLbc2d0w+AeQqq0DaJwVdK5ZRrQcTOxQBIAEKnrnvpN7FOW3kCl0ihJ3ZiK3UvcUowRhxfgin9ZS6Kv7r0fytCrhUxSCYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730194994; 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=xL/UlbFPjBRTTlLpTkNVMDwoMWbBYpkFEHzclxK8YBo=; b=gtdm9Q4L8hVJ5QwO454gwQF+fdZT+RShRybnC1hf79fVkFIk9Zulv95Cv3k1JcWnTA3YitM5+wQVJBAHp/k9oaNxT2us8QefOtD9vxdTqqsOQQSbhm+/0oLsQcb+OuubG/9VO2OblzZ+6xBziNPfxs7tkKRIleTbFoI9qwbqUF8= 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 1730194994472540.9746038682208; Tue, 29 Oct 2024 02:43:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827167.1241689 (Exim 4.92) (envelope-from ) id 1t5ike-00059W-9f; Tue, 29 Oct 2024 09:43:00 +0000 Received: by outflank-mailman (output) from mailman id 827167.1241689; Tue, 29 Oct 2024 09:43:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5ike-00059N-6n; Tue, 29 Oct 2024 09:43:00 +0000 Received: by outflank-mailman (input) for mailman id 827167; Tue, 29 Oct 2024 09:42:58 +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 1t5ikc-00058l-Q5 for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 09:42:58 +0000 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [2a00:1450:4864:20::52e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2dc917b1-95da-11ef-a0c3-8be0dac302b0; Tue, 29 Oct 2024 10:42:57 +0100 (CET) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5cb6704ff6bso6850564a12.3 for ; Tue, 29 Oct 2024 02:42:57 -0700 (PDT) Received: from localhost ([213.195.115.182]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f029511sm459385966b.62.2024.10.29.02.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 02:42:56 -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: 2dc917b1-95da-11ef-a0c3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730194977; x=1730799777; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xL/UlbFPjBRTTlLpTkNVMDwoMWbBYpkFEHzclxK8YBo=; b=N1i5qdcYa8cQIiA2kbq6PS7JbFiGyXvk9Ro6KLA+LIMNFzNHLuloOHBkdhYs3//sxu EsF+SruVmiSl/+C29LSjctyXvs+P+0nbB+KIjS8PGdVXwjDiQ1Trlt/twBKLiM+i+kDo gD1bN84mHC1OcdHUGM4O8yN/pZm2X9H8Rhous= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730194977; x=1730799777; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xL/UlbFPjBRTTlLpTkNVMDwoMWbBYpkFEHzclxK8YBo=; b=t2Dl7wqn//4D7kYsPCcWdt1tu2iPC/02Jlyc9ivFasFzyfqXOrXfrcHj3RvZlU/N8l ttlg6lpQ6iBwP/4zUkuyf/UZowrOBVX5K4yqctG2Rz0XTCo2fnHc3p9jel2ZdN74xcoM 1KeEkL45kPB5yOxxR7VBlKH0aS7QmwSBWO87fobZZ7U8T4S0u0VCQSDXtVzcn5nBkkps lrs1b4Wsh6UyGeI5XcuDbsh3hAd7uY8Abs2IQZQLihXhfKbth4PTVkuMOBBHcuhK+QIb 3lxWJfaF3x4VPaeXCxoiRK+F7zLYwIB3RRXA2j7ZnD6G1fL0VbcvQPmiuYVUtf9iYYEN Xeaw== X-Gm-Message-State: AOJu0Yz/dSJfotWCaNXM6qUJ5e/sC3LKrzhjRglHll7ODRkRO5kBi7q/ eyyC5D0hm330gY4/FZLiJlTcJRZDaG39/EkVSh2aK9IndHRAzIWoQgZ676n65afgvlt8xboUvrN c X-Google-Smtp-Source: AGHT+IEio22AWrj+X2xaIVMPhThhLcl8UOyFNAbZ9with0OcbvQ4Zp4Z0qm0FHHD59gtSLKsE449AA== X-Received: by 2002:a17:907:9487:b0:a99:c0be:a8ac with SMTP id a640c23a62f3a-a9de5ee477dmr1113535966b.37.1730194976764; Tue, 29 Oct 2024 02:42:56 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH] x86/pv: gate setting per-domain slot to XPTI being active for the domain Date: Tue, 29 Oct 2024 10:42:54 +0100 Message-ID: <20241029094254.38659-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.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: 1730194995915116600 It's possible to have XPTI not active for all PV domains (active for domUs, inactive for dom0), hence don't gate setting the per-domain slot on the presence of the per-pCPU shadow root page-table. Instead set the slot base= d on whether XPTI is active for the domain. This avoid pointlessly setting the per-domain slot if the shadow root page-table won't be used by the domain. Fixes: 0d3e7f0b6bf0 ('xen/x86: support per-domain flag for xpti') Signed-off-by: Roger Pau Monn=C3=A9 --- xen/arch/x86/domain.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 78a13e6812c9..fd6bb3663027 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1902,12 +1902,11 @@ void cf_check paravirt_ctxt_switch_from(struct vcpu= *v) =20 void cf_check paravirt_ctxt_switch_to(struct vcpu *v) { - root_pgentry_t *root_pgt =3D this_cpu(root_pgt); + const struct domain *d =3D v->domain; =20 - if ( root_pgt ) - root_pgt[root_table_offset(PERDOMAIN_VIRT_START)] =3D - l4e_from_page(v->domain->arch.perdomain_l3_pg, - __PAGE_HYPERVISOR_RW); + if ( d->arch.pv.xpti ) + this_cpu(root_pgt)[root_table_offset(PERDOMAIN_VIRT_START)] =3D + l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR_RW); =20 if ( unlikely(v->arch.dr7 & DR7_ACTIVE_MASK) ) activate_debugregs(v); --=20 2.46.0