[4/4] KVM: selftests: Set KVM_MEM_NON_COHERENT_DMA as a supported memslot flag

Message ID 20240105091624.24822-1-yan.y.zhao@intel.com
State New
Headers
Series KVM: Honor guest memory types for virtio GPU devices |

Commit Message

Yan Zhao Jan. 5, 2024, 9:16 a.m. UTC
  Update test_invalid_memory_region_flags() to treat KVM_MEM_NON_COHERENT_DMA
as a supported memslot flag.

Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
---
 tools/testing/selftests/kvm/set_memory_region_test.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/testing/selftests/kvm/set_memory_region_test.c
index 075b80dbe237..2d6f961734db 100644
--- a/tools/testing/selftests/kvm/set_memory_region_test.c
+++ b/tools/testing/selftests/kvm/set_memory_region_test.c
@@ -335,6 +335,9 @@  static void test_invalid_memory_region_flags(void)
 
 #if defined __aarch64__ || defined __x86_64__
 	supported_flags |= KVM_MEM_READONLY;
+
+	if (kvm_has_cap(KVM_CAP_USER_CONFIGURE_NONCOHERENT_DMA))
+		supported_flags |= KVM_MEM_NON_COHERENT_DMA;
 #endif
 
 #ifdef __x86_64__