From owner-svn-src-head@freebsd.org Thu Feb 13 22:09:02 2020 Return-Path: Delivered-To: svn-src-head@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 B5A0F2379AC; Thu, 13 Feb 2020 22:09:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48JVz23Snvz4f4C; Thu, 13 Feb 2020 22:09:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 01DM8s6B007136 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 14 Feb 2020 00:08:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 01DM8s6B007136 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 01DM8r1W007135; Fri, 14 Feb 2020 00:08:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 14 Feb 2020 00:08:53 +0200 From: Konstantin Belousov To: Ravi Pokala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r357865 - in head/sys/amd64/vmm: . io Message-ID: <20200213220853.GM4808@kib.kiev.ua> References: <202002131903.01DJ3DDN044487@repo.freebsd.org> <5C7C143D-5F7E-4B5E-933F-6AFD0C37BD88@panasas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5C7C143D-5F7E-4B5E-933F-6AFD0C37BD88@panasas.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 48JVz23Snvz4f4C X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 22:09:02 -0000 On Thu, Feb 13, 2020 at 01:49:09PM -0800, Ravi Pokala wrote: > Why "svm"? Because this is how AMD calls its virtualization extensions. Secure Virtual Machine. > > -Ravi (rpokala@) > > -----Original Message----- > From: on behalf of Konstantin Belousov > Date: 2020-02-13, Thursday at 11:03 > To: , , > Subject: svn commit: r357865 - in head/sys/amd64/vmm: . io > > Author: kib > Date: Thu Feb 13 19:03:12 2020 > New Revision: 357865 > URL: https://svnweb.freebsd.org/changeset/base/357865 > > Log: > vmm: Add Hygon Dhyana support. > > Submitted by: Pu Wen > Discussed with: grehan > Reviewed by: jhb (previous version) > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D23553 > > Modified: > head/sys/amd64/vmm/io/iommu.c > head/sys/amd64/vmm/vmm.c > head/sys/amd64/vmm/vmm_stat.c > head/sys/amd64/vmm/vmm_util.c > head/sys/amd64/vmm/vmm_util.h > head/sys/amd64/vmm/x86.c > > Modified: head/sys/amd64/vmm/io/iommu.c > ============================================================================== > --- head/sys/amd64/vmm/io/iommu.c Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/io/iommu.c Thu Feb 13 19:03:12 2020 (r357865) > @@ -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: head/sys/amd64/vmm/vmm.c > ============================================================================== > --- head/sys/amd64/vmm/vmm.c Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/vmm.c Thu Feb 13 19:03:12 2020 (r357865) > @@ -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: head/sys/amd64/vmm/vmm_stat.c > ============================================================================== > --- head/sys/amd64/vmm/vmm_stat.c Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/vmm_stat.c Thu Feb 13 19:03:12 2020 (r357865) > @@ -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: head/sys/amd64/vmm/vmm_util.c > ============================================================================== > --- head/sys/amd64/vmm/vmm_util.c Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/vmm_util.c Thu Feb 13 19:03:12 2020 (r357865) > @@ -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: head/sys/amd64/vmm/vmm_util.h > ============================================================================== > --- head/sys/amd64/vmm/vmm_util.h Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/vmm_util.h Thu Feb 13 19:03:12 2020 (r357865) > @@ -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: head/sys/amd64/vmm/x86.c > ============================================================================== > --- head/sys/amd64/vmm/x86.c Thu Feb 13 18:37:17 2020 (r357864) > +++ head/sys/amd64/vmm/x86.c Thu Feb 13 19:03:12 2020 (r357865) > @@ -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, > > >