|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 14/14] tools/libxc: Add Hygon Dhyana support
Add Hygon Dhyana support to caculate the cpuid policies for creating PV
or HVM guest by using the code path of AMD.
Signed-off-by: Pu Wen <puwen@xxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
tools/libxc/xc_cpuid_x86.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 098affe..d0cb9ae 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -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;
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |