mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 04:46:30 -04:00
KVM: s390: Allow for 2G hugepages
Change gmap_2g_allowed() to perform the necessary checks to allow for 2G hugepages to be used, instead of returning false. The GMAP_FLAG_ALLOW_HPAGE_2G gmap flag is now taken into account. Also add appropriate kerneldoc comments. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Message-ID: <20260609150930.665370-4-imbrenda@linux.ibm.com>
This commit is contained in:
@@ -624,10 +624,27 @@ int gmap_try_fixup_minor(struct gmap *gmap, struct guest_fault *fault)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* gmap_2g_allowed() - Check whether a 2G hugepage is allowed.
|
||||
* @gmap: The gmap of the guest.
|
||||
* @f: Describes the fault that is being resolved.
|
||||
* @slot: The memslot the faulting address belongs to.
|
||||
*
|
||||
* The function checks whether the GMAP_FLAG_ALLOW_HPAGE_2G flag is set for
|
||||
* @gmap, whether the offset of the address in the 2G virtual frame is the
|
||||
* same as the offset in the physical 2G frame, and finally whether the whole
|
||||
* 2G page would fit in the given memslot.
|
||||
*
|
||||
* Return: true if a 2G hugepage is allowed to back the faulting address, false
|
||||
* otherwise.
|
||||
*/
|
||||
static inline bool gmap_2g_allowed(struct gmap *gmap, struct guest_fault *f,
|
||||
struct kvm_memory_slot *slot)
|
||||
{
|
||||
return false;
|
||||
return test_bit(GMAP_FLAG_ALLOW_HPAGE_2G, &gmap->flags) &&
|
||||
!((f->gfn ^ f->pfn) & ~_REGION3_FR_MASK) &&
|
||||
slot->base_gfn <= ALIGN_DOWN(f->gfn, _PAGES_PER_REGION3) &&
|
||||
slot->base_gfn + slot->npages >= ALIGN(f->gfn + 1, _PAGES_PER_REGION3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user