Skip to content

Commit 8886640

Browse files
committed
kvm: replace __KVM_HAVE_READONLY_MEM with Kconfig symbol
KVM uses __KVM_HAVE_* symbols in the architecture-dependent uapi/asm/kvm.h to mask unused definitions in include/uapi/linux/kvm.h. __KVM_HAVE_READONLY_MEM however was nothing but a misguided attempt to define KVM_CAP_READONLY_MEM only on architectures where KVM_CHECK_EXTENSION(KVM_CAP_READONLY_MEM) could possibly return nonzero. This however does not make sense, and it prevented userspace from supporting this architecture-independent feature without recompilation. Therefore, these days __KVM_HAVE_READONLY_MEM does not mask anything and is only used in virt/kvm/kvm_main.c. Userspace does not need to test it and there should be no need for it to exist. Remove it and replace it with a Kconfig symbol within Linux source code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 5d9cb71 commit 8886640

File tree

12 files changed

+9
-8
lines changed

12 files changed

+9
-8
lines changed

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
#define __KVM_HAVE_GUEST_DEBUG
4141
#define __KVM_HAVE_IRQ_LINE
42-
#define __KVM_HAVE_READONLY_MEM
4342
#define __KVM_HAVE_VCPU_EVENTS
4443

4544
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1

arch/arm64/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ menuconfig KVM
3636
select HAVE_KVM_IRQ_ROUTING
3737
select IRQ_BYPASS_MANAGER
3838
select HAVE_KVM_IRQ_BYPASS
39+
select HAVE_KVM_READONLY_MEM
3940
select HAVE_KVM_VCPU_RUN_PID_CHANGE
4041
select SCHED_INFO
4142
select GUEST_PERF_EVENTS if PERF_EVENTS

arch/loongarch/include/uapi/asm/kvm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* Some parts derived from the x86 version of this file.
1515
*/
1616

17-
#define __KVM_HAVE_READONLY_MEM
18-
1917
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
2018
#define KVM_DIRTY_LOG_PAGE_OFFSET 64
2119

arch/loongarch/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config KVM
2828
select KVM_GENERIC_HARDWARE_ENABLING
2929
select KVM_GENERIC_MMU_NOTIFIER
3030
select KVM_MMIO
31+
select HAVE_KVM_READONLY_MEM
3132
select KVM_XFER_TO_GUEST_WORK
3233
help
3334
Support hosting virtualized guest machines using

arch/mips/include/uapi/asm/kvm.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* Some parts derived from the x86 version of this file.
2121
*/
2222

23-
#define __KVM_HAVE_READONLY_MEM
24-
2523
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
2624

2725
/*

arch/mips/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config KVM
2626
select KVM_MMIO
2727
select KVM_GENERIC_MMU_NOTIFIER
2828
select KVM_GENERIC_HARDWARE_ENABLING
29+
select HAVE_KVM_READONLY_MEM
2930
help
3031
Support for hosting Guest kernels.
3132

arch/riscv/include/uapi/asm/kvm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <asm/ptrace.h>
1717

1818
#define __KVM_HAVE_IRQ_LINE
19-
#define __KVM_HAVE_READONLY_MEM
2019

2120
#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
2221

arch/riscv/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ config KVM
2424
select HAVE_KVM_IRQ_ROUTING
2525
select HAVE_KVM_MSI
2626
select HAVE_KVM_VCPU_ASYNC_IOCTL
27+
select HAVE_KVM_READONLY_MEM
2728
select KVM_COMMON
2829
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
2930
select KVM_GENERIC_HARDWARE_ENABLING

arch/x86/include/uapi/asm/kvm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#define __KVM_HAVE_DEBUGREGS
5252
#define __KVM_HAVE_XSAVE
5353
#define __KVM_HAVE_XCRS
54-
#define __KVM_HAVE_READONLY_MEM
5554

5655
/* Architectural interrupt line count. */
5756
#define KVM_NR_INTERRUPTS 256

arch/x86/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config KVM
3232
select IRQ_BYPASS_MANAGER
3333
select HAVE_KVM_IRQ_BYPASS
3434
select HAVE_KVM_IRQ_ROUTING
35+
select HAVE_KVM_READONLY_MEM
3536
select KVM_ASYNC_PF
3637
select USER_RETURN_NOTIFIER
3738
select KVM_MMIO

0 commit comments

Comments
 (0)