Received: by 10.192.165.148 with SMTP id m20csp824176imm; Wed, 25 Apr 2018 08:13:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx48BuXcEMCHFqCa2qBHIgE9uEwYagtKEPqAxx92+Z4KIraRFg4bE4acaDeS2IxlEghSW20+J X-Received: by 10.98.192.220 with SMTP id g89mr24740392pfk.223.1524669195364; Wed, 25 Apr 2018 08:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524669195; cv=none; d=google.com; s=arc-20160816; b=tuf5Y4q7SY4A7QBKrEstVtQnoM2Q+xAdzIMWjTuBdRSevS6FBJYjLz4OMQNIeI9hBL +N7/TrJw/qZbMikOvmNtSvfOf+H6BaYCqHi32Vi4xxQh4qBbMK95jLzVNAxVNXffNZik 95eJeuh4WU317bgW1e97Q1pqan5bfHY7NJVkRZAdPufbtif0xKMTom+y3ByWXizbHN9u KFtEaelX+WUQESos79cNa4e2i+FB6iHVWE13vsDAZtjOp/y+Y2Q0XWv3+80/3oUgZfd5 3ACULUoSp1rKP4I7VRWBRXT8fgYdvK+aL1YNfSkMGdVX1zsD8iTApEYREXKd3o5nea2V QuPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:arc-authentication-results; bh=ReFBUt4CfR1BTIflmkAhHbf5lFIc0L+T9qXRNWDn0sQ=; b=PJUnzSBhSPdu2kCMnk6WWnE3oNewfXxGLvfZpmmbnCygqD/nni4MNDJALjOwHh51vl pGDhELxzyDs9JQZXPoeXPBUJSGpXYRwEbcq7WdTMPQmtdRMvduiq3ecOqz6JpMHE9pus ZBx3qywYMS+AcL8mXAjs90teprga7enX0bGgj5ce10JMq7xW6qm97tIX5rF7ZvAjhmwY 5E7pMBbQf/anadjqPPallyL34dmFK57yBnGVrg44tYB6MehsXMnnFUIsQNBDvuDvL3Lu mb6gzJJZeVXdIKH85h7gTa2/UWIQdal1j/U/tlhmhWm0u17o8mQoEtIZMsjNb2a+T4kr uE0g== 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 c10-v6si16889374pla.127.2018.04.25.08.13.00; Wed, 25 Apr 2018 08:13:15 -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 S1755232AbeDYPLS (ORCPT + 99 others); Wed, 25 Apr 2018 11:11:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49638 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755072AbeDYPLL (ORCPT ); Wed, 25 Apr 2018 11:11:11 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 232573002FB6; Wed, 25 Apr 2018 15:11:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDBBD31341C1; Wed, 25 Apr 2018 15:11:10 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2096D1808873; Wed, 25 Apr 2018 15:11:10 +0000 (UTC) Date: Wed, 25 Apr 2018 11:11:09 -0400 (EDT) From: Pankaj Gupta To: "Michael S. Tsirkin" Cc: kwolf@redhat.com, haozhong zhang , lcapitulino@redhat.com, jack@suse.cz, xiaoguangrong eric , kvm@vger.kernel.org, riel@surriel.com, linux-nvdimm@ml01.01.org, david@redhat.com, ross zwisler , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, hch@infradead.org, linux-mm@kvack.org, imammedo@redhat.com, stefanha@redhat.com, niteshnarayanlal@hotmail.com, marcel@redhat.com, pbonzini@redhat.com, dan j williams , nilal@redhat.com Message-ID: <1651348200.22658063.1524669069712.JavaMail.zimbra@redhat.com> In-Reply-To: <20180425174705-mutt-send-email-mst@kernel.org> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-2-pagupta@redhat.com> <20180425174705-mutt-send-email-mst@kernel.org> Subject: Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.111, 10.4.195.13] Thread-Topic: virtio: add pmem driver Thread-Index: LEj7GKzcWwhsYKZMy6ae6EjkgvkcPQ== X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 25 Apr 2018 15:11:11 +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. O.K Will create virtio spec and follow the procedure. > > > > 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. o.k > > > + uint64_t start; > > + uint64_t size; > > Used LE fields for everything. o.k > > > +}; > > + > > +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. o.k > > > + > > +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. o.k. Thanks, Pankaj