Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5072335yba; Wed, 10 Apr 2019 10:42:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoWPdQX1wEDAQlpnMdK/yhy02BMvbpug24IH8gcZfGVdp6Ypospcvco76662QwGyXJIg0A X-Received: by 2002:a63:8143:: with SMTP id t64mr41446334pgd.301.1554918148682; Wed, 10 Apr 2019 10:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554918148; cv=none; d=google.com; s=arc-20160816; b=I3geArzTUMYHCa+FAO5LdfPra0QWK4YD2R9LuIqRGcaq0jaNDY5qbwFilvILM0n3UZ YQoY6NYqhmB1zGqWcIBDqiu6jnVsnd1wblxiJdShxCtLzs2ZrCqVnCt+YIihQbdp2Ac+ 1w3U0LCuvcYSVRn9zBBexQ/HGEfp1USXe9YWhdMl9sNumQBxXgIoURRHAGPP0cZ8NEko BD3N7RyJANOzpn2ZTnNkb3O/GLdtZxptp8HvPgnAUOwgkH285E9yztLkuzp9L00riOBI Vn2kSrpLB4R4EFSaSV48IXjVRIhxjRJJlwXw9Kb42DAcQi4+zosWmAjxcZLDlBFDUnhS x7CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tWKjYIeiHXHl7RfxJfMrtXBbi9DfgMhue/6AAetWxXk=; b=u8fPIU7RGzsuAGX0nMfmtJ9nLSqdv1LP8mFn39uK9zMYguYaOQ97ddkgisad3jjdtD nrFSSiM6onIY0Q6sZ4JIEBU4kCaO4YBBLe0JuNG4YNoZFf3W7uZuVZl5e2/cKKxzja7I hmcpkiDvF7gyM6OXSI+CtMSo7fyruVC9K/z0x7qN4ZuhiHth7+hWSs0scRD+OnwLS7tp Q/yz2Qz3g5zIdYENIFcGwvnoR2NePOdITYyOS1/inNYbebu7hxXJkO1aoDrM9z2KW82d eyoktvm/odRcaoy9NHYAFnSvEhjt4ymW+BaNBH4Kt2T1zCMI9M3kqJPwg/XEYdJYm1fp 4gDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=16tEd6JG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si25821606pll.21.2019.04.10.10.42.12; Wed, 10 Apr 2019 10:42:28 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=16tEd6JG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732846AbfDJOmf (ORCPT + 99 others); Wed, 10 Apr 2019 10:42:35 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51032 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731971AbfDJOme (ORCPT ); Wed, 10 Apr 2019 10:42:34 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3AEdPmS111968; Wed, 10 Apr 2019 14:42:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=tWKjYIeiHXHl7RfxJfMrtXBbi9DfgMhue/6AAetWxXk=; b=16tEd6JG33BtjKjJS3Nd3ruUmPv6Zreq3PXNWaIijKd1KlYDdJ/K4Cr5MVkx9/W75eS1 m++wa917kDkVUWfqK1Cb7BsXFOlZwY/oFmCNg4VlYqZb1kxh41/ZlS5IBHBYI8wBSMEW JD8ok57XUnnrDe+XMDF+3uT1GpQbxgdWyb+bcf1XapEACO6iax+NhlQ//xjOBkmJchUP O/A5K2+1bCm8cbdELJa3PezrkRbr5QKPHFflLWxiC67lctz55GkQtXPzwbuLbq12vgII v+ybPhugeM0olQ+Y8+uc6JPp9rrc3bGla6E/SGoLaXx58GcPb/SycIikiGSPIeOvCxMl LQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2rphmekpgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2019 14:42:08 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3AEffE3143298; Wed, 10 Apr 2019 14:42:08 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2rpytc9eyk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2019 14:42:07 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3AEg6Q8026831; Wed, 10 Apr 2019 14:42:06 GMT Received: from lap1 (/77.138.183.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Apr 2019 07:42:05 -0700 Date: Wed, 10 Apr 2019 17:41:47 +0300 From: Yuval Shaia To: Pankaj Gupta Cc: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-acpi@vger.kernel.org, qemu-devel@nongnu.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, dan.j.williams@intel.com, zwisler@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, mst@redhat.com, jasowang@redhat.com, willy@infradead.org, rjw@rjwysocki.net, hch@infradead.org, lenb@kernel.org, jack@suse.cz, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, lcapitulino@redhat.com, kwolf@redhat.com, imammedo@redhat.com, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, aarcange@redhat.com, david@redhat.com, david@fromorbit.com, cohuck@redhat.com, xiaoguangrong.eric@gmail.com, pbonzini@redhat.com, kilobyte@angband.pl Subject: Re: [PATCH v5 2/5] virtio-pmem: Add virtio pmem driver Message-ID: <20190410144147.GA7947@lap1> References: <20190410040826.24371-1-pagupta@redhat.com> <20190410040826.24371-3-pagupta@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190410040826.24371-3-pagupta@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9222 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904100104 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9222 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904100104 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + > +static int virtio_pmem_probe(struct virtio_device *vdev) > +{ > + int err = 0; > + struct resource res; > + struct virtio_pmem *vpmem; > + struct nvdimm_bus *nvdimm_bus; > + struct nd_region_desc ndr_desc = {}; > + int nid = dev_to_node(&vdev->dev); > + struct nd_region *nd_region; > + > + if (!vdev->config->get) { > + dev_err(&vdev->dev, "%s failure: config disabled\n", > + __func__); > + return -EINVAL; > + } > + > + vdev->priv = vpmem = devm_kzalloc(&vdev->dev, sizeof(*vpmem), > + GFP_KERNEL); > + if (!vpmem) { > + err = -ENOMEM; > + goto out_err; > + } > + > + vpmem->vdev = vdev; > + err = init_vq(vpmem); > + if (err) > + goto out_err; > + > + virtio_cread(vpmem->vdev, struct virtio_pmem_config, > + start, &vpmem->start); > + virtio_cread(vpmem->vdev, struct virtio_pmem_config, > + size, &vpmem->size); > + > + res.start = vpmem->start; > + res.end = vpmem->start + vpmem->size-1; > + vpmem->nd_desc.provider_name = "virtio-pmem"; > + vpmem->nd_desc.module = THIS_MODULE; > + > + vpmem->nvdimm_bus = nvdimm_bus = nvdimm_bus_register(&vdev->dev, > + &vpmem->nd_desc); > + if (!nvdimm_bus) > + goto out_vq; > + > + dev_set_drvdata(&vdev->dev, nvdimm_bus); > + > + ndr_desc.res = &res; > + ndr_desc.numa_node = nid; > + ndr_desc.flush = virtio_pmem_flush; > + set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); > + set_bit(ND_REGION_ASYNC, &ndr_desc.flags); > + nd_region = nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc); > + nd_region->provider_data = dev_to_virtio Pleas delete the extra space. > + (nd_region->dev.parent->parent); > + > + if (!nd_region) > + goto out_nd; > + > + return 0; > +out_nd: > + err = -ENXIO; > + nvdimm_bus_unregister(nvdimm_bus); > +out_vq: > + vdev->config->del_vqs(vdev); > +out_err: > + dev_err(&vdev->dev, "failed to register virtio pmem memory\n"); > + return err; > +}