Skip to content

Commit

Permalink
Merge tag 'pull-ppc-20211129' of https://github.com/legoater/qemu int…
Browse files Browse the repository at this point in the history
…o staging

ppc 6.2 queue:

* Hash64 MMU fix for FreeBSD installer

# gpg: Signature made Mon 29 Nov 2021 09:49:54 PM CET
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <[email protected]>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-ppc-20211129' of https://github.com/legoater/qemu:
  target/ppc: fix Hash64 MMU update of PTE bit R

Signed-off-by: Richard Henderson <[email protected]>
  • Loading branch information
rth7680 committed Nov 29, 2021
2 parents a0fd8a5 + 7bf00df commit 50456a6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions hw/ppc/spapr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -1430,15 +1430,15 @@ 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);
}
}
}

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) {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/spapr_softmmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions target/ppc/mmu-hash64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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 =
Expand Down
5 changes: 5 additions & 0 deletions target/ppc/mmu-hash64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 50456a6

Please sign in to comment.