Lines Matching refs:ghc

1628 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,  in kvm_gfn_to_hva_cache_init()  argument
1638 ghc->gpa = gpa; in kvm_gfn_to_hva_cache_init()
1639 ghc->generation = slots->generation; in kvm_gfn_to_hva_cache_init()
1640 ghc->len = len; in kvm_gfn_to_hva_cache_init()
1641 ghc->memslot = gfn_to_memslot(kvm, start_gfn); in kvm_gfn_to_hva_cache_init()
1642 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL); in kvm_gfn_to_hva_cache_init()
1643 if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) { in kvm_gfn_to_hva_cache_init()
1644 ghc->hva += offset; in kvm_gfn_to_hva_cache_init()
1651 ghc->memslot = gfn_to_memslot(kvm, start_gfn); in kvm_gfn_to_hva_cache_init()
1652 ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, in kvm_gfn_to_hva_cache_init()
1654 if (kvm_is_error_hva(ghc->hva)) in kvm_gfn_to_hva_cache_init()
1659 ghc->memslot = NULL; in kvm_gfn_to_hva_cache_init()
1665 int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, in kvm_write_guest_cached() argument
1671 BUG_ON(len > ghc->len); in kvm_write_guest_cached()
1673 if (slots->generation != ghc->generation) in kvm_write_guest_cached()
1674 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); in kvm_write_guest_cached()
1676 if (unlikely(!ghc->memslot)) in kvm_write_guest_cached()
1677 return kvm_write_guest(kvm, ghc->gpa, data, len); in kvm_write_guest_cached()
1679 if (kvm_is_error_hva(ghc->hva)) in kvm_write_guest_cached()
1682 r = __copy_to_user((void __user *)ghc->hva, data, len); in kvm_write_guest_cached()
1685 mark_page_dirty_in_slot(kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT); in kvm_write_guest_cached()
1691 int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, in kvm_read_guest_cached() argument
1697 BUG_ON(len > ghc->len); in kvm_read_guest_cached()
1699 if (slots->generation != ghc->generation) in kvm_read_guest_cached()
1700 kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); in kvm_read_guest_cached()
1702 if (unlikely(!ghc->memslot)) in kvm_read_guest_cached()
1703 return kvm_read_guest(kvm, ghc->gpa, data, len); in kvm_read_guest_cached()
1705 if (kvm_is_error_hva(ghc->hva)) in kvm_read_guest_cached()
1708 r = __copy_from_user(data, (void __user *)ghc->hva, len); in kvm_read_guest_cached()