public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] riscv mmu-type minor fixes
@ 2022-05-02 12:50 Niklas Cassel
  2022-05-02 12:50 ` [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57 Niklas Cassel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Niklas Cassel @ 2022-05-02 12:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Paul Walmsley, Palmer Dabbelt,
	Albert Ou
  Cc: Niklas Cassel, devicetree, linux-riscv

Hello there,


Here are some minor riscv mmu-type related fixes.

The first patch simply adds "riscv,sv57" to the list of valid mmu-type
values.

The second patch fixes the "mmu:" print in /proc/cpuinfo on nommu systems.

Please review.


Kind regards,
Niklas

Changes since v1:
-Picked up tag from Rob Herring on patch 1/1.
-Send both patches as a series, since they are relate to mmu-type.

Niklas Cassel (2):
  dt-bindings: riscv: Add mmu-type riscv,sv57
  riscv: Don't output a bogus mmu-type on a no MMU kernel

 Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
 arch/riscv/kernel/cpu.c                           | 4 ++++
 2 files changed, 5 insertions(+)

-- 
2.35.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57
  2022-05-02 12:50 [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
@ 2022-05-02 12:50 ` Niklas Cassel
  2022-05-02 12:57   ` Anup Patel
  2022-05-02 12:50 ` [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel Niklas Cassel
  2022-05-16  7:29 ` [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
  2 siblings, 1 reply; 6+ messages in thread
From: Niklas Cassel @ 2022-05-02 12:50 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Paul Walmsley, Palmer Dabbelt,
	Albert Ou
  Cc: Niklas Cassel, Rob Herring, devicetree, linux-riscv

sv57 is defined in the RISC-V Privileged Specification document.

Additionally, commit 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
changed the default MMU mode to sv57, if supported by current hardware.

Add riscv,sv57 to the list of valid mmu-type values.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
index d632ac76532e..3100fa233ca4 100644
--- a/Documentation/devicetree/bindings/riscv/cpus.yaml
+++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
@@ -61,6 +61,7 @@ properties:
       - riscv,sv32
       - riscv,sv39
       - riscv,sv48
+      - riscv,sv57
       - riscv,none
 
   riscv,isa:
-- 
2.35.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel
  2022-05-02 12:50 [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
  2022-05-02 12:50 ` [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57 Niklas Cassel
@ 2022-05-02 12:50 ` Niklas Cassel
  2022-05-02 12:57   ` Anup Patel
  2022-05-16  7:29 ` [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
  2 siblings, 1 reply; 6+ messages in thread
From: Niklas Cassel @ 2022-05-02 12:50 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou; +Cc: Niklas Cassel, linux-riscv

Currently on a 64-bit kernel built without CONFIG_MMU, /proc/cpuinfo will
show the current MMU mode as sv57.

While the device tree property "mmu-type" does have a value "riscv,none" to
describe a CPU without a MMU, since commit 73c7c8f68e72 ("riscv: Use
pgtable_l4_enabled to output mmu_type in cpuinfo"), we no longer rely on
device tree to output the MMU mode. (Not even for CONFIG_32BIT.)

Therefore, instead of readding code to look at the "mmu-type" device tree
property, let's continue with the existing convention to use fixed values
for configurations where we don't determine the MMU mode at runtime.

Add a new fixed value for !CONFIG_MMU in order to output the correct
MMU mode in cpuinfo.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 arch/riscv/kernel/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
index ccb617791e56..ecfb3e85ffb2 100644
--- a/arch/riscv/kernel/cpu.c
+++ b/arch/riscv/kernel/cpu.c
@@ -138,6 +138,7 @@ static void print_mmu(struct seq_file *f)
 {
 	char sv_type[16];
 
+#ifdef CONFIG_MMU
 #if defined(CONFIG_32BIT)
 	strncpy(sv_type, "sv32", 5);
 #elif defined(CONFIG_64BIT)
@@ -148,6 +149,9 @@ static void print_mmu(struct seq_file *f)
 	else
 		strncpy(sv_type, "sv39", 5);
 #endif
+#else
+	strncpy(sv_type, "none", 5);
+#endif /* CONFIG_MMU */
 	seq_printf(f, "mmu\t\t: %s\n", sv_type);
 }
 
-- 
2.35.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57
  2022-05-02 12:50 ` [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57 Niklas Cassel
@ 2022-05-02 12:57   ` Anup Patel
  0 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2022-05-02 12:57 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: Rob Herring, Krzysztof Kozlowski, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Rob Herring, DTML, linux-riscv

On Mon, May 2, 2022 at 6:20 PM Niklas Cassel <niklas.cassel@wdc.com> wrote:
>
> sv57 is defined in the RISC-V Privileged Specification document.
>
> Additionally, commit 011f09d12052 ("riscv: mm: Set sv57 on defaultly")
> changed the default MMU mode to sv57, if supported by current hardware.
>
> Add riscv,sv57 to the list of valid mmu-type values.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> Acked-by: Rob Herring <robh@kernel.org>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
> index d632ac76532e..3100fa233ca4 100644
> --- a/Documentation/devicetree/bindings/riscv/cpus.yaml
> +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
> @@ -61,6 +61,7 @@ properties:
>        - riscv,sv32
>        - riscv,sv39
>        - riscv,sv48
> +      - riscv,sv57
>        - riscv,none
>
>    riscv,isa:
> --
> 2.35.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel
  2022-05-02 12:50 ` [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel Niklas Cassel
@ 2022-05-02 12:57   ` Anup Patel
  0 siblings, 0 replies; 6+ messages in thread
From: Anup Patel @ 2022-05-02 12:57 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv

On Mon, May 2, 2022 at 6:20 PM Niklas Cassel <niklas.cassel@wdc.com> wrote:
>
> Currently on a 64-bit kernel built without CONFIG_MMU, /proc/cpuinfo will
> show the current MMU mode as sv57.
>
> While the device tree property "mmu-type" does have a value "riscv,none" to
> describe a CPU without a MMU, since commit 73c7c8f68e72 ("riscv: Use
> pgtable_l4_enabled to output mmu_type in cpuinfo"), we no longer rely on
> device tree to output the MMU mode. (Not even for CONFIG_32BIT.)
>
> Therefore, instead of readding code to look at the "mmu-type" device tree
> property, let's continue with the existing convention to use fixed values
> for configurations where we don't determine the MMU mode at runtime.
>
> Add a new fixed value for !CONFIG_MMU in order to output the correct
> MMU mode in cpuinfo.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>

Looks good to me.

Reviewed-by: Anup Patel <anup@brainfault.org>

Regards,
Anup

> ---
>  arch/riscv/kernel/cpu.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
> index ccb617791e56..ecfb3e85ffb2 100644
> --- a/arch/riscv/kernel/cpu.c
> +++ b/arch/riscv/kernel/cpu.c
> @@ -138,6 +138,7 @@ static void print_mmu(struct seq_file *f)
>  {
>         char sv_type[16];
>
> +#ifdef CONFIG_MMU
>  #if defined(CONFIG_32BIT)
>         strncpy(sv_type, "sv32", 5);
>  #elif defined(CONFIG_64BIT)
> @@ -148,6 +149,9 @@ static void print_mmu(struct seq_file *f)
>         else
>                 strncpy(sv_type, "sv39", 5);
>  #endif
> +#else
> +       strncpy(sv_type, "none", 5);
> +#endif /* CONFIG_MMU */
>         seq_printf(f, "mmu\t\t: %s\n", sv_type);
>  }
>
> --
> 2.35.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] riscv mmu-type minor fixes
  2022-05-02 12:50 [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
  2022-05-02 12:50 ` [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57 Niklas Cassel
  2022-05-02 12:50 ` [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel Niklas Cassel
@ 2022-05-16  7:29 ` Niklas Cassel
  2 siblings, 0 replies; 6+ messages in thread
From: Niklas Cassel @ 2022-05-16  7:29 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
	Albert Ou, Rob Herring, Krzysztof Kozlowski, Paul Walmsley

On Mon, May 02, 2022 at 02:50:12PM +0200, Niklas Cassel wrote:
> Hello there,
> 
> 
> Here are some minor riscv mmu-type related fixes.
> 
> The first patch simply adds "riscv,sv57" to the list of valid mmu-type
> values.
> 
> The second patch fixes the "mmu:" print in /proc/cpuinfo on nommu systems.
> 
> Please review.
> 
> 
> Kind regards,
> Niklas
> 
> Changes since v1:
> -Picked up tag from Rob Herring on patch 1/1.
> -Send both patches as a series, since they are relate to mmu-type.
> 
> Niklas Cassel (2):
>   dt-bindings: riscv: Add mmu-type riscv,sv57
>   riscv: Don't output a bogus mmu-type on a no MMU kernel
> 
>  Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
>  arch/riscv/kernel/cpu.c                           | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> -- 
> 2.35.1
> 

Hello Palmer,

A gentle ping.
Any chance of this getting picked up?


Kind regards,
Niklas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-16  7:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-02 12:50 [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel
2022-05-02 12:50 ` [PATCH v2 1/2] dt-bindings: riscv: Add mmu-type riscv,sv57 Niklas Cassel
2022-05-02 12:57   ` Anup Patel
2022-05-02 12:50 ` [PATCH v2 2/2] riscv: Don't output a bogus mmu-type on a no MMU kernel Niklas Cassel
2022-05-02 12:57   ` Anup Patel
2022-05-16  7:29 ` [PATCH v2 0/2] riscv mmu-type minor fixes Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox