From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76C34C433F5 for ; Mon, 4 Oct 2021 19:08:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5638E61452 for ; Mon, 4 Oct 2021 19:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236730AbhJDTKM (ORCPT ); Mon, 4 Oct 2021 15:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233226AbhJDTKM (ORCPT ); Mon, 4 Oct 2021 15:10:12 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35222C061745; Mon, 4 Oct 2021 12:08:23 -0700 (PDT) Received: from zn.tnic (p200300ec2f0fe4009c23c25c98857304.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:e400:9c23:c25c:9885:7304]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A06841EC03FE; Mon, 4 Oct 2021 21:08:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1633374501; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=i6PxikJNA1V7HfDVyLAobLqaSjOebbk6J6n8Zlv5QfE=; b=EKdSCXKP0dFy4SUcN7yE1/LTYYr7g50Rq74dwqthJVY7HnSsWQ0haYRQBlHM9qpvT/ZewA L/dhM/XkdJucHyEk/QoP7sLQggGOKhbB/la4UEPn7+C8g2QJ/yp32xgC5HZdOGksGMh1OO gOfqpItzsrx/A1wmMvUKtArbVnZHUQM= Date: Mon, 4 Oct 2021 21:08:22 +0200 From: Borislav Petkov To: Iwona Winiarska Cc: linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, Greg Kroah-Hartman , x86@kernel.org, devicetree@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Rob Herring , Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Arnd Bergmann , Olof Johansson , Jonathan Corbet , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Yazen Ghannam , Mauro Carvalho Chehab , Pierre-Louis Bossart , Tony Luck , Andy Shevchenko , Jae Hyun Yoo , Dan Williams , Randy Dunlap , Zev Weiss , David Muller Subject: Re: [PATCH v2 02/15] x86/cpu: Extract cpuid helpers to arch-independent Message-ID: References: <20210803113134.2262882-1-iwona.winiarska@intel.com> <20210803113134.2262882-3-iwona.winiarska@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210803113134.2262882-3-iwona.winiarska@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org On Tue, Aug 03, 2021 at 01:31:21PM +0200, Iwona Winiarska wrote: > Baseboard management controllers (BMC) often run Linux but are usually > implemented with non-X86 processors. They can use PECI to access package > config space (PCS) registers on the host CPU and since some information, > e.g. figuring out the core count, can be obtained using different > registers on different CPU generations, they need to decode the family > and model. > > The format of Package Identifier PCS register that describes CPUID > information has the same layout as CPUID_1.EAX, so let's allow to reuse > cpuid helpers by making it available for other architectures as well. > > Signed-off-by: Iwona Winiarska > Reviewed-by: Tony Luck > Reviewed-by: Dan Williams > --- > MAINTAINERS | 1 + > arch/x86/Kconfig | 1 + > arch/x86/include/asm/cpu.h | 3 --- > arch/x86/include/asm/microcode.h | 2 +- > arch/x86/kvm/cpuid.h | 3 ++- > arch/x86/lib/Makefile | 2 +- > drivers/edac/mce_amd.c | 3 +-- > include/linux/x86/cpu.h | 9 +++++++++ > lib/Kconfig | 4 ++++ > lib/Makefile | 2 ++ > lib/x86/Makefile | 3 +++ > {arch/x86/lib => lib/x86}/cpu.c | 2 +- > 12 files changed, 26 insertions(+), 9 deletions(-) > create mode 100644 include/linux/x86/cpu.h > create mode 100644 lib/x86/Makefile > rename {arch/x86/lib => lib/x86}/cpu.c (95%) AFAICT, all that churn is done for x86_family() and x86_model() which are used *exactly* *once* and which are almost trivial anyway. What's wrong with simply computing the family and model "by hand", so to speak, in peci_device_info_init() and do away with that diffstat 12 files changed, 26 insertions(+), 9 deletions(-) ? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA2C2C433EF for ; Mon, 4 Oct 2021 19:09:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 907EF61248 for ; Mon, 4 Oct 2021 19:09:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 907EF61248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qj11c7NJq5cZYiTs+bFLjiuVd6iGyx1y7ok86kBg4t0=; b=ZCCqF1Req7pt6w 5/1HqdGtY9IM2si5pAtXRoJ3bgH1sxXD52hW2Pq3YKBNfIwQmWgaZ3WZj9ddICsoMf7KIK3qCx2Ra LG9ukRdDPnJ/F9n9gYy5U+1fPh8oCL+ttv5UXt1qPqN9tlyQxfLCH+fjgm2u/L5kx0fHyIiDqBZ3d vAcSCuFVZi4nnE5OHvTX5wkLMO6KviSZKLjfCElUABjhJG6MtjbaYJe+g5UCdTOsWKZxBv/3+e9WM wff71Axi3xluowJbJCKx96RBKqpwHhSR9LsG+O589Xp6O+kVKInPTBRNt9/IF90nmkBhPG+y+bH/5 4iGVexWS9tHwzkgOPgPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXTK7-007oiW-6T; Mon, 04 Oct 2021 19:08:27 +0000 Received: from mail.skyhub.de ([2a01:4f8:190:11c2::b:1457]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXTK3-007ohB-85 for linux-arm-kernel@lists.infradead.org; Mon, 04 Oct 2021 19:08:24 +0000 Received: from zn.tnic (p200300ec2f0fe4009c23c25c98857304.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:e400:9c23:c25c:9885:7304]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A06841EC03FE; Mon, 4 Oct 2021 21:08:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1633374501; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=i6PxikJNA1V7HfDVyLAobLqaSjOebbk6J6n8Zlv5QfE=; b=EKdSCXKP0dFy4SUcN7yE1/LTYYr7g50Rq74dwqthJVY7HnSsWQ0haYRQBlHM9qpvT/ZewA L/dhM/XkdJucHyEk/QoP7sLQggGOKhbB/la4UEPn7+C8g2QJ/yp32xgC5HZdOGksGMh1OO gOfqpItzsrx/A1wmMvUKtArbVnZHUQM= Date: Mon, 4 Oct 2021 21:08:22 +0200 From: Borislav Petkov To: Iwona Winiarska Cc: linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, Greg Kroah-Hartman , x86@kernel.org, devicetree@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, Rob Herring , Joel Stanley , Andrew Jeffery , Jean Delvare , Guenter Roeck , Arnd Bergmann , Olof Johansson , Jonathan Corbet , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Yazen Ghannam , Mauro Carvalho Chehab , Pierre-Louis Bossart , Tony Luck , Andy Shevchenko , Jae Hyun Yoo , Dan Williams , Randy Dunlap , Zev Weiss , David Muller Subject: Re: [PATCH v2 02/15] x86/cpu: Extract cpuid helpers to arch-independent Message-ID: References: <20210803113134.2262882-1-iwona.winiarska@intel.com> <20210803113134.2262882-3-iwona.winiarska@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210803113134.2262882-3-iwona.winiarska@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211004_120823_478936_FC27B093 X-CRM114-Status: GOOD ( 17.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 03, 2021 at 01:31:21PM +0200, Iwona Winiarska wrote: > Baseboard management controllers (BMC) often run Linux but are usually > implemented with non-X86 processors. They can use PECI to access package > config space (PCS) registers on the host CPU and since some information, > e.g. figuring out the core count, can be obtained using different > registers on different CPU generations, they need to decode the family > and model. > > The format of Package Identifier PCS register that describes CPUID > information has the same layout as CPUID_1.EAX, so let's allow to reuse > cpuid helpers by making it available for other architectures as well. > > Signed-off-by: Iwona Winiarska > Reviewed-by: Tony Luck > Reviewed-by: Dan Williams > --- > MAINTAINERS | 1 + > arch/x86/Kconfig | 1 + > arch/x86/include/asm/cpu.h | 3 --- > arch/x86/include/asm/microcode.h | 2 +- > arch/x86/kvm/cpuid.h | 3 ++- > arch/x86/lib/Makefile | 2 +- > drivers/edac/mce_amd.c | 3 +-- > include/linux/x86/cpu.h | 9 +++++++++ > lib/Kconfig | 4 ++++ > lib/Makefile | 2 ++ > lib/x86/Makefile | 3 +++ > {arch/x86/lib => lib/x86}/cpu.c | 2 +- > 12 files changed, 26 insertions(+), 9 deletions(-) > create mode 100644 include/linux/x86/cpu.h > create mode 100644 lib/x86/Makefile > rename {arch/x86/lib => lib/x86}/cpu.c (95%) AFAICT, all that churn is done for x86_family() and x86_model() which are used *exactly* *once* and which are almost trivial anyway. What's wrong with simply computing the family and model "by hand", so to speak, in peci_device_info_init() and do away with that diffstat 12 files changed, 26 insertions(+), 9 deletions(-) ? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B615C433F5 for ; Tue, 5 Oct 2021 00:11:21 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6387C60F43 for ; Tue, 5 Oct 2021 00:11:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6387C60F43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HNdKf5z3wz2yV6 for ; Tue, 5 Oct 2021 11:11:18 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=alien8.de header.i=@alien8.de header.a=rsa-sha256 header.s=dkim header.b=EKdSCXKP; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=alien8.de (client-ip=5.9.137.197; helo=mail.skyhub.de; envelope-from=bp@alien8.de; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=alien8.de header.i=@alien8.de header.a=rsa-sha256 header.s=dkim header.b=EKdSCXKP; dkim-atps=neutral X-Greylist: delayed 257 seconds by postgrey-1.36 at boromir; Tue, 05 Oct 2021 06:08:24 AEDT Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HNVc81qKgz2xY1; Tue, 5 Oct 2021 06:08:24 +1100 (AEDT) Received: from zn.tnic (p200300ec2f0fe4009c23c25c98857304.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:e400:9c23:c25c:9885:7304]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A06841EC03FE; Mon, 4 Oct 2021 21:08:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1633374501; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=i6PxikJNA1V7HfDVyLAobLqaSjOebbk6J6n8Zlv5QfE=; b=EKdSCXKP0dFy4SUcN7yE1/LTYYr7g50Rq74dwqthJVY7HnSsWQ0haYRQBlHM9qpvT/ZewA L/dhM/XkdJucHyEk/QoP7sLQggGOKhbB/la4UEPn7+C8g2QJ/yp32xgC5HZdOGksGMh1OO gOfqpItzsrx/A1wmMvUKtArbVnZHUQM= Date: Mon, 4 Oct 2021 21:08:22 +0200 From: Borislav Petkov To: Iwona Winiarska Subject: Re: [PATCH v2 02/15] x86/cpu: Extract cpuid helpers to arch-independent Message-ID: References: <20210803113134.2262882-1-iwona.winiarska@intel.com> <20210803113134.2262882-3-iwona.winiarska@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210803113134.2262882-3-iwona.winiarska@intel.com> X-Mailman-Approved-At: Tue, 05 Oct 2021 11:10:42 +1100 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, linux-doc@vger.kernel.org, Dan Williams , Zev Weiss , Jae Hyun Yoo , Andy Shevchenko , Jonathan Corbet , openbmc@lists.ozlabs.org, x86@kernel.org, Pierre-Louis Bossart , Ingo Molnar , Guenter Roeck , devicetree@vger.kernel.org, Jean Delvare , Arnd Bergmann , Rob Herring , Andy Lutomirski , Thomas Gleixner , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, Tony Luck , Andrew Jeffery , Greg Kroah-Hartman , Randy Dunlap , linux-kernel@vger.kernel.org, Yazen Ghannam , Olof Johansson Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Tue, Aug 03, 2021 at 01:31:21PM +0200, Iwona Winiarska wrote: > Baseboard management controllers (BMC) often run Linux but are usually > implemented with non-X86 processors. They can use PECI to access package > config space (PCS) registers on the host CPU and since some information, > e.g. figuring out the core count, can be obtained using different > registers on different CPU generations, they need to decode the family > and model. > > The format of Package Identifier PCS register that describes CPUID > information has the same layout as CPUID_1.EAX, so let's allow to reuse > cpuid helpers by making it available for other architectures as well. > > Signed-off-by: Iwona Winiarska > Reviewed-by: Tony Luck > Reviewed-by: Dan Williams > --- > MAINTAINERS | 1 + > arch/x86/Kconfig | 1 + > arch/x86/include/asm/cpu.h | 3 --- > arch/x86/include/asm/microcode.h | 2 +- > arch/x86/kvm/cpuid.h | 3 ++- > arch/x86/lib/Makefile | 2 +- > drivers/edac/mce_amd.c | 3 +-- > include/linux/x86/cpu.h | 9 +++++++++ > lib/Kconfig | 4 ++++ > lib/Makefile | 2 ++ > lib/x86/Makefile | 3 +++ > {arch/x86/lib => lib/x86}/cpu.c | 2 +- > 12 files changed, 26 insertions(+), 9 deletions(-) > create mode 100644 include/linux/x86/cpu.h > create mode 100644 lib/x86/Makefile > rename {arch/x86/lib => lib/x86}/cpu.c (95%) AFAICT, all that churn is done for x86_family() and x86_model() which are used *exactly* *once* and which are almost trivial anyway. What's wrong with simply computing the family and model "by hand", so to speak, in peci_device_info_init() and do away with that diffstat 12 files changed, 26 insertions(+), 9 deletions(-) ? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette