Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38072775rwd; Wed, 12 Jul 2023 02:36:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbPqGT8aVdBXHT8VUcGyS3YqVOpghkIPKGIYgsJKPYHVnJzzbh/8GvtfBby0i3NPs9KSux X-Received: by 2002:a05:6358:e488:b0:135:6a39:a955 with SMTP id by8-20020a056358e48800b001356a39a955mr8164899rwb.6.1689154580857; Wed, 12 Jul 2023 02:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689154580; cv=none; d=google.com; s=arc-20160816; b=rhZLl+O4g4KeGZXtQiJBPd1d68YQH+U57Al2YqguP/xOcGzS5yYnHzpgxyAZKMY/3x 4EtxbdS5pECvhBKWq0J7prYWwC7X922Va3BBhbR3VYhhFpExhtWo6ZukM3CfVQfkJvHN +GHiTqRFG6lwy2AaDCD//RVeJ5BHWXsytIqyEQT5qUdDt2vNVdKd1wAqKLH1GI9Rx8ef WqUerkUssl8Bptwj3rFE2psQ7ynljJib7FJfEraNk95XgceTOFz0rpP7sWpm/5Q1PpO/ amZVNKpKUbXipxK2/cUk0cbUaGgaCYQR+puq5tCqmVJaDbsnAoMTKbJlssrPnzeJ6+jK cBDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q4ZoGAPYZ8auh+cY1dsqTY2FAmhOhUJEp9FjQd56o+w=; fh=7Czjx7uvNNZ9AID2K8svJQhTcEBkP/LdcXnjC3BIFk4=; b=UjtoEVrSQBIREWPjI2Nl/ScrnlLayMhQ1wFtJo1k27JWvxI2LtyZ9PiCu+8Tu99hMJ 40HxvwCTY3iJ4doH9UfUU/3ZIdBoMN2Pv3M5uElMaAsZxOBIb9x0Mt0A6eRLhkvZAgUN rYmdjlvfGoehu4Sgm8AoCcBS2KHGAXnL60hBNhFfL7niGHIqM5AZKIGTTC/Vky+vV4xK AGehOtRnP1h0qhXHDqrVZnSAASdacaV7/u7GyoHgPT0qiraUu4EkZbh+NSbQXFUXdjEp Lt9s33urnBsh4dSwiMlmowTe5l8EgL8G9hBtezn9gIzdqZ/qGqQ0L+RMwnvle1CYI+0C 9zJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=dvqNet6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a655386000000b00534780446d9si2881756pgq.640.2023.07.12.02.36.08; Wed, 12 Jul 2023 02:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=dvqNet6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232957AbjGLJNK (ORCPT + 99 others); Wed, 12 Jul 2023 05:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbjGLJMy (ORCPT ); Wed, 12 Jul 2023 05:12:54 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C2E1BB for ; Wed, 12 Jul 2023 02:12:52 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4fb7dc16ff0so10463131e87.2 for ; Wed, 12 Jul 2023 02:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1689153170; x=1691745170; 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=Q4ZoGAPYZ8auh+cY1dsqTY2FAmhOhUJEp9FjQd56o+w=; b=dvqNet6tpnktRGtOqzbtsVLpj/bfeHpughlaL3oKMVMMLyJVS2VbOXxFOoQcjHaw5Q MGIrOYLAfDkrECTvPuokDmFvHBWum2prAlWUJk6EkSaeywvahuyjPN9Jq2px5kCLXJMe DTsK+ymPr4+epiKI1oyPCTmuKrNXcWSh1DUQyYFBiwy4MgfMxISiHEjnAK6m/wzPcgUj 4A+7jUysHPi7csWV3Z/H4fXL/az/tflwcUMEOpTe29lTUfTDfCMwQlZ33m+WD/WxTzEF qnUPrCxE9rjjZmlsE4GdF6bRoOH3r24nKcfrrDIdWa8TMdv5ceXbknxMoyK+VLMWEQbX SsLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689153170; x=1691745170; 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=Q4ZoGAPYZ8auh+cY1dsqTY2FAmhOhUJEp9FjQd56o+w=; b=lcAXpfUXahrFpvhUrRr9o8nHNjq396Q1kp4LiMjy/PRiyE2+ljdVH/QVCHVupp3jHj lDS0tAF2ZXOH9824KWPoUPNhrC6CuoKRlQG0csImmdNJzzNemAVjrpI1RPTsl7gNQH19 ZG0G9/lwxZIkmZovRG16Cz5XW4i7peJkxNIJen6G/jS/X0wtrumyJOgj/214dwy2R5JW TBV/HJhyyc3qHzCKVlT8600/rS4Tei3kek7MgFzZ5AvU/AlZszJ7yCouK2y86kHAgYky GCy723JbEGdyg1QEytyL7l3BdJkzyYyVmym8mZt+gEScA609ckYPDnOvReXp0BhpEt+G QCmw== X-Gm-Message-State: ABy/qLblgebKbU7jAs3vvQ36rQ64555OfuDIv3YzUZwtUcEzAJuOqnO/ qguiP9QtvPEZfhhI9JW5uBWiv0payW18uK0bXdUacg== X-Received: by 2002:ac2:4c49:0:b0:4f8:6b7f:c6d6 with SMTP id o9-20020ac24c49000000b004f86b7fc6d6mr18579724lfk.48.1689153169817; Wed, 12 Jul 2023 02:12:49 -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 y11-20020a05600c364b00b003f90b9b2c31sm15013711wmq.28.2023.07.12.02.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 02:12:49 -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 v2 3/3] hwmon: (peci/dimmtemp) Add Sapphire Rapids support Date: Wed, 12 Jul 2023 11:12:40 +0200 Message-ID: <20230712091241.3668454-3-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230712091241.3668454-1-Naresh.Solanki@9elements.com> References: <20230712091241.3668454-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrick Rudolph This patch extends the functionality of the hwmon (peci/dimmtemp) to include support for Sapphire Rapids platform. Sapphire Rapids can accommodate up to 8 CPUs, each with 16 DIMMs. To accommodate this configuration, the maximum supported DIMM count is increased, and the corresponding Sapphire Rapids ID and threshold code are added. The patch has been tested on a 4S system with 64 DIMMs installed. Default thresholds are utilized for Sapphire Rapids, as accessing the threshold requires accessing the UBOX device on Uncore bus 0, which can only be achieved using MSR access. The non-PCI-compliant MMIO BARs are not available for this purpose. Signed-off-by: Patrick Rudolph Signed-off-by: Naresh Solanki --- Changes in V2: - Update subject. --- drivers/hwmon/peci/dimmtemp.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/peci/dimmtemp.c b/drivers/hwmon/peci/dimmtemp.c index ed968401f93c..edafbfd66fef 100644 --- a/drivers/hwmon/peci/dimmtemp.c +++ b/drivers/hwmon/peci/dimmtemp.c @@ -30,8 +30,10 @@ #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 128 +#define DIMM_IDX_MAX_ON_SPR 2 -#define CHAN_RANK_MAX CHAN_RANK_MAX_ON_HSX +#define CHAN_RANK_MAX CHAN_RANK_MAX_ON_SPR #define DIMM_IDX_MAX DIMM_IDX_MAX_ON_HSX #define DIMM_NUMS_MAX (CHAN_RANK_MAX * DIMM_IDX_MAX) @@ -530,6 +532,15 @@ 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) +{ + /* Use defaults */ + *data = (95 << 16) | (90 << 8); + + 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, @@ -572,6 +583,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", @@ -597,6 +615,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); -- 2.41.0