mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
accel/kvm: Use target_needs_bswap()
Check whether we need to swap at runtime using target_needs_bswap(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250417131004.47205-3-philmd@linaro.org>
This commit is contained in:
parent
4e442406fd
commit
56f8fb6886
1 changed files with 16 additions and 14 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include "system/cpus.h"
|
#include "system/cpus.h"
|
||||||
#include "system/accel-blocker.h"
|
#include "system/accel-blocker.h"
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
#include "system/memory.h"
|
#include "system/memory.h"
|
||||||
#include "system/ram_addr.h"
|
#include "system/ram_addr.h"
|
||||||
#include "qemu/event_notifier.h"
|
#include "qemu/event_notifier.h"
|
||||||
|
@ -1318,11 +1319,12 @@ bool kvm_hwpoisoned_mem(void)
|
||||||
|
|
||||||
static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
|
static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
|
||||||
{
|
{
|
||||||
#if HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN
|
if (target_needs_bswap()) {
|
||||||
/* The kernel expects ioeventfd values in HOST_BIG_ENDIAN
|
/*
|
||||||
|
* The kernel expects ioeventfd values in HOST_BIG_ENDIAN
|
||||||
* endianness, but the memory core hands them in target endianness.
|
* endianness, but the memory core hands them in target endianness.
|
||||||
* For example, PPC is always treated as big-endian even if running
|
* For example, PPC is always treated as big-endian even if running
|
||||||
* on KVM and on PPC64LE. Correct here.
|
* on KVM and on PPC64LE. Correct here, swapping back.
|
||||||
*/
|
*/
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1332,7 +1334,7 @@ static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
|
||||||
val = bswap32(val);
|
val = bswap32(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue