[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200212022842-mutt-send-email-mst@kernel.org>
Date: Wed, 12 Feb 2020 02:29:58 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: "Liu, Jing2" <jing2.liu@...ux.intel.com>
Cc: Zha Bin <zhabin@...ux.alibaba.com>, linux-kernel@...r.kernel.org,
jasowang@...hat.com, slp@...hat.com,
virtio-dev@...ts.oasis-open.org, qemu-devel@...gnu.org,
gerry@...ux.alibaba.com, chao.p.peng@...ux.intel.com
Subject: Re: [virtio-dev] Re: [PATCH v2 2/5] virtio-mmio: refactor common
functionality
On Wed, Feb 12, 2020 at 10:58:13AM +0800, Liu, Jing2 wrote:
>
> On 2/11/2020 7:19 PM, Michael S. Tsirkin wrote:
> > On Mon, Feb 10, 2020 at 05:05:18PM +0800, Zha Bin wrote:
> > > From: Liu Jiang <gerry@...ux.alibaba.com>
> > >
> > > Common functionality is refactored into virtio_mmio_common.h
> > > in order to MSI support in later patch set.
> > >
> > > Signed-off-by: Liu Jiang <gerry@...ux.alibaba.com>
> > > Co-developed-by: Zha Bin <zhabin@...ux.alibaba.com>
> > > Signed-off-by: Zha Bin <zhabin@...ux.alibaba.com>
> > > Co-developed-by: Jing Liu <jing2.liu@...ux.intel.com>
> > > Signed-off-by: Jing Liu <jing2.liu@...ux.intel.com>
> > > Co-developed-by: Chao Peng <chao.p.peng@...ux.intel.com>
> > > Signed-off-by: Chao Peng <chao.p.peng@...ux.intel.com>
> > What does this proliferation of header files achieve?
> > common with what?
>
> We're considering that the virtio mmio structure is useful for virtio mmio
> msi file so refactor out.
I would not put msi in a separate file either.
> e.g. to get the base of virtio_mmio_device from struct msi_desc *desc.
>
> Jing
>
>
> > > ---
> > > drivers/virtio/virtio_mmio.c | 21 +--------------------
> > > drivers/virtio/virtio_mmio_common.h | 31 +++++++++++++++++++++++++++++++
> > > 2 files changed, 32 insertions(+), 20 deletions(-)
> > > create mode 100644 drivers/virtio/virtio_mmio_common.h
> > >
> > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > > index 1733ab97..41e1c93 100644
> > > --- a/drivers/virtio/virtio_mmio.c
> > > +++ b/drivers/virtio/virtio_mmio.c
> > > @@ -61,13 +61,12 @@
> > > #include <linux/io.h>
> > > #include <linux/list.h>
> > > #include <linux/module.h>
> > > -#include <linux/platform_device.h>
> > > #include <linux/slab.h>
> > > #include <linux/spinlock.h>
> > > -#include <linux/virtio.h>
> > > #include <linux/virtio_config.h>
> > > #include <uapi/linux/virtio_mmio.h>
> > > #include <linux/virtio_ring.h>
> > > +#include "virtio_mmio_common.h"
> > > @@ -77,24 +76,6 @@
> > > -#define to_virtio_mmio_device(_plat_dev) \
> > > - container_of(_plat_dev, struct virtio_mmio_device, vdev)
> > > -
> > > -struct virtio_mmio_device {
> > > - struct virtio_device vdev;
> > > - struct platform_device *pdev;
> > > -
> > > - void __iomem *base;
> > > - unsigned long version;
> > > -
> > > - /* a list of queues so we can dispatch IRQs */
> > > - spinlock_t lock;
> > > - struct list_head virtqueues;
> > > -
> > > - unsigned short notify_base;
> > > - unsigned short notify_multiplier;
> > > -};
> > > -
> > > struct virtio_mmio_vq_info {
> > > /* the actual virtqueue */
> > > struct virtqueue *vq;
> > > diff --git a/drivers/virtio/virtio_mmio_common.h b/drivers/virtio/virtio_mmio_common.h
> > > new file mode 100644
> > > index 0000000..90cb304
> > > --- /dev/null
> > > +++ b/drivers/virtio/virtio_mmio_common.h
> > > @@ -0,0 +1,31 @@
> > > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > > +#ifndef _DRIVERS_VIRTIO_VIRTIO_MMIO_COMMON_H
> > > +#define _DRIVERS_VIRTIO_VIRTIO_MMIO_COMMON_H
> > > +/*
> > > + * Virtio MMIO driver - common functionality for all device versions
> > > + *
> > > + * This module allows virtio devices to be used over a memory-mapped device.
> > > + */
> > > +
> > > +#include <linux/platform_device.h>
> > > +#include <linux/virtio.h>
> > > +
> > > +#define to_virtio_mmio_device(_plat_dev) \
> > > + container_of(_plat_dev, struct virtio_mmio_device, vdev)
> > > +
> > > +struct virtio_mmio_device {
> > > + struct virtio_device vdev;
> > > + struct platform_device *pdev;
> > > +
> > > + void __iomem *base;
> > > + unsigned long version;
> > > +
> > > + /* a list of queues so we can dispatch IRQs */
> > > + spinlock_t lock;
> > > + struct list_head virtqueues;
> > > +
> > > + unsigned short notify_base;
> > > + unsigned short notify_multiplier;
> > > +};
> > > +
> > > +#endif
> > > --
> > > 1.8.3.1
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: virtio-dev-unsubscribe@...ts.oasis-open.org
> > For additional commands, e-mail: virtio-dev-help@...ts.oasis-open.org
> >
Powered by blists - more mailing lists