diff mbox series

Implement ioremap_prot support (v2)

Message ID 20221202083356.169176-1-jiangjianwen@uniontech.com (mailing list archive)
State Changes Requested
Headers show
Series Implement ioremap_prot support (v2) | expand

Checks

Context Check Description
conchuod/patch_count success Link
conchuod/cover_letter success Single patches do not need cover letters
conchuod/tree_selection success Guessed tree name to be for-next
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/module_param success Was 0 now: 0
conchuod/alphanumeric_selects success Out of order selects before the patch: 57 and now 57
conchuod/build_rv32_defconfig success Build OK
conchuod/build_warn_rv64 success Errors and warnings before: 0 this patch: 0
conchuod/dtb_warn_rv64 success Errors and warnings before: 0 this patch: 0
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch warning WARNING: Do not use whitespace before Signed-off-by:
conchuod/source_inline success Was 0 now: 0
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Jianwen Jiang Dec. 2, 2022, 8:33 a.m. UTC
Feature ioremap_prot only needs an implementation of pte_pgprot on riscv.
    That macro is similar to the same one on platform loongarch, mips and sh.
    We just need:
    1. replace _PFN_MASK with _PAGE_PFN_MASK in pte_gpprot;
    2. add "select HAVE_IOREMAP_PROT" into arch/riscv/Kconfig;
    3. add "depends on MMU" into drivers/fpga/Kconfig to fix the building error "undefined reference to generic_access_phys".

    Signed-off-by: Jianwen Jiang <jiangjianwen@uniontech.com>
---
 arch/riscv/Kconfig            | 1 +
 arch/riscv/include/asm/page.h | 2 ++
 drivers/fpga/Kconfig          | 1 +
 3 files changed, 4 insertions(+)

Comments

Conor Dooley Dec. 2, 2022, 10:36 a.m. UTC | #1
Hello!

On Fri, Dec 02, 2022 at 04:33:56PM +0800, Jianwen Jiang wrote:a
> [PATCH]     Implement ioremap_prot support (v2)

Some process bits.. Please put the v2 inside the leading [], git
format-patch will do this for you with the `-v N` arg. Also, please add
a subsytem prefix to the $subject & drop the leading spaces.

>     Feature ioremap_prot only needs an implementation of pte_pgprot on riscv.

There's also no need to tab this stuff in

>     That macro is similar to the same one on platform loongarch, mips and sh.
>     We just need:
>     1. replace _PFN_MASK with _PAGE_PFN_MASK in pte_gpprot;
>     2. add "select HAVE_IOREMAP_PROT" into arch/riscv/Kconfig;
>     3. add "depends on MMU" into drivers/fpga/Kconfig to fix the building error "undefined reference to generic_access_phys".
> 
>     Signed-off-by: Jianwen Jiang <jiangjianwen@uniontech.com>

And this line should not be tabbed in.

> ---
>  arch/riscv/Kconfig            | 1 +
>  arch/riscv/include/asm/page.h | 2 ++
>  drivers/fpga/Kconfig          | 1 +

This needs to go as a separate patch to the FPGA subsystem, with the
FPGA maintainers in to/cc.

>  3 files changed, 4 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..cb08a4911d60 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
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index bbe0a7cabb75..0493272b8bff 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -5,6 +5,7 @@
>  
>  menuconfig FPGA
>  	tristate "FPGA Configuration Framework"
> +	depends on MMU

How come no other arch needs this dependancy?

Thanks,
Conor.

>  	help
>  	  Say Y here if you want support for configuring FPGAs from the
>  	  kernel.  The FPGA framework adds an FPGA manager class and FPGA
> -- 
> 2.37.3.446.gd42b38dfb5
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Palmer Dabbelt Dec. 2, 2022, 2:59 p.m. UTC | #2
On Fri, 02 Dec 2022 00:33:56 PST (-0800), jiangjianwen@uniontech.com wrote:
>     Feature ioremap_prot only needs an implementation of pte_pgprot on riscv.
>     That macro is similar to the same one on platform loongarch, mips and sh.
>     We just need:
>     1. replace _PFN_MASK with _PAGE_PFN_MASK in pte_gpprot;
>     2. add "select HAVE_IOREMAP_PROT" into arch/riscv/Kconfig;
>     3. add "depends on MMU" into drivers/fpga/Kconfig to fix the building error "undefined reference to generic_access_phys".

That third one should be its own patch, it's not really related to the 
RISC-V bits.

>
>     Signed-off-by: Jianwen Jiang <jiangjianwen@uniontech.com>
> ---
>  arch/riscv/Kconfig            | 1 +
>  arch/riscv/include/asm/page.h | 2 ++
>  drivers/fpga/Kconfig          | 1 +
>  3 files changed, 4 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..cb08a4911d60 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
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index bbe0a7cabb75..0493272b8bff 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -5,6 +5,7 @@
>
>  menuconfig FPGA
>  	tristate "FPGA Configuration Framework"
> +	depends on MMU
>  	help
>  	  Say Y here if you want support for configuring FPGAs from the
>  	  kernel.  The FPGA framework adds an FPGA manager class and FPGA
diff mbox series

Patch

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..cb08a4911d60 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
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index bbe0a7cabb75..0493272b8bff 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -5,6 +5,7 @@ 
 
 menuconfig FPGA
 	tristate "FPGA Configuration Framework"
+	depends on MMU
 	help
 	  Say Y here if you want support for configuring FPGAs from the
 	  kernel.  The FPGA framework adds an FPGA manager class and FPGA