Skip to content

Commit c5edd75

Browse files
huthbonzini
authored andcommitted
KVM: x86: Remove the KVM_GET_NR_MMU_PAGES ioctl
The KVM_GET_NR_MMU_PAGES ioctl is quite questionable on 64-bit hosts since it fails to return the full 64 bits of the value that can be set with the corresponding KVM_SET_NR_MMU_PAGES call. Its "long" return value is truncated into an "int" in the kvm_arch_vm_ioctl() function. Since this ioctl also never has been used by userspace applications (QEMU, Google's internal VMM, kvmtool and CrosVM have been checked), it's likely the best if we remove this badly designed ioctl before anybody really tries to use it. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Sean Christopherson <seanjc@google.com> Message-Id: <20230208140105.655814-4-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 71fb165 commit c5edd75

3 files changed

Lines changed: 2 additions & 10 deletions

File tree

arch/x86/kvm/x86.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6021,11 +6021,6 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
60216021
return 0;
60226022
}
60236023

6024-
static unsigned long kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
6025-
{
6026-
return kvm->arch.n_max_mmu_pages;
6027-
}
6028-
60296024
static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
60306025
{
60316026
struct kvm_pic *pic = kvm->arch.vpic;
@@ -6711,9 +6706,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
67116706
case KVM_SET_NR_MMU_PAGES:
67126707
r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
67136708
break;
6714-
case KVM_GET_NR_MMU_PAGES:
6715-
r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
6716-
break;
67176709
case KVM_CREATE_IRQCHIP: {
67186710
mutex_lock(&kvm->lock);
67196711

include/uapi/linux/kvm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ struct kvm_vfio_spapr_tce {
14511451
#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
14521452
#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
14531453
#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
1454-
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
1454+
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) /* deprecated */
14551455
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \
14561456
struct kvm_userspace_memory_region)
14571457
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)

tools/include/uapi/linux/kvm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ struct kvm_vfio_spapr_tce {
14511451
#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
14521452
#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
14531453
#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
1454-
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
1454+
#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) /* deprecated */
14551455
#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \
14561456
struct kvm_userspace_memory_region)
14571457
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)

0 commit comments

Comments
 (0)