Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9283572pxu; Mon, 28 Dec 2020 11:20:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvcfeBlmB5nRSW8Vy6WcEg6348icv6qL2MJR+3Vnk8s9dER6Lc3rVRfqKFhQV9prhm4+3Z X-Received: by 2002:a50:f404:: with SMTP id r4mr43399112edm.62.1609183242628; Mon, 28 Dec 2020 11:20:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609183242; cv=none; d=google.com; s=arc-20160816; b=EZE9eM+5wMs5HIaFLkOK6l4Og+ezAH4Xb/CYTcPe2VNUTtY/idk+Jox8yMlnZ4I2FM cjG544OFvC7l1iOYShwjDYs2uxfboOWxKgbEcOxHkjXolg8XW4e2LCiNJfHVpsiW9Qg+ m/n+FDkLJFoTSOsxl93zTEzsQSvMU7Yn82UKBo1Tnqf3/AC+eOrwy02vl6d46rAieRGx SHdVLue2OZSkvtNOXuZ1cDJfQoGGJ7dAAfF06A2ZUOiv4yUwKpgSujWDcnULw3W1/1lF uX27yYUfRiOOGwre62YbCWRj7z3nT+zac4Y///xhXABf/jWgogIrLRtUHSmOmUCuCiqE crTw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iGZKQTwqX/7fOBmJyhHAONMMvl5xsKfywIT6/zM1ZUk=; b=etSjFEyfSsDP1iZ0b5NnjdWSbJYZaxzOEd7PnwHL0rn4txrnOOLAccPmxUosUqaw9m xrIG3n6DL8LP3Y4FGJvh5r/+FDzlQcffuGqwfveWhEvtMdxa8ho3sJ2HiWeu7Unis8tE +oh7kimo/WnZjIKYyNfovxiVtLmsI5mc/pomNRgni0+6qIKUmfFsVD3CWppEa4U8tEsf SQ9rcTn4O59wR7TPppEWGqxYLSDLL1BaynmqyES7BWPHFdXqkEK59oHt4vnOdEsMPHrv uaMkUn1Hx120ydZLdB9i48SEN5HMHA9XNRKxUktJMD10jfiVDmunsN+kGJfZnnpC/H50 SjJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rHr3Iu4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si19158458ejh.224.2020.12.28.11.20.20; Mon, 28 Dec 2020 11:20:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rHr3Iu4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407618AbgL1N71 (ORCPT + 99 others); Mon, 28 Dec 2020 08:59:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:32768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407910AbgL1N7Q (ORCPT ); Mon, 28 Dec 2020 08:59:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84783207A9; Mon, 28 Dec 2020 13:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163941; bh=13Jd/DXuJbGSVunn27AfmRjke9PfKRxKU/B0vebFACw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rHr3Iu4Kp5SD3of2pqSI60EhfmqxFlRGKf9OTJk5c4GR3SkqBR20/VFOaYBeeQx2D YCRE89gxMUpHZGIhffPZsr+eOBFF3t3semiqcatGsJ9Pq8GcKsg29sTp+vbdIUrOBZ xGZelRZ1BouD43JmQmRTC313o8oCXqydI8kGo308= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Artem S. Tashkinov" , Wei Huang , Guenter Roeck Subject: [PATCH 5.10 001/717] hwmon: (k10temp) Remove support for displaying voltage and current on Zen CPUs Date: Mon, 28 Dec 2020 13:39:59 +0100 Message-Id: <20201228125021.047814624@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guenter Roeck commit 0a4e668b5d52eed8026f5d717196b02b55fb2dc6 upstream. Voltages and current are reported by Zen CPUs. However, the means to do so is undocumented, changes from CPU to CPU, and the raw data is not calibrated. Calibration information is available, but again not documented. This results in less than perfect user experience, up to concerns that loading the driver might possibly damage the hardware (by reporting out-of range voltages). Effectively support for reporting voltages and current is not maintainable. Drop it. Cc: Artem S. Tashkinov Cc: Wei Huang Tested-by: Wei Huang Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/k10temp.c | 98 ------------------------------------------------ 1 file changed, 98 deletions(-) --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c @@ -11,13 +11,6 @@ * convert raw register values is from https://github.com/ocerman/zenpower. * The information is not confirmed from chip datasheets, but experiments * suggest that it provides reasonable temperature values. - * - Register addresses to read chip voltage and current are also from - * https://github.com/ocerman/zenpower, and not confirmed from chip - * datasheets. Current calibration is board specific and not typically - * shared by board vendors. For this reason, current values are - * normalized to report 1A/LSB for core current and and 0.25A/LSB for SoC - * current. Reported values can be adjusted using the sensors configuration - * file. */ #include @@ -109,10 +102,7 @@ struct k10temp_data { int temp_offset; u32 temp_adjust_mask; u32 show_temp; - u32 svi_addr[2]; bool is_zen; - bool show_current; - int cfactor[2]; }; #define TCTL_BIT 0 @@ -137,16 +127,6 @@ static const struct tctl_offset tctl_off { 0x17, "AMD Ryzen Threadripper 29", 27000 }, /* 29{20,50,70,90}[W]X */ }; -static bool is_threadripper(void) -{ - return strstr(boot_cpu_data.x86_model_id, "Threadripper"); -} - -static bool is_epyc(void) -{ - return strstr(boot_cpu_data.x86_model_id, "EPYC"); -} - static void read_htcreg_pci(struct pci_dev *pdev, u32 *regval) { pci_read_config_dword(pdev, REG_HARDWARE_THERMAL_CONTROL, regval); @@ -211,16 +191,6 @@ static const char *k10temp_temp_label[] "Tccd8", }; -static const char *k10temp_in_label[] = { - "Vcore", - "Vsoc", -}; - -static const char *k10temp_curr_label[] = { - "Icore", - "Isoc", -}; - static int k10temp_read_labels(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, const char **str) @@ -229,50 +199,6 @@ static int k10temp_read_labels(struct de case hwmon_temp: *str = k10temp_temp_label[channel]; break; - case hwmon_in: - *str = k10temp_in_label[channel]; - break; - case hwmon_curr: - *str = k10temp_curr_label[channel]; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static int k10temp_read_curr(struct device *dev, u32 attr, int channel, - long *val) -{ - struct k10temp_data *data = dev_get_drvdata(dev); - u32 regval; - - switch (attr) { - case hwmon_curr_input: - amd_smn_read(amd_pci_dev_to_node_id(data->pdev), - data->svi_addr[channel], ®val); - *val = DIV_ROUND_CLOSEST(data->cfactor[channel] * - (regval & 0xff), - 1000); - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static int k10temp_read_in(struct device *dev, u32 attr, int channel, long *val) -{ - struct k10temp_data *data = dev_get_drvdata(dev); - u32 regval; - - switch (attr) { - case hwmon_in_input: - amd_smn_read(amd_pci_dev_to_node_id(data->pdev), - data->svi_addr[channel], ®val); - regval = (regval >> 16) & 0xff; - *val = DIV_ROUND_CLOSEST(155000 - regval * 625, 100); - break; default: return -EOPNOTSUPP; } @@ -331,10 +257,6 @@ static int k10temp_read(struct device *d switch (type) { case hwmon_temp: return k10temp_read_temp(dev, attr, channel, val); - case hwmon_in: - return k10temp_read_in(dev, attr, channel, val); - case hwmon_curr: - return k10temp_read_curr(dev, attr, channel, val); default: return -EOPNOTSUPP; } @@ -383,11 +305,6 @@ static umode_t k10temp_is_visible(const return 0; } break; - case hwmon_in: - case hwmon_curr: - if (!data->show_current) - return 0; - break; default: return 0; } @@ -517,20 +434,10 @@ static int k10temp_probe(struct pci_dev case 0x8: /* Zen+ */ case 0x11: /* Zen APU */ case 0x18: /* Zen+ APU */ - data->show_current = !is_threadripper() && !is_epyc(); - data->svi_addr[0] = F17H_M01H_SVI_TEL_PLANE0; - data->svi_addr[1] = F17H_M01H_SVI_TEL_PLANE1; - data->cfactor[0] = F17H_M01H_CFACTOR_ICORE; - data->cfactor[1] = F17H_M01H_CFACTOR_ISOC; k10temp_get_ccd_support(pdev, data, 4); break; case 0x31: /* Zen2 Threadripper */ case 0x71: /* Zen2 */ - data->show_current = !is_threadripper() && !is_epyc(); - data->cfactor[0] = F17H_M31H_CFACTOR_ICORE; - data->cfactor[1] = F17H_M31H_CFACTOR_ISOC; - data->svi_addr[0] = F17H_M31H_SVI_TEL_PLANE0; - data->svi_addr[1] = F17H_M31H_SVI_TEL_PLANE1; k10temp_get_ccd_support(pdev, data, 8); break; } @@ -542,11 +449,6 @@ static int k10temp_probe(struct pci_dev switch (boot_cpu_data.x86_model) { case 0x0 ... 0x1: /* Zen3 */ - data->show_current = true; - data->svi_addr[0] = F19H_M01_SVI_TEL_PLANE0; - data->svi_addr[1] = F19H_M01_SVI_TEL_PLANE1; - data->cfactor[0] = F19H_M01H_CFACTOR_ICORE; - data->cfactor[1] = F19H_M01H_CFACTOR_ISOC; k10temp_get_ccd_support(pdev, data, 8); break; }