]> git.baikalelectronics.ru Git - kernel.git/commit
virtio_pmem: set device ready in probe()
authorJason Wang <jasowang@redhat.com>
Tue, 28 Jun 2022 08:34:30 +0000 (16:34 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 11 Aug 2022 08:06:37 +0000 (04:06 -0400)
commit49fed5356abef3713d111ab215b8443cd91853a0
tree9e6271c829721c60756fd8ac7c731c3eedd1493c
parentd8116fe264b07c992cb563d879bc14ccf80b13de
virtio_pmem: set device ready in probe()

The NVDIMM region could be available before the virtio_device_ready()
that is called by virtio_dev_probe(). This means the driver tries to
use device before DRIVER_OK which violates the spec, fixing this by
set device ready before the nvdimm_pmem_region_create().

Note that this means the virtio_pmem_host_ack() could be triggered
before the creation of the nd region, this is safe since the pmem_lock
has been initialized and whether or not any available buffer is added
before is validated by virtio_pmem_host_ack().

Fixes 7f81db57cbfc ("virtio-pmem: Add virtio pmem driver")
Acked-by: Pankaj Gupta <pankaj.gupta@amd.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220628083430.61856-2-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/nvdimm/virtio_pmem.c