Joerg Roedel wrote:
This patch enables support for 1GB pages in KVM by implementing
the support in backing_size().
@@ -490,18 +492,30 @@ static enum kvm_page_size host_page_size(struct kvm *kvm, gfn_t gfn)
static enum kvm_page_size backing_size(struct kvm_vcpu *vcpu, gfn_t gfn)
{
struct kvm_memory_slot *slot;
-
- if (has_wrprotected_page(vcpu->kvm, gfn))
- return KVM_PAGE_SIZE_4k;
-
- if (host_page_size(vcpu->kvm, gfn) < KVM_PAGE_SIZE_2M)
- return KVM_PAGE_SIZE_4k;
+ enum kvm_page_size host_size, ret;
slot = gfn_to_memslot(vcpu->kvm, gfn);
if (slot && slot->dirty_bitmap)
return KVM_PAGE_SIZE_4k;
- return KVM_PAGE_SIZE_2M;
+ host_size = host_page_size(vcpu->kvm, gfn);
+
+ switch (host_size) {
+ case KVM_PAGE_SIZE_1G:
+ if (!has_wrprotected_largepage(vcpu->kvm, gfn)) {
+ ret = KVM_PAGE_SIZE_1G;
+ break;
+ }
What if there's a wrprotected_page in there?
+ case KVM_PAGE_SIZE_2M:
+ if (!has_wrprotected_page(vcpu->kvm, gfn)) {
+ ret = KVM_PAGE_SIZE_2M;
+ break;
+ }
+ default:
+ ret = KVM_PAGE_SIZE_4k;
+ }
+
+ return ret;
}
/*
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html