From nobody Mon Nov 25 20:01:27 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=1718645993; cv=none; d=zohomail.com; s=zohoarc; b=gF4HEcjvzcRjCmZb9Q0bqf3d5LKAs/oWVoqYFgFHOPQEK7Vl7KKHV3kPNuoT081iFX+cAAXRTaLhwRNJy5a3MLmHA6nZSkSe1dtIV95neqxGx9ZflApA3XvzCvcRB8ZxCh6zuXVg7OUSqKo+XxACgf7sDmjCoL2Iy57ndy52IMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718645993; 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=7hZrd7J+i5bTlpEezybGSWjb1th3JpIpYnEjFoW/+BI=; b=XLa5a4taoQB2HAeMeaU3gJooAlJ+8DFoAz1J+H40bqagucO6IpYf04MDhsAxOUS87xFSts9XhZO9azhvsjQyvYzG+cnl7sK3+J2L3CTQHvIPThP5eF0ZU7knqWZH3dstL/B3EDI95ai2o0yN0aOEZVjmL4/mMPALt32YKTnpCeg= 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 1718645993190700.6814893571711; Mon, 17 Jun 2024 10:39:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.742541.1149391 (Exim 4.92) (envelope-from ) id 1sJGKK-000421-9A; Mon, 17 Jun 2024 17:39:32 +0000 Received: by outflank-mailman (output) from mailman id 742541.1149391; Mon, 17 Jun 2024 17:39:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sJGKK-0003zi-3w; Mon, 17 Jun 2024 17:39:32 +0000 Received: by outflank-mailman (input) for mailman id 742541; Mon, 17 Jun 2024 17:39:30 +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 1sJGKI-00036g-LB for xen-devel@lists.xenproject.org; Mon, 17 Jun 2024 17:39:30 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8b6c3158-2cd0-11ef-b4bb-af5377834399; Mon, 17 Jun 2024 19:39:27 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-52b7ffd9f6eso4553420e87.3 for ; Mon, 17 Jun 2024 10:39:27 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([160.101.139.1]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56da4496sm532010666b.8.2024.06.17.10.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 10:39:26 -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: 8b6c3158-2cd0-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1718645967; x=1719250767; 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=7hZrd7J+i5bTlpEezybGSWjb1th3JpIpYnEjFoW/+BI=; b=eqqLgikruXq+2H7oZBZ19ee9T8xWoxjR2ZAEXu6DtEhhp0r2+vODmYF3fhqluhZrqU zHaLmG5GqG/sQXd2xI9xffLyBN4CIC8erBCoaruu+yn2BCImWBjRjKrtFVWFdEM5PdlB Okt1Me80+Qbx9IBbGIt64pmq0FQ1To8XozU/o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718645967; x=1719250767; 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=7hZrd7J+i5bTlpEezybGSWjb1th3JpIpYnEjFoW/+BI=; b=Ue8JcaPB3WyX61ob3Qd01lRLEFOKiqmCBjg9s2hBVd+UQa46aJADLCBOutYUIP1sNk BarxM2SZ3QP76/gW3Zf7ryhXH7oeBE6bHyJ4AtsDk6lrCf/d37gDQ0QDdMF42onAreT6 yAvggoUb9PN5IwzBNevXq1hEHl8py3Qd/2Q7REHz30K/iJJC7dcx/+J+m5IQOK33xRdm XgADBRfHd0AqbIk+KSj4lcXu3D8kYlAEWMlL7BuQAtwrAdGZjMZnnoo+mC8eWRwuNljN VUqhHZEuSv6JB+4LbwkavEjILIZpVmKi6G4zjwzOcxeENRIs2jviBf9I9lxEggyVf9GD 2Cww== X-Gm-Message-State: AOJu0YzYbSth5amJlnPaqj4tHsj6Dis4HnXGsQtxE8p5pcNfA0oDVeGt AmSvx/sdiYFQybO+d2JItSYERS33BHirhs57d+qrI7ZArz9E39sxXPqJvI1kK15hlmzdXmBuww6 N8tw= X-Google-Smtp-Source: AGHT+IGqswVteiKgyhCwzghy5F3j/dZoVVGu9AAXTgMs18mPwS1twjrtvvS5gzvDBXXDpOpKJ67J7Q== X-Received: by 2002:a05:6512:3113:b0:52b:c089:4579 with SMTP id 2adb3069b0e04-52ca6e91501mr7271082e87.49.1718645966685; Mon, 17 Jun 2024 10:39:26 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Oleksii Kurochko Subject: [PATCH v4 3/7] x86/boot: Collect the Raw CPU Policy earlier on boot Date: Mon, 17 Jun 2024 18:39:17 +0100 Message-Id: <20240617173921.1755439-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240617173921.1755439-1-andrew.cooper3@citrix.com> References: <20240617173921.1755439-1-andrew.cooper3@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: 1718645994155100001 This is a tangle, but it's a small step in the right direction. In the following change, xstate_init() is going to start using the Raw poli= cy. calculate_raw_cpu_policy() is sufficiently separate from the other policies= to safely move like this. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Oleksii Kurochko This is necessary for the forthcoming xstate_{un,}compressed_size() to perf= orm boot-time sanity checks on state components which aren't fully enabled yet.= I decided that doing this was better than extending the xstate_{offsets,sizes= }[] logic that we're intending to retire in due course. v3: * New. v4: * Adjust commit message a little. --- xen/arch/x86/cpu-policy.c | 1 - xen/arch/x86/setup.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c index b96f4ee55cc4..5b66f002df05 100644 --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -845,7 +845,6 @@ static void __init calculate_hvm_def_policy(void) =20 void __init init_guest_cpu_policies(void) { - calculate_raw_cpu_policy(); calculate_host_policy(); =20 if ( IS_ENABLED(CONFIG_PV) ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index dd51e68dbe5b..eee20bb1753c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1888,7 +1888,9 @@ void asmlinkage __init noreturn __start_xen(unsigned = long mbi_p) =20 tsx_init(); /* Needs microcode. May change HLE/RTM feature bits. */ =20 - identify_cpu(&boot_cpu_data); + calculate_raw_cpu_policy(); /* Needs microcode. No other dependenices= . */ + + identify_cpu(&boot_cpu_data); /* Needs microcode and raw policy. */ =20 set_in_cr4(X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT); =20 --=20 2.39.2