Message ID | 20241015120750.21217-4-quic_jseerapu@quicinc.com |
---|---|
State | New |
Headers | show |
Series | Add Block event interrupt support for I2C protocol | expand |
On 15.10.2024 2:07 PM, Jyothi Kumar Seerapu wrote: > The current GPI driver hardcodes the channel TRE (Transfer Ring Element) > size to 64. For scenarios requiring high performance with multiple > messages in a transfer, use Block Event Interrupt (BEI). > This method triggers interrupt after specific message transfers and > the last message transfer, effectively reducing the number of interrupts. > For multiple transfers utilizing BEI, a channel TRE size of 64 is > insufficient and may lead to transfer failures, indicated by errors > related to unavailable memory space. > > Added provision to modify the channel TRE size via the device tree. > The Default channel TRE size is set to 64, but this value can update > in the device tree which will then be parsed by the GPI driver. > > Signed-off-by: Jyothi Kumar Seerapu <quic_jseerapu@quicinc.com> > --- 1. Is the total memory pool for these shared? 2. Is there any scenario where we want TRE size to be lower and not higher? Are there any drawbacks to always keeping them at SOME_MAX_VALUE? 3. Is this something we should configure at boot time (in firmware)? Perhaps this could be decided based on client device settings (which may or may not require adding some field in the i2c framework) Konrad
On 10/25/2024 11:47 PM, Konrad Dybcio wrote: > On 15.10.2024 2:07 PM, Jyothi Kumar Seerapu wrote: >> The current GPI driver hardcodes the channel TRE (Transfer Ring Element) >> size to 64. For scenarios requiring high performance with multiple >> messages in a transfer, use Block Event Interrupt (BEI). >> This method triggers interrupt after specific message transfers and >> the last message transfer, effectively reducing the number of interrupts. >> For multiple transfers utilizing BEI, a channel TRE size of 64 is >> insufficient and may lead to transfer failures, indicated by errors >> related to unavailable memory space. >> >> Added provision to modify the channel TRE size via the device tree. >> The Default channel TRE size is set to 64, but this value can update >> in the device tree which will then be parsed by the GPI driver. >> >> Signed-off-by: Jyothi Kumar Seerapu <quic_jseerapu@quicinc.com> >> --- > > 1. Is the total memory pool for these shared? Total memory we need preallocate and so for each serial engine this mentioned channel TRE size be used for config, go, dma tres preparation. > > 2. Is there any scenario where we want TRE size to be lower and > not higher? Are there any drawbacks to always keeping them at > SOME_MAX_VALUE? We are keeping minimum channel tre size to 64 to make sure that enough size is present to handle the requested transfers. > > 3. Is this something we should configure at boot time (in firmware)? > Perhaps this could be decided based on client device settings (which > may or may not require adding some field in the i2c framework) > This memory is for software usecase and preallocated prior to GPI driver allocated this memory to channels and events handling. I have reverted the changes related to adding new argument for dma-cells property and instead used existing value for channel TRE size in GPI driver, which is 64. > > Konrad
diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c index 52a7c8f2498f..3c89b4a88ac1 100644 --- a/drivers/dma/qcom/gpi.c +++ b/drivers/dma/qcom/gpi.c @@ -234,7 +234,7 @@ enum msm_gpi_tce_code { #define GPI_RX_CHAN (1) #define STATE_IGNORE (U32_MAX) #define EV_FACTOR (2) -#define REQ_OF_DMA_ARGS (5) /* # of arguments required from client */ +#define REQ_OF_DMA_ARGS (3) /* # of arguments required from client */ #define CHAN_TRES 64 struct __packed xfer_compl_event { @@ -481,6 +481,7 @@ struct gchan { u32 chid; u32 seid; u32 protocol; + u32 num_chan_tres; struct gpii *gpii; enum gpi_ch_state ch_state; enum gpi_pm_state pm_state; @@ -1903,8 +1904,8 @@ static int gpi_ch_init(struct gchan *gchan) } /* allocate memory for event ring */ - elements = CHAN_TRES << ev_factor; - ret = gpi_alloc_ring(&gpii->ev_ring, elements, + elements = max(gpii->gchan[0].num_chan_tres, gpii->gchan[1].num_chan_tres); + ret = gpi_alloc_ring(&gpii->ev_ring, elements << ev_factor, sizeof(union gpi_event), gpii); if (ret) goto exit_gpi_init; @@ -2042,7 +2043,7 @@ static int gpi_alloc_chan_resources(struct dma_chan *chan) mutex_lock(&gpii->ctrl_lock); /* allocate memory for transfer ring */ - ret = gpi_alloc_ring(&gchan->ch_ring, CHAN_TRES, + ret = gpi_alloc_ring(&gchan->ch_ring, gchan->num_chan_tres, sizeof(struct gpi_tre), gpii); if (ret) goto xfer_alloc_err; @@ -2107,9 +2108,9 @@ static struct dma_chan *gpi_of_dma_xlate(struct of_phandle_args *args, int gpii; struct gchan *gchan; - if (args->args_count < 3) { - dev_err(gpi_dev->dev, "gpii require minimum 2 args, client passed:%d args\n", - args->args_count); + if (args->args_count < REQ_OF_DMA_ARGS) { + dev_err(gpi_dev->dev, "gpii require minimum %d args, client passed:%d args\n", + REQ_OF_DMA_ARGS, args->args_count); return NULL; } @@ -2138,6 +2139,16 @@ static struct dma_chan *gpi_of_dma_xlate(struct of_phandle_args *args, gchan->seid = seid; gchan->protocol = args->args[2]; + /* + * If the channel tre size entry is present in device tree and + * channel tre size is greater than 64 then parse the value from + * the device tree, otherwise use the default value, which is 64. + */ + if (args->args_count > REQ_OF_DMA_ARGS && args->args[3] > CHAN_TRES) + gchan->num_chan_tres = args->args[3]; + else + gchan->num_chan_tres = CHAN_TRES; + return dma_get_slave_channel(&gchan->vc.chan); }
The current GPI driver hardcodes the channel TRE (Transfer Ring Element) size to 64. For scenarios requiring high performance with multiple messages in a transfer, use Block Event Interrupt (BEI). This method triggers interrupt after specific message transfers and the last message transfer, effectively reducing the number of interrupts. For multiple transfers utilizing BEI, a channel TRE size of 64 is insufficient and may lead to transfer failures, indicated by errors related to unavailable memory space. Added provision to modify the channel TRE size via the device tree. The Default channel TRE size is set to 64, but this value can update in the device tree which will then be parsed by the GPI driver. Signed-off-by: Jyothi Kumar Seerapu <quic_jseerapu@quicinc.com> --- drivers/dma/qcom/gpi.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)