From nobody Thu Nov 14 18:00:31 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=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1729525601; cv=none; d=zohomail.com; s=zohoarc; b=JtZq2bNJ74832dDi9wY90QjhJO5oXWwu1T7kBSYe//HiaBg2QUcHIzX9Yzg6rC7V9UESqYH1/HUmo37IZRtegQ9aV5tkhyXmr69WuLMJoKklVDab8B7PdsFoMlLVxj1Yzn3h8lkAXxVzACXzUZHniqna1QeOmVYIaazq1rL/3vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729525601; h=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=GBassmQzkQGjGcGX6CCW94tabGk8bt3HmbNpfye2CBI=; b=Ijg35FuXa0R6t5BHYWFV4PhHLTPdC8zhZ4j6MXQ0rF/OIsvuMHuyzeMogQ8lcjvd65KxTLTxgDTtQ3GVS5Ts5NCqyNdsVet6x93QIemo1mORYF/NsVAGa0tQiTjri4yu7TnfwukP/fsIfpUL/e5UdWgUuqGk9tCthmxNw8NWlKY= 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 172952560175557.93140686215156; Mon, 21 Oct 2024 08:46:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.823732.1237778 (Exim 4.92) (envelope-from ) id 1t2uc0-00078w-Dd; Mon, 21 Oct 2024 15:46:28 +0000 Received: by outflank-mailman (output) from mailman id 823732.1237778; Mon, 21 Oct 2024 15:46:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t2uc0-00078p-An; Mon, 21 Oct 2024 15:46:28 +0000 Received: by outflank-mailman (input) for mailman id 823732; Mon, 21 Oct 2024 15:46:27 +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 1t2uby-00072f-Ul for xen-devel@lists.xenproject.org; Mon, 21 Oct 2024 15:46:26 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a144706c-8fc3-11ef-a0be-8be0dac302b0; Mon, 21 Oct 2024 17:46:26 +0200 (CEST) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a9aa8895facso28000366b.2 for ; Mon, 21 Oct 2024 08:46:26 -0700 (PDT) Received: from localhost.localdomain (0545937c.skybroadband.com. [5.69.147.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a91370fe5sm215688966b.112.2024.10.21.08.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 08:46:24 -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: a144706c-8fc3-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1729525585; x=1730130385; 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=GBassmQzkQGjGcGX6CCW94tabGk8bt3HmbNpfye2CBI=; b=fQVisM99hOGDTBagGT7JvBbBDzaIQopRXIbcYHrceNr/Z3GDkQ8ykeYmYyfWVbAsva 9GBOqsIBnTMRzIvgHWaMv3NaivkTIKX9xgKNfvJ+uKLe1gUdNWvBHN87ej6Bylum4MEn pOV6h05uG9H7SHpt38z5JPjMt+oLcmgpeUEg0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729525585; x=1730130385; 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=GBassmQzkQGjGcGX6CCW94tabGk8bt3HmbNpfye2CBI=; b=sc8AX5vH+JSc9Hgibno9jTZTvKS8Jw1Sm5xVzdECyr3IH7g8C0Xjh99FIEKjHOFsRP wlH27CEoxOLSfVd4ExvPkxKUhYXTk+06kNaJIzhgyAGPPShuW9nE9Ob6kd5Q0yju3VxU iafCFwigOvYQDF1XAWYB61pgxxuNAKP40NDQywrPLre7Eek6BKiDg8iX84IKfzmpclIP vJ4jUSfpnmiEg0eRhYCA/pGZBLDGMYaWT5R4MDsDjzC5Ue9bq7ZXwF6Eq+02WRCcnacy HeHFseHrA1SH8wq0CLUc0ii2Dp9zx0KZuyrf1KIEXdLLXcrReCcebe99sxxmBLguQwoj pi1A== X-Gm-Message-State: AOJu0YzlV9mUz4V4yQxjhM9fX6CFNOuPOvG3xU/0UaTca+ygiBSBnMWM XAMkaAqvjlf0kK2y45JauQSm4b/Y6yir/XcZEhCXz5bXHC74FWo7kwecxfsxDX23mGPmPEJx6fz x X-Google-Smtp-Source: AGHT+IEihvHwwhqYr+uHOEPw6bXq1/E4z6qPAHQE2TFcRK7PeBA8wIjJHn08cy5toE54HuoyOx+a0Q== X-Received: by 2002:a17:907:7fab:b0:a99:e505:2089 with SMTP id a640c23a62f3a-a9a69c92299mr1103020666b.45.1729525585037; Mon, 21 Oct 2024 08:46:25 -0700 (PDT) From: Alejandro Vallejo To: xen-devel@lists.xenproject.org Cc: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v7 01/10] lib/x86: Bump max basic leaf in {pv,hvm}_max_policy Date: Mon, 21 Oct 2024 16:45:51 +0100 Message-ID: <20241021154600.11745-2-alejandro.vallejo@cloud.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021154600.11745-1-alejandro.vallejo@cloud.com> References: <20241021154600.11745-1-alejandro.vallejo@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1729525602665116600 Content-Type: text/plain; charset="utf-8" Bump it to ARRAY_SIZE() so toolstack is able to extend a policy past host limits (i.e: to emulate a feature not present in the host) Signed-off-by: Alejandro Vallejo --- v7: * Replaces v6/patch1("Relax checks about policy compatibility") * Bumps basic.max_leaf to ARRAY_SIZE(basic.raw) to pass the compatibility checks rather than tweaking the checker. --- xen/arch/x86/cpu-policy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c index b6d9fad56773..715a66d2a978 100644 --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -585,6 +585,9 @@ static void __init calculate_pv_max_policy(void) */ p->feat.max_subleaf =3D ARRAY_SIZE(p->feat.raw) - 1; =20 + /* Toolstack may populate leaves not present in the basic host leaves = */ + p->basic.max_leaf =3D ARRAY_SIZE(p->basic.raw) - 1; + x86_cpu_policy_to_featureset(p, fs); =20 for ( i =3D 0; i < ARRAY_SIZE(fs); ++i ) @@ -672,6 +675,9 @@ static void __init calculate_hvm_max_policy(void) */ p->feat.max_subleaf =3D ARRAY_SIZE(p->feat.raw) - 1; =20 + /* Toolstack may populate leaves not present in the basic host leaves = */ + p->basic.max_leaf =3D ARRAY_SIZE(p->basic.raw) - 1; + x86_cpu_policy_to_featureset(p, fs); =20 mask =3D hvm_hap_supported() ? --=20 2.47.0