[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3e0ec0d-3387-17bd-a33c-189933f70f95@linux.intel.com>
Date: Thu, 19 Mar 2020 15:28:09 +0800
From: Zhu Lingshan <lingshan.zhu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...lanox.com>,
Jason Wang <jasowang@...hat.com>
Cc: mst@...hat.com, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
maxime.coquelin@...hat.com, cunming.liang@...el.com,
zhihong.wang@...el.com, rob.miller@...adcom.com,
xiao.w.wang@...el.com, lingshan.zhu@...el.com, eperezma@...hat.com,
lulu@...hat.com, parav@...lanox.com, kevin.tian@...el.com,
stefanha@...hat.com, rdunlap@...radead.org, hch@...radead.org,
aadam@...hat.com, jiri@...lanox.com, shahafs@...lanox.com,
hanand@...inx.com, mhabets@...arflare.com, gdawar@...inx.com,
saugatm@...inx.com, vmireyno@...vell.com,
Bie Tiwei <tiwei.bie@...el.com>
Subject: Re: [PATCH V6 8/8] virtio: Intel IFC VF driver for VDPA
On 3/18/2020 8:22 PM, Jason Gunthorpe wrote:
> On Wed, Mar 18, 2020 at 04:03:27PM +0800, Jason Wang wrote:
>> From: Zhu Lingshan <lingshan.zhu@...el.com>
>> +
>> +static int ifcvf_vdpa_attach(struct ifcvf_adapter *adapter)
>> +{
>> + int ret;
>> +
>> + adapter->vdpa_dev = vdpa_alloc_device(adapter->dev, adapter->dev,
>> + &ifc_vdpa_ops);
>> + if (IS_ERR(adapter->vdpa_dev)) {
>> + IFCVF_ERR(adapter->dev, "Failed to init ifcvf on vdpa bus");
>> + put_device(&adapter->vdpa_dev->dev);
>> + return -ENODEV;
>> + }
> The point of having an alloc call is so that the drivers
> ifcvf_adaptor memory could be placed in the same struct - eg use
> container_of to flip between them, and have a kref for both memories.
>
> It seem really weird to have an alloc followed immediately by
> register.
Hi Jason,
Thanks for your comments, but I failed to understand this. In IFCVF
driver, we call ifcvf_vdpa_attach() at the end at probe(),
at this point, PCIE initialization almost done, then try to alloc vdpa
device, if successful, we can register it to VDPA bus.
Are you suggesting to wait for anything else done?
THanks,
BR
Zhu Linghsan
>
>> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
>> index c30eb55030be..de64b88ee7e4 100644
>> +++ b/drivers/virtio/virtio_vdpa.c
>> @@ -362,6 +362,7 @@ static int virtio_vdpa_probe(struct vdpa_device *vdpa)
>> goto err;
>>
>> vdpa_set_drvdata(vdpa, vd_dev);
>> + dev_info(vd_dev->vdev.dev.parent, "device attached to VDPA bus\n");
>>
>> return 0;
> This hunk seems out of place
>
> Jason
Powered by blists - more mailing lists