@@ -234,6 +234,7 @@ struct cpuid_domain_info
VENDOR_UNKNOWN,
VENDOR_INTEL,
VENDOR_AMD,
+ VENDOR_HYGON,
} vendor;
bool hvm;
@@ -304,6 +305,10 @@ static int get_cpuid_domain_info(xc_interface *xch, uint32_t domid,
regs[2] == 0x444d4163U &&
regs[3] == 0x69746e65U )
info->vendor = VENDOR_AMD;
+ else if ( regs[1] == 0x6f677948U && /* "HygonGenuine" */
+ regs[2] == 0x656e6975U &&
+ regs[3] == 0x6e65476eU )
+ info->vendor = VENDOR_HYGON;
else
info->vendor = VENDOR_UNKNOWN;
@@ -568,7 +573,8 @@ static void xc_cpuid_hvm_policy(const struct cpuid_domain_info *info,
break;
}
- if ( info->vendor == VENDOR_AMD )
+ if ( info->vendor == VENDOR_AMD ||
+ info->vendor == VENDOR_HYGON )
amd_xc_cpuid_policy(info, input, regs);
else
intel_xc_cpuid_policy(info, input, regs);
@@ -630,7 +636,8 @@ static void xc_cpuid_pv_policy(const struct cpuid_domain_info *info,
case 0x80000000:
{
- unsigned int max = info->vendor == VENDOR_AMD
+ unsigned int max = (info->vendor == VENDOR_AMD||
+ info->vendor == VENDOR_HYGON)
? DEF_MAX_AMDEXT : DEF_MAX_INTELEXT;
if ( regs[0] > max )
@@ -736,7 +743,8 @@ static void sanitise_featureset(struct cpuid_domain_info *info)
if ( !info->pv64 )
{
clear_bit(X86_FEATURE_LM, info->featureset);
- if ( info->vendor != VENDOR_AMD )
+ if ( info->vendor != VENDOR_AMD &&
+ info->vendor != VENDOR_HYGON )
clear_bit(X86_FEATURE_SYSCALL, info->featureset);
}
@@ -787,7 +795,7 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
input[0] = 0x80000000;
cpuid(input, regs);
- if ( info.vendor == VENDOR_AMD )
+ if ( info.vendor == VENDOR_AMD || info.vendor == VENDOR_HYGON )
ext_max = (regs[0] <= DEF_MAX_AMDEXT) ? regs[0] : DEF_MAX_AMDEXT;
else
ext_max = (regs[0] <= DEF_MAX_INTELEXT) ? regs[0] : DEF_MAX_INTELEXT;