Message ID | 20210721075937.696811-4-alex@ghiti.fr (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixes regarding CONFIG_PHYS_RAM_BASE | expand |
On Wed, 21 Jul 2021 00:59:37 PDT (-0700), alex@ghiti.fr wrote: > The current test in kernel_mapping_va_to_pa only applies when > CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at > compile-time in standard kernels that do not require this test. > > Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> > --- > arch/riscv/include/asm/page.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h > index b0ca5058e7ae..10dc063868f6 100644 > --- a/arch/riscv/include/asm/page.h > +++ b/arch/riscv/include/asm/page.h > @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; > #define linear_mapping_va_to_pa(x) ((unsigned long)(x) - kernel_map.va_pa_offset) > #define kernel_mapping_va_to_pa(y) ({ \ > unsigned long _y = y; \ > - (_y < kernel_map.virt_addr + XIP_OFFSET) ? \ > + (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + XIP_OFFSET) ? \ > ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) : \ > ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - XIP_OFFSET); \ > }) IIUC this isn't actually a fix? The other two are, though, so they're on fixes. Thanks!
Le 7/08/2021 à 18:36, Palmer Dabbelt a écrit : > On Wed, 21 Jul 2021 00:59:37 PDT (-0700), alex@ghiti.fr wrote: >> The current test in kernel_mapping_va_to_pa only applies when >> CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at >> compile-time in standard kernels that do not require this test. >> >> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> >> --- >> arch/riscv/include/asm/page.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/riscv/include/asm/page.h >> b/arch/riscv/include/asm/page.h >> index b0ca5058e7ae..10dc063868f6 100644 >> --- a/arch/riscv/include/asm/page.h >> +++ b/arch/riscv/include/asm/page.h >> @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; >> #define linear_mapping_va_to_pa(x) ((unsigned long)(x) - >> kernel_map.va_pa_offset) >> #define kernel_mapping_va_to_pa(y) ({ \ >> unsigned long _y = y; \ >> - (_y < kernel_map.virt_addr + XIP_OFFSET) ? \ >> + (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + >> XIP_OFFSET) ? \ >> ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) >> : \ >> ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - >> XIP_OFFSET); \ >> }) > > IIUC this isn't actually a fix? The other two are, though, so they're > on fixes. Indeed this is not a fix, this is symmetrical to what I have done in patch 1 so that seemed natural to land in the same patchset. Let me know if you want me to resend it on its own. Thanks, Alex > > Thanks! > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Wed, Jul 21, 2021 at 10:04 AM Alexandre Ghiti <alex@ghiti.fr> wrote: > > The current test in kernel_mapping_va_to_pa only applies when > CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at > compile-time in standard kernels that do not require this test. > > Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> Just in case you need it, here comes Reviewed-By: Vitaly Wool <vitaly.wool@konsulko.com> > --- > arch/riscv/include/asm/page.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h > index b0ca5058e7ae..10dc063868f6 100644 > --- a/arch/riscv/include/asm/page.h > +++ b/arch/riscv/include/asm/page.h > @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; > #define linear_mapping_va_to_pa(x) ((unsigned long)(x) - kernel_map.va_pa_offset) > #define kernel_mapping_va_to_pa(y) ({ \ > unsigned long _y = y; \ > - (_y < kernel_map.virt_addr + XIP_OFFSET) ? \ > + (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + XIP_OFFSET) ? \ > ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) : \ > ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - XIP_OFFSET); \ > }) > -- > 2.30.2 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Sat, 07 Aug 2021 12:31:24 PDT (-0700), alex@ghiti.fr wrote: > Le 7/08/2021 à 18:36, Palmer Dabbelt a écrit : >> On Wed, 21 Jul 2021 00:59:37 PDT (-0700), alex@ghiti.fr wrote: >>> The current test in kernel_mapping_va_to_pa only applies when >>> CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at >>> compile-time in standard kernels that do not require this test. >>> >>> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> >>> --- >>> arch/riscv/include/asm/page.h | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/arch/riscv/include/asm/page.h >>> b/arch/riscv/include/asm/page.h >>> index b0ca5058e7ae..10dc063868f6 100644 >>> --- a/arch/riscv/include/asm/page.h >>> +++ b/arch/riscv/include/asm/page.h >>> @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; >>> #define linear_mapping_va_to_pa(x) ((unsigned long)(x) - >>> kernel_map.va_pa_offset) >>> #define kernel_mapping_va_to_pa(y) ({ \ >>> unsigned long _y = y; \ >>> - (_y < kernel_map.virt_addr + XIP_OFFSET) ? \ >>> + (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + >>> XIP_OFFSET) ? \ >>> ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) >>> : \ >>> ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - >>> XIP_OFFSET); \ >>> }) >> >> IIUC this isn't actually a fix? The other two are, though, so they're >> on fixes. > > Indeed this is not a fix, this is symmetrical to what I have done in > patch 1 so that seemed natural to land in the same patchset. Let me know > if you want me to resend it on its own. That's fine, it was just explicitly called out as a fix in the subject line so I wanted to make sure I wasn't missing something. This is on for-next. Thanks!
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index b0ca5058e7ae..10dc063868f6 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; #define linear_mapping_va_to_pa(x) ((unsigned long)(x) - kernel_map.va_pa_offset) #define kernel_mapping_va_to_pa(y) ({ \ unsigned long _y = y; \ - (_y < kernel_map.virt_addr + XIP_OFFSET) ? \ + (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + XIP_OFFSET) ? \ ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) : \ ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - XIP_OFFSET); \ })
The current test in kernel_mapping_va_to_pa only applies when CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at compile-time in standard kernels that do not require this test. Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> --- arch/riscv/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)