Revert "idxd: No longer set token configuration"

This reverts commit 3bacd6653d.

Change-Id: I8dbaffc9f50cf9627720667644496cdaf4e81c3f
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11723
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
paul luse 2022-02-23 16:48:56 -07:00 committed by Ben Walker
parent 0b034da148
commit 492d576795
3 changed files with 15 additions and 9 deletions

View File

@ -540,14 +540,14 @@ SPDK_STATIC_ASSERT(sizeof(struct idxd_registers) == 0xE0, "size mismatch");
union idxd_group_flags {
struct {
uint32_t tc_a : 3;
uint32_t tc_b : 3;
uint32_t reserved0 : 1;
uint32_t global_read_buffer_limit : 1;
uint32_t read_buffers_reserved : 8;
uint32_t reserved1 : 4;
uint32_t read_buffers_allowed : 8;
uint32_t reserved2 : 4;
uint32_t tc_a: 3;
uint32_t tc_b: 3;
uint32_t rsvd: 1;
uint32_t use_token_limit: 1;
uint32_t tokens_reserved: 8;
uint32_t rsvd2: 4;
uint32_t tokens_allowed: 8;
uint32_t rsvd3: 4;
};
uint32_t raw;
};

View File

@ -238,6 +238,10 @@ idxd_group_config(struct spdk_idxd_device *idxd)
for (i = 0; i < g_user_dev_cfg.num_groups; i++) {
idxd->groups[i].idxd = idxd;
idxd->groups[i].id = i;
/* Divide BW tokens evenly */
idxd->groups[i].grpcfg.flags.tokens_allowed =
user_idxd->registers.groupcap.read_bufs / g_user_dev_cfg.num_groups;
}
/*

View File

@ -41,6 +41,7 @@
#define FAKE_REG_SIZE 0x800
#define GRP_CFG_OFFSET 0x400
#define MAX_TOKENS 0x40
#define MAX_ARRAY_SIZE 0x20
SPDK_LOG_REGISTER_COMPONENT(idxd);
@ -171,6 +172,7 @@ test_idxd_group_config(void)
user_idxd.registers.groupcap.num_groups = g_user_dev_cfg.num_groups;
user_idxd.registers.enginecap.num_engines = g_user_dev_cfg.total_engines;
user_idxd.registers.wqcap.num_wqs = g_user_dev_cfg.total_wqs;
user_idxd.registers.groupcap.read_bufs = MAX_TOKENS;
user_idxd.grpcfg_offset = GRP_CFG_OFFSET;
rc = idxd_group_config(idxd);
@ -185,7 +187,7 @@ test_idxd_group_config(void)
/* wqe and engine arrays are indexed by group id and are bitmaps of assigned elements. */
CU_ASSERT(wqs[0] == 0x1);
CU_ASSERT(engines[0] == 0xf);
CU_ASSERT(flags[0].raw == 0);
CU_ASSERT(flags[0].tokens_allowed == MAX_TOKENS / g_user_dev_cfg.num_groups);
/* groups allocated by code under test. */
free(idxd->groups);