From patchwork Mon Mar 25 13:31:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Wen X-Patchwork-Id: 10869155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66994186D for ; Mon, 25 Mar 2019 13:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5379328635 for ; Mon, 25 Mar 2019 13:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51A6D28660; Mon, 25 Mar 2019 13:37:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1FDE28635 for ; Mon, 25 Mar 2019 13:37:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8Pkx-00038S-G1; Mon, 25 Mar 2019 13:35:15 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h8Pkv-00037B-Pd for xen-devel@lists.xenproject.org; Mon, 25 Mar 2019 13:35:13 +0000 X-Inumbo-ID: cee68f34-4f02-11e9-bc90-bc764e045a96 Received: from spam1.hygon.cn (unknown [110.188.70.11]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id cee68f34-4f02-11e9-bc90-bc764e045a96; Mon, 25 Mar 2019 13:35:11 +0000 (UTC) Received: from MK-DB.hygon.cn ([172.23.18.60]) by spam1.hygon.cn with ESMTP id x2PDVqFQ013817; Mon, 25 Mar 2019 21:31:52 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-DB.hygon.cn with ESMTP id x2PDVn3u064151; Mon, 25 Mar 2019 21:31:49 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from pw-vbox.hygon.cn (172.23.18.44) by cncheex01.Hygon.cn (172.23.18.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1466.3; Mon, 25 Mar 2019 21:31:52 +0800 From: Pu Wen To: Date: Mon, 25 Mar 2019 21:31:45 +0800 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.23.18.44] X-ClientProxiedBy: cncheex02.Hygon.cn (172.23.18.12) To cncheex01.Hygon.cn (172.23.18.10) X-MAIL: spam1.hygon.cn x2PDVqFQ013817 X-DNSRBL: Subject: [Xen-devel] [PATCH v3 11/14] x86/domctl: Add Hygon Dhyana support X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Pu Wen , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Jan Beulich , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add Hygon Dhyana support to update cpuid info for creating PV guest. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/domctl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 9bf2d08..19b7bdd 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -176,6 +176,7 @@ static int update_domain_cpuid_info(struct domain *d, break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: mask &= ((uint64_t)ecx << 32) | edx; /* @@ -220,7 +221,8 @@ static int update_domain_cpuid_info(struct domain *d, uint32_t eax = ctl->eax; uint32_t ebx = p->feat._7b0; - if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) + if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON ) mask &= ((uint64_t)eax << 32) | ebx; d->arch.pv.cpuidmasks->_7ab0 = mask; @@ -281,8 +283,12 @@ static int update_domain_cpuid_info(struct domain *d, if ( cpu_has_cmp_legacy ) ecx |= cpufeat_mask(X86_FEATURE_CMP_LEGACY); - /* If not emulating AMD, clear the duplicated features in e1d. */ - if ( p->x86_vendor != X86_VENDOR_AMD ) + /* + * If not emulating AMD or Hygon, clear the duplicated features + * in e1d. + */ + if ( p->x86_vendor != X86_VENDOR_AMD && + p->x86_vendor != X86_VENDOR_HYGON ) edx &= ~CPUID_COMMON_1D_FEATURES; switch ( boot_cpu_data.x86_vendor ) @@ -292,6 +298,7 @@ static int update_domain_cpuid_info(struct domain *d, break; case X86_VENDOR_AMD: + case X86_VENDOR_HYGON: mask &= ((uint64_t)ecx << 32) | edx; /*