Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2021 19:15:57 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ade8b810b02f - stable/13 - Create VM_MEMATTR_DEVICE on all architectures
Message-ID:  <202106131915.15DJFvlI047352@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by andrew:

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

commit ade8b810b02fd6f7ab9e68afa18e3d34c7a1c1a8
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-04-10 07:59:29 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-06-13 15:49:36 +0000

    Create VM_MEMATTR_DEVICE on all architectures
    
    This is intended to be used with memory mapped IO, e.g. from
    bus_space_map with no flags, or pmap_mapdev.
    
    Use this new memory type in the map request configured by
    resource_init_map_request, and in pciconf.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D29692
    
    (cherry picked from commit 5d2d599d3f3494d813e51e1bcd1c9693eb9c098b)
---
 sys/amd64/include/vm.h     | 1 +
 sys/i386/include/vm.h      | 1 +
 sys/kern/subr_bus.c        | 2 +-
 sys/mips/include/vm.h      | 1 +
 sys/powerpc/include/vm.h   | 2 ++
 usr.sbin/pciconf/pciconf.c | 4 ----
 6 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sys/amd64/include/vm.h b/sys/amd64/include/vm.h
index 2e9c30da9936..fef7a53ca317 100644
--- a/sys/amd64/include/vm.h
+++ b/sys/amd64/include/vm.h
@@ -43,5 +43,6 @@
 #define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
+#define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE
 
 #endif /* !_MACHINE_VM_H_ */
diff --git a/sys/i386/include/vm.h b/sys/i386/include/vm.h
index 2e9c30da9936..fef7a53ca317 100644
--- a/sys/i386/include/vm.h
+++ b/sys/i386/include/vm.h
@@ -43,5 +43,6 @@
 #define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED)
 
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
+#define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE
 
 #endif /* !_MACHINE_VM_H_ */
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 6d5607337ef6..f0198a0e1fa3 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3117,7 +3117,7 @@ resource_init_map_request_impl(struct resource_map_request *args, size_t sz)
 {
 	bzero(args, sz);
 	args->size = sz;
-	args->memattr = VM_MEMATTR_UNCACHEABLE;
+	args->memattr = VM_MEMATTR_DEVICE;
 }
 
 /**
diff --git a/sys/mips/include/vm.h b/sys/mips/include/vm.h
index 06af199db17b..c759d8cfa61e 100644
--- a/sys/mips/include/vm.h
+++ b/sys/mips/include/vm.h
@@ -38,6 +38,7 @@
 #define	VM_MEMATTR_UNCACHEABLE		((vm_memattr_t)MIPS_CCA_UNCACHED)
 #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)MIPS_CCA_CACHED)
 #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK
+#define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE
 #ifdef MIPS_CCA_WC
 #define	VM_MEMATTR_WRITE_COMBINING	((vm_memattr_t)MIPS_CCA_WC)
 #endif
diff --git a/sys/powerpc/include/vm.h b/sys/powerpc/include/vm.h
index 3af863509908..692bd8fc2d77 100644
--- a/sys/powerpc/include/vm.h
+++ b/sys/powerpc/include/vm.h
@@ -42,4 +42,6 @@
 #define	VM_MEMATTR_WRITE_THROUGH	0x10
 #define	VM_MEMATTR_PREFETCHABLE		0x20
 
+#define	VM_MEMATTR_DEVICE		VM_MEMATTR_DEFAULT
+
 #endif /* !_MACHINE_VM_H_ */
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 6b54687d7c79..ccc816d5986d 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -1126,11 +1126,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
 	if (*reg == '\0' || *el != '\0')
 		errx(1, "Invalid bar specification %s", reg);
 	pbm.pbm_flags = 0;
-#ifdef VM_MEMATTR_DEVICE
 	pbm.pbm_memattr = VM_MEMATTR_DEVICE;
-#else
-	pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE;
-#endif
 
 	fd = open(_PATH_DEVPCI, O_RDWR, 0);
 	if (fd < 0)



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