Re: [PATCH] RISC-V: redefine PTRS_PER_PGD/PTRS_PER_PMD/PTRS_PER_PTE

2019-04-18 Thread Anup Patel
On Thu, Apr 18, 2019 at 6:26 AM damon wrote: > > Use the number of addresses to define the relevant macros. > > Signed-off-by: damon > --- > arch/riscv/include/asm/pgtable-32.h | 2 ++ > arch/riscv/include/asm/pgtable-64.h | 3 ++- > arch/riscv/include/asm/pgtable.h| 4 ++-- > 3 files

[PATCH v3 2/3] RISC-V: Add interrupt related SCAUSE defines in asm/csr.h

2019-04-15 Thread Anup Patel
This patch adds SCAUSE interrupt flag and SCAUSE interrupt related defines to asm/csr.h. We also use these defines in kernel/irq.c and express SIE/SIP flags in-terms of SCAUSE interrupt causes. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 25 + arch/riscv

[PATCH v3 3/3] RISC-V: Access CSRs using CSR numbers

2019-04-15 Thread Anup Patel
. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 32 ++-- arch/riscv/include/asm/irqflags.h| 10 - arch/riscv/include/asm/mmu_context.h | 7 +- arch/riscv/kernel/entry.S| 22 +-- arch/riscv/kernel/head.S

[PATCH v3 1/3] RISC-V: Use tabs to align macro values in asm/csr.h

2019-04-15 Thread Anup Patel
The spacing between macro name and value is not consistent in asm/csr.h. This patch beautifies asm/csr.h by using tabs to align macro values instead of spaces. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 76 ++-- 1 file changed, 38 insertions

[PATCH v3 0/3] Allow accessing CSR using CSR number

2019-04-15 Thread Anup Patel
nce v2: - Dropped PATCH1 which added asm/encoding.h - Added new PATCH1 which beautifies asm/csr.h by using tabs to align macro values Changes since v1: - Squash PATCH2 into cpatch3 - Added new PATCH2 to add interrupt related SCAUSE defines in asm/encoding.h Anup Patel (3): RISC-V: Use tabs to

Re: [PATCH v2 1/3] RISC-V: Add separate asm/encoding.h for spec related defines

2019-04-15 Thread Anup Patel
On Mon, Apr 15, 2019 at 11:19 AM Christoph Hellwig wrote: > > On Sat, Apr 13, 2019 at 03:38:35PM +, Anup Patel wrote: > > It's better to have all RISC-V spec related defines in one place > > so this patch adds separate asm/encoding.h for such defines which > > can

[PATCH v2 2/3] RISC-V: Add interrupt related SCAUSE defines in asm/encoding.h

2019-04-13 Thread Anup Patel
This patch adds SCAUSE interrupt flag and SCAUSE interrupt cause related defines to asm/encoding.h. We also use these defines in arch/riscv/kernel/irq.c and express SIE/SIP flag in-terms of interrupt causes. Signed-off-by: Anup Patel --- arch/riscv/include/asm/encoding.h | 25

[PATCH v2 3/3] RISC-V: Access CSRs using CSR numbers

2019-04-13 Thread Anup Patel
. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 15 --- arch/riscv/include/asm/encoding.h| 16 arch/riscv/include/asm/irqflags.h| 10 +- arch/riscv/include/asm/mmu_context.h | 7 +-- arch/riscv/kernel/entry.S| 22

[PATCH v2 0/3] Allow accessing CSR using CSR number

2019-04-13 Thread Anup Patel
nce v1: - Squash PATCH2 into cpatch3 - Added new PATCH2 to add interrupt related SCAUSE defines in asm/encoding.h Anup Patel (3): RISC-V: Add separate asm/encoding.h for spec related defines RISC-V: Add interrupt related SCAUSE defines in asm/encoding.h RISC-V: Access CSRs using CSR numbers

[PATCH v2 1/3] RISC-V: Add separate asm/encoding.h for spec related defines

2019-04-13 Thread Anup Patel
It's better to have all RISC-V spec related defines in one place so this patch adds separate asm/encoding.h for such defines which can be included in assembly as well as C code. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 52 +- arch/riscv/include

Re: [PATCH 3/3] RISC-V: Access CSRs using CSR numbers

2019-04-13 Thread Anup Patel
On Sat, Apr 13, 2019 at 1:25 PM Christoph Hellwig wrote: > > On Sat, Apr 13, 2019 at 07:39:44AM +, Anup Patel wrote: > > We should prefer accessing CSRs using their CSR numbers because: > > 1. It compiles fine with older toolchains. > > 2. We can use latest CSR name

Re: [PATCH 1/3] RISC-V: Add separate asm/encoding.h for spec related defines

2019-04-13 Thread Anup Patel
On Sat, Apr 13, 2019 at 1:23 PM Christoph Hellwig wrote: > > On Sat, Apr 13, 2019 at 07:39:35AM +, Anup Patel wrote: > > It's better to have all RISC-V spec related defines in one place > > so this patch adds separate asm/encoding.h for such defines which > > can

