@@ -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;
@@ -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 {
@@ -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,
@@ -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:
@@ -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) {
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@amd.com> --- 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(-)