Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2469633rdb; Mon, 12 Feb 2024 06:06:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIfBxQqXiRwyKHguayTAqOyJgxLricJljn8kodwWzw6RWMqwMSAHRefoiOJCMlEbW6Pe2u X-Received: by 2002:a05:622a:1746:b0:42c:7050:9ad8 with SMTP id l6-20020a05622a174600b0042c70509ad8mr5919127qtk.58.1707746808740; Mon, 12 Feb 2024 06:06:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707746808; cv=pass; d=google.com; s=arc-20160816; b=GFUuKrrN0IVRNpfwcMi1T1qfyI/f1B048NhLfBLZfz0QsvZI3SsiMar3qqly+7+fwD X4c/cHqPqdigpmPYQuo/bKcYRUGBIA73tgOUhRfCfPTnMMlFJNM4/H0qtDJGoER6V3cK aIblo8ntBzT4V8upjOYWSd+jJ0pYwEgfpr4BxokKNFYe2QgicClPvgzbbqiVg9M5yj/4 qf1ZlOVL1vd/Cuor/Wp++TPh5KSGBuTqmtQxsnMJ8C9qgdPbXq80Hb+rvYAWXUR5p5hD kz99g6i70IRBngX4u3CLD2prjM2x/LFgn71qP7273uLdGLmTAUF2+aIxVb8q3mX7SziM QOtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=PDs667/kyIokG7fh/bIYu8xk/luCO9c6+FvAq1iBXGI=; fh=rUBmhPzi954mvCmRpRasbYDPEuM6LocbeezDBDTJ7Ko=; b=oTNAb2rZjWn3KDrz7BpV6AEWM4RKg4dZ+IhXb8HJrZOVH9y5skRfbJJi+8Tn5tGJHv hgjlx6wN6naXGX/3ezZQdXtx68F7ILik/qQWVRpLqX1v0yrIUXsYRtzp9TT0WdWn8w6J 4Y9COuWVfuPZP8IJ2PiaJwk7CQOpb/x+lzERJ4Slk9myDlKXcpcc2LbFRiIm0PvYKJaj vIxL3p+qenhOTyGwy762Ood5dHDH1pQet0qfnjyOgdpu4fyZWloz9XFtqUpM/Mbt0YcR dbtcpXvZTvTmbVIyRcdS2acP3eQUFiSLvGju9/P7Ts6xC34wyZ6AGX/URyjCEzrzP3FP 55tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="sbBd/Hmi"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-61780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61780-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCXTXSRg28EOCTSGXOoClgbmQWNdevWc8NU3l+JeLSUKD0w/s6grn8+E8sT2jeOFDnYOWpJLvC8Tu03rb65WahW+GvKLg1fN3c80QsAw4w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v13-20020a05622a130d00b0042c39b11ea3si464057qtk.581.2024.02.12.06.06.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="sbBd/Hmi"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-61780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61780-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 6787E1C22950 for ; Mon, 12 Feb 2024 14:06:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 982994CE0F; Mon, 12 Feb 2024 13:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sbBd/Hmi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kz1K/T9G" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 4A3D24C635 for ; Mon, 12 Feb 2024 13:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707746226; cv=none; b=AXinI6grYZEYpygkBMyj1ryuBxgzgl6Qahl5geRT1JtvdgLOxv/e9iOXKLJKw9A+GHdK6U5CwurYHilN3JhlLjeUEO5Uv2pSrKiaWLb3CPwHXyWFsEticHUe7IVbNCy6sSCkvaI/aDToTMJK3EOR0TXES5PVLuRg8Hzx4lP2LPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707746226; c=relaxed/simple; bh=PhHUI0/op/Qan6FvY/VR9aAaIVdZQKnXApivF6nk/xI=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:MIME-Version: Content-Type; b=QK+q/OYr72DNmSN7rowxIH679RSu9NPILlZKXwt2rhnhvfkP8P90+CK9T+0hhd9BVlD5jg2q2NQyXVsN9rO8zqrdy/bHafW1X1l3W5rqouOpn7uwMuedausVKvcWSR2YFFg6r6O5jz9n14vlOuxnudabin8y7H94YEfXGze2LGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sbBd/Hmi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kz1K/T9G; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707746223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=PDs667/kyIokG7fh/bIYu8xk/luCO9c6+FvAq1iBXGI=; b=sbBd/HmiodRWiGy6/hdfeHSy42CNWZxJJgDMlU1KCbmwbfBHuokYiA8RcmsDnFK1WXMZTS mq6B9TgCqeIT2nxwcBUfSs15oDKtSqyVnpxx8v1kugVQ3BruwM/XTakh9g1KyFqZHTTpTA tVFQZv/nYmzjmpUAY7I5v8KmrgRH99g75S/rQwvWxgXIVlUc/XbZ+FWPIvMO6iGeXIO2q7 jKBtHQtSwWH3HuM7AlJ0K3dRwp9J260ezBh7Y4Zj9likzdbHf6rMGryJd4h5PUKko6zNFx S3AfLl2sYgd3PL4FwHsDDo31YPRq+hRTupc4IkqWT+eb86X65DOkWtcdjBcm6Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707746223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=PDs667/kyIokG7fh/bIYu8xk/luCO9c6+FvAq1iBXGI=; b=kz1K/T9G0KAQsJwWer8yj5E3F2bJzHPyiaOKT2ENQWU2Pb/kyqDM6ghMT7Olg2stggai58 tAvA6iB/VoKsk2AQ== To: Borislav Petkov 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)" Subject: Re: [patch v5 01/19] x86/cpu: Provide cpuid_read() et al. In-Reply-To: <20240124200207.GHZbFsv-XjMRGfp19b@fat_crate.local> Date: Mon, 12 Feb 2024 14:57:02 +0100 Message-ID: <87le7plr9t.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Wed, Jan 24 2024 at 21:02, Borislav Petkov wrote: > On Wed, Jan 24, 2024 at 01:25:12PM +0100, Borislav Petkov wrote: >> > +static inline void __cpuid_read_reg(unsigned int leaf, unsigned int subleaf, >> > + enum cpuid_regs_idx regidx, u32 *reg) >> > +{ >> > + u32 regs[4]; >> > + >> > + __cpuid_read(leaf, subleaf, regs); >> > + *reg = regs[regidx]; >> >> Why not do >> >> return regs[regidx]; >> >> instead? > > Or do you really want to be able to use anonymous structs with bitfields > in them and then convert them to a u32 * when passing in to > cpuid_leaf_reg() etc in order to save yourself all the masking and > shifting and read out the bitfields directly? > > I'm looking at the parse_topology() use case. > > Looks like it... Yes, that's the idea.