Re: [PATCH 2/3] RISC-V: Add defines for CSR numbers

2019-04-13 Thread Anup Patel
On Sat, Apr 13, 2019 at 1:24 PM Christoph Hellwig wrote: > > I think this should be merged with the next patch. Also please > only add the CSRs that we actually use. Sure, will do. Regards, Anup

[PATCH 0/3] Allow accessing CSR using CSR number

2019-04-13 Thread Anup Patel
. sptbr => CSR_SATP, sbadaddr => CSR_STVAL, etc.) 3. We can access newly added CSRs even if toolchain does not recognize newly addes CSRs by name. (e.g. BSSTATUS, BSIE, SSIP, etc.) The patchset can be found in riscv_csr_number_v1 branch of https//github.com/avpatel/linux.git Anup Patel (3):

[PATCH 2/3] RISC-V: Add defines for CSR numbers

2019-04-13 Thread Anup Patel
Each CSR is encoded as 12bit number in RISC-V instructions. This patch adds defines for CSR numbers to allow us access CSRs using CSR numbers. Signed-off-by: Anup Patel --- arch/riscv/include/asm/encoding.h | 237 ++ 1 file changed, 237 insertions(+) diff --git

[PATCH 3/3] RISC-V: Access CSRs using CSR numbers

2019-04-13 Thread Anup Patel
. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 15 --- arch/riscv/include/asm/irqflags.h| 10 +- arch/riscv/include/asm/mmu_context.h | 2 +- arch/riscv/kernel/entry.S| 22 +++--- arch/riscv/kernel/head.S

[PATCH 1/3] RISC-V: Add separate asm/encoding.h for spec related defines

2019-04-13 Thread Anup Patel
It's better to have all RISC-V spec related defines in one place so this patch adds separate asm/encoding.h for such defines which can be included in assembly as well as C code. Signed-off-by: Anup Patel --- arch/riscv/include/asm/csr.h | 52 +- arch/riscv/include

Re: [PATCH 1/3] RISC-V: Add separate defconfig for 32bit systems

2019-04-10 Thread Anup Patel
On Tue, Apr 9, 2019 at 10:14 PM Palmer Dabbelt wrote: > > On Tue, 12 Mar 2019 15:08:12 PDT (-0700), Anup Patel wrote: > > This patch adds rv32_defconfig for 32bit systems. The only > > difference between rv32_defconfig and defconfig is that > > rv32_defconfig has CONFIG_

Re: [PATCH 2/3] RISC-V: Make setup_vm() independent of GCC code model

2019-04-09 Thread Anup Patel
On Tue, Apr 9, 2019 at 10:17 PM Palmer Dabbelt wrote: > > On Tue, 12 Mar 2019 15:08:16 PDT (-0700), Anup Patel wrote: > > The setup_vm() must access kernel symbols in a position independent way > > because it will be called from head.S with MMU off. > > > > If we com

RE: [PATCH v2] RISC-V: Implement ASID allocator

2019-04-08 Thread Anup Patel
> -Original Message- > From: Guo Ren > Sent: Tuesday, April 9, 2019 8:33 AM > To: Anup Patel > Cc: Palmer Dabbelt ; Albert Ou > ; linux-kernel@vger.kernel.org; Mike Rapoport > ; Christoph Hellwig ; Atish Patra > ; Gary Guo ; Paul Walmsley > ; linux-ri...@li

Re: [PATCH v3] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-07 Thread Anup Patel
On Sat, Apr 6, 2019 at 2:47 AM Palmer Dabbelt wrote: > > On Thu, 04 Apr 2019 23:01:11 PDT (-0700), a...@brainfault.org wrote: > > On Fri, Apr 5, 2019 at 11:24 AM Christoph Hellwig > > wrote: > >> > >> On Fri, Apr 05, 2019 at 05:49:34AM +, Anup Patel wrote

Re: [PATCH v3] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-05 Thread Anup Patel
On Fri, Apr 5, 2019 at 11:24 AM Christoph Hellwig wrote: > > On Fri, Apr 05, 2019 at 05:49:34AM +, Anup Patel wrote: > > The Maximum Physical Memory 2GiB option for 64bit systems is currently > > broken because kernel hangs at boot-time when this option is enabled >

[PATCH v3] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-04 Thread Anup Patel
fixes above issue by removing unusable memory region in setup_bootmem(). Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- Changes since v2: - Drop brackets in if() condition added by this patch Changes since v1: - Use memblock_remove() instead of memblock_reserve() --- arch/riscv/mm

Re: [PATCH v8 06/20] riscv: mm: Add p?d_large() definitions

