From owner-svn-src-all@freebsd.org Mon Aug 14 06:46:17 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43018DD8AC4; Mon, 14 Aug 2017 06:46:17 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id 1326970424; Mon, 14 Aug 2017 06:46:17 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7E6kGdm004134; Mon, 14 Aug 2017 06:46:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7E6kF3Z004130; Mon, 14 Aug 2017 06:46:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201708140646.v7E6kF3Z004130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 14 Aug 2017 06:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r322490 - in stable/11/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: sephe X-SVN-Commit-Paths: in stable/11/sys: amd64/amd64 i386/include x86/include x86/x86 X-SVN-Commit-Revision: 322490 X-SVN-Commit-Repository: base 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.23 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: Mon, 14 Aug 2017 06:46:17 -0000 Author: sephe Date: Mon Aug 14 06:46:15 2017 New Revision: 322490 URL: https://svnweb.freebsd.org/changeset/base/322490 Log: MFC 322323 by jkim Split identify_cpu() into two functions for amd64 as we do for i386. This reduces diff between amd64 and i386. Also, it fixes a regression introduced in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. This function assumes cpu_feature2 is already initialized. Reported by: dexuan Tested by: dexuan Modified: stable/11/sys/amd64/amd64/machdep.c stable/11/sys/i386/include/md_var.h stable/11/sys/x86/include/x86_var.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/machdep.c ============================================================================== --- stable/11/sys/amd64/amd64/machdep.c Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/amd64/amd64/machdep.c Mon Aug 14 06:46:15 2017 (r322490) @@ -1544,6 +1544,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) kmdp = init_ops.parse_preload_data(modulep); + identify_cpu(); identify_hypervisor(); /* Init basic tunables, hz etc */ @@ -1650,7 +1651,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) != NULL) vty_set_preferred(VTY_VT); - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); Modified: stable/11/sys/i386/include/md_var.h ============================================================================== --- stable/11/sys/i386/include/md_var.h Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/i386/include/md_var.h Mon Aug 14 06:46:15 2017 (r322490) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/x86/include/x86_var.h Mon Aug 14 06:46:15 2017 (r322490) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Mon Aug 14 06:29:24 2017 (r322489) +++ stable/11/sys/x86/x86/identcpu.c Mon Aug 14 06:46:15 2017 (r322490) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; -#ifdef __amd64__ do_cpuid(0, regs); cpu_high = regs[0]; ((u_int *)&cpu_vendor)[0] = regs[1]; @@ -1401,6 +1390,18 @@ identify_cpu(void) cpu_procinfo = regs[1]; cpu_feature = regs[3]; cpu_feature2 = regs[2]; +} +#endif + +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; #endif cpu_vendor_id = find_cpu_vendor_id();