Skip to content

Commit

Permalink
fix running pointer test bugs
Browse files Browse the repository at this point in the history
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
  • Loading branch information
anandaravuri committed Dec 5, 2023
1 parent 26287ef commit b37c811
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
19 changes: 9 additions & 10 deletions samples/cxl_host_exerciser/cxl_he_cache_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,10 @@ class he_cache_cmd : public he_cmd {

node_count = FPGA_2MB_CACHE_LINES - 10;
cout << " linked list Node count:" << std::dec << node_count << endl;
node_count = 10;

// create linked list
if (!create_linked_list(host_virt_ptr, host_phy_ptr, data, node_count)) {
if (!create_linked_list(host_virt_ptr, host_phy_ptr, data,
node_count,HOSTMEM_BIAS)) {
cerr << "Failed to create linked list" << endl;
host_exe_->free_pinned_buffer(host_virt_ptr);
host_exe_->free_dsm();
Expand All @@ -1246,16 +1246,15 @@ class he_cache_cmd : public he_cmd {

node_count = FPGA_2MB_CACHE_LINES - 10;
cout << " linked list Node count:" << std::dec << node_count << endl;
node_count = 10;

// create linked list
if (!create_linked_list(fpga_virt_ptr, fpga_phy_ptr, data, node_count)) {
if (!create_linked_list(fpga_virt_ptr, fpga_phy_ptr, data,
node_count, FPGAMEM_HOST_BIAS)) {
cerr << "Failed to create linked list" << endl;
host_exe_->free_dsm();
host_exe_->free_pinned_buffer(fpga_virt_ptr);
return -1;
}
he_ctl_.bias_support = HOSTMEM_BIAS;
phy_ptr = fpga_phy_ptr;

} else {
Expand Down Expand Up @@ -1290,11 +1289,11 @@ class he_cache_cmd : public he_cmd {

node_count = 2*(FPGA_2MB_CACHE_LINES - 10);
cout << " linked list Node count:" << std::dec << node_count << endl;
node_count = 20;

// create linked list
if (!create_linked_list(host_virt_ptr, host_phy_ptr, data,
node_count, fpga_virt_ptr, fpga_phy_ptr)) {
node_count, HOSTMEM_BIAS, fpga_virt_ptr,
fpga_phy_ptr, FPGAMEM_HOST_BIAS)) {
cerr << "Failed to create linked list" << endl;
host_exe_->free_dsm();
host_exe_->free_pinned_buffer(fpga_virt_ptr);
Expand Down Expand Up @@ -1388,7 +1387,7 @@ class he_cache_cmd : public he_cmd {
}

he_rd_num_lines_.value = host_exe_->read64(HE_RD_NUM_LINES);
he_rd_num_lines_.max_count = 100000;
he_rd_num_lines_.max_count = INT_MAX/10000;
host_exe_->write64(HE_RD_NUM_LINES, he_rd_num_lines_.value);

cout << "HE_RD_NUM_LINES:" << std::hex << he_rd_num_lines_.value << endl;
Expand Down Expand Up @@ -1420,7 +1419,7 @@ class he_cache_cmd : public he_cmd {
usleep(HE_CACHE_TEST_SLEEP_INVL);
if (--timeout == 0) {
he_forcetestcmpl();
cout << "HE cache ping pong test time out error" << endl;
cerr << "HE cache ping pong test time out error" << endl;
host_exerciser_errors();
he_perf_counters();
host_exe_->free_dsm();
Expand All @@ -1433,7 +1432,7 @@ class he_cache_cmd : public he_cmd {
// wait for completion
if (!he_wait_test_completion()) {
he_forcetestcmpl();
cout << "HE Cache ping pong test time out error" << endl;
cerr << "HE Cache ping pong test time out error" << endl;
he_perf_counters();
host_exerciser_errors();
host_exe_->free_dsm();
Expand Down
16 changes: 10 additions & 6 deletions samples/cxl_host_exerciser/cxl_he_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#define HE_TEST_STARTED "Test started ......"
#define HE_PRTEST_SCENARIO "Pretest scenario started ......"
#define HE_PING_PONG "Ping ong test started ......"
#define HE_PING_PONG "Ping pong test started ......"
#define HE_RUNNING_POINTER "Running pointer test started ......"

#define PFN_MASK_SIZE 8
Expand Down Expand Up @@ -455,8 +455,9 @@ class he_cmd : public test_command {
}

bool create_linked_list(uint64_t *virt_ptr_a, uint64_t phy_ptr_a,
uint64_t data, uint64_t max_size,
uint64_t *virt_ptr_b = NULL, uint64_t phy_ptr_b = 0) {
uint64_t data, uint64_t max_size, he_bias_support bias_a = HOSTMEM_BIAS,
uint64_t *virt_ptr_b = NULL, uint64_t phy_ptr_b = 0,
he_bias_support bias_b = FPGAMEM_HOST_BIAS) {

uint64_t *temp_virt_ptr_a = virt_ptr_a;
uint64_t temp_phy_ptr_a = phy_ptr_a;
Expand All @@ -465,9 +466,9 @@ class he_cmd : public test_command {
uint64_t i = 0;
struct he_cache_running_ptr *temp_node = NULL;

host_exe_->logger_->debug("virt_ptr_a:0x{:x}", fmt::ptr(virt_ptr_a));
host_exe_->logger_->debug("virt_ptr_a:{:p}", fmt::ptr(virt_ptr_a));
host_exe_->logger_->debug("phy_ptr_a:0x{:x}", phy_ptr_a);
host_exe_->logger_->debug("virt_ptr_b:0x{:x}", fmt::ptr(virt_ptr_b));
host_exe_->logger_->debug("virt_ptr_b:{:p}", fmt::ptr(virt_ptr_b));
host_exe_->logger_->debug("phy_ptr_b:0x{:x}", phy_ptr_b);
host_exe_->logger_->debug("max_size:{0}", max_size);
host_exe_->logger_->debug("data:{:x}", data);
Expand All @@ -487,6 +488,7 @@ class he_cmd : public test_command {
temp_node->phy_next_ptr = temp_phy_ptr_a + 64;
temp_node->data = data;
temp_node->virt_next_ptr = (struct he_cache_running_ptr*)(temp_virt_ptr_a + 8);
temp_node->biasmode = bias_a;

temp_node++;
temp_phy_ptr_a = temp_phy_ptr_a + 64;
Expand Down Expand Up @@ -515,13 +517,15 @@ class he_cmd : public test_command {
if (which == 0) {
temp_node_a->phy_next_ptr = temp_phy_ptr_b;
temp_node_a->data = data;
temp_node_a->biasmode = bias_b;
temp_node_a->virt_next_ptr = temp_node_b;
++temp_node_a;
temp_phy_ptr_a += 64;

} else {
temp_node_b->phy_next_ptr = temp_phy_ptr_a;
temp_node_b->data = data;
temp_node_b->biasmode = bias_a;
temp_node_b->virt_next_ptr = temp_node_a;
++temp_node_b;
temp_phy_ptr_b += 64;
Expand All @@ -547,7 +551,7 @@ class he_cmd : public test_command {
struct he_cache_running_ptr* temp = NULL;
uint64_t i = 0;

host_exe_->logger_->debug("virt_ptr:0x{:x}", fmt::ptr(virt_ptr));
host_exe_->logger_->debug("virt_ptr:{:p}", fmt::ptr(virt_ptr));
host_exe_->logger_->debug("phy_ptr:0x{:x}", phy_ptr);
host_exe_->logger_->debug("max_size:{0}", max_size);
host_exe_->logger_->debug("data:{:x}", data);
Expand Down
11 changes: 9 additions & 2 deletions samples/cxl_host_exerciser/cxl_host_exerciser.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ typedef enum {
HOST_BIAS_NA = 0x1,
FPGAMEM_HOST_BIAS = 0x2,
FPGAMEM_DEVICE_BIAS = 0x3,
} he_bisa_support;
} he_bias_support;

const std::map<std::string, uint32_t> he_targets = {
{"host", HE_TARGET_HOST},
Expand Down Expand Up @@ -418,7 +418,14 @@ struct he_cache_running_ptr {
uint64_t phy_next_ptr;
uint64_t data;
he_cache_running_ptr *virt_next_ptr;
uint64_t rsvd[5];
uint64_t rsvd[4];
union {
uint64_t mode;
struct {
uint64_t rsvd_0_62 : 62;
uint64_t biasmode :2;
};
};
};


Expand Down

0 comments on commit b37c811

Please sign in to comment.