Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] accel/thames: broken dru_kernel_channel_first check in thames_core_read_caps() --
commit 7eb0354ce4ccbc601749105abe32aaddd5f51384 Author: Tomeu Vizoso <[email protected]> accel/thames: Create a context per client on device open This commit allocates a per-client context and LPAE page table on device open, mapping the L2 SRAM, DRU kernel channels, user stack, and save area for each DSP core. > diff --git a/drivers/accel/thames/thames_core.c > b/drivers/accel/thames/thames_core.c > index 8053eeeb39022..d1140a374bd62 100644 > --- a/drivers/accel/thames/thames_core.c > +++ b/drivers/accel/thames/thames_core.c [ ... ] > @@ -140,8 +141,16 @@ static int thames_core_read_caps(struct thames_core > *core, struct thames_handsha > return -EINVAL; > } > > - if (tdev->has_caps && memcmp(caps, &tdev->caps, sizeof(*caps))) { > - dev_err(core->dev, "Capabilities or window sizes differ from > the first core's\n"); > + /* > + * A Context maps every core's DRU channels when the Context is > + * created, from channel 0 on a core that has not attached yet, so a > + * core attaching later must report the first channel its Contexts map. > + */ > + if (tdev->has_caps && > + (memcmp(caps, &tdev->caps, sizeof(*caps)) || > + dru_kernel_channel_first != core->dru_kernel_channel_first)) { > + dev_err(core->dev, > + "Capabilities, window sizes or first DRU channel differ > from those the device was set up with\n"); > return -EINVAL; > } [Severity: High] Does comparing dru_kernel_channel_first against core->dru_kernel_channel_first reject every secondary core when the firmware reports a non-zero dru_kernel_channel_first? When the first core attaches, it sets tdev->has_caps to true and stores its own core->dru_kernel_channel_first. When a second core attaches for the first time, tdev->has_caps is already true, but the second core's core->dru_kernel_channel_first has not been initialized yet and is still 0, so any non-zero dru_kernel_channel_first fails with -EINVAL even when both cores report the same value and no contexts exist yet. In addition, thames_context_map_core_regions() uses core->dru_kernel_channel_first per core when mapping THAMES_WINDOW_DRU, so any context opened before the second core attaches maps DRU channel 0 (the firmware's own channels) for that core. Storing dru_kernel_channel_first in struct thames_caps would check and map a consistent device-wide value across all cores. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=14
