KVM: selftests: Don't limit LE dirty-bitmap bitops to s390x

dirty_log_test already has BITOP_LE_SWIZZLE helpers, but they were
compiled in only for s390x, so every other big-endian host used native
test_bit().

The test fails on big-endian powerpc because it treated dirty host pages
as clean (because of the endianness issue)

w/o the fix the test fails with:
  Clear page 1 value (1) >= iteration (1)

Fixes: a049a37716 ("KVM: selftests: Enable dirty_log_test on s390x")
Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Gautam Menghani <gautam@linux.ibm.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/63c900860b5f7e49cfa7258602e94b58b3de73b3.1791280439.git.ritesh.list@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Ritesh Harjani (IBM) 2026-10-06 15:58:35 +05:30 committed by Sean Christopherson
parent 1e59e5a3bd
commit ab1d400067

View File

@ -44,8 +44,11 @@
#define TEST_MIN_WRITES_PER_ITERATION 0x100
/* Dirty bitmaps are always little endian, so we need to swap on big endian */
#if defined(__s390x__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
#else
# define BITOP_LE_SWIZZLE 0
#endif
# define test_bit_le(nr, addr) \
test_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
# define __set_bit_le(nr, addr) \
@ -56,13 +59,6 @@
__test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
# define __test_and_clear_bit_le(nr, addr) \
__test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, addr)
#else
# define test_bit_le test_bit
# define __set_bit_le __set_bit
# define __clear_bit_le __clear_bit
# define __test_and_set_bit_le __test_and_set_bit
# define __test_and_clear_bit_le __test_and_clear_bit
#endif
#define TEST_DIRTY_RING_COUNT 65536