diff options
-rw-r--r-- | include/linux/kvm_host.h | 1 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 7 | ||||
-rw-r--r-- | virt/kvm/vfio.c | 5 | ||||
-rw-r--r-- | virt/kvm/vfio.h | 4 |
4 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 28be31f49250..ea53b04993f2 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -1080,6 +1080,7 @@ void kvm_device_get(struct kvm_device *dev); | |||
1080 | void kvm_device_put(struct kvm_device *dev); | 1080 | void kvm_device_put(struct kvm_device *dev); |
1081 | struct kvm_device *kvm_device_from_filp(struct file *filp); | 1081 | struct kvm_device *kvm_device_from_filp(struct file *filp); |
1082 | int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type); | 1082 | int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type); |
1083 | void kvm_unregister_device_ops(u32 type); | ||
1083 | 1084 | ||
1084 | extern struct kvm_device_ops kvm_mpic_ops; | 1085 | extern struct kvm_device_ops kvm_mpic_ops; |
1085 | extern struct kvm_device_ops kvm_xics_ops; | 1086 | extern struct kvm_device_ops kvm_xics_ops; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 384eaa7b02fa..25ffac9e947d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -2354,6 +2354,12 @@ int kvm_register_device_ops(struct kvm_device_ops *ops, u32 type) | |||
2354 | return 0; | 2354 | return 0; |
2355 | } | 2355 | } |
2356 | 2356 | ||
2357 | void kvm_unregister_device_ops(u32 type) | ||
2358 | { | ||
2359 | if (kvm_device_ops_table[type] != NULL) | ||
2360 | kvm_device_ops_table[type] = NULL; | ||
2361 | } | ||
2362 | |||
2357 | static int kvm_ioctl_create_device(struct kvm *kvm, | 2363 | static int kvm_ioctl_create_device(struct kvm *kvm, |
2358 | struct kvm_create_device *cd) | 2364 | struct kvm_create_device *cd) |
2359 | { | 2365 | { |
@@ -3328,5 +3334,6 @@ void kvm_exit(void) | |||
3328 | kvm_arch_exit(); | 3334 | kvm_arch_exit(); |
3329 | kvm_irqfd_exit(); | 3335 | kvm_irqfd_exit(); |
3330 | free_cpumask_var(cpus_hardware_enabled); | 3336 | free_cpumask_var(cpus_hardware_enabled); |
3337 | kvm_vfio_ops_exit(); | ||
3331 | } | 3338 | } |
3332 | EXPORT_SYMBOL_GPL(kvm_exit); | 3339 | EXPORT_SYMBOL_GPL(kvm_exit); |
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index 281e7cf2b8e5..620e37f741b8 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c | |||
@@ -283,3 +283,8 @@ int kvm_vfio_ops_init(void) | |||
283 | { | 283 | { |
284 | return kvm_register_device_ops(&kvm_vfio_ops, KVM_DEV_TYPE_VFIO); | 284 | return kvm_register_device_ops(&kvm_vfio_ops, KVM_DEV_TYPE_VFIO); |
285 | } | 285 | } |
286 | |||
287 | void kvm_vfio_ops_exit(void) | ||
288 | { | ||
289 | kvm_unregister_device_ops(KVM_DEV_TYPE_VFIO); | ||
290 | } | ||
diff --git a/virt/kvm/vfio.h b/virt/kvm/vfio.h index 92eac75d6b62..ab88c7dc0514 100644 --- a/virt/kvm/vfio.h +++ b/virt/kvm/vfio.h | |||
@@ -3,11 +3,15 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_KVM_VFIO | 4 | #ifdef CONFIG_KVM_VFIO |
5 | int kvm_vfio_ops_init(void); | 5 | int kvm_vfio_ops_init(void); |
6 | void kvm_vfio_ops_exit(void); | ||
6 | #else | 7 | #else |
7 | static inline int kvm_vfio_ops_init(void) | 8 | static inline int kvm_vfio_ops_init(void) |
8 | { | 9 | { |
9 | return 0; | 10 | return 0; |
10 | } | 11 | } |
12 | static inline void kvm_vfio_ops_exit(void) | ||
13 | { | ||
14 | } | ||
11 | #endif | 15 | #endif |
12 | 16 | ||
13 | #endif | 17 | #endif |