x86/hvm: Use guest_cpuid() rather than hvm_cpuid()

More work is required before maxphysaddr can be read straight out of the
cpuid_policy block, but in the meantime hvm_cpuid() wants to disappear so
update the code to use the newer interface.

Use the behaviour of max_leaf handling (returning all zeros) to avoid a double
call into guest_cpuid().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2017-01-11 11:59:02 +00:00
1 parent bc54ec1aee
commit fff8160a81
1 file changed
+5 -8
+5 -8
View File
@@ -440,7 +440,7 @@ bool_t mtrr_fix_range_msr_set(struct domain *d, struct mtrr_state *m,
bool_t mtrr_var_range_msr_set(
struct domain *d, struct mtrr_state *m, uint32_t msr, uint64_t msr_content)
{
uint32_t index, phys_addr, eax;
uint32_t index, phys_addr;
uint64_t msr_mask;
uint64_t *var_range_base = (uint64_t*)m->var_ranges;
@@ -453,13 +453,10 @@ bool_t mtrr_var_range_msr_set(
if ( d == current->domain )
{
phys_addr = 36;
hvm_cpuid(0x80000000, &eax, NULL, NULL, NULL);
if ( (eax >> 16) == 0x8000 && eax >= 0x80000008 )
{
hvm_cpuid(0x80000008, &eax, NULL, NULL, NULL);
phys_addr = (uint8_t)eax;
}
struct cpuid_leaf res;
guest_cpuid(current, 0x80000008, 0, &res);
phys_addr = (uint8_t)res.a ?: 36;
}
else
phys_addr = paddr_bits;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.