Received: by 10.192.165.148 with SMTP id m20csp801279imm; Wed, 25 Apr 2018 07:54:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx48mQADehI5mlvw8/uiBB7pG2yUKAPcR3Ck9k5coOJNQKwsn54Adq+8qLX6m0XjeW0g429zK X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr28850213plp.136.1524668065409; Wed, 25 Apr 2018 07:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524668065; cv=none; d=google.com; s=arc-20160816; b=kKgoxkDf9kVa7hyKTOS6QkEkW4ODsCC68wdXBv+Ql8zoXUUJqrWQwojZgn8PhKZwDF qAOyo5Cg99jm67LSFlzDlDTxiTWvfiTpjW/OGNuuU/O9bH/Z8btYNVs4HsqCsqpDbrjR iSpo7IU1rVuzSoi4NGRxgqXB+r7kK4W+XtWZnvzYmiNAwIJ/VQzBKwRdHGkuSAxQk1bS FasRhZpiRkd9syKhORKHOLtUDd7CTM2y2XMUCYBbRD27r9LPlYS8L94f1mn+CXUw81jA 67+GTf1TRjM1I9YvXihfG+VJ2Uf8qFKqzECtg1r3PG7QbPunbOGImotgl++GZ1q1U3Yo NJmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=LS06ASQ6hZmLz4mctKvnQ3Dg5rR5ZRGHDS/YNeVo2TU=; b=JRGNwOysK9ftT+k4mki3ffr9Wrs4cPCSwLHFi+5gULZvd9cHjG3A69mtYxQAkNRIcP w240WepW6Ff2N7BzvviIGFfYnumEYqjwB+D6fRpK8iawcbEa8ECmhd+CO15rU05p6IU7 CEMuZ5+w7XndRakV/wFUou8Yg1Id0tbXvvKP2M2gLaLSJ2k3kfIuR5xOatZS5rWvRZrD FbN5UhbGTTcppe4haLtYdemGhafVHDjlT7y710uTYvXsAQjQRfb+f/QY7afDta6k0Okx yBXpUPQo54wQmXmInCg10L+RepWfZ+jqAzPU+HV1CMyPI/Pm0IR0vhwws0V1zg6tCPWf foqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si7960726pgp.594.2018.04.25.07.54.10; Wed, 25 Apr 2018 07:54:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754748AbeDYOxK (ORCPT + 99 others); Wed, 25 Apr 2018 10:53:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49820 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754196AbeDYOxG (ORCPT ); Wed, 25 Apr 2018 10:53:06 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E008D30BA378; Wed, 25 Apr 2018 14:53:05 +0000 (UTC) Received: from redhat.com (ovpn-123-156.rdu2.redhat.com [10.10.123.156]) by smtp.corp.redhat.com (Postfix) with SMTP id 2B5653142160; Wed, 25 Apr 2018 14:52:53 +0000 (UTC) Date: Wed, 25 Apr 2018 17:52:47 +0300 From: "Michael S. Tsirkin" To: Pankaj Gupta 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 Message-ID: <20180425174705-mutt-send-email-mst@kernel.org> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-2-pagupta@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180425112415.12327-2-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 25 Apr 2018 14:53:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > +#include > +#include > +#include > +#include > + > + > +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