* [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n)
@ 2022-01-07 22:25 Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 1/8] target/ppc: powerpc_excp: Extract software TLB logging into a function Fabiano Rosas
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Version 3:
- patches 1,3,4,5,6,7: unchanged, reviewed;
- patch 2: started using qemu_loglevel_mask(CPU_LOG_MMU) instead of
qemu_log_enabled;
I decided to not rename the function at this point because
it is used for both 60x and 7x5 and these two will be split
in the near future, so allow me to postpone that;
- patch 8: new patch using env->has_hv_mode to fix the endianness of
powernv dumps as suggested by David.
v2:
https://lists.nongnu.org/archive/html/qemu-ppc/2022-01/msg00139.html
v1:
https://lists.nongnu.org/archive/html/qemu-ppc/2022-01/msg00054.html
RFC v1:
https://lists.nongnu.org/archive/html/qemu-ppc/2021-06/msg00026.html
RFC v2:
https://lists.nongnu.org/archive/html/qemu-ppc/2021-12/msg00542.html
Cleanups 1/n [already merged]:
https://mail.gnu.org/archive/html/qemu-ppc/2021-12/msg00696.html
Fabiano Rosas (8):
target/ppc: powerpc_excp: Extract software TLB logging into a function
target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active
target/ppc: powerpc_excp: Group unimplemented exceptions
target/ppc: Add HV support to ppc_interrupts_little_endian
target/ppc: Add MSR_ILE support to ppc_interrupts_little_endian
target/ppc: Use ppc_interrupts_little_endian in powerpc_excp
target/ppc: Introduce a wrapper for powerpc_excp
target/ppc: Set the correct endianness for powernv memory dumps
target/ppc/arch_dump.c | 2 +-
target/ppc/cpu.h | 25 ++++--
target/ppc/excp_helper.c | 183 ++++++++++++---------------------------
3 files changed, 73 insertions(+), 137 deletions(-)
--
2.33.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/8] target/ppc: powerpc_excp: Extract software TLB logging into a function
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 2/8] target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active Fabiano Rosas
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/excp_helper.c | 63 +++++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 27 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index a779dc936a..2c5d5470de 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -135,6 +135,41 @@ static void dump_hcall(CPUPPCState *env)
env->nip);
}
+static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp)
+{
+#if defined(DEBUG_SOFTWARE_TLB)
+ const char *es;
+ target_ulong *miss, *cmp;
+ int en;
+
+ if (!qemu_log_enabled()) {
+ return;
+ }
+
+ if (excp == POWERPC_EXCP_IFTLB) {
+ es = "I";
+ en = 'I';
+ miss = &env->spr[SPR_IMISS];
+ cmp = &env->spr[SPR_ICMP];
+ } else {
+ if (excp == POWERPC_EXCP_DLTLB) {
+ es = "DL";
+ } else {
+ es = "DS";
+ }
+ en = 'D';
+ miss = &env->spr[SPR_DMISS];
+ cmp = &env->spr[SPR_DCMP];
+ }
+ qemu_log("6xx %sTLB miss: %cM " TARGET_FMT_lx " %cC "
+ TARGET_FMT_lx " H1 " TARGET_FMT_lx " H2 "
+ TARGET_FMT_lx " %08x\n", es, en, *miss, en, *cmp,
+ env->spr[SPR_HASH1], env->spr[SPR_HASH2],
+ env->error_code);
+#endif
+}
+
+
static int powerpc_reset_wakeup(CPUState *cs, CPUPPCState *env, int excp,
target_ulong *msr)
{
@@ -777,34 +812,8 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
}
/* fall through */
case POWERPC_EXCP_7x5:
-#if defined(DEBUG_SOFTWARE_TLB)
- if (qemu_log_enabled()) {
- const char *es;
- target_ulong *miss, *cmp;
- int en;
+ ppc_excp_debug_sw_tlb(env, excp);
- if (excp == POWERPC_EXCP_IFTLB) {
- es = "I";
- en = 'I';
- miss = &env->spr[SPR_IMISS];
- cmp = &env->spr[SPR_ICMP];
- } else {
- if (excp == POWERPC_EXCP_DLTLB) {
- es = "DL";
- } else {
- es = "DS";
- }
- en = 'D';
- miss = &env->spr[SPR_DMISS];
- cmp = &env->spr[SPR_DCMP];
- }
- qemu_log("6xx %sTLB miss: %cM " TARGET_FMT_lx " %cC "
- TARGET_FMT_lx " H1 " TARGET_FMT_lx " H2 "
- TARGET_FMT_lx " %08x\n", es, en, *miss, en, *cmp,
- env->spr[SPR_HASH1], env->spr[SPR_HASH2],
- env->error_code);
- }
-#endif
msr |= env->crf[0] << 28;
msr |= env->error_code; /* key, D/I, S/L bits */
/* Set way using a LRU mechanism */
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 2/8] target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 1/8] target/ppc: powerpc_excp: Extract software TLB logging into a function Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 3/8] target/ppc: powerpc_excp: Group unimplemented exceptions Fabiano Rosas
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Remove the compile time definition and make the logging be controlled
by the `-d mmu` option in the cmdline.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/excp_helper.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 2c5d5470de..a12ed14c30 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -30,8 +30,6 @@
#include "exec/cpu_ldst.h"
#endif
-/* #define DEBUG_SOFTWARE_TLB */
-
/*****************************************************************************/
/* Exception processing */
#if !defined(CONFIG_USER_ONLY)
@@ -137,12 +135,11 @@ static void dump_hcall(CPUPPCState *env)
static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp)
{
-#if defined(DEBUG_SOFTWARE_TLB)
const char *es;
target_ulong *miss, *cmp;
int en;
- if (!qemu_log_enabled()) {
+ if (!qemu_loglevel_mask(CPU_LOG_MMU)) {
return;
}
@@ -166,7 +163,6 @@ static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp)
TARGET_FMT_lx " %08x\n", es, en, *miss, en, *cmp,
env->spr[SPR_HASH1], env->spr[SPR_HASH2],
env->error_code);
-#endif
}
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 3/8] target/ppc: powerpc_excp: Group unimplemented exceptions
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 1/8] target/ppc: powerpc_excp: Extract software TLB logging into a function Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 2/8] target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 4/8] target/ppc: Add HV support to ppc_interrupts_little_endian Fabiano Rosas
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/excp_helper.c | 77 +++++-----------------------------------
1 file changed, 8 insertions(+), 69 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index a12ed14c30..a52340ac0a 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -700,23 +700,6 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
case POWERPC_EXCP_SPEU: /* SPE/embedded floating-point unavailable/VPU */
env->spr[SPR_BOOKE_ESR] = ESR_SPV;
break;
- case POWERPC_EXCP_EFPDI: /* Embedded floating-point data interrupt */
- /* XXX: TODO */
- cpu_abort(cs, "Embedded floating point data exception "
- "is not implemented yet !\n");
- env->spr[SPR_BOOKE_ESR] = ESR_SPV;
- break;
- case POWERPC_EXCP_EFPRI: /* Embedded floating-point round interrupt */
- /* XXX: TODO */
- cpu_abort(cs, "Embedded floating point round exception "
- "is not implemented yet !\n");
- env->spr[SPR_BOOKE_ESR] = ESR_SPV;
- break;
- case POWERPC_EXCP_EPERFM: /* Embedded performance monitor interrupt */
- /* XXX: TODO */
- cpu_abort(cs,
- "Performance counter exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_DOORI: /* Embedded doorbell interrupt */
break;
case POWERPC_EXCP_DOORCI: /* Embedded doorbell critical interrupt */
@@ -781,19 +764,6 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
case POWERPC_EXCP_PIT: /* Programmable interval timer interrupt */
trace_ppc_excp_print("PIT");
break;
- case POWERPC_EXCP_IO: /* IO error exception */
- /* XXX: TODO */
- cpu_abort(cs, "601 IO error exception is not implemented yet !\n");
- break;
- case POWERPC_EXCP_RUNM: /* Run mode exception */
- /* XXX: TODO */
- cpu_abort(cs, "601 run mode exception is not implemented yet !\n");
- break;
- case POWERPC_EXCP_EMUL: /* Emulation trap exception */
- /* XXX: TODO */
- cpu_abort(cs, "602 emulation trap exception "
- "is not implemented yet !\n");
- break;
case POWERPC_EXCP_IFTLB: /* Instruction fetch TLB error */
case POWERPC_EXCP_DLTLB: /* Data load TLB miss */
case POWERPC_EXCP_DSTLB: /* Data store TLB miss */
@@ -820,56 +790,25 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
break;
}
break;
+ case POWERPC_EXCP_EFPDI: /* Embedded floating-point data interrupt */
+ case POWERPC_EXCP_EFPRI: /* Embedded floating-point round interrupt */
+ case POWERPC_EXCP_EPERFM: /* Embedded performance monitor interrupt */
+ case POWERPC_EXCP_IO: /* IO error exception */
+ case POWERPC_EXCP_RUNM: /* Run mode exception */
+ case POWERPC_EXCP_EMUL: /* Emulation trap exception */
case POWERPC_EXCP_FPA: /* Floating-point assist exception */
- /* XXX: TODO */
- cpu_abort(cs, "Floating point assist exception "
- "is not implemented yet !\n");
- break;
case POWERPC_EXCP_DABR: /* Data address breakpoint */
- /* XXX: TODO */
- cpu_abort(cs, "DABR exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_IABR: /* Instruction address breakpoint */
- /* XXX: TODO */
- cpu_abort(cs, "IABR exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_SMI: /* System management interrupt */
- /* XXX: TODO */
- cpu_abort(cs, "SMI exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_THERM: /* Thermal interrupt */
- /* XXX: TODO */
- cpu_abort(cs, "Thermal management exception "
- "is not implemented yet !\n");
- break;
case POWERPC_EXCP_PERFM: /* Embedded performance monitor interrupt */
- /* XXX: TODO */
- cpu_abort(cs,
- "Performance counter exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_VPUA: /* Vector assist exception */
- /* XXX: TODO */
- cpu_abort(cs, "VPU assist exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_SOFTP: /* Soft patch exception */
- /* XXX: TODO */
- cpu_abort(cs,
- "970 soft-patch exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_MAINT: /* Maintenance exception */
- /* XXX: TODO */
- cpu_abort(cs,
- "970 maintenance exception is not implemented yet !\n");
- break;
case POWERPC_EXCP_MEXTBR: /* Maskable external breakpoint */
- /* XXX: TODO */
- cpu_abort(cs, "Maskable external exception "
- "is not implemented yet !\n");
- break;
case POWERPC_EXCP_NMEXTBR: /* Non maskable external breakpoint */
- /* XXX: TODO */
- cpu_abort(cs, "Non maskable external exception "
- "is not implemented yet !\n");
+ cpu_abort(cs, "%s exception not implemented\n",
+ powerpc_excp_name(excp));
break;
default:
excp_invalid:
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 4/8] target/ppc: Add HV support to ppc_interrupts_little_endian
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (2 preceding siblings ...)
2022-01-07 22:25 ` [PATCH v3 3/8] target/ppc: powerpc_excp: Group unimplemented exceptions Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 5/8] target/ppc: Add MSR_ILE " Fabiano Rosas
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
The ppc_interrupts_little_endian function could be used for interrupts
delivered in Hypervisor mode, so add support for powernv8 and powernv9
to it.
Also drop the comment because it is inaccurate, all CPUs that can run
little endian can have interrupts in little endian. The point is
whether they can take interrupts in an endianness different from
MSR_LE.
This change has no functional impact.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/arch_dump.c | 2 +-
target/ppc/cpu.h | 23 +++++++++++++++--------
target/ppc/excp_helper.c | 2 +-
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
index bb392f6d88..12cde198a3 100644
--- a/target/ppc/arch_dump.c
+++ b/target/ppc/arch_dump.c
@@ -237,7 +237,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
info->d_machine = PPC_ELF_MACHINE;
info->d_class = ELFCLASS;
- if (ppc_interrupts_little_endian(cpu)) {
+ if (ppc_interrupts_little_endian(cpu, false)) {
info->d_endian = ELFDATA2LSB;
} else {
info->d_endian = ELFDATA2MSB;
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index f20d4ffa6d..a6fc857ad4 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -2728,20 +2728,27 @@ static inline bool ppc_has_spr(PowerPCCPU *cpu, int spr)
return cpu->env.spr_cb[spr].name != NULL;
}
-static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu)
+#if !defined(CONFIG_USER_ONLY)
+static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
{
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
+ CPUPPCState *env = &cpu->env;
+ bool ile = false;
- /*
- * Only models that have an LPCR and know about LPCR_ILE can do little
- * endian.
- */
- if (pcc->lpcr_mask & LPCR_ILE) {
- return !!(cpu->env.spr[SPR_LPCR] & LPCR_ILE);
+ if (hv && env->has_hv_mode) {
+ if (is_isa300(pcc)) {
+ ile = !!(env->spr[SPR_HID0] & HID0_POWER9_HILE);
+ } else {
+ ile = !!(env->spr[SPR_HID0] & HID0_HILE);
+ }
+
+ } else if (pcc->lpcr_mask & LPCR_ILE) {
+ ile = !!(env->spr[SPR_LPCR] & LPCR_ILE);
}
- return false;
+ return ile;
}
+#endif
void dump_mmu(CPUPPCState *env);
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index a52340ac0a..3a430f23d6 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -1070,7 +1070,7 @@ void ppc_cpu_do_fwnmi_machine_check(CPUState *cs, target_ulong vector)
*/
msr = (1ULL << MSR_ME);
msr |= env->msr & (1ULL << MSR_SF);
- if (ppc_interrupts_little_endian(cpu)) {
+ if (ppc_interrupts_little_endian(cpu, false)) {
msr |= (1ULL << MSR_LE);
}
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 5/8] target/ppc: Add MSR_ILE support to ppc_interrupts_little_endian
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (3 preceding siblings ...)
2022-01-07 22:25 ` [PATCH v3 4/8] target/ppc: Add HV support to ppc_interrupts_little_endian Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 6/8] target/ppc: Use ppc_interrupts_little_endian in powerpc_excp Fabiano Rosas
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Some CPUs set ILE via an MSR bit. We can make
ppc_interrupts_little_endian handle that case as well. Now we have a
centralized way of determining the endianness of interrupts.
This change has no functional impact.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/cpu.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index a6fc857ad4..f99cd0ea92 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -2733,7 +2733,7 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
{
PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
CPUPPCState *env = &cpu->env;
- bool ile = false;
+ bool ile;
if (hv && env->has_hv_mode) {
if (is_isa300(pcc)) {
@@ -2744,6 +2744,8 @@ static inline bool ppc_interrupts_little_endian(PowerPCCPU *cpu, bool hv)
} else if (pcc->lpcr_mask & LPCR_ILE) {
ile = !!(env->spr[SPR_LPCR] & LPCR_ILE);
+ } else {
+ ile = !!(msr_ile);
}
return ile;
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 6/8] target/ppc: Use ppc_interrupts_little_endian in powerpc_excp
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (4 preceding siblings ...)
2022-01-07 22:25 ` [PATCH v3 5/8] target/ppc: Add MSR_ILE " Fabiano Rosas
@ 2022-01-07 22:25 ` Fabiano Rosas
2022-01-07 22:26 ` [PATCH v3 7/8] target/ppc: Introduce a wrapper for powerpc_excp Fabiano Rosas
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:25 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
The ppc_interrupts_little_endian function is now suitable for
determining the endianness of interrupts for all CPUs.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/excp_helper.c | 29 +----------------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 3a430f23d6..3b4123bc65 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -832,36 +832,9 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
* Sort out endianness of interrupt, this differs depending on the
* CPU, the HV mode, etc...
*/
-#ifdef TARGET_PPC64
- if (excp_model == POWERPC_EXCP_POWER7) {
- if (!(new_msr & MSR_HVB) && (env->spr[SPR_LPCR] & LPCR_ILE)) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
- } else if (excp_model == POWERPC_EXCP_POWER8) {
- if (new_msr & MSR_HVB) {
- if (env->spr[SPR_HID0] & HID0_HILE) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
- } else if (env->spr[SPR_LPCR] & LPCR_ILE) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
- } else if (excp_model == POWERPC_EXCP_POWER9 ||
- excp_model == POWERPC_EXCP_POWER10) {
- if (new_msr & MSR_HVB) {
- if (env->spr[SPR_HID0] & HID0_POWER9_HILE) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
- } else if (env->spr[SPR_LPCR] & LPCR_ILE) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
- } else if (msr_ile) {
+ if (ppc_interrupts_little_endian(cpu, !!(new_msr & MSR_HVB))) {
new_msr |= (target_ulong)1 << MSR_LE;
}
-#else
- if (msr_ile) {
- new_msr |= (target_ulong)1 << MSR_LE;
- }
-#endif
#if defined(TARGET_PPC64)
if (excp_model == POWERPC_EXCP_BOOKE) {
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 7/8] target/ppc: Introduce a wrapper for powerpc_excp
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (5 preceding siblings ...)
2022-01-07 22:25 ` [PATCH v3 6/8] target/ppc: Use ppc_interrupts_little_endian in powerpc_excp Fabiano Rosas
@ 2022-01-07 22:26 ` Fabiano Rosas
2022-01-07 22:26 ` [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps Fabiano Rosas
2022-01-10 7:38 ` [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Cédric Le Goater
8 siblings, 0 replies; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
Next patches will split powerpc_excp in multiple family specific
handlers. This patch adds a wrapper to make the transition clearer.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
target/ppc/excp_helper.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 3b4123bc65..bc646c67a0 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -396,7 +396,7 @@ static void powerpc_set_excp_state(PowerPCCPU *cpu,
* Note that this function should be greatly optimized when called
* with a constant excp, from ppc_hw_interrupt
*/
-static void powerpc_excp(PowerPCCPU *cpu, int excp)
+static inline void powerpc_excp_legacy(PowerPCCPU *cpu, int excp)
{
CPUState *cs = CPU(cpu);
CPUPPCState *env = &cpu->env;
@@ -867,6 +867,16 @@ static void powerpc_excp(PowerPCCPU *cpu, int excp)
powerpc_set_excp_state(cpu, vector, new_msr);
}
+static void powerpc_excp(PowerPCCPU *cpu, int excp)
+{
+ CPUPPCState *env = &cpu->env;
+
+ switch (env->excp_model) {
+ default:
+ powerpc_excp_legacy(cpu, excp);
+ }
+}
+
void ppc_cpu_do_interrupt(CPUState *cs)
{
PowerPCCPU *cpu = POWERPC_CPU(cs);
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (6 preceding siblings ...)
2022-01-07 22:26 ` [PATCH v3 7/8] target/ppc: Introduce a wrapper for powerpc_excp Fabiano Rosas
@ 2022-01-07 22:26 ` Fabiano Rosas
2022-01-10 2:24 ` David Gibson
2022-01-10 7:38 ` [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Cédric Le Goater
8 siblings, 1 reply; 11+ messages in thread
From: Fabiano Rosas @ 2022-01-07 22:26 UTC (permalink / raw)
To: qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, clg, david
We use the endianness of interrupts to determine which endianness to
use for the guest kernel memory dump. For machines that support HILE
(powernv8 and up) we have been always generating big endian dump
files.
This patch uses the HILE support recently added to
ppc_interrupts_little_endian to fix the endianness of the dumps for
powernv machines.
Here are two dumps created at different moments:
$ file skiboot.dump
skiboot.dump: ELF 64-bit MSB core file, 64-bit PowerPC ...
$ file kernel.dump
kernel.dump: ELF 64-bit LSB core file, 64-bit PowerPC ...
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
target/ppc/arch_dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
index 12cde198a3..993740897d 100644
--- a/target/ppc/arch_dump.c
+++ b/target/ppc/arch_dump.c
@@ -237,7 +237,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
info->d_machine = PPC_ELF_MACHINE;
info->d_class = ELFCLASS;
- if (ppc_interrupts_little_endian(cpu, false)) {
+ if (ppc_interrupts_little_endian(cpu, cpu->env.has_hv_mode)) {
info->d_endian = ELFDATA2LSB;
} else {
info->d_endian = ELFDATA2MSB;
--
2.33.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps
2022-01-07 22:26 ` [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps Fabiano Rosas
@ 2022-01-10 2:24 ` David Gibson
0 siblings, 0 replies; 11+ messages in thread
From: David Gibson @ 2022-01-10 2:24 UTC (permalink / raw)
To: Fabiano Rosas; +Cc: qemu-ppc, danielhb413, richard.henderson, qemu-devel, clg
[-- Attachment #1: Type: text/plain, Size: 1682 bytes --]
On Fri, Jan 07, 2022 at 07:26:01PM -0300, Fabiano Rosas wrote:
> We use the endianness of interrupts to determine which endianness to
> use for the guest kernel memory dump. For machines that support HILE
> (powernv8 and up) we have been always generating big endian dump
> files.
>
> This patch uses the HILE support recently added to
> ppc_interrupts_little_endian to fix the endianness of the dumps for
> powernv machines.
>
> Here are two dumps created at different moments:
>
> $ file skiboot.dump
> skiboot.dump: ELF 64-bit MSB core file, 64-bit PowerPC ...
>
> $ file kernel.dump
> kernel.dump: ELF 64-bit LSB core file, 64-bit PowerPC ...
>
> Suggested-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> target/ppc/arch_dump.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
> index 12cde198a3..993740897d 100644
> --- a/target/ppc/arch_dump.c
> +++ b/target/ppc/arch_dump.c
> @@ -237,7 +237,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
> info->d_machine = PPC_ELF_MACHINE;
> info->d_class = ELFCLASS;
>
> - if (ppc_interrupts_little_endian(cpu, false)) {
> + if (ppc_interrupts_little_endian(cpu, cpu->env.has_hv_mode)) {
> info->d_endian = ELFDATA2LSB;
> } else {
> info->d_endian = ELFDATA2MSB;
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n)
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
` (7 preceding siblings ...)
2022-01-07 22:26 ` [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps Fabiano Rosas
@ 2022-01-10 7:38 ` Cédric Le Goater
8 siblings, 0 replies; 11+ messages in thread
From: Cédric Le Goater @ 2022-01-10 7:38 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: richard.henderson, danielhb413, qemu-ppc, david
Hello Fabiano,
On 1/7/22 23:25, Fabiano Rosas wrote:
> Version 3:
>
> - patches 1,3,4,5,6,7: unchanged, reviewed;
>
> - patch 2: started using qemu_loglevel_mask(CPU_LOG_MMU) instead of
> qemu_log_enabled;
>
> I decided to not rename the function at this point because
> it is used for both 60x and 7x5 and these two will be split
> in the near future, so allow me to postpone that;
>
> - patch 8: new patch using env->has_hv_mode to fix the endianness of
> powernv dumps as suggested by David.
I have queued this version for ppc-7.0. You can send followups on top
of it.
Thanks,
C.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-01-10 8:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07 22:25 [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 1/8] target/ppc: powerpc_excp: Extract software TLB logging into a function Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 2/8] target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 3/8] target/ppc: powerpc_excp: Group unimplemented exceptions Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 4/8] target/ppc: Add HV support to ppc_interrupts_little_endian Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 5/8] target/ppc: Add MSR_ILE " Fabiano Rosas
2022-01-07 22:25 ` [PATCH v3 6/8] target/ppc: Use ppc_interrupts_little_endian in powerpc_excp Fabiano Rosas
2022-01-07 22:26 ` [PATCH v3 7/8] target/ppc: Introduce a wrapper for powerpc_excp Fabiano Rosas
2022-01-07 22:26 ` [PATCH v3 8/8] target/ppc: Set the correct endianness for powernv memory dumps Fabiano Rosas
2022-01-10 2:24 ` David Gibson
2022-01-10 7:38 ` [PATCH v3 0/8] target/ppc: powerpc_excp improvements (2/n) Cédric Le Goater
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).