From: Oleksii <oleksii.kurochko@gmail.com>
To: Julien Grall <julien@xen.org>, xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Gianluca Guida <gianluca@rivosinc.com>,
Bob Eshleman <bobbyeshleman@gmail.com>,
Alistair Francis <alistair.francis@wdc.com>,
Connor Davis <connojdavis@gmail.com>
Subject: Re: [PATCH v1 2/3] xen/riscv: setup initial pagetables
Date: Mon, 27 Feb 2023 19:17:01 +0200 [thread overview]
Message-ID: <e2a1968767e7a0f1535920ada14ec2f323e0f9c5.camel@gmail.com> (raw)
In-Reply-To: <52072f1b-0cf8-a218-eefc-a8c1b4cecf43@xen.org>
On Sat, 2023-02-25 at 18:05 +0000, Julien Grall wrote:
> Hi,
>
> On 24/02/2023 15:06, Oleksii Kurochko wrote:
> > Calculate load and linker linker image addresses and
> > setup initial pagetables.
> >
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > ---
> > xen/arch/riscv/setup.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
> > index b7cd438a1d..f69bc278bb 100644
> > --- a/xen/arch/riscv/setup.c
> > +++ b/xen/arch/riscv/setup.c
> > @@ -1,9 +1,11 @@
> > #include <xen/bug.h>
> > #include <xen/compile.h>
> > #include <xen/init.h>
> > +#include <xen/kernel.h>
> >
> > #include <asm/csr.h>
> > #include <asm/early_printk.h>
> > +#include <asm/mm.h>
> > #include <asm/traps.h>
> >
> > /* Xen stack for bringing up the first CPU. */
> > @@ -43,6 +45,11 @@ static void __init disable_fpu(void)
> >
> > void __init noreturn start_xen(void)
> > {
> > + unsigned long load_start = (unsigned long)start;
> > + unsigned long load_end = load_start + (unsigned
> > long)(_end - _start);
>
> I am a bit puzzled, on top of load_addr() and linker_addr(), you
> wrote
> it can't use global variable/function. But here... you are using
> them.
> So how is this different?
I don't use load_addr() and linker_addr() macros here.
>
> > + unsigned long linker_start = (unsigned long)_start;
> > + unsigned long linker_end = (unsigned long)_end;
>
> I am a bit confused with how you define the start/end for both the
> linker and load. In one you use _start and the other _end.
>
> Both are fixed at compile time, so I assume the values will be a
> linked
> address rather than the load address. So how is this meant to how?
>
_start, _end - it is label from linker script so I use them to define
linker_start and linker_end addresses.
load_start is defined as an address of start() function from head.S and
load_end is the load_start + the size (_end - _start)
> Furthermore, I would expect linker_start and load_start to point to
> the
> same symbol (the only different is one store the virtual address
> whereas
> the other the physical address). But here you are technically using
> two
> different symbol. Can you explain why?
It is used to make identity mapping for the range [load_addr, load_end]
and [linker_addr, linker_end]. It was done so because in Bobby's
patches in the linker script XEN_VIRT_START is defined as
_AT(vaddr_t,0x00200000) but bootloader loads Xen at 0x80200000 and so
in this case loadr_addr != linker_addr.
But I have changed XEN_VIRT_START to 0x8020...00 so they are equal now.
>
> > +
> > /*
> > * The following things are passed by bootloader:
> > * a0 -> hart_id
> > @@ -65,6 +72,10 @@ void __init noreturn start_xen(void)
> >
> > test_macros_from_bug_h();
> >
> > + setup_initial_pagetables(load_start, load_end, linker_start,
> > linker_end);
>
> Shouldn't this happen earlier in start_xen()?
It can. If to be honest I don't know if it should. I added at the end
only because it was the last thing I worked on...
>
> Cheers,
>
~ Oleksii
next prev parent reply other threads:[~2023-02-27 17:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 15:06 [PATCH v1 0/3] enable MMU for RISC-V Oleksii Kurochko
2023-02-24 15:06 ` [PATCH v1 1/3] xen/riscv: introduce setup_initial_pages Oleksii Kurochko
2023-02-24 15:23 ` Andrew Cooper
2023-02-25 17:53 ` Julien Grall
2023-02-27 16:52 ` Oleksii
2023-02-27 17:36 ` Julien Grall
2023-03-05 16:25 ` Oleksii
2023-03-05 21:28 ` Oleksii
2023-03-21 16:25 ` Julien Grall
2023-03-22 9:14 ` Oleksii
2023-02-27 15:12 ` Jan Beulich
2023-02-27 15:19 ` Jan Beulich
2023-03-06 6:39 ` Oleksii
2023-03-06 6:38 ` Oleksii
2023-02-24 15:06 ` [PATCH v1 2/3] xen/riscv: setup initial pagetables Oleksii Kurochko
2023-02-25 18:05 ` Julien Grall
2023-02-27 15:17 ` Jan Beulich
2023-02-27 15:36 ` Julien Grall
2023-02-27 17:17 ` Oleksii [this message]
2023-02-27 17:45 ` Julien Grall
2023-03-08 14:54 ` Oleksii
2023-03-08 15:17 ` Jan Beulich
2023-03-08 16:16 ` Oleksii
2023-03-09 9:46 ` Jan Beulich
2023-03-09 14:39 ` Oleksii
2023-02-24 15:06 ` [PATCH v1 3/3] automation: update RISC-V smoke test Oleksii Kurochko
2023-02-24 15:27 ` Andrew Cooper
2023-02-24 16:45 ` Oleksii
2023-02-24 15:19 ` [PATCH v1 0/3] enable MMU for RISC-V Oleksii
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=e2a1968767e7a0f1535920ada14ec2f323e0f9c5.camel@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=gianluca@rivosinc.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.