Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1343227rdb; Wed, 24 Jan 2024 12:02:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFA3eSrHQSnbxOSrjOw3isPu7AdSCd9n4fISaMapVZhy/V31NNIqbZTXY/dQh5nTt5OOSe0 X-Received: by 2002:a17:90a:ebc5:b0:28e:72c5:ebfa with SMTP id cf5-20020a17090aebc500b0028e72c5ebfamr71234pjb.47.1706126565315; Wed, 24 Jan 2024 12:02:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706126565; cv=pass; d=google.com; s=arc-20160816; b=qXJCG6CV2Sm5U7+IfJrKgIjtMV1x7gnZ7p2fuIyI+gFoAAx2pdbmV5zw7ls34eUjW0 n9YVYa+zYAPChGgcfB5zNhRQbTe/5eA73+BdPTRrQkg5tXcvvWwhfjTI1hAKSLEJHkKZ RramU2jlkeS6gIhYHq2lzGfPp6D4NsF0jBcBQsNv2ie2i/OEbQu03PEGydCR//R18dzo 3nWG3xVtAoS0gV2mPTeB/fBPEtf1Ur+oKAZCo76TqxswKSZ0S2guJXTTZuvTkVcLWeDe loEAI2a9UrdJYNQBG6Ij4mKeuUQRr68Qg2UByR67uzf/BoPWbU/4y8mQpiHfA2kdF3Oj Y0Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RuqA/hiDlGH+hxSp2YKGEnzorWdSjH2aYOcNAjuwMOs=; fh=PpClqDpo2D8sZrgtk64JoIOykDOhS505LkT4V/bWuZw=; b=cdiBN6uA8PsrQG7I/m9gxsD9STMU0NFOFqnrb4P+2NQgKBpszhDeyP1qi0pWJ3aEED fIeD2dYz8BzDbxMCahFj9q8rqEYArvXYvR4LvZBSEBcjfpu8GFqdS3j/bmt2nnZcMNlW dF9v6HZZXfcdmmMVaC6bDBAoIg1PKAquRmZX+lg5NBV154MaEuLxfvJp/m1tiUJTf4m5 /sDMEHG4eQdPddIHOF0D46/MFeC6ITr5V+ze+3GMNJ0qmrlf+X/RuVhtPir6z/3wCRhR pz19v3C5ps90etnlN/M4HgC7+DJbMlFIj9wC108I1EbrpbrG/6Z295epENWnqKACrMe6 ChGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=gx+AhE70; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-37622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d13-20020a63fd0d000000b005cfc0129274si7823222pgh.667.2024.01.24.12.02.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:02:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=gx+AhE70; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-37622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EF789288568 for ; Wed, 24 Jan 2024 20:02:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8E6A13342B; Wed, 24 Jan 2024 20:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="gx+AhE70" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 318797C091 for ; Wed, 24 Jan 2024 20:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126558; cv=none; b=dRH3aoPM7fnrjk+c3HEKG+1fXpiRozI8TYKpkteWaG/ts1YTMCFdMaML5pM19uo5UkTc1XVZzNmtrVZ1+cppXfxLshXRt+bPU4A/o+tX213YgpAjIFE9J9cq8eOMscX7T2JsQNYQhDDKvbbcE6gK50Uoek5vITSHRdggBpUaLWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706126558; c=relaxed/simple; bh=jTPaQoWtGEcd7Oo6zZIipCUXmUKB5V0hAm7D2saM/7Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BGU8FD8mpQZGBdjooRK1nA+MGOD3NX39bTdu9N8Uf51OuTlVTx0fEyyopq/KPglRnACS+Vv189yyhC+xLAeDRozKX4inRj5lXzfaaP29ydMxQZ/brjdqqcEEEgfGoF4/7l5oAFrS0ICNgwlVWqyDKf0AfElPxgBj4uls6BQl3KM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=gx+AhE70; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 6470C40E00C5; Wed, 24 Jan 2024 20:02:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GAW0QID3evmb; Wed, 24 Jan 2024 20:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1706126551; bh=RuqA/hiDlGH+hxSp2YKGEnzorWdSjH2aYOcNAjuwMOs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gx+AhE70fLYufEdbnnLdDdMJDyqB7tFQ7PMXz7wGKavgPzWH5jmforuNzv2gQ4B4N jOovoZRK+3W6+3ZQv0AWRz95lC7QuaE8qximILOP6L3XQT/hATgfSM2P7HVDyHSZ2v am+yjZW6qYqa8ge+BA3HYHE4KDMEXoI3lN68dU1JtP9ErQbTX73lZsbHvpgKp2yh/w NX5n9q+kWEwANbHi+j8uYtP3zC14b80Ej6Ejiub7WeMAvea/9OvtJbr9zSDS87sosF TjtfnRdYQ1IIAR/f0ynIdtxvL3/5FXdMF1WUuxAdSKOFnkvVhg99NtX9PmlUmg4kv8 SYoIYpBnlLHO3SXXVQpOah8ByiKYKTIMtNOjEmwn5t2WI7+NkTYxEJGDmlj1oGuNcj h8M7IxxR6qa4Dsak+zLRm7Ms9XayH+W4tBmAt49XtNmWbbOh4/qYjKwRdxMsIj4UT6 txWxGk7IIRZ2YYS1aziiS0Uas0TojBPmjiQx2iwICEpenoJMvcY3Ezp2kSTxmqjS3A ArXSOILRb4HHvGkh0tnGToyaUMBXf+3MhnLXDybwE5cP90mKvCfPzFchBKxgiCVXlJ g2i2V+cO8+zptHOEaLcoUA4lwceoI0M2qGCbD6o2fNNhpy8B+END/OY87MBTALm6tY KAq1vCvtnRx+Wnh75R38yQ4w= Received: from zn.tnic (pd953033e.dip0.t-ipconnect.de [217.83.3.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B273740E0177; Wed, 24 Jan 2024 20:02:12 +0000 (UTC) Date: Wed, 24 Jan 2024 21:02:07 +0100 From: Borislav Petkov 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)" Subject: Re: [patch v5 01/19] x86/cpu: Provide cpuid_read() et al. Message-ID: <20240124200207.GHZbFsv-XjMRGfp19b@fat_crate.local> References: <20240117115752.863482697@linutronix.de> <20240117115908.344295552@linutronix.de> <20240124122512.GUZbEBqH0_5pb19sKr@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240124122512.GUZbEBqH0_5pb19sKr@fat_crate.local> 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... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette