vdpa/vdpa_sim: Use the negotiated features when calling vringh_init_iotlb
PATCH 1/1 vdpa/vdpa_sim: Use the negotiated features when calling vringh_init_iotlb
When calling vringh_init_iotlb(), use the negotiated features which might be different than the supported features.
---
v0 --> v1:
Update "Fixes" line
drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vdpa/vdpa_sim/vdpa_sim.c +2 -2
@@ -66,7 +66,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) {struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features, VDPASIM_QUEUE_MAX, false, (struct vring_desc *)(uintptr_t)vq->desc_addr, (struct vring_avail *)
@@ -86,7 +86,7 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, vq->device_addr =0 ; vq->cb =NULL ; vq->private =NULL ; -vringh_init_iotlb (&vq->vring, vdpasim->dev_attr.supported_features, +vringh_init_iotlb (&vq->vring, vdpasim->features,VDPASIM_QUEUE_MAX , false,NULL ,NULL ,NULL ); vq->vring.notify =NULL ;
Signature · 1 line
2.30.1
Quoted 26 lines · Eli Cohen
When calling
vringh_init_iotlb(), use the negotiated features which might be different than the supported features.Fixes 2c53d0f64c06f ("vdpasim: vDPA device simulator")Signed-off-by Eli Cohen <[email protected]>---
v0 --> v1:
Update "Fixes" line
drivers/vdpa/vdpa_sim/vdpa_sim.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/vdpa/vdpa_sim/vdpa_sim.c +1
-1@@ -66,7 +66,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) {struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features, VDPASIM_QUEUE_MAX, false, (struct vring_desc *)(uintptr_t)vq->desc_addr, (struct vring_avail *)
drivers/vdpa/vdpa_sim/vdpa_sim.c static void vdpasim_vq_reset(struct vdpasim *vdpasim, · line 89
Quoted 5 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c +1
-1@@ -86,7 +86,7 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, vq->device_addr =0 ; vq->cb =NULL ; vq->private =NULL ; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features,
vdpasim_vq_reset() is called while resetting the device in vdpasim_reset() where we also set vdpasim->features = 0 after resetting the vqs, so maybe it's better to use the supported features here, since the negotiated ones are related to the previous instance.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 21 lines · Stefano Garzarella
Quoted 20 lines · Eli Cohen
When calling
vringh_init_iotlb(), use the negotiated features which might be different than the supported features.Fixes 2c53d0f64c06f ("vdpasim: vDPA device simulator")Signed-off-by Eli Cohen <[email protected]>---
v0 --> v1:
Update "Fixes" line
drivers/vdpa/vdpa_sim/vdpa_sim.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/vdpa/vdpa_sim/vdpa_sim.c +0
-0@@ -66,7 +66,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) {struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
Quoted 17 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c static void vdpasim_vq_reset(struct vdpasim *vdpasim, · line 89
Quoted 11 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c +2
-2- vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features, VDPASIM_QUEUE_MAX, false, (struct vring_desc *)(uintptr_t)vq->desc_addr, (struct vring_avail *)@@ -86,7 +86,7 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, vq->device_addr =0 ; vq->cb =NULL ; vq->private =NULL ; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features,
vdpasim_vq_reset()is called while resetting the device invdpasim_reset()where we also setvdpasim->features = 0after resetting the vqs, so maybe it's better to use the supported features here, since the negotiated ones are related to the previous instance.
I don't think using supported features is valid. Better to make sure vringh_init_iotlb() is called after the features have been negotiated.
Quoted 3 lines
Thanks,
Stefano
Quoted 40 lines · Eli Cohen
Quoted 21 lines · Stefano Garzarella
Quoted 20 lines · Eli Cohen
When calling
vringh_init_iotlb(), use the negotiated features which might be different than the supported features.Fixes 2c53d0f64c06f ("vdpasim: vDPA device simulator")Signed-off-by Eli Cohen <[email protected]>---
v0 --> v1:
Update "Fixes" line
drivers/vdpa/vdpa_sim/vdpa_sim.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/vdpa/vdpa_sim/vdpa_sim.c +0
-0@@ -66,7 +66,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) {struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];Quoted 17 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c static void vdpasim_vq_reset(struct vdpasim *vdpasim, · line 89
Quoted 11 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c +2
-2- vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features, VDPASIM_QUEUE_MAX, false, (struct vring_desc *)(uintptr_t)vq->desc_addr, (struct vring_avail *)@@ -86,7 +86,7 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, vq->device_addr =0 ; vq->cb =NULL ; vq->private =NULL ; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features,
vdpasim_vq_reset()is called while resetting the device invdpasim_reset()where we also setvdpasim->features = 0after resetting the vqs, so maybe it's better to use the supported features here, since the negotiated ones are related to the previous instance.
Quoted 3 lines
I don't think using supported features is valid. Better to make sure
vringh_init_iotlb()is called after the features have been negotiated.
I think the vringh_init_iotlb() call in vdpasim_vq_reset() is just used to clean up the struct vringh, then it will be initialized in vdpasim_queue_ready() when features have already been negotiated.
Maybe here we can pass 0 (to the features parameter) if we don't want to use the features supported by the device.
Thanks,
Stefano
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 49 lines · Stefano Garzarella
Quoted 40 lines · Eli Cohen
Quoted 21 lines · Stefano Garzarella
Quoted 20 lines · Eli Cohen
When calling
vringh_init_iotlb(), use the negotiated features which might be different than the supported features.Fixes 2c53d0f64c06f ("vdpasim: vDPA device simulator")Signed-off-by Eli Cohen <[email protected]>---
v0 --> v1:
Update "Fixes" line
drivers/vdpa/vdpa_sim/vdpa_sim.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/vdpa/vdpa_sim/vdpa_sim.c +0
-0@@ -66,7 +66,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx) {struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];Quoted 17 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c static void vdpasim_vq_reset(struct vdpasim *vdpasim, · line 89
Quoted 11 lines
drivers/vdpa/vdpa_sim/vdpa_sim.c +2
-2- vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features, VDPASIM_QUEUE_MAX, false, (struct vring_desc *)(uintptr_t)vq->desc_addr, (struct vring_avail *)@@ -86,7 +86,7 @@ static void vdpasim_vq_reset(struct vdpasim *vdpasim, vq->device_addr =0 ; vq->cb =NULL ; vq->private =NULL ; - vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features, + vringh_init_iotlb(&vq->vring, vdpasim->features,
vdpasim_vq_reset()is called while resetting the device invdpasim_reset()where we also setvdpasim->features = 0after resetting the vqs, so maybe it's better to use the supported features here, since the negotiated ones are related to the previous instance.Quoted 3 lines
I don't think using supported features is valid. Better to make sure
vringh_init_iotlb()is called after the features have been negotiated.I think the
vringh_init_iotlb()call invdpasim_vq_reset()is just used to clean up thestruct vringh, then it will be initialized invdpasim_queue_ready()when features have already been negotiated.
Quoted 5 lines
Maybe here we can pass 0 (to the features parameter) if we don't want to use the features supported by the device.
Thanks,
Stefano
Eli? Maybe you can describe what is the observed bug the patch is trying to fix.
Thanks!
Signature · 1 line
MST