* [PATCH v2] riscv: Set text_offset correctly for M-Mode
@ 2020-10-22 20:30 Sean Anderson
2020-10-22 23:55 ` Damien Le Moal
0 siblings, 1 reply; 3+ messages in thread
From: Sean Anderson @ 2020-10-22 20:30 UTC (permalink / raw)
To: linux-riscv
Cc: Damien Le Moal, Albert Ou, Anup Patel, Sean Anderson,
Atish Patra, Palmer Dabbelt, Paul Walmsley
M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this
should be calculated based on PAGE_OFFSET somehow? Even better would be to
deprecate text_offset and instead introduce something absolute.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---
Changes in v2:
- RISCV_S_MODE does not exist; use RISCV_M_MODE instead
arch/riscv/kernel/head.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 0a4e81b8dc79..5a0ae2eaf5e2 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -27,12 +27,17 @@ ENTRY(_start)
/* reserved */
.word 0
.balign 8
+#ifdef CONFIG_RISCV_M_MODE
+ /* Image load offset (0MB) from start of RAM for M-mode */
+ .dword 0
+#else
#if __riscv_xlen == 64
/* Image load offset(2MB) from start of RAM */
.dword 0x200000
#else
/* Image load offset(4MB) from start of RAM */
.dword 0x400000
#endif
+#endif
/* Effective size of kernel image */
.dword _end - _start
--
2.28.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] riscv: Set text_offset correctly for M-Mode
2020-10-22 20:30 [PATCH v2] riscv: Set text_offset correctly for M-Mode Sean Anderson
@ 2020-10-22 23:55 ` Damien Le Moal
2020-11-06 1:43 ` Palmer Dabbelt
0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2020-10-22 23:55 UTC (permalink / raw)
To: Sean Anderson, linux-riscv
Cc: Anup Patel, Albert Ou, Palmer Dabbelt, Atish Patra, Paul Walmsley
On 2020/10/23 5:30, Sean Anderson wrote:
> M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this
> should be calculated based on PAGE_OFFSET somehow? Even better would be to
> deprecate text_offset and instead introduce something absolute.
>
> Signed-off-by: Sean Anderson <seanga2@gmail.com>
> ---
>
> Changes in v2:
> - RISCV_S_MODE does not exist; use RISCV_M_MODE instead
>
> arch/riscv/kernel/head.S | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
> index 0a4e81b8dc79..5a0ae2eaf5e2 100644
> --- a/arch/riscv/kernel/head.S
> +++ b/arch/riscv/kernel/head.S
> @@ -27,12 +27,17 @@ ENTRY(_start)
> /* reserved */
> .word 0
> .balign 8
> +#ifdef CONFIG_RISCV_M_MODE
> + /* Image load offset (0MB) from start of RAM for M-mode */
> + .dword 0
> +#else
> #if __riscv_xlen == 64
> /* Image load offset(2MB) from start of RAM */
> .dword 0x200000
> #else
> /* Image load offset(4MB) from start of RAM */
> .dword 0x400000
> #endif
> +#endif
> /* Effective size of kernel image */
> .dword _end - _start
>
Looks good to me. Added this to my upcoming pile of patches for Kendryte and
tested. No problems.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
--
Damien Le Moal
Western Digital Research
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] riscv: Set text_offset correctly for M-Mode
2020-10-22 23:55 ` Damien Le Moal
@ 2020-11-06 1:43 ` Palmer Dabbelt
0 siblings, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2020-11-06 1:43 UTC (permalink / raw)
To: Damien Le Moal
Cc: aou, anup, seanga2, Atish Patra, Paul Walmsley, linux-riscv
On Thu, 22 Oct 2020 16:55:33 PDT (-0700), Damien Le Moal wrote:
>> On 2020/10/23 5:30, Sean Anderson wrote:
>> M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this
>> should be calculated based on PAGE_OFFSET somehow? Even better would be to
>> deprecate text_offset and instead introduce something absolute.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>> ---
>>
>> Changes in v2:
>> - RISCV_S_MODE does not exist; use RISCV_M_MODE instead
>>
>> arch/riscv/kernel/head.S | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
>> index 0a4e81b8dc79..5a0ae2eaf5e2 100644
>> --- a/arch/riscv/kernel/head.S
>> +++ b/arch/riscv/kernel/head.S
>> @@ -27,12 +27,17 @@ ENTRY(_start)
>> /* reserved */
>> .word 0
>> .balign 8
>> +#ifdef CONFIG_RISCV_M_MODE
>> + /* Image load offset (0MB) from start of RAM for M-mode */
>> + .dword 0
>> +#else
>> #if __riscv_xlen == 64
>> /* Image load offset(2MB) from start of RAM */
>> .dword 0x200000
>> #else
>> /* Image load offset(4MB) from start of RAM */
>> .dword 0x400000
>> #endif
>> +#endif
>> /* Effective size of kernel image */
>> .dword _end - _start
>>
>
> Looks good to me. Added this to my upcoming pile of patches for Kendryte and
> tested. No problems.
>
> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
> Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Thanks. This is on fixes.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-06 1:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22 20:30 [PATCH v2] riscv: Set text_offset correctly for M-Mode Sean Anderson
2020-10-22 23:55 ` Damien Le Moal
2020-11-06 1:43 ` Palmer Dabbelt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).