* [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms
@ 2023-11-21 16:59 Paolo Bonzini
2023-11-21 17:23 ` Mark Brown
2023-11-21 23:02 ` Gavin Shan
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2023-11-21 16:59 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: broonie
MEM_REGION_SLOT and MEM_REGION_GPA are not really needed in
test_invalid_memory_region_flags; the VM never runs and there are no
other slots, so it is okay to use slot 0 and place it at address
zero. This fixes compilation on architectures that do not
define them.
Fixes: 5d74316466f4 ("KVM: selftests: Add a memory region subtest to validate invalid flags", 2023-11-14)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tools/testing/selftests/kvm/set_memory_region_test.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
index 1efee1cfcff0..6637a0845acf 100644
--- a/tools/testing/selftests/kvm/set_memory_region_test.c
+++ b/tools/testing/selftests/kvm/set_memory_region_test.c
@@ -349,8 +349,8 @@ static void test_invalid_memory_region_flags(void)
if ((supported_flags & BIT(i)) && !(v2_only_flags & BIT(i)))
continue;
- r = __vm_set_user_memory_region(vm, MEM_REGION_SLOT, BIT(i),
- MEM_REGION_GPA, MEM_REGION_SIZE, NULL);
+ r = __vm_set_user_memory_region(vm, 0, BIT(i),
+ 0, MEM_REGION_SIZE, NULL);
TEST_ASSERT(r && errno == EINVAL,
"KVM_SET_USER_MEMORY_REGION should have failed on v2 only flag 0x%lx", BIT(i));
@@ -358,16 +358,16 @@ static void test_invalid_memory_region_flags(void)
if (supported_flags & BIT(i))
continue;
- r = __vm_set_user_memory_region2(vm, MEM_REGION_SLOT, BIT(i),
- MEM_REGION_GPA, MEM_REGION_SIZE, NULL, 0, 0);
+ r = __vm_set_user_memory_region2(vm, 0, BIT(i),
+ 0, MEM_REGION_SIZE, NULL, 0, 0);
TEST_ASSERT(r && errno == EINVAL,
"KVM_SET_USER_MEMORY_REGION2 should have failed on unsupported flag 0x%lx", BIT(i));
}
if (supported_flags & KVM_MEM_GUEST_MEMFD) {
- r = __vm_set_user_memory_region2(vm, MEM_REGION_SLOT,
+ r = __vm_set_user_memory_region2(vm, 0,
KVM_MEM_LOG_DIRTY_PAGES | KVM_MEM_GUEST_MEMFD,
- MEM_REGION_GPA, MEM_REGION_SIZE, NULL, 0, 0);
+ 0, MEM_REGION_SIZE, NULL, 0, 0);
TEST_ASSERT(r && errno == EINVAL,
"KVM_SET_USER_MEMORY_REGION2 should have failed, dirty logging private memory is unsupported");
}
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms
2023-11-21 16:59 [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms Paolo Bonzini
@ 2023-11-21 17:23 ` Mark Brown
2023-11-21 23:02 ` Gavin Shan
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-11-21 17:23 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Tue, Nov 21, 2023 at 11:59:15AM -0500, Paolo Bonzini wrote:
> MEM_REGION_SLOT and MEM_REGION_GPA are not really needed in
> test_invalid_memory_region_flags; the VM never runs and there are no
> other slots, so it is okay to use slot 0 and place it at address
> zero. This fixes compilation on architectures that do not
> define them.
Tested-by: Mark Brown <broonie@kernel.org>
Thanks, this'll make my CI and work's a lot happer!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms
2023-11-21 16:59 [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms Paolo Bonzini
2023-11-21 17:23 ` Mark Brown
@ 2023-11-21 23:02 ` Gavin Shan
1 sibling, 0 replies; 3+ messages in thread
From: Gavin Shan @ 2023-11-21 23:02 UTC (permalink / raw)
To: Paolo Bonzini, linux-kernel, kvm; +Cc: broonie
On 11/22/23 02:59, Paolo Bonzini wrote:
> MEM_REGION_SLOT and MEM_REGION_GPA are not really needed in
> test_invalid_memory_region_flags; the VM never runs and there are no
> other slots, so it is okay to use slot 0 and place it at address
> zero. This fixes compilation on architectures that do not
> define them.
>
> Fixes: 5d74316466f4 ("KVM: selftests: Add a memory region subtest to validate invalid flags", 2023-11-14)
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tools/testing/selftests/kvm/set_memory_region_test.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
Reviewed-by: Gavin Shan <gshan@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-21 23:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 16:59 [PATCH] selftests/kvm: fix compilation on non-x86_64 platforms Paolo Bonzini
2023-11-21 17:23 ` Mark Brown
2023-11-21 23:02 ` Gavin Shan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).