2022-11-14 10:07:19

by Anup Patel

[permalink] [raw]
Subject: [PATCH v6 0/3] Add PMEM support for RISC-V

The Linux NVDIMM PEM drivers require arch support to map and access the
persistent memory device. This series adds RISC-V PMEM support using
recently added Svpbmt and Zicbom support.

First two patches are fixes and remaining two patches add the required
PMEM support for Linux RISC-V.

These patches can also be found in riscv_pmem_v6 branch at:
https://github.com/avpatel/linux.git

Changes since v5:
- Rebased on Linux-6.1-rc5
- Directly add pmem.o in obj-y of PATCH3
- Dropped PATCH1 since this is already merged.

Changes since v4:
- Simplify PATCH2 by implementing RISC-V specific arch_memremap_wb()

Changes since v3:
- Pickup correct version of Drew's patch as PATCH1

Changes since v2:
- Rebased on Linux-6.1-rc1
- Replaced PATCH1 with the patch proposed by Drew

Changes since v1:
- Fix error reported by test bot
https://lore.kernel.org/all/[email protected]/

Anup Patel (3):
RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
RISC-V: Implement arch specific PMEM APIs
RISC-V: Enable PMEM drivers

arch/riscv/Kconfig | 1 +
arch/riscv/configs/defconfig | 1 +
arch/riscv/include/asm/io.h | 5 +++++
arch/riscv/mm/Makefile | 1 +
arch/riscv/mm/pmem.c | 21 +++++++++++++++++++++
5 files changed, 29 insertions(+)
create mode 100644 arch/riscv/mm/pmem.c

--
2.34.1



2022-11-14 10:48:16

by Anup Patel

[permalink] [raw]
Subject: [PATCH v6 1/3] RISC-V: Fix MEMREMAP_WB for systems with Svpbmt

Currently, the memremap() called with MEMREMAP_WB maps memory using
the generic ioremap() function which breaks on system with Svpbmt
because memory mapped using _PAGE_IOREMAP page attributes is treated
as strongly-ordered non-cacheable IO memory.

To address this, we implement RISC-V specific arch_memremap_wb()
which maps memory using _PAGE_KERNEL page attributes resulting in
write-back cacheable mapping on systems with Svpbmt.

Fixes: ff689fd21cb1 ("riscv: add RISC-V Svpbmt extension support")
Co-developed-by: Mayuresh Chitale <[email protected]>
Signed-off-by: Mayuresh Chitale <[email protected]>
Signed-off-by: Anup Patel <[email protected]>
---
arch/riscv/include/asm/io.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h
index 92080a227937..42497d487a17 100644
--- a/arch/riscv/include/asm/io.h
+++ b/arch/riscv/include/asm/io.h
@@ -135,4 +135,9 @@ __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw())

#include <asm-generic/io.h>

+#ifdef CONFIG_MMU
+#define arch_memremap_wb(addr, size) \
+ ((__force void *)ioremap_prot((addr), (size), _PAGE_KERNEL))
+#endif
+
#endif /* _ASM_RISCV_IO_H */
--
2.34.1


2022-11-14 17:22:30

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

Hey Anup,

Looks like patches 2 and 3 are failing for the nommu defconfigs:
https://patchwork.kernel.org/project/linux-riscv/list/?series=694995
Unfortunately, if the build fails NIPA doesn't appear to save a log.

In case it's relevant, should be gcc-11 & bintutils 2.37.

Thanks,
Conor.

On Mon, Nov 14, 2022 at 02:35:33PM +0530, Anup Patel wrote:
> The Linux NVDIMM PEM drivers require arch support to map and access the
> persistent memory device. This series adds RISC-V PMEM support using
> recently added Svpbmt and Zicbom support.
>
> First two patches are fixes and remaining two patches add the required
> PMEM support for Linux RISC-V.
>
> These patches can also be found in riscv_pmem_v6 branch at:
> https://github.com/avpatel/linux.git
>
> Changes since v5:
> - Rebased on Linux-6.1-rc5
> - Directly add pmem.o in obj-y of PATCH3
> - Dropped PATCH1 since this is already merged.
>
> Changes since v4:
> - Simplify PATCH2 by implementing RISC-V specific arch_memremap_wb()
>
> Changes since v3:
> - Pickup correct version of Drew's patch as PATCH1
>
> Changes since v2:
> - Rebased on Linux-6.1-rc1
> - Replaced PATCH1 with the patch proposed by Drew
>
> Changes since v1:
> - Fix error reported by test bot
> https://lore.kernel.org/all/[email protected]/
>
> Anup Patel (3):
> RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
> RISC-V: Implement arch specific PMEM APIs
> RISC-V: Enable PMEM drivers
>
> arch/riscv/Kconfig | 1 +
> arch/riscv/configs/defconfig | 1 +
> arch/riscv/include/asm/io.h | 5 +++++
> arch/riscv/mm/Makefile | 1 +
> arch/riscv/mm/pmem.c | 21 +++++++++++++++++++++
> 5 files changed, 29 insertions(+)
> create mode 100644 arch/riscv/mm/pmem.c
>
> --
> 2.34.1
>

