Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp323463rdb; Thu, 15 Feb 2024 00:49:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU7uK9JXRVJxO++kaaUlZTa58ZxnglePuyyOepBDQ9cF0dlmsrVbz8P/mQIkUZ7rSWXsbZwSfpGGui8Hs+8I1vwQgMo+Xq6fmmD6mvOkA== X-Google-Smtp-Source: AGHT+IEYkXta7C1ETHwyFCMU/baUcUeSIG4xiX0jCX8NrjY9GsioOZSNlPXdDavhccd3Hibcwi5u X-Received: by 2002:a05:620a:ece:b0:787:3820:90c with SMTP id x14-20020a05620a0ece00b007873820090cmr448198qkm.1.1707986989394; Thu, 15 Feb 2024 00:49:49 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id l1-20020a05620a28c100b007873add778bsi179420qkp.225.2024.02.15.00.49.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 00:49:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66442-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=Smgu+PZA; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-66442-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 297C31C216C0 for ; Thu, 15 Feb 2024 08:49:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA5CD13FF5; Thu, 15 Feb 2024 08:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Smgu+PZA" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 698AC13FE0 for ; Thu, 15 Feb 2024 08:49:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707986983; cv=none; b=gFAmVOz0OD3C3m+euaS21N7LgkaShu21kAiGMovIL+DByQimBw3gisMOkDorXBxPHU7mfihE5zJ7PY6HeMR95VouV1YzCFPqy3dZbCLnlWC83Lzrwv8fQe9qtbtIN0jRTD3v7mLUosvBaJofkZ0ZgbHW5i05AENTqyelGCtgFW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707986983; c=relaxed/simple; bh=qshXf0HFNw0V+6ASl/t02jVpBSTOYtjsOwTrGDgKgi8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SWRU7NMr4ZXTY3PMwrFCoYDqZw01L8EPReHSZ4oz94ZmvDygTmK9p8pUMjv7VviFjNxxjIDDq04gSrc7NEPQM7MsJgqnia5CgS5wCR5ZTFMlIcgNvlmtYPamurbfyIAC9ID+bgwteiOuE7c/D2xS2rxH2zgz58bmgj7UoMpP2b0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Smgu+PZA; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a293f2280c7so81976466b.1 for ; Thu, 15 Feb 2024 00:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707986979; x=1708591779; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zZwJRwyAoati4WJnxx7rhcBfrLMB6W5r3eHHRAnRiMU=; b=Smgu+PZAOd4L91rDNus3t7lQwkOa/AclSIIzc/qQTxAnRqy9FryI/PZv3VkSC1yU1k GVI2aVx2rSomz51TUY0irZqABIKyRw1huqXQZFFMOwevAEj0Mtmxv9J3UW75xz20KXmq 95n/KuztLFNZyVu4gfWlAQl2qPne20Defo8cTlP33nRCJNXngpZwll38ymvbecuhqY1v HjIP175yRaOW/X0v5Sc9CZV6g1mPUX7JZ+tAt+U2qHffx4pu3Xw05gjffIbhSFaeRzKy U/JrKMxM2BYtPazGbNrKuVQME46Q2TtPHH4FfES25W+fwQJhC4jlwc9KR3gyNgTjdO0W nXFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707986979; x=1708591779; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zZwJRwyAoati4WJnxx7rhcBfrLMB6W5r3eHHRAnRiMU=; b=A6Pi85Hk0dPJDZE93rTfzF76IAUz0Asj74oJI0a3yKlCaFDRIb0NR8f5c4ekYT5rAo kOiL7M62+K20YccV8ELW5GL2sfxeFGyZRzPewi3BAPWxf/bNmnBYmYs6+UiDVhZXMQDx +qS5f7WVIXGQkxWJfbEZAk/YXc8ftm0fiIG5NvFSdT8Z6BszHJxa+g3a8vzPqgwH7wrn muyRy9Vzoag07z+07lFh8MjF4+AaQGur+IEDEybl98ToFxbC5OAwFvlSeIgy0dOkWng1 8Q/eskQKrJ6z+2M0FLV0Q7kMo1rGC0cqT0E3PXVbfRBlNBS0yknN6FlO0SC3d7naJeXz mFrg== X-Gm-Message-State: AOJu0YxFTdMVksgROkmbBrirv04stHKtK3v8D7t0q6nis9s1LR7aUTBw 08tUrHuyioJekI/GztktuHSMa5biyBoXYUurczhDHksoTfOqTntFVmSPMzcAsDYtXpiLiFBfBxf qadHAZB8LjyDWIHaLekv5Kj9z20c= X-Received: by 2002:a17:906:bc4e:b0:a3c:10a4:7a91 with SMTP id s14-20020a170906bc4e00b00a3c10a47a91mr925445ejv.13.1707986979412; Thu, 15 Feb 2024 00:49:39 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212153109.330805450@linutronix.de> <20240212153624.516965279@linutronix.de> <878r3mg570.ffs@tglx> In-Reply-To: <878r3mg570.ffs@tglx> From: Andy Shevchenko Date: Thu, 15 Feb 2024 10:49:02 +0200 Message-ID: Subject: Re: [patch V6a 01/19] x86/cpu: Provide cpuid_read() et al. To: Thomas Gleixner Cc: LKML , x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" , Wang Wendy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 10:29=E2=80=AFPM Thomas Gleixner wrote: > > Provide a few helper functions to read CPUID leafs or individual register= s > into a data structure without requiring unions. .. > +#define cpuid_subleaf(leaf, subleaf, regs) { \ > + BUILD_BUG_ON(sizeof(*(regs)) !=3D 16); \ > + __cpuid_read(leaf, subleaf, (u32 *)(regs)); \ > +} > + > +#define cpuid_leaf(leaf, regs) { \ > + BUILD_BUG_ON(sizeof(*(regs)) !=3D 16); \ > + __cpuid_read(leaf, 0, (u32 *)(regs)); \ > +} .. > +#define cpuid_subleaf_reg(leaf, subleaf, regidx, reg) { \ > + BUILD_BUG_ON(sizeof(*(reg)) !=3D 4); \ > + __cpuid_read_reg(leaf, subleaf, regidx, (u32 *)(reg)); \ > +} > + > +#define cpuid_leaf_reg(leaf, regidx, reg) { \ > + BUILD_BUG_ON(sizeof(*(reg)) !=3D 4); \ > + __cpuid_read_reg(leaf, 0, regidx, (u32 *)(reg)); \ > +} I'm wondering if we can use static_assert() instead of BUILD_BUG_ON() in the above macros. --=20 With Best Regards, Andy Shevchenko