From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-6736-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id E7765985DC3 for ; Wed, 12 Feb 2020 07:30:07 +0000 (UTC) Date: Wed, 12 Feb 2020 02:29:58 -0500 From: "Michael S. Tsirkin" Message-ID: <20200212022842-mutt-send-email-mst@kernel.org> References: <0268807dc26ecdf5620de9000758d05ca0b21f3f.1581305609.git.zhabin@linux.alibaba.com> <20200211061758-mutt-send-email-mst@kernel.org> <787bac48-3fd0-316a-a99a-8c93154dc8e2@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <787bac48-3fd0-316a-a99a-8c93154dc8e2@linux.intel.com> Subject: Re: [virtio-dev] Re: [PATCH v2 2/5] virtio-mmio: refactor common functionality Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline To: "Liu, Jing2" Cc: Zha Bin , linux-kernel@vger.kernel.org, jasowang@redhat.com, slp@redhat.com, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, gerry@linux.alibaba.com, chao.p.peng@linux.intel.com List-ID: On Wed, Feb 12, 2020 at 10:58:13AM +0800, Liu, Jing2 wrote: >=20 > 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 > > >=20 > > > Common functionality is refactored into virtio_mmio_common.h > > > in order to MSI support in later patch set. > > >=20 > > > Signed-off-by: Liu Jiang > > > Co-developed-by: Zha Bin > > > Signed-off-by: Zha Bin > > > Co-developed-by: Jing Liu > > > Signed-off-by: Jing Liu > > > Co-developed-by: Chao Peng > > > Signed-off-by: Chao Peng > > What does this proliferation of header files achieve? > > common with what? >=20 > We're considering that the virtio mmio structure is useful for virtio mmi= o > 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. >=20 > Jing >=20 >=20 > > > --- > > > 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 > > >=20 > > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmi= o.c > > > index 1733ab97..41e1c93 100644 > > > --- a/drivers/virtio/virtio_mmio.c > > > +++ b/drivers/virtio/virtio_mmio.c > > > @@ -61,13 +61,12 @@ > > > #include > > > #include > > > #include > > > -#include > > > #include > > > #include > > > -#include > > > #include > > > #include > > > #include > > > +#include "virtio_mmio_common.h" > > > @@ -77,24 +76,6 @@ > > > -#define to_virtio_mmio_device(_plat_dev) \ > > > -=09container_of(_plat_dev, struct virtio_mmio_device, vdev) > > > - > > > -struct virtio_mmio_device { > > > -=09struct virtio_device vdev; > > > -=09struct platform_device *pdev; > > > - > > > -=09void __iomem *base; > > > -=09unsigned long version; > > > - > > > -=09/* a list of queues so we can dispatch IRQs */ > > > -=09spinlock_t lock; > > > -=09struct list_head virtqueues; > > > - > > > -=09unsigned short notify_base; > > > -=09unsigned short notify_multiplier; > > > -}; > > > - > > > struct virtio_mmio_vq_info { > > > =09/* the actual virtqueue */ > > > =09struct virtqueue *vq; > > > diff --git a/drivers/virtio/virtio_mmio_common.h b/drivers/virtio/vir= tio_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 > > > +#include > > > + > > > +#define to_virtio_mmio_device(_plat_dev) \ > > > +=09container_of(_plat_dev, struct virtio_mmio_device, vdev) > > > + > > > +struct virtio_mmio_device { > > > +=09struct virtio_device vdev; > > > +=09struct platform_device *pdev; > > > + > > > +=09void __iomem *base; > > > +=09unsigned long version; > > > + > > > +=09/* a list of queues so we can dispatch IRQs */ > > > +=09spinlock_t lock; > > > +=09struct list_head virtqueues; > > > + > > > +=09unsigned short notify_base; > > > +=09unsigned short notify_multiplier; > > > +}; > > > + > > > +#endif > > > --=20 > > > 1.8.3.1 > >=20 > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org > > For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org > >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org