[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d4b297f8-82d7-465f-b691-f723087675d4@quicinc.com>
Date: Wed, 3 Sep 2025 15:12:58 +0530
From: Jyothi Kumar Seerapu <quic_jseerapu@...cinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
CC: Vinod Koul <vkoul@...nel.org>,
Mukesh Kumar Savaliya
<quic_msavaliy@...cinc.com>,
Viken Dadhaniya <quic_vdadhani@...cinc.com>,
Andi Shyti <andi.shyti@...nel.org>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>,
<linux-arm-msm@...r.kernel.org>, <dmaengine@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-i2c@...r.kernel.org>,
<linux-media@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
<linaro-mm-sig@...ts.linaro.org>, <quic_vtanuku@...cinc.com>
Subject: Re: [PATCH v7 1/2] dmaengine: qcom: gpi: Add GPI Block event
interrupt support
On 9/3/2025 2:55 PM, Dmitry Baryshkov wrote:
> On Wed, Sep 03, 2025 at 01:00:58PM +0530, Jyothi Kumar Seerapu wrote:
>> GSI hardware generates an interrupt for each transfer completion.
>> For multiple messages within a single transfer, this results in
>> N interrupts for N messages, leading to significant software
>> interrupt latency.
>>
>> To mitigate this latency, utilize Block Event Interrupt (BEI) mechanism.
>> Enabling BEI instructs the GSI hardware to prevent interrupt generation
>> and BEI is disabled when an interrupt is necessary.
>>
>> Large I2C transfer can be divided into chunks of messages internally.
>> Interrupts are not expected for the messages for which BEI bit set,
>> only the last message triggers an interrupt, indicating the completion of
>> N messages. This BEI mechanism enhances overall transfer efficiency.
>>
>> This BEI mechanism enhances overall transfer efficiency.
>
> Duplicate phrase.
Thanks, I will remove the duplicate phrase 'This BEI mechanism enhances
overall transfer efficiency.' in the later patchset.
>
>>
>> Signed-off-by: Jyothi Kumar Seerapu <quic_jseerapu@...cinc.com>
>> ---
>>
>> v6 -> v7:
>> - The design has been modified to configure BEI for interrupt
>> generation either:
>> After the last I2C message, if sufficient TREs are available, or
>> After a specific I2C message, when no further TREs are available.
>> - In the GPI driver, passed the flags argumnetr to the gpi_create_i2c_tre function
>> and so avoided using external variables for DMA_PREP_INTERRUPT status.
>>
>> v5 ->v6:
>> - For updating the block event interrupt bit, instead of relying on
>> bei_flag, decision check is moved with DMA_PREP_INTERRUPT flag.
>>
>> v4 -> v5:
>> - BEI flag naming changed from flags to bei_flag.
>> - QCOM_GPI_BLOCK_EVENT_IRQ macro is removed from qcom-gpi-dma.h
>> file, and Block event interrupt support is checked with bei_flag.
>>
>> v3 -> v4:
>> - API's added for Block event interrupt with multi descriptor support for
>> I2C is moved from qcom-gpi-dma.h file to I2C geni qcom driver file.
>> - gpi_multi_xfer_timeout_handler function is moved from GPI driver to
>> I2C driver.
>>
>> v2-> v3:
>> - Renamed gpi_multi_desc_process to gpi_multi_xfer_timeout_handler
>> - MIN_NUM_OF_MSGS_MULTI_DESC changed from 4 to 2
>> - Added documentation for newly added changes in "qcom-gpi-dma.h" file
>> - Updated commit description.
>>
>> v1 -> v2:
>> - Changed dma_addr type from array of pointers to array.
>> - To support BEI functionality with the TRE size of 64 defined in GPI driver,
>> updated QCOM_GPI_MAX_NUM_MSGS to 16 and NUM_MSGS_PER_IRQ to 4.
>>
>> drivers/dma/qcom/gpi.c | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
>> index 8e87738086b2..66bfea1f156d 100644
>> --- a/drivers/dma/qcom/gpi.c
>> +++ b/drivers/dma/qcom/gpi.c
>> @@ -1619,7 +1619,8 @@ gpi_peripheral_config(struct dma_chan *chan, struct dma_slave_config *config)
>> }
>>
>> static int gpi_create_i2c_tre(struct gchan *chan, struct gpi_desc *desc,
>> - struct scatterlist *sgl, enum dma_transfer_direction direction)
>> + struct scatterlist *sgl, enum dma_transfer_direction direction,
>> + unsigned long flags)
>> {
>> struct gpi_i2c_config *i2c = chan->config;
>> struct device *dev = chan->gpii->gpi_dev->dev;
>> @@ -1684,6 +1685,9 @@ static int gpi_create_i2c_tre(struct gchan *chan, struct gpi_desc *desc,
>>
>> tre->dword[3] = u32_encode_bits(TRE_TYPE_DMA, TRE_FLAGS_TYPE);
>> tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_IEOT);
>> +
>> + if (!(flags & DMA_PREP_INTERRUPT))
>> + tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_BEI);
>> }
>>
>> for (i = 0; i < tre_idx; i++)
>> @@ -1827,6 +1831,9 @@ gpi_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
>> return NULL;
>> }
>>
>> + if (!(flags & DMA_PREP_INTERRUPT) && (nr - nr_tre < 2))
>> + return NULL;
>
> Comment in the source file.
>
>> +
>> gpi_desc = kzalloc(sizeof(*gpi_desc), GFP_NOWAIT);
>> if (!gpi_desc)
>> return NULL;
>> @@ -1835,7 +1842,7 @@ gpi_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
>> if (gchan->protocol == QCOM_GPI_SPI) {
>> i = gpi_create_spi_tre(gchan, gpi_desc, sgl, direction);
>> } else if (gchan->protocol == QCOM_GPI_I2C) {
>> - i = gpi_create_i2c_tre(gchan, gpi_desc, sgl, direction);
>> + i = gpi_create_i2c_tre(gchan, gpi_desc, sgl, direction, flags);
>> } else {
>> dev_err(dev, "invalid peripheral: %d\n", gchan->protocol);
>> kfree(gpi_desc);
>> --
>> 2.34.1
>>
>
Powered by blists - more mailing lists