* [Qemu-devel] [PATCH] allow more than 1T in KVM x86 guest
@ 2010-09-15 17:13 Andrea Arcangeli
2010-09-15 18:26 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Arcangeli @ 2010-09-15 17:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori
Subject: allow more than 1T in KVM x86 guest
From: Andrea Arcangeli <aarcange@redhat.com>
When host supports 48 bits of physical address reflect that in the guest cpuid
to allow the guest to use more than 1TB of RAM.
The migration code should probably be updated accordingly checking if the size
of the guest ram is bigger than the migration target cpuid 0x80000008 limit and
failing migration in that case. (not a real practical issue, I don't
see many people migrating >1T guests yet :)
The comment below refers to a 42 bit limit on exec.c, but I didn't identify
what the comment refers to yet. At least now guest should be able to use 4TB.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
index d63fdcb..462e709 100644
--- a/target-i386/cpuid.c
+++ b/target-i386/cpuid.c
@@ -1189,6 +1189,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
/* 64 bit processor */
/* XXX: The physical address space is limited to 42 bits in exec.c. */
*eax = 0x00003028; /* 48 bits virtual, 40 bits physical */
+ if (kvm_enabled()) {
+ uint32_t _eax;
+ host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL);
+ if (_eax >= 0x80000008)
+ host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL);
+ }
} else {
if (env->cpuid_features & CPUID_PSE36)
*eax = 0x00000024; /* 36 bits physical */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] allow more than 1T in KVM x86 guest
2010-09-15 17:13 [Qemu-devel] [PATCH] allow more than 1T in KVM x86 guest Andrea Arcangeli
@ 2010-09-15 18:26 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2010-09-15 18:26 UTC (permalink / raw)
To: Andrea Arcangeli; +Cc: Anthony Liguori, qemu-devel
On 09/15/2010 12:13 PM, Andrea Arcangeli wrote:
> Subject: allow more than 1T in KVM x86 guest
>
> From: Andrea Arcangeli<aarcange@redhat.com>
>
> When host supports 48 bits of physical address reflect that in the guest cpuid
> to allow the guest to use more than 1TB of RAM.
>
> The migration code should probably be updated accordingly checking if the size
> of the guest ram is bigger than the migration target cpuid 0x80000008 limit and
> failing migration in that case. (not a real practical issue, I don't
> see many people migrating>1T guests yet :)
>
> The comment below refers to a 42 bit limit on exec.c, but I didn't identify
> what the comment refers to yet. At least now guest should be able to use 4TB.
>
target-i386/cpu.h
#ifdef TARGET_X86_64
#define TARGET_PHYS_ADDR_SPACE_BITS 52
/* ??? This is really 48 bits, sign-extended, but the only thing
accessible to userland with bit 48 set is the VSYSCALL, and that
is handled via other mechanisms. */
#define TARGET_VIRT_ADDR_SPACE_BITS 47
#else
#define TARGET_PHYS_ADDR_SPACE_BITS 36
#define TARGET_VIRT_ADDR_SPACE_BITS 32
#endif
The macros are then used in exec.c
Regards,
Anthony Liguori
> Signed-off-by: Andrea Arcangeli<aarcange@redhat.com>
> ---
>
> diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c
> index d63fdcb..462e709 100644
> --- a/target-i386/cpuid.c
> +++ b/target-i386/cpuid.c
> @@ -1189,6 +1189,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
> /* 64 bit processor */
> /* XXX: The physical address space is limited to 42 bits in exec.c. */
> *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */
> + if (kvm_enabled()) {
> + uint32_t _eax;
> + host_cpuid(0x80000000, 0,&_eax, NULL, NULL, NULL);
> + if (_eax>= 0x80000008)
> + host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL);
> + }
> } else {
> if (env->cpuid_features& CPUID_PSE36)
> *eax = 0x00000024; /* 36 bits physical */
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-15 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 17:13 [Qemu-devel] [PATCH] allow more than 1T in KVM x86 guest Andrea Arcangeli
2010-09-15 18:26 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).