Skip to content

zocl: fix ert_polling not working with fpga_accelerator DT node - #10134

Merged
chvamshi-xilinx merged 1 commit into
Xilinx:masterfrom
chvamshi-xilinx:zocl-ert-polling-fix
Oct 24, 2026
Merged

chvamshi-xilinx merged 1 commit into
Xilinx:masterfrom
chvamshi-xilinx:zocl-ert-polling-fix

Conversation

@chvamshi-xilinx

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

When the fpga_accelerator device-tree node with interrupts-extended is present, ert_polling mode was broken due to two issues:

  1. zocl_edge_xclbin.c: zocl_cu_intc_refresh() was called before zocl_kds_update(), so force_polling was not set when the INTC decision was made. Additionally, zocl_create_cu() ran before refresh, causing CUs to register with the old INTC that was subsequently torn down, leaving the new INTC with no CU handlers.
  2. zocl_drv.c: zocl_cu_intc_refresh() always recreated the CU INTC regardless of polling mode, causing an IRQ handler to be registered even when ert_polling was enabled.
  3. zocl_kds.c: force_polling in kds_sched was never set by the edge path, so kds_core could not honour the polling request.
  4. zocl_ctrl_ert.c: zert_cmd_cfg_end() unconditionally set cu_intr=1, overriding the polling flag set earlier by zocl_kds_update().

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

Found it in one of IVT

How problem was solved, alternative solutions (if any) and why they were rejected

Fix: set force_polling from kds_cfg.polling before calling zocl_cu_intc_refresh(), and move zocl_create_cu() after the refresh so CUs register with the correct (new or absent) INTC.
when force_polling is set, tear down any existing INTC and return without recreating it.
set/clear force_polling alongside cu_intr in zocl_kds_update().
guard cu_intr=1 with !force_polling.

Risks (if any) associated the changes in the commit

None

What has been tested and how, request additional testing if necessary

Tested on VCK190 with the fpga_accelerator DT overlay applied:

  • Without xrt.ini: interrupt mode works, IRQ 47 appears in /proc/interrupts during kernel execution.
  • With ert_polling=1 in /etc/xrt.ini: polling mode works, no zocl_irq_intc entry in /proc/interrupts at any point.

Documentation impact (if any)

None

When the fpga_accelerator device-tree node with interrupts-extended is
present, ert_polling mode was broken due to two issues:

1. zocl_edge_xclbin.c: zocl_cu_intc_refresh() was called before
   zocl_kds_update(), so force_polling was not set when the INTC
   decision was made. Additionally, zocl_create_cu() ran before
   refresh, causing CUs to register with the old INTC that was
   subsequently torn down, leaving the new INTC with no CU handlers.

   Fix: set force_polling from kds_cfg.polling before calling
   zocl_cu_intc_refresh(), and move zocl_create_cu() after the
   refresh so CUs register with the correct (new or absent) INTC.

2. zocl_drv.c: zocl_cu_intc_refresh() always recreated the CU INTC
   regardless of polling mode, causing an IRQ handler to be registered
   even when ert_polling was enabled.

   Fix: when force_polling is set, tear down any existing INTC and
   return without recreating it.

3. zocl_kds.c: force_polling in kds_sched was never set by the edge
   path, so kds_core could not honour the polling request.

   Fix: set/clear force_polling alongside cu_intr in zocl_kds_update().

4. zocl_ctrl_ert.c: zert_cmd_cfg_end() unconditionally set cu_intr=1,
   overriding the polling flag set earlier by zocl_kds_update().

   Fix: guard cu_intr=1 with !force_polling.

Tested on VCK190 with the fpga_accelerator DT overlay applied:
- Without xrt.ini: interrupt mode works, IRQ 47 appears in
  /proc/interrupts during kernel execution.
- With ert_polling=1 in /etc/xrt.ini: polling mode works, no
  zocl_irq_intc entry in /proc/interrupts at any point.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@chvamshi-xilinx
