From: Jianwen Jiang <jiangjianwen@uniontech.com>
To: paul.walmsley@sifive.com, palmer@dabbelt.com,
aou@eecs.berkeley.edu, alexandre.ghiti@canonical.comp,
geert@linux-m68k.org, panqinglin2020@iscas.ac.cn, arnd@arndb.de
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Jianwen Jiang <jiangjianwen@uniontech.com>
Subject: [PATCH] riscv: Implement ioremap_prot support
Date: Wed, 16 Nov 2022 10:57:09 +0800 [thread overview]
Message-ID: <20221116025709.27368-1-jiangjianwen@uniontech.com> (raw)
Feature ioremap_prot only needs an implementation of pte_pgprot on riscv.
That macro is similar on platform loongarch, mips and sh.
We just need to replace _PFN_MASK with _PAGE_PFN_MASK, and select
HAVE_IOREMAP_PROT in arch/riscv/Kconfig.
Signed-off-by: Jianwen Jiang <jiangjianwen@uniontech.com>
---
arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/page.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index fa78595a6089..5ed2c7361040 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -95,6 +95,7 @@ config RISCV
select HAVE_FUNCTION_ERROR_INJECTION
select HAVE_GCC_PLUGINS
select HAVE_GENERIC_VDSO if MMU && 64BIT
+ select HAVE_IOREMAP_PROT
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES if !XIP_KERNEL
select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index ac70b0fd9a9a..d379b4702849 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -84,6 +84,8 @@ typedef struct page *pgtable_t;
#define __pgd(x) ((pgd_t) { (x) })
#define __pgprot(x) ((pgprot_t) { (x) })
+#define pte_pgprot(x) __pgprot(pte_val(x) & ~_PAGE_PFN_MASK)
+
#ifdef CONFIG_64BIT
#define PTE_FMT "%016lx"
#else
--
2.37.3.446.gd42b38dfb5
next reply other threads:[~2022-11-16 2:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 2:57 Jianwen Jiang [this message]
2022-11-24 2:03 ` kernel test robot
2022-12-01 20:25 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221116025709.27368-1-jiangjianwen@uniontech.com \
--to=jiangjianwen@uniontech.com \
--cc=alexandre.ghiti@canonical.comp \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=panqinglin2020@iscas.ac.cn \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®