From owner-svn-src-stable@freebsd.org Thu Feb 20 01:38:58 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB53E24C45F; Thu, 20 Feb 2020 01:38:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48NHLV2YgBz42hj; Thu, 20 Feb 2020 01:38:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48C751A018; Thu, 20 Feb 2020 01:38:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01K1cw5g092717; Thu, 20 Feb 2020 01:38:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01K1cvGV092711; Thu, 20 Feb 2020 01:38:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202002200138.01K1cvGV092711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 20 Feb 2020 01:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r358146 - in stable/12/sys/amd64/vmm: . io X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/amd64/vmm: . io X-SVN-Commit-Revision: 358146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Feb 2020 01:38:58 -0000 Author: kib Date: Thu Feb 20 01:38:56 2020 New Revision: 358146 URL: https://svnweb.freebsd.org/changeset/base/358146 Log: MFC r357865: vmm: Add Hygon Dhyana support. Modified: stable/12/sys/amd64/vmm/io/iommu.c stable/12/sys/amd64/vmm/vmm.c stable/12/sys/amd64/vmm/vmm_stat.c stable/12/sys/amd64/vmm/vmm_util.c stable/12/sys/amd64/vmm/vmm_util.h stable/12/sys/amd64/vmm/x86.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/io/iommu.c ============================================================================== --- stable/12/sys/amd64/vmm/io/iommu.c Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/io/iommu.c Thu Feb 20 01:38:56 2020 (r358146) @@ -184,7 +184,7 @@ iommu_init(void) if (vmm_is_intel()) ops = &iommu_ops_intel; - else if (vmm_is_amd()) + else if (vmm_is_svm()) ops = &iommu_ops_amd; else ops = NULL; Modified: stable/12/sys/amd64/vmm/vmm.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm.c Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/vmm.c Thu Feb 20 01:38:56 2020 (r358146) @@ -347,7 +347,7 @@ vmm_init(void) if (vmm_is_intel()) ops = &vmm_ops_intel; - else if (vmm_is_amd()) + else if (vmm_is_svm()) ops = &vmm_ops_amd; else return (ENXIO); Modified: stable/12/sys/amd64/vmm/vmm_stat.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_stat.c Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/vmm_stat.c Thu Feb 20 01:38:56 2020 (r358146) @@ -67,7 +67,7 @@ vmm_stat_register(void *arg) if (vst->scope == VMM_STAT_SCOPE_INTEL && !vmm_is_intel()) return; - if (vst->scope == VMM_STAT_SCOPE_AMD && !vmm_is_amd()) + if (vst->scope == VMM_STAT_SCOPE_AMD && !vmm_is_svm()) return; if (vst_num_elems + vst->nelems >= MAX_VMM_STAT_ELEMS) { Modified: stable/12/sys/amd64/vmm/vmm_util.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_util.c Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/vmm_util.c Thu Feb 20 01:38:56 2020 (r358146) @@ -46,9 +46,10 @@ vmm_is_intel(void) } bool -vmm_is_amd(void) +vmm_is_svm(void) { - return (strcmp(cpu_vendor, "AuthenticAMD") == 0); + return (strcmp(cpu_vendor, "AuthenticAMD") == 0 || + strcmp(cpu_vendor, "HygonGenuine") == 0); } bool Modified: stable/12/sys/amd64/vmm/vmm_util.h ============================================================================== --- stable/12/sys/amd64/vmm/vmm_util.h Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/vmm_util.h Thu Feb 20 01:38:56 2020 (r358146) @@ -34,7 +34,7 @@ struct trapframe; bool vmm_is_intel(void); -bool vmm_is_amd(void); +bool vmm_is_svm(void); bool vmm_supports_1G_pages(void); void dump_trapframe(struct trapframe *tf); Modified: stable/12/sys/amd64/vmm/x86.c ============================================================================== --- stable/12/sys/amd64/vmm/x86.c Thu Feb 20 01:35:30 2020 (r358145) +++ stable/12/sys/amd64/vmm/x86.c Thu Feb 20 01:38:56 2020 (r358146) @@ -135,7 +135,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, break; case CPUID_8000_0008: cpuid_count(*eax, *ecx, regs); - if (vmm_is_amd()) { + if (vmm_is_svm()) { /* * As on Intel (0000_0007:0, EDX), mask out * unsupported or unsafe AMD extended features @@ -234,7 +234,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, case CPUID_8000_001D: /* AMD Cache topology, like 0000_0004 for Intel. */ - if (!vmm_is_amd()) + if (!vmm_is_svm()) goto default_leaf; /* @@ -276,8 +276,11 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, break; case CPUID_8000_001E: - /* AMD Family 16h+ additional identifiers */ - if (!vmm_is_amd() || CPUID_TO_FAMILY(cpu_id) < 0x16) + /* + * AMD Family 16h+ and Hygon Family 18h additional + * identifiers. + */ + if (!vmm_is_svm() || CPUID_TO_FAMILY(cpu_id) < 0x16) goto default_leaf; vm_get_topology(vm, &sockets, &cores, &threads,