From patchwork Thu Apr 4 13:47:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Wen X-Patchwork-Id: 10885647 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 7AB7013B5 for ; Thu, 4 Apr 2019 13:52:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63A0628722 for ; Thu, 4 Apr 2019 13:52:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57DA828734; Thu, 4 Apr 2019 13:52:43 +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 E7F7228722 for ; Thu, 4 Apr 2019 13:52:42 +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 1hC2li-0008Fk-Kz; Thu, 04 Apr 2019 13:51:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hC2lh-0008F3-2f for xen-devel@lists.xenproject.org; Thu, 04 Apr 2019 13:51:01 +0000 X-Inumbo-ID: a99efebe-56e0-11e9-a3d7-a3405c2d8e4a Received: from spam1.hygon.cn (unknown [110.188.70.11]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a99efebe-56e0-11e9-a3d7-a3405c2d8e4a; Thu, 04 Apr 2019 13:50:54 +0000 (UTC) Received: from MK-FE.hygon.cn ([172.23.18.61]) by spam1.hygon.cn with ESMTP id x34DlcXX097204; Thu, 4 Apr 2019 21:47:38 +0800 (GMT-8) (envelope-from puwen@hygon.cn) Received: from cncheex01.Hygon.cn ([172.23.18.10]) by MK-FE.hygon.cn with ESMTP id x34DlLp7063309; Thu, 4 Apr 2019 21:47:21 +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; Thu, 4 Apr 2019 21:47:38 +0800 From: Pu Wen To: Date: Thu, 4 Apr 2019 21:47:29 +0800 Message-ID: <80513cf30a1d1babd2afeb3fb1d14d40d83afed4.1554382869.git.puwen@hygon.cn> 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: cncheex01.Hygon.cn (172.23.18.10) To cncheex01.Hygon.cn (172.23.18.10) X-MAIL: spam1.hygon.cn x34DlcXX097204 X-DNSRBL: Subject: [Xen-devel] [PATCH v5 11/15] x86/domain: 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 handle HyperTransport range. Also loading a nul selector does not clear bases and limits on Hygon CPUs, so add Hygon Dhyana support to the function preload_segment. Signed-off-by: Pu Wen Acked-by: Jan Beulich --- xen/arch/x86/dom0_build.c | 3 ++- xen/arch/x86/domain.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 73f5407..4a36b63 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -542,7 +542,8 @@ int __init dom0_setup_permissions(struct domain *d) paddr_to_pfn(MSI_ADDR_BASE_LO + MSI_ADDR_DEST_ID_MASK)); /* HyperTransport range. */ - 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 ) rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32), paddr_to_pfn((1ULL << 40) - 1)); diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 20b86fd..c9a7964 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1253,13 +1253,14 @@ arch_do_vcpu_op( } /* - * Loading a nul selector does not clear bases and limits on AMD CPUs. Be on - * the safe side and re-initialize both to flat segment values before loading - * a nul selector. + * Loading a nul selector does not clear bases and limits on AMD or Hygon + * CPUs. Be on the safe side and re-initialize both to flat segment values + * before loading a nul selector. */ #define preload_segment(seg, value) do { \ if ( !((value) & ~3) && \ - boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) \ + (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || \ + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) ) \ asm volatile ( "movl %k0, %%" #seg \ :: "r" (FLAT_USER_DS32) ); \ } while ( false )