Commit ee46b715 authored by Sujatha Banoth's avatar Sujatha Banoth

QDMA Linux Driver 2020.2 Patches

MM Channel configuration
Keyhole feature support
resolve the page allocation issues
parent 5c214bb4
...@@ -180,6 +180,10 @@ struct io_info { ...@@ -180,6 +180,10 @@ struct io_info {
unsigned int pipe_flow_id; unsigned int pipe_flow_id;
unsigned int pipe_slr_id; unsigned int pipe_slr_id;
unsigned int pipe_tdest; unsigned int pipe_tdest;
unsigned int mm_chnl;
int keyhole_en;
unsigned int aperture_sz;
unsigned int offset;
#ifdef DEBUG #ifdef DEBUG
unsigned long long total_nodes; unsigned long long total_nodes;
unsigned long long freed_nodes; unsigned long long freed_nodes;
...@@ -203,10 +207,14 @@ struct list_head { ...@@ -203,10 +207,14 @@ struct list_head {
static unsigned int *io_exit = 0; static unsigned int *io_exit = 0;
int io_exit_id; int io_exit_id;
static unsigned int mm_chnl = 0;
static unsigned int force_exit = 0; static unsigned int force_exit = 0;
static unsigned int num_q = 0; static unsigned int num_q = 0;
static unsigned int pkt_sz = 0; static unsigned int pkt_sz = 0;
static unsigned int num_pkts; static unsigned int num_pkts;
static int keyhole_en = 0;
static unsigned int aperture_sz = 0;
static unsigned int offset = 0;
static unsigned int tsecs = 0; static unsigned int tsecs = 0;
struct io_info *info = NULL; struct io_info *info = NULL;
static char cfg_name[20]; static char cfg_name[20];
...@@ -615,6 +623,7 @@ static void create_thread_info(void) ...@@ -615,6 +623,7 @@ static void create_thread_info(void)
_info[base].q_ctrl = q_ctrl; _info[base].q_ctrl = q_ctrl;
_info[base].fd = last_fd; _info[base].fd = last_fd;
_info[base].pkt_burst = num_pkts; _info[base].pkt_burst = num_pkts;
_info[base].mm_chnl = mm_chnl;
_info[base].pkt_sz = pkt_sz; _info[base].pkt_sz = pkt_sz;
if ((_info[base].mode == Q_MODE_ST) && if ((_info[base].mode == Q_MODE_ST) &&
(stm_mode)) { (stm_mode)) {
...@@ -624,6 +633,12 @@ static void create_thread_info(void) ...@@ -624,6 +633,12 @@ static void create_thread_info(void)
_info[base].pipe_slr_id = pipe_slr_id_lst[(k*num_q) + i]; _info[base].pipe_slr_id = pipe_slr_id_lst[(k*num_q) + i];
_info[base].pipe_tdest = pipe_tdest_lst[(k*num_q) + i]; _info[base].pipe_tdest = pipe_tdest_lst[(k*num_q) + i];
} }
if (_info[base].mode == Q_MODE_MM &&
keyhole_en) {
_info[base].aperture_sz = aperture_sz;
}
_info[base].offset = offset;
#if THREADS_SET_CPU_AFFINITY #if THREADS_SET_CPU_AFFINITY
_info[base].cpu = h2c_cpu; _info[base].cpu = h2c_cpu;
#endif #endif
...@@ -649,6 +664,7 @@ static void create_thread_info(void) ...@@ -649,6 +664,7 @@ static void create_thread_info(void)
_info[base].qid = q_start + i; _info[base].qid = q_start + i;
_info[base].q_ctrl = q_ctrl; _info[base].q_ctrl = q_ctrl;
_info[base].pkt_burst = num_pkts; _info[base].pkt_burst = num_pkts;
_info[base].mm_chnl = mm_chnl;
_info[base].pkt_sz = pkt_sz; _info[base].pkt_sz = pkt_sz;
#if THREADS_SET_CPU_AFFINITY #if THREADS_SET_CPU_AFFINITY
_info[base].cpu = c2h_cpu; _info[base].cpu = c2h_cpu;
...@@ -830,12 +846,34 @@ static void parse_config_file(const char *cfg_fname) ...@@ -830,12 +846,34 @@ static void parse_config_file(const char *cfg_fname)
printf("Error: Invalid pkt_sz:%s\n", value); printf("Error: Invalid pkt_sz:%s\n", value);
goto prase_cleanup; goto prase_cleanup;
} }
} else if (!strncmp(config, "mm_chnl", 7)) {
if (arg_read_int(value, &mm_chnl)) {
printf("Error: Invalid mm_chnl:%s\n", value);
goto prase_cleanup;
}
} else if (!strncmp(config, "num_pkt", 7)) { } else if (!strncmp(config, "num_pkt", 7)) {
if (arg_read_int(value, &num_pkts)) { if (arg_read_int(value, &num_pkts)) {
printf("Error: Invalid num_pkt:%s\n", value); printf("Error: Invalid num_pkt:%s\n", value);
goto prase_cleanup; goto prase_cleanup;
} }
} else if (!strncmp(config, "no_memcpy", 9)) { } else if (!strncmp(config, "aperture_sz", 11)) {
if (arg_read_int(value, &aperture_sz)) {
printf("Error: Invalid aperture size:%s\n", value);
goto prase_cleanup;
}
} else if (!strncmp(config, "offset", 6)) {
if (arg_read_int(value, &offset)) {
printf("Error: Invalid aperture offset:%s\n", value);
goto prase_cleanup;
}
}else if (!strncmp(config, "keyhole_en", 7)) {
if (arg_read_int(value, &keyhole_en)) {
printf("Error: Invalid keyhole option:%s\n", value);
goto prase_cleanup;
}
}
else if (!strncmp(config, "no_memcpy", 9)) {
if (arg_read_int(value, &no_memcpy)) { if (arg_read_int(value, &no_memcpy)) {
printf("Error: Invalid no_memcpy:%s\n", value); printf("Error: Invalid no_memcpy:%s\n", value);
goto prase_cleanup; goto prase_cleanup;
...@@ -945,6 +983,7 @@ static void parse_config_file(const char *cfg_fname) ...@@ -945,6 +983,7 @@ static void parse_config_file(const char *cfg_fname)
} }
} }
fclose(fp); fclose(fp);
if (vf_perf == 0) { if (vf_perf == 0) {
dmactl_dev_prefix_str = pf_dmactl_prefix_str; dmactl_dev_prefix_str = pf_dmactl_prefix_str;
...@@ -1421,6 +1460,19 @@ static int qdma_prepare_q_start(struct xcmd_info *xcmd, ...@@ -1421,6 +1460,19 @@ static int qdma_prepare_q_start(struct xcmd_info *xcmd,
qparm->flags |= XNL_F_PFETCH_EN; qparm->flags |= XNL_F_PFETCH_EN;
} }
if (info->dir == Q_MODE_MM) {
qparm->mm_channel = info->mm_chnl;
f_arg_set |= 1 <<QPARM_MM_CHANNEL;
}
if ((info->dir == Q_DIR_H2C) && (info->mode == Q_MODE_MM)) {
if (keyhole_en) {
qparm->aperture_sz = info->aperture_sz;
f_arg_set |= 1 << QPARM_KEYHOLE_EN;
}
}
qparm->flags |= (XNL_F_CMPL_STATUS_EN | XNL_F_CMPL_STATUS_ACC_EN | qparm->flags |= (XNL_F_CMPL_STATUS_EN | XNL_F_CMPL_STATUS_ACC_EN |
XNL_F_CMPL_STATUS_PEND_CHK | XNL_F_CMPL_STATUS_DESC_EN | XNL_F_CMPL_STATUS_PEND_CHK | XNL_F_CMPL_STATUS_DESC_EN |
XNL_F_FETCH_CREDIT); XNL_F_FETCH_CREDIT);
...@@ -1815,13 +1867,13 @@ static void *io_thread(void *argp) ...@@ -1815,13 +1867,13 @@ static void *io_thread(void *argp)
_info->fd, _info->fd,
iov, iov,
iovcnt, iovcnt,
0); offset);
} else { } else {
io_prep_preadv(io_list[0], io_prep_preadv(io_list[0],
_info->fd, _info->fd,
iov, iov,
iovcnt, iovcnt,
0); offset);
} }
ret = io_submit(node->ctxt, 1, io_list); ret = io_submit(node->ctxt, 1, io_list);
......
...@@ -362,8 +362,8 @@ extern "C" { ...@@ -362,8 +362,8 @@ extern "C" {
#define QDMA_OFFSET_GLBL2_PF_VF_BARLITE_EXT 0x110 #define QDMA_OFFSET_GLBL2_PF_VF_BARLITE_EXT 0x110
#define QDMA_OFFSET_GLBL2_CHANNEL_INST 0x114 #define QDMA_OFFSET_GLBL2_CHANNEL_INST 0x114
#define QDMA_OFFSET_GLBL2_CHANNEL_MDMA 0x118 #define QDMA_OFFSET_GLBL2_CHANNEL_MDMA 0x118
#define QDMA_GLBL2_ST_C2H_MASK BIT(16) #define QDMA_GLBL2_ST_C2H_MASK BIT(17)
#define QDMA_GLBL2_ST_H2C_MASK BIT(17) #define QDMA_GLBL2_ST_H2C_MASK BIT(16)
#define QDMA_GLBL2_MM_C2H_MASK BIT(8) #define QDMA_GLBL2_MM_C2H_MASK BIT(8)
#define QDMA_GLBL2_MM_H2C_MASK BIT(0) #define QDMA_GLBL2_MM_H2C_MASK BIT(0)
#define QDMA_OFFSET_GLBL2_CHANNEL_STRM 0x11C #define QDMA_OFFSET_GLBL2_CHANNEL_STRM 0x11C
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "qdma_descq.h" #include "qdma_descq.h"
#include <asm/cacheflush.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -516,9 +517,11 @@ int descq_st_c2h_read(struct qdma_descq *descq, struct qdma_request *req, ...@@ -516,9 +517,11 @@ int descq_st_c2h_read(struct qdma_descq *descq, struct qdma_request *req,
u64 *pkt_tx_time = u64 *pkt_tx_time =
(u64 *)(page_address(fsg->pg) + fsg->offset); (u64 *)(page_address(fsg->pg) + fsg->offset);
if (!req->no_memcpy) if (!req->no_memcpy) {
memcpy(page_address(tsg->pg) + toff, memcpy(page_address(tsg->pg) + toff,
faddr, copy); faddr, copy);
flush_dcache_page(tsg->pg);
}
if (descq->conf.ping_pong_en && if (descq->conf.ping_pong_en &&
*pkt_tx_time == descq->ping_pong_tx_time) { *pkt_tx_time == descq->ping_pong_tx_time) {
u64 latency; u64 latency;
......
...@@ -241,7 +241,7 @@ static void unmap_user_buf(struct qdma_io_cb *iocb, bool write) ...@@ -241,7 +241,7 @@ static void unmap_user_buf(struct qdma_io_cb *iocb, bool write)
for (i = 0; i < iocb->pages_nr; i++) { for (i = 0; i < iocb->pages_nr; i++) {
if (iocb->pages[i]) { if (iocb->pages[i]) {
if (!write) if (!write)
set_page_dirty_lock(iocb->pages[i]); set_page_dirty(iocb->pages[i]);
put_page(iocb->pages[i]); put_page(iocb->pages[i]);
} else } else
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment