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, 16 Apr 2019 15:18:34 +0200

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.
I looked at directories under .output that were called 'board' (in lack of 
better). That gave me this:

Directory: ./output/qemu-3.0.0/roms/u-boot-sam460ex/
File mask: board
----- -Attributes-    -- Size -- -- Date and Time -- Name ---------------
   1:  ....D...               0  14.Aug.2018  21:13  board/
Totals: 1 file  0 bytes  0 KB


Directory: ./output/qemu-3.0.0/roms/u-boot-sam460ex/nand_spl/
File mask: board
----- -Attributes-    -- Size -- -- Date and Time -- Name ---------------
   1:  ....D...               0  14.Aug.2018  21:13  board/
Totals: 1 file  0 bytes  0 KB


Directory: ./output/qemu-3.0.0/roms/u-boot-sam460ex/onenand_ipl/
File mask: board
----- -Attributes-    -- Size -- -- Date and Time -- Name ---------------
   1:  ....D...               0  14.Aug.2018  21:13  board/
Totals: 1 file  0 bytes  0 KB


Directory: ./output/qemu-3.0.0/roms/u-boot-sam460ex/post/
File mask: board
----- -Attributes-    -- Size -- -- Date and Time -- Name ---------------
   1:  ....D...               0  14.Aug.2018  21:13  board/
Totals: 1 file  0 bytes  0 KB

Grand totals: 4 directories  4 files  0 bytes  0 KB

But if I was less specific and looking for *cortex*,  I found I 
contribution directory here:

./output/qemu-3.0.0/roms/u-boot-sam460ex/arch/arm/cpu/arm_cortexa8/

Maybe totally unrelated, but where then should I go to find the 'board 
code' you mention?
Are these different 'board codes' designed in a similar way, so that 
making a change
for an arm board would be very similar to a change for a ppc board?
Or have I completely misunderstood this and now on my merry way out on a 
tangent?

Can you point me to the spot where mps2-scc is added to its 'board code'?

I shall try to avoid spamming you with questions in the future, but right 
now I need the
information I ask for - at least I believe I do!

Thanks.

        Thorkil B. Rasmussen
        address@hidden



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



On Tue, 16 Apr 2019 at 11:09, <address@hidden> wrote:
> I am trying to create a new device in QEMU that is supposed to be a 
memory
> mapped device at some physical address and of some size.
> The idea is to set up .read and .write functions that get control when 
the
> user application reads from or writes to the MMIO device, similar to 
other
> devices.
> It should NOT be PCI!

You want something that is a "sysbus device", which is
QEMU's abstraction for "device that is memory mapped and
possibly has interrupt lines". hw/misc/mps2-scc.c is an
example of a very simple one that's been written fairly
recently and is in the currently recommended style.

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.

> I was hoping that the configuration values for the MMIO-device could be
> provided when starting the QEMU-image, along with other entities you see
> when you use the -v option. So there must be a standard way to pass this
> information on from the invocation to the actual device they were 
written
> for.

You can't conveniently do this. Memory-mapped devices are
created by board code, not on the command line, which makes
them awkward to configure via the command line. (It is possible
to get them to have some device properties which can then be
set via the -global option, but you need to know where the
device was created in the QOM object tree to know what to pass
-global.)

thanks
-- PMM






reply via email to

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