All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Wool <vitaly.wool@konsulko.com>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -fixes 3/3] riscv: Optimize kernel virtual address conversion macro
Date: Sun, 8 Aug 2021 14:27:25 +0200	[thread overview]
Message-ID: <CAM4kBBKEU4zKkRJKe27Y0uvt7SN=K6HsyNMdPu7Y+WWyh7QRHg@mail.gmail.com> (raw)
In-Reply-To: <20210721075937.696811-4-alex@ghiti.fr>

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

WARNING: multiple messages have this Message-ID
From: Vitaly Wool <vitaly.wool@konsulko.com>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -fixes 3/3] riscv: Optimize kernel virtual address conversion macro
Date: Sun, 8 Aug 2021 14:27:25 +0200	[thread overview]
Message-ID: <CAM4kBBKEU4zKkRJKe27Y0uvt7SN=K6HsyNMdPu7Y+WWyh7QRHg@mail.gmail.com> (raw)
In-Reply-To: <20210721075937.696811-4-alex@ghiti.fr>

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

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

  parent reply	other threads:[~2021-08-08 12:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  7:59 [PATCH -fixes 0/3] Fixes regarding CONFIG_PHYS_RAM_BASE Alexandre Ghiti
2021-07-21  7:59 ` Alexandre Ghiti
2021-07-21  7:59 ` [PATCH -fixes 1/3] riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion Alexandre Ghiti
2021-07-21  7:59   ` Alexandre Ghiti
2021-07-21  7:59 ` [PATCH -fixes 2/3] Revert "riscv: Remove CONFIG_PHYS_RAM_BASE_FIXED" Alexandre Ghiti
2021-07-21  7:59   ` Alexandre Ghiti
2021-07-21  7:59 ` [PATCH -fixes 3/3] riscv: Optimize kernel virtual address conversion macro Alexandre Ghiti
2021-07-21  7:59   ` Alexandre Ghiti
2021-08-07 16:36   ` Palmer Dabbelt
2021-08-07 16:36     ` Palmer Dabbelt
2021-08-07 19:31     ` Alex Ghiti
2021-08-07 19:31       ` Alex Ghiti
2021-08-12  5:23       ` Palmer Dabbelt
2021-08-12  5:23         ` Palmer Dabbelt
2021-08-08 12:27   ` Vitaly Wool [this message]
2021-08-08 12:27     ` Vitaly Wool
2021-07-21 14:12 ` [PATCH -fixes 0/3] Fixes regarding CONFIG_PHYS_RAM_BASE Emil Renner Berthing
2021-07-21 14:12   ` Emil Renner Berthing
2021-07-22 15:29 ` Jisheng Zhang
2021-07-22 15:29   ` Jisheng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM4kBBKEU4zKkRJKe27Y0uvt7SN=K6HsyNMdPu7Y+WWyh7QRHg@mail.gmail.com' \
    --to=vitaly.wool@konsulko.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --subject='Re: [PATCH -fixes 3/3] riscv: Optimize kernel virtual address conversion macro' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.