Lines Matching defs:gpa
60 static bool kvm_gpc_is_valid_len(gpa_t gpa, unsigned long uhva,
63 unsigned long offset = kvm_is_error_gpa(gpa) ? offset_in_page(uhva) :
64 offset_in_page(gpa);
84 if (!kvm_is_error_gpa(gpc->gpa) && gpc->generation != slots->generation)
90 if (!kvm_gpc_is_valid_len(gpc->gpa, gpc->uhva, len))
166 .gfn = gpa_to_gfn(gpc->gpa),
177 * Invalidate the cache prior to dropping gpc->lock, the gpa=>uhva
179 * different task may not fail the gpa/uhva/generation checks.
256 static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa, unsigned long uhva)
266 /* Either gpa or uhva must be valid, but not both */
267 if (WARN_ON_ONCE(kvm_is_error_gpa(gpa) == kvm_is_error_hva(uhva)))
283 if (kvm_is_error_gpa(gpa)) {
286 gpc->gpa = INVALID_GPA;
295 page_offset = offset_in_page(gpa);
297 if (gpc->gpa != gpa || gpc->generation != slots->generation ||
299 gfn_t gfn = gpa_to_gfn(gpa);
301 gpc->gpa = gpa;
345 * Some/all of the uhva, gpa, and memslot generation info may still be
372 if (!kvm_gpc_is_valid_len(gpc->gpa, gpc->uhva, len))
380 uhva = kvm_is_error_gpa(gpc->gpa) ? gpc->uhva : KVM_HVA_ERR_BAD;
382 return __kvm_gpc_refresh(gpc, gpc->gpa, uhva);
392 gpc->gpa = INVALID_GPA;
397 static int __kvm_gpc_activate(struct gfn_to_pfn_cache *gpc, gpa_t gpa, unsigned long uhva,
402 if (!kvm_gpc_is_valid_len(gpa, uhva, len))
424 return __kvm_gpc_refresh(gpc, gpa, uhva);
427 int kvm_gpc_activate(struct gfn_to_pfn_cache *gpc, gpa_t gpa, unsigned long len)
433 if (WARN_ON_ONCE(kvm_is_error_gpa(gpa)))
436 return __kvm_gpc_activate(gpc, gpa, KVM_HVA_ERR_BAD, len);