From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH v2] x86: cap address bits CPUID output
Date: Mon, 9 May 2016 14:27:07 +0100 [thread overview]
Message-ID: <5730902B.5090605@citrix.com> (raw)
In-Reply-To: <5730AC2102000078000E98FA@prv-mh.provo.novell.com>
On 09/05/16 14:26, Jan Beulich wrote:
>>>> On 09.05.16 at 15:21, <andrew.cooper3@citrix.com> wrote:
>> On 09/05/16 14:15, Jan Beulich wrote:
>>> Don't use more or report more to guests than we are capable of
>>> handling.
>>>
>>> At once
>>> - correct the involved extended CPUID level checks,
>>> - simplify the code in hvm_cpuid() and mtrr_top_of_ram().
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, with perhaps one
>> tweak
>>
>>> --- a/xen/arch/x86/hvm/hvm.c
>>> +++ b/xen/arch/x86/hvm/hvm.c
>>> @@ -3504,19 +3504,19 @@ void hvm_cpuid(unsigned int input, unsig
>>> break;
>>>
>>> case 0x80000008:
>>> + *eax &= 0xff;
>>> count = d->arch.paging.gfn_bits + PAGE_SHIFT;
>>> - if ( (*eax & 0xff) > count )
>>> - *eax = (*eax & ~0xff) | count;
>>> + if ( *eax > count )
>>> + *eax = count;
>>>
>>> hvm_cpuid(1, NULL, NULL, NULL, &_edx);
>>> count = _edx & (cpufeat_mask(X86_FEATURE_PAE) |
>>> cpufeat_mask(X86_FEATURE_PSE36)) ? 36 : 32;
>>> - if ( (*eax & 0xff) < count )
>>> - *eax = (*eax & ~0xff) | count;
>>> + if ( *eax < count )
>>> + *eax = count;
>>>
>>> hvm_cpuid(0x80000001, NULL, NULL, NULL, &_edx);
>>> - *eax = (*eax & ~0xffff00) | (_edx & cpufeat_mask(X86_FEATURE_LM)
>>> - ? 0x3000 : 0x2000);
>>> + *eax |= _edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits << 8 : 0x2000;
> In that case I'd prefer
>
> *eax |= (_edx & cpufeat_mask(X86_FEATURE_LM) ? vaddr_bits : 32) << 8;
That looks better.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-09 13:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 13:15 [PATCH v2] x86: cap address bits CPUID output Jan Beulich
2016-05-09 13:21 ` Andrew Cooper
2016-05-09 13:26 ` Jan Beulich
2016-05-09 13:27 ` Andrew Cooper [this message]
2016-05-09 13:31 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5730902B.5090605@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).