From owner-dev-commits-src-all@freebsd.org Sun Oct 3 18:36:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C509E66C7DD; Sun, 3 Oct 2021 18:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMsy94ZHJz3s45; Sun, 3 Oct 2021 18:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 575932D9C; Sun, 3 Oct 2021 18:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 193IanjD074917; Sun, 3 Oct 2021 18:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 193Ian5c074916; Sun, 3 Oct 2021 18:36:49 GMT (envelope-from git) Date: Sun, 3 Oct 2021 18:36:49 GMT Message-Id: <202110031836.193Ian5c074916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8167c92f65bc - main - LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8167c92f65bc20145467b3b98c842cde57736900 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 18:36:49 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8167c92f65bc20145467b3b98c842cde57736900 commit 8167c92f65bc20145467b3b98c842cde57736900 Author: Jessica Clarke AuthorDate: 2021-10-03 18:34:40 +0000 Commit: Jessica Clarke CommitDate: 2021-10-03 18:34:40 +0000 LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards One of the three uses is already guarded; this guards the remaining ones to support architectures like riscv that do not provide write-combining, and is needed to build drm-kmod on riscv. Reviewed by: hselasky, manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31999 --- sys/compat/linuxkpi/common/include/linux/io.h | 4 ++++ sys/compat/linuxkpi/common/include/linux/page.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index 0104eea90ace..074417b892f9 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -411,8 +411,12 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr); #define ioremap(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) #endif +#ifdef VM_MEMATTR_WRITE_COMBINING #define ioremap_wc(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) +#else +#define ioremap_wc(addr, size) ioremap_nocache(addr, size) +#endif #define ioremap_wb(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) void iounmap(void *addr); diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h index ca7365419e22..0c3d456d6ec0 100644 --- a/sys/compat/linuxkpi/common/include/linux/page.h +++ b/sys/compat/linuxkpi/common/include/linux/page.h @@ -83,8 +83,12 @@ pgprot2cachemode(pgprot_t prot) #define clear_page(page) memset(page, 0, PAGE_SIZE) #define pgprot_noncached(prot) \ (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE)) +#ifdef VM_MEMATTR_WRITE_COMBINING #define pgprot_writecombine(prot) \ (((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING)) +#else +#define pgprot_writecombine(prot) pgprot_noncached(prot) +#endif #undef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1))