qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements
@ 2017-06-16 17:22 Daniel Henrique Barboza
  2017-06-17 15:04 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Henrique Barboza @ 2017-06-16 17:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, david, mdroth

In ppc_spapr_reset(), if the guest is using HPT, the code was executing:

    } else {
        spapr->patb_entry = 0;
        spapr_setup_hpt_and_vrma(spapr);
    }

And, at the end of spapr_setup_hpt_and_vrma:

    /* We're setting up a hash table, so that means we're not radix */
    spapr->patb_entry = 0;

Resulting in spapr->patb_entry being assigned to 0 twice in a row.

Given that 'spapr_setup_hpt_and_vrma' is also called inside
'spapr_check_setup_free_hpt' of spapr_hcall.c, this trivial patch removes
the 'patb_entry = 0' assignment from the 'else' clause inside ppc_spapr_reset
to avoid this behavior.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e877d45..bd31972 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1326,7 +1326,6 @@ static void ppc_spapr_reset(void)
          * Set the GR bit in PATB so that we know there is no HPT. */
         spapr->patb_entry = PATBE1_GR;
     } else {
-        spapr->patb_entry = 0;
         spapr_setup_hpt_and_vrma(spapr);
     }
 
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements
  2017-06-16 17:22 [Qemu-devel] [PATCH] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements Daniel Henrique Barboza
@ 2017-06-17 15:04 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-06-17 15:04 UTC (permalink / raw)
  To: Daniel Henrique Barboza; +Cc: qemu-devel, qemu-ppc, mdroth

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

On Fri, Jun 16, 2017 at 02:22:30PM -0300, Daniel Henrique Barboza wrote:
> In ppc_spapr_reset(), if the guest is using HPT, the code was executing:
> 
>     } else {
>         spapr->patb_entry = 0;
>         spapr_setup_hpt_and_vrma(spapr);
>     }
> 
> And, at the end of spapr_setup_hpt_and_vrma:
> 
>     /* We're setting up a hash table, so that means we're not radix */
>     spapr->patb_entry = 0;
> 
> Resulting in spapr->patb_entry being assigned to 0 twice in a row.
> 
> Given that 'spapr_setup_hpt_and_vrma' is also called inside
> 'spapr_check_setup_free_hpt' of spapr_hcall.c, this trivial patch removes
> the 'patb_entry = 0' assignment from the 'else' clause inside ppc_spapr_reset
> to avoid this behavior.
> 
> Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>

Applied to ppc-for-2.10.

> ---
>  hw/ppc/spapr.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index e877d45..bd31972 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1326,7 +1326,6 @@ static void ppc_spapr_reset(void)
>           * Set the GR bit in PATB so that we know there is no HPT. */
>          spapr->patb_entry = PATBE1_GR;
>      } else {
> -        spapr->patb_entry = 0;
>          spapr_setup_hpt_and_vrma(spapr);
>      }
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-18  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-16 17:22 [Qemu-devel] [PATCH] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements Daniel Henrique Barboza
2017-06-17 15:04 ` David Gibson

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).