Re: [PATCH char-misc-next 3/8] misc: mic: MIC VOP Bus

From: Sudeep Dutt
Date: Mon Feb 08 2016 - 12:29:18 EST


On Sun, 2016-02-07 at 22:57 -0800, Greg Kroah-Hartman wrote:
> On Mon, Feb 01, 2016 at 08:23:40PM -0800, Sudeep Dutt wrote:
> > The Virtio Over PCIe (VOP) bus abstracts the low level hardware
> > details like interrupts and mapping remote memory so that the same VOP
> > driver can work without changes with different MIC host or card
> > drivers as long as the hardware bus operations are implemented. The
> > VOP driver registers itself on the VOP bus. The base PCIe drivers
> > implement the bus ops and register VOP devices on the bus, resulting
> > in the VOP driver being probed with the VOP devices. This allows the
> > VOP functionality to be shared between multiple generations of Intel
> > MIC products.
> >
> > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@xxxxxxxxx>
> > Signed-off-by: Sudeep Dutt <sudeep.dutt@xxxxxxxxx>
> > ---
> > drivers/misc/mic/Kconfig | 17 ++++
> > drivers/misc/mic/bus/Makefile | 1 +
> > drivers/misc/mic/bus/vop_bus.h | 142 ++++++++++++++++++++++++++++
> > drivers/misc/mic/bus/vop_bus.c | 204 +++++++++++++++++++++++++++++++++++++++++
> > 4 files changed, 364 insertions(+)
> > create mode 100644 drivers/misc/mic/bus/vop_bus.h
> > create mode 100644 drivers/misc/mic/bus/vop_bus.c
> >
> > diff --git a/drivers/misc/mic/Kconfig b/drivers/misc/mic/Kconfig
> > index 40677df..840f7ef 100644
> > --- a/drivers/misc/mic/Kconfig
> > +++ b/drivers/misc/mic/Kconfig
> > @@ -32,6 +32,23 @@ config SCIF_BUS
> > OS and tools for MIC to use with this driver are available from
> > <http://software.intel.com/en-us/mic-developer>.
> >
> > +comment "VOP Bus Driver"
> > +
> > +config VOP_BUS
> > + tristate "VOP Bus Driver"
> > + depends on 64BIT && PCI && X86 && X86_DEV_DMA_OPS
> > + help
> > + This option is selected by any driver which registers a
> > + device or driver on the VOP Bus, such as CONFIG_INTEL_MIC_HOST
> > + and CONFIG_INTEL_MIC_CARD.
> > +
> > + If you are building a host/card kernel with an Intel MIC device
> > + then say M (recommended) or Y, else say N. If unsure say N.
> > +
> > + More information about the Intel MIC family as well as the Linux
> > + OS and tools for MIC to use with this driver are available from
> > + <http://software.intel.com/en-us/mic-developer>.
> > +
> > comment "Intel MIC Host Driver"
> >
> > config INTEL_MIC_HOST
> > diff --git a/drivers/misc/mic/bus/Makefile b/drivers/misc/mic/bus/Makefile
> > index 761842b..8758a7d 100644
> > --- a/drivers/misc/mic/bus/Makefile
> > +++ b/drivers/misc/mic/bus/Makefile
> > @@ -5,3 +5,4 @@
> > obj-$(CONFIG_INTEL_MIC_BUS) += mic_bus.o
> > obj-$(CONFIG_SCIF_BUS) += scif_bus.o
> > obj-$(CONFIG_MIC_COSM) += cosm_bus.o
> > +obj-$(CONFIG_VOP_BUS) += vop_bus.o
> > diff --git a/drivers/misc/mic/bus/vop_bus.h b/drivers/misc/mic/bus/vop_bus.h
> > new file mode 100644
> > index 0000000..97fa5d6
> > --- /dev/null
> > +++ b/drivers/misc/mic/bus/vop_bus.h
> > @@ -0,0 +1,142 @@
> > +/*
> > + * Intel MIC Platform Software Stack (MPSS)
> > + *
> > + * Copyright(c) 2016 Intel Corporation.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License, version 2, as
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful, but
> > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> > + * General Public License for more details.
> > + *
> > + * The full GNU General Public License is included in this distribution in
> > + * the file called "COPYING".
> > + *
> > + * Intel Virtio over PCIe Bus driver.
> > + */
> > +#ifndef _VOP_BUS_H_
> > +#define _VOP_BUS_H_
> > +/*
> > + * Everything a vop driver needs to work with any particular vop
> > + * implementation.
> > + */
> > +#include <linux/dmaengine.h>
> > +#include <linux/interrupt.h>
> > +
> > +#include "../common/mic_dev.h"
> > +
> > +struct vop_device_id {
> > + u32 device;
> > + u32 vendor;
> > +};
> > +
> > +#define VOP_DEV_TRNSP 1
> > +#define VOP_DEV_ANY_ID 0xffffffff
> > +/*
> > + * Size of the internal buffer used during DMA's as an intermediate buffer
> > + * for copy to/from user. Must be an integral number of pages.
> > + */
> > +#define VOP_INT_DMA_BUF_SIZE PAGE_ALIGN(64 * 1024ULL)
> > +
> > +/**
> > + * vop_device - representation of a device using vop
> > + * @priv: private pointer for the driver's use.
> > + * @hw_ops: the hardware ops supported by this device.
> > + * @id: the device type identification (used to match it with a driver).
> > + * @dev: underlying device.
> > + * @dnode - The destination node which this device will communicate with.
> > + * @aper: Aperture memory window
> > + * @dma_ch - DMA channel
> > + * @index: unique position on the vop bus
> > + */
> > +struct vop_device {
> > + void *priv;
>
> You don't need this pointer, use the one in struct device instead.
>
> Other than that, looks good, nice job with this bus.
>

Hi Greg,

I will clean this up, refresh this patch series against the latest
char-misc-next tree and resend today.

Thanks for reviewing!

Sudeep Dutt