svn commit: r299930 - in head/sys/compat/linuxkpi/common: include/linux src
Hans Petter Selasky
hselasky at FreeBSD.org
Mon May 16 09:16:16 UTC 2016
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 <machine/stdarg.h>
+#if defined(__i386__) || defined(__amd64__)
+#include <machine/md_var.h>
+#endif
+
#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/slab.h>
@@ -67,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include <linux/rcupdate.h>
#include <linux/interrupt.h>
#include <linux/uaccess.h>
+#include <linux/kernel.h>
#include <vm/vm_pager.h>
@@ -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,
More information about the svn-src-all
mailing list