idxd: updates to WQ config routine to match updated spec
Using the latest DSA we aren't supposed to (a) touch WQ space that we aren't configuring and (b) touch WQ config fields that we are configuring even if we are configuring that WQ. So, this patch will read in initial values of only the number of desired WQs and update them accordingly before updating the HW. Also updates a few vars to use shorter local variables consistently. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I7641cdfc5ccc839e37a1d46d760248799a8fce1f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10981 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
af6d280247
commit
8a6c8ba9ae
@ -291,14 +291,21 @@ idxd_wq_config(struct spdk_user_idxd_device *user_idxd)
|
||||
* and achieve optimal performance for common cases.
|
||||
*/
|
||||
idxd->chan_per_device = (idxd->total_wq_size >= 128) ? 8 : 4;
|
||||
idxd->queues = calloc(1, user_idxd->registers.wqcap.num_wqs * sizeof(struct idxd_wq));
|
||||
idxd->queues = calloc(1, g_user_dev_cfg.total_wqs * sizeof(struct idxd_wq));
|
||||
if (idxd->queues == NULL) {
|
||||
SPDK_ERRLOG("Failed to allocate queue memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < g_user_dev_cfg.total_wqs; i++) {
|
||||
queue = &user_idxd->idxd.queues[i];
|
||||
queue = &idxd->queues[i];
|
||||
/* Per spec we need to read in existing values first so we don't zero out something we
|
||||
* didn't touch when we write the cfg register out below.
|
||||
*/
|
||||
for (j = 0 ; j < (sizeof(union idxd_wqcfg) / sizeof(uint32_t)); j++) {
|
||||
queue->wqcfg.raw[j] = _idxd_read_4(idxd,
|
||||
user_idxd->wqcfg_offset + i * wqcap_size + j * sizeof(uint32_t));
|
||||
}
|
||||
queue->wqcfg.wq_size = wq_size;
|
||||
queue->wqcfg.mode = WQ_MODE_DEDICATED;
|
||||
queue->wqcfg.max_batch_shift = LOG2_WQ_MAX_BATCH;
|
||||
@ -307,14 +314,14 @@ idxd_wq_config(struct spdk_user_idxd_device *user_idxd)
|
||||
queue->wqcfg.priority = WQ_PRIORITY_1;
|
||||
|
||||
/* Not part of the config struct */
|
||||
queue->idxd = &user_idxd->idxd;
|
||||
queue->idxd = idxd;
|
||||
queue->group = &idxd->groups[i % g_user_dev_cfg.num_groups];
|
||||
}
|
||||
|
||||
/*
|
||||
* Now write the work queue config to the device for all wq space
|
||||
* Now write the work queue config to the device for configured queues
|
||||
*/
|
||||
for (i = 0 ; i < user_idxd->registers.wqcap.num_wqs; i++) {
|
||||
for (i = 0 ; i < g_user_dev_cfg.total_wqs; i++) {
|
||||
queue = &idxd->queues[i];
|
||||
for (j = 0 ; j < (sizeof(union idxd_wqcfg) / sizeof(uint32_t)); j++) {
|
||||
_idxd_write_4(idxd, user_idxd->wqcfg_offset + i * wqcap_size + j * sizeof(uint32_t),
|
||||
|
Loading…
Reference in New Issue
Block a user