From owner-svn-src-all@FreeBSD.ORG Wed Dec 31 22:15:29 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF13CFC4; Wed, 31 Dec 2014 22:15:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FF7966133; Wed, 31 Dec 2014 22:15:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBVMFTnT002809; Wed, 31 Dec 2014 22:15:29 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBVMFTwl002808; Wed, 31 Dec 2014 22:15:29 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201412312215.sBVMFTwl002808@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Wed, 31 Dec 2014 22:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276482 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Dec 2014 22:15:30 -0000 Author: neel Date: Wed Dec 31 22:15:28 2014 New Revision: 276482 URL: https://svnweb.freebsd.org/changeset/base/276482 Log: MFC r273748 Output a summary of optional SVM features in dmesg similar to CPU features. If bootverbose is enabled, a detailed list is provided; otherwise, a single-line summary is displayed. Requested by: jhb Modified: stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Wed Dec 31 21:58:03 2014 (r276481) +++ stable/10/sys/x86/x86/identcpu.c Wed Dec 31 22:15:28 2014 (r276482) @@ -76,6 +76,7 @@ static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_INTEL_info(void); static void print_INTEL_TLB(u_int data); +static void print_svm_info(void); static void print_via_padlock_info(void); static void print_vmx_info(void); @@ -932,6 +933,9 @@ printcpuinfo(void) if (cpu_feature2 & CPUID2_VMX) print_vmx_info(); + if (amd_feature2 & AMDID2_SVM) + print_svm_info(); + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; @@ -1735,6 +1739,67 @@ print_INTEL_TLB(u_int data) } } +static void +print_svm_info(void) +{ + u_int features, regs[4]; + uint64_t msr; + int comma; + + printf("\n SVM: "); + do_cpuid(0x8000000A, regs); + features = regs[3]; + + msr = rdmsr(MSR_VM_CR); + if ((msr & VM_CR_SVMDIS) == VM_CR_SVMDIS) + printf("(disabled in BIOS) "); + + if (!bootverbose) { + comma = 0; + if (features & (1 << 0)) { + printf("%sNP", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 3)) { + printf("%sNRIP", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 5)) { + printf("%sVClean", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 6)) { + printf("%sAFlush", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 7)) { + printf("%sDAssist", comma ? "," : ""); + comma = 1; + } + printf("%sNAsids=%d", comma ? "," : "", regs[1]); + return; + } + + printf("Features=0x%b", features, + "\020" + "\001NP" /* Nested paging */ + "\002LbrVirt" /* LBR virtualization */ + "\003SVML" /* SVM lock */ + "\004NRIPS" /* NRIP save */ + "\005TscRateMsr" /* MSR based TSC rate control */ + "\006VmcbClean" /* VMCB clean bits */ + "\007FlushByAsid" /* Flush by ASID */ + "\010DecodeAssist" /* Decode assist */ + "\011" + "\012" + "\013PauseFilter" /* PAUSE intercept filter */ + "\014" + "\015PauseFilterThreshold" /* PAUSE filter threshold */ + "\016AVIC" /* virtual interrupt controller */ + ); + printf("\nRevision=%d, ASIDs=%d", regs[0] & 0xff, regs[1]); +} + #ifdef __i386__ static void print_transmeta_info(void)