linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Luke Kenneth Casson Leighton <lkcl@lkcl.net>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: openpower-hdl-cores
	<openpower-hdl-cores@mailinglist.openpowerfoundation.org>,
	Libre-Soc General Development <libre-soc-dev@lists.libre-soc.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: microwatt booting linux-5.7 under verilator
Date: Tue, 1 Feb 2022 09:52:53 +0000	[thread overview]
Message-ID: <CAPweEDzwFK6zRxu5dXMDd_bqX=WTRQ97s9GHjJPW5Uu=Hc0qLQ@mail.gmail.com> (raw)
In-Reply-To: <1643696448.f3llnvzeyb.astroid@bobo.none>

On Tue, Feb 1, 2022 at 6:27 AM Nicholas Piggin <npiggin@gmail.com> wrote:

> Not sure of the details on that. Is it memcpy()ing out of ROM or RAM to
> RAM? Is this in the arch boot code? (I don't know very well).

RAM to RAM.  arch/powerpc/boot/main.c:

    if (uncompressed_image) {
        memcpy(addr, vmlinuz_addr + ei.elfoffset, ei.loadsize);
        printf("0x%lx bytes of uncompressed data copied\n\r",
               ei.loadsize);
        goto out;
    }

in some systems those would be two different types of RAM,
(one would be on-board SRAM, the target would be DRAM
which had previously been initialised by the previous chain-boot
loader e.g. u-boot)

[in other circumstances, the source location might be addressable
SPI NOR flash, which would be slower, expensive, and therefore
compression is plain common sense, in which case it's out of
scope for this discussion.]

in the case of the simulation - and also in the case of the
WinCE Smartphone hand-held reverse-engineering using
GNUHARET.EXE (similar to LOADLIN.EXE if anyone remembers
that) - the uncompressed initramfs are both in the same
RAM, so the memcpy is completely redundant.

the only good reason for the memcpy would be to ensure
that the start location is at a known-fixed offset, and of course
that can be arranged in advance by the simulator.  even if
it has to be at 0x0000_0000_0000_0000 that can be arranged
by moving the cold-boot loader to an alternative hard-reset
start address and telling the simulated-core to start from there.

> >
> > other areas are the memset before VM is set up, followed by memset *again* on.individual pages once created.  those are an hour each
>
> Seems like we could should avoid the duplication and maybe be able to
> add an option to skip zeroing (I thought there was one, maybe thinking
> of something else).

it makes sense for security reasons (on real hardware) - a simulation
not so much, it's guaranteed to be all-zeros at startup.

> Are you using optimize for size? That can result in much slower code in
> some places. In skiboot we compile some of the string.h library code
> with -O2 for example.

interesting - no, this is default options.  have to be careful not to
introduce any VSX instructions (the core doesn't have them).

   CROSS_COMPILE="ccache powerpc64le-linux-gnu-" \
   ARCH=powerpc \
   make -j16 O=microwatt

l.

  reply	other threads:[~2022-02-01 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  0:45 microwatt booting linux-5.7 under verilator Luke Kenneth Casson Leighton
2022-01-31  3:31 ` Nicholas Piggin
2022-01-31  4:19   ` lkcl
2022-01-31  5:12     ` [OpenPOWER-HDL-Cores] " Herrenschmidt, Benjamin
2022-02-01  6:27     ` Nicholas Piggin
2022-02-01  9:52       ` Luke Kenneth Casson Leighton [this message]
2022-02-01 11:53       ` Michael Ellerman
2022-02-01 11:59         ` Luke Kenneth Casson Leighton
2022-03-12  7:45 ` Christophe Leroy

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='CAPweEDzwFK6zRxu5dXMDd_bqX=WTRQ97s9GHjJPW5Uu=Hc0qLQ@mail.gmail.com' \
    --to=lkcl@lkcl.net \
    --cc=libre-soc-dev@lists.libre-soc.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=openpower-hdl-cores@mailinglist.openpowerfoundation.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 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).