git: 2ae0f5a4d093 - main - linuxkpi: Make arch_io_*_memtype_wc amd64-only
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 May 2024 18:52:44 UTC
The branch main has been updated by tijl:
URL: https://cgit.FreeBSD.org/src/commit/?id=2ae0f5a4d0931067c672be9a791909f0e32d5a0e
commit 2ae0f5a4d0931067c672be9a791909f0e32d5a0e
Author: Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2024-05-08 18:49:56 +0000
Commit: Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2024-05-08 18:52:37 +0000
linuxkpi: Make arch_io_*_memtype_wc amd64-only
Linux only implements these functions on x86. They return 0 on other
architectures. The FreeBSD implementation calls PHYS_TO_DMAP but this
panics on i386 because it does not have a direct map so return 0 on i386
as well for now. These functions are only used by graphics/drm-*-kmod
to mark the VRAM aperture write-combining but this is also accomplished
by a call to vm_phys_fictitious_reg_range so this change is sufficient
to fix drm-*-kmod on i386 for FreeBSD 14.1.
Reviewed by: kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45125
---
sys/compat/linuxkpi/common/include/linux/io.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index bce70ed0cb8d..164347dbc4e7 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -541,30 +541,29 @@ void lkpi_arch_phys_wc_del(int);
#define arch_phys_wc_index(x) \
(((x) < __MTRR_ID_BASE) ? -1 : ((x) - __MTRR_ID_BASE))
-#if defined(__amd64__) || defined(__i386__) || defined(__aarch64__) || defined(__powerpc__) || defined(__riscv)
static inline int
arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size)
{
+#if defined(__amd64__)
vm_offset_t va;
va = PHYS_TO_DMAP(start);
-
-#ifdef VM_MEMATTR_WRITE_COMBINING
return (-pmap_change_attr(va, size, VM_MEMATTR_WRITE_COMBINING));
#else
- return (-pmap_change_attr(va, size, VM_MEMATTR_UNCACHEABLE));
+ return (0);
#endif
}
static inline void
arch_io_free_memtype_wc(resource_size_t start, resource_size_t size)
{
+#if defined(__amd64__)
vm_offset_t va;
va = PHYS_TO_DMAP(start);
pmap_change_attr(va, size, VM_MEMATTR_WRITE_BACK);
-}
#endif
+}
#endif /* _LINUXKPI_LINUX_IO_H_ */