[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 5/6] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirt
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 5/6] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirty() method |
Date: |
Fri, 20 Dec 2024 22:31:02 +0100 |
Convert DIRTY_HPTE() macro as hpte_set_dirty() method.
sPAPR data structures including the hash page table are big-endian
regardless of current CPU endian mode, so use the big-endian LD/ST
API to access the hash PTEs.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/spapr.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e68e8c320f4..d318ce2a350 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1422,7 +1422,11 @@ static void hpte_set_clean(SpaprMachineState *s,
unsigned index)
ldq_be_p(hpte_get_ptr(s, index)) & ~HPTE64_V_HPTE_DIRTY);
}
-#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=
tswap64(HPTE64_V_HPTE_DIRTY))
+static void hpte_set_dirty(SpaprMachineState *s, unsigned index)
+{
+ stq_be_p(hpte_get_ptr(s, index),
+ ldq_be_p(hpte_get_ptr(s, index)) | HPTE64_V_HPTE_DIRTY);
+}
/*
* Get the fd to access the kernel htab, re-opening it if necessary
@@ -1633,7 +1637,7 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, int
shift, Error **errp)
spapr->htab_shift = shift;
for (i = 0; i < size / HASH_PTE_SIZE_64; i++) {
- DIRTY_HPTE(hpte_get_ptr(spapr, i));
+ hpte_set_dirty(spapr, i);
}
}
/* We're setting up a hash table, so that means we're not radix */
--
2.47.1
- [PATCH v4 0/6] hw/ppc: Remove tswap() calls, Philippe Mathieu-Daudé, 2024/12/20
- [PATCH v4 1/6] hw/ppc/spapr: Convert HPTE() macro as hpte_get_ptr() method, Philippe Mathieu-Daudé, 2024/12/20
- [PATCH v4 3/6] hw/ppc/spapr: Convert HPTE_DIRTY() macro as hpte_is_dirty() method, Philippe Mathieu-Daudé, 2024/12/20
- [PATCH v4 4/6] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method, Philippe Mathieu-Daudé, 2024/12/20
- [PATCH v4 2/6] hw/ppc/spapr: Convert HPTE_VALID() macro as hpte_is_valid() method, Philippe Mathieu-Daudé, 2024/12/20
- [PATCH v4 5/6] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirty() method,
Philippe Mathieu-Daudé <=
- [PATCH v4 6/6] hw/ppc/epapr: Do not swap ePAPR magic value, Philippe Mathieu-Daudé, 2024/12/20
- Re: [PATCH v4 0/6] hw/ppc: Remove tswap() calls, Harsh Prateek Bora, 2024/12/23