qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 5/5] x86: Set physical address bits based on hos


From: Igor Mammedov
Subject: Re: [Qemu-devel] [PATCH 5/5] x86: Set physical address bits based on host
Date: Fri, 17 Jun 2016 09:25:39 +0200

On Thu, 16 Jun 2016 18:12:13 +0100
"Dr. David Alan Gilbert (git)" <address@hidden> wrote:

> From: "Dr. David Alan Gilbert" <address@hidden>
> 
> A special case based on the previous phys-bits property; if it's
> the magic value 0 then use the hosts capabilities.
> 
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
>  target-i386/cpu.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index c3bbf8e..e03e48f 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2609,7 +2609,21 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, 
> uint32_t count,
>              /* 64 bit processor, 48 bits virtual, configurable
>               * physical bits.
>               */
> -            *eax = 0x00003000 + cpu->phys_bits;
> +            if (cpu->phys_bits != 0) {
> +                *eax = 0x00003000 + cpu->phys_bits;
> +            } else {
> +                /* phys_bits set to 0 -> Try and read the host, again
> +                 * fall back to the magic 40 qemu used for a long time
> +                 * Note: This is setting the virtual size as well from
> +                 * the host; TODO: Split that out
> +                 */
> +                uint32_t _eax;
> +                *eax = 0x00003028; /* 48 bits virtual, 40 bits physical */
> +                host_cpuid(0x80000000, 0, &_eax, NULL, NULL, NULL);
> +                if (_eax >= 0x80000008) {
> +                    host_cpuid(0x80000008, 0, eax, NULL, NULL, NULL);
> +                }
could host part be done at host_x86_cpu_initfn() time and set
needed value of cpu->phys_bits?

> +            }
>          } else {
>              if (env->features[FEAT_1_EDX] & CPUID_PSE36) {
>                  *eax = 0x00000024; /* 36 bits physical */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]