qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@linux.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	"Maxiwell S. Garcia" <maxiwell@linux.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] target/ppc: fix memory dump endianness in QEMU monitor
Date: Mon, 23 Dec 2019 20:27:49 -0300	[thread overview]
Message-ID: <875zi6fwqy.fsf@linux.ibm.com> (raw)
In-Reply-To: <20191223063043.GH38380@umbus.modem>

David Gibson <david@gibson.dropbear.id.au> writes:

> b) AFAICT this is the *only* thing that looks for the LE bit in
> hflags. Given that, and the fact that it would be wrong in most cases,
> we should remove it from hflags entirely along with this change.
>

I see there is:

static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
{
    ...
    ctx->le_mode = !!(env->hflags & (1 << MSR_LE));
    ...
}

And we call hreg_recompute_hflags in some places:

- powerpc_excp (target/ppc/excp_helper.c)
  Called from TCG do_interrupt

- ppc_cpu_reset (target/ppc/translate_init.inc.c)
  Called from spapr_machine_reset

- hreg_store_msr (target/ppc/helper_regs.h)
  This is used for migration and for do_rfi, store_msr

- h_cede (hw/ppc/spapr_hcall.c)
  QEMU-side H_CEDE hypercall implementation 


It looks like the hflags MSR_LE is being updated correctly with TCG. But
with KVM we only touch it on system_reset (and possibly h_cede? I don't
know if it is QEMU who handles it).

So I would let hflags be.


... Actually, I don't really know the purpose of hflags. It comes from:

  commit 3f3373166227b13e762e20d2fb51eadfa6a2d653
  Author: Fabrice Bellard <fabrice@bellard.org>
  Date:   Wed Aug 20 23:02:09 2003 +0000
  
      pop ss, mov ss, x and sti disable irqs for the next instruction -
      began dispatch optimization by adding new x86 cpu 'hidden' flags
      
      
      git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@372 c046a42c-6fe2-441c-8c8c-71466251a162

Could any one clarify that?

Thanks

>> ---
>>  target/ppc/translate_init.inc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
>> index d33d65dff7..a0b384da9e 100644
>> --- a/target/ppc/translate_init.inc.c
>> +++ b/target/ppc/translate_init.inc.c
>> @@ -10830,7 +10830,7 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
>>      PowerPCCPU *cpu = POWERPC_CPU(cs);
>>      CPUPPCState *env = &cpu->env;
>>  
>> -    if ((env->hflags >> MSR_LE) & 1) {
>> +    if (msr_le) {
>>          info->endian = BFD_ENDIAN_LITTLE;
>>      }
>>      info->mach = env->bfd_mach;


  parent reply	other threads:[~2019-12-23 23:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 16:38 [PATCH] target/ppc: fix memory dump endianness in QEMU monitor Maxiwell S. Garcia
2019-12-23  6:30 ` David Gibson
2019-12-23 21:35   ` Maxiwell S. Garcia
2019-12-24  5:10     ` David Gibson
2019-12-23 23:27   ` Fabiano Rosas [this message]
2019-12-24  5:19     ` David Gibson
2019-12-24 16:10       ` Fabiano Rosas
2019-12-26  1:54         ` 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=875zi6fwqy.fsf@linux.ibm.com \
    --to=farosas@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=maxiwell@linux.ibm.com \
    --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).