From nobody Sun Oct 10 13:38:16 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 81F8212DB8B5; Sun, 10 Oct 2021 13:38:18 +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 4HS30T17Wgz4jx1; Sun, 10 Oct 2021 13:38:16 +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 70B6B6937; Sun, 10 Oct 2021 13:38:16 +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 19ADcGRQ035952; Sun, 10 Oct 2021 13:38:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19ADcGrA035950; Sun, 10 Oct 2021 13:38:16 GMT (envelope-from git) Date: Sun, 10 Oct 2021 13:38:16 GMT Message-Id: <202110101338.19ADcGrA035950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: e79989d8233b - stable/13 - LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e79989d8233bf4732a5a1d904e3de7c67d8220cd Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=e79989d8233bf4732a5a1d904e3de7c67d8220cd commit e79989d8233bf4732a5a1d904e3de7c67d8220cd Author: Jessica Clarke AuthorDate: 2021-10-03 18:34:40 +0000 Commit: Jessica Clarke CommitDate: 2021-10-10 13:36:53 +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 (cherry picked from commit 8167c92f65bc20145467b3b98c842cde57736900) --- 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 c2dbab769c2a..a09ae439266e 100644 --- a/sys/compat/linuxkpi/common/include/linux/page.h +++ b/sys/compat/linuxkpi/common/include/linux/page.h @@ -76,8 +76,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))