* [PULL 0/1] ppc queue
@ 2021-11-29 20:53 Cédric Le Goater
2021-11-29 20:53 ` [PULL 1/1] target/ppc: fix Hash64 MMU update of PTE bit R Cédric Le Goater
2021-11-30 8:04 ` [PULL 0/1] ppc queue Richard Henderson
0 siblings, 2 replies; 3+ messages in thread
From: Cédric Le Goater @ 2021-11-29 20:53 UTC (permalink / raw)
To: qemu-ppc, qemu-devel
Cc: Peter Maydell, Richard Henderson, Cédric Le Goater
The following changes since commit a0fd8a5492240379a07c0b39c8dae3b8341b458f:
Merge tag 'pull-for-6.2-291121-1' of https://github.com/stsquad/qemu into staging (2021-11-29 18:58:06 +0100)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-ppc-20211129
for you to fetch changes up to 7bf00dfb51566070960e0b7977e41abba96c130e:
target/ppc: fix Hash64 MMU update of PTE bit R (2021-11-29 21:00:08 +0100)
----------------------------------------------------------------
ppc 6.2 queue:
* Hash64 MMU fix for FreeBSD installer
----------------------------------------------------------------
Leandro Lupori (1):
target/ppc: fix Hash64 MMU update of PTE bit R
target/ppc/mmu-hash64.h | 5 +++++
hw/ppc/spapr.c | 8 ++++----
hw/ppc/spapr_softmmu.c | 2 +-
target/ppc/mmu-hash64.c | 4 ++--
4 files changed, 12 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PULL 1/1] target/ppc: fix Hash64 MMU update of PTE bit R
2021-11-29 20:53 [PULL 0/1] ppc queue Cédric Le Goater
@ 2021-11-29 20:53 ` Cédric Le Goater
2021-11-30 8:04 ` [PULL 0/1] ppc queue Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2021-11-29 20:53 UTC (permalink / raw)
To: qemu-ppc, qemu-devel
Cc: Peter Maydell, Richard Henderson, Leandro Lupori,
Cédric Le Goater
From: Leandro Lupori <leandro.lupori@eldorado.org.br>
When updating the R bit of a PTE, the Hash64 MMU was using a wrong byte
offset, causing the first byte of the adjacent PTE to be corrupted.
This caused a panic when booting FreeBSD, using the Hash MMU.
Fixes: a2dd4e83e76b ("ppc/hash64: Rework R and C bit updates")
Signed-off-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/mmu-hash64.h | 5 +++++
hw/ppc/spapr.c | 8 ++++----
hw/ppc/spapr_softmmu.c | 2 +-
target/ppc/mmu-hash64.c | 4 ++--
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h
index c5b2f97ff74f..1496955d389b 100644
--- a/target/ppc/mmu-hash64.h
+++ b/target/ppc/mmu-hash64.h
@@ -97,6 +97,11 @@ void ppc_hash64_finalize(PowerPCCPU *cpu);
#define HPTE64_V_1TB_SEG 0x4000000000000000ULL
#define HPTE64_V_VRMA_MASK 0x4001ffffff000000ULL
+/* PTE offsets */
+#define HPTE64_DW1 (HASH_PTE_SIZE_64 / 2)
+#define HPTE64_DW1_R (HPTE64_DW1 + 6)
+#define HPTE64_DW1_C (HPTE64_DW1 + 7)
+
/* Format changes for ARCH v3 */
#define HPTE64_V_COMMON_BITS 0x000fffffffffffffULL
#define HPTE64_R_3_0_SSIZE_SHIFT 58
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 163c90388af2..3b5fd749be89 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1414,7 +1414,7 @@ void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex,
kvmppc_write_hpte(ptex, pte0, pte1);
} else {
if (pte0 & HPTE64_V_VALID) {
- stq_p(spapr->htab + offset + HASH_PTE_SIZE_64 / 2, pte1);
+ stq_p(spapr->htab + offset + HPTE64_DW1, pte1);
/*
* When setting valid, we write PTE1 first. This ensures
* proper synchronization with the reading code in
@@ -1430,7 +1430,7 @@ void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex,
* ppc_hash64_pteg_search()
*/
smp_wmb();
- stq_p(spapr->htab + offset + HASH_PTE_SIZE_64 / 2, pte1);
+ stq_p(spapr->htab + offset + HPTE64_DW1, pte1);
}
}
}
@@ -1438,7 +1438,7 @@ void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex,
static void spapr_hpte_set_c(PPCVirtualHypervisor *vhyp, hwaddr ptex,
uint64_t pte1)
{
- hwaddr offset = ptex * HASH_PTE_SIZE_64 + 15;
+ hwaddr offset = ptex * HASH_PTE_SIZE_64 + HPTE64_DW1_C;
SpaprMachineState *spapr = SPAPR_MACHINE(vhyp);
if (!spapr->htab) {
@@ -1454,7 +1454,7 @@ static void spapr_hpte_set_c(PPCVirtualHypervisor *vhyp, hwaddr ptex,
static void spapr_hpte_set_r(PPCVirtualHypervisor *vhyp, hwaddr ptex,
uint64_t pte1)
{
- hwaddr offset = ptex * HASH_PTE_SIZE_64 + 14;
+ hwaddr offset = ptex * HASH_PTE_SIZE_64 + HPTE64_DW1_R;
SpaprMachineState *spapr = SPAPR_MACHINE(vhyp);
if (!spapr->htab) {
diff --git a/hw/ppc/spapr_softmmu.c b/hw/ppc/spapr_softmmu.c
index f8924270eff5..4ee03c83e48e 100644
--- a/hw/ppc/spapr_softmmu.c
+++ b/hw/ppc/spapr_softmmu.c
@@ -426,7 +426,7 @@ static void new_hpte_store(void *htab, uint64_t pteg, int slot,
addr += slot * HASH_PTE_SIZE_64;
stq_p(addr, pte0);
- stq_p(addr + HASH_PTE_SIZE_64 / 2, pte1);
+ stq_p(addr + HPTE64_DW1, pte1);
}
static int rehash_hpte(PowerPCCPU *cpu,
diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c
index 19832c4b46f2..da9fe99ff8bd 100644
--- a/target/ppc/mmu-hash64.c
+++ b/target/ppc/mmu-hash64.c
@@ -786,7 +786,7 @@ static void ppc_hash64_set_dsi(CPUState *cs, int mmu_idx, uint64_t dar, uint64_t
static void ppc_hash64_set_r(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte1)
{
- hwaddr base, offset = ptex * HASH_PTE_SIZE_64 + 16;
+ hwaddr base, offset = ptex * HASH_PTE_SIZE_64 + HPTE64_DW1_R;
if (cpu->vhyp) {
PPCVirtualHypervisorClass *vhc =
@@ -803,7 +803,7 @@ static void ppc_hash64_set_r(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte1)
static void ppc_hash64_set_c(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte1)
{
- hwaddr base, offset = ptex * HASH_PTE_SIZE_64 + 15;
+ hwaddr base, offset = ptex * HASH_PTE_SIZE_64 + HPTE64_DW1_C;
if (cpu->vhyp) {
PPCVirtualHypervisorClass *vhc =
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PULL 0/1] ppc queue
2021-11-29 20:53 [PULL 0/1] ppc queue Cédric Le Goater
2021-11-29 20:53 ` [PULL 1/1] target/ppc: fix Hash64 MMU update of PTE bit R Cédric Le Goater
@ 2021-11-30 8:04 ` Richard Henderson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2021-11-30 8:04 UTC (permalink / raw)
To: Cédric Le Goater, qemu-ppc, qemu-devel; +Cc: Peter Maydell
On 11/29/21 9:53 PM, Cédric Le Goater wrote:
> The following changes since commit a0fd8a5492240379a07c0b39c8dae3b8341b458f:
>
> Merge tag 'pull-for-6.2-291121-1' of https://github.com/stsquad/qemu into staging (2021-11-29 18:58:06 +0100)
>
> are available in the Git repository at:
>
> https://github.com/legoater/qemu/ tags/pull-ppc-20211129
>
> for you to fetch changes up to 7bf00dfb51566070960e0b7977e41abba96c130e:
>
> target/ppc: fix Hash64 MMU update of PTE bit R (2021-11-29 21:00:08 +0100)
>
> ----------------------------------------------------------------
> ppc 6.2 queue:
>
> * Hash64 MMU fix for FreeBSD installer
>
> ----------------------------------------------------------------
> Leandro Lupori (1):
> target/ppc: fix Hash64 MMU update of PTE bit R
>
> target/ppc/mmu-hash64.h | 5 +++++
> hw/ppc/spapr.c | 8 ++++----
> hw/ppc/spapr_softmmu.c | 2 +-
> target/ppc/mmu-hash64.c | 4 ++--
> 4 files changed, 12 insertions(+), 7 deletions(-)
Applied, thanks.
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-30 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-29 20:53 [PULL 0/1] ppc queue Cédric Le Goater
2021-11-29 20:53 ` [PULL 1/1] target/ppc: fix Hash64 MMU update of PTE bit R Cédric Le Goater
2021-11-30 8:04 ` [PULL 0/1] ppc queue Richard Henderson
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).