Lines Matching refs:kvm
191 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
193 void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
195 struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx,
263 struct kvm *kvm; member
385 struct kvm *kvm, int irq_source_id, int level,
446 struct kvm { struct
536 static inline bool kvm_dirty_log_manual_protect_and_init_set(struct kvm *kvm) in kvm_dirty_log_manual_protect_and_init_set() argument
538 return !!(kvm->manual_dirty_log_protect & KVM_DIRTY_LOG_INITIALLY_SET); in kvm_dirty_log_manual_protect_and_init_set()
541 static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) in kvm_get_bus() argument
543 return srcu_dereference_check(kvm->buses[idx], &kvm->srcu, in kvm_get_bus()
544 lockdep_is_held(&kvm->slots_lock) || in kvm_get_bus()
545 !refcount_read(&kvm->users_count)); in kvm_get_bus()
548 static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) in kvm_get_vcpu() argument
550 int num_vcpus = atomic_read(&kvm->online_vcpus); in kvm_get_vcpu()
555 return kvm->vcpus[i]; in kvm_get_vcpu()
558 #define kvm_for_each_vcpu(idx, vcpup, kvm) \ argument
560 idx < atomic_read(&kvm->online_vcpus) && \
561 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
564 static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) in kvm_get_vcpu_by_id() argument
572 vcpu = kvm_get_vcpu(kvm, id); in kvm_get_vcpu_by_id()
575 kvm_for_each_vcpu(i, vcpu, kvm) in kvm_get_vcpu_by_id()
598 void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm);
599 void kvm_arch_post_irq_routing_update(struct kvm *kvm);
601 static inline void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm) in kvm_arch_post_irq_ack_notifier_list_update() argument
604 static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm) in kvm_arch_post_irq_routing_update() argument
626 void kvm_get_kvm(struct kvm *kvm);
627 void kvm_put_kvm(struct kvm *kvm);
628 void kvm_put_kvm_no_destroy(struct kvm *kvm);
630 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id) in __kvm_memslots() argument
633 return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu, in __kvm_memslots()
634 lockdep_is_held(&kvm->slots_lock) || in __kvm_memslots()
635 !refcount_read(&kvm->users_count)); in __kvm_memslots()
638 static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) in kvm_memslots() argument
640 return __kvm_memslots(kvm, 0); in kvm_memslots()
647 return __kvm_memslots(vcpu->kvm, as_id); in kvm_vcpu_memslots()
683 int kvm_set_memory_region(struct kvm *kvm,
685 int __kvm_set_memory_region(struct kvm *kvm,
687 void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot);
688 void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen);
689 int kvm_arch_prepare_memory_region(struct kvm *kvm,
693 void kvm_arch_commit_memory_region(struct kvm *kvm,
699 void kvm_arch_flush_shadow_all(struct kvm *kvm);
701 void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
707 struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
708 unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
709 unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
717 kvm_pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
718 kvm_pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
733 int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
735 int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
736 int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
738 int kvm_read_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
741 int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
743 int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
745 int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
747 int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
750 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
753 #define __kvm_get_guest(kvm, gfn, offset, v) \ argument
755 unsigned long __addr = gfn_to_hva(kvm, gfn); \
764 #define kvm_get_guest(kvm, gpa, v) \ argument
767 struct kvm *__kvm = kvm; \
773 #define __kvm_put_guest(kvm, gfn, offset, v) \ argument
775 unsigned long __addr = gfn_to_hva(kvm, gfn); \
782 mark_page_dirty(kvm, gfn); \
786 #define kvm_put_guest(kvm, gpa, v) \ argument
789 struct kvm *__kvm = kvm; \
795 int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
796 int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
797 struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
798 bool kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
802 void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
840 void kvm_flush_remote_tlbs(struct kvm *kvm);
841 void kvm_reload_remote_mmus(struct kvm *kvm);
850 bool kvm_make_vcpus_request_mask(struct kvm *kvm, unsigned int req,
853 bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
854 bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
856 bool kvm_make_cpus_request_mask(struct kvm *kvm, unsigned int req,
865 int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext);
867 void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
871 void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot);
874 void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
877 int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log);
878 int kvm_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log,
882 int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level,
884 int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
916 int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id);
934 int kvm_arch_post_init_vm(struct kvm *kvm);
935 void kvm_arch_pre_destroy_vm(struct kvm *kvm);
942 static inline struct kvm *kvm_arch_alloc_vm(void) in kvm_arch_alloc_vm()
944 return kzalloc(sizeof(struct kvm), GFP_KERNEL); in kvm_arch_alloc_vm()
947 static inline void kvm_arch_free_vm(struct kvm *kvm) in kvm_arch_free_vm() argument
949 kfree(kvm); in kvm_arch_free_vm()
954 static inline int kvm_arch_flush_remote_tlb(struct kvm *kvm) in kvm_arch_flush_remote_tlb() argument
961 void kvm_arch_register_noncoherent_dma(struct kvm *kvm);
962 void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm);
963 bool kvm_arch_has_noncoherent_dma(struct kvm *kvm);
965 static inline void kvm_arch_register_noncoherent_dma(struct kvm *kvm) in kvm_arch_register_noncoherent_dma() argument
969 static inline void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm) in kvm_arch_unregister_noncoherent_dma() argument
973 static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm) in kvm_arch_has_noncoherent_dma() argument
979 void kvm_arch_start_assignment(struct kvm *kvm);
980 void kvm_arch_end_assignment(struct kvm *kvm);
981 bool kvm_arch_has_assigned_device(struct kvm *kvm);
983 static inline void kvm_arch_start_assignment(struct kvm *kvm) in kvm_arch_start_assignment() argument
987 static inline void kvm_arch_end_assignment(struct kvm *kvm) in kvm_arch_end_assignment() argument
991 static inline bool kvm_arch_has_assigned_device(struct kvm *kvm) in kvm_arch_has_assigned_device() argument
1012 bool kvm_arch_intc_initialized(struct kvm *kvm);
1014 static inline bool kvm_arch_intc_initialized(struct kvm *kvm) in kvm_arch_intc_initialized() argument
1020 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
1021 void kvm_arch_destroy_vm(struct kvm *kvm);
1022 void kvm_arch_sync_events(struct kvm *kvm);
1036 int kvm_irq_map_gsi(struct kvm *kvm,
1038 int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin);
1040 int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
1042 int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
1045 struct kvm *kvm, int irq_source_id,
1047 bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
1048 void kvm_notify_acked_gsi(struct kvm *kvm, int gsi);
1049 void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
1050 void kvm_register_irq_ack_notifier(struct kvm *kvm,
1052 void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
1054 int kvm_request_irq_source_id(struct kvm *kvm);
1055 void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
1056 bool kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args);
1110 static inline int memslot_id(struct kvm *kvm, gfn_t gfn) in memslot_id() argument
1112 return gfn_to_memslot(kvm, gfn)->id; in memslot_id()
1144 static inline bool kvm_is_error_gpa(struct kvm *kvm, gpa_t gpa) in kvm_is_error_gpa() argument
1146 unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa)); in kvm_is_error_gpa()
1157 struct kvm *kvm; member
1172 { n, offsetof(struct kvm, stat.x), KVM_STAT_VM, ## __VA_ARGS__ }
1180 static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) in mmu_notifier_retry() argument
1182 if (unlikely(kvm->mmu_notifier_count)) in mmu_notifier_retry()
1195 if (kvm->mmu_notifier_seq != mmu_seq) in mmu_notifier_retry()
1205 bool kvm_arch_can_set_irq_routing(struct kvm *kvm);
1206 int kvm_set_irq_routing(struct kvm *kvm,
1210 int kvm_set_routing_entry(struct kvm *kvm,
1213 void kvm_free_irq_routing(struct kvm *kvm);
1217 static inline void kvm_free_irq_routing(struct kvm *kvm) {} in kvm_free_irq_routing() argument
1221 int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
1225 void kvm_eventfd_init(struct kvm *kvm);
1226 int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
1229 int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
1230 void kvm_irqfd_release(struct kvm *kvm);
1231 void kvm_irq_routing_update(struct kvm *);
1233 static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd() argument
1238 static inline void kvm_irqfd_release(struct kvm *kvm) {} in kvm_irqfd_release() argument
1243 static inline void kvm_eventfd_init(struct kvm *kvm) {} in kvm_eventfd_init() argument
1245 static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) in kvm_irqfd() argument
1250 static inline void kvm_irqfd_release(struct kvm *kvm) {} in kvm_irqfd_release() argument
1253 static inline void kvm_irq_routing_update(struct kvm *kvm) in kvm_irq_routing_update() argument
1258 static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) in kvm_ioeventfd() argument
1265 void kvm_arch_irq_routing_update(struct kvm *kvm);
1317 struct kvm *kvm; member
1415 int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
1455 void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm,
1467 typedef int (*kvm_vm_thread_fn_t)(struct kvm *kvm, uintptr_t data);
1469 int kvm_vm_create_worker_thread(struct kvm *kvm, kvm_vm_thread_fn_t thread_fn,