]> Git Repo - linux.git/commitdiff
KVM: x86: Add infrastructure for MSR filtering
authorAlexander Graf <[email protected]>
Fri, 25 Sep 2020 14:34:17 +0000 (16:34 +0200)
committerPaolo Bonzini <[email protected]>
Mon, 28 Sep 2020 11:58:05 +0000 (07:58 -0400)
In the following commits we will add pieces of MSR filtering.
To ensure that code compiles even with the feature half-merged, let's add
a few stubs and struct definitions before the real patches start.

Signed-off-by: Alexander Graf <[email protected]>
Message-Id: <20200925143422[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
arch/x86/include/asm/kvm_host.h
arch/x86/include/uapi/asm/kvm.h
arch/x86/kvm/x86.c
arch/x86/kvm/x86.h

index dd2665504dc0703d91584e5abcb00bd4eb79f42a..f4a2443219bc00425e735f11e9818e655fbbba18 100644 (file)
@@ -1235,6 +1235,7 @@ struct kvm_x86_ops {
        int (*enable_direct_tlbflush)(struct kvm_vcpu *vcpu);
 
        void (*migrate_timers)(struct kvm_vcpu *vcpu);
+       void (*msr_filter_changed)(struct kvm_vcpu *vcpu);
 };
 
 struct kvm_x86_nested_ops {
index 0780f97c185088ce214bf7f57d917fda7aff730b..c2fd0aa2f587c44fbed9ed5ad92ca974136bec19 100644 (file)
@@ -192,6 +192,8 @@ struct kvm_msr_list {
        __u32 indices[0];
 };
 
+#define KVM_MSR_FILTER_READ  (1 << 0)
+#define KVM_MSR_FILTER_WRITE (1 << 1)
 
 struct kvm_cpuid_entry {
        __u32 function;
index af6d008145cd46a9ff3f6c626915a6ee1a4065ce..60219882fee217e8bd36a1786f046897f39e5dbc 100644 (file)
@@ -1488,6 +1488,12 @@ void kvm_enable_efer_bits(u64 mask)
 }
 EXPORT_SYMBOL_GPL(kvm_enable_efer_bits);
 
+bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type)
+{
+       return true;
+}
+EXPORT_SYMBOL_GPL(kvm_msr_allowed);
+
 /*
  * Write @data into the MSR specified by @index.  Select MSR specific fault
  * checks are bypassed if @host_initiated is %true.
index 941f288c38aa33f572c6febcf39f3e8c69ebddcd..3900ab0c6004d20567242107e09ee1e08557de59 100644 (file)
@@ -374,6 +374,7 @@ bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu);
 int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r,
                              struct x86_exception *e);
 int kvm_handle_invpcid(struct kvm_vcpu *vcpu, unsigned long type, gva_t gva);
+bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type);
 
 #define  KVM_MSR_RET_INVALID  2
 
This page took 0.085902 seconds and 4 git commands to generate.