From: Peter Maydell <peter.maydell@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
"patches@linaro.org" <patches@linaro.org>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH 16/16] hw/arm/mps2-tz: Create PL081s and MSCs
Date: Sat, 18 Aug 2018 11:07:18 +0100 [thread overview]
Message-ID: <CAFEAcA8==GqUH4mOc0ne9iCvUCpsqQmkRw8cYpu+GqM7Akd0Kw@mail.gmail.com> (raw)
In-Reply-To: <e65ebee0-33bf-3bb5-fc9a-2a60532af74e@amsat.org>
On 18 August 2018 at 02:09, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> On 08/09/2018 10:01 AM, Peter Maydell wrote:
>> The AN505 FPGA image includes four PL081 DMA controllers, each
>> of which is gated by a Master Security Controller that allows
>> the guest to prevent a non-secure DMA controller from accessing
>> memory that is used by secure guest code. Create and wire
>> up these devices.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> hw/arm/mps2-tz.c | 101 +++++++++++++++++++++++++++++++++++++++++++----
>> 1 file changed, 94 insertions(+), 7 deletions(-)
>>
>> diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
>> index 22180c56fb7..7d92bc5fe1c 100644
>> --- a/hw/arm/mps2-tz.c
>> +++ b/hw/arm/mps2-tz.c
>> @@ -45,7 +45,9 @@
>> #include "hw/misc/mps2-scc.h"
>> #include "hw/misc/mps2-fpgaio.h"
>> #include "hw/misc/tz-mpc.h"
>> +#include "hw/misc/tz-msc.h"
>> #include "hw/arm/iotkit.h"
>> +#include "hw/dma/pl080.h"
>> #include "hw/devices.h"
>> #include "net/net.h"
>> #include "hw/core/split-irq.h"
>> @@ -75,8 +77,9 @@ typedef struct {
>> UnimplementedDeviceState i2c[4];
>> UnimplementedDeviceState i2s_audio;
>> UnimplementedDeviceState gpio[4];
>> - UnimplementedDeviceState dma[4];
>> UnimplementedDeviceState gfx;
>> + PL080State dma[4];
>> + TZMSC msc[4];
>> CMSDKAPBUART uart[5];
>> SplitIRQ sec_resp_splitter;
>> qemu_or_irq uart_irq_orgate;
>> @@ -273,6 +276,65 @@ static MemoryRegion *make_mpc(MPS2TZMachineState *mms, void *opaque,
>> return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0);
>> }
>>
>> +static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,
>> + const char *name, hwaddr size)
>> +{
>> + PL080State *dma = opaque;
>> + int i = dma - &mms->dma[0];
>
> This line is not trivial to read. I wondered "isn't this ptrdiff_t? why
> not divide by sizeof(dma)...
It's following the same approach as the other existing
make_*() functions in this file, though.
>> + SysBusDevice *s;
>> + char *mscname = g_strdup_printf("%s-msc", name);
>> + TZMSC *msc = &mms->msc[i];
>> + DeviceState *iotkitdev = DEVICE(&mms->iotkit);
>> + MemoryRegion *msc_upstream;
>> + MemoryRegion *msc_downstream;
>> +
>> + /*
>> + * Each DMA device is a PL081 whose transaction master interface
>> + * is guarded by a Master Security Controller. The downstream end of
>> + * the MSC connects to the IoTKit AHB Slave Expansion port, so the
>> + * DMA devices can see all devices and memory that the CPU does.
>> + */
>> + init_sysbus_child(OBJECT(mms), mscname, msc, sizeof(mms->msc[0]),
>
> sizeof(*msc) easier to read?
That would work and probably is better; again I was just following
the same thing I'd done in other make_*() functions earlier.
thanks
-- PMM
next prev parent reply other threads:[~2018-08-18 10:08 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 13:00 [Qemu-devel] [PATCH 00/16] arm: Implement MPS2 watchdogs and DMA Peter Maydell
2018-08-09 13:01 ` [Qemu-devel] [PATCH 01/16] hw/watchdog/cmsdk_apb_watchdog: Implement CMSDK APB watchdog module Peter Maydell
2018-08-18 1:27 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 02/16] nvic: Expose NMI line Peter Maydell
2018-08-10 5:05 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 03/16] hw/arm/iotkit: Wire up the watchdogs Peter Maydell
2018-08-17 23:47 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 04/16] hw/arm/iotkit: Wire up the S32KTIMER Peter Maydell
2018-08-17 23:49 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 05/16] hw/misc/iotkit-sysctl: Implement IoTKit system control element Peter Maydell
2018-08-18 0:23 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-18 10:04 ` Peter Maydell
2018-08-18 19:54 ` Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 06/16] hw/misc/iotkit: Wire up the " Peter Maydell
2018-08-18 0:00 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-18 9:55 ` Peter Maydell
2018-08-18 15:06 ` Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 07/16] hw/misc/tz-msc: Model TrustZone Master Security Controller Peter Maydell
2018-08-18 1:15 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 08/16] hw/misc/iotkit-secctl: Wire up registers for controlling MSCs Peter Maydell
2018-08-18 0:37 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-18 10:05 ` Peter Maydell
2018-08-18 15:42 ` Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 09/16] hw/arm/iotkit: Wire up the lines for MSCs Peter Maydell
2018-08-18 0:39 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 10/16] hw/dma/pl080: Allow use as embedded-struct device Peter Maydell
2018-08-10 5:18 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-10 5:27 ` Philippe Mathieu-Daudé
2018-08-10 9:03 ` Peter Maydell
2018-08-09 13:01 ` [Qemu-devel] [PATCH 11/16] hw/dma/pl080: Support all three interrupt lines Peter Maydell
2018-08-18 0:43 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 12/16] hw/dma/pl080: Don't use CPU address space for DMA accesses Peter Maydell
2018-08-10 5:10 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 13/16] hw/dma/pl080: Provide device reset function Peter Maydell
2018-08-10 5:11 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 14/16] hw/dma/pl080: Correct bug in register address decode logic Peter Maydell
2018-08-15 14:39 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-15 15:31 ` Peter Maydell
2018-08-09 13:01 ` [Qemu-devel] [PATCH 15/16] hw/dma/pl080: Remove hw_error() if DMA is enabled Peter Maydell
2018-08-10 5:12 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-09 13:01 ` [Qemu-devel] [PATCH 16/16] hw/arm/mps2-tz: Create PL081s and MSCs Peter Maydell
2018-08-18 1:09 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-08-18 10:07 ` Peter Maydell [this message]
2018-08-16 18:02 ` [Qemu-devel] [Qemu-arm] [PATCH 00/16] arm: Implement MPS2 watchdogs and DMA Peter Maydell
2018-08-18 1:29 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFEAcA8==GqUH4mOc0ne9iCvUCpsqQmkRw8cYpu+GqM7Akd0Kw@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=f4bug@amsat.org \
--cc=patches@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).