From owner-svn-src-all@freebsd.org Mon May 16 09:16:16 2016 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 D6F02B3DD79; Mon, 16 May 2016 09:16:16 +0000 (UTC) (envelope-from hselasky@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 900411CE7; Mon, 16 May 2016 09:16:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4G9GFxf013295; Mon, 16 May 2016 09:16:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4G9GFLl013293; Mon, 16 May 2016 09:16:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605160916.u4G9GFLl013293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 16 May 2016 09:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299930 - in head/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: head 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.22 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, 16 May 2016 09:16:16 -0000 Author: hselasky Date: Mon May 16 09:16:15 2016 New Revision: 299930 URL: https://svnweb.freebsd.org/changeset/base/299930 Log: Properly implement "cpu_has_clflush" macro. Suggested by: kib, jhb MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 16 09:15:50 2016 (r299929) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon May 16 09:16:15 2016 (r299930) @@ -258,7 +258,11 @@ #define smp_processor_id() PCPU_GET(cpuid) #define num_possible_cpus() mp_ncpus #define num_online_cpus() mp_ncpus -#define cpu_has_clflush (1) + +#if defined(__i386__) || defined(__amd64__) +extern bool linux_cpu_has_clflush; +#define cpu_has_clflush linux_cpu_has_clflush +#endif typedef struct pm_message { int event; Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 16 09:15:50 2016 (r299929) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 16 09:16:15 2016 (r299930) @@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$"); #include +#if defined(__i386__) || defined(__amd64__) +#include +#endif + #include #include #include @@ -67,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -1362,12 +1367,19 @@ linux_irq_handler(void *ent) irqe->handler(irqe->irq, irqe->arg); } +#if defined(__i386__) || defined(__amd64__) +bool linux_cpu_has_clflush; +#endif + static void linux_compat_init(void *arg) { struct sysctl_oid *rootoid; int i; +#if defined(__i386__) || defined(__amd64__) + linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH); +#endif sx_init(&linux_global_rcu_lock, "LinuxGlobalRCU"); rootoid = SYSCTL_ADD_ROOT_NODE(NULL,