[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-discuss] Guidance requested creating a QEMU MMIO device
From: |
trasmussen |
Subject: |
Re: [Qemu-discuss] Guidance requested creating a QEMU MMIO device |
Date: |
Tue, 30 Apr 2019 16:09:01 +0200 |
I made some good progress and has been able to create the code for my
MMIO-device borrowing from MPS2, compile and link it.
When I start qemu with gdb to debug MPS2, I get to mps2_machine_init(),
then to mps2_scc_register_types(), but not to mps2_scc_init() nor to
mps2_common_init().
I know that the cpu is cortex-a53 and it may not have any UARTs at all.
I was hoping there was a way to introduce a new device on any cpu that is
not 'born' with it from the manufacturer, like I attempt to introduce the
MPS2 on the cortex-a53.
I get to introduce it, but no instance is ever made of it, so it could
become used.
In reality I 'just' need to create a device which is at some physical
memory address (e.g. 0x09070000) and of size 0x1000, and I want to catch
reads and writes to this physical address range in my device and respond
there. My new device is unknown to a real cortex-a53 board.
Is there a way to add such a device, provided that the chosen physical
address range is free?
Since I may not have created my MMIO-device correctly, I had hoped I could
use MPS2 as debugging subject, so I could verify what is done in
mps2_common_init().
I hope it is possible to augment a qemu-cpu with phony devices in some
way!
I fear that the device-tree is built-in and unique to each cpu and cannot
be modified in a simple way.
Thanks.
Thorkil B. Rasmussen
From: "Peter Maydell" <address@hidden>
To: address@hidden
Cc: "Qemu-discuss"
<address@hidden>, "qemu-discuss"
<address@hidden>
Date: 16-04-2019 15:37
Subject: Re: [Qemu-discuss] Guidance requested creating a QEMU MMIO
device
Sent by: "Qemu-discuss"
<address@hidden>
On Tue, 16 Apr 2019 at 14:18, <address@hidden> wrote:
>
> Thanks, Peter.
>
> I can see how to use parts of the mps2-scc code to set up my wanted
MMIO.
> I would basically need an array of 32-bit words and would not need to
differentiate
> between control and data registers. That's what I hope at least.
>
> You wrote;
>
> > You would then need to modify the board code for whatever
> > machine you're trying to use this with to create the device
> > at whatever physical address you want it to live at.
>
> You didn't specify what you meant by 'board code'. Since a qemu is
supposed to emulate a
> specific processor/cpu, e.g. an arm cortex-a53 or a ppc mpc8544ds.
The board code is the code that models a particular board or
machine (which you specify on the command line with -M machinename).
It's under hw/${ARCH}/, usually, eg the versatilepb and versatileab
boards are handled by hw/arm/versatilepb.c.
For mps2-scc, you can see where the device is created by
looking for TYPE_MPS2_SCC -- it's used in the boards
modelled in hw/arm/mps2-tz.c and hw/arm/mps2.c.
All that code in roms/ that you found is just the source
code for a copy of u-boot which we ship as a ROM blob
to run on certain guest boards -- it is irrelevant to you.
thanks
-- PMM