[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 5/7] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clea
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 5/7] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method |
Date: |
Wed, 18 Dec 2024 19:21:04 +0100 |
Convert CLEAN_HPTE() macro as hpte_set_clean() method.
Since sPAPR is in big endian configuration at reset,
use the big endian LD/ST API to access the HPTEs.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/spapr.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 5bc49598a97..4e1fe832c29 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1416,7 +1416,12 @@ static bool hpte_is_dirty(SpaprMachineState *s, unsigned
index)
return ldq_be_p(hpte_get(s, index)) & HPTE64_V_HPTE_DIRTY;
}
-#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=
tswap64(~HPTE64_V_HPTE_DIRTY))
+static void hpte_set_clean(SpaprMachineState *s, unsigned index)
+{
+ stq_be_p(hpte_get(s, index),
+ ldq_be_p(hpte_get(s, index)) & ~HPTE64_V_HPTE_DIRTY);
+}
+
#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=
tswap64(HPTE64_V_HPTE_DIRTY))
/*
@@ -2213,7 +2218,7 @@ static void htab_save_first_pass(QEMUFile *f,
SpaprMachineState *spapr,
/* Consume invalid HPTEs */
while ((index < htabslots)
&& !hpte_is_valid(spapr->htab, index)) {
- CLEAN_HPTE(hpte_get(spapr->htab, index));
+ hpte_set_clean(spapr->htab, index);
index++;
}
@@ -2221,7 +2226,7 @@ static void htab_save_first_pass(QEMUFile *f,
SpaprMachineState *spapr,
chunkstart = index;
while ((index < htabslots) && (index - chunkstart < USHRT_MAX)
&& hpte_is_valid(spapr->htab, index)) {
- CLEAN_HPTE(hpte_get(spapr->htab, index));
+ hpte_set_clean(spapr->htab, index);
index++;
}
@@ -2271,7 +2276,7 @@ static int htab_save_later_pass(QEMUFile *f,
SpaprMachineState *spapr,
while ((index < htabslots) && (index - chunkstart < USHRT_MAX)
&& hpte_is_dirty(spapr->htab, index)
&& hpte_is_valid(spapr->htab, index)) {
- CLEAN_HPTE(hpte_get(spapr->htab, index));
+ hpte_set_clean(spapr->htab, index);
index++;
examined++;
}
@@ -2281,7 +2286,7 @@ static int htab_save_later_pass(QEMUFile *f,
SpaprMachineState *spapr,
while ((index < htabslots) && (index - invalidstart < USHRT_MAX)
&& hpte_is_dirty(spapr->htab, index)
&& !hpte_is_valid(spapr->htab, index)) {
- CLEAN_HPTE(hpte_get(spapr->htab, index));
+ hpte_set_clean(spapr->htab, index);
index++;
examined++;
}
--
2.45.2
- Re: [PATCH v3 1/7] meson: Run some compiler checks using -Wno-unused-value, (continued)
- [PATCH v3 2/7] hw/ppc/spapr: Convert HPTE() macro as hpte_get() method, Philippe Mathieu-Daudé, 2024/12/18
- [PATCH v3 3/7] hw/ppc/spapr: Convert HPTE_VALID() macro as hpte_is_valid() method, Philippe Mathieu-Daudé, 2024/12/18
- [PATCH v3 4/7] hw/ppc/spapr: Convert HPTE_DIRTY() macro as hpte_is_dirty() method, Philippe Mathieu-Daudé, 2024/12/18
- [PATCH v3 5/7] hw/ppc/spapr: Convert CLEAN_HPTE() macro as hpte_set_clean() method,
Philippe Mathieu-Daudé <=
- [PATCH v3 6/7] hw/ppc/spapr: Convert DIRTY_HPTE() macro as hpte_set_dirty() method, Philippe Mathieu-Daudé, 2024/12/18
- [PATCH v3 7/7] hw/ppc/epapr: Do not swap ePAPR magic value, Philippe Mathieu-Daudé, 2024/12/18