[v5,15/15] tools/libxc: Add Hygon Dhyana support
diff mbox series

Message ID 335fa51bfcc7da5f619177063c321c68b9de0f67.1554382869.git.puwen@hygon.cn
State New, archived
Headers show
Series
  • Add support for Hygon Dhyana Family 18h processor
Related show

Commit Message

Pu Wen April 4, 2019, 1:48 p.m. UTC
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@hygon.cn>
---
 tools/libxc/xc_cpuid_x86.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Wei Liu April 4, 2019, 4:26 p.m. UTC | #1
On Thu, Apr 04, 2019 at 09:48:13PM +0800, Pu Wen wrote:
> 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@hygon.cn>

Acked-by: Wei Liu <wei.liu2@citrix.com>
Pu Wen April 4, 2019, 4:40 p.m. UTC | #2
On 2019/4/5 0:38, Wei Liu wrote:
> On Thu, Apr 04, 2019 at 09:48:13PM +0800, Pu Wen wrote:
>> 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@hygon.cn>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Thanks.

Patch
diff mbox series

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 71e1ee7..e5afa55 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -556,7 +556,8 @@  static void xc_cpuid_hvm_policy(const struct cpuid_domain_info *info,
         break;
     }
 
-    if ( info->vendor == X86_VENDOR_AMD )
+    if ( info->vendor == X86_VENDOR_AMD ||
+         info->vendor == X86_VENDOR_HYGON )
         amd_xc_cpuid_policy(info, input, regs);
     else
         intel_xc_cpuid_policy(info, input, regs);
@@ -618,7 +619,8 @@  static void xc_cpuid_pv_policy(const struct cpuid_domain_info *info,
 
     case 0x80000000:
     {
-        unsigned int max = info->vendor == X86_VENDOR_AMD
+        unsigned int max = (info->vendor == X86_VENDOR_AMD ||
+                            info->vendor == X86_VENDOR_HYGON)
             ? DEF_MAX_AMDEXT : DEF_MAX_INTELEXT;
 
         if ( regs[0] > max )
@@ -724,7 +726,8 @@  static void sanitise_featureset(struct cpuid_domain_info *info)
         if ( !info->pv64 )
         {
             clear_bit(X86_FEATURE_LM, info->featureset);
-            if ( info->vendor != X86_VENDOR_AMD )
+            if ( info->vendor != X86_VENDOR_AMD &&
+                 info->vendor != X86_VENDOR_HYGON )
                 clear_bit(X86_FEATURE_SYSCALL, info->featureset);
         }
 
@@ -775,7 +778,7 @@  int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,
     input[0] = 0x80000000;
     cpuid(input, regs);
 
-    if ( info.vendor == X86_VENDOR_AMD )
+    if ( info.vendor == X86_VENDOR_AMD || info.vendor == X86_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;