commit 0dc0595ee1d84bc77cb431b2417223f3b4a5bd57
parent f6c8fcf146353388bad49aebfa44e31b8170b8ef
Author: Louis Burda <quent.burda@gmail.com>
Date: Mon, 23 Jan 2023 20:48:46 +0100
Remove unused ioctls
Diffstat:
3 files changed, 1 insertion(+), 69 deletions(-)
diff --git a/Makefile b/Makefile
@@ -9,7 +9,7 @@ BINS = test/eviction test/kvm-eviction
BINS += test/kvm-step #test/kvm-execstep
# BINS += test/qemu-eviction_guest test/qemu-eviction_host
# BINS += test/qemu-aes_guest test/qemu-aes_host
-BINS += util/svme util/debug util/reset
+BINS += util/debug util/reset
CFLAGS = -I . -I linux/usr/include
CFLAGS += -g -Wunused-variable -Wunknown-pragmas -Wunused-function
diff --git a/cachepc/kvm.c b/cachepc/kvm.c
@@ -126,9 +126,6 @@ static int cachepc_kvm_calc_baseline_ioctl(void __user *arg_user);
static int cachepc_kvm_read_baseline_ioctl(void __user *arg_user);
static int cachepc_kvm_apply_baseline_ioctl(void __user *arg_user);
-static int cachepc_kvm_vmsa_read_ioctl(void __user *arg_user);
-static int cachepc_kvm_svme_read_ioctl(void __user *arg_user);
-
static int cachepc_kvm_reset_tracking_ioctl(void __user *arg_user);
static int cachepc_kvm_track_mode_ioctl(void __user *arg_user);
// static int cachepc_kvm_track_page_ioctl(void __user *arg_user);
@@ -467,42 +464,6 @@ cachepc_kvm_long_step_ioctl(void __user *arg_user)
}
int
-cachepc_kvm_vmsa_read_ioctl(void __user *arg_user)
-{
- struct kvm_vcpu *vcpu;
- struct vcpu_svm *svm;
-
- if (!arg_user) return -EINVAL;
-
- if (!main_vm || xa_empty(&main_vm->vcpu_array))
- return -EFAULT;
-
- vcpu = xa_load(&main_vm->vcpu_array, 0);
- svm = to_svm(vcpu);
-
- if (copy_to_user(arg_user, svm->sev_es.vmsa, PAGE_SIZE))
- return -EFAULT;
-
- return 0;
-}
-
-int
-cachepc_kvm_svme_read_ioctl(void __user *arg_user)
-{
- uint64_t res;
- uint32_t svme;
-
- if (!arg_user) return -EINVAL;
-
- res = __rdmsr(0xC0000080);
- svme = (res >> 12) & 1;
- if (copy_to_user(arg_user, &svme, sizeof(uint32_t)))
- return -EFAULT;
-
- return 0;
-}
-
-int
cachepc_kvm_reset_tracking_ioctl(void __user *arg_user)
{
struct kvm_vcpu *vcpu;
@@ -706,10 +667,6 @@ cachepc_kvm_ioctl(struct file *file, unsigned int ioctl, unsigned long arg)
return cachepc_kvm_apply_baseline_ioctl(arg_user);
case KVM_CPC_LONG_STEP:
return cachepc_kvm_long_step_ioctl(arg_user);
- case KVM_CPC_VMSA_READ:
- return cachepc_kvm_vmsa_read_ioctl(arg_user);
- case KVM_CPC_SVME_READ:
- return cachepc_kvm_svme_read_ioctl(arg_user);
case KVM_CPC_RESET_TRACKING:
return cachepc_kvm_reset_tracking_ioctl(arg_user);
case KVM_CPC_TRACK_MODE:
diff --git a/util/svme.c b/util/svme.c
@@ -1,25 +0,0 @@
-#include "cachepc/uapi.h"
-
-#include <sys/ioctl.h>
-#include <err.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdio.h>
-
-int
-main(int argc, const char **argv)
-{
- uint32_t svme;
- int kvm_fd;
-
- kvm_fd = open("/dev/kvm", O_RDWR);
- if (kvm_fd < 0) err(1, "open /dev/kvm");
-
- if (ioctl(kvm_fd, KVM_CPC_SVME_READ, &svme))
- err(1, "ioctl KVM_CPC_SVME_READ");
-
- printf("%u\n", svme);
-
- close(kvm_fd);
-}