LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Pankaj Gupta <pagupta@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	qemu-devel@nongnu.org, linux-nvdimm@ml01.01.org,
	linux-mm@kvack.org, jack@suse.cz, stefanha@redhat.com,
	dan.j.williams@intel.com, riel@surriel.com,
	haozhong.zhang@intel.com, nilal@redhat.com, kwolf@redhat.com,
	pbonzini@redhat.com, ross.zwisler@intel.com, david@redhat.com,
	xiaoguangrong.eric@gmail.com, hch@infradead.org,
	marcel@redhat.com, niteshnarayanlal@hotmail.com,
	imammedo@redhat.com, lcapitulino@redhat.com
Subject: Re: [RFC v2 1/2] virtio: add pmem driver
Date: Wed, 25 Apr 2018 17:52:47 +0300	[thread overview]
Message-ID: <20180425174705-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180425112415.12327-2-pagupta@redhat.com>

On Wed, Apr 25, 2018 at 04:54:13PM +0530, Pankaj Gupta wrote:
> diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
> index 6d5c3b2..5ebd049 100644
> --- a/include/uapi/linux/virtio_ids.h
> +++ b/include/uapi/linux/virtio_ids.h
> @@ -43,5 +43,6 @@
>  #define VIRTIO_ID_INPUT        18 /* virtio input */
>  #define VIRTIO_ID_VSOCK        19 /* virtio vsock transport */
>  #define VIRTIO_ID_CRYPTO       20 /* virtio crypto */
> +#define VIRTIO_ID_PMEM         21 /* virtio pmem */
>  
>  #endif /* _LINUX_VIRTIO_IDS_H */

Please register the device id with virtio TC.


> diff --git a/include/uapi/linux/virtio_pmem.h b/include/uapi/linux/virtio_pmem.h
> new file mode 100644
> index 0000000..2ec27cb
> --- /dev/null
> +++ b/include/uapi/linux/virtio_pmem.h
> @@ -0,0 +1,58 @@
> +/* Virtio pmem Driver
> + *
> + * Discovers persitent memory range information
> + * from host and provides a virtio based flushing
> + * interface.
> + */
> +
> +#ifndef _LINUX_VIRTIO_PMEM_H
> +#define _LINUX_VIRTIO_PMEM_H
> +
> +#include <linux/types.h>
> +#include <linux/virtio_types.h>
> +#include <linux/virtio_ids.h>
> +#include <linux/virtio_config.h>
> +#include <linux/virtio_ring.h>
> +
> +
> +struct virtio_pmem_config {
> +

don't add empty lines pls.

> +	uint64_t start;
> +	uint64_t size;

Used LE fields for everything.

> +};
> +
> +struct virtio_pmem {
> +
> +	struct virtio_device *vdev;
> +	struct virtqueue *req_vq;
> +
> +	uint64_t start;
> +	uint64_t size;
> +} __packed;

This does not belong in uapi, and should not be packed either.

> +
> +static struct virtio_device_id id_table[] = {
> +	{ VIRTIO_ID_PMEM, VIRTIO_DEV_ANY_ID },
> +	{ 0 },
> +};
> +
> +void virtio_pmem_flush(struct device *dev)
> +{
> +	struct scatterlist sg;
> +	struct virtio_device *vdev  = dev_to_virtio(dev->parent->parent);
> +	struct virtio_pmem   *vpmem = vdev->priv;
> +	char *buf = "FLUSH";
> +	int err;
> +
> +	sg_init_one(&sg, buf, sizeof(buf));
> +
> +	err = virtqueue_add_outbuf(vpmem->req_vq, &sg, 1, buf, GFP_KERNEL);
> +
> +	if (err) {
> +		dev_err(&vdev->dev, "failed to send command to virtio pmem device\n");
> +		return;
> +	}
> +
> +	virtqueue_kick(vpmem->req_vq);
> +};

this doesn't belong in uapi.

> +
> +#endif
> -- 
> 2.9.3

  parent reply	other threads:[~2018-04-25 14:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 11:24 [RFC v2 0/2] kvm "fake DAX" device flushing Pankaj Gupta
2018-04-25 11:24 ` [RFC v2 1/2] virtio: add pmem driver Pankaj Gupta
2018-04-25 14:21   ` Dan Williams
2018-04-25 14:43     ` Dan Williams
2018-04-26 12:27       ` Jeff Moyer
2018-04-26 17:15         ` [Qemu-devel] " Pankaj Gupta
2018-04-26 17:24           ` Jeff Moyer
2018-04-25 14:52   ` Michael S. Tsirkin [this message]
2018-04-25 15:11     ` Pankaj Gupta
2018-04-26 13:12   ` Stefan Hajnoczi
2018-04-26 15:44     ` Pankaj Gupta
2018-04-27 13:31       ` Stefan Hajnoczi
2018-04-28 10:48         ` Pankaj Gupta
2018-04-25 11:24 ` [RFC v2 2/2] pmem: device flush over VIRTIO Pankaj Gupta
2018-04-25 14:23   ` Dan Williams
2018-04-25 14:47     ` Pankaj Gupta
2018-04-26 13:15   ` Stefan Hajnoczi
2018-04-26 16:40     ` Pankaj Gupta
2018-04-26 16:57       ` Dan Williams
2018-04-26 17:13         ` Pankaj Gupta
2018-04-25 11:24 ` [RFC v2] qemu: Add virtio pmem device Pankaj Gupta
2018-04-25 11:35   ` [Qemu-devel] " no-reply
2018-04-25 11:58     ` Pankaj Gupta
2018-04-25 14:23       ` Eric Blake
2018-04-25 14:51         ` Pankaj Gupta
2018-04-25 11:46   ` no-reply
2018-04-25 14:25   ` Eric Blake
2018-04-25 14:55     ` Pankaj Gupta
2018-04-26 13:24   ` Stefan Hajnoczi
2018-04-26 16:43     ` [Qemu-devel] " Pankaj Gupta
2018-06-01 12:24 ` [Qemu-devel] [RFC v2 0/2] kvm "fake DAX" device flushing Igor Mammedov
2018-06-04  5:56   ` Pankaj Gupta
2018-06-04  9:55   ` David Hildenbrand

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=20180425174705-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=hch@infradead.org \
    --cc=imammedo@redhat.com \
    --cc=jack@suse.cz \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=marcel@redhat.com \
    --cc=nilal@redhat.com \
    --cc=niteshnarayanlal@hotmail.com \
    --cc=pagupta@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riel@surriel.com \
    --cc=ross.zwisler@intel.com \
    --cc=stefanha@redhat.com \
    --cc=xiaoguangrong.eric@gmail.com \
    --subject='Re: [RFC v2 1/2] virtio: add pmem driver' \
    /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

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).