Re: how to prevent automatic dtb load?

2022-08-04 Thread Peter Maydell
On Thu, 4 Aug 2022 at 13:51, Chan Kim  wrote:
> Yes, you are right. I tried again with that -dtb option like this.
>
> qemu-system-aarch64  -machine 
> ab21q,gic-version=max,secure=on,virtualization=true -cpu max -kernel 
> u-boot-spl -m 8M -nographic -device loader,file=Image,addr=0x8020 -dtb 
> ab21m.dtb -chardev stdio,mux=on,id=char0 -serial chardev:char0 -serial 
> chardev:char0
>
> And it proceeded with the linux booting. Thanks!
> (I thought I tried this before and had the same error, but it works ok now. 
> Maybe I have done something wrong then.)
> So I gather qemu loads the file I provide with -dtb option at the first 
> address of the memory(0x8000 in my case) and doesn't load the dtb it 
> generated instead. My virtual machine is a modified version of arm/virt).

Yes, if you specify a -dtb command line option that overrides
the autogenerated file. But generally you shouldn't do that.
You should decide whether your new machine:
 * expects the user to provide a DTB, like almost all of
   the other boards QEMU has. This is the normal case,
   for when QEMU is modelling a specific fixed piece of
   hardware. The idea is the user passes QEMU the same
   dtb file that they would do to boot the kernel on
   real hardware.
 * expects to autogenerate the DTB matching whatever it does,
   like the virt board. This is the unusual case -- virt
   only does this because it is a purely "virtual" board
   that doesn't match any real physical hardware and
   which changes depending on what the user asked for.

and then use it that way.

More generally, if you're writing a new machine type,
then 'virt' is a very bad choice for basing it on,
because 'virt' is not a "normal" machine type, and does
lots of things in ways that you wouldn't want to do
for a straightforward "model of real bit of hardware".

thanks
-- PMM



RE: how to prevent automatic dtb load?

2022-08-04 Thread Chan Kim
Hi, Alex Bennée

Yes, you are right. I tried again with that -dtb option like this.

qemu-system-aarch64  -machine 
ab21q,gic-version=max,secure=on,virtualization=true -cpu max -kernel u-boot-spl 
-m 8M -nographic -device loader,file=Image,addr=0x8020 -dtb ab21m.dtb 
-chardev stdio,mux=on,id=char0 -serial chardev:char0 -serial chardev:char0

And it proceeded with the linux booting. Thanks!
(I thought I tried this before and had the same error, but it works ok now. 
Maybe I have done something wrong then.)
So I gather qemu loads the file I provide with -dtb option at the first address 
of the memory(0x8000 in my case) and doesn't load the dtb it generated 
instead. My virtual machine is a modified version of arm/virt).

Chan Kim

>-Original Message-
>From: Alex Bennée 
>Sent: Thursday, August 4, 2022 7:04 PM
>To: Chan Kim 
>Cc: qemu-discuss@nongnu.org
>Subject: Re: how to prevent automatic dtb load?
>
>
>"Chan Kim"  writes:
>
>> Hello experts,
>>
>> While emulating u-boot program which loads linux, I found even if I
>> load my dtb file at 0x8000 using -device loader,file=xxx,addr=yyy
>> the qemu program loads the dtb it generated at 0x8000. And it gives
>me this error.
>
>What is your full command line? QEMU only generates DTBs for some dynamic
>models, otherwise you should be providing one via the -dtb option.
>
>>
>> The following two regions overlap (in the cpu-memory-0 address space):
>>
>>   arch/arm64/boot/dts/arm/ab21m.dtb (addresses 0x8000 -
>> 0x8994)
>>
>>   dtb (addresses 0x8000 - 0x8010)
>>
>> make: *** [Makefile.qemu:22: run_uboot] Error 1
>>
>> I tried setting skip_dtb_autoload to true in my machine to no avail.
>>
>> How can I avoid automatic dtb load?
>>
>> Thanks in advance.
>>
>> Chan Kim
>
>
>--
>Alex Bennée







Re: how to prevent automatic dtb load?

2022-08-04 Thread Alex Bennée


"Chan Kim"  writes:

> Hello experts,
>
> While emulating u-boot program which loads linux, I found even if I load my 
> dtb file at 0x8000 using -device
> loader,file=xxx,addr=yyy the qemu program loads the dtb it generated
> at 0x8000. And it gives me this error.

What is your full command line? QEMU only generates DTBs for some
dynamic models, otherwise you should be providing one via the -dtb
option.

>
> The following two regions overlap (in the cpu-memory-0 address space):
>
>   arch/arm64/boot/dts/arm/ab21m.dtb (addresses 0x8000 - 
> 0x8994)
>
>   dtb (addresses 0x8000 - 0x8010)
>
> make: *** [Makefile.qemu:22: run_uboot] Error 1
>
> I tried setting skip_dtb_autoload to true in my machine to no avail.
>
> How can I avoid automatic dtb load?
>
> Thanks in advance.
>
> Chan Kim


-- 
Alex Bennée



how to prevent automatic dtb load?

2022-08-04 Thread Chan Kim
Hello experts,

While emulating u-boot program which loads linux, I found even if I load my
dtb file at 0x8000 using -device loader,file=xxx,addr=yyy the qemu
program loads the dtb it generated at 0x8000. And it gives me this
error.

The following two regions overlap (in the cpu-memory-0 address space):

  arch/arm64/boot/dts/arm/ab21m.dtb (addresses 0x8000 -
0x8994)

  dtb (addresses 0x8000 - 0x8010)

make: *** [Makefile.qemu:22: run_uboot] Error 1

I tried setting skip_dtb_autoload to true in my machine to no avail.

How can I avoid automatic dtb load?

Thanks in advance.

Chan Kim