Lines Matching refs:kvm

162 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
165 bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
166 bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
168 bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
205 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
207 int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
209 struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx,
241 bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range);
242 bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range);
243 bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range);
244 bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range);
296 struct kvm *kvm; member
477 struct kvm *kvm, int irq_source_id, int level,
537 struct kvm { struct
654 static inline void kvm_vm_bugged(struct kvm *kvm) in kvm_vm_bugged() argument
656 kvm->vm_bugged = true; in kvm_vm_bugged()
657 kvm_make_all_cpus_request(kvm, KVM_REQ_VM_BUGGED); in kvm_vm_bugged()
660 #define KVM_BUG(cond, kvm, fmt...) \ argument
664 if (WARN_ONCE(__ret && !(kvm)->vm_bugged, fmt)) \
665 kvm_vm_bugged(kvm); \
669 #define KVM_BUG_ON(cond, kvm) \ argument
673 if (WARN_ON_ONCE(__ret && !(kvm)->vm_bugged)) \
674 kvm_vm_bugged(kvm); \
678 static inline bool kvm_dirty_log_manual_protect_and_init_set(struct kvm *kvm) in kvm_dirty_log_manual_protect_and_init_set() argument
680 return !!(kvm->manual_dirty_log_protect & KVM_DIRTY_LOG_INITIALLY_SET); in kvm_dirty_log_manual_protect_and_init_set()
683 static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) in kvm_get_bus() argument
685 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu, in kvm_get_bus()
686 lockdep_is_held(&kvm->slots_lock) || in kvm_get_bus()
687 !refcount_read(&kvm->users_count)); in kvm_get_bus()
690 static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) in kvm_get_vcpu() argument
692 int num_vcpus = atomic_read(&kvm->online_vcpus); in kvm_get_vcpu()
697 return kvm->vcpus[i]; in kvm_get_vcpu()
700 #define kvm_for_each_vcpu(idx, vcpup, kvm) \ argument
702 idx < atomic_read(&kvm->online_vcpus) && \
703 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
706 static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) in kvm_get_vcpu_by_id() argument
714 vcpu = kvm_get_vcpu(kvm, id); in kvm_get_vcpu_by_id()
717 kvm_for_each_vcpu(i, vcpu, kvm) in kvm_get_vcpu_by_id()
735 void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm);
736 void kvm_arch_post_irq_routing_update(struct kvm *kvm);
738 static inline void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm) in kvm_arch_post_irq_ack_notifier_list_update() argument
741 static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm) in kvm_arch_post_irq_routing_update() argument
763 void kvm_get_kvm(struct kvm *kvm);
764 bool kvm_get_kvm_safe(struct kvm *kvm);
765 void kvm_put_kvm(struct kvm *kvm);
767 void kvm_put_kvm_no_destroy(struct kvm *kvm);
769 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) in __kvm_memslots() argument
772 return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu, in __kvm_memslots()
773 lockdep_is_held(&kvm->slots_lock) || in __kvm_memslots()
774 !refcount_read(&kvm->users_count)); in __kvm_memslots()
777 static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) in kvm_memslots() argument
779 return __kvm_memslots(kvm, 0); in kvm_memslots()
786 return __kvm_memslots(vcpu->kvm, as_id); in kvm_vcpu_memslots()
822 int kvm_set_memory_region(struct kvm *kvm,
824 int __kvm_set_memory_region(struct kvm *kvm,
826 void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot);
827 void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen);
828 int kvm_arch_prepare_memory_region(struct kvm *kvm,
832 void kvm_arch_commit_memory_region(struct kvm *kvm,
838 void kvm_arch_flush_shadow_all(struct kvm *kvm);
840 void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
846 struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
847 unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
848 unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
856 kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
857 kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
871 int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
873 int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
874 int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
876 int kvm_read_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
879 int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
881 int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
883 int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
885 int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
888 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
891 #define __kvm_get_guest(kvm, gfn, offset, v) \ argument
893 unsigned long __addr = gfn_to_hva(kvm, gfn); \
902 #define kvm_get_guest(kvm, gpa, v) \ argument
905 struct kvm *__kvm = kvm; \
911 #define __kvm_put_guest(kvm, gfn, offset, v) \ argument
913 unsigned long __addr = gfn_to_hva(kvm, gfn); \
920 mark_page_dirty(kvm, gfn); \
924 #define kvm_put_guest(kvm, gpa, v) \ argument
927 struct kvm *__kvm = kvm; \
933 int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
934 struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
935 bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
938 void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot, gfn_t gfn);
939 void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
977 void kvm_flush_remote_tlbs(struct kvm *kvm);
978 void kvm_reload_remote_mmus(struct kvm *kvm);
987 void kvm_inc_notifier_count(struct kvm *kvm, unsigned long start,
989 void kvm_dec_notifier_count(struct kvm *kvm, unsigned long start,
998 int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
1000 void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
1004 void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot);
1007 void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
1010 int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log);
1011 int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log,
1015 int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
1017 int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
1049 int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id);
1055 int kvm_arch_pm_notifier(struct kvm *kvm, unsigned long state);
1072 int kvm_arch_post_init_vm(struct kvm *kvm);
1073 void kvm_arch_pre_destroy_vm(struct kvm *kvm);
1074 int kvm_arch_create_vm_debugfs(struct kvm *kvm);
1081 static inline struct kvm *kvm_arch_alloc_vm(void) in kvm_arch_alloc_vm()
1083 return kzalloc(sizeof(struct kvm), GFP_KERNEL); in kvm_arch_alloc_vm()
1086 static inline void kvm_arch_free_vm(struct kvm *kvm) in kvm_arch_free_vm() argument
1088 kfree(kvm); in kvm_arch_free_vm()
1093 static inline int kvm_arch_flush_remote_tlb(struct kvm *kvm) in kvm_arch_flush_remote_tlb() argument
1100 void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
1101 void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
1102 bool kvm_arch_has_noncoherent_dma(struct kvm *kvm);
1104 static inline void kvm_arch_register_noncoherent_dma(struct kvm *kvm) in kvm_arch_register_noncoherent_dma() argument
1108 static inline void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm) in kvm_arch_unregister_noncoherent_dma() argument
1112 static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm) in kvm_arch_has_noncoherent_dma() argument
1118 void kvm_arch_start_assignment(struct kvm *kvm);
1119 void kvm_arch_end_assignment(struct kvm *kvm);
1120 bool kvm_arch_has_assigned_device(struct kvm *kvm);
1122 static inline void kvm_arch_start_assignment(struct kvm *kvm) in kvm_arch_start_assignment() argument
1126 static inline void kvm_arch_end_assignment(struct kvm *kvm) in kvm_arch_end_assignment() argument
1130 static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) in kvm_arch_has_assigned_device() argument
1151 bool kvm_arch_intc_initialized(struct kvm *kvm);
1153 static inline bool kvm_arch_intc_initialized(struct kvm *kvm) in kvm_arch_intc_initialized() argument
1159 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
1160 void kvm_arch_destroy_vm(struct kvm *kvm);
1161 void kvm_arch_sync_events(struct kvm *kvm);
1175 int kvm_irq_map_gsi(struct kvm *kvm,
1177 int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
1179 int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
1181 int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
1184 struct kvm *kvm, int irq_source_id,
1186 bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
1187 void kvm_notify_acked_gsi(struct kvm *kvm, int gsi);
1188 void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
1189 void kvm_register_irq_ack_notifier(struct kvm *kvm,
1191 void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
1193 int kvm_request_irq_source_id(struct kvm *kvm);
1194 void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
1195 bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args);
1295 static inline int memslot_id(struct kvm *kvm, gfn_t gfn) in memslot_id() argument
1297 return gfn_to_memslot(kvm, gfn)->id; in memslot_id()
1329 static inline bool kvm_is_error_gpa(struct kvm *kvm, gpa_t gpa) in kvm_is_error_gpa() argument
1331 unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa)); in kvm_is_error_gpa()
1342 struct kvm *kvm; member
1511 static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) in mmu_notifier_retry() argument
1513 if (unlikely(kvm->mmu_notifier_count)) in mmu_notifier_retry()
1526 if (kvm->mmu_notifier_seq != mmu_seq) in mmu_notifier_retry()
1531 static inline int mmu_notifier_retry_hva(struct kvm *kvm, in mmu_notifier_retry_hva() argument
1535 lockdep_assert_held(&kvm->mmu_lock); in mmu_notifier_retry_hva()
1542 if (unlikely(kvm->mmu_notifier_count) && in mmu_notifier_retry_hva()
1543 hva >= kvm->mmu_notifier_range_start && in mmu_notifier_retry_hva()
1544 hva < kvm->mmu_notifier_range_end) in mmu_notifier_retry_hva()
1546 if (kvm->mmu_notifier_seq != mmu_seq) in mmu_notifier_retry_hva()
1556 bool kvm_arch_can_set_irq_routing(struct kvm *kvm);
1557 int kvm_set_irq_routing(struct kvm *kvm,
1561 int kvm_set_routing_entry(struct kvm *kvm,
1564 void kvm_free_irq_routing(struct kvm *kvm);
1568 static inline void kvm_free_irq_routing(struct kvm *kvm) {} in kvm_free_irq_routing() argument
1572 int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
1576 void kvm_eventfd_init(struct kvm *kvm);
1577 int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
1580 int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
1581 void kvm_irqfd_release(struct kvm *kvm);
1582 void kvm_irq_routing_update(struct kvm *);
1584 static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd() argument
1589 static inline void kvm_irqfd_release(struct kvm *kvm) {} in kvm_irqfd_release() argument
1594 static inline void kvm_eventfd_init(struct kvm *kvm) {} in kvm_eventfd_init() argument
1596 static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd() argument
1601 static inline void kvm_irqfd_release(struct kvm *kvm) {} in kvm_irqfd_release() argument
1604 static inline void kvm_irq_routing_update(struct kvm *kvm) in kvm_irq_routing_update() argument
1609 static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) in kvm_ioeventfd() argument
1616 void kvm_arch_irq_routing_update(struct kvm *kvm);
1668 struct kvm *kvm; member
1766 int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
1806 void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm,
1818 typedef int (*kvm_vm_thread_fn_t)(struct kvm *kvm, uintptr_t data);
1820 int kvm_vm_create_worker_thread(struct kvm *kvm, kvm_vm_thread_fn_t thread_fn,