qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Beniamino Galvani <b.galvani@gmail.com>,
	Charlie Smurthwaite <charlie@atech.media>,
	QEMU Developers <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] hw/arm/allwinner-a10: Add the 'A' SRAM and the SRAM controller
Date: Fri, 4 Jan 2019 15:15:06 +0100	[thread overview]
Message-ID: <CAAdtpL6jsY7de7Si+m5kyD__7E_UO2pwUg_0K+VqCn4_9OQFsA@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA_nOm4gcuF0NgYtqgAfB1UaW1MFmcRCtWwrUr9-X+Xe8g@mail.gmail.com>

On Fri, Jan 4, 2019 at 3:10 PM Peter Maydell <peter.maydell@linaro.org> wrote:
> On Sun, 9 Dec 2018 at 19:37, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> > From the "A10 User Manual V1.20" p.29: "3.2. Memory Mapping" and:
> >
> >  7. System Control
> >   7.1. Overview
> >
> >   A10 embeds a high-speed SRAM which has been split into five segments.
> >   See detailed memory mapping in following table:
> >
> >   Area          Address        Size (Bytes)
> >    A1    0x00000000-0x00003FFF 16K
> >    A2    0x00004000-0x00007FFF 16K
> >    A3    0x00008000-0x0000B3FF 13K
> >    A4    0x0000B400-0x0000BFFF  3K
> >
> > Since for emulation purpose we don't need the segmentations, we simply define
> > the 'A' area as a single 48KB SRAM.
>
> >  static void aw_a10_init(Object *obj)
> >  {
> > @@ -85,6 +86,10 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
> >      sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
> >      sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
> >
> > +    memory_region_init_ram(&s->sram_a, NULL, "sram A", 48 * KiB, &error_fatal);
>
> This creates the memory region with a NULL owner, which is
> OK for board model code, but since we're a device object
> here we should use OBJECT(dev) as the owner.
>
> This is more important if the region creation happens
> in the instance_init function, in which case it will
> result in a leak of the memory region after the device
> is destroyed (see for instance commit 09d98b69804cfd9e),
> but it's worth getting right here anyway.

Thanks, good to know.
I'll fix.
Regards,

Phil.

> > +    memory_region_add_subregion(get_system_memory(), 0x00000000, &s->sram_a);
> > +    create_unimplemented_device("a10-sram-ctrl", 0x01c00000, 4 * KiB);
> > +
> >      /* FIXME use qdev NIC properties instead of nd_table[] */
> >      if (nd_table[0].used) {
> >          qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
>
> thanks
> -- PMM

      reply	other threads:[~2019-01-04 14:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-09 19:37 [Qemu-devel] [PATCH] hw/arm/allwinner-a10: Add the 'A' SRAM and the SRAM controller Philippe Mathieu-Daudé
2019-01-04 14:09 ` Peter Maydell
2019-01-04 14:15   ` Philippe Mathieu-Daudé [this message]

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=CAAdtpL6jsY7de7Si+m5kyD__7E_UO2pwUg_0K+VqCn4_9OQFsA@mail.gmail.com \
    --to=f4bug@amsat.org \
    --cc=b.galvani@gmail.com \
    --cc=charlie@atech.media \
    --cc=peter.maydell@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).