]>
Commit | Line | Data |
---|---|---|
41193d5a SL |
1 | From f3a17153b46ee70eada6dd86ca35720ac0b84994 Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Fri, 9 Feb 2024 14:30:07 -0800 | |
4 | Subject: vdpa_sim: reset must not run | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Steve Sistare <steven.sistare@oracle.com> | |
10 | ||
11 | [ Upstream commit 9588e7fc511f9c55b9835f14916e90ab940061b7 ] | |
12 | ||
13 | vdpasim_do_reset sets running to true, which is wrong, as it allows | |
14 | vdpasim_kick_vq to post work requests before the device has been | |
15 | configured. To fix, do not set running until VIRTIO_CONFIG_S_DRIVER_OK | |
16 | is set. | |
17 | ||
18 | Fixes: 0c89e2a3a9d0 ("vdpa_sim: Implement suspend vdpa op") | |
19 | Signed-off-by: Steve Sistare <steven.sistare@oracle.com> | |
20 | Reviewed-by: Eugenio PĂ©rez <eperezma@redhat.com> | |
21 | Acked-by: Jason Wang <jasowang@redhat.com> | |
22 | Message-Id: <1707517807-137331-1-git-send-email-steven.sistare@oracle.com> | |
23 | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | |
24 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
25 | --- | |
26 | drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 ++- | |
27 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
28 | ||
29 | diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c | |
30 | index 61bde476cf9c8..e7fc25bfdd237 100644 | |
31 | --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c | |
32 | +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c | |
33 | @@ -120,7 +120,7 @@ static void vdpasim_do_reset(struct vdpasim *vdpasim) | |
34 | for (i = 0; i < vdpasim->dev_attr.nas; i++) | |
35 | vhost_iotlb_reset(&vdpasim->iommu[i]); | |
36 | ||
37 | - vdpasim->running = true; | |
38 | + vdpasim->running = false; | |
39 | spin_unlock(&vdpasim->iommu_lock); | |
40 | ||
41 | vdpasim->features = 0; | |
42 | @@ -513,6 +513,7 @@ static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) | |
43 | ||
44 | spin_lock(&vdpasim->lock); | |
45 | vdpasim->status = status; | |
46 | + vdpasim->running = (status & VIRTIO_CONFIG_S_DRIVER_OK) != 0; | |
47 | spin_unlock(&vdpasim->lock); | |
48 | } | |
49 | ||
50 | -- | |
51 | 2.43.0 | |
52 |