spi: dt-bindings: qcom,spi-geni-qcom: Add property to force GSI mode
Subsystems (3)
PATCH 1/2 spi: dt-bindings: qcom,spi-geni-qcom: Add property to force GSI mode
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
--- .../devicetree/bindings/spi/qcom,spi-geni-qcom.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml +5 -0
@@ -45,6 +45,11 @@ properties: - const: tx - const: rx + qcom,force-gsi-mode: + $ref: /schemas/types.yaml#/definitions/flag + description: + Use DMA (GSI) mode, even if FIFO mode is not disabled. + interconnects: minItems: 2 maxItems: 3
Signature · 1 line
2.54.0
PATCH 2/2 spi: qcom-geni: Add property to force GSI mode
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/spi/spi-geni-qcom.c +7 -0
@@ -102,6 +102,7 @@ struct spi_geni_master {int irq;bool cs_flag;bool abort_failed; +bool force_gsi_mode;struct dma_chan *tx;struct dma_chan *rx;int cur_xfer_mode;
@@ -655,6 +656,9 @@ static int spi_geni_init(struct spi_geni_master *mas) mas->oversampling =1 ; fifo_disable =readl (se->base +GENI_IF_DISABLE_RO ) &FIFO_IF_DISABLE ; +if (mas->force_gsi_mode) + fifo_disable =1 ; +switch (fifo_disable) {case 1 : ret =spi_geni_grab_gpi_chan (mas);
@@ -1133,6 +1137,9 @@ static int spi_geni_probe(struct platform_device *pdev)if (ret)return ret; +if (device_property_read_bool (&pdev->dev,"qcom,force-gsi-mode" )) + mas->force_gsi_mode = true; + ret =spi_geni_init (mas);if (ret)return ret;
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Forcing GSI mode via `qcom,force-gsi-mode` fails to update the hardware configuration registers…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Forcing GSI mode via qcom,force-gsi-mode fails to update the hardware configuration registers (SE_FIFO_IF_DISABLE and SE_DMA_IF_EN), leaving the hardware and software in inconsistent states.
- [Medium] The new qcom,force-gsi-mode property is functionally redundant and bypasses the existing qcom,enable-gsi-dma property, muddying the device tree bindings.
--
commit 7902ba1d5ce1661e61400f2f7a40e6f1185b3264
Author: Pengyu Luo <[email protected]>
spi: qcom-geni: Add property to force GSI mode
This commit introduces a "qcom,force-gsi-mode" property to force the controller into GSI mode during initialization for devices that do not disable FIFO mode by default.
Quoted 4 lines
drivers/spi/spi-geni-qcom.c +0
-0
[ ... ]
drivers/spi/spi-geni-qcom.c static int spi_geni_init(struct spi_geni_master *mas) · line 661
Quoted 7 lines
drivers/spi/spi-geni-qcom.c +3
-0@@ -655,6 +656,9 @@ static int spi_geni_init(struct spi_geni_master *mas) mas->oversampling =1 ; fifo_disable =readl (se->base +GENI_IF_DISABLE_RO ) &FIFO_IF_DISABLE ; +if (mas->force_gsi_mode) + fifo_disable =1 ; +
[Severity: High]
Does overriding this local variable actually configure the hardware for GSI DMA mode?
Looking at the hardware initialization, geni_load_se_fw() is the only place where SE_FIFO_IF_DISABLE and SE_DMA_IF_EN are written. By just overriding fifo_disable here, the driver will attempt to use GENI_GPI_DMA mode while the hardware's core FIFO interface might still be enabled and the DMA interface disabled.
Could this lead to DMA failures, timeouts, or lockups since the software and hardware states are inconsistent?
Quoted 3 lines
drivers/spi/spi-geni-qcom.c +0
-0switch (fifo_disable) {case 1 : ret =spi_geni_grab_gpi_chan (mas);
[ ... ]
drivers/spi/spi-geni-qcom.c static int spi_geni_probe(struct platform_device *pdev) · line 1142
Quoted 7 lines
drivers/spi/spi-geni-qcom.c +3
-0@@ -1133,6 +1137,9 @@ static int spi_geni_probe(struct platform_device *pdev)if (ret)return ret; +if (device_property_read_bool (&pdev->dev,"qcom,force-gsi-mode" )) + mas->force_gsi_mode = true; +
[Severity: Medium]
Is this new property functionally redundant?
The subsystem already supports the qcom,enable-gsi-dma device tree property to configure GSI DMA mode, which is parsed in geni_load_se_firmware().
Would introducing qcom,force-gsi-mode create overlapping bindings for the same hardware configuration and pollute the device tree ABI?
It seems this new property might be introduced to work around an internal software parsing order issue where geni_load_se_firmware() is skipped if the firmware is already loaded.
Quoted 3 lines
drivers/spi/spi-geni-qcom.c +0
-0ret =spi_geni_init (mas);if (ret)return ret;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Pengyu LuoQuoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 7 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 7 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
Best wishes,
Pengyu
Quoted 10 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)--
With best wishes
Dmitry
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 4 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
This hunk is very odd:
/*
* in case of failure to get gpi dma channel, we can still do the
* FIFO mode, so fallthrough
*/dev_warn(mas->dev, "FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode\n");
In my understanding, GSI DMA mode is always preferable. +Mukesh, do you have any insights?
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Hi Konrad, sorry for late response.
Quoted 25 lines · Konrad Dybcio
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 4 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
This hunk is very odd:
Quoted 9 lines
/*
* in case of failure to get gpi dma channel, we can still do the
* FIFO mode, so fallthrough
*/dev_warn(mas->dev, "FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode\n");In my understanding, GSI DMA mode is always preferable. +Mukesh, do you have any insights?
GSI mode is preferable but if for some reason it fails, we try to continue with the FIFO mode. Just fallback mechanism.
Quoted 1 line
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 34 lines · Mukesh Savaliya
Hi Konrad, sorry for late response.
Quoted 31 lines · Konrad Dybcio
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 4 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
This hunk is very odd:
/*
* in case of failure to get gpi dma channel, we can still do the
* FIFO mode, so fallthrough
*/dev_warn(mas->dev, "FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode\n");
Quoted 4 lines
Quoted 3 lines
In my understanding, GSI DMA mode is always preferable. +Mukesh, do you have any insights?
GSI mode is preferable but if for some reason it fails, we try to continue with the FIFO mode. Just fallback mechanism.
So, would making GSI the default and FIFO the fallback option sound good?
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 36 lines · Konrad Dybcio
Quoted 34 lines · Mukesh Savaliya
Hi Konrad, sorry for late response.
Quoted 31 lines · Konrad Dybcio
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 4 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
This hunk is very odd:
/*
* in case of failure to get gpi dma channel, we can still do the
* FIFO mode, so fallthrough
*/dev_warn(mas->dev, "FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode\n");
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
In my understanding, GSI DMA mode is always preferable. +Mukesh, do you have any insights?
GSI mode is preferable but if for some reason it fails, we try to continue with the FIFO mode. Just fallback mechanism.
So, would making GSI the default and FIFO the fallback option sound good?
Yes, I have sent v2, please check here
https://lore.kernel.org/linux-arm-msm/[email protected]
Best wishes,
Pengyu
Quoted 2 lines
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
On 6/27/2026 10:52 AM, Pengyu Luo wrote:
[...]
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
This hunk is very odd:
/*
* in case of failure to get gpi dma channel, we can still do the
* FIFO mode, so fallthrough
*/dev_warn(mas->dev, "FIFO mode disabled, but couldn't get DMA, fall back to FIFO mode\n");In my understanding, GSI DMA mode is always preferable. +Mukesh, do you have any insights?
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
GSI mode is preferable but if for some reason it fails, we try to continue with the FIFO mode. Just fallback mechanism.
So, would making GSI the default and FIFO the fallback option sound good?
Yes, I have sent v2, please check here
https://lore.kernel.org/linux-arm-msm/[email protected]
Just Reviewed and Commented on V2.
Quoted 5 lines
Best wishes,
PengyuQuoted 2 lines
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Pengyu LuoQuoted 12 lines · Pengyu Luo
Quoted 10 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 4 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
I have read reviews. Can we check if the compatible "qcom,sm6350-gpi-dma" is in DT? If the gpi dma controller is presented, then we enable GSI mode.
Can we just check for the dmas property? If it is present and if we could get DMA channels, then GSI DMA is available.
Quoted 14 lines
Best wishes,
PengyuQuoted 10 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Dmitry BaryshkovHi Pengyu,
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Quoted 5 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 10 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
Best wishes,
Pengyu
Quoted 19 lines
Quoted 5 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 22 lines
Best wishes,
PengyuQuoted 19 lines
Quoted 5 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 21 lines · Mukesh Savaliya
Quoted 17 lines · Pengyu Luo
Quoted 14 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Quoted 9 lines
Quoted 4 lines
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.
Best wishes,
Pengyu
Quoted 23 lines
Quoted 22 lines
Best wishes,
PengyuQuoted 19 lines
Quoted 5 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 33 lines · Pengyu Luo
Quoted 21 lines · Mukesh Savaliya
Quoted 17 lines · Pengyu Luo
Quoted 14 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Quoted 9 lines
Quoted 4 lines
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 5 lines
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register
SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.
Thanks ! if GSI is already enabled, then why do you need forced gsi ?
My point here - SW should only decide mode based on register read, not enforce by DT flag. As such it's not a SOC exposed, can't be overridden by user.
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 37 lines · Mukesh Savaliya
Quoted 33 lines · Pengyu Luo
Quoted 30 lines · Mukesh Savaliya
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 6 lines
Quoted 5 lines
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register
SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.Thanks ! if GSI is already enabled, then why do you need forced gsi ?
I meant it is enabled on windows, not linux, and I think it is enabled in the driver, geni_se_select_dma_mode() does it. On windows, GENI_DMA_MODE_EN bit is set, but not on linux.
Yes, I have no doubt about below(as I drop DT part in V2), but the GENI_IF_DISABLE_RO register only determines if fifo is disabled, if not, why can't we use GSI?
Quoted 3 lines
My point here - SW should only decide mode based on register read, not enforce by DT flag. As such it's not a SOC exposed, can't be overridden by user.
Best wishes,
Pengyu
Quoted 22 lines
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Ideally, this should be decided by the SPI controller based on the requirements. Another option would be to prefer GSI for all transfers if it is available, ignoring the FIFO even if it is not disabled.
Yes, it should be decided in advance and configured accordingly for GSI vs non GSI mode. Because there would be limited set of GSI pipes, which will actually make must have GSI mode device run with FIFO mode.
Why don't you decide prior and configure for GSI mode ? We don't need to change the current logic of deciding FIFO vs GSI.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Pengyu LuoQuoted 33 lines · Pengyu Luo
Quoted 21 lines · Mukesh Savaliya
Quoted 17 lines · Pengyu Luo
Quoted 14 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Quoted 9 lines
Quoted 4 lines
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 4 lines
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register
SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.
What's the value of se->base + SE_DMA_IF_EN (+0x2004) on this SE?
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Quoted 34 lines · Konrad Dybcio
Quoted 33 lines · Pengyu Luo
Quoted 30 lines · Mukesh Savaliya
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 6 lines
Quoted 4 lines
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register
SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.What's the value of
se->base+SE_DMA_IF_EN(+0x2004) on this SE?
I'm sorry, I read the first sentence only..
I think the enabling of DMA and the disabling of FIFO are technically disjoint operations, but shouldn't be. The programming guide mentions that FIFO_DISABLE=1 is set to prevent malicious software from snooping the data from the RX FIFO while the SE is operated through the GSI.
Mukesh, would it make sense to make to rework the checks this way:
if (dma_enabled)
prefer GSI, try SE DMA otherwise
else if (fifo_disabled)
return error, misconfigured SE
else
fifo mode
?
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
Hi Konrad,
Quoted 35 lines · Konrad Dybcio
Quoted 34 lines · Konrad Dybcio
Quoted 33 lines · Pengyu Luo
Quoted 30 lines · Mukesh Savaliya
Quoted 12 lines · Pengyu Luo
Quoted 10 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 6 lines · Dmitry Baryshkov
Quoted 5 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
What I can confirm is that fifo is not disabled on my device, and gsi is definitely enabled (under windows, check the register
SE_GENI_DMA_MODE_EN), forcing the device to enable GSI mode on linux works well.
It may work, but it may fail too. We rather want to decide FIFO/DMA vs GSI based on fifo_disabled variable.
Quoted 12 lines
Quoted 2 lines
What's the value of
se->base+SE_DMA_IF_EN(+0x2004) on this SE?I'm sorry, I read the first sentence only..
I think the enabling of DMA and the disabling of FIFO are technically disjoint operations, but shouldn't be. The programming guide mentions that FIFO_DISABLE=1 is set to prevent malicious software from snooping the data from the RX FIFO while the SE is operated through the GSI.
Mukesh, would it make sense to make to rework the checks this way:
No, below actually completely makes things wrong. Overall it's between GSI vs non GSI [i.e. FIFO/DMA]
fifo_disabled = 1 = GSI [Neither go for FIFO nor for DMA]
fifo_disabled = 0 = non GSI [Then Driver checks data transfer size, if <64 prefer FIFO else go for CPU DMA mode]
dma_enabled = 1 [fifo_disabled = 0] = FIFO OR DMA [Driver checks data size, if <64 prefer FIFO else go for CPU DMA mode]
let me know if there is still a confusion, we can discuss.
Quoted 10 lines
if (
dma_enabled)
prefer GSI, try SE DMA otherwise
else if (fifo_disabled)
return error, misconfigured SE
else
fifo mode?
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Mukesh SavaliyaQuoted 17 lines · Mukesh Savaliya
Quoted 14 lines · Pengyu Luo
Quoted 12 lines · Mukesh Savaliya
Hi Pengyu,
Quoted 8 lines · Dmitry Baryshkov
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Why to force ? You can directly configure in GSI mode. Note there are some configuration done prior to Linux bootup too.
Sorry, I don't get it. how? I know there may be a qupfw, but it is impossible for a normal user like me to generate one with GSI preferred.
If firmware doesn't program in GSI, you can't have this working in GSI mode, its going to fail (and work with fallback). if it's programmed in GSI, anyway this will run in GSI mode. So why to add extra things without any usage ?
My understanding is that GSI mode works, but the the FIFO_DISABLE bit is set to zero, so FIFO mode is chosen.
So NHLOS would allow the use of this GPI instance (and not reserve the GPI channels for this SE), but not set FIFO_DISABLE=1.
Konrad
Re: [PATCH 2/2] spi: qcom-geni: Add property to force GSI mode
In reply to Pengyu LuoQuoted 36 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
Signed-off-by Pengyu Luo <[email protected]>--- drivers/spi/spi-geni-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/spi/spi-geni-qcom.c +4
-0@@ -102,6 +102,7 @@ struct spi_geni_master {int irq;bool cs_flag;bool abort_failed; +bool force_gsi_mode;struct dma_chan *tx;struct dma_chan *rx;int cur_xfer_mode;@@ -655,6 +656,9 @@ static int spi_geni_init(struct spi_geni_master *mas) mas->oversampling =1 ; fifo_disable =readl (se->base +GENI_IF_DISABLE_RO ) &FIFO_IF_DISABLE ; +if (mas->force_gsi_mode) + fifo_disable =1 ; +switch (fifo_disable) {case 1 : ret =spi_geni_grab_gpi_chan (mas);
drivers/spi/spi-geni-qcom.c static int spi_geni_probe(struct platform_device *pdev) · line 1142
Quoted 6 lines
drivers/spi/spi-geni-qcom.c +3
-0@@ -1133,6 +1137,9 @@ static int spi_geni_probe(struct platform_device *pdev)if (ret)return ret; +if (device_property_read_bool (&pdev->dev,"qcom,force-gsi-mode" )) + mas->force_gsi_mode = true; +
I don't think this is a HW bit, it's an internal selection based on FW programming. This is inherently decided by GENI_IF_DISABLE_RO, No exposure to the user/DT.
Quoted 3 lines
drivers/spi/spi-geni-qcom.c +0
-0ret =spi_geni_init (mas);if (ret)return ret;
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `qcom,force-gsi-mode` property dictates driver software behavior instead of describing…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The qcom,force-gsi-mode property dictates driver software behavior instead of describing hardware configuration, violating Devicetree principles. --
commit 0692b669eca2d4de46bd91bb83f4d52a4fe1f11d
Author: Pengyu Luo <[email protected]>
spi: dt-bindings: qcom,spi-geni-qcom: Add property to force GSI mode
This commit introduces a new devicetree property, "qcom,force-gsi-mode", to the Qualcomm SPI Geni binding. The property is intended to instruct the driver to prioritize DMA (GSI) mode over FIFO mode during initialization on platforms where FIFO mode isn't explicitly disabled.
Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml properties: · line 51
Quoted 12 lines
Documentation/devicetree/bindings/spi/qcom,spi-geni-qcom.yaml +4
-0@@ -45,6 +45,11 @@ properties: - const: tx - const: rx + qcom,force-gsi-mode: + $ref: /schemas/types.yaml#/definitions/flag + description: + Use DMA (GSI) mode, even if FIFO mode is not disabled.
[Severity: Medium]
Does this property violate the principle that devicetree bindings should describe hardware capabilities rather than software behavior?
The hardware's capability to use DMA is typically already described by standard properties like dmas and dma-names. Since qcom,force-gsi-mode acts as a hint to override the driver's default fallback logic, could the driver instead make this decision internally?
For example, the driver could default to DMA when the resources are available, or apply a quirk based on the board's compatible string, avoiding the need to introduce an OS-specific policy flag into the devicetree.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Mark Brown
maintainerQuoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
This is an optimisation not a fundamental part of how these devices operate. The DT should describe whatever it is about these SoCs that allows this mode, or this should be triggered based on the compatible for the variant of the device that can do this.
Quoted 7 lines · Pengyu Luo
Some devices (such as gaokun3) do not disable FIFO mode, causing the driver to fallback to FIFO mode by default. However, these platforms also support GSI mode, which is highly preferred for certain peripherals like SPI touchscreens to improve performance.
Introduce the "qcom,force-gsi-mode" device property to hint and force the controller into GSI mode during initialization.
You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc.
And even differently named property does not feel correct here - just choose GSI in the driver...
Best regards,
Krzysztof