From patchwork Tue Jul 25 10:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13326303 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2015EC0015E for ; Tue, 25 Jul 2023 10:44:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232598AbjGYKoB (ORCPT ); Tue, 25 Jul 2023 06:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230405AbjGYKoA (ORCPT ); Tue, 25 Jul 2023 06:44:00 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 211D910CC for ; Tue, 25 Jul 2023 03:43:59 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbd33a57dcso52808465e9.0 for ; Tue, 25 Jul 2023 03:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1690281837; x=1690886637; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y2+LOkmbRzocNLGHFc65c1vCZRpwTkaqodGNOPSIAJU=; b=QRAUr/fNWYjB0sOxrI8MMRk87D1j2LMRs7ByIWGHV02Y+iFcHv5AnkKaJ4jo/3WkQQ gTIpW4yMlpTKWW00bLhLpD9HCS08121iceRfhHIFqs4FQoAxpigzlblcApJfliU0DLu1 Fww/vuWbs/HhGvYYWb0vhdVa2Ygo7nbMcT200KrrjHVYquOhuDxB6vu0knKLJaamkmLp ToUTTPiG5CFN1T18MkEQofHAuNUr9aUIqLf7fmmDz8GMJKr0Rfb3QZvr8yZDcaRveY3u mIaZBorI1JvKm28Eb+aGIMu9mZCvSisgna8BS0deWIhMMwlk4OuZgBewSalsTvHtKZ8n Qt+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690281837; x=1690886637; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y2+LOkmbRzocNLGHFc65c1vCZRpwTkaqodGNOPSIAJU=; b=jG1RAr2Dx4prM+kQDZcDZp+uBo7EtNVjiI8YE3MLX2gVwSrsoP2764iE7Wo3nTrOjz bXHN89DVXOtmj2uq9n3TdbMCFBCeZQ1dqSkXt0mvA9ZcDQCdG0BqBy4QCCpur2Y1j7Jj e+kqXEme6YI/Rrxq7OutXMo2S59OGP732gyv57e1P+aJ79ktVY44eD2PDg4MIGH+BupH 6Tn+j4JZF2aTWn8U8jLlHKUxJhAuTChIHbpdN2p1hCncbz8ILpi4enp1uKdBzwMBmYuC N39/349XdrEeTBSziHmQCeBfWj7Ca6UFR4ptUY4gWTaDISBWqYIy6D4AbGHckTJPLi7p uNog== X-Gm-Message-State: ABy/qLYkswP5bjgBISaoCeACZBPNQ64TPt92LAs7qkDBhsZg9NJkMRVG uVRehVOuU/cV5rCvLENldIL8ehtnKikbzikb/c2CtQ== X-Google-Smtp-Source: APBJJlFgnYys6xLwEPqvMSaNFLz0aaGFAQiC1lUMCbKi1QUfpXLwHlZMzXcC3NjQhAM4FS+FHyhNCQ== X-Received: by 2002:a05:600c:2a54:b0:3fb:a917:b769 with SMTP id x20-20020a05600c2a5400b003fba917b769mr9567467wme.21.1690281837646; Tue, 25 Jul 2023 03:43:57 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n12-20020a5d6b8c000000b003143c6e09ccsm15793723wrx.16.2023.07.25.03.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:43:57 -0700 (PDT) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, iwona.winiarska@intel.com, linux@roeck-us.net, jdelvare@suse.com Cc: Naresh Solanki , Patrick Rudolph , openbmc@lists.ozlabs.org Subject: [PATCH v4 1/3] peci: cpu: Add Intel Sapphire Rapids support Date: Tue, 25 Jul 2023 12:43:51 +0200 Message-ID: <20230725104354.33920-1-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Add support for detection of Intel Sapphire Rapids processor based on CPU family & model. Sapphire Rapids Xeon processors with the family set to 6 and the model set to INTEL_FAM6_SAPPHIRERAPIDS_X. The data field for this entry is "spr". Tested the patch series with AST2600 BMC with 4S Intel Sapphire Rapids processors & verified by reading cpu & dimm temperature. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki Reviewed-by: Iwona Winiarska --- Changes in V3: - Move spr entry at end of struct peci_cpu_device_ids - Mention test with the patch. Changes in V2: - Refactored from previous patchset as seperate patch based on subsystem. --- drivers/peci/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) base-commit: 55612007f16b5d7b1fb83a7b0f5bb686829db7c7 diff --git a/drivers/peci/cpu.c b/drivers/peci/cpu.c index de4a7b3e5966..bd990acd92b8 100644 --- a/drivers/peci/cpu.c +++ b/drivers/peci/cpu.c @@ -323,6 +323,11 @@ static const struct peci_device_id peci_cpu_device_ids[] = { .model = INTEL_FAM6_ICELAKE_D, .data = "icxd", }, + { /* Sapphire Rapids Xeon */ + .family = 6, + .model = INTEL_FAM6_SAPPHIRERAPIDS_X, + .data = "spr", + }, { } }; MODULE_DEVICE_TABLE(peci, peci_cpu_device_ids); From patchwork Tue Jul 25 10:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13326304 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31610C001DE for ; Tue, 25 Jul 2023 10:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233186AbjGYKoC (ORCPT ); Tue, 25 Jul 2023 06:44:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjGYKoB (ORCPT ); Tue, 25 Jul 2023 06:44:01 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59FF210E6 for ; Tue, 25 Jul 2023 03:44:00 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-307d20548adso3998755f8f.0 for ; Tue, 25 Jul 2023 03:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1690281839; x=1690886639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wQL70qcpHVJtjXXrjcL8pHbenCmiHSNwdzBLMHcDPF0=; b=PHuasKoTSBC0QMQvXfABeSOEYeM8DDzDnBcVpK7+caqAeBQjHNpkL0tvdC+mm+3RG8 Q5y43essKVx39/Ph5CLC8EcH6jg4PZBifCltmg1gBP3Bk3CgXiMCG4aWoqiwa4FL0k8b yA6cLh8qJOIECYj49SWXVjaFLDW7d1hlnu7UtN62cOrqU8rZSybZ1DDi3btNvM33ZsBI VEDluzb+45ZPixohocX/0fBjgVusO9PsqDD2nuKaRBatCNh8PurponKdcb9EKmT1BxP9 k9NnuICa8rffTW+ipnef/aAMqpQI50ClehaNks1hYJ32fDBUn9ieoUbOfwvua5CZP6h6 XSbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690281839; x=1690886639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wQL70qcpHVJtjXXrjcL8pHbenCmiHSNwdzBLMHcDPF0=; b=PJPr11H1CZk17G+k5cbgPIqAYaUXgOapDNs63eXRrVSuXECiwUJJno9d4OPjO2Eri2 K6mlKEgXRFY3s31EUsxpmfVEcmrkWeLTE06Z3yVjph2pluGPusfglfCl2mGdI6EQu6iC 4KV9LpNW9Lx0st85H+a42N01tuy4sPJAaWnsNNvOGbNCncEJVZHO0ESpgMeXu5zmSn5E VSaqpY2Orlbp6F7Xtb/fWCDi9NWdWFI9WlcunewP2QOKWX1St5hHp4iWfi6wtj9SmEsZ Rvzp+5QNBPjLE3tgOItJzrjEmpQkygNu+DvOxw8o3kQ+g2t2mZhfE8jkm4PytKAamk5X eagQ== X-Gm-Message-State: ABy/qLYkel0JEXaNL/jxBhfqDhkpfKmNW1DD0bw/oLpBd2PejHaDwRya f2VSHzavRzP/Lii2doQmKSAoZ7nZo/n1TF7rXUvi7430 X-Google-Smtp-Source: APBJJlGGRHvBlQf1jjqQ05LnBmIHx3SJKzrmBQUPxZIrjsmSt+Ko0VpcmiGahSEUVSA6Zk2Pzhyj8w== X-Received: by 2002:a5d:53d0:0:b0:313:f33c:24c4 with SMTP id a16-20020a5d53d0000000b00313f33c24c4mr7669482wrw.39.1690281838826; Tue, 25 Jul 2023 03:43:58 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n12-20020a5d6b8c000000b003143c6e09ccsm15793723wrx.16.2023.07.25.03.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:43:58 -0700 (PDT) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, iwona.winiarska@intel.com, linux@roeck-us.net, jdelvare@suse.com Cc: Patrick Rudolph , Naresh Solanki Subject: [PATCH v4 2/3] hwmon: (peci/cputemp) Add Intel Sapphire Rapids support Date: Tue, 25 Jul 2023 12:43:52 +0200 Message-ID: <20230725104354.33920-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104354.33920-1-Naresh.Solanki@9elements.com> References: <20230725104354.33920-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Patrick Rudolph Add support to read DTS for reading Intel Sapphire Rapids platform. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki Acked-by: Guenter Roeck Reviewed-by: Iwona Winiarska --- Chagnes in V3: - Update Acked-by in commit message. Changes in V2: - Refactored from previous patchset as seperate patch based on subsystem. --- drivers/hwmon/peci/cputemp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/hwmon/peci/cputemp.c b/drivers/hwmon/peci/cputemp.c index e5b65a382772..a812c15948d9 100644 --- a/drivers/hwmon/peci/cputemp.c +++ b/drivers/hwmon/peci/cputemp.c @@ -363,6 +363,7 @@ static int init_core_mask(struct peci_cputemp *priv) switch (peci_dev->info.model) { case INTEL_FAM6_ICELAKE_X: case INTEL_FAM6_ICELAKE_D: + case INTEL_FAM6_SAPPHIRERAPIDS_X: ret = peci_ep_pci_local_read(peci_dev, 0, reg->bus, reg->dev, reg->func, reg->offset + 4, &data); if (ret) @@ -531,6 +532,13 @@ static struct resolved_cores_reg resolved_cores_reg_icx = { .offset = 0xd0, }; +static struct resolved_cores_reg resolved_cores_reg_spr = { + .bus = 31, + .dev = 30, + .func = 6, + .offset = 0x80, +}; + static const struct cpu_info cpu_hsx = { .reg = &resolved_cores_reg_hsx, .min_peci_revision = 0x33, @@ -549,6 +557,12 @@ static const struct cpu_info cpu_icx = { .thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree, }; +static const struct cpu_info cpu_spr = { + .reg = &resolved_cores_reg_spr, + .min_peci_revision = 0x40, + .thermal_margin_to_millidegree = &dts_ten_dot_six_to_millidegree, +}; + static const struct auxiliary_device_id peci_cputemp_ids[] = { { .name = "peci_cpu.cputemp.hsx", @@ -574,6 +588,10 @@ static const struct auxiliary_device_id peci_cputemp_ids[] = { .name = "peci_cpu.cputemp.icxd", .driver_data = (kernel_ulong_t)&cpu_icx, }, + { + .name = "peci_cpu.cputemp.spr", + .driver_data = (kernel_ulong_t)&cpu_spr, + }, { } }; MODULE_DEVICE_TABLE(auxiliary, peci_cputemp_ids); From patchwork Tue Jul 25 10:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Solanki X-Patchwork-Id: 13326305 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43D1AC41513 for ; Tue, 25 Jul 2023 10:44:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233287AbjGYKoD (ORCPT ); Tue, 25 Jul 2023 06:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbjGYKoC (ORCPT ); Tue, 25 Jul 2023 06:44:02 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71CC210CC for ; Tue, 25 Jul 2023 03:44:01 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31297125334so3449470f8f.0 for ; Tue, 25 Jul 2023 03:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1690281840; x=1690886640; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eT1M70QmPWlyzzTGWLB186I5SL8oEeXWy/zvh7U5jHs=; b=L87nMl2y4zHHvKG2Q/04w0rgX8wiQVuIlX1wAVjnD/6D7rHkMbT3w1U1NhRm5guLUa BQuKqSr1f0PicazKlUci5tzrYQ7sPCFfkFqLnN8WYgNsXvS3HX3z7hqCC1EbLpux3n8C SuhXu1hSpzKVP91FpSg7VMB14+my8uIISA9x6jrB4rX3+/7NJDp9+vVVIjPVgAi0Pbvb RNARHoLnAoc6Y5n1Y6aeAcjqKwunWAcduAvrFsOYc9APD3Kdm5/kypIUBRdJovFo3RBi 89cM0f2k+yJisuaiAu/tw4s/d0oLwqHACUh/E/cZgCgXlJbp9qK42EoueWccBZiS5FIh FpMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690281840; x=1690886640; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eT1M70QmPWlyzzTGWLB186I5SL8oEeXWy/zvh7U5jHs=; b=L3Nc2WVZCDEL3VBNv7cPLGBZ2/Q+7jtyN7P7ZQ2f1maSASTYjGW4LMhm9idGXzdrlb sef1wy1vSFy4PRasGRD3WJBDmT0ZIfGSE0h+uhCbirQmQTIe+YNSDds6NrIkTeuXJymW qIRXrSHBHQcUB9jidKhzuG2eK1b7sPYRmf7PHM7XCYp/Bkei3GlKU2Pv26WT2aNGGyNo w4gbazDHJbuDeHV373guG+7YeobfBpLafMWaHt+d1hG+LEGNIXIyo4rQfIgX9mcnr2kf CD1mwTyeIF32RL7B/Qdh4b9bl/On4K6ujs8L2IY3z5D3076DVh5DXg/hAcgm2dDqH5o1 cbbA== X-Gm-Message-State: ABy/qLY68rRFSmeKRridlehrv+u4OEHLjP3m+27a58rXBz2Hq2ScH0bO EWqQy4G8J6Mc2Z7EnDPfh2rGIw== X-Google-Smtp-Source: APBJJlGYrXsJBuwSkiRKpG5r9PXBP687z9chJuTDG3nvnLpp3zgOEBxhHUTkRfNKUDSicbyR6/z5fA== X-Received: by 2002:a5d:660d:0:b0:317:6734:c2ae with SMTP id n13-20020a5d660d000000b003176734c2aemr1704572wru.11.1690281840081; Tue, 25 Jul 2023 03:44:00 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id n12-20020a5d6b8c000000b003143c6e09ccsm15793723wrx.16.2023.07.25.03.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 03:43:59 -0700 (PDT) From: Naresh Solanki X-Google-Original-From: Naresh Solanki To: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, iwona.winiarska@intel.com, linux@roeck-us.net, jdelvare@suse.com Cc: Patrick Rudolph , Naresh Solanki Subject: [PATCH v4 3/3] hwmon: (peci/dimmtemp) Add Sapphire Rapids support Date: Tue, 25 Jul 2023 12:43:53 +0200 Message-ID: <20230725104354.33920-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104354.33920-1-Naresh.Solanki@9elements.com> References: <20230725104354.33920-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Patrick Rudolph Extend the functionality of hwmon (peci/dimmtemp) for Sapphire Rapids platform. Add the corresponding Sapphire Rapids ID and threshold code. The patch has been tested on a 4S system with 64 DIMMs installed. Verified read of DIMM temperature thresholds & temperature. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki Acked-by: Guenter Roeck Reviewed-by: Iwona Winiarska --- Changes in V4: - Instead of using hard coded dimm temperature threshold, read from mmio offset. - Change CHAN_RANK_MAX_ON_SPR to 8 - Restore #define CHAN_RANK_MAX to previous assignment. - Update commit message. Changes in V3: - Update Acked-by in commit message. Changes in V2: - Update subject. --- drivers/hwmon/peci/dimmtemp.c | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/hwmon/peci/dimmtemp.c b/drivers/hwmon/peci/dimmtemp.c index ce89da3937a0..5ca4d04e4b14 100644 --- a/drivers/hwmon/peci/dimmtemp.c +++ b/drivers/hwmon/peci/dimmtemp.c @@ -30,6 +30,8 @@ #define DIMM_IDX_MAX_ON_ICX 2 #define CHAN_RANK_MAX_ON_ICXD 4 #define DIMM_IDX_MAX_ON_ICXD 2 +#define CHAN_RANK_MAX_ON_SPR 8 +#define DIMM_IDX_MAX_ON_SPR 2 #define CHAN_RANK_MAX CHAN_RANK_MAX_ON_HSX #define DIMM_IDX_MAX DIMM_IDX_MAX_ON_HSX @@ -534,6 +536,43 @@ read_thresholds_icx(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u return 0; } +static int +read_thresholds_spr(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u32 *data) +{ + u32 reg_val; + u64 offset; + int ret; + u8 dev; + + ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, ®_val); + if (ret || !(reg_val & BIT(31))) + return -ENODATA; /* Use default or previous value */ + + ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, ®_val); + if (ret) + return -ENODATA; /* Use default or previous value */ + + /* + * Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0 + * Device 26, Offset 299a8: IMC 0 channel 1 -> rank 1 + * Device 27, Offset 219a8: IMC 1 channel 0 -> rank 2 + * Device 27, Offset 299a8: IMC 1 channel 1 -> rank 3 + * Device 28, Offset 219a8: IMC 2 channel 0 -> rank 4 + * Device 28, Offset 299a8: IMC 2 channel 1 -> rank 5 + * Device 29, Offset 219a8: IMC 3 channel 0 -> rank 6 + * Device 29, Offset 299a8: IMC 3 channel 1 -> rank 7 + */ + dev = 26 + chan_rank / 2; + offset = 0x219a8 + dimm_order * 4 + (chan_rank % 2) * 0x8000; + + ret = peci_mmio_read(priv->peci_dev, 0, GET_CPU_SEG(reg_val), GET_CPU_BUS(reg_val), + dev, 0, offset, data); + if (ret) + return ret; + + return 0; +} + static const struct dimm_info dimm_hsx = { .chan_rank_max = CHAN_RANK_MAX_ON_HSX, .dimm_idx_max = DIMM_IDX_MAX_ON_HSX, @@ -576,6 +615,13 @@ static const struct dimm_info dimm_icxd = { .read_thresholds = &read_thresholds_icx, }; +static const struct dimm_info dimm_spr = { + .chan_rank_max = CHAN_RANK_MAX_ON_SPR, + .dimm_idx_max = DIMM_IDX_MAX_ON_SPR, + .min_peci_revision = 0x40, + .read_thresholds = &read_thresholds_spr, +}; + static const struct auxiliary_device_id peci_dimmtemp_ids[] = { { .name = "peci_cpu.dimmtemp.hsx", @@ -601,6 +647,10 @@ static const struct auxiliary_device_id peci_dimmtemp_ids[] = { .name = "peci_cpu.dimmtemp.icxd", .driver_data = (kernel_ulong_t)&dimm_icxd, }, + { + .name = "peci_cpu.dimmtemp.spr", + .driver_data = (kernel_ulong_t)&dimm_spr, + }, { } }; MODULE_DEVICE_TABLE(auxiliary, peci_dimmtemp_ids);