Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1214628

Re: [PATCH 07/15] hwmon, fam15h_power: add ratio of Tsample to the PTSC period

Path csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [PATCH 07/15] hwmon, fam15h_power: add ratio of Tsample to the PTSC period
Date Thu, 27 Aug 2015 17:00:03 +0200
Message-ID <q26OL-7Bf-27@gated-at.bofh.it> (permalink)
References <q26vn-7el-3@gated-at.bofh.it> <q26OL-7Bf-29@gated-at.bofh.it>
X-Original-To Huang Rui <ray.huang@amd.com>, Borislav Petkov <bp@suse.de>, Jean Delvare <jdelvare@suse.de>, Andy Lutomirski <luto@amacapital.net>, Andreas Herrmann <herrmann.der.user@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>, "Rafael J. Wysocki" <rjw@rjwysocki.net>, Len Brown <lenb@kernel.org>, John Stultz <john.stultz@linaro.org>, Frédéric Weisbecker <fweisbec@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=VX4cgt/VdsdrQNyQW76LX3Qkp00U0L612wTMOe50O0o=; b=BGH1gAyGZgTZMfey2qiD9gJTFLFQw54IlcPaLQsl9HZOisKaCo4Jt2c2VEUx/wmX7To6cEh4yCYaRHgCtK0MF3g5q94aQL9oFJohgNVeKNesU+/AylY8+CItfrvDvBEsKnZIIE6SRSNIYKXrKrFNWLiqgU1kgXUQgCEdMt0ckd4=;
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Authenticated_Sender linux@roeck-us.net
X-Outgoing-Spam-Status No, score=0.0
X-Antiabuse This header was added to track abuse, please include it with any abuse report
X-Antiabuse Primary Hostname - bh-25.webhostbox.net
X-Antiabuse Original Domain - vger.kernel.org
X-Antiabuse Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse Sender Address Domain - roeck-us.net
X-Get-Message-Sender-Via bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 68
Organization linux.* mail to news gateway
X-Original-Cc lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org, x86@kernel.org, Andreas Herrmann <herrmann.der.user@googlemail.com>, Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>, Borislav Petkov <bp@alien8.de>, Fengguang Wu <fengguang.wu@intel.com>, Aaron Lu <aaron.lu@intel.com>, Tony Li <tony.li@amd.com>
X-Original-Date Thu, 27 Aug 2015 07:54:30 -0700
X-Original-Message-ID <55DF24A6.5050106@roeck-us.net>
X-Original-References <1440662866-28716-1-git-send-email-ray.huang@amd.com> <1440662866-28716-8-git-send-email-ray.huang@amd.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1214628

Show key headers only | View raw


On 08/27/2015 01:07 AM, Huang Rui wrote:
> This patch adds a member (cpu_pwr_sample_ratio) of fam15h_power_data,
> that represents the ratio of compute unit power accumulator sample
> period to the PTSC counter period.
>
> Tsample: compute unit power accumulator sample period
> Tref: the performance timestamp counter period
> PTSC: performance timestamp counter
>
> Signed-off-by: Huang Rui <ray.huang@amd.com>

Applied to hwmon-next (after fixing spelling error 'detemine').

Thanks,
Guenter

> ---
>   drivers/hwmon/fam15h_power.c | 16 +++++++++++++++-
>   1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> index 55b25ef..d6efcf6 100644
> --- a/drivers/hwmon/fam15h_power.c
> +++ b/drivers/hwmon/fam15h_power.c
> @@ -48,6 +48,7 @@ struct fam15h_power_data {
>   	unsigned int tdp_to_watts;
>   	unsigned int base_tdp;
>   	unsigned int processor_pwr_watts;
> +	unsigned int cpu_pwr_sample_ratio;
>   };
>
>   static ssize_t show_power(struct device *dev,
> @@ -201,7 +202,7 @@ static int fam15h_power_resume(struct pci_dev *pdev)
>   static void fam15h_power_init_data(struct pci_dev *f4,
>   					     struct fam15h_power_data *data)
>   {
> -	u32 val;
> +	u32 val, eax, ebx, ecx, edx;
>   	u64 tmp;
>
>   	pci_read_config_dword(f4, REG_PROCESSOR_TDP, &val);
> @@ -222,6 +223,19 @@ static void fam15h_power_init_data(struct pci_dev *f4,
>
>   	/* convert to microWatt */
>   	data->processor_pwr_watts = (tmp * 15625) >> 10;
> +
> +	cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
> +
> +	/* CPUID Fn8000_0007:EDX[12] indicates to support accumulated power */
> +	if (!(edx & BIT(12)))
> +		return;
> +
> +	/*
> +	 * detemine the ratio of the compute unit power accumulator
> +	 * sample period to the PTSC counter period by executing CPUID
> +	 * Fn8000_0007:ECX
> +	 */
> +	data->cpu_pwr_sample_ratio = ecx;
>   }
>
>   static int fam15h_power_probe(struct pci_dev *pdev,
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 07/15] hwmon, fam15h_power: add ratio of Tsample to the  PTSC period Guenter Roeck <linux@roeck-us.net> - 2015-08-27 17:00 +0200

csiph-web