2022-11-19 13:08:32

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

On Mon, Nov 14, 2022 at 10:11 PM Conor Dooley <[email protected]> wrote:
>
> Hey Anup,
>
> Looks like patches 2 and 3 are failing for the nommu defconfigs:
> https://patchwork.kernel.org/project/linux-riscv/list/?series=694995
> Unfortunately, if the build fails NIPA doesn't appear to save a log.
>
> In case it's relevant, should be gcc-11 & bintutils 2.37.

I tried nommu defconfigs with gcc-12.1.0 and binutils-2.39 and I did
not see any failure.

Regards,
Anup

>
> Thanks,
> Conor.
>
> On Mon, Nov 14, 2022 at 02:35:33PM +0530, Anup Patel wrote:
> > The Linux NVDIMM PEM drivers require arch support to map and access the
> > persistent memory device. This series adds RISC-V PMEM support using
> > recently added Svpbmt and Zicbom support.
> >
> > First two patches are fixes and remaining two patches add the required
> > PMEM support for Linux RISC-V.
> >
> > These patches can also be found in riscv_pmem_v6 branch at:
> > https://github.com/avpatel/linux.git
> >
> > Changes since v5:
> > - Rebased on Linux-6.1-rc5
> > - Directly add pmem.o in obj-y of PATCH3
> > - Dropped PATCH1 since this is already merged.
> >
> > Changes since v4:
> > - Simplify PATCH2 by implementing RISC-V specific arch_memremap_wb()
> >
> > Changes since v3:
> > - Pickup correct version of Drew's patch as PATCH1
> >
> > Changes since v2:
> > - Rebased on Linux-6.1-rc1
> > - Replaced PATCH1 with the patch proposed by Drew
> >
> > Changes since v1:
> > - Fix error reported by test bot
> > https://lore.kernel.org/all/[email protected]/
> >
> > Anup Patel (3):
> > RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
> > RISC-V: Implement arch specific PMEM APIs
> > RISC-V: Enable PMEM drivers
> >
> > arch/riscv/Kconfig | 1 +
> > arch/riscv/configs/defconfig | 1 +
> > arch/riscv/include/asm/io.h | 5 +++++
> > arch/riscv/mm/Makefile | 1 +
> > arch/riscv/mm/pmem.c | 21 +++++++++++++++++++++
> > 5 files changed, 29 insertions(+)
> > create mode 100644 arch/riscv/mm/pmem.c
> >
> > --
> > 2.34.1
> >

2022-11-19 13:16:30

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

On Sat, Nov 19, 2022 at 06:11:08PM +0530, Anup Patel wrote:
> On Mon, Nov 14, 2022 at 10:11 PM Conor Dooley <[email protected]> wrote:
> >
> > Hey Anup,
> >
> > Looks like patches 2 and 3 are failing for the nommu defconfigs:
> > https://patchwork.kernel.org/project/linux-riscv/list/?series=694995
> > Unfortunately, if the build fails NIPA doesn't appear to save a log.
> >
> > In case it's relevant, should be gcc-11 & bintutils 2.37.
>
> I tried nommu defconfigs with gcc-12.1.0 and binutils-2.39 and I did
> not see any failure.

In the interim, I got my new machine set up properly and have gcc-11
locally now (11.1.0) with binutils 2.37. I just gave the series a try
and I cannot see the failure either but I am not using tuxmake.

Apologies for the noise Anup!
FWIW:
Acked-by: Conor Dooley <[email protected]>

