All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Scott Wood <scottwood@freescale.com>,
	Mihai Caraman <mihai.caraman@freescale.com>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] KVM: PPC: e500: Emulate power management control SPR
Date: Thu, 03 Jul 2014 12:03:01 +0000	[thread overview]
Message-ID: <53B54675.5040308@suse.de> (raw)
In-Reply-To: <1404152404.2435.132.camel@snotra.buserror.net>


On 30.06.14 20:20, Scott Wood wrote:
> On Mon, 2014-06-30 at 15:55 +0300, Mihai Caraman wrote:
>> For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0)
>> to enable idle power down for cores and devices by setting up the idle count
>> period at boot time. With the host already controlling the power management
>> configuration the guest could simply benefit from it, so emulate guest request
>> as nop.
>>
>> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
>> ---
>>   arch/powerpc/kvm/e500_emulate.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
>> index 002d517..98a22e5 100644
>> --- a/arch/powerpc/kvm/e500_emulate.c
>> +++ b/arch/powerpc/kvm/e500_emulate.c
>> @@ -250,6 +250,10 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
>>   				spr_val);
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		/* Guest relies on host power management configurations */
>> +		break;
>> +
>>   	/* extra exceptions */
>>   	case SPRN_IVOR32:
>>   		vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
>> @@ -355,6 +359,10 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
>>   		*spr_val = 0;
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		*spr_val = 0;
>> +		break;
>> +
>>   	case SPRN_MMUCFG:
>>   		*spr_val = vcpu->arch.mmucfg;
>>   		break;
> When reading, is it better to return zero, or the current host value, or
> the value last written by the guest (even though it wasn't written to
> hardware)?

I think it makes sense to treat it as general storage. I don't think 
leaking the host value into the guest is useful. And while zero works, 
the spec does say that the value gets retained, so I think we should do 
the same.


Alex


WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Scott Wood <scottwood@freescale.com>,
	Mihai Caraman <mihai.caraman@freescale.com>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: e500: Emulate power management control SPR
Date: Thu, 03 Jul 2014 14:03:01 +0200	[thread overview]
Message-ID: <53B54675.5040308@suse.de> (raw)
In-Reply-To: <1404152404.2435.132.camel@snotra.buserror.net>


On 30.06.14 20:20, Scott Wood wrote:
> On Mon, 2014-06-30 at 15:55 +0300, Mihai Caraman wrote:
>> For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0)
>> to enable idle power down for cores and devices by setting up the idle count
>> period at boot time. With the host already controlling the power management
>> configuration the guest could simply benefit from it, so emulate guest request
>> as nop.
>>
>> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
>> ---
>>   arch/powerpc/kvm/e500_emulate.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
>> index 002d517..98a22e5 100644
>> --- a/arch/powerpc/kvm/e500_emulate.c
>> +++ b/arch/powerpc/kvm/e500_emulate.c
>> @@ -250,6 +250,10 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
>>   				spr_val);
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		/* Guest relies on host power management configurations */
>> +		break;
>> +
>>   	/* extra exceptions */
>>   	case SPRN_IVOR32:
>>   		vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
>> @@ -355,6 +359,10 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
>>   		*spr_val = 0;
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		*spr_val = 0;
>> +		break;
>> +
>>   	case SPRN_MMUCFG:
>>   		*spr_val = vcpu->arch.mmucfg;
>>   		break;
> When reading, is it better to return zero, or the current host value, or
> the value last written by the guest (even though it wasn't written to
> hardware)?

I think it makes sense to treat it as general storage. I don't think 
leaking the host value into the guest is useful. And while zero works, 
the spec does say that the value gets retained, so I think we should do 
the same.


Alex

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Scott Wood <scottwood@freescale.com>,
	Mihai Caraman <mihai.caraman@freescale.com>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] KVM: PPC: e500: Emulate power management control SPR
Date: Thu, 03 Jul 2014 14:03:01 +0200	[thread overview]
Message-ID: <53B54675.5040308@suse.de> (raw)
In-Reply-To: <1404152404.2435.132.camel@snotra.buserror.net>


On 30.06.14 20:20, Scott Wood wrote:
> On Mon, 2014-06-30 at 15:55 +0300, Mihai Caraman wrote:
>> For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0)
>> to enable idle power down for cores and devices by setting up the idle count
>> period at boot time. With the host already controlling the power management
>> configuration the guest could simply benefit from it, so emulate guest request
>> as nop.
>>
>> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
>> ---
>>   arch/powerpc/kvm/e500_emulate.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
>> index 002d517..98a22e5 100644
>> --- a/arch/powerpc/kvm/e500_emulate.c
>> +++ b/arch/powerpc/kvm/e500_emulate.c
>> @@ -250,6 +250,10 @@ int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong spr_va
>>   				spr_val);
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		/* Guest relies on host power management configurations */
>> +		break;
>> +
>>   	/* extra exceptions */
>>   	case SPRN_IVOR32:
>>   		vcpu->arch.ivor[BOOKE_IRQPRIO_SPE_UNAVAIL] = spr_val;
>> @@ -355,6 +359,10 @@ int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn, ulong *spr_v
>>   		*spr_val = 0;
>>   		break;
>>   
>> +	case SPRN_PWRMGTCR0:
>> +		*spr_val = 0;
>> +		break;
>> +
>>   	case SPRN_MMUCFG:
>>   		*spr_val = vcpu->arch.mmucfg;
>>   		break;
> When reading, is it better to return zero, or the current host value, or
> the value last written by the guest (even though it wasn't written to
> hardware)?

I think it makes sense to treat it as general storage. I don't think 
leaking the host value into the guest is useful. And while zero works, 
the spec does say that the value gets retained, so I think we should do 
the same.


Alex

  reply	other threads:[~2014-07-03 12:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 12:55 [PATCH] KVM: PPC: e500: Emulate power management control SPR Mihai Caraman
2014-06-30 12:55 ` Mihai Caraman
2014-06-30 12:55 ` Mihai Caraman
2014-06-30 18:20 ` Scott Wood
2014-06-30 18:20   ` Scott Wood
2014-06-30 18:20   ` Scott Wood
2014-07-03 12:03   ` Alexander Graf [this message]
2014-07-03 12:03     ` Alexander Graf
2014-07-03 12:03     ` Alexander Graf

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=53B54675.5040308@suse.de \
    --to=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mihai.caraman@freescale.com \
    --cc=scottwood@freescale.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.