chvamshi-xilinx merged commit 4f80103 into Xilinx:master Oct 24, 2026
26 checks passed
ManojTakasi pushed a commit to ManojTakasi/XRT that referenced this pull request Oct 24, 2026
…nx#10134)

When the fpga_accelerator device-tree node with interrupts-extended is
present, ert_polling mode was broken due to two issues:

1. zocl_edge_xclbin.c: zocl_cu_intc_refresh() was called before
   zocl_kds_update(), so force_polling was not set when the INTC
   decision was made. Additionally, zocl_create_cu() ran before
   refresh, causing CUs to register with the old INTC that was
   subsequently torn down, leaving the new INTC with no CU handlers.

   Fix: set force_polling from kds_cfg.polling before calling
   zocl_cu_intc_refresh(), and move zocl_create_cu() after the
   refresh so CUs register with the correct (new or absent) INTC.

2. zocl_drv.c: zocl_cu_intc_refresh() always recreated the CU INTC
   regardless of polling mode, causing an IRQ handler to be registered
   even when ert_polling was enabled.

   Fix: when force_polling is set, tear down any existing INTC and
   return without recreating it.

3. zocl_kds.c: force_polling in kds_sched was never set by the edge
   path, so kds_core could not honour the polling request.

   Fix: set/clear force_polling alongside cu_intr in zocl_kds_update().

4. zocl_ctrl_ert.c: zert_cmd_cfg_end() unconditionally set cu_intr=1,
   overriding the polling flag set earlier by zocl_kds_update().

   Fix: guard cu_intr=1 with !force_polling.

Tested on VCK190 with the fpga_accelerator DT overlay applied:
- Without xrt.ini: interrupt mode works, IRQ 47 appears in
  /proc/interrupts during kernel execution.
- With ert_polling=1 in /etc/xrt.ini: polling mode works, no
  zocl_irq_intc entry in /proc/interrupts at any point.

Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 4f80103)
chvamshi-xilinx added a commit that referenced this pull request Oct 24, 2026
…) (#10138)

When the fpga_accelerator device-tree node with interrupts-extended is
present, ert_polling mode was broken due to two issues:

1. zocl_edge_xclbin.c: zocl_cu_intc_refresh() was called before
   zocl_kds_update(), so force_polling was not set when the INTC
   decision was made. Additionally, zocl_create_cu() ran before
   refresh, causing CUs to register with the old INTC that was
   subsequently torn down, leaving the new INTC with no CU handlers.

   Fix: set force_polling from kds_cfg.polling before calling
   zocl_cu_intc_refresh(), and move zocl_create_cu() after the
   refresh so CUs register with the correct (new or absent) INTC.

2. zocl_drv.c: zocl_cu_intc_refresh() always recreated the CU INTC
   regardless of polling mode, causing an IRQ handler to be registered
   even when ert_polling was enabled.

   Fix: when force_polling is set, tear down any existing INTC and
   return without recreating it.

3. zocl_kds.c: force_polling in kds_sched was never set by the edge
   path, so kds_core could not honour the polling request.

   Fix: set/clear force_polling alongside cu_intr in zocl_kds_update().

4. zocl_ctrl_ert.c: zert_cmd_cfg_end() unconditionally set cu_intr=1,
   overriding the polling flag set earlier by zocl_kds_update().

   Fix: guard cu_intr=1 with !force_polling.

Tested on VCK190 with the fpga_accelerator DT overlay applied:
- Without xrt.ini: interrupt mode works, IRQ 47 appears in
  /proc/interrupts during kernel execution.
- With ert_polling=1 in /etc/xrt.ini: polling mode works, no
  zocl_irq_intc entry in /proc/interrupts at any point.


(cherry picked from commit 4f80103)

Co-authored-by: Ch Vamshi Krishna <40261882+chvamshi-xilinx@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant