qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org,
	Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [Qemu-devel] [PATCH 4/5] ppc: Improve PCR bit selection in ppc_set_compat()
Date: Wed, 8 Jun 2016 08:47:22 +0200	[thread overview]
Message-ID: <5757BF7A.8010107@redhat.com> (raw)
In-Reply-To: <20160608011205.GR9226@voom.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 2662 bytes --]

On 08.06.2016 03:12, David Gibson wrote:
> On Tue, Jun 07, 2016 at 05:39:39PM +0200, Thomas Huth wrote:
>> When using an olderr PowerISA level, all the upper compatibility

s/olderr/older/ :-/

>> bits have to be enabled, too. For example when we want to run
>> something in PowerISA 2.05 compatibility mode on POWER8, the bit
>> for 2.06 has to be set beside the bit for 2.05.
>> Additionally, to make sure that we do not set bits that are not
>> supported by the host, we apply a mask with the known-to-be-good
>> bits here, too.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> This one confused me a bit until I realised that, roughly speaking,
> bits in the PCR turn features off, rather than turning features on.
> Does that sound correct?

Right. Turning on the 2.06 bit means "disable all things that have been
added additionally in 2.07", for example. So if you turn on bit 2.05,
but not bit 2.06 (which the old code was doing), I guess you end up in a
strange state where new instructions from PowerISA 2.07 can be used, but
the instructions that have been added in ISA 2.06 are disabled.

>> ---
>>  target-ppc/translate_init.c | 13 +++++++++----
>>  1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
>> index fa09183..ee2bc14 100644
>> --- a/target-ppc/translate_init.c
>> +++ b/target-ppc/translate_init.c
>> @@ -9519,24 +9519,29 @@ void ppc_set_compat(PowerPCCPU *cpu, uint32_t cpu_version, Error **errp)
>>  {
>>      int ret = 0;
>>      CPUPPCState *env = &cpu->env;
>> +    PowerPCCPUClass *host_pcc;
>>  
>>      cpu->cpu_version = cpu_version;
>>  
>>      switch (cpu_version) {
>>      case CPU_POWERPC_LOGICAL_2_05:
>> -        env->spr[SPR_PCR] = PCR_COMPAT_2_05;
>> +        env->spr[SPR_PCR] = PCR_TM_DIS | PCR_VSX_DIS | PCR_COMPAT_2_07 |
>> +                            PCR_COMPAT_2_06 | PCR_COMPAT_2_05;
>>          break;
>>      case CPU_POWERPC_LOGICAL_2_06:
>> -        env->spr[SPR_PCR] = PCR_COMPAT_2_06;
>> -        break;
>>      case CPU_POWERPC_LOGICAL_2_06_PLUS:
>> -        env->spr[SPR_PCR] = PCR_COMPAT_2_06;
>> +        env->spr[SPR_PCR] = PCR_TM_DIS | PCR_COMPAT_2_07 | PCR_COMPAT_2_06;
>>          break;
>>      default:
>>          env->spr[SPR_PCR] = 0;
>>          break;
>>      }
>>  
>> +    host_pcc = kvm_ppc_get_host_cpu_class();
>> +    if (host_pcc) {
>> +        env->spr[SPR_PCR] &= host_pcc->pcr_mask;
>> +    }
>> +
>>      if (kvm_enabled()) {
>>          ret = kvmppc_set_compat(cpu, cpu->cpu_version);
>>          if (ret < 0) {
> 

 Thomas



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-06-08  6:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 15:39 [Qemu-devel] [PATCH 0/5] ppc: Improve sPAPR CPU compatibility mode settings Thomas Huth
2016-06-07 15:39 ` [Qemu-devel] [PATCH 1/5] ppc/spapr: Refactor h_client_architecture_support() CPU parsing code Thomas Huth
2016-06-08  0:33   ` Michael Roth
2016-06-07 15:39 ` [Qemu-devel] [PATCH 2/5] ppc: Split pcr_mask settings into supported bits and the register mask Thomas Huth
2016-06-08  0:34   ` Michael Roth
2016-06-07 15:39 ` [Qemu-devel] [PATCH 3/5] ppc: Provide function to get CPU class of the host CPU Thomas Huth
2016-06-08  0:38   ` Michael Roth
2016-06-07 15:39 ` [Qemu-devel] [PATCH 4/5] ppc: Improve PCR bit selection in ppc_set_compat() Thomas Huth
2016-06-08  1:12   ` David Gibson
2016-06-08  6:47     ` Thomas Huth [this message]
2016-06-08  5:44   ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-06-08  6:59     ` Thomas Huth
2016-06-08  7:24       ` David Gibson
2016-06-08  7:37         ` Thomas Huth
2016-06-07 15:39 ` [Qemu-devel] [PATCH 5/5] ppc: Add PowerISA 2.07 compatibility mode Thomas Huth
2016-06-08  1:11 ` [Qemu-devel] [PATCH 0/5] ppc: Improve sPAPR CPU compatibility mode settings David Gibson

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=5757BF7A.8010107@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).