From: Andrew Jones <drjones@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
christoffer.dall@linaro.org
Subject: Re: [PATCH v6 07/17] add minimal virtio support for devtree virtio-mmio
Date: Tue, 15 Jul 2014 19:22:04 +0200 [thread overview]
Message-ID: <20140715172204.GB15967@hawk.usersys.redhat.com> (raw)
In-Reply-To: <20140711090828.GB6013@hawk.usersys.redhat.com>
On Fri, Jul 11, 2014 at 11:08:28AM +0200, Andrew Jones wrote:
> On Fri, Jul 11, 2014 at 10:32:51AM +0200, Paolo Bonzini wrote:
> > Il 11/07/2014 10:19, Andrew Jones ha scritto:
> > >+enum virtio_hwdesc_type {
> > >+ VIRTIO_HWDESC_TYPE_DT = 0, /* device tree */
> > >+ NR_VIRTIO_HWDESC_TYPES,
> > >+};
> > >+
> > >+enum virtio_bus_type {
> > >+ VIRTIO_BUS_TYPE_MMIO = 0, /* virtio-mmio */
> > >+ NR_VIRTIO_BUS_TYPES,
> > >+};
> > >+
> > >+struct virtio_bind_bus {
> > >+ bool (*hwdesc_probe)(void);
> > >+ struct virtio_device *(*device_bind)(u32 devid);
> > >+};
> > >+
> > >+static struct virtio_device *vm_dt_device_bind(u32 devid);
> > >+
> > >+static struct virtio_bind_bus
> > >+virtio_bind_busses[NR_VIRTIO_HWDESC_TYPES][NR_VIRTIO_BUS_TYPES] = {
> > >+
> > >+[VIRTIO_HWDESC_TYPE_DT] = {
> > >+
> > >+ [VIRTIO_BUS_TYPE_MMIO] = {
> > >+ .hwdesc_probe = dt_available,
> > >+ .device_bind = vm_dt_device_bind,
> > >+ },
> > >+},
> > >+};
> > >+
> >
> > If you put this in lib/virtio.c, it is overengineered. It would make sense
> > if something else provided virtio_bind_busses[][].
>
> yeah, I acknowledged in the v4 changelog that it was unnecessary at the
> moment, but it's there to reduce the ugly hardcodeding that this simplified
> version currently needs, and who knows what the future shall bring.
>
> >
> > I suggest that you drop it and split this file in four:
> >
> > lib/virtio.c
> > lib/virtio-mmio.c
>
> This split already crossed my mind.
I made this split.
>
> > lib/virtio-mmio-dt.c
>
> I'm not sure we need this one, but OK.
I opted not to make this one. To me it seems reasonable to keep virtio-mmio
and virtio-mmio-dt code together, if for nothing else just to lean more
on the reduce file count side of the trade-off.
>
> > lib/arm/virtio.c
> >
> > where virtio_bind is in lib/arm/virtio.c.
> >
>
> Well, virtio_bind will still need to be in lib/virtio.c, but just as
> a wrapper to arch_virtio_bind. And, I'm inclined to keep virtio_bind_busses
> in arm's arch_virtio_bind.
>
I dropped the idea of depending on arch-specific implementations being
necessary. As the whole reason to get rid of my table is to simplify
things, then I think all we need for now is
virtio_bind
virtio_mmio_bind
virtio_mmio_dt_bind
to maintain abstractions and give room for expansions (virtio-pci).
drew
next prev parent reply other threads:[~2014-07-15 17:22 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-11 8:19 [PATCH v6 00/17] kvm-unit-tests/arm: initial drop Andrew Jones
2014-07-11 8:19 ` [PATCH v6 02/17] libfdt: get libfdt to build Andrew Jones
2014-07-11 8:19 ` [PATCH v6 03/17] add support for Linux device trees Andrew Jones
2014-07-11 8:19 ` [PATCH v6 04/17] libcflat: add abort() and assert() Andrew Jones
2014-07-11 8:19 ` [PATCH v6 05/17] Introduce asm-generic/*.h files Andrew Jones
2014-07-11 8:19 ` [PATCH v6 06/17] Introduce alloc_ops Andrew Jones
2014-07-11 8:40 ` Paolo Bonzini
2014-07-11 8:55 ` Andrew Jones
2014-07-11 9:41 ` Paolo Bonzini
2014-07-11 10:07 ` Andrew Jones
2014-07-11 10:12 ` Paolo Bonzini
2014-07-15 17:16 ` Andrew Jones
2014-07-11 8:19 ` [PATCH v6 07/17] add minimal virtio support for devtree virtio-mmio Andrew Jones
2014-07-11 8:32 ` Paolo Bonzini
2014-07-11 9:08 ` Andrew Jones
2014-07-11 9:27 ` Paolo Bonzini
2014-07-11 9:36 ` Andrew Jones
2014-07-15 17:22 ` Andrew Jones [this message]
2014-07-11 8:19 ` [PATCH v6 08/17] lib: add asm/page.h and virt_to_phys/phys_to_virt Andrew Jones
2014-07-11 8:19 ` [PATCH v6 09/17] virtio: add minimal support for virtqueues Andrew Jones
2014-07-11 9:23 ` Paolo Bonzini
2014-07-11 9:32 ` Paolo Bonzini
2014-07-11 9:52 ` Andrew Jones
2014-07-11 8:19 ` [PATCH v6 10/17] Introduce chr-testdev Andrew Jones
2014-07-11 8:19 ` [PATCH v6 11/17] libcflat: clean up libcflat.h Andrew Jones
2014-07-11 8:19 ` [PATCH v6 12/17] arm: initial drop Andrew Jones
2014-07-11 8:19 ` [PATCH v6 13/17] arm: Add spinlock implementation Andrew Jones
2014-07-11 8:19 ` [PATCH v6 14/17] arm: Add IO accessors to avoid register-writeback Andrew Jones
2014-07-11 8:19 ` [PATCH v6 15/17] arm: Add arch-specific asm/page.h and __va/__pa Andrew Jones
2014-07-11 8:19 ` [PATCH v6 16/17] arm: add useful headers from the Linux kernel Andrew Jones
2014-07-11 8:19 ` [PATCH v6 17/17] arm: vectors support Andrew Jones
2014-07-11 8:47 ` [PATCH v6 00/17] kvm-unit-tests/arm: initial drop Paolo Bonzini
2014-07-15 17:24 ` Andrew Jones
2014-07-15 20:19 ` Paolo Bonzini
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=20140715172204.GB15967@hawk.usersys.redhat.com \
--to=drjones@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=pbonzini@redhat.com \
/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