All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Zhao Yakui <yakui.zhao@intel.com>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [Patch_4/4] :Add MSR support for T-States
Date: Wed, 14 Nov 2007 22:22:15 -0500	[thread overview]
Message-ID: <200711142222.15583.lenb@kernel.org> (raw)
In-Reply-To: <1194483443.9610.7.camel@yakui_zhao.sh.intel.com>

On Wednesday 07 November 2007 19:57, Zhao Yakui wrote:
> Subject: ACPI : Add MSR support for T-States
> >From : Zhao Yakui <yakui.zhao@intel.com>
>  
> Add throttling control via MSR when T-states uses the FixHW Control/
> Status registers.
> 
> 
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> Signed-off-by: Li Shaohua <shaohua.li@intel.com>
> 
> ---
>  arch/x86/kernel/acpi/processor.c    |    3 +
>  drivers/acpi/processor_throttling.c |   72 ++++++++++++++++++++++++++++++++++--
>  2 files changed, 71 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6.24-rc1/drivers/acpi/processor_throttling.c
> ===================================================================
> --- linux-2.6.24-rc1.orig/drivers/acpi/processor_throttling.c
> +++ linux-2.6.24-rc1/drivers/acpi/processor_throttling.c
> @@ -391,6 +391,71 @@ static int acpi_processor_get_throttling
>  
>  	return 0;
>  }
> +#ifdef CONFIG_X86
> +static int acpi_throttling_rdmsr(struct acpi_processor *pr,
> +                                        acpi_integer * value)
> +{
> +        struct cpuinfo_x86 *c;
> +        u64 msr_high, msr_low;
> +        unsigned int cpu;
> +        u64 msr = 0;
> +        int ret = -1;
> +
> +	cpu = pr->id;
> +	c = &cpu_data(cpu);
> +
> +	if ((c->x86_vendor != X86_VENDOR_INTEL) ||
> +		!cpu_has(c, X86_FEATURE_ACPI)) {
> +		printk(KERN_ERR PREFIX
> +			"HARDWARE addr space,NOT supported yet\n");
> +	} else {
> +		msr_low = 0;
> +		msr_high = 0;
> +		rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
> +			(u32 *)&msr_low , (u32 *) &msr_high);
> +		msr = (msr_high << 32) | msr_low;
> +		*value = (acpi_integer) msr;
> +		ret = 0;
> +	}
> +	return ret;
> +}
> +static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
> +{
> +	struct cpuinfo_x86 *c;
> +	unsigned int cpu;
> +	int ret = -1;
> +	u64 msr;
> +
> +	cpu = pr->id;
> +	c = &cpu_data(cpu);
> +
> +	if ((c->x86_vendor != X86_VENDOR_INTEL) ||
> +		!cpu_has(c, X86_FEATURE_ACPI)) {
> +		printk(KERN_ERR PREFIX
> +			"HARDWARE addr space,NOT supported yet\n");
> +	} else {
> +		msr = value;
> +		wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
> +			msr & 0xffffffff, msr >> 32);
> +		ret = 0;
> +	}
> +	return ret;
> +}
> +#else
> +static int acpi_throttling_rdmsr(struct acpi_processor *pr,
> +				acpi_integer * value)
> +{
> +	printk(KERN_ERR PREFIX
> +		"HARDWARE addr space,NOT supported yet\n");
> +	return -1;
> +}
> +static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
> +{
> +	printk(KERN_ERR PREFIX
> +		"HARDWARE addr space,NOT supported yet\n");
> +	return -1;
> +}
> +#endif
>  
>  static int acpi_read_throttling_status(struct acpi_processor *pr,
>  						acpi_integer *value)
> @@ -415,8 +480,7 @@ static int acpi_read_throttling_status(s
>  		ret = 0;
>  		break;
>  	case ACPI_ADR_SPACE_FIXED_HARDWARE:
> -		printk(KERN_ERR PREFIX
> -		       "HARDWARE addr space,NOT supported yet\n");
> +		ret = acpi_throttling_rdmsr(pr, value);
>  		break;
>  	default:
>  		printk(KERN_ERR PREFIX "Unknown addr space %d\n",
> @@ -449,8 +513,7 @@ static int acpi_write_throttling_state(s
>  		ret = 0;
>  		break;
>  	case ACPI_ADR_SPACE_FIXED_HARDWARE:
> -		printk(KERN_ERR PREFIX
> -		       "HARDWARE addr space,NOT supported yet\n");
> +		ret = acpi_throttling_wrmsr(pr, value);
>  		break;
>  	default:
>  		printk(KERN_ERR PREFIX "Unknown addr space %d\n",
> @@ -504,6 +567,7 @@ static int acpi_processor_get_throttling
>  
>  	pr->throttling.state = 0;
>  	local_irq_disable();
> +	value = 0;

but this patch doesn't _use_ value -- should it have been initialized
in a previous patch?

>  	ret = acpi_read_throttling_status(pr, &value);
>  	if (ret >= 0) {
>  		state = acpi_get_throttling_state(pr, value);
> Index: linux-2.6.24-rc1/arch/x86/kernel/acpi/processor.c
> ===================================================================
> --- linux-2.6.24-rc1.orig/arch/x86/kernel/acpi/processor.c
> +++ linux-2.6.24-rc1/arch/x86/kernel/acpi/processor.c
> @@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_p
>  	if (cpu_has(c, X86_FEATURE_EST))
>  		buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
>  
> +	if (cpu_has(c, X86_FEATURE_ACPI))
> +		buf[2] |= ACPI_PDC_T_FFH;
> +
>  	obj->type = ACPI_TYPE_BUFFER;
>  	obj->buffer.length = 12;
>  	obj->buffer.pointer = (u8 *) buf;
> 

  reply	other threads:[~2007-11-15  3:22 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08  3:35 [PATCH] ACPI:avoid printing the error message that processor device is not present Zhao Yakui
2007-10-10  3:43 ` Len Brown
2007-10-15  1:19   ` Zhao Yakui
2007-11-07 12:34   ` [PATCH_1/4] :Add the _TPC throttling limit for TSS Zhao Yakui
2007-11-07 12:34   ` [PATCH_2/4] : Modify the ACPI I/O Access width Zhao Yakui
2007-11-07 12:35   ` [Patch_3/4]:Throttling control uses T-states returned by _TSS when _TSS exists Zhao Yakui
2007-11-07 12:35   ` [Patch_4/4] :Add MSR support for T-States Zhao Yakui
2007-11-08  0:56   ` [PATCH_1/4] :Add the _TPC throttling limit for TSS Zhao Yakui
2007-11-15  2:52     ` Len Brown
2007-11-08  0:56   ` [PATCH_2/4] : Modify the ACPI I/O Access width Zhao Yakui
2007-11-08  0:57   ` [Patch_3/4]:Throttling control uses T-states returned by _TSS when _TSS exists Zhao Yakui
2007-11-08  0:57   ` [Patch_4/4] :Add MSR support for T-States Zhao Yakui
2007-11-15  3:22     ` Len Brown [this message]
2007-11-08  1:25   ` [PATCH] [ACPI ]: Init PDC before getting throttling info Zhao Yakui
2007-11-15  8:41   ` [PATCH_2/7] : Modify the ACPI I/O Access width Zhao Yakui
2007-11-15  8:41   ` [Patch_3/7] ACPI: Not use calculated T-states from FADT.duty_width when _TSS exists Zhao Yakui
2007-11-15  8:41   ` [Patch_4/7] :Change the function interface for throttling control via PTC Zhao Yakui
2007-11-15  8:42   ` [Patch_5/7 ] :Throttling control uses T-states returned by _TSS when _TSS exists Zhao Yakui
2007-11-15  8:59   ` [PATCH_1/7] ACPI: Add the _TPC throttling limit for TSS Zhao Yakui
2007-11-15  9:01   ` [PATCH_2/7] ACPI: Modify the ACPI I/O Access width Zhao Yakui
2007-11-15  9:02   ` [PATCH_3/7] ACPI: Not use calculated T-states from FADT.duty_width when _TSS exists Zhao Yakui
2007-11-15  9:03   ` [PATCH_4/7] ACPI: Change the function interface for throttling control via PTC Zhao Yakui
2007-11-15  9:05   ` [PATCH_5/7] ACPI: Throttling control uses T-states returned by _TSS when _TSS exists Zhao Yakui
2007-11-15  9:05   ` [PATCH_6/7] ACPI: Init PDC before getting throttling info Zhao Yakui
2007-11-15  9:06   ` [PATCH_7/7] ACPI: Add MSR support for T-States Zhao Yakui
2007-11-15  9:18   ` [PATCH] ACPI: Disable all GPEs before re-enable interrupts Zhao Yakui
2008-05-09  9:22   ` Subject:ACPI: Send the reserved AC notification event to user space Zhao Yakui
2008-05-14  0:55     ` Len Brown
2008-05-14  2:47       ` Zhao Yakui
2008-05-14 23:04         ` Len Brown
2008-05-15 13:55           ` Zhao Yakui
2008-05-14  3:32   ` [PATCH]: ACPI: Disable Fixed_RTC event when installing RTC handler Zhao Yakui
2008-05-14  4:33     ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711142222.15583.lenb@kernel.org \
    --to=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=yakui.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.