[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE) |
Date: |
Tue, 13 Dec 2022 13:52:17 +0100 |
The tswap64() calls introduced in commit 4be21d561d ("pseries:
savevm support for pseries machine") are used to store the HTAB
in the migration stream (see savevm_htab_handlers) and are in
big-endian format.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/spapr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 66b414d2e9..8b1d5689d2 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -39,6 +39,7 @@
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
#include "qemu/log.h"
+#include "qemu/bswap.h"
#include "hw/fw-path-provider.h"
#include "elf.h"
#include "net/net.h"
@@ -1357,10 +1358,10 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhyp,
PowerPCCPU *cpu,
}
#define HPTE(_table, _i) (void *)(((uint64_t *)(_table)) + ((_i) * 2))
-#define HPTE_VALID(_hpte) (tswap64(*((uint64_t *)(_hpte))) & HPTE64_V_VALID)
-#define HPTE_DIRTY(_hpte) (tswap64(*((uint64_t *)(_hpte))) &
HPTE64_V_HPTE_DIRTY)
-#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=
tswap64(~HPTE64_V_HPTE_DIRTY))
-#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=
tswap64(HPTE64_V_HPTE_DIRTY))
+#define HPTE_VALID(_hpte) (be64_to_cpu(*((uint64_t *)(_hpte))) &
HPTE64_V_VALID)
+#define HPTE_DIRTY(_hpte) (be64_to_cpu(*((uint64_t *)(_hpte))) &
HPTE64_V_HPTE_DIRTY)
+#define CLEAN_HPTE(_hpte) ((*(uint64_t *)(_hpte)) &=
cpu_to_be64(~HPTE64_V_HPTE_DIRTY))
+#define DIRTY_HPTE(_hpte) ((*(uint64_t *)(_hpte)) |=
cpu_to_be64(HPTE64_V_HPTE_DIRTY))
/*
* Get the fd to access the kernel htab, re-opening it if necessary
--
2.38.1
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), (continued)
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Philippe Mathieu-Daudé, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Richard Henderson, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Peter Maydell, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Richard Henderson, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Cédric Le Goater, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Peter Maydell, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Edgar E. Iglesias, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), BALATON Zoltan, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Peter Maydell, 2022/12/13
- Re: [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32(), Cédric Le Goater, 2022/12/13
[RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE),
Philippe Mathieu-Daudé <=
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Peter Maydell, 2022/12/13
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Daniel Henrique Barboza, 2022/12/16
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Peter Maydell, 2022/12/16
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), David Gibson, 2022/12/19
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Peter Maydell, 2022/12/19
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), David Gibson, 2022/12/20
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Peter Maydell, 2022/12/21
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Cédric Le Goater, 2022/12/21
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), Peter Maydell, 2022/12/21
- Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE), David Gibson, 2022/12/21