>
> Regards,
> Anup
>
> >
> > Thanks,
> > Conor.
> >
> > On Mon, Nov 14, 2022 at 02:35:33PM +0530, Anup Patel wrote:
> > > The Linux NVDIMM PEM drivers require arch support to map and access the
> > > persistent memory device. This series adds RISC-V PMEM support using
> > > recently added Svpbmt and Zicbom support.
> > >
> > > First two patches are fixes and remaining two patches add the required
> > > PMEM support for Linux RISC-V.
> > >
> > > These patches can also be found in riscv_pmem_v6 branch at:
> > > https://github.com/avpatel/linux.git
> > >
> > > Changes since v5:
> > > - Rebased on Linux-6.1-rc5
> > > - Directly add pmem.o in obj-y of PATCH3
> > > - Dropped PATCH1 since this is already merged.
> > >
> > > Changes since v4:
> > > - Simplify PATCH2 by implementing RISC-V specific arch_memremap_wb()
> > >
> > > Changes since v3:
> > > - Pickup correct version of Drew's patch as PATCH1
> > >
> > > Changes since v2:
> > > - Rebased on Linux-6.1-rc1
> > > - Replaced PATCH1 with the patch proposed by Drew
> > >
> > > Changes since v1:
> > > - Fix error reported by test bot
> > > https://lore.kernel.org/all/[email protected]/
> > >
> > > Anup Patel (3):
> > > RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
> > > RISC-V: Implement arch specific PMEM APIs
> > > RISC-V: Enable PMEM drivers
> > >
> > > arch/riscv/Kconfig | 1 +
> > > arch/riscv/configs/defconfig | 1 +
> > > arch/riscv/include/asm/io.h | 5 +++++
> > > arch/riscv/mm/Makefile | 1 +
> > > arch/riscv/mm/pmem.c | 21 +++++++++++++++++++++
> > > 5 files changed, 29 insertions(+)
> > > create mode 100644 arch/riscv/mm/pmem.c
> > >
> > > --
> > > 2.34.1
> > >

2022-12-03 06:48:06

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

Hi Palmer,

On Mon, Nov 14, 2022 at 2:36 PM Anup Patel <[email protected]> wrote:
>
> The Linux NVDIMM PEM drivers require arch support to map and access the
> persistent memory device. This series adds RISC-V PMEM support using
> recently added Svpbmt and Zicbom support.
>
> First two patches are fixes and remaining two patches add the required
> PMEM support for Linux RISC-V.
>
> These patches can also be found in riscv_pmem_v6 branch at:
> https://github.com/avpatel/linux.git
>
> Changes since v5:
> - Rebased on Linux-6.1-rc5
> - Directly add pmem.o in obj-y of PATCH3
> - Dropped PATCH1 since this is already merged.
>
> Changes since v4:
> - Simplify PATCH2 by implementing RISC-V specific arch_memremap_wb()
>
> Changes since v3:
> - Pickup correct version of Drew's patch as PATCH1
>
> Changes since v2:
> - Rebased on Linux-6.1-rc1
> - Replaced PATCH1 with the patch proposed by Drew
>
> Changes since v1:
> - Fix error reported by test bot
> https://lore.kernel.org/all/[email protected]/
>
> Anup Patel (3):
> RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
> RISC-V: Implement arch specific PMEM APIs
> RISC-V: Enable PMEM drivers

Can this series be considered for Linux-6.2 ?

Regards,
Anup

>
> arch/riscv/Kconfig | 1 +
> arch/riscv/configs/defconfig | 1 +
> arch/riscv/include/asm/io.h | 5 +++++
> arch/riscv/mm/Makefile | 1 +
> arch/riscv/mm/pmem.c | 21 +++++++++++++++++++++
> 5 files changed, 29 insertions(+)
> create mode 100644 arch/riscv/mm/pmem.c
>
> --
> 2.34.1
>

2022-12-09 01:38:07

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

On Mon, 14 Nov 2022 14:35:33 +0530, Anup Patel wrote:
> The Linux NVDIMM PEM drivers require arch support to map and access the
> persistent memory device. This series adds RISC-V PMEM support using
> recently added Svpbmt and Zicbom support.
>
> First two patches are fixes and remaining two patches add the required
> PMEM support for Linux RISC-V.
>
> [...]

Applied, thanks!

[1/3] RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
https://git.kernel.org/palmer/c/b91676fc16cd
[2/3] RISC-V: Implement arch specific PMEM APIs
https://git.kernel.org/palmer/c/a49ab905a1fc
[3/3] RISC-V: Enable PMEM drivers
https://git.kernel.org/palmer/c/497bcbe3ce04

Best regards,
--
Palmer Dabbelt <[email protected]>

Subject: Re: [PATCH v6 0/3] Add PMEM support for RISC-V

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <[email protected]>:

On Mon, 14 Nov 2022 14:35:33 +0530 you wrote:
> The Linux NVDIMM PEM drivers require arch support to map and access the
> persistent memory device. This series adds RISC-V PMEM support using
> recently added Svpbmt and Zicbom support.
>
> First two patches are fixes and remaining two patches add the required
> PMEM support for Linux RISC-V.
>
> [...]

Here is the summary with links:
- [v6,1/3] RISC-V: Fix MEMREMAP_WB for systems with Svpbmt
https://git.kernel.org/riscv/c/b91676fc16cd
- [v6,2/3] RISC-V: Implement arch specific PMEM APIs
https://git.kernel.org/riscv/c/a49ab905a1fc
- [v6,3/3] RISC-V: Enable PMEM drivers
https://git.kernel.org/riscv/c/497bcbe3ce04

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html