git: feb3031f0ae8 - stable/13 - LinuxKPI: Implement _ioremap_attr for riscv

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Sun, 24 Oct 2021 18:54:06 UTC
The branch stable/13 has been updated by jrtc27:

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

commit feb3031f0ae878b72b48488fe3ba13884ae58b7f
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-10-17 14:32:20 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-10-24 18:51:12 +0000

    LinuxKPI: Implement _ioremap_attr for riscv
    
    Now that riscv implements pmap_mapdev_attr we can enable the non-stub
    implementation for riscv, which is needed for drm-kmod to not fail at
    run time for drivers that need to map I/O regions.
    
    Reviewed by:    hselasky, bz
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D32446
    
    (cherry picked from commit 60d962e0410340f107d062e8f4389c0d467613a2)
---
 sys/compat/linuxkpi/common/include/linux/io.h | 2 +-
 sys/compat/linuxkpi/common/src/linux_compat.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index 074417b892f9..e402ebed0665 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -390,7 +390,7 @@ _outb(u_char data, u_int port)
 }
 #endif
 
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv)
 void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
 #else
 #define	_ioremap_attr(...) NULL
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 247c1f54515e..a1462c6a7010 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1822,7 +1822,7 @@ vmmap_remove(void *addr)
 	return (vmmap);
 }
 
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv)
 void *
 _ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr)
 {
@@ -1845,7 +1845,7 @@ iounmap(void *addr)
 	vmmap = vmmap_remove(addr);
 	if (vmmap == NULL)
 		return;
-#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__)
+#if defined(__i386__) || defined(__amd64__) || defined(__powerpc__) || defined(__aarch64__) || defined(__riscv)
 	pmap_unmapdev((vm_offset_t)addr, vmmap->vm_size);
 #endif
 	kfree(vmmap);