Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2023 22:40:00 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 83df72e5fb25 - main - linuxkpi: Define `pat_enabled()`
Message-ID:  <202303212240.32LMe0Sv054914@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=83df72e5fb253a8842693ae8135e42d0c2403540

commit 83df72e5fb253a8842693ae8135e42d0c2403540
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-20 20:45:24 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-03-21 22:36:40 +0000

    linuxkpi: Define `pat_enabled()`
    
    This new <asm/memtype.h> header is included from <linux/pci.h> because
    that's how it is included in Linux too. DRM drivers depend on this.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D39052
---
 sys/compat/linuxkpi/common/include/asm/memtype.h | 18 ++++++++++++++++++
 sys/compat/linuxkpi/common/include/linux/pci.h   |  1 +
 2 files changed, 19 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/asm/memtype.h b/sys/compat/linuxkpi/common/include/asm/memtype.h
new file mode 100644
index 000000000000..c433e54fd7bf
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/asm/memtype.h
@@ -0,0 +1,18 @@
+/* Public domain. */
+
+#ifndef _LINUXKPI_ASM_MEMTYPE_H_
+#define _LINUXKPI_ASM_MEMTYPE_H_
+
+#if defined(__amd64__) || defined(__i386__)
+
+#include <asm/cpufeature.h>
+
+static inline bool
+pat_enabled(void)
+{
+	return (boot_cpu_has(X86_FEATURE_PAT));
+}
+
+#endif
+
+#endif /* _LINUXKPI_ASM_MEMTYPE_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 2c222bf1cdbe..8077a75c4dd9 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -57,6 +57,7 @@
 #include <linux/compiler.h>
 #include <linux/errno.h>
 #include <asm/atomic.h>
+#include <asm/memtype.h>
 #include <linux/device.h>
 #include <linux/pci_ids.h>
 #include <linux/pm.h>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303212240.32LMe0Sv054914>