Dear Team,
We are using iMX8DXL processor. Is there any way to make all the SPI related task to work in single core? Do let us know if there is any procedure or example to do so.
Regards,
Ankita
Hello,
To set the CPU affinity for the SPI interrupt to a specific core (e.g., CPU0):
echo 1 > /proc/irq/<spi_irq_number>/smp_affinity
Reference: https://docs.kernel.org/core-api/irq/irq-affinity.html
Best Regards,
Zhiming
Hello,
To set it in driver, please use irq_set_affinity referring the drivers in kernel. For example, drivers/perf/fsl_imx9_ddr_perf.c
ret = irq_set_affinity(pmu->irq, cpumask_of(pmu->cpu));
if (ret) {
dev_err(pmu->dev, "Failed to set interrupt affinity\n");
goto ddr_perf_err;
}
Best Regards,
Zhiming
Hello,
If you want to assign irq to the second core, please try.
echo 1 > /proc/irq/204/smp_affinity
Best Regards,
Zhiming
Hello,
The default gpio-mxc driver doesn't support affinity interfaces, you could refer below thread to add code in driver if you need.
https://community.nxp.com/t5/i-MX-Processors/i-MX7-IRQ-affinity-setting-for-GPIO-interrupts/m-p/7609...
Best Regards,
Zhiming
Hello,
The /proc/irq/xxx/smp_affinity can only work with those irqs binding to GICv3. For standard gpio driver, there is no such interfaces to handle smp_affinity.
For the gpio smp affinity, the previous thread gave a special code in gpio driver to support bind one gpio band irq to one cpu core, you can add log print to verify these code, but you can't check if this can work in rootfs as this is not official way to support affinity feature in driver.
Best Regards,
Zhiming
Hello,
The second core is index 1, the cpumask_of(2) is the third core. Please try to use cpumask_of(1).
Best Regards,
Zhiming
Hello,
I did same modification in driver.
Here is test based on 4 core i.MX EVK board, not DXL EVK. This gpio is used by PTN5110.
163: 0 0 8 0 gpio-mxc 19 Level 1-0050
If i plugin USB, the irq handled number will increase.
163: 0 0 18 0 gpio-mxc 19 Level 1-0050
Another interrupt gpio about sd card also can be assigned to core3(index=2)
88: 0 0 1 0 gpio-mxc 12 Edge 30b50000.mmc cd
Best Regards,
Zhiming
Hello,
Please share the device tree node and pinctrl about this flexcan
Best Regards,
Zhiming
Hello,
Referring previous successful gpio case and Documentation/devicetree/bindings/net/can/tcan4x5x.txt, you can try below setting.
tcan4x5x0: tcan4x5x@0 {
compatible = "ti,tcan4x5x";
reg = <0>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <1>;
spi-max-frequency = <16000000>;
bosch,mram-cfg = <0x0 3 2 32 10 0 20 10>;
clocks = <&hclk>, <&cclk>;
clock-names = "hclk", "cclk";
interrupt-parent = <&lsio_gpio3>;
interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
reset-gpios= <&exp2 12 GPIO_ACTIVE_HIGH>;
iw-tcan-prop;
wakeup-source;
status = "okay";
Best Regards,
Zhiming