AM6442: Setting udma driver CPU affinity

Part Number: AM6442

Tool/software:

Hello,

I am currently trying to figure out how to set the CPU affinities of peripherals utilizing the udma driver. For example, I would like to change the interrupt affinity for the dma controller. The affinity is set to 0x3 (both A53 cores) by default as seen in the following:

root@phyboard-electra-am64xx# cat /proc/interrupts

...

30: 5 MSI-INTA 1713152 Level 485c0100.dma-controller chan0

...

root@phyboard-electra-am64xx# cat /proc/irq/30/smp_affinity
3

root@phyboard-electra-am64xx# readlink /sys/bus/platform/devices/485c0100.dma-controller/driver
../../../../../bus/platform/drivers/ti-udma

I would like to change the affinity so that only CPU0 can handle the irq. I attempted to accomplish this via sysfs; however, I get the following error:


root@phyboard-electra-am64xx# echo 1 > /proc/irq/30/smp_affinity [368451.488942] attempting to set cpu affinity
-sh: echo: write error: Invalid argument

What is the recommended approach to changing the CPU affinity, and is this even possible?

Thanks for your help!

  • Hi Jared,

    are you using the latest/current AM64 SDK v10.1? We've made improvements recently in how SMP affinity can be managed. This was mostly to benefit use cases like Ethernet. Whatever you are trying seems to work just fine with that SDK. Can you please try to re-create.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    root@am64xx-evm:~# grep '485c0100.dma-controller chan0' /proc/interrupts
    25: 2681 0 MSI-INTA 1713152 Level 485c0100.dma-controller chan0
    root@am64xx-evm:~# cat /proc/irq/25/smp_affinity
    3
    root@am64xx-evm:~# echo 1 > /proc/irq/25/smp_affinity
    root@am64xx-evm:~# cat /proc/irq/25/smp_affinity
    3
    # Not sure why this is needed a second time initially before the value "sticks"
    root@am64xx-evm:~# echo 1 > /proc/irq/25/smp_affinity
    root@am64xx-evm:~# cat /proc/irq/25/smp_affinity
    1
    # Further changes will get picked up immediately
    root@am64xx-evm:~# echo 2 > /proc/irq/25/smp_affinity
    root@am64xx-evm:~# cat /proc/irq/25/smp_affinity
    2
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards, Andreas

  • Hi Andreas,

    Thanks for the quick reply, I really appreciate it!

    I am using Yocto to build my AM64 image and I am unsure how to determine which SDK version that Yocto is utilizing during the build process. Do you know of any way that I could check this in Yocto? As an alternative, is there a way to check this on the board itself once the image is compiled? 

    Thanks again,

    - Jared 

  • Hi Jared,

    I am using Yocto to build my AM64 image and I am unsure how to determine which SDK version that Yocto is utilizing during the build process.

    Well in a typical "customer adoption flow" of our SW stack you would start off and fork a certain version of our SDK or the associated Yocto trees, and customize from thereon. So that fork-point would be your "SDK base version" in a sense.

    Since the fact that setting SMP affinity being functional is almost certainly dependent on the Kernel version you are using (and what patches it has, etc.), we can just look at the version history of that particular BSP layer.

    On my system, below is what I get for what's currently setup as an example to illustrate the process (NOTE: This is NOT what I used earlier to demonstrate the feature; for this I had used & programmed the SDK v10.1 image downloaded from TI.com directly, not v10.0).

    Fullscreen
    1
    2
    3
    a0797059@jiji:~/tisdk/am64xx-evm (master)
    $ git -C sources/meta-ti/ log --oneline -1
    13807734 (HEAD, tag: cicd.scarthgap.202407301155, tag: cicd.scarthgap.202407271443, tag: 10.00.07) CI/CD Auto-Merger: cicd.scarthgap.202407271443
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    You can see the version tag 10.00.07 in the git log there.

    Regards, Andreas

  • Hi Andreas,

    After some back and forth with Phytec (I am using their SOM) I was able to determine that the irq fixes were not incorporated into Yocto build. I went ahead and patched Linux within my distro layer, and the patches do indeed fix the irq affinity issues. Thank you for pointing me towards this solution and thank you to the devs who implemented the changes.

    To anyone in a similar situation, the two pertinent commits on processor-sdk-linux/ti-linux-6.12.y are:

    • 3228d92e89e5 PENDING: irqchip: irq-ti-sci-inta: Introduce IRQ affinity support 
    • b73f2b8dd225 PENDING: irqchip: irq-ti-sci-inta: Don't aggregate event until necessary

    Thanks again,

    Jared