[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190410144147.GA7947@lap1>
Date: Wed, 10 Apr 2019 17:41:47 +0300
From: Yuval Shaia <yuval.shaia@...cle.com>
To: Pankaj Gupta <pagupta@...hat.com>
Cc: linux-nvdimm@...ts.01.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, kvm@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-acpi@...r.kernel.org,
qemu-devel@...gnu.org, linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org, dan.j.williams@...el.com,
zwisler@...nel.org, vishal.l.verma@...el.com, dave.jiang@...el.com,
mst@...hat.com, jasowang@...hat.com, willy@...radead.org,
rjw@...ysocki.net, hch@...radead.org, lenb@...nel.org,
jack@...e.cz, tytso@....edu, adilger.kernel@...ger.ca,
darrick.wong@...cle.com, lcapitulino@...hat.com, kwolf@...hat.com,
imammedo@...hat.com, jmoyer@...hat.com, nilal@...hat.com,
riel@...riel.com, stefanha@...hat.com, aarcange@...hat.com,
david@...hat.com, david@...morbit.com, cohuck@...hat.com,
xiaoguangrong.eric@...il.com, pbonzini@...hat.com,
kilobyte@...band.pl
Subject: Re: [PATCH v5 2/5] virtio-pmem: Add virtio pmem driver
> +
> +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;
> +}
Powered by blists - more mailing lists