diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-01-23 20:48:46 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-01-23 20:48:46 +0100 |
| commit | 0dc0595ee1d84bc77cb431b2417223f3b4a5bd57 (patch) | |
| tree | f4fb1305e2655157e864294f11c8b7ff01fe2218 | |
| parent | f6c8fcf146353388bad49aebfa44e31b8170b8ef (diff) | |
| download | cachepc-0dc0595ee1d84bc77cb431b2417223f3b4a5bd57.tar.gz cachepc-0dc0595ee1d84bc77cb431b2417223f3b4a5bd57.zip | |
Remove unused ioctls
| -rwxr-xr-x | Makefile | 2 | ||||
| -rw-r--r-- | cachepc/kvm.c | 43 | ||||
| -rw-r--r-- | util/svme.c | 25 |
3 files changed, 1 insertions, 69 deletions
@@ -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 index 6756018..083aafb 100644 --- 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 deleted file mode 100644 index 4876ac4..0000000 --- a/util/svme.c +++ /dev/null @@ -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); -} |
