Re: How to run different firmware in a machine with 2 cpu?

2023-04-07 Thread Huang Canming
Sorry for the wrong cmd. It'a typo after I edit the sample command.
my command is: ./qemu-system-arm -M mymachine -smp cpus=2 -kernel test1.elf
-bios test2.elf -serial stdio -serial tcp::5678,server=on,wait=off
which use 'kernel' and "bios" to load different firmwares to the 2 cpus.

You should only call armv7m_load_kernel() once, even if there
> is more than one CPU in the system.

So I need to use  generic loader to load file into cpu and then do cpu
reset by myself(which was done in armv7m_load_kernel).
Thank you. I will try it.

I have a few further question:
in such cases, do I need a second sysbus? or can the 2 cpus use the same
sysbus?
and why the armv7m_load_kernel can only be called once?

Thank you for your time.

Peter Maydell  于2023年4月7日周五 23:22写道:

> On Fri, 7 Apr 2023 at 11:41, Huang Canming  wrote:
> >
> > hi, members.
> >
> > I'm trying to model a custom machine which has 2 cpus. Each cpu has its
> own ram/rom.
> >
> > for now, I have create a different MemoryRegion for the 2 cpu.
> >
> > I want that the 2 cpu could run differnt firmware, so I use
> >
> > armv7m_load_kernel(ARM_CPU(cpu1),machine->firmware,0,0x1)
> > armv7m_load_kernel(ARM_CPU(cpu2),machine->kernel_filename,0,0x1)
>
> You should only call armv7m_load_kernel() once, even if there
> is more than one CPU in the system.
>
> If you want to do something more complex than "just load
> one file", then look at the "generic loader", which will
> allow you to specifically say "load this ELF file into
> the address space as seen by this particular CPU".
> https://www.qemu.org/docs/master/system/generic-loader.html
>
> > ./qemu-system-arm -M mymachine -smp cpus=2 -kernel test1.elf -test2.elf
> -serial stdio -serial tcp::5678,server=on,wait=off
>
> This command line doesn't make sense and I'm surprised it
> didn't generate an error, because "-test2.elf" isn't a valid option.
>
> thanks
> -- PMM
>


Re: How to run different firmware in a machine with 2 cpu?

2023-04-07 Thread Peter Maydell
On Fri, 7 Apr 2023 at 11:41, Huang Canming  wrote:
>
> hi, members.
>
> I'm trying to model a custom machine which has 2 cpus. Each cpu has its own 
> ram/rom.
>
> for now, I have create a different MemoryRegion for the 2 cpu.
>
> I want that the 2 cpu could run differnt firmware, so I use
>
> armv7m_load_kernel(ARM_CPU(cpu1),machine->firmware,0,0x1)
> armv7m_load_kernel(ARM_CPU(cpu2),machine->kernel_filename,0,0x1)

You should only call armv7m_load_kernel() once, even if there
is more than one CPU in the system.

If you want to do something more complex than "just load
one file", then look at the "generic loader", which will
allow you to specifically say "load this ELF file into
the address space as seen by this particular CPU".
https://www.qemu.org/docs/master/system/generic-loader.html

> ./qemu-system-arm -M mymachine -smp cpus=2 -kernel test1.elf -test2.elf 
> -serial stdio -serial tcp::5678,server=on,wait=off

This command line doesn't make sense and I'm surprised it
didn't generate an error, because "-test2.elf" isn't a valid option.

thanks
-- PMM



Re: How to run different firmware in a machine with 2 cpu?

2023-04-07 Thread Huang Canming
sorry for lack my start cmd:
./qemu-system-arm -M mymachine -smp cpus=2 -kernel test1.elf -test2.elf
-serial stdio -serial tcp::5678,server=on,wait=off

Huang Canming  于2023年4月7日周五 18:40写道:

> hi, members.
>
> I'm trying to model a custom machine which has 2 cpus. Each cpu has its
> own ram/rom.
>
> for now, I have create a different MemoryRegion for the 2 cpu.
>
> I want that the 2 cpu could run differnt firmware, so I use
>
> armv7m_load_kernel(ARM_CPU(cpu1),machine->firmware,0,0x1)
> armv7m_load_kernel(ARM_CPU(cpu2),machine->kernel_filename,0,0x1)
>
> but it seems could not work normally:
>
> qemu-system-arm: ../target/arm/cpu.h:2396: arm_is_secure_below_el3:
> Assertion failed.
>
> so I wonder is there something need to do to achieve this but I ignore? do
> I need a second sysbus for cpu2(default sysbus for cpu1)? I create the
> other sysbus for cpu2, but it didn't solve the problem.
>
> Thank you for your time to read my email, Looking forward to hearing from
> you.
>
>
>


How to run different firmware in a machine with 2 cpu?

2023-04-07 Thread Huang Canming
hi, members.

I'm trying to model a custom machine which has 2 cpus. Each cpu has its own
ram/rom.

for now, I have create a different MemoryRegion for the 2 cpu.

I want that the 2 cpu could run differnt firmware, so I use

armv7m_load_kernel(ARM_CPU(cpu1),machine->firmware,0,0x1)
armv7m_load_kernel(ARM_CPU(cpu2),machine->kernel_filename,0,0x1)

but it seems could not work normally:

qemu-system-arm: ../target/arm/cpu.h:2396: arm_is_secure_below_el3:
Assertion failed.

so I wonder is there something need to do to achieve this but I ignore? do
I need a second sysbus for cpu2(default sysbus for cpu1)? I create the
other sysbus for cpu2, but it didn't solve the problem.

Thank you for your time to read my email, Looking forward to hearing from
you.