2019-04-04 Thread Anup Patel
_t pmd) > +{ > + return pmd_present(pmd) > + && (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); > +} > + > static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) > { > *pmdp = pmd; > -- > 2.20.1 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup

Re: [PATCH] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-02 Thread Anup Patel
On Tue, Apr 2, 2019 at 2:05 PM Mike Rapoport wrote: > > On Tue, Apr 02, 2019 at 06:02:38AM +, Anup Patel wrote: > > The Maximum Physical Memory 2GiB option for 64bit systems is currently > > broken because kernel hangs at boot-time when this option is enabled > > and t

[PATCH v2] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-02 Thread Anup Patel
fixes above issue by removing unusable memory region in setup_bootmem(). Signed-off-by: Anup Patel --- Changes since v1: - Use memblock_remove() instead of memblock_reserve() --- arch/riscv/mm/init.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm

Re: [PATCH] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-02 Thread Anup Patel
On Tue, Apr 2, 2019 at 2:05 PM Mike Rapoport wrote: > > On Tue, Apr 02, 2019 at 06:02:38AM +, Anup Patel wrote: > > The Maximum Physical Memory 2GiB option for 64bit systems is currently > > broken because kernel hangs at boot-time when this option is enabled > > and t

[PATCH] RISC-V: Fix Maximum Physical Memory 2GiB option for 64bit systems

2019-04-02 Thread Anup Patel
fixes above issue by reserving unusable memory region in setup_bootmem(). Signed-off-by: Anup Patel --- arch/riscv/mm/init.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 5fd8c922e1c2..6b063f20a9d0 100644 --- a/arch/riscv/mm/init.c

Re: [PATCH] RISC-V: Fix FIXMAP_TOP to avoid overlap with VMALLOC area

2019-03-29 Thread Anup Patel
Hi Palmer, On Fri, Mar 29, 2019 at 11:48 AM Palmer Dabbelt wrote: > > On Fri, 22 Mar 2019 06:25:09 PDT (-0700), Christoph Hellwig wrote: > > Looks good, > > > > Reviewed-by: Christoph Hellwig > > Thanks. I've added this to my fixes list for the next RC. I have another RC fix as well: "[PATCH

Re: [PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
On Fri, Mar 29, 2019 at 10:34 AM Paul Walmsley wrote: > > > On Thu, 28 Mar 2019, Anup Patel wrote: > > > Signed-off-by: Gary Guo > > Signed-off-by: Anup Patel > > --- > > Changes since v1: > > - We adapt good aspects from Gary Guo's ASID allocator i

[PATCH v3] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
in performance. Co-developed-by:: Gary Guo Signed-off-by: Anup Patel --- Changes since v2: - Move to lazy TLB flushing because we get slow path warnings if we use flush_tlb_all() - Don't set ASID bits to all 1s in head.s. Instead just do it on boot CPU calling asids_init() for determining number

Re: [PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 8:03 PM Gary Guo wrote: > > > > On 28/03/2019 14:13, Anup Patel wrote: > > On Thu, Mar 28, 2019 at 7:07 PM Gary Guo wrote: > >> > >> Hi Anup, > >> > >> The code still does not use ASID in TLB flush routines. Wit

Re: [PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 8:00 PM Gary Guo wrote: > > > > On 28/03/2019 14:09, Anup Patel wrote: > > On Thu, Mar 28, 2019 at 7:07 PM Gary Guo wrote: > >> > >> Hi Anup, > >> > >> The code still does not use ASID in TLB flush routines. Wit

Re: [PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
ystems. 32-bit CONTEXTID may overflow in a month time. > > Please all see my inline comments. > > Best, > Gary > > On 28/03/2019 06:32, Anup Patel wrote: > > Currently, we do local TLB flush on every MM switch. This is very harsh > > on performance because

Re: [PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
overflow in a month time? > > Please all see my inline comments. > > Best, > Gary > > On 28/03/2019 06:32, Anup Patel wrote: > > Currently, we do local TLB flush on every MM switch. This is very harsh > > on performance because we are forcing page table walks afte

Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 3:22 PM Anup Patel wrote: > > On Thu, Mar 28, 2019 at 1:25 PM Mike Rapoport wrote: > > > > On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > > > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > &

Re: [PATCH 4/7] RISC-V: Update page tables to cover the whole linear mapping

2019-03-28 Thread Anup Patel
aligned version of va_pa_offset such that all of the physical > address space will be mapped. > > Signed-off-by: Logan Gunthorpe > Cc: Palmer Dabbelt > Cc: Albert Ou > Cc: Anup Patel > Cc: Atish Patra > Cc: Paul Walmsley > Cc: Zong Li > Cc: Mike Rapoport > --- >

Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-28 Thread Anup Patel
On Thu, Mar 28, 2019 at 1:25 PM Mike Rapoport wrote: > > On Wed, Mar 27, 2019 at 12:54:41AM -0700, Christoph Hellwig wrote: > > On Mon, Mar 25, 2019 at 09:46:59PM +0530, Anup Patel wrote: > > > > Why do you even care about kernel mappings for non-existant ram. >

[PATCH v2] RISC-V: Implement ASID allocator

2019-03-28 Thread Anup Patel
TLBs provided by QEMU. Unfortunately, ASID bits of SATP CSR are not implemented on SiFive Unleashed board so we don't see any change in performance. Signed-off-by: Gary Guo Signed-off-by: Anup Patel --- Changes since v1: - We adapt good aspects from Gary Guo's ASID allocator implementation

Re: [PATCH 3/7] RISC-V: Rework kernel's virtual address space mapping

2019-03-28 Thread Anup Patel
fix that issue? It's somewhere in my > email queue... That was a patch I submitted to fix overlapping FIXMAP and VMALLOC regions. This patch does not consider FIXMAP region. I suggest we introduce asm/memory.h where we have all critical defines related to virtual memory layout. Also, t

Re: [PATCH] RISC-V: Implement ASID allocator

2019-03-27 Thread Anup Patel
On Wed, Mar 27, 2019 at 7:39 PM Gary Guo wrote: > > I think my code already get all the caveats cases covered. The only > thing my code is missing is handling the case when ASID is not > supported. Maybe it is better to work based on that instead? Well, I have also spend enough time hardening

Re: [PATCH] RISC-V: Implement ASID allocator

2019-03-27 Thread Anup Patel
On Wed, Mar 27, 2019 at 7:08 PM Gary Guo wrote: > > On 27/03/2019 11:42, Anup Patel wrote: > > On Wed, Mar 27, 2019 at 4:57 PM Gary Guo wrote: > >> > >> Hi Anup, > >> > >> This won't work in an actual hardware with ASID supp

Re: [PATCH] RISC-V: Implement ASID allocator

2019-03-27 Thread Anup Patel
On Wed, Mar 27, 2019 at 7:12 PM Gary Guo wrote: > > I would also like to mention that your code assumes 64-bit atomics > support which we don't have on 32-bit systems. Using 32-bit to track > ASID generations isn't sufficient and will cause overflows. That's why I > have asid_generation_overflow

Re: [PATCH] RISC-V: Implement ASID allocator

2019-03-27 Thread Anup Patel
On Wed, Mar 27, 2019 at 4:57 PM Gary Guo wrote: > > Hi Anup, > > This won't work in an actual hardware with ASID support. There're more Can you elaborate why? This implementation is based on Linux ARM64 ASID allocator which is tested for large number of CPUs on real HW. > interactions with TLB

[PATCH] RISC-V: Implement ASID allocator

2019-03-27 Thread Anup Patel
and ASIDs provided by QEMU. Unfortunately, ASID bits of SATP CSR are not implemented on SiFive Unleashed board so we don't see any change in performance. Signed-off-by: Anup Patel --- This patch is based on Linux-5.1-rc2 and TLB flush cleanup patches v4 from Gary Guo. It can be also found

[PATCH v4] RISC-V: Always compile mm/init.c with cmodel=medany and notrace

2019-03-26 Thread Anup Patel
ot;RISC-V: Move setup_vm() to mm/init.c") Suggested-by: Christoph Hellwig Suggested-by: Mike Rapoport Signed-off-by: Anup Patel Reviewed-by: Mike Rapoport Reviewed-by: Christoph Hellwig --- v4: Use "#error" for setup_vm() compiled without cmodel=medany v3: Don't use CFLAG &

Re: [PATCH v2] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-25 Thread Anup Patel
On Tue, Mar 26, 2019 at 7:52 AM Palmer Dabbelt wrote: > > On Mon, 25 Mar 2019 00:01:45 PDT (-0700), a...@brainfault.org wrote: > > On Mon, Mar 25, 2019 at 12:18 PM Christoph Hellwig > > wrote: > >> > >> On Mon, Mar 25, 2019 at 01:25:50PM +0800, Alan Kao wrote: > >> > Hi Anup, > >> > > >> >

Re: [PATCH v3] RISC-V: Always compile mm/init.c with cmodel=medany and notrace

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 5:08 PM Christoph Hellwig wrote: > > > +ifdef CONFIG_FTRACE > > +CFLAGS_REMOVE_init.o = -pg > > +endif > > + > > obj-y += init.o > > obj-y += fault.o > > obj-y += extable.o > > obj-y += ioremap.o > > obj-y += cacheflush.o > > + > > +CFLAGS_init.o := -mcmodel=medany >

Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 8:29 PM Christoph Hellwig wrote: > > On Mon, Mar 25, 2019 at 06:18:45PM +0530, Anup Patel wrote: > > We trying to addresses following issues in current code: > > 1. The current setup_vm() maps all possible kernel virtual addresses (128GB > >

Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 5:09 PM Christoph Hellwig wrote: > > I'm still not sold on this at all. It is a lot more code, a lot harder > to read code and all for a very narrow corner case that isn't even > going to be enabled in default configs. In case you missed my previous response about why

Re: [PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 5:09 PM Christoph Hellwig wrote: > > I'm still not sold on this at all. It is a lot more code, a lot harder > to read code and all for a very narrow corner case that isn't even > going to be enabled in default configs. The old page table setup code does not exist

[PATCH v3 4/4] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-25 Thread Anup Patel
memblock setup, we map all available memory banks. With this patch in-place, the booting constraint for RISCV32 and RISCV64 kernel is much more relaxed when CONFIG_BOOT_PAGE_ALIGNED=y and we can now boot kernel very close to RAM start thereby minimizng memory wastage. Signed-off-by: Anup Patel --- arch

[PATCH v3 0/4] Boot RISC-V kernel from any 4KB aligned address

2019-03-25 Thread Anup Patel
le - Added PATCH5 to fix memory reservation in setup_bootmem() Anup Patel (4): RISC-V: Add separate defconfig for 32bit systems RISC-V: Fix memory reservation in setup_bootmem() RISC-V: Remove redundant trampoline page table RISC-V: Allow booting kernel from any 4KB aligned address arch/ris

[PATCH v3 2/4] RISC-V: Fix memory reservation in setup_bootmem()

2019-03-25 Thread Anup Patel
Rapoport Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig --- arch/riscv/mm/init.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 8cf9ff1f9058..3e66b7cb3a61 100644 --- a/arch/riscv/mm/init.c +++ b/arch

[PATCH v3 3/4] RISC-V: Remove redundant trampoline page table

2019-03-25 Thread Anup Patel
to above, this patch removes trampoline page table and related code from kernel/head.S and mm/init.c. Signed-off-by: Anup Patel --- arch/riscv/kernel/head.S | 13 - arch/riscv/mm/init.c | 10 -- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/arch/riscv/kernel

[PATCH v3 1/4] RISC-V: Add separate defconfig for 32bit systems

2019-03-25 Thread Anup Patel
This patch adds rv32_defconfig for 32bit systems. The only difference between rv32_defconfig and defconfig is that rv32_defconfig has CONFIG_ARCH_RV32I=y. Signed-off-by: Anup Patel --- arch/riscv/configs/rv32_defconfig | 84 +++ 1 file changed, 84 insertions

[PATCH v3] RISC-V: Always compile mm/init.c with cmodel=medany and notrace

2019-03-25 Thread Anup Patel
1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") Suggested-by: Christoph Hellwig Suggested-by: Mike Rapoport Signed-off-by: Anup Patel Reviewed-by: Mike Rapoport --- v3: Don't use CFLAG "-pg" for mm/init.o v2: Removed CFLAGS_setup.o from kernel/Makefile and replaced SoBs -

Re: [PATCH v2] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 12:18 PM Christoph Hellwig wrote: > > On Mon, Mar 25, 2019 at 01:25:50PM +0800, Alan Kao wrote: > > Hi Anup, > > > > Sorry for being late to the party. I think one more thing should > > move together with setup_vm(): > > Ah, I wonded about that yesterday but wasn't sure.

Re: [PATCH v2] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-25 Thread Anup Patel
On Mon, Mar 25, 2019 at 10:56 AM Alan Kao wrote: > > Hi Anup, > > Sorry for being late to the party. I think one more thing should > move together with setup_vm(): > > On Mon, Mar 25, 2019 at 03:37:38AM +, Anup Patel wrote: > > The Linux RISC-V 32bit kernel is bro

Re: [PATCH v2 2/5] RISC-V: Make setup_vm() independent of GCC code model

2019-03-24 Thread Anup Patel
On Sat, Mar 23, 2019 at 9:15 PM Mike Rapoport wrote: > > On Thu, Mar 21, 2019 at 09:47:47AM +, Anup Patel wrote: > > The setup_vm() must access kernel symbols in a position independent way > > because it will be called from head.S with MMU off. > > > > If we com

Re: [PATCH v2 4/5] RISC-V: Remove redundant trampoline page table

2019-03-24 Thread Anup Patel
On Fri, Mar 22, 2019 at 7:03 PM Christoph Hellwig wrote: > > > > > - /* Compute satp for kernel page tables, but don't load it yet */ > > + /* Compute satp for kernel page directory, but don't load it yet */ > > > > /* > > - * Load trampoline page directory, which will cause us

[PATCH v2] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-24 Thread Anup Patel
=medany for mm/init.c 2. Moving remaing MM-related stuff va_pa_offset, pfn_base and empty_zero_page from kernel/setup.c to mm/init.c Fixes: 6f1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") Suggested-by: Christoph Hellwig Suggested-by: Mike Rapoport Signed-off-by: Anup Patel --- v

Re: [PATCH] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-24 Thread Anup Patel
On Mon, Mar 25, 2019 at 12:44 AM Gary Guo wrote: > > > > > -Original Message- > > From: linux-riscv On Behalf Of > > Anup > > Patel > > Sent: Sunday, March 24, 2019 11:08 > > To: Palmer Dabbelt ; Albert Ou > > Cc: Anup Patel ; linux-ke

Re: [PATCH] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-24 Thread Anup Patel
On Sun, Mar 24, 2019 at 8:27 PM Christoph Hellwig wrote: > > On Sun, Mar 24, 2019 at 11:08:29AM +, Anup Patel wrote: > > Signed-off-by: Christoph Hellwig > > Signed-off-by: Mike Rapoport > > Huh? I don't think this is from Mike and me. > > > +unsigned long

Re: [PATCH] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-24 Thread Anup Patel
On Sun, Mar 24, 2019 at 10:13 PM Mike Rapoport wrote: > > On Sun, Mar 24, 2019 at 03:57:08PM +0100, Christoph Hellwig wrote: > > On Sun, Mar 24, 2019 at 11:08:29AM +, Anup Patel wrote: > > > Signed-off-by: Christoph Hellwig > > > Signed-off-by: Mike Rapopor

[PATCH] RISC-V: Always compile mm/init.c with cmodel=medany

2019-03-24 Thread Anup Patel
=medany for mm/init.c 2. Moving remaing MM-related stuff va_pa_offset, pfn_base and empty_zero_page from kernel/setup.c to mm/init.c Fixes: 6f1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") Signed-off-by: Christoph Hellwig Signed-off-by: Mike Rapoport Signed-off-by: Anup Patel ---

Re: [PATCH v2 3/5] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-23 Thread Anup Patel
On Sat, Mar 23, 2019 at 10:54 PM Christoph Hellwig wrote: > > On Sat, Mar 23, 2019 at 05:40:12PM +0200, Mike Rapoport wrote: > > I have no general objection, but I presume the patch will be significantly > > simplified if the addition of 4K pages support will follow the removal of > > the

Re: [PATCH v2 3/5] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-23 Thread Anup Patel
On Sat, Mar 23, 2019 at 9:10 PM Mike Rapoport wrote: > > On Thu, Mar 21, 2019 at 09:47:51AM +, Anup Patel wrote: > > Currently, we have to boot RISCV64 kernel from a 2MB aligned physical > > address and RISCV32 kernel from a 4MB aligned physical address. This > > const

Re: [PATCH] clocksource/drivers/riscv: Fix clocksource mask

2019-03-23 Thread Anup Patel
p_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, > "clockevents/riscv/timer:starting", > -- > 2.21.0 > Looks good to me. It would be great if you can add "Fixes:" line and "Cc: sta...@vger.kernel.org" Reviewed-by: Anup Patel Regards, Anup

Re: [PATCH] RISC-V: Fix FIXMAP_TOP to avoid overlap with VMALLOC area

2019-03-22 Thread Anup Patel
On Fri, Mar 22, 2019 at 6:55 PM Christoph Hellwig wrote: > > Looks good, > > Reviewed-by: Christoph Hellwig > > Btw, what is the 32-bit test vehicle of choice? qemu with the > virt machine? Yes, for now QEMU seems to be only the option. I am not aware of any board we can purchase for RV32.

[PATCH] RISC-V: Fix FIXMAP_TOP to avoid overlap with VMALLOC area

2019-03-22 Thread Anup Patel
: f2c17aabc917 ("RISC-V: Implement compile-time fixed mappings") Signed-off-by: Anup Patel --- arch/riscv/include/asm/fixmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h index 5cf53dd882e5..9c

[PATCH v2 4/5] RISC-V: Remove redundant trampoline page table

2019-03-21 Thread Anup Patel
to above, this patch removes trampoline page table and related code from kernel/head.S and mm/init.c. Signed-off-by: Anup Patel --- arch/riscv/kernel/head.S | 13 ++- arch/riscv/mm/init.c | 79 2 files changed, 19 insertions(+), 73 deletions(-) diff

[PATCH v2 3/5] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-21 Thread Anup Patel
memblock setup, we map all available memory banks. With this patch in-place, the booting constraint for RISCV32 and RISCV64 kernel is much more relaxed when CONFIG_BOOT_PAGE_ALIGNED=y and we can now boot kernel very close to RAM start thereby minimizng memory wastage. Signed-off-by: Anup Patel --- arch

[PATCH v2 5/5] RISC-V: Fix memory reservation in setup_bootmem()

2019-03-21 Thread Anup Patel
Rapoport Signed-off-by: Anup Patel --- arch/riscv/mm/init.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 2e2f2567964c..99b42380d17d 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -18,6 +18,8

[PATCH v2 2/5] RISC-V: Make setup_vm() independent of GCC code model

2019-03-21 Thread Anup Patel
addressing. Fixes: 6f1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") Signed-off-by: Anup Patel --- arch/riscv/kernel/head.S | 1 + arch/riscv/mm/init.c | 73 ++-- 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/arch/riscv/ker

[PATCH v2 0/5] Boot RISC-V kernel from any 4KB aligned address

2019-03-21 Thread Anup Patel
based on load address alignment - Added PATCH4 to remove redundant trampoline page table - Added PATCH5 to fix memory reservation in setup_bootmem() Anup Patel (5): RISC-V: Add separate defconfig for 32bit systems RISC-V: Make setup_vm() independent of GCC code model RISC-V: Allow booting

[PATCH v2 1/5] RISC-V: Add separate defconfig for 32bit systems

2019-03-21 Thread Anup Patel
This patch adds rv32_defconfig for 32bit systems. The only difference between rv32_defconfig and defconfig is that rv32_defconfig has CONFIG_ARCH_RV32I=y. Signed-off-by: Anup Patel --- arch/riscv/configs/rv32_defconfig | 84 +++ 1 file changed, 84 insertions

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-18 Thread Anup Patel
On Mon, Mar 18, 2019 at 12:48 PM Mike Rapoport wrote: > > On Sat, Mar 16, 2019 at 04:55:30AM +0530, Anup Patel wrote: > > On Fri, Mar 15, 2019 at 9:52 PM Anup Patel wrote: > > > > > > On Fri, Mar 15, 2019 at 9:28 PM Mike Rapoport wrote: > > > > > >

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-15 Thread Anup Patel
On Fri, Mar 15, 2019 at 9:52 PM Anup Patel wrote: > > On Fri, Mar 15, 2019 at 9:28 PM Mike Rapoport wrote: > > > > On Thu, Mar 14, 2019 at 11:28:32PM +0530, Anup Patel wrote: > > > On Thu, Mar 14, 2019 at 12:23 PM Mike Rapoport wrote: > > > > > >

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-15 Thread Anup Patel
On Fri, Mar 15, 2019 at 9:28 PM Mike Rapoport wrote: > > On Thu, Mar 14, 2019 at 11:28:32PM +0530, Anup Patel wrote: > > On Thu, Mar 14, 2019 at 12:23 PM Mike Rapoport wrote: > > > > > > On Thu, Mar 14, 2019 at 02:36:01AM +0530, Anup Patel wrote: > > >

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-15 Thread Anup Patel
On Fri, Mar 15, 2019 at 9:28 PM Mike Rapoport wrote: > > On Thu, Mar 14, 2019 at 11:28:32PM +0530, Anup Patel wrote: > > On Thu, Mar 14, 2019 at 12:23 PM Mike Rapoport wrote: > > > > > > On Thu, Mar 14, 2019 at 02:36:01AM +0530, Anup Patel wrote: > > >

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-14 Thread Anup Patel
On Thu, Mar 14, 2019 at 12:23 PM Mike Rapoport wrote: > > On Thu, Mar 14, 2019 at 02:36:01AM +0530, Anup Patel wrote: > > On Thu, Mar 14, 2019 at 12:01 AM Mike Rapoport wrote: > > > > > > On Tue, Mar 12, 2019 at 10:08:22PM +, Anup Patel wrote: > > &g

Re: [PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-13 Thread Anup Patel
On Thu, Mar 14, 2019 at 12:01 AM Mike Rapoport wrote: > > On Tue, Mar 12, 2019 at 10:08:22PM +, Anup Patel wrote: > > Currently, we have to boot RISCV64 kernel from a 2MB aligned physical > > address and RISCV32 kernel from a 4MB aligned physical address. This > &g

[PATCH 3/3] RISC-V: Allow booting kernel from any 4KB aligned address

2019-03-12 Thread Anup Patel
in-place, the booting constraint for RISCV32 and RISCV64 kernel is much more relaxed and we can now boot kernel very close to RAM start thereby minimizng memory wastage. Signed-off-by: Anup Patel --- arch/riscv/include/asm/fixmap.h | 5 + arch/riscv/include/asm/pgtable-64.h | 5 + arch/riscv

[PATCH 1/3] RISC-V: Add separate defconfig for 32bit systems

2019-03-12 Thread Anup Patel
This patch adds rv32_defconfig for 32bit systems. The only difference between rv32_defconfig and defconfig is that rv32_defconfig has CONFIG_ARCH_RV32I=y. Signed-off-by: Anup Patel --- arch/riscv/configs/rv32_defconfig | 84 +++ 1 file changed, 84 insertions

[PATCH 2/3] RISC-V: Make setup_vm() independent of GCC code model

2019-03-12 Thread Anup Patel
addressing. Fixes: 6f1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") Signed-off-by: Anup Patel --- arch/riscv/kernel/head.S | 1 + arch/riscv/mm/init.c | 71 ++-- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/arch/riscv/ker

[PATCH 0/3] Boot RISC-V kernel from any 4KB aligned address

2019-03-12 Thread Anup Patel
From: Anup Patel This patchset primarily extends initial page table setup using fixmap to boot Linux RISC-V kernel (64bit and 32bit) from any 4KB aligned address. We also add 32bit defconfig to allow people to try 32bit Linux RISC-V kernel as well. The patchset is tested on SiFive Unleashed

Re: [v6 PATCH 6/6] RISC-V: Assign hwcap as per comman capabilities.

2019-02-24 Thread Anup Patel
uot; hart, in case they > don't > +* have. > + */ > + if (elf_hwcap) > + elf_hwcap &= this_hwcap; > + else > + elf_hwcap = this_hwcap; > + } > > /* We don't support systems with F but without D, so mask those out > * here. */ > -- > 2.7.4 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup

Re: [PATCH v2 0/6] Fixmap support and MM cleanups

2019-02-14 Thread Anup Patel
On Thu, Feb 14, 2019 at 6:07 AM Palmer Dabbelt wrote: > > On Wed, 13 Feb 2019 00:21:43 PST (-0800), a...@brainfault.org wrote: > > On Wed, Feb 13, 2019 at 4:45 AM Palmer Dabbelt wrote: > >> > >> On Sat, 19 Jan 2019 05:27:53 PST (-0800), Anup Patel wrote: >

[PATCH v6 0/5] Fixmap support and MM cleanups

2019-02-13 Thread Anup Patel
v1: - Use more characters per line in changelog of PATCH3 - Removed #ifndef __ASSEMBLY__ from PATCH5 - Use more characters per line in commets of PATCH5 - Added PATCH6 to implement keepinitrd kernel parameter Anup Patel (5): RISC-V: Setup init_mm before parse_early_param() RISC-V: Move set

[PATCH v6 1/5] RISC-V: Setup init_mm before parse_early_param()

2019-02-13 Thread Anup Patel
We should setup init_mm before doing parse_early_param() in setup_arch() to be consistent with setup_arch() of other architectures such as x86, ARM, and ARM64. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt --- arch/riscv/kernel/setup.c | 9 - 1

[PATCH v6 5/5] RISC-V: Free-up initrd in free_initrd_mem()

2019-02-13 Thread Anup Patel
We should free-up initrd memory in free_initrd_mem() instead of doing nothing. Signed-off-by: Anup Patel --- arch/riscv/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index b1167a6f5a92..aabf1869c54b 100644 --- a/arch

[PATCH v6 2/5] RISC-V: Move setup_bootmem() to mm/init.c

2019-02-13 Thread Anup Patel
The setup_bootmem() mainly populates memblocks and does early memory reservations. The right location for this function is mm/init.c. It calls setup_initrd() so we move that as well. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt --- arch/riscv/include

[PATCH v6 3/5] RISC-V: Move setup_vm() to mm/init.c

2019-02-13 Thread Anup Patel
The setup_vm() is responsible for setting up initial page table hence should be placed in mm/init.c. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt --- arch/riscv/kernel/setup.c | 49 --- arch/riscv/mm/init.c | 49

[PATCH v6 4/5] RISC-V: Implement compile-time fixed mappings

2019-02-13 Thread Anup Patel
This patch implements compile-time virtual to physical mappings. These compile-time fixed mappings can be used by earlycon, ACPI, and early ioremap for creating fixed mappings when FIX_EARLYCON_MEM=y. To start with, we have enabled compile-time fixed mappings for earlycon. Signed-off-by: Anup

RE: [PATCH v5 1/6] RISC-V: Move free_initrd_mem() to kernel/setup.c

2019-02-13 Thread Anup Patel
> -Original Message- > From: Mike Rapoport [mailto:r...@linux.ibm.com] > Sent: Wednesday, February 13, 2019 3:30 PM > To: Anup Patel > Cc: Palmer Dabbelt ; Albert Ou > ; Atish Patra ; Paul > Walmsley ; Christoph Hellwig > ; linux-ri...@lists.inf

Re: [PATCH v2 0/6] Fixmap support and MM cleanups

2019-02-13 Thread Anup Patel
On Wed, Feb 13, 2019 at 4:45 AM Palmer Dabbelt wrote: > > On Sat, 19 Jan 2019 05:27:53 PST (-0800), Anup Patel wrote: > > This patchset does: > > 1. Moves MM related code from kernel/setup.c to mm/init.c > > 2. Implements compile-time fixed mappings > > > > Us

[PATCH v5 5/6] RISC-V: Implement compile-time fixed mappings

2019-02-13 Thread Anup Patel
This patch implements compile-time virtual to physical mappings. These compile-time fixed mappings can be used by earlycon, ACPI, and early ioremap for creating fixed mappings when FIX_EARLYCON_MEM=y. To start with, we have enabled compile-time fixed mappings for earlycon. Signed-off-by: Anup

[PATCH v5 4/6] RISC-V: Move setup_vm() to mm/init.c

2019-02-13 Thread Anup Patel
The setup_vm() is responsible for setting up initial page table hence should be placed in mm/init.c. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt --- arch/riscv/kernel/setup.c | 49 --- arch/riscv/mm/init.c | 49

[PATCH v5 2/6] RISC-V: Setup init_mm before parse_early_param()

2019-02-13 Thread Anup Patel
We should setup init_mm before doing parse_early_param() in setup_arch() to be consistent with setup_arch() of other architectures such as x86, ARM, and ARM64. Signed-off-by: Anup Patel Reviewed-by: Christoph Hellwig Reviewed-by: Palmer Dabbelt --- arch/riscv/kernel/setup.c | 9 - 1

<    4   5   6   7   8   9   10   11   12   13   >