Re: Emulating multi core processor (ARM cortex M7) on QEMU

2024-02-26 Thread Peter Maydell
On Mon, 26 Feb 2024 at 10:59, ankita suman  wrote:
> I am trying to emulate multi core processor (dual core for now) on QEMU. The 
> processor I am targeting is cortex m7. I tried by running multiple instances 
> of QEMU to emulate multi cores, and use shared memory for communication, but 
> since I am working on a bare metal environment, I don't have the options of 
> libraries for synchronization.
> Another approach I tried was using inter VM shared memory(ivshmem). But I am 
> facing the same problem. I am able to write and read from the ivshmem device 
> from two different QEMU instances, but it is not working for ARM.

None of this is the right way to go. Running multiple QEMU instances
is like having two separate Arm hardware boards connected to each
other somehow, not like having an actual multi-CPU board.

You need to either:
 (1) use one of QEMU's existing boards with multiple CPUs
 (unfortunately we have no dual-M7 board)
 (2) model some dual-M7 board in QEMU, by writing C code to do that.
 This will not be particularly simple, depending on what the
 board you're trying to model is.

If you're OK with a pair of Cortex-M33 rather than M7 specifically,
you can look at using the mps3-an521 or mps3-an524 board models.
I would suggest doing that: it will be by far the easiest thing.

thanks
-- PMM



Re: Emulating multi core processor (ARM cortex M7) on QEMU

2024-02-26 Thread Philippe Mathieu-Daudé

Hello,

On 26/2/24 11:58, ankita suman wrote:

Hello,

I am trying to emulate multi core processor (dual core for now) on QEMU. 
The processor I am targeting is cortex m7. I tried by running multiple 
instances of QEMU to emulate multi cores, and use shared memory for 
communication, but since I am working on a bare metal environment, I 
don't have the options of libraries for synchronization.


Have a look at the 'fby35' machine in hw/arm/fby35.c, it uses
a pair of Aspeed ast1030 and ast2600 ARM cores.

Another approach I tried was using inter VM shared memory(ivshmem). But 
I am facing the same problem. I am able to write and read from the 
ivshmem device from two different QEMU instances, but it is not working 
for ARM.


Cc'ing Gustavo who worked on something similar and posted ivshmem
patches:
https://lore.kernel.org/qemu-devel/2024022218.2261956-1-gustavo.rom...@linaro.org/

can someone please guide me on how to proceed and what is the best 
approach? If there are library support in QEMU for multi core emulation, 
kindly let me know, that would be helpful as well.


Regards,

Phil.




Emulating multi core processor (ARM cortex M7) on QEMU

2024-02-26 Thread ankita suman
Hello,

I am trying to emulate multi core processor (dual core for now) on QEMU.
The processor I am targeting is cortex m7. I tried by running multiple
instances of QEMU to emulate multi cores, and use shared memory for
communication, but since I am working on a bare metal environment, I don't
have the options of libraries for synchronization.
Another approach I tried was using inter VM shared memory(ivshmem). But I
am facing the same problem. I am able to write and read from the ivshmem
device from two different QEMU instances, but it is not working for ARM.

can someone please guide me on how to proceed and what is the best
approach? If there are library support in QEMU for multi core emulation,
kindly let me know, that would be helpful as well.

Thanks and regards,
Ankita Suman


Re: Accelerator in ARM-based macOS

2024-02-26 Thread Philippe Mathieu-Daudé

Hi Serdar,

On 26/2/24 11:33, Serdar Bahar wrote:

Hello,

I'm a newbie in QEMU and I'm using it on an Apple Silicon macOS 
(ARM-based). I use the default accelerator tcg to run a virtual machine 
with Ubuntu but it is quite slow. I tried commands like "-enable-kvm" or 
"-accel xyz"  but every one of them (except tcg) returned the message 
"invalid accelerator" (I guess none of them are compatible with an 
ARM-based macOS). Do you have any suggestions for me to have a faster 
experience in my virtual machine? Again, I'm very new to QEMU and I'm 
trying it because other options are either not compatible with my 
computer or are paid and I apologize if my question barely makes sense.


KVM is a Linux specific acceleration.

With macOS you want HVF (-accel hvf).

Note, you can only leverage hardware acceleration if your guest
architecture is the same as your host. So in your case you can
only use HVF with ARM guests.

Regards,

Phil.



Re: Accelerator in ARM-based macOS

2024-02-26 Thread Simon Becherer



Am 26.02.24 um 11:33 schrieb Serdar Bahar:

Hello,

I'm a newbie in QEMU and I'm using it on an Apple Silicon macOS (ARM-based). I use the default accelerator tcg to run a virtual machine with Ubuntu but it is quite slow. I tried commands like "-enable-kvm" or "-accel 
xyz"  but every one of them (except tcg) returned the message "invalid accelerator" (I guess none of them are compatible with an ARM-based macOS). Do you have any suggestions for me to have a faster experience in my 
virtual machine? Again, I'm very new to QEMU and I'm trying it because other options are either not compatible with my computer or are paid and I apologize if my question barely makes sense.


Thank you,
Serdar Bahar


if i understand you correct,
your host is arm based and your guest is
i86-64 based?
as far as i know, accelerating is only working
if host and guest has the same processor-family.
maybe i am wrong, i am only an user.
i do not know if ubuntu is available in a arm based
version, if yes, then i would use this version and try
to use the acceleration.


--
www.becherer.de




OpenPGP_signature
Description: OpenPGP digital signature


Accelerator in ARM-based macOS

2024-02-26 Thread Serdar Bahar
Hello,

I'm a newbie in QEMU and I'm using it on an Apple Silicon macOS
(ARM-based). I use the default accelerator tcg to run a virtual machine
with Ubuntu but it is quite slow. I tried commands like "-enable-kvm" or
"-accel xyz"  but every one of them (except tcg) returned the message
"invalid accelerator" (I guess none of them are compatible with an
ARM-based macOS). Do you have any suggestions for me to have a faster
experience in my virtual machine? Again, I'm very new to QEMU and I'm
trying it because other options are either not compatible with my computer
or are paid and I apologize if my question barely makes sense.

Thank you,
Serdar Bahar