| 151 | } |
| 152 | |
| 153 | static int |
| 154 | modern_setup_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq) |
| 155 | { |
| 156 | uint64_t desc_addr, avail_addr, used_addr; |
| 157 | uint16_t notify_off; |
| 158 | |
| 159 | if (!check_vq_phys_addr_ok(vq)) |
| 160 | return -1; |
| 161 | |
| 162 | desc_addr = vq->vq_ring_mem; |
| 163 | avail_addr = desc_addr + vq->vq_nentries * sizeof(struct vring_desc); |
| 164 | used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct vring_avail, |
| 165 | ring[vq->vq_nentries]), |
| 166 | VIRTIO_PCI_VRING_ALIGN); |
| 167 | |
| 168 | rte_write16(vq->vq_queue_index, &hw->common_cfg->queue_select); |
| 169 | |
| 170 | io_write64_twopart(desc_addr, &hw->common_cfg->queue_desc_lo, |
| 171 | &hw->common_cfg->queue_desc_hi); |
| 172 | io_write64_twopart(avail_addr, &hw->common_cfg->queue_avail_lo, |
| 173 | &hw->common_cfg->queue_avail_hi); |
| 174 | io_write64_twopart(used_addr, &hw->common_cfg->queue_used_lo, |
| 175 | &hw->common_cfg->queue_used_hi); |
| 176 | |
| 177 | notify_off = rte_read16(&hw->common_cfg->queue_notify_off); |
| 178 | vq->notify_addr = (void *)((uint8_t *)hw->notify_base + |
| 179 | notify_off * hw->notify_off_multiplier); |
| 180 | |
| 181 | rte_write16(1, &hw->common_cfg->queue_enable); |
| 182 | |
| 183 | VIRTIO_CRYPTO_INIT_LOG_DBG("queue %u addresses:", vq->vq_queue_index); |
| 184 | VIRTIO_CRYPTO_INIT_LOG_DBG("\t desc_addr: %" PRIx64, desc_addr); |
| 185 | VIRTIO_CRYPTO_INIT_LOG_DBG("\t aval_addr: %" PRIx64, avail_addr); |
| 186 | VIRTIO_CRYPTO_INIT_LOG_DBG("\t used_addr: %" PRIx64, used_addr); |
| 187 | VIRTIO_CRYPTO_INIT_LOG_DBG("\t notify addr: %p (notify offset: %u)", |
| 188 | vq->notify_addr, notify_off); |
| 189 | |
| 190 | return 0; |
| 191 | } |
| 192 | |
| 193 | static void |
| 194 | modern_del_queue(struct virtio_crypto_hw *hw, struct virtqueue *vq) |
nothing calls this directly
no test coverage detected