clear-pkgs-linux-iot-lts2018/0637-hyper_dmabuf-virtio-Ad...

46 lines
1.7 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-10-11 02:06:46 +08:00
From: Mateusz Polrola <mateuszx.potrola@intel.com>
Date: Thu, 20 Sep 2018 12:12:52 +0200
Subject: [PATCH] hyper_dmabuf/virtio: Adapt to the new state transition of VHM
requests
2018-10-11 02:06:46 +08:00
Instead of using two members (namely ''valid'' and ''processed''), the
new state transition uses a single member (i.e. ''processed) following the
transition pattern below.
FREE -> PENDING -> PROCESSING -> COMPLETE -> FREE -> ...
Additionally atomic operations should be used to access the state.
Signed-off-by: Mateusz Polrola <mateuszx.potrola@intel.com>
---
.../hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c b/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
2020-10-27 02:14:06 +08:00
index 51dd8ed8271a..400c6e702005 100644
2018-10-11 02:06:46 +08:00
--- a/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
+++ b/drivers/dma-buf/hyper_dmabuf/virtio/hyper_dmabuf_virtio_be_drv.c
@@ -179,15 +179,15 @@ static int virtio_be_handle_kick(int client_id, int req_cnt)
for (i = 0; i < fe_info->max_vcpu; ++i) {
req = &fe_info->req_buf[i];
- if (req->valid &&
- req->processed == REQ_STATE_PROCESSING &&
+ if (atomic_read(&req->processed) == REQ_STATE_PROCESSING &&
req->client == fe_info->client_id) {
if (req->reqs.pio_request.direction == REQUEST_READ)
req->reqs.pio_request.value = 0;
else
val = req->reqs.pio_request.value;
- req->processed = REQ_STATE_SUCCESS;
+ smp_mb();
+ atomic_set(&req->processed, REQ_STATE_COMPLETE);
acrn_ioreq_complete_request(fe_info->client_id, i);
}
}
--
https://clearlinux.org
2018-10-11 02:06:46 +08:00