Date: Fri, 14 Feb 2020 00:08:53 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Ravi Pokala <rpokala@freebsd.org> 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> In-Reply-To: <5C7C143D-5F7E-4B5E-933F-6AFD0C37BD88@panasas.com> References: <202002131903.01DJ3DDN044487@repo.freebsd.org> <5C7C143D-5F7E-4B5E-933F-6AFD0C37BD88@panasas.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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: <owner-src-committers@freebsd.org> on behalf of Konstantin Belousov <kib@FreeBSD.org> > Date: 2020-02-13, Thursday at 11:03 > To: <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, <svn-src-head@freebsd.org> > 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 <puwen@hygon.cn> > 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, > > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200213220853.GM4808>