qemu-discuss
[Top][All Lists]
Advanced

[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:48:35 +0200

Thanks for the response.

I do see that the 3 mps2_..._class_init() functions are called, but I 
don't see mps2_common_init() being called which suggests that the mc->init 
field is not called.
Shouldn't there be created an instance which then should be calling 
mps2_common_init() where all the initialization takes place?

Shouldn't an instance also be created for my MMIO that follows the same 
style and pattern as MPS2?

After the third mps2..class_init() function is called, qemu just starts 
up.
That cannot be right, can it?

        Thorkil B. Rasmussen



From:   "Peter Maydell" <address@hidden>
To:     address@hidden
Cc:     "Qemu-discuss" 
<address@hidden>, "qemu-discuss" 
<address@hidden>
Date:   30-04-2019 16:25
Subject:        Re: [Qemu-discuss] Guidance requested creating a QEMU MMIO 
device
Sent by:        "Qemu-discuss" 
<address@hidden>



On Tue, 30 Apr 2019 at 15:09, <address@hidden> wrote:
>
> 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.

Cortex-A53 is a CPU. This is not related to whethher there's a
UART present or not, which is a question of the design of a
particular SoC or board.

For Cortex-A53 you definitely want to use a different board from
the MPS2, though, because MPS2 is M-profile specific. When
I mentioned it I just meant to say that you could look at the
code in the MPS2 board code that is creating a simple device
and copy the way that works for whatever board it is that
you are using.

> 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().

Yes, as I say you can look at the mps2-scc device to see how it
is created and wired up into the memory map.

> I fear that the device-tree is built-in and unique to each cpu
> and cannot be modified in a simple way.

No, the device creation is handled by code for a particular
board, it's not CPU-specific.

thanks
-- PMM






reply via email to

[Prev in Thread] Current Thread [Next in Thread]