From patchwork Wed Apr 24 18:15:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luck, Tony" X-Patchwork-Id: 1927313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YKUJkqSv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VPnJN4Glwz1yZr for ; Thu, 25 Apr 2024 04:17:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YKUJkqSv; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VPnJJ3qhVz3cGM for ; Thu, 25 Apr 2024 04:17:04 +1000 (AEST) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YKUJkqSv; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=192.198.163.19; helo=mgamail.intel.com; envelope-from=tony.luck@intel.com; receiver=lists.ozlabs.org) X-Greylist: delayed 64 seconds by postgrey-1.37 at boromir; Thu, 25 Apr 2024 04:16:43 AEST Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 4VPnHv3Lggz3cP7 for ; Thu, 25 Apr 2024 04:16:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713982603; x=1745518603; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t/ao4kMQjvb5Oyj2NN7I0cbLAgUqp9G5mS37WgG/glA=; b=YKUJkqSvNCx+A237z9caMfkF2ZUIwkXpiCcMIpaaqy8DTvorSllyokN8 03wXKmSAOJZvueDRRRBNF+zllNt/TjILeOhU0s04IzhlE9UQNv0Mb5941 ACNUH+setzFTOVo1fRdjGYLFQ/YJLWzDGGbPY77Ywe0+0402Pz6jASG8u GZijuLfyXTl8nLvXuc7H6COjtSk+zA8PElHk2eEsWrk8oDV88wXqJMv8o T/hmObyNDmjDYTkNlNXVNvWhYUCQwGc/2Qk2sYwJrSXDurBT2PRb60TVu JiMpfF11+jIUxv8ybSchBpptinfUiB5kCS+GGLdbHUQAR8Ur2JAfp4v0h w==; X-CSE-ConnectionGUID: av95oyagSKeHdd3Br+y2RQ== X-CSE-MsgGUID: yWeAHUh8Q+mhtnUzpDwtwQ== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="9503651" X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="9503651" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 11:15:34 -0700 X-CSE-ConnectionGUID: Pm2usB6YTlyIertnoLSiOg== X-CSE-MsgGUID: zoV8luwyT2+F/Vz8ck2PuQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,226,1708416000"; d="scan'208";a="55750223" Received: from agluck-desk3.sc.intel.com ([172.25.222.105]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2024 11:15:34 -0700 From: Tony Luck To: Borislav Petkov , linux-kernel@vger.kernel.org Subject: [PATCH v4 54/71] peci: cpu: Switch to new Intel CPU model defines Date: Wed, 24 Apr 2024 11:15:33 -0700 Message-ID: <20240424181533.42197-1-tony.luck@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240424181245.41141-1-tony.luck@intel.com> References: <20240424181245.41141-1-tony.luck@intel.com> MIME-Version: 1.0 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: openbmc@lists.ozlabs.org, Tony Luck , patches@lists.linux.dev, Iwona Winiarska Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" New CPU #defines encode vendor and family as well as model. N.B. Copy some macros from x86 and the X86_VENDOR_INTEL define from because this code can be built for BMC's that are not based on x86 so accessing those header files is problematic. Signed-off-by: Tony Luck --- include/linux/peci-cpu.h | 24 ++++++++++++++++++++++++ drivers/peci/cpu.c | 28 ++++++++++++++-------------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/include/linux/peci-cpu.h b/include/linux/peci-cpu.h index ff8ae9c26c80..601cdd086bf6 100644 --- a/include/linux/peci-cpu.h +++ b/include/linux/peci-cpu.h @@ -6,6 +6,30 @@ #include +/* Copied from x86 */ +#define X86_VENDOR_INTEL 0 + +/* Copied from x86 */ +#define VFM_MODEL_BIT 0 +#define VFM_FAMILY_BIT 8 +#define VFM_VENDOR_BIT 16 +#define VFM_RSVD_BIT 24 + +#define VFM_MODEL_MASK GENMASK(VFM_FAMILY_BIT - 1, VFM_MODEL_BIT) +#define VFM_FAMILY_MASK GENMASK(VFM_VENDOR_BIT - 1, VFM_FAMILY_BIT) +#define VFM_VENDOR_MASK GENMASK(VFM_RSVD_BIT - 1, VFM_VENDOR_BIT) + +#define VFM_MODEL(vfm) (((vfm) & VFM_MODEL_MASK) >> VFM_MODEL_BIT) +#define VFM_FAMILY(vfm) (((vfm) & VFM_FAMILY_MASK) >> VFM_FAMILY_BIT) +#define VFM_VENDOR(vfm) (((vfm) & VFM_VENDOR_MASK) >> VFM_VENDOR_BIT) + +#define VFM_MAKE(_vendor, _family, _model) ( \ + ((_model) << VFM_MODEL_BIT) | \ + ((_family) << VFM_FAMILY_BIT) | \ + ((_vendor) << VFM_VENDOR_BIT) \ +) +/* End of copied code */ + #include "../../arch/x86/include/asm/intel-family.h" #define PECI_PCS_PKG_ID 0 /* Package Identifier Read */ diff --git a/drivers/peci/cpu.c b/drivers/peci/cpu.c index bd990acd92b8..8e8292c05551 100644 --- a/drivers/peci/cpu.c +++ b/drivers/peci/cpu.c @@ -294,38 +294,38 @@ peci_cpu_probe(struct peci_device *device, const struct peci_device_id *id) static const struct peci_device_id peci_cpu_device_ids[] = { { /* Haswell Xeon */ - .family = 6, - .model = INTEL_FAM6_HASWELL_X, + .family = VFM_FAMILY(INTEL_HASWELL_X), + .model = VFM_MODEL(INTEL_HASWELL_X), .data = "hsx", }, { /* Broadwell Xeon */ - .family = 6, - .model = INTEL_FAM6_BROADWELL_X, + .family = VFM_FAMILY(INTEL_BROADWELL_X), + .model = VFM_MODEL(INTEL_BROADWELL_X), .data = "bdx", }, { /* Broadwell Xeon D */ - .family = 6, - .model = INTEL_FAM6_BROADWELL_D, + .family = VFM_FAMILY(INTEL_BROADWELL_D), + .model = VFM_MODEL(INTEL_BROADWELL_D), .data = "bdxd", }, { /* Skylake Xeon */ - .family = 6, - .model = INTEL_FAM6_SKYLAKE_X, + .family = VFM_FAMILY(INTEL_SKYLAKE_X), + .model = VFM_MODEL(INTEL_SKYLAKE_X), .data = "skx", }, { /* Icelake Xeon */ - .family = 6, - .model = INTEL_FAM6_ICELAKE_X, + .family = VFM_FAMILY(INTEL_ICELAKE_X), + .model = VFM_MODEL(INTEL_ICELAKE_X), .data = "icx", }, { /* Icelake Xeon D */ - .family = 6, - .model = INTEL_FAM6_ICELAKE_D, + .family = VFM_FAMILY(INTEL_ICELAKE_D), + .model = VFM_MODEL(INTEL_ICELAKE_D), .data = "icxd", }, { /* Sapphire Rapids Xeon */ - .family = 6, - .model = INTEL_FAM6_SAPPHIRERAPIDS_X, + .family = VFM_FAMILY(INTEL_SAPPHIRERAPIDS_X), + .model = VFM_MODEL(INTEL_SAPPHIRERAPIDS_X), .data = "spr", }, { }