This patch adds a command line parameter to expose the gbpages cpuid bit to the guest if the kvm kernel module supports it. Signed-off-by: Joerg Roedel <joerg.roedel@xxxxxxx> --- qemu-kvm.c | 1 + qemu-kvm.h | 1 + qemu-options.hx | 2 ++ target-i386/helper.c | 3 +++ vl.c | 4 ++++ 5 files changed, 11 insertions(+), 0 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 2aeb17c..01a889d 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -33,6 +33,7 @@ int kvm_irqchip = 1; int kvm_pit = 1; int kvm_pit_reinject = 1; int kvm_nested = 0; +int kvm_gbpages = 0; kvm_context_t kvm_context; pthread_mutex_t qemu_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/qemu-kvm.h b/qemu-kvm.h index fa40542..fc06b96 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -151,6 +151,7 @@ extern int kvm_irqchip; extern int kvm_pit; extern int kvm_pit_reinject; extern int kvm_nested; +extern int kvm_gbpages; extern kvm_context_t kvm_context; struct ioperm_data { diff --git a/qemu-options.hx b/qemu-options.hx index edd99db..fe9e9d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1594,6 +1594,8 @@ DEF("pcidevice", HAS_ARG, QEMU_OPTION_pcidevice, #endif DEF("enable-nesting", 0, QEMU_OPTION_enable_nesting, "-enable-nesting enable support for running a VM inside the VM (AMD only)\n") +DEF("enable-gbpages", 0, QEMU_OPTION_enable_gbpages, + "-enable-gbpages enable support for 1GB pages in the guest (if supported)\n") DEF("nvram", HAS_ARG, QEMU_OPTION_nvram, "-nvram FILE provide ia64 nvram contents\n") DEF("tdf", 0, QEMU_OPTION_tdf, diff --git a/target-i386/helper.c b/target-i386/helper.c index 6dc0111..9fb2ae4 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1607,6 +1607,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *ecx &= ~4UL; /* 3dnow */ *edx &= ~0xc0000000; + /* enable gbpages and let kvm disable it if unsupported */ + if (kvm_gbpages) + *edx |= (1UL << 26UL); } break; case 0x80000002: diff --git a/vl.c b/vl.c index 845ed54..262ff1b 100644 --- a/vl.c +++ b/vl.c @@ -5621,6 +5621,10 @@ int main(int argc, char **argv, char **envp) kvm_nested = 1; break; } + case QEMU_OPTION_enable_gbpages: { + kvm_gbpages = 1; + break; + } #if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_IA64) || defined(__linux__) case QEMU_OPTION_pcidevice: if (assigned_devices_index >= MAX_DEV_ASSIGN_CMDLINE) { -- 1.6.3.1 -- 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