diff options
author | Alvaro Karsz <alvaro.karsz@solid-run.com> | 2023-04-17 11:38:53 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-04-21 03:02:35 -0400 |
commit | 51b6e6c1c8e382c50fe88a04e25d326ceff74f89 (patch) | |
tree | 82eff9d424fb529413bc56589d736c4e76144ae6 /drivers/vdpa | |
parent | 2c4e4a22a3b090e06191f8544d21e0e1d72ce518 (diff) |
vdpa/snet: implement kick_vq_with_data callback
Implement the kick_vq_with_data vDPA callback.
On kick, we pass the next available data to the DPU by writing it in
the kick offset.
Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
Message-Id: <20230417083853.375076-1-alvaro.karsz@solid-run.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vdpa')
-rw-r--r-- | drivers/vdpa/solidrun/snet_main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c index 7359599e09e4..da14d437af33 100644 --- a/drivers/vdpa/solidrun/snet_main.c +++ b/drivers/vdpa/solidrun/snet_main.c @@ -112,6 +112,18 @@ static void snet_kick_vq(struct vdpa_device *vdev, u16 idx) iowrite32(SNET_KICK_VAL, snet->vqs[idx]->kick_ptr); } +static void snet_kick_vq_with_data(struct vdpa_device *vdev, u32 data) +{ + struct snet *snet = vdpa_to_snet(vdev); + u16 idx = data & 0xFFFF; + + /* not ready - ignore */ + if (unlikely(!snet->vqs[idx]->ready)) + return; + + iowrite32((data & 0xFFFF0000) | SNET_KICK_VAL, snet->vqs[idx]->kick_ptr); +} + static void snet_set_vq_cb(struct vdpa_device *vdev, u16 idx, struct vdpa_callback *cb) { struct snet *snet = vdpa_to_snet(vdev); @@ -501,6 +513,7 @@ static const struct vdpa_config_ops snet_config_ops = { .set_vq_address = snet_set_vq_address, .set_vq_num = snet_set_vq_num, .kick_vq = snet_kick_vq, + .kick_vq_with_data = snet_kick_vq_with_data, .set_vq_cb = snet_set_vq_cb, .set_vq_ready = snet_set_vq_ready, .get_vq_ready = snet_get_vq_ready, |