2015-12-03 21:30:38 +00:00
|
|
|
/*-
|
|
|
|
* BSD LICENSE
|
|
|
|
*
|
2016-01-26 17:47:22 +00:00
|
|
|
* Copyright (c) Intel Corporation.
|
2015-12-03 21:30:38 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* * Neither the name of Intel Corporation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2017-05-02 18:18:25 +00:00
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
#include "ioat_internal.h"
|
|
|
|
|
2016-08-10 17:41:12 +00:00
|
|
|
#include "spdk/env.h"
|
2017-02-02 17:07:12 +00:00
|
|
|
#include "spdk/util.h"
|
2020-02-27 13:38:02 +00:00
|
|
|
#include "spdk/memory.h"
|
2016-08-12 16:13:33 +00:00
|
|
|
|
2016-11-07 22:10:28 +00:00
|
|
|
#include "spdk_internal/log.h"
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
struct ioat_driver {
|
2016-08-08 16:59:45 +00:00
|
|
|
pthread_mutex_t lock;
|
2016-02-11 19:31:35 +00:00
|
|
|
TAILQ_HEAD(, spdk_ioat_chan) attached_chans;
|
2015-12-03 21:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct ioat_driver g_ioat_driver = {
|
2016-08-08 16:59:45 +00:00
|
|
|
.lock = PTHREAD_MUTEX_INITIALIZER,
|
2016-02-03 19:57:51 +00:00
|
|
|
.attached_chans = TAILQ_HEAD_INITIALIZER(g_ioat_driver.attached_chans),
|
2015-12-03 21:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static uint64_t
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_get_chansts(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2015-12-10 23:56:12 +00:00
|
|
|
return spdk_mmio_read_8(&ioat->regs->chansts);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_write_chancmp(struct spdk_ioat_chan *ioat, uint64_t addr)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2015-12-10 23:56:12 +00:00
|
|
|
spdk_mmio_write_8(&ioat->regs->chancmp, addr);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_write_chainaddr(struct spdk_ioat_chan *ioat, uint64_t addr)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2015-12-10 23:56:12 +00:00
|
|
|
spdk_mmio_write_8(&ioat->regs->chainaddr, addr);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_suspend(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
ioat->regs->chancmd = SPDK_IOAT_CHANCMD_SUSPEND;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_reset(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
ioat->regs->chancmd = SPDK_IOAT_CHANCMD_RESET;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_reset_pending(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
uint8_t cmd;
|
|
|
|
|
|
|
|
cmd = ioat->regs->chancmd;
|
2016-02-11 17:39:28 +00:00
|
|
|
return (cmd & SPDK_IOAT_CHANCMD_RESET) == SPDK_IOAT_CHANCMD_RESET;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_map_pci_bar(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
int regs_bar, rc;
|
|
|
|
void *addr;
|
2016-08-08 22:57:49 +00:00
|
|
|
uint64_t phys_addr, size;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
regs_bar = 0;
|
2016-08-08 22:57:49 +00:00
|
|
|
rc = spdk_pci_device_map_bar(ioat->device, regs_bar, &addr, &phys_addr, &size);
|
2015-12-03 21:30:38 +00:00
|
|
|
if (rc != 0 || addr == NULL) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("pci_device_map_range failed with error code %d\n",
|
|
|
|
rc);
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-02-11 17:39:28 +00:00
|
|
|
ioat->regs = (volatile struct spdk_ioat_registers *)addr;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_unmap_pci_bar(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
void *addr = (void *)ioat->regs;
|
|
|
|
|
|
|
|
if (addr) {
|
2016-08-08 22:57:49 +00:00
|
|
|
rc = spdk_pci_device_unmap_bar(ioat->device, 0, addr);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint32_t
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_get_active(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
return (ioat->head - ioat->tail) & ((1 << ioat->ring_size_order) - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_get_ring_space(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
return (1 << ioat->ring_size_order) - ioat_get_active(ioat) - 1;
|
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
static uint32_t
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_get_ring_index(struct spdk_ioat_chan *ioat, uint32_t index)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2015-12-08 17:34:30 +00:00
|
|
|
return index & ((1 << ioat->ring_size_order) - 1);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_get_ring_entry(struct spdk_ioat_chan *ioat, uint32_t index,
|
2015-12-08 17:34:30 +00:00
|
|
|
struct ioat_descriptor **desc,
|
2016-02-11 17:39:28 +00:00
|
|
|
union spdk_ioat_hw_desc **hw_desc)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2015-12-08 17:34:30 +00:00
|
|
|
uint32_t i = ioat_get_ring_index(ioat, index);
|
|
|
|
|
|
|
|
*desc = &ioat->ring[i];
|
|
|
|
*hw_desc = &ioat->hw_ring[i];
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_submit_single(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
ioat->head++;
|
|
|
|
}
|
|
|
|
|
2019-02-15 23:00:56 +00:00
|
|
|
void
|
|
|
|
spdk_ioat_flush(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2019-02-15 23:38:23 +00:00
|
|
|
uint32_t index = ioat_get_ring_index(ioat, ioat->head - 1);
|
|
|
|
union spdk_ioat_hw_desc *hw_desc;
|
|
|
|
|
|
|
|
hw_desc = &ioat->hw_ring[index];
|
|
|
|
hw_desc->dma.u.control.completion_update = 1;
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat->regs->dmacount = (uint16_t)ioat->head;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ioat_descriptor *
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_prep_null(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
struct ioat_descriptor *desc;
|
2016-02-11 17:39:28 +00:00
|
|
|
union spdk_ioat_hw_desc *hw_desc;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (ioat_get_ring_space(ioat) < 1) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
ioat_get_ring_entry(ioat, ioat->head, &desc, &hw_desc);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2015-12-29 18:10:58 +00:00
|
|
|
hw_desc->dma.u.control_raw = 0;
|
2016-02-11 17:39:28 +00:00
|
|
|
hw_desc->dma.u.control.op = SPDK_IOAT_OP_COPY;
|
2015-12-29 18:10:58 +00:00
|
|
|
hw_desc->dma.u.control.null = 1;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2015-12-29 18:10:58 +00:00
|
|
|
hw_desc->dma.size = 8;
|
|
|
|
hw_desc->dma.src_addr = 0;
|
|
|
|
hw_desc->dma.dest_addr = 0;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
desc->callback_fn = NULL;
|
|
|
|
desc->callback_arg = NULL;
|
|
|
|
|
|
|
|
ioat_submit_single(ioat);
|
|
|
|
|
|
|
|
return desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ioat_descriptor *
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_prep_copy(struct spdk_ioat_chan *ioat, uint64_t dst,
|
2015-12-03 21:30:38 +00:00
|
|
|
uint64_t src, uint32_t len)
|
|
|
|
{
|
|
|
|
struct ioat_descriptor *desc;
|
2016-02-11 17:39:28 +00:00
|
|
|
union spdk_ioat_hw_desc *hw_desc;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2016-08-08 20:55:27 +00:00
|
|
|
assert(len <= ioat->max_xfer_size);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (ioat_get_ring_space(ioat) < 1) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
ioat_get_ring_entry(ioat, ioat->head, &desc, &hw_desc);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2015-12-29 18:10:58 +00:00
|
|
|
hw_desc->dma.u.control_raw = 0;
|
2016-02-11 17:39:28 +00:00
|
|
|
hw_desc->dma.u.control.op = SPDK_IOAT_OP_COPY;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2015-12-29 18:10:58 +00:00
|
|
|
hw_desc->dma.size = len;
|
|
|
|
hw_desc->dma.src_addr = src;
|
|
|
|
hw_desc->dma.dest_addr = dst;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
desc->callback_fn = NULL;
|
|
|
|
desc->callback_arg = NULL;
|
|
|
|
|
|
|
|
ioat_submit_single(ioat);
|
|
|
|
|
|
|
|
return desc;
|
|
|
|
}
|
|
|
|
|
2016-01-29 08:01:43 +00:00
|
|
|
static struct ioat_descriptor *
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_prep_fill(struct spdk_ioat_chan *ioat, uint64_t dst,
|
2016-01-29 08:01:43 +00:00
|
|
|
uint64_t fill_pattern, uint32_t len)
|
|
|
|
{
|
|
|
|
struct ioat_descriptor *desc;
|
2016-02-11 17:39:28 +00:00
|
|
|
union spdk_ioat_hw_desc *hw_desc;
|
2016-01-29 08:01:43 +00:00
|
|
|
|
2016-08-08 20:55:27 +00:00
|
|
|
assert(len <= ioat->max_xfer_size);
|
2016-01-29 08:01:43 +00:00
|
|
|
|
|
|
|
if (ioat_get_ring_space(ioat) < 1) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ioat_get_ring_entry(ioat, ioat->head, &desc, &hw_desc);
|
|
|
|
|
|
|
|
hw_desc->fill.u.control_raw = 0;
|
2016-02-11 17:39:28 +00:00
|
|
|
hw_desc->fill.u.control.op = SPDK_IOAT_OP_FILL;
|
2016-01-29 08:01:43 +00:00
|
|
|
|
|
|
|
hw_desc->fill.size = len;
|
|
|
|
hw_desc->fill.src_data = fill_pattern;
|
|
|
|
hw_desc->fill.dest_addr = dst;
|
|
|
|
|
|
|
|
desc->callback_fn = NULL;
|
|
|
|
desc->callback_arg = NULL;
|
|
|
|
|
|
|
|
ioat_submit_single(ioat);
|
|
|
|
|
|
|
|
return desc;
|
|
|
|
}
|
|
|
|
|
2016-02-11 19:31:35 +00:00
|
|
|
static int ioat_reset_hw(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
int timeout;
|
|
|
|
uint64_t status;
|
|
|
|
uint32_t chanerr;
|
2018-08-13 01:30:05 +00:00
|
|
|
int rc;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
status = ioat_get_chansts(ioat);
|
|
|
|
if (is_ioat_active(status) || is_ioat_idle(status)) {
|
|
|
|
ioat_suspend(ioat);
|
|
|
|
}
|
|
|
|
|
|
|
|
timeout = 20; /* in milliseconds */
|
|
|
|
while (is_ioat_active(status) || is_ioat_idle(status)) {
|
2016-08-12 16:23:44 +00:00
|
|
|
spdk_delay_us(1000);
|
2015-12-03 21:30:38 +00:00
|
|
|
timeout--;
|
|
|
|
if (timeout == 0) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("timed out waiting for suspend\n");
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
status = ioat_get_chansts(ioat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear any outstanding errors.
|
|
|
|
* CHANERR is write-1-to-clear, so write the current CHANERR bits back to reset everything.
|
|
|
|
*/
|
|
|
|
chanerr = ioat->regs->chanerr;
|
|
|
|
ioat->regs->chanerr = chanerr;
|
|
|
|
|
2018-08-13 01:30:05 +00:00
|
|
|
if (ioat->regs->cbver < SPDK_IOAT_VER_3_3) {
|
|
|
|
rc = spdk_pci_device_cfg_read32(ioat->device, &chanerr,
|
|
|
|
SPDK_IOAT_PCI_CHANERR_INT_OFFSET);
|
|
|
|
if (rc) {
|
|
|
|
SPDK_ERRLOG("failed to read the internal channel error register\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
spdk_pci_device_cfg_write32(ioat->device, chanerr,
|
|
|
|
SPDK_IOAT_PCI_CHANERR_INT_OFFSET);
|
|
|
|
}
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat_reset(ioat);
|
|
|
|
|
|
|
|
timeout = 20;
|
|
|
|
while (ioat_reset_pending(ioat)) {
|
2016-08-12 16:23:44 +00:00
|
|
|
spdk_delay_us(1000);
|
2015-12-03 21:30:38 +00:00
|
|
|
timeout--;
|
|
|
|
if (timeout == 0) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("timed out waiting for reset\n");
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-17 17:56:00 +00:00
|
|
|
static int
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_process_channel_events(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
struct ioat_descriptor *desc;
|
2020-05-04 09:51:27 +00:00
|
|
|
uint64_t status, completed_descriptor, hw_desc_phys_addr, events_count = 0;
|
2015-12-08 17:34:30 +00:00
|
|
|
uint32_t tail;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (ioat->head == ioat->tail) {
|
2015-12-17 17:56:00 +00:00
|
|
|
return 0;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
status = *ioat->comp_update;
|
2016-02-11 17:39:28 +00:00
|
|
|
completed_descriptor = status & SPDK_IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (is_ioat_halted(status)) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("Channel halted (%x)\n", ioat->regs->chanerr);
|
2015-12-17 17:56:00 +00:00
|
|
|
return -1;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (completed_descriptor == ioat->last_seen) {
|
2015-12-17 17:56:00 +00:00
|
|
|
return 0;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
do {
|
|
|
|
tail = ioat_get_ring_index(ioat, ioat->tail);
|
|
|
|
desc = &ioat->ring[tail];
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (desc->callback_fn) {
|
|
|
|
desc->callback_fn(desc->callback_arg);
|
|
|
|
}
|
|
|
|
|
2018-07-03 17:15:41 +00:00
|
|
|
hw_desc_phys_addr = desc->phys_addr;
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat->tail++;
|
2020-05-04 09:51:27 +00:00
|
|
|
events_count++;
|
2015-12-08 17:34:30 +00:00
|
|
|
} while (hw_desc_phys_addr != completed_descriptor);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
ioat->last_seen = hw_desc_phys_addr;
|
2020-05-04 09:51:27 +00:00
|
|
|
|
|
|
|
return events_count;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
2018-09-18 13:19:12 +00:00
|
|
|
static void
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_channel_destruct(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
ioat_unmap_pci_bar(ioat);
|
|
|
|
|
|
|
|
if (ioat->ring) {
|
|
|
|
free(ioat->ring);
|
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
if (ioat->hw_ring) {
|
2019-04-05 09:02:14 +00:00
|
|
|
spdk_free(ioat->hw_ring);
|
2015-12-08 17:34:30 +00:00
|
|
|
}
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
if (ioat->comp_update) {
|
2019-04-05 09:02:14 +00:00
|
|
|
spdk_free((void *)ioat->comp_update);
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat->comp_update = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-01 19:00:10 +00:00
|
|
|
uint32_t
|
|
|
|
spdk_ioat_get_max_descriptors(struct spdk_ioat_chan *ioat)
|
|
|
|
{
|
|
|
|
return 1 << ioat->ring_size_order;
|
|
|
|
}
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
static int
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat_channel_start(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
uint8_t xfercap, version;
|
|
|
|
uint64_t status;
|
|
|
|
int i, num_descriptors;
|
2016-08-08 22:57:49 +00:00
|
|
|
uint64_t comp_update_bus_addr = 0;
|
2018-07-03 17:15:41 +00:00
|
|
|
uint64_t phys_addr;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
if (ioat_map_pci_bar(ioat) != 0) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("ioat_map_pci_bar() failed\n");
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
version = ioat->regs->cbver;
|
2016-02-11 17:39:28 +00:00
|
|
|
if (version < SPDK_IOAT_VER_3_0) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG(" unsupported IOAT version %u.%u\n",
|
|
|
|
version >> 4, version & 0xF);
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-01-29 08:01:43 +00:00
|
|
|
/* Always support DMA copy */
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat->dma_capabilities = SPDK_IOAT_ENGINE_COPY_SUPPORTED;
|
2017-12-07 23:23:48 +00:00
|
|
|
if (ioat->regs->dmacapability & SPDK_IOAT_DMACAP_BFILL) {
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat->dma_capabilities |= SPDK_IOAT_ENGINE_FILL_SUPPORTED;
|
2017-12-07 23:23:48 +00:00
|
|
|
}
|
2015-12-03 21:30:38 +00:00
|
|
|
xfercap = ioat->regs->xfercap;
|
|
|
|
|
|
|
|
/* Only bits [4:0] are valid. */
|
|
|
|
xfercap &= 0x1f;
|
|
|
|
if (xfercap == 0) {
|
|
|
|
/* 0 means 4 GB max transfer size. */
|
|
|
|
ioat->max_xfer_size = 1ULL << 32;
|
|
|
|
} else if (xfercap < 12) {
|
2018-07-03 17:24:39 +00:00
|
|
|
/* XFERCAP must be at least 12 (4 KB) according to the spec. */
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("invalid XFERCAP value %u\n", xfercap);
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
ioat->max_xfer_size = 1U << xfercap;
|
|
|
|
}
|
|
|
|
|
2019-04-05 09:02:14 +00:00
|
|
|
ioat->comp_update = spdk_zmalloc(sizeof(*ioat->comp_update), SPDK_IOAT_CHANCMP_ALIGN,
|
|
|
|
NULL, SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
2015-12-03 21:30:38 +00:00
|
|
|
if (ioat->comp_update == NULL) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-03-15 12:39:08 +00:00
|
|
|
comp_update_bus_addr = spdk_vtophys((void *)ioat->comp_update, NULL);
|
|
|
|
if (comp_update_bus_addr == SPDK_VTOPHYS_ERROR) {
|
2019-04-05 09:02:14 +00:00
|
|
|
spdk_free((void *)ioat->comp_update);
|
2019-03-15 12:39:08 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat->ring_size_order = IOAT_DEFAULT_ORDER;
|
|
|
|
|
|
|
|
num_descriptors = 1 << ioat->ring_size_order;
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
ioat->ring = calloc(num_descriptors, sizeof(struct ioat_descriptor));
|
2015-12-03 21:30:38 +00:00
|
|
|
if (!ioat->ring) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-04-05 09:02:14 +00:00
|
|
|
ioat->hw_ring = spdk_zmalloc(num_descriptors * sizeof(union spdk_ioat_hw_desc), 64,
|
|
|
|
NULL, SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
2015-12-08 17:34:30 +00:00
|
|
|
if (!ioat->hw_ring) {
|
|
|
|
return -1;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
for (i = 0; i < num_descriptors; i++) {
|
2018-12-28 11:59:21 +00:00
|
|
|
phys_addr = spdk_vtophys(&ioat->hw_ring[i], NULL);
|
2018-07-03 17:15:41 +00:00
|
|
|
if (phys_addr == SPDK_VTOPHYS_ERROR) {
|
|
|
|
SPDK_ERRLOG("Failed to translate descriptor %u to physical address\n", i);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ioat->ring[i].phys_addr = phys_addr;
|
|
|
|
ioat->hw_ring[ioat_get_ring_index(ioat, i - 1)].generic.next = phys_addr;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ioat->head = 0;
|
|
|
|
ioat->tail = 0;
|
|
|
|
ioat->last_seen = 0;
|
|
|
|
|
|
|
|
ioat_reset_hw(ioat);
|
|
|
|
|
2016-02-11 17:39:28 +00:00
|
|
|
ioat->regs->chanctrl = SPDK_IOAT_CHANCTRL_ANY_ERR_ABORT_EN;
|
2015-12-03 21:30:38 +00:00
|
|
|
ioat_write_chancmp(ioat, comp_update_bus_addr);
|
2018-07-03 17:15:41 +00:00
|
|
|
ioat_write_chainaddr(ioat, ioat->ring[0].phys_addr);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
ioat_prep_null(ioat);
|
2019-02-15 23:00:56 +00:00
|
|
|
spdk_ioat_flush(ioat);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
i = 100;
|
|
|
|
while (i-- > 0) {
|
2016-08-12 16:23:44 +00:00
|
|
|
spdk_delay_us(100);
|
2015-12-03 21:30:38 +00:00
|
|
|
status = ioat_get_chansts(ioat);
|
2017-12-07 23:23:48 +00:00
|
|
|
if (is_ioat_idle(status)) {
|
2015-12-03 21:30:38 +00:00
|
|
|
break;
|
2017-12-07 23:23:48 +00:00
|
|
|
}
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_ioat_idle(status)) {
|
|
|
|
ioat_process_channel_events(ioat);
|
|
|
|
} else {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("could not start channel: status = %p\n error = %#x\n",
|
|
|
|
(void *)status, ioat->regs->chanerr);
|
2015-12-03 21:30:38 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-03 19:57:51 +00:00
|
|
|
/* Caller must hold g_ioat_driver.lock */
|
2016-02-11 19:31:35 +00:00
|
|
|
static struct spdk_ioat_chan *
|
2018-06-27 09:06:47 +00:00
|
|
|
ioat_attach(struct spdk_pci_device *device)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2018-03-02 19:49:36 +00:00
|
|
|
struct spdk_ioat_chan *ioat;
|
2015-12-03 21:30:38 +00:00
|
|
|
uint32_t cmd_reg;
|
|
|
|
|
2016-02-11 19:31:35 +00:00
|
|
|
ioat = calloc(1, sizeof(struct spdk_ioat_chan));
|
2015-12-03 21:30:38 +00:00
|
|
|
if (ioat == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable PCI busmaster. */
|
2016-08-08 22:57:49 +00:00
|
|
|
spdk_pci_device_cfg_read32(device, &cmd_reg, 4);
|
2015-12-03 21:30:38 +00:00
|
|
|
cmd_reg |= 0x4;
|
2016-08-08 22:57:49 +00:00
|
|
|
spdk_pci_device_cfg_write32(device, cmd_reg, 4);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
ioat->device = device;
|
|
|
|
|
|
|
|
if (ioat_channel_start(ioat) != 0) {
|
2015-12-08 17:34:30 +00:00
|
|
|
ioat_channel_destruct(ioat);
|
2015-12-03 21:30:38 +00:00
|
|
|
free(ioat);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ioat;
|
|
|
|
}
|
|
|
|
|
2016-02-03 19:57:51 +00:00
|
|
|
struct ioat_enum_ctx {
|
2016-02-11 19:31:35 +00:00
|
|
|
spdk_ioat_probe_cb probe_cb;
|
|
|
|
spdk_ioat_attach_cb attach_cb;
|
2016-02-03 19:57:51 +00:00
|
|
|
void *cb_ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This function must only be called while holding g_ioat_driver.lock */
|
|
|
|
static int
|
2016-02-03 21:36:26 +00:00
|
|
|
ioat_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
|
2016-02-03 19:57:51 +00:00
|
|
|
{
|
|
|
|
struct ioat_enum_ctx *enum_ctx = ctx;
|
2016-02-11 19:31:35 +00:00
|
|
|
struct spdk_ioat_chan *ioat;
|
2016-02-03 19:57:51 +00:00
|
|
|
|
|
|
|
/* Verify that this device is not already attached */
|
|
|
|
TAILQ_FOREACH(ioat, &g_ioat_driver.attached_chans, tailq) {
|
|
|
|
/*
|
|
|
|
* NOTE: This assumes that the PCI abstraction layer will use the same device handle
|
|
|
|
* across enumerations; we could compare by BDF instead if this is not true.
|
|
|
|
*/
|
|
|
|
if (pci_dev == ioat->device) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enum_ctx->probe_cb(enum_ctx->cb_ctx, pci_dev)) {
|
|
|
|
/*
|
|
|
|
* Since I/OAT init is relatively quick, just perform the full init during probing.
|
|
|
|
* If this turns out to be a bottleneck later, this can be changed to work like
|
|
|
|
* NVMe with a list of devices to initialize in parallel.
|
|
|
|
*/
|
|
|
|
ioat = ioat_attach(pci_dev);
|
|
|
|
if (ioat == NULL) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("ioat_attach() failed\n");
|
2016-02-03 19:57:51 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
TAILQ_INSERT_TAIL(&g_ioat_driver.attached_chans, ioat, tailq);
|
|
|
|
|
|
|
|
enum_ctx->attach_cb(enum_ctx->cb_ctx, pci_dev, ioat);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2016-02-11 19:31:35 +00:00
|
|
|
spdk_ioat_probe(void *cb_ctx, spdk_ioat_probe_cb probe_cb, spdk_ioat_attach_cb attach_cb)
|
2016-02-03 19:57:51 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
struct ioat_enum_ctx enum_ctx;
|
|
|
|
|
2016-08-08 16:59:45 +00:00
|
|
|
pthread_mutex_lock(&g_ioat_driver.lock);
|
2016-02-03 19:57:51 +00:00
|
|
|
|
|
|
|
enum_ctx.probe_cb = probe_cb;
|
|
|
|
enum_ctx.attach_cb = attach_cb;
|
|
|
|
enum_ctx.cb_ctx = cb_ctx;
|
|
|
|
|
2018-12-07 10:47:55 +00:00
|
|
|
rc = spdk_pci_enumerate(spdk_pci_ioat_get_driver(), ioat_enum_cb, &enum_ctx);
|
2016-02-03 19:57:51 +00:00
|
|
|
|
2016-08-08 16:59:45 +00:00
|
|
|
pthread_mutex_unlock(&g_ioat_driver.lock);
|
2016-02-03 19:57:51 +00:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2018-09-11 11:58:05 +00:00
|
|
|
void
|
2016-02-11 19:31:35 +00:00
|
|
|
spdk_ioat_detach(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
struct ioat_driver *driver = &g_ioat_driver;
|
|
|
|
|
|
|
|
/* ioat should be in the free list (not registered to a thread)
|
|
|
|
* when calling ioat_detach().
|
|
|
|
*/
|
2016-08-08 16:59:45 +00:00
|
|
|
pthread_mutex_lock(&driver->lock);
|
2016-02-03 19:57:51 +00:00
|
|
|
TAILQ_REMOVE(&driver->attached_chans, ioat, tailq);
|
2016-08-08 16:59:45 +00:00
|
|
|
pthread_mutex_unlock(&driver->lock);
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
ioat_channel_destruct(ioat);
|
|
|
|
free(ioat);
|
|
|
|
}
|
|
|
|
|
2017-09-16 00:17:57 +00:00
|
|
|
int
|
2019-02-15 23:24:31 +00:00
|
|
|
spdk_ioat_build_copy(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_cb cb_fn,
|
|
|
|
void *dst, const void *src, uint64_t nbytes)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
|
|
|
struct ioat_descriptor *last_desc;
|
|
|
|
uint64_t remaining, op_size;
|
|
|
|
uint64_t vdst, vsrc;
|
|
|
|
uint64_t vdst_page, vsrc_page;
|
|
|
|
uint64_t pdst_page, psrc_page;
|
|
|
|
uint32_t orig_head;
|
|
|
|
|
|
|
|
if (!ioat) {
|
2017-09-16 00:17:57 +00:00
|
|
|
return -EINVAL;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
orig_head = ioat->head;
|
|
|
|
|
|
|
|
vdst = (uint64_t)dst;
|
|
|
|
vsrc = (uint64_t)src;
|
2017-01-23 05:30:46 +00:00
|
|
|
vdst_page = vsrc_page = 0;
|
|
|
|
pdst_page = psrc_page = SPDK_VTOPHYS_ERROR;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
remaining = nbytes;
|
|
|
|
while (remaining) {
|
2017-01-23 05:30:46 +00:00
|
|
|
if (_2MB_PAGE(vsrc) != vsrc_page) {
|
|
|
|
vsrc_page = _2MB_PAGE(vsrc);
|
2018-12-28 11:59:21 +00:00
|
|
|
psrc_page = spdk_vtophys((void *)vsrc_page, NULL);
|
2017-01-23 05:30:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_2MB_PAGE(vdst) != vdst_page) {
|
|
|
|
vdst_page = _2MB_PAGE(vdst);
|
2018-12-28 11:59:21 +00:00
|
|
|
pdst_page = spdk_vtophys((void *)vdst_page, NULL);
|
2017-01-23 05:30:46 +00:00
|
|
|
}
|
2015-12-03 21:30:38 +00:00
|
|
|
op_size = remaining;
|
2019-01-07 12:05:17 +00:00
|
|
|
op_size = spdk_min(op_size, (VALUE_2MB - _2MB_OFFSET(vsrc)));
|
|
|
|
op_size = spdk_min(op_size, (VALUE_2MB - _2MB_OFFSET(vdst)));
|
2017-02-02 17:07:12 +00:00
|
|
|
op_size = spdk_min(op_size, ioat->max_xfer_size);
|
2015-12-03 21:30:38 +00:00
|
|
|
remaining -= op_size;
|
|
|
|
|
|
|
|
last_desc = ioat_prep_copy(ioat,
|
|
|
|
pdst_page + _2MB_OFFSET(vdst),
|
|
|
|
psrc_page + _2MB_OFFSET(vsrc),
|
|
|
|
op_size);
|
|
|
|
|
|
|
|
if (remaining == 0 || last_desc == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
vsrc += op_size;
|
|
|
|
vdst += op_size;
|
|
|
|
|
|
|
|
}
|
|
|
|
/* Issue null descriptor for null transfer */
|
|
|
|
if (nbytes == 0) {
|
|
|
|
last_desc = ioat_prep_null(ioat);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_desc) {
|
|
|
|
last_desc->callback_fn = cb_fn;
|
|
|
|
last_desc->callback_arg = cb_arg;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Ran out of descriptors in the ring - reset head to leave things as they were
|
|
|
|
* in case we managed to fill out any descriptors.
|
|
|
|
*/
|
|
|
|
ioat->head = orig_head;
|
2017-09-16 00:17:57 +00:00
|
|
|
return -ENOMEM;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 23:24:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spdk_ioat_submit_copy(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_cb cb_fn,
|
|
|
|
void *dst, const void *src, uint64_t nbytes)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = spdk_ioat_build_copy(ioat, cb_arg, cb_fn, dst, src, nbytes);
|
|
|
|
if (rc != 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2019-02-15 23:00:56 +00:00
|
|
|
spdk_ioat_flush(ioat);
|
2017-09-16 00:17:57 +00:00
|
|
|
return 0;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
2017-09-16 00:17:57 +00:00
|
|
|
int
|
2019-02-15 23:24:31 +00:00
|
|
|
spdk_ioat_build_fill(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_cb cb_fn,
|
|
|
|
void *dst, uint64_t fill_pattern, uint64_t nbytes)
|
2016-01-29 08:01:43 +00:00
|
|
|
{
|
|
|
|
struct ioat_descriptor *last_desc = NULL;
|
|
|
|
uint64_t remaining, op_size;
|
|
|
|
uint64_t vdst;
|
|
|
|
uint32_t orig_head;
|
|
|
|
|
|
|
|
if (!ioat) {
|
2017-09-16 00:17:57 +00:00
|
|
|
return -EINVAL;
|
2016-01-29 08:01:43 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 19:31:35 +00:00
|
|
|
if (!(ioat->dma_capabilities & SPDK_IOAT_ENGINE_FILL_SUPPORTED)) {
|
2016-08-12 16:13:33 +00:00
|
|
|
SPDK_ERRLOG("Channel does not support memory fill\n");
|
2016-01-29 08:01:43 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
orig_head = ioat->head;
|
|
|
|
|
|
|
|
vdst = (uint64_t)dst;
|
|
|
|
remaining = nbytes;
|
|
|
|
|
|
|
|
while (remaining) {
|
|
|
|
op_size = remaining;
|
2019-01-07 12:05:17 +00:00
|
|
|
op_size = spdk_min(op_size, (VALUE_2MB - _2MB_OFFSET(vdst)));
|
2017-02-02 17:07:12 +00:00
|
|
|
op_size = spdk_min(op_size, ioat->max_xfer_size);
|
2016-01-29 08:01:43 +00:00
|
|
|
remaining -= op_size;
|
|
|
|
|
|
|
|
last_desc = ioat_prep_fill(ioat,
|
2018-12-28 11:59:21 +00:00
|
|
|
spdk_vtophys((void *)vdst, NULL),
|
2016-01-29 08:01:43 +00:00
|
|
|
fill_pattern,
|
|
|
|
op_size);
|
|
|
|
|
|
|
|
if (remaining == 0 || last_desc == NULL) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
vdst += op_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (last_desc) {
|
|
|
|
last_desc->callback_fn = cb_fn;
|
|
|
|
last_desc->callback_arg = cb_arg;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Ran out of descriptors in the ring - reset head to leave things as they were
|
|
|
|
* in case we managed to fill out any descriptors.
|
|
|
|
*/
|
|
|
|
ioat->head = orig_head;
|
2017-09-16 00:17:57 +00:00
|
|
|
return -ENOMEM;
|
2016-01-29 08:01:43 +00:00
|
|
|
}
|
|
|
|
|
2019-02-15 23:24:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
spdk_ioat_submit_fill(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_cb cb_fn,
|
|
|
|
void *dst, uint64_t fill_pattern, uint64_t nbytes)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = spdk_ioat_build_fill(ioat, cb_arg, cb_fn, dst, fill_pattern, nbytes);
|
|
|
|
if (rc != 0) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2019-02-15 23:00:56 +00:00
|
|
|
spdk_ioat_flush(ioat);
|
2017-09-16 00:17:57 +00:00
|
|
|
return 0;
|
2016-01-29 08:01:43 +00:00
|
|
|
}
|
|
|
|
|
2016-02-11 19:31:35 +00:00
|
|
|
uint32_t
|
2016-03-10 18:07:32 +00:00
|
|
|
spdk_ioat_get_dma_capabilities(struct spdk_ioat_chan *ioat)
|
2016-01-29 08:01:43 +00:00
|
|
|
{
|
|
|
|
if (!ioat) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return ioat->dma_capabilities;
|
|
|
|
}
|
|
|
|
|
2016-02-11 19:31:35 +00:00
|
|
|
int
|
2016-03-10 18:07:32 +00:00
|
|
|
spdk_ioat_process_events(struct spdk_ioat_chan *ioat)
|
2015-12-03 21:30:38 +00:00
|
|
|
{
|
2016-03-10 18:07:32 +00:00
|
|
|
return ioat_process_channel_events(ioat);
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
2016-08-12 16:13:33 +00:00
|
|
|
|
2020-09-04 11:27:29 +00:00
|
|
|
SPDK_LOG_REGISTER_COMPONENT(ioat)
|