s390/virtio_ccw: fix config change notifications
Subsystems (4)
Halil Pasic
maintainerPATCH 1/1 s390/virtio_ccw: fix config change notifications
Commit e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API") broke configuration change notifications for virtio-ccw by putting the DMA address of *indicatorp directly into ccw->cda disregarding the fact that if !!(vcdev->is_thinint) then the function virtio_ccw_register_adapter_ind() will overwrite that ccw->cda value with the address of the virtio_thinint_area so it can actually set up the adapter interrupts via CCW_CMD_SET_IND_ADAPTER. Thus we end up pointing to the wrong object for both CCW_CMD_SET_IND if setting up the adapter interrupts fails, and for CCW_CMD_SET_CONF_IND regardless whether it succeeds or fails.
To fix this, let us save away the dma address of *indicatorp in a local variable, and copy it to ccw->cda after the "vcdev->is_thinint" branch.
---
I know that checkpatch.pl complains about a missing 'Closes' tag. Unfortunately I don't have an appropriate URL at hand. @Sebastian, @Boqiao: do you have any suggetions?
--- drivers/s390/virtio/virtio_ccw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/virtio/virtio_ccw.c +3 -1
@@ -698,6 +698,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,dma64_t *indicatorp =NULL ;int ret, i, queue_idx =0 ;struct ccw1 *ccw; +dma32_t indicatorp_dma =0 ; ccw =ccw_device_dma_zalloc (vcdev->cdev,sizeof (*ccw),NULL );if (!ccw)
@@ -725,7 +726,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,*/ indicatorp =ccw_device_dma_zalloc (vcdev->cdev,sizeof (*indicatorp), - &ccw->cda); + &indicatorp_dma);if (!indicatorp) goto out; *indicatorp =indicators_dma (vcdev);
@@ -735,6 +736,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,/* no error, just fall back to legacy interrupts */ vcdev->is_thinint = false; } + ccw->cda = indicatorp_dma;if (!vcdev->is_thinint) {/* Register queue indicators with host. */ *indicators (vcdev) =0 ;
base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670
Signature · 1 line
2.40.1
Quoted 14 lines · Halil Pasic
Commit
e3e9bda38e6d("s390/virtio_ccw: use DMA handle from DMA API") broke configuration change notifications for virtio-ccw by putting the DMA address of *indicatorp directly intoccw->cdadisregarding the fact that if !!(vcdev->is_thinint) then the functionvirtio_ccw_register_adapter_ind()will overwrite thatccw->cdavalue with the address of thevirtio_thinint_areaso it can actually set up the adapter interrupts viaCCW_CMD_SET_IND_ADAPTER. Thus we end up pointing to the wrong object for bothCCW_CMD_SET_INDif setting up the adapter interrupts fails, and forCCW_CMD_SET_CONF_INDregardless whether it succeeds or fails.To fix this, let us save away the dma address of *indicatorp in a local variable, and copy it to
ccw->cdaafter the "vcdev->is_thinint" branch.
Quoted 8 lines
Reported-by Boqiao Fu <[email protected]>Reported-by Sebastian Mitterle <[email protected]>Fixes e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API")Signed-off-by Halil Pasic <[email protected]>---
I know that checkpatch.pl complains about a missing 'Closes' tag. Unfortunately I don't have an appropriate URL at hand. @Sebastian, @Boqiao: do you have any suggetions?
?
Anyway, I've tested the patch and it indeed fixes the problem with virtio-balloon and the link state for me:
Halil Pasic
maintainerQuoted 24 lines · On Wed, 12 Jun 2024 16:04:15 +0200 Thomas Huth <[email protected]> wrote:
Quoted 14 lines · Halil Pasic
Commit
e3e9bda38e6d("s390/virtio_ccw: use DMA handle from DMA API") broke configuration change notifications for virtio-ccw by putting the DMA address of *indicatorp directly intoccw->cdadisregarding the fact that if !!(vcdev->is_thinint) then the functionvirtio_ccw_register_adapter_ind()will overwrite thatccw->cdavalue with the address of thevirtio_thinint_areaso it can actually set up the adapter interrupts viaCCW_CMD_SET_IND_ADAPTER. Thus we end up pointing to the wrong object for bothCCW_CMD_SET_INDif setting up the adapter interrupts fails, and forCCW_CMD_SET_CONF_INDregardless whether it succeeds or fails.To fix this, let us save away the dma address of *indicatorp in a local variable, and copy it to
ccw->cdaafter the "vcdev->is_thinint" branch.Quoted 8 lines
Reported-by Boqiao Fu <[email protected]>Reported-by Sebastian Mitterle <[email protected]>Fixes e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API")Signed-off-by Halil Pasic <[email protected]>---
I know that checkpatch.pl complains about a missing 'Closes' tag. Unfortunately I don't have an appropriate URL at hand. @Sebastian, @Boqiao: do you have any suggetions?
Quoted 2 lines
?
Yep! That is a public bug tracker bug. Qualifies! @Vasily: Can you guys pick hat one up when picking the patch?
Quoted 6 lines
Anyway, I've tested the patch and it indeed fixes the problem with virtio-balloon and the link state for me:
Tested-by Thomas Huth <[email protected]>
Thanks!
Vasily Gorbik
maintainerQuoted 27 lines · Halil Pasic
Quoted 24 lines · On Wed, 12 Jun 2024 16:04:15 +0200 Thomas Huth <[email protected]> wrote:
Quoted 22 lines · Halil Pasic
Commit
e3e9bda38e6d("s390/virtio_ccw: use DMA handle from DMA API") broke configuration change notifications for virtio-ccw by putting the DMA address of *indicatorp directly intoccw->cdadisregarding the fact that if !!(vcdev->is_thinint) then the functionvirtio_ccw_register_adapter_ind()will overwrite thatccw->cdavalue with the address of thevirtio_thinint_areaso it can actually set up the adapter interrupts viaCCW_CMD_SET_IND_ADAPTER. Thus we end up pointing to the wrong object for bothCCW_CMD_SET_INDif setting up the adapter interrupts fails, and forCCW_CMD_SET_CONF_INDregardless whether it succeeds or fails.To fix this, let us save away the dma address of *indicatorp in a local variable, and copy it to
ccw->cdaafter the "vcdev->is_thinint" branch.Reported-by Boqiao Fu <[email protected]>Reported-by Sebastian Mitterle <[email protected]>Fixes e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API")Signed-off-by Halil Pasic <[email protected]>---
I know that checkpatch.pl complains about a missing 'Closes' tag. Unfortunately I don't have an appropriate URL at hand. @Sebastian, @Boqiao: do you have any suggetions?
Quoted 5 lines
Quoted 2 lines
?
Yep! That is a public bug tracker bug. Qualifies! @Vasily: Can you guys pick hat one up when picking the patch?
Sure, applied. Thanks!
Quoted 23 lines · Halil Pasic
Commit
e3e9bda38e6d("s390/virtio_ccw: use DMA handle from DMA API") broke configuration change notifications for virtio-ccw by putting the
DMA address of *indicatorp directly intoccw->cdadisregarding the fact
that if !!(vcdev->is_thinint) then the functionvirtio_ccw_register_adapter_ind()will overwrite thatccw->cdavalue with the address of thevirtio_thinint_areaso it can actually set up the adapter interrupts via CCW_CMD_SET_IND_ADAPTER. Thus we end up pointing to the wrong object for bothCCW_CMD_SET_INDif setting up the
adapter interrupts fails, and forCCW_CMD_SET_CONF_INDregardless whether it succeeds or fails.To fix this, let us save away the dma address of *indicatorp in a local
variable, and copy it toccw->cdaafter the "vcdev->is_thinint" branch.Reported-by Boqiao Fu <[email protected]>Reported-by Sebastian Mitterle <[email protected]>Fixes e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API")Signed-off-by Halil Pasic <[email protected]>
Quoted 7 lines
---
I know that checkpatch.pl complains about a missing 'Closes' tag. Unfortunately I don't have an appropriate URL at hand. @Sebastian, @Boqiao: do you have any suggetions?
---
drivers/s390/virtio/virtio_ccw.c | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)