Linux-EFI Archive mirror
 help / color / mirror / Atom feed
From: Huacai Chen <chenhuacai@kernel.org>
To: Ainux Wang <ainux.wang@gmail.com>
Cc: wangyao@lemote.com, ardb@kernel.org, wangrui@loongson.cn,
	 linux-efi@vger.kernel.org
Subject: Re: [PATCH v3 2/2] efi/loongarch: load address is not equal to link address
Date: Tue, 5 Dec 2023 19:48:25 +0800	[thread overview]
Message-ID: <CAAhV-H4WE61RNJFw5=Q242CGUqcFi3yamuLpBa5HSey9npy2tA@mail.gmail.com> (raw)
In-Reply-To: <CAPWE4_zv1hscnBN-sf0TBjc5-T58C_xuWqm1jrdUqx9mvPP5Gg@mail.gmail.com>

On Tue, Dec 5, 2023 at 4:19 PM Ainux Wang <ainux.wang@gmail.com> wrote:
>
> Huacai Chen <chenhuacai@kernel.org> 于2023年12月5日周二 15:41写道:
> >
> > On Tue, Dec 5, 2023 at 2:24 PM Ainux Wang <ainux.wang@gmail.com> wrote:
> > >
> > > Huacai Chen <chenhuacai@kernel.org> 于2023年12月5日周二 14:18写道:
> > > >
> > > > On Tue, Dec 5, 2023 at 2:16 PM Ainux Wang <ainux.wang@gmail.com> wrote:
> > > > >
> > > > > Huacai Chen <chenhuacai@kernel.org> 于2023年12月5日周二 14:09写道:
> > > > > >
> > > > > > Why send a test patch?
> > > > > >
> > > > >
> > > > > Confirm the accuracy of the testing method
> > > >
> > > > Don't use maillist to do this.
> > >
> > > Sorry, I don't know about this :-(
> > But from this patch, you only test the vmlinux.efi not loaded at link
> > address, but haven't tested the vmlinuz.efi not decompressed to the
> > link address. You should test that, but don't submit patches for that.
>
> vmlinuz.efi decompress at 0x300000  is ok.
Then you can resend the first patch as v4, add:
Acked-by: Huacai Chen <chenhuacai@loongson.cn>


Huacai

>
> >
> > >
> > > >
> > > > >
> > > > > > On Tue, Dec 5, 2023 at 2:04 PM <wangyao@lemote.com> wrote:
> > > > > > >
> > > > > > > From: Wang Yao <wangyao@lemote.com>
> > > > > > >
> > > > > > > This is a test patch for PIE kernel that load address is not equal to
> > > > > > > link address.
> > > > > > >
> > > > > > > Signed-off-by: Wang Yao <wangyao@lemote.com>
> > > > > > > ---
> > > > > > >  drivers/firmware/efi/libstub/loongarch-stub.c | 12 +++++++++++-
> > > > > > >  1 file changed, 11 insertions(+), 1 deletion(-)
> > > > > > >
> > > > > > > diff --git a/drivers/firmware/efi/libstub/loongarch-stub.c b/drivers/firmware/efi/libstub/loongarch-stub.c
> > > > > > > index d6ec5d4b8dbe..c13c022d18cf 100644
> > > > > > > --- a/drivers/firmware/efi/libstub/loongarch-stub.c
> > > > > > > +++ b/drivers/firmware/efi/libstub/loongarch-stub.c
> > > > > > > @@ -22,12 +22,22 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
> > > > > > >                                  efi_handle_t image_handle)
> > > > > > >  {
> > > > > > >         efi_status_t status;
> > > > > > > -       unsigned long kernel_addr = 0;
> > > > > > > +       unsigned long kernel_addr = 0, tmp_addr = 0;
> > > > > > >
> > > > > > >         kernel_addr = (unsigned long)&kernel_offset - kernel_offset;
> > > > > > >
> > > > > > > +       /*
> > > > > > > +        * Allocate 2M space at 0x200000(EFI_KIMG_PREFERRED_ADDRESS) for
> > > > > > > +        * test, this will lead to the kernel be loaded at 0x4000000.
> > > > > > > +        */
> > > > > > > +       status = efi_relocate_kernel(&tmp_addr, 0x100000, 0x200000,
> > > > > > > +                    EFI_KIMG_PREFERRED_ADDRESS, efi_get_kimg_min_align(), 0x0);
> > > > > > > +       efi_info("@@@[%s] tmp_addr: 0x%lx\n", __func__, tmp_addr);
> > > > > > > +
> > > > > > > +       /* kernel_addr == 0x400000 */
> > > > > > >         status = efi_relocate_kernel(&kernel_addr, kernel_fsize, kernel_asize,
> > > > > > >                      EFI_KIMG_PREFERRED_ADDRESS, efi_get_kimg_min_align(), 0x0);
> > > > > > > +       efi_info("@@@[%s] kernel_addr: 0x%lx\n", __func__, kernel_addr);
> > > > > > >
> > > > > > >         *image_addr = kernel_addr;
> > > > > > >         *image_size = kernel_asize;
> > > > > > > --
> > > > > > > 2.27.0
> > > > > > >

      reply	other threads:[~2023-12-05 11:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05  6:03 [PATCH v3 0/2] Use load address to calculate kernel entry wangyao
2023-12-05  6:03 ` [PATCH v3 1/2] efi/loongarch: Use load address to calculate kernel entry address wangyao
2023-12-05  6:03 ` [PATCH v3 2/2] efi/loongarch: load address is not equal to link address wangyao
2023-12-05  6:09   ` Huacai Chen
2023-12-05  6:15     ` Ainux Wang
2023-12-05  6:18       ` Huacai Chen
2023-12-05  6:23         ` Ainux Wang
2023-12-05  7:41           ` Huacai Chen
2023-12-05  8:19             ` Ainux Wang
2023-12-05 11:48               ` Huacai Chen [this message]

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='CAAhV-H4WE61RNJFw5=Q242CGUqcFi3yamuLpBa5HSey9npy2tA@mail.gmail.com' \
    --to=chenhuacai@kernel.org \
    --cc=ainux.wang@gmail.com \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=wangrui@loongson.cn \
    --cc=wangyao@lemote.com \
    /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 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 read-only IMAP folder(s) and NNTP newsgroup(s).