Lines Matching refs:ghc

1811 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,  in kvm_gfn_to_hva_cache_init()  argument
1821 ghc->gpa = gpa; in kvm_gfn_to_hva_cache_init()
1822 ghc->generation = slots->generation; in kvm_gfn_to_hva_cache_init()
1823 ghc->len = len; in kvm_gfn_to_hva_cache_init()
1824 ghc->memslot = gfn_to_memslot(kvm, start_gfn); in kvm_gfn_to_hva_cache_init()
1825 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL); in kvm_gfn_to_hva_cache_init()
1826 if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) { in kvm_gfn_to_hva_cache_init()
1827 ghc->hva += offset; in kvm_gfn_to_hva_cache_init()
1834 ghc->memslot = gfn_to_memslot(kvm, start_gfn); in kvm_gfn_to_hva_cache_init()
1835 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, in kvm_gfn_to_hva_cache_init()
1837 if (kvm_is_error_hva(ghc->hva)) in kvm_gfn_to_hva_cache_init()
1842 ghc->memslot = NULL; in kvm_gfn_to_hva_cache_init()
1848 int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, in kvm_write_guest_cached() argument
1854 BUG_ON(len > ghc->len); in kvm_write_guest_cached()
1856 if (slots->generation != ghc->generation) in kvm_write_guest_cached()
1857 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); in kvm_write_guest_cached()
1859 if (unlikely(!ghc->memslot)) in kvm_write_guest_cached()
1860 return kvm_write_guest(kvm, ghc->gpa, data, len); in kvm_write_guest_cached()
1862 if (kvm_is_error_hva(ghc->hva)) in kvm_write_guest_cached()
1865 r = __copy_to_user((void __user *)ghc->hva, data, len); in kvm_write_guest_cached()
1868 mark_page_dirty_in_slot(ghc->memslot, ghc->gpa >> PAGE_SHIFT); in kvm_write_guest_cached()
1874 int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, in kvm_read_guest_cached() argument
1880 BUG_ON(len > ghc->len); in kvm_read_guest_cached()
1882 if (slots->generation != ghc->generation) in kvm_read_guest_cached()
1883 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); in kvm_read_guest_cached()
1885 if (unlikely(!ghc->memslot)) in kvm_read_guest_cached()
1886 return kvm_read_guest(kvm, ghc->gpa, data, len); in kvm_read_guest_cached()
1888 if (kvm_is_error_hva(ghc->hva)) in kvm_read_guest_cached()
1891 r = __copy_from_user(data, (void __user *)ghc->hva, len); in kvm_read_guest_cached()