linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
To: Joel Stanley <joel@jms.id.au>
Cc: rjw@rjwysocki.net, viresh.kumar@linaro.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@ozlabs.org
Subject: Re: [PATCH v4 3/6] cpufreq: powernv: Register for OCC related opal_message notification
Date: Wed, 15 Jul 2015 15:45:41 +0530	[thread overview]
Message-ID: <55A632CD.7060500@linux.vnet.ibm.com> (raw)
In-Reply-To: <1436941021.17171.12.camel@jms.id.au>

Hi Joel,

On 07/15/2015 11:47 AM, Joel Stanley wrote:
> Hello,
> 
> On Mon, 2015-07-13 at 19:39 +0530, Shilpasri G Bhat wrote:
>> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
>> index d0c18c9..1f59958 100644
>> --- a/drivers/cpufreq/powernv-cpufreq.c
>> +++ b/drivers/cpufreq/powernv-cpufreq.c
>> @@ -414,6 +415,71 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {
>>  	.notifier_call = powernv_cpufreq_reboot_notifier,
>>  };
>>  
>> +static char throttle_reason[][30] = {
>> +					"No throttling",
>> +					"Power Cap",
>> +					"Processor Over Temperature",
>> +					"Power Supply Failure",
>> +					"Over Current",
>> +					"OCC Reset"
>> +				     };
>> +
>> +static int powernv_cpufreq_occ_msg(struct notifier_block *nb,
>> +				   unsigned long msg_type, void *_msg)
>> +{
>> +	struct opal_msg *msg = _msg;
>> +	struct opal_occ_msg omsg;
>> +
>> +	if (msg_type != OPAL_MSG_OCC)
>> +		return 0;
>> +
>> +	memcpy(&omsg, msg->params, sizeof(omsg));
> 
> You need to ensure the of the members of struct opal_occ_msg are in the
> correct byte order when copying them over.
> 
> Have you tested this code with in a little endian configuration?

Ah yes this wont work in LE.
I tested the below diff in both BE/LE configuration on Power8 box which has FSP.

-       memcpy(&omsg, msg->params, sizeof(omsg));
+       omsg.type = be64_to_cpu(msg->params[0]);
+       omsg.chip = be64_to_cpu(msg->params[1]);
+       omsg.throttle_status = be64_to_cpu(msg->params[2]);
> 
> Do the messages you're sending make sense for a system that has a BMC
> instead of a FSP?

For a system with BMC, only OCC_THROTTLE will be received by the host. The
remaining two (OCC_RESET and OCC_LOAD) are sent only in FSP based systems.
OCC_THROTTLE is sent by opal which polls on the throttle_status byte in the
OPAL-OCC shared memory region.

> 
> Cheers,
> 
> Joel
> 

Thanks and Regards,
Shilpa

  reply	other threads:[~2015-07-15 10:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13 14:09 [PATCH v4 0/6] powernv: cpufreq: Report frequency throttle by OCC Shilpasri G Bhat
2015-07-13 14:09 ` [PATCH v4 1/6] cpufreq: powernv: Handle throttling due to Pmax capping at chip level Shilpasri G Bhat
2015-07-13 14:09 ` [PATCH v4 2/6] powerpc/powernv: Add definition of OPAL_MSG_OCC message type Shilpasri G Bhat
2015-07-13 14:09 ` [PATCH v4 3/6] cpufreq: powernv: Register for OCC related opal_message notification Shilpasri G Bhat
2015-07-15  6:17   ` Joel Stanley
2015-07-15 10:15     ` Shilpasri G Bhat [this message]
2015-07-13 14:10 ` [PATCH v4 4/6] cpufreq: powernv: Call throttle_check() on receiving OCC_THROTTLE Shilpasri G Bhat
2015-07-13 14:10 ` [PATCH v4 5/6] cpufreq: powernv: Report Psafe only if PMSR.psafe_mode_active bit is set Shilpasri G Bhat
2015-07-13 14:10 ` [PATCH v4 6/6] cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling Shilpasri G Bhat
2015-07-16  5:14 ` [PATCH v4 0/6] powernv: cpufreq: Report frequency throttle by OCC Viresh Kumar

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=55A632CD.7060500@linux.vnet.ibm.com \
    --to=shilpa.bhat@linux.vnet.ibm.com \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).