Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1078864rdb; Wed, 24 Jan 2024 04:25:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhinoQo5sTomQPgiOQSJIR88iB7d2RUIfQbB4Q3cYg6RRgWm6zMx36m8JBB/ZIPubQ1dbv X-Received: by 2002:a05:6214:1d06:b0:685:b66d:7d4f with SMTP id e6-20020a0562141d0600b00685b66d7d4fmr3041021qvd.93.1706099150596; Wed, 24 Jan 2024 04:25:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706099150; cv=pass; d=google.com; s=arc-20160816; b=Npc558g/Z2fJnTb1Suq+4SJei2/qdAH43iVt8dlsR6FN0IUn9UZZbZ6CaOHnZ4+GfF EYtG0+uG858McPtiNmbQED5S+00CdwIXwbGYdCstZaLuXL7rhHaaXFiA7WygbqaVm57G AssDXepAql03F4fVVE9kFyeVmupf5HuUZPiXOJBimlltFvKotqmVKHOYtL3qrJ4eFmcl Wx/5NP0wwDHEddpR7ECITBNu7cPMUk1wg2yViENZrrQQz8Ke2ECMCzPJGB/9LNGTps+Z O6lDBBjcPw3XG4bPTNyuAeq3JSNiLUo/jiWBT2X2X9jW8D9dWsKoECkBLJJmm6vBO8My MTbQ== 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=2e7i4QkwJtub1qe+RyKIh7wmtZv9acr9lQcqv94JXdE=; fh=PpClqDpo2D8sZrgtk64JoIOykDOhS505LkT4V/bWuZw=; b=N+I83pB9TsKaf7ZS2nBD8s+Rgx3D7MvRTbvu13531AikgyZ10UJgs6ZfJmyyt3hIPR +x5vT8pAtmJiDPkv4xKiVXnlXSoATEQbye5ZuGsxcG6mwgy1ws7gM3HcO4LJ4IC9gXG5 JssSbquB0Txt08El4xpc6/Xfz6X9HXhALks8E8mgVpBkaCu0rnpFkyTFUYVEysUfQKzd Y3JWB3HJHEAZnFnm/5JHG9szClvVhvUfKNQUeiHXZ1hcKsb5GCG9utGLUa90Ee90DN15 E9VFjgiVnDYgtbVUQRq+AqpkL6HFl9R3XO40A7vxl1FgcwzuvGcQddJ+E1HzbAlyZ3VN sM0w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=W3cK2siY; 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-36972-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36972-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z17-20020a0c8f11000000b00682d6640016si10199151qvd.479.2024.01.24.04.25.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 04:25:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36972-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=pass header.i=@alien8.de header.s=alien8 header.b=W3cK2siY; 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-36972-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36972-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5BEEB1C21217 for ; Wed, 24 Jan 2024 12:25:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5B0B63110; Wed, 24 Jan 2024 12:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="W3cK2siY" 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 E0D5ECA69 for ; Wed, 24 Jan 2024 12:25:40 +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=1706099142; cv=none; b=UWAqboVUF0ZEgn2TpqJAlH0rWd6Hvz1rD9k7vvrsFuGH+M6RBVRWdHLNA/QAjtO0fiPJgPCQcclJRsH6bxIJUpi0DVsMeyuPiBP6pnvAkIJkcXExWmNupU5QgO+hjp7+lieedVhoax9IhlFkX46+TA0VnKeIp0yIZwigmoxljQk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706099142; c=relaxed/simple; bh=hdLrqlT1YuQO57T7qv3Fix50b4rRfIshrK2u98Hr52A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LgN4tG19blVuP1BHPORdSxlzh194uLA9xo9CtDev13wXs0oNIKZ0xbV38ueiUPIDtrm24pIa97R9xu6lbdP4wQM1iOAQmgtJIs6pP0QInHT21BRjN1Qseea15kCPebUNuTNjVUnrE7cVYN5aSo+MJbgv5ygA5BN2v9exp07vNWg= 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=W3cK2siY; 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 063E040E00C5; Wed, 24 Jan 2024 12:25:38 +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 ZTaN3fkMc74B; Wed, 24 Jan 2024 12:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1706099135; bh=2e7i4QkwJtub1qe+RyKIh7wmtZv9acr9lQcqv94JXdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W3cK2siYsCcLtLESpixiTuZ4JgburWRzY2QBt6ThB9xjl9jG2y/ZcaUBUBKwyyOnT WYcP9Wpy7nBglwuFdp62ZEgDmPEpDqre/58pNI88D1CMAYcYDHQFoWHr2u+rHyA5UR /K15NZTAEhzZ+fgLTmkJJAuK5YI/QpUX/U6gPMVzb9CLnRX/sYb0Oem/kdhUxy8pXU mBF9V2bq+cIecIdbIcgL+ZlH0g9jcomv0uudRgbxxNiIC4SGt/lCIda86WmvYN8wvB uhKJJP34l/+YHCbleXK6hFhmvYNMce3BMhKoIwD5AftOyfmda4pFWtQ1fXS8oXZyji xKIm1Purt0OV4IgAXqaJyVeXSpWn99ugAC6cVlmG0ZiWTgfIi7N3aCgddSePegw1n5 03VgcDesVWfqyF+bUs2YueaS3z5Xoe7ie/qMwjMm7l10F4QOsxtubmeEOk5CpqiNRg +RMCY/i51Yf1gcFeSN2bK7hYNBrA0iK5em2MVfheDdrZyuxNYuuKMde4Gl+C46s6pD 3JanQVxQXsiQnUnX+eB5wEw6Op/xCc4Nl/NrKsS32P/7ZMlU8kIq6ULgNfXRCVgCy+ 6P9AXxuQ8hxCIXFVqIR92Kog8BzuXyoHiTBdy2V1pDw+3inFgIbUok8OtGP98J3QxQ 9kRZcEEMIHtSwKitnkF42Dao= 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 A99C740E01AE; Wed, 24 Jan 2024 12:25:17 +0000 (UTC) Date: Wed, 24 Jan 2024 13:25:12 +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: <20240124122512.GUZbEBqH0_5pb19sKr@fat_crate.local> References: <20240117115752.863482697@linutronix.de> <20240117115908.344295552@linutronix.de> 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: <20240117115908.344295552@linutronix.de> On Tue, Jan 23, 2024 at 01:53:30PM +0100, Thomas Gleixner wrote: > +static inline void __cpuid_read(unsigned int leaf, unsigned int subleaf, u32 *regs) > +{ > + regs[CPUID_EAX] = leaf; > + regs[CPUID_ECX] = subleaf; > + __cpuid(regs, regs + 1, regs + 2, regs + 3); You have defines for the regs - might as well use them: __cpuid(regs, regs + CPUID_EBX, regs + CPUID_ECX, regs + CPUID_EDX); > +} > + > +#define cpuid_subleaf(leaf, subleaf, regs) { \ > + BUILD_BUG_ON(sizeof(*(regs)) != 16); \ > + __cpuid_read(leaf, subleaf, (u32 *)(regs)); \ > +} > + > +#define cpuid_leaf(leaf, regs) { \ > + BUILD_BUG_ON(sizeof(*(regs)) != 16); \ > + __cpuid_read(leaf, 0, (u32 *)(regs)); \ > +} > + > +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? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette