git: 2a8921c5d187 - stable/13 - pciconf: Use VM_MEMATTR_DEVICE on supported architectures

Andrew Turner andrew at FreeBSD.org
Sun Jun 13 19:15:57 UTC 2021


The branch stable/13 has been updated by andrew:

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

commit 2a8921c5d187a2c3f1b709cc77c839568ede0b8d
Author:     Marcin Wojtas <mw at FreeBSD.org>
AuthorDate: 2021-04-06 15:00:05 +0000
Commit:     Andrew Turner <andrew at FreeBSD.org>
CommitDate: 2021-06-13 15:49:36 +0000

    pciconf: Use VM_MEMATTR_DEVICE on supported architectures
    
    Some architectures - armv7, armv8 and riscv use VM_MEMATTR_DEVICE
    when mapping device registers in kernel. Do the same in pciconf.
    On armada8k SoC all reads from BARs mapped with hitherto attribute
    (VM_MEMATTR_UNCACHEABLE) return 0xff's.
    
    Submitted by: Kornel Duleba <mindal at semihalf.com>
    Reviewed by: kib
    Obtained from: Semihalf
    Sponsored by: Marvell
    Differential revision: https://reviews.freebsd.org/D29603
    
    (cherry picked from commit 1c1ead9b94a1a731646327ec3b09e8f3acd577b8)
---
 usr.sbin/pciconf/pciconf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 817de6ec09ed..6b54687d7c79 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -1126,7 +1126,11 @@ 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;
-	pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE; /* XXX */
+#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)


More information about the dev-commits-src-all mailing list