Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1704204lqs; Sun, 16 Jun 2024 00:27:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWq7T8k5zsr6K7ej3u7CPD10c5av+yCHoMkyMSMMVkHvkDl5TSb6qo7bO8m6OVf7vcoUg9G+T4qMDk2HmacQdeVlmQA1tFUjACXiKPTTg== X-Google-Smtp-Source: AGHT+IG7e3h8Qb6sq9OnalhFGg9CGBqtGgKr2aFYfv506OKm7Oaiev1mSikGbEAA3c4Yk5ScOxpz X-Received: by 2002:a05:6512:2fb:b0:52b:c88e:cec1 with SMTP id 2adb3069b0e04-52ca6e6e53emr5091031e87.33.1718522873808; Sun, 16 Jun 2024 00:27:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718522873; cv=pass; d=google.com; s=arc-20160816; b=vwHtZeCV1+o99ImWlcHb9aVkOSx8ph8fwWsfMUCmAWKIcZl4MTkFU6w09anhWmARMy ooxl/lj4p3ogkbyZyLXveFczzqrHCt36oQYpG94tQ5C6qIFRaiLDrGqjrahXKlyDRHlu Cmbeo+HH5tZbYJ0KAyIS3+/9urksWqwm8uJrYtqF5yD8cve58Awz/DfKomqPrbhM9rzC t4rZmjsnn7vGw7z9hxoliiY9T3Rbw/bvIiqBDvZ58roNOEhgXdGrQ6nzCZfHiDmC79oV 2xW4ypcjaP885cbr6IL8w0uRV8Iw4MM/1J0Cj0t6Bhs9X9jvq1+sEodROyvH9TGFCP+x 6I4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-filter; bh=vcnyciM5IvH6WEzwFFx0NauxBD5rFkkyBqjtfqxYFho=; fh=88woEVmZlmuPsYsOsKUvzMUMO3h60xp7RLa/S0+h53Q=; b=BC2ahcCmf7odrbrzFVxmT6Fncx5FzzKsdlvFNGrSh0b+jbKMpII2ov25PNbewazWsB UNeyXJHRasstEfPPjLVsXbDoRu5yxNzDY6RGa/tmmKm4vR01pjcdK84XwMzexMD125M7 Lkx0klgZ/y5mH93TwMNW6Yyg7zU4mCwbNOZx8/F/VNAnhYmfjn3e2GI90RgN2AAaD/tF CgjKvBk3W91YH/Koi4HyfMzcZZ4UZ4MnIZNXyAaa+vxXrN2vgfnW+o7qch57/tqNeVvx 8wT+rewiXBCsidI868dLbyxKNl8Q60HCuY+qo3wttSD1O6GM/XC17p1OuGmzSoX+3p7t 4V3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024051501 header.b=AtPDByQB; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-216159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56dd663fsi327658566b.448.2024.06.16.00.27.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 00:27:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-216159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024051501 header.b=AtPDByQB; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-216159-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-216159-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 828511F22A95 for ; Sun, 16 Jun 2024 07:27:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56F55178CFA; Sun, 16 Jun 2024 07:27:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="AtPDByQB" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B4B016DEB4; Sun, 16 Jun 2024 07:27:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718522867; cv=none; b=lX3XtVoQ2F2iIdORqBIicZtqfDRoyVNnc5xKazK+/FmoWAcWEwkVX2sMTQJYKdJOjq/V4yBQ1LKbzbK8fyAu9txYK1gexCwtvwrzNZdZGkZWvV5wSNvqZe/sNfkKXwDiP1F/STFbA4+b48gv3a4PcatfLt5Olc8wT4DgFkr9UbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718522867; c=relaxed/simple; bh=IJKBx8EngZjCf1UMWwzavgh2/tV9nzo7UHwlFNS36nQ=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=n0awOyJsvcF/jyp4VvTl4eDsL8DkkbPGYnnwChmIHorZY4dyn3UMiuDdsCLLrbQ9DgmVAaMgPvjIyB7wyTIRAwzaYMHiGWKXSm4OhrQnniZK0xRnuMMGcLAOLG5/3nyqmQ7Mi+oryHSCHiJ78P78QA/UbUkIGXMgjUif0IZ4ml0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=AtPDByQB; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [192.168.7.205] ([71.202.166.45]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 45G7Qnfg1078062 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sun, 16 Jun 2024 00:26:49 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 45G7Qnfg1078062 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024051501; t=1718522810; bh=vcnyciM5IvH6WEzwFFx0NauxBD5rFkkyBqjtfqxYFho=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=AtPDByQBMPrHWCGI+vzy8WZd8eQnzbzM+qXJF88Fb2WB2o+PZTPwNlkkLKmrTUk6a /nwKfiQrc6wYyXRaN6OA6gbPyymGlSuF1oyKtg540JImmdKhvgid+pRKDF07JtieKB NlA+yUHTFyuUArFshov6HbYhiR25PIUQJHWNr+dbDyiaN0DzNqG8Qlf2MYLHLsLyG9 3J4g/EJpZBuBi9pumrYn/UbP6yFmGs+Xl7X/nbVEGEg1jPhUdmbrWZVlXkUXCBrk1/ EZ6HOCVUVgIPIyUCzZqJdvMElRaDA3YoyHt+AJbRRYYSEXBbqAVAXVfC0pqegdYl3e gwkBSyyWTVV1g== Message-ID: <99208d95-d3de-44d0-8b08-f508759aabca@zytor.com> Date: Sun, 16 Jun 2024 00:26:48 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND v1 2/3] x86/cpufeatures: Generate a feature mask header based on build config From: Xin Li To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, will@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, acme@kernel.org, namhyung@kernel.org References: <20240509205340.275568-1-xin@zytor.com> <20240509205340.275568-3-xin@zytor.com> Content-Language: en-US Autocrypt: addr=xin@zytor.com; keydata= xsDNBGUPz1cBDACS/9yOJGojBFPxFt0OfTWuMl0uSgpwk37uRrFPTTLw4BaxhlFL0bjs6q+0 2OfG34R+a0ZCuj5c9vggUMoOLdDyA7yPVAJU0OX6lqpg6z/kyQg3t4jvajG6aCgwSDx5Kzg5 Rj3AXl8k2wb0jdqRB4RvaOPFiHNGgXCs5Pkux/qr0laeFIpzMKMootGa4kfURgPhRzUaM1vy bsMsL8vpJtGUmitrSqe5dVNBH00whLtPFM7IbzKURPUOkRRiusFAsw0a1ztCgoFczq6VfAVu raTye0L/VXwZd+aGi401V2tLsAHxxckRi9p3mc0jExPc60joK+aZPy6amwSCy5kAJ/AboYtY VmKIGKx1yx8POy6m+1lZ8C0q9b8eJ8kWPAR78PgT37FQWKYS1uAroG2wLdK7FiIEpPhCD+zH wlslo2ETbdKjrLIPNehQCOWrT32k8vFNEMLP5G/mmjfNj5sEf3IOKgMTMVl9AFjsINLHcxEQ 6T8nGbX/n3msP6A36FDfdSEAEQEAAc0WWGluIExpIDx4aW5Aenl0b3IuY29tPsLBDQQTAQgA NxYhBIUq/WFSDTiOvUIqv2u9DlcdrjdRBQJlD89X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J/ABD6pBnUUAEQEAAcLA/AQYAQgA JhYhBIUq/WFSDTiOvUIqv2u9DlcdrjdRBQJlD89ZBQkFo5qAAhsMAAoJEGu9DlcdrjdR4C0L /RcjolEjoZW8VsyxWtXazQPnaRvzZ4vhmGOsCPr2BPtMlSwDzTlri8BBG1/3t/DNK4JLuwEj OAIE3fkkm+UG4Kjud6aNeraDI52DRVCSx6xff3bjmJsJJMb12mWglN6LjdF6K+PE+OTJUh2F dOhslN5C2kgl0dvUuevwMgQF3IljLmi/6APKYJHjkJpu1E6luZec/lRbetHuNFtbh3xgFIJx 2RpgVDP4xB3f8r0I+y6ua+p7fgOjDLyoFjubRGed0Be45JJQEn7A3CSb6Xu7NYobnxfkwAGZ Q81a2XtvNS7Aj6NWVoOQB5KbM4yosO5+Me1V1SkX2jlnn26JPEvbV3KRFcwV5RnDxm4OQTSk PYbAkjBbm+tuJ/Sm+5Yp5T/BnKz21FoCS8uvTiziHj2H7Cuekn6F8EYhegONm+RVg3vikOpn gao85i4HwQTK9/D1wgJIQkdwWXVMZ6q/OALaBp82vQ2U9sjTyFXgDjglgh00VRAHP7u1Rcu4 l75w1xInsg== In-Reply-To: <20240509205340.275568-3-xin@zytor.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/9/2024 1:53 PM, Xin Li (Intel) wrote: > From: "H. Peter Anvin (Intel)" > > Introduce an AWK script to auto-generate a header with required and > disabled feature masks based on and current build > config. Thus for any CPU feature with a build config, e.g., X86_FRED, > simply add ... > + > + printf "\n#define %s_MASKS ", s; > + pfx = "{"; > + for (i = 0; i < ncapints; i++) { > + printf "%s \\\n\t%s_MASK_%d", pfx, s, i; > + pfx = ","; > + } > + printf " \\\n}\n\n"; > + > + printf "#define %s_FEATURE(x) \\\n", s; > + printf "\t((( "; > + for (i = 0; i < ncapints; i++) { > + if (masks[i]) { > + printf "\\\n\t\t((x) >> 5) == %2d ? %s_MASK%-3d : ", i, s, i; > + } > + } > + printf "0 \\\n"; > + printf "\t) >> ((x) & 31)) & 1)\n\n"; This code generates macros {REQUIRED,DISABLED}_FEATURE(x) to tell if a CPU feature, e.g., X86_FEATURE_FRED, is a required or disabled feature for this particular compile-time configuration. But they are NOT currently used, so I prefer to remove them for now. Thanks! Xin