Skip to contentSkip to conversation

PPC: E500: Set PIR default reset value rather than SPR value

PATCH In review Alexander Graf 5 participants 7 messages Apr 3, 2014 – Apr 4, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: E500: Set PIR default reset value rather than SPR value

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +1 -1
index d7ba25f..f984b3e 100644
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
         input = (qemu_irq *)env->irq_inputs;
         irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
         irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
         env->mpic_iack = MPC8544_CCSRBAR_BASE +
                          MPC8544_MPIC_REGS_OFFSET + 0xa0;
 
Signature · 1 line
1.8.1.4
#1 lore raw

Am 03.04.2014 20:48, schrieb Alexander Graf:

Quoted 7 lines

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

Quoted 10 lines
---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +0 -0
index d7ba25f..f984b3e 100644

hw/ppc/e500.c void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params) · line 655

Quoted 8 lines
hw/ppc/e500.c +1 -1
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
         input = (qemu_irq *)env->irq_inputs;
         irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
         irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
         env->mpic_iack = MPC8544_CCSRBAR_BASE +
                          MPC8544_MPIC_REGS_OFFSET + 0xa0;
 

.default_value then. ;)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
In reply to Alexander Graf
Quoted 17 lines · Alexander Graf

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +0 -0
index d7ba25f..f984b3e 100644

hw/ppc/e500.c void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params) · line 652

Quoted 5 lines
hw/ppc/e500.c +1 -1
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
         input = (qemu_irq *)env->irq_inputs;
         irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
         irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;

Not an issue introduced with this patch, but should we really be missing with CPUState::cpu_index in a board file? (Nowhere else does, it's otherwise simply set to an appropriately incremented index by cpu_exec_init().) I rather suspect that cpu_index will already be set to the value we set it, in any case...

thanks
-- PMM

#3 lore raw
Quoted 22 lines · Peter Maydell
Quoted 21 lines · Alexander Graf

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

---
hw/ppc/e500.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +0 -1
index d7ba25f..f984b3e 100644
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
        input = (qemu_irq *)env->irq_inputs;
        irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
        irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
Quoted 8 lines

hw/ppc/e500.c void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params) · line 652

Quoted 1 line
hw/ppc/e500.c +1 -0
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;

Not an issue introduced with this patch, but should we really be missing with CPUState::cpu_index in a board file? (Nowhere else does, it's otherwise simply set to an appropriately incremented index by cpu_exec_init().) I rather suspect that cpu_index will already be set to the value we set it, in any case...

Most likely, but I'd rather not touch that logic for 2.0 :)

Alex

#4 lore raw
Quoted 34 lines · Alexander Graf
Quoted 22 lines · Peter Maydell
Quoted 21 lines · Alexander Graf

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

---
hw/ppc/e500.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +0 -1
index d7ba25f..f984b3e 100644
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
        input = (qemu_irq *)env->irq_inputs;
        irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
        irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
Quoted 8 lines

hw/ppc/e500.c void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params) · line 652

Quoted 1 line
hw/ppc/e500.c +1 -0
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;

Not an issue introduced with this patch, but should we really be missing with CPUState::cpu_index in a board file? (Nowhere else does, it's otherwise simply set to an appropriately incremented index by cpu_exec_init().) I rather suspect that cpu_index will already be set to the value we set it, in any case...

Quoted 1 line

Most likely, but I'd rather not touch that logic for 2.0 :)

git grep "cpu_index\s\+=[^=]":

cpus.c:1404: cpu_index = 0;
exec.c:482: cpu_index = 0;
exec.c:486: cpu->cpu_index = cpu_index;
hmp.c:742: cpu_index = qdict_get_int(qdict, "index");
hw/ppc/e500.c:652: env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
monitor.c:2225: int cpu_index = qdict_get_int(qdict, "cpu_index");
scripts/qmp/qmp-shell:183: self.__cpu_index = 0
scripts/qmp/qmp-shell:216: def __cmd_passthrough(self, cmdline,
cpu_index = 0):
scripts/qmp/qmp-shell:229: self.__cpu_index = idx

Assigning cpu_index in e500.c looks to me as a strange idea. And it is hidden so nicely with two "=" in a row :-/

Out of curiosity - in the real e500 hardware, PIR does not get reset on CPU reset?

Signature · 1 line
Alexey
#5 lore raw
Quoted 55 lines

Am 04.04.2014 um 02:26 schrieb Alexey Kardashevskiy <[email protected]>:

Quoted 35 lines · Alexander Graf
Quoted 25 lines · Peter Maydell
Quoted 23 lines · Alexander Graf

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

---
hw/ppc/e500.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +0 -1
index d7ba25f..f984b3e 100644
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
       input = (qemu_irq *)env->irq_inputs;
       irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
       irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
Quoted 8 lines

hw/ppc/e500.c void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params) · line 652

Quoted 1 line
hw/ppc/e500.c +1 -0
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;

Not an issue introduced with this patch, but should we really be missing with CPUState::cpu_index in a board file? (Nowhere else does, it's otherwise simply set to an appropriately incremented index by cpu_exec_init().) I rather suspect that cpu_index will already be set to the value we set it, in any case...

Quoted 1 line

Most likely, but I'd rather not touch that logic for 2.0 :)

git grep "cpu_index\s\+=[^=]":

cpus.c:1404: cpu_index = 0;
exec.c:482: cpu_index = 0;
exec.c:486: cpu->cpu_index = cpu_index;
hmp.c:742: cpu_index = qdict_get_int(qdict, "index");
hw/ppc/e500.c:652: env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
monitor.c:2225: int cpu_index = qdict_get_int(qdict, "cpu_index");
scripts/qmp/qmp-shell:183: self.__cpu_index = 0
scripts/qmp/qmp-shell:216: def __cmd_passthrough(self, cmdline,
cpu_index = 0):
scripts/qmp/qmp-shell:229: self.__cpu_index = idx

Quoted 5 lines

Assigning cpu_index in e500.c looks to me as a strange idea. And it is hidden so nicely with two "=" in a row :-/

Out of curiosity - in the real e500 hardware, PIR does not get reset on CPU reset?

On real hw PIR is a hardwired read-only register :)

Alex

Quoted 4 lines
Signature · 2 lines
-- 
Alexey
Tested-by on v1 1/1
#6 lore raw
In reply to Alexander Graf

Hi Alex,

Seems to works for me ;).

Quoted 8 lines · Alexander Graf

We now reset SPRs to their reset values on CPU reset. So if we want to have an SPR persistently changed, we need to change its default reset value rather than the value itself manually.

Do this for SPR_BOOKE_PIR, fixing e500v2 SMP boot.

Thanks,
Fred

Quoted 17 lines
---
  hw/ppc/e500.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +1 -1
index d7ba25f..f984b3e 100644
@@ -649,7 +649,7 @@ void ppce500_init(QEMUMachineInitArgs *args, PPCE500Params *params)
          input = (qemu_irq *)env->irq_inputs;
          irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
          irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
-        env->spr[SPR_BOOKE_PIR] = cs->cpu_index = i;
+        env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
          env->mpic_iack = MPC8544_CCSRBAR_BASE +
                           MPC8544_MPIC_REGS_OFFSET + 0xa0;