From nobody Fri Nov 22 18:38: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=1716463033; cv=none; d=zohomail.com; s=zohoarc; b=Cy2tyM4kzdoWEb5nQCOSaky2XjYamTlNLHTllGf9dsNlMgM7OER58oCMfvvT5i0zzvSfct/+YuIdYSL/vjSEGfgnD3nVO+ACYddiJopcTZZ4bwBiFGXVTk8/CJ/TXJ/uwTHK1xA1y506B0AWzqzYKbrRdcXG/XyTBhQ+hqX+5RE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716463033; 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=3brSZl6/vV2dpGWkfgvqrJmcT56Fa2D0F6BOtDAqDOI=; b=SqQg5xasaK1pKoY4HDvRNkTHoLsMmozh3WRCtpJIokygxeJ+yI9x2jBC8zpfqDtbSOWwnnBvULj19imwNcEcXl8suKi6ueHT5OSGz9I4xg8nIgqkHf9SJ2Je7wsxSXnaB6BL6oPAEBxtWX+gbDPaK7OWq8FfcjwkxxOjBOubn90= 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 1716463033851704.4928701149844; Thu, 23 May 2024 04:17:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.728367.1133286 (Exim 4.92) (envelope-from ) id 1sA6RI-0006rX-2v; Thu, 23 May 2024 11:16:52 +0000 Received: by outflank-mailman (output) from mailman id 728367.1133286; Thu, 23 May 2024 11:16:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sA6RH-0006rE-Vg; Thu, 23 May 2024 11:16:51 +0000 Received: by outflank-mailman (input) for mailman id 728367; Thu, 23 May 2024 11:16:50 +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 1sA6RG-0006Hv-CY for xen-devel@lists.xenproject.org; Thu, 23 May 2024 11:16:50 +0000 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [2607:f8b0:4864:20::233]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f22261f1-18f5-11ef-b4bb-af5377834399; Thu, 23 May 2024 13:16:48 +0200 (CEST) Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-3cabac56b38so1546647b6e.3 for ; Thu, 23 May 2024 04:16:48 -0700 (PDT) Received: from andrew-laptop.citrite.net ([217.156.233.157]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6a15f179cebsm142194236d6.3.2024.05.23.04.16.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 04:16:42 -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: f22261f1-18f5-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1716463006; x=1717067806; 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=3brSZl6/vV2dpGWkfgvqrJmcT56Fa2D0F6BOtDAqDOI=; b=LcahzV4fVqrQv+UWToDs4J/GQMy9S0YbbRRlhQpGlgUV/HhnnTGOMlN1Whrjju8QTW IgkiTIFaQpJBaA+1eFackREzUbuC162gDsO2ImJL0GEBGOlDVB/4/ok6oE5mrgJ5FOwh aSwq0Ed6u7iS/EFZ6r5dWe2BxDdhoBn6VNLzI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716463006; x=1717067806; 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=3brSZl6/vV2dpGWkfgvqrJmcT56Fa2D0F6BOtDAqDOI=; b=qYl9f9ft+clGR9+yRS9Sme1azyS731LsXSsTKkP9iTU9bXyq6YO+X5vqveVUH1Za/6 CqoyrScm6NLdo7sdTvAvkE2d6u36E42EhoX0qq92SC/NC5enAvqcKp6uujnZqFhei/lq gq6LWyauE2ZH3kkYyY6iDEOZPyBmwzrQmItu2OYkp4K5RCekfog/oF1bPwBA/b+nQZNa iIRefhgLS2ZxoMvacQuSBNymg95WD2mxJJ+ONIFuwo5bWgXy7mPruEXQVKgh9+waC9kV LGqQ2kV7xkWgOjc5xzMQxQTiymiMK1jR4HSxmExcnAHDeRFU5ocZc4F68twgVC3F+wVS NC2A== X-Gm-Message-State: AOJu0YxBnyQAmXYJ9z+dk3ozENG/tbBsHZYtNM9rNm8X8CHjz0xQvWuQ /5BdvNdiUC205LFaCWxKxUuWhc0BuEU4Cbqobq9PmUXqMbWyDqj36mQtYV+/8s98ASX0uwbI3Vs +QSo= X-Google-Smtp-Source: AGHT+IFpvJcWqnaHvo7hcFKKjX515sNn6S5bC6QmZNxfnQRU35FyPFQYvA+CWP5bK1L4FB1RMRQaEg== X-Received: by 2002:a54:4715:0:b0:3c9:6e96:88fb with SMTP id 5614622812f47-3cdb0c91a7bmr4613116b6e.4.1716463004868; Thu, 23 May 2024 04:16:44 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 3/7] x86/boot: Collect the Raw CPU Policy earlier on boot Date: Thu, 23 May 2024 12:16:23 +0100 Message-Id: <20240523111627.28896-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240523111627.28896-1-andrew.cooper3@citrix.com> References: <20240523111627.28896-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: 1716463035039100001 This is a tangle, but it's a small step in the right direction. xstate_init() is shortly going to want data from the Raw policy. calculate_raw_cpu_policy() is sufficiently separate from the other policies= to be safe to do. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 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. --- 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 b50c9c84af6d..8850e5637a98 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.30.2