Skip to contentSkip to conversation

hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements

PATCH Applied Daniel Henrique Barboza 2 participants 2 messages Jun 16, 2017 – Jun 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements

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.

---
 hw/ppc/spapr.c | 1 -
 1 file changed, 1 deletion(-)
hw/ppc/spapr.c +0 -1
index e877d45..bd31972 100644
@@ -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);
     }
 
Signature · 1 line
2.9.4
Applied
#1 lore raw
Quoted 12 lines · Daniel Henrique Barboza

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;
Quoted 8 lines

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.

Applied to ppc-for-2.10.

Quoted 16 lines
---
 hw/ppc/spapr.c | 1 -
 1 file changed, 1 deletion(-)
hw/ppc/spapr.c +0 -1
index e877d45..bd31972 100644
@@ -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);
     }
 
Signature · 4 lines
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