msm: mhi_dev: Support async write in UCI for size greater than 8k

In the current implementation of MHI UCI layer, write operation from
device to host fails if the size requested by client is more than 8k.
Removing this condition in this change as MHI supports buffer size of
upto 64k in async path. Continuing to fail write in sync case, as MHI
layer uses pre allocated buffers of size 8k. Also, added debug logs to
check if buffer size of Diag is more than 16k. With this change async
writes of size greater than 8k are supported in UCI layer.

Change-Id: I084da6a49a00095e806872f591365eabb9edc1de
Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
This commit is contained in:
Sai Chaitanya Kaveti 2023-05-24 18:00:01 +05:30
parent 17edd981ce
commit 5e4dbce2b7
2 changed files with 20 additions and 14 deletions

View File

@ -267,6 +267,7 @@ struct mhi_config {
#define MHI_ENV_VALUE 2
#define MHI_MASK_ROWS_CH_EV_DB 4
#define TRB_MAX_DATA_SIZE 8192
#define TRB_MAX_DATA_SIZE_16K 16384
#define MHI_CTRL_STATE 100
/* maximum transfer completion events buffer */

View File

@ -173,7 +173,7 @@ static const struct chan_attr mhi_chan_attr_table[] = {
},
{
MHI_CLIENT_DIAG_OUT,
TRB_MAX_DATA_SIZE,
TRB_MAX_DATA_SIZE_16K,
MAX_NR_TRBS_PER_CHAN,
MHI_DIR_OUT,
NULL,
@ -184,7 +184,7 @@ static const struct chan_attr mhi_chan_attr_table[] = {
},
{
MHI_CLIENT_DIAG_IN,
TRB_MAX_DATA_SIZE,
TRB_MAX_DATA_SIZE_16K,
MAX_NR_TRBS_PER_CHAN,
MHI_DIR_IN,
NULL,
@ -629,10 +629,17 @@ static int mhi_uci_send_sync(struct uci_client *uci_handle,
struct mhi_req ureq;
int ret_val;
uci_log(UCI_DBG_VERBOSE,
uci_log(UCI_DBG_DBG,
"Sync write for ch_id:%d size %d\n",
uci_handle->out_chan, size);
if (size > TRB_MAX_DATA_SIZE) {
uci_log(UCI_DBG_ERROR,
"Too big write size: %lu, max supported size is %d\n",
size, TRB_MAX_DATA_SIZE);
return -EFBIG;
}
ureq.client = uci_handle->out_handle;
ureq.buf = data_loc;
ureq.len = size;
@ -945,7 +952,7 @@ static int mhi_uci_read_sync(struct uci_client *uci_handle, int *bytes_avail)
struct mhi_req ureq;
struct mhi_dev_client *client_handle;
uci_log(UCI_DBG_INFO,
uci_log(UCI_DBG_DBG,
"Sync read for ch_id:%d\n", uci_handle->in_chan);
client_handle = uci_handle->in_handle;
@ -1484,11 +1491,10 @@ static ssize_t mhi_uci_client_write(struct file *file,
return -ENODEV;
}
if (count > TRB_MAX_DATA_SIZE) {
uci_log(UCI_DBG_ERROR,
"Too big write size: %lu, max supported size is %d\n",
count, TRB_MAX_DATA_SIZE);
return -EFBIG;
if (count > uci_handle->out_chan_attr->max_packet_size) {
uci_log(UCI_DBG_DBG,
"Warning: big write size: %lu, max supported size is %d\n",
count, uci_handle->out_chan_attr->max_packet_size);
}
data_loc = kmalloc(count, GFP_KERNEL);
@ -1543,11 +1549,10 @@ static ssize_t mhi_uci_client_write_iter(struct kiocb *iocb,
return -ENODEV;
}
if (count > TRB_MAX_DATA_SIZE) {
uci_log(UCI_DBG_ERROR,
"Too big write size: %lu, max supported size is %d\n",
count, TRB_MAX_DATA_SIZE);
return -EFBIG;
if (count > uci_handle->out_chan_attr->max_packet_size) {
uci_log(UCI_DBG_DBG,
"Warning: big write size: %lu, max supported size is %d\n",
count, uci_handle->out_chan_attr->max_packet_size);
}
data_loc = kmalloc(count, GFP_KERNEL);