qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH v3 2/5] intc: add goldfish-pic
Date: Thu, 4 Mar 2021 23:54:11 +0100	[thread overview]
Message-ID: <fecc4d39-51a2-5c9f-7bf7-8a543645a83d@amsat.org> (raw)
In-Reply-To: <20210304220104.2574112-3-laurent@vivier.eu>



On 3/4/21 11:01 PM, Laurent Vivier wrote:
> Implement the goldfish pic device as defined in
> 
> https://android.googlesource.com/platform/external/qemu/+/master/docs/GOLDFISH-VIRTUAL-HARDWARE.TXT
> 
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  include/hw/intc/goldfish_pic.h |  33 +++++
>  hw/intc/goldfish_pic.c         | 214 +++++++++++++++++++++++++++++++++
>  hw/intc/Kconfig                |   3 +
>  hw/intc/meson.build            |   1 +
>  hw/intc/trace-events           |   8 ++
>  5 files changed, 259 insertions(+)
>  create mode 100644 include/hw/intc/goldfish_pic.h
>  create mode 100644 hw/intc/goldfish_pic.c

> +static const MemoryRegionOps goldfish_pic_ops = {
> +    .read = goldfish_pic_read,
> +    .write = goldfish_pic_write,
> +    .endianness = DEVICE_NATIVE_ENDIAN,
> +    .valid.max_access_size = 4,

Missing:

       .impl.min_access_size = 4,

> +    .impl.max_access_size = 4,
> +};
> +
> +static void goldfish_pic_reset(DeviceState *dev)
> +{
> +    GoldfishPICState *s = GOLDFISH_PIC(dev);
> +    int i;
> +
> +    trace_goldfish_pic_reset(s, s->idx);
> +    s->pending = 0;
> +    s->enabled = 0;
> +
> +    for (i = 0; i < ARRAY_SIZE(s->stats_irq_count); i++) {
> +        s->stats_irq_count[i] = 0;
> +    }
> +}
> +
> +static void goldfish_pic_realize(DeviceState *dev, Error **errp)
> +{
> +    GoldfishPICState *s = GOLDFISH_PIC(dev);
> +    static int counter;
> +
> +    s->idx = counter++;

Isn't it a bit fragile? Aren't we better using DEFINE_PROP_UINT8()?

> +    trace_goldfish_pic_realize(s, s->idx);
> +
> +    memory_region_init_io(&s->iomem, OBJECT(s), &goldfish_pic_ops, s,
> +                          "goldfish_pic", 0x24);
> +}

Adding .impl.min_access_size:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  reply	other threads:[~2021-03-04 22:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 22:00 [PATCH v3 0/5] m68k: add Virtual M68k Machine Laurent Vivier
2021-03-04 22:01 ` [PATCH v3 1/5] char: add goldfish-tty Laurent Vivier
2021-03-04 22:55   ` Philippe Mathieu-Daudé
2021-03-04 22:01 ` [PATCH v3 2/5] intc: add goldfish-pic Laurent Vivier
2021-03-04 22:54   ` Philippe Mathieu-Daudé [this message]
2021-03-04 22:01 ` [PATCH v3 3/5] m68k: add an interrupt controller Laurent Vivier
2021-03-04 22:47   ` Philippe Mathieu-Daudé
2021-03-04 22:01 ` [PATCH v3 4/5] m68k: add a system controller Laurent Vivier
2021-03-04 22:01 ` [PATCH v3 5/5] m68k: add Virtual M68k Machine Laurent Vivier
2021-03-07  7:38 ` [PATCH v3 0/5] " Richard Henderson

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=fecc4d39-51a2-5c9f-7bf7-8a543645a83d@amsat.org \
    --to=f4bug@amsat.org \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).