[PATCH 4/4] platform: generic: tenstorrent: Add RISC-V IOMMU support

Joel Stanley joel at jms.id.au
Wed Apr 1 05:51:04 PDT 2026


On Tue, 10 Mar 2026 at 11:19, Nicholas Piggin <npiggin at gmail.com> wrote:

> --- /dev/null
> +++ b/platform/generic/tenstorrent/iommu.c

> +int tt_iommu_fdt_configure(const void *fdt)
> +{
> +       const char *compatible = "tenstorrent,riscv-iommu";
> +       bool found_dt = false;
> +       int offset = -1;
> +
> +       for (;;) {
> +               uint64_t addr, size;
> +               int rc;
> +
> +               offset = fdt_node_offset_by_compatible(fdt, offset, compatible);
> +               if (offset < 0)
> +                       break;
> +
> +               rc = fdt_get_node_addr_size_by_name(fdt, offset, "machine",
> +                                                   &addr, &size);
> +               if (rc < 0 || !size) {
> +                       sbi_printf("tenstorrent,riscv-iommu did not find "
> +                                       "machine regs\n");
> +                       continue;
> +               }
> +
> +               if (size < RISCV_IOMMU_REG_MACHINE_SIZE) {
> +                       sbi_printf("tenstorrent,riscv-iommu at 0x%016lx "
> +                                  " machine regs region too small\n", addr);
> +                       continue;
> +               }

should this set found_dt = true here?

> +
> +               sbi_dprintf("tenstorrent,riscv-iommu found machine regs "
> +                           "0x%016lx-0x%016lx\n", addr, addr + size - 1);
> +
> +               rc = tt_iommu_configure(addr);
> +               if (rc)
> +                       sbi_printf("tenstorrent,riscv-iommu at 0x%016lx "
> +                                  "init failed\n", addr);
> +       }
> +
> +       if (!found_dt)
> +               return SBI_ENOTSUPP;

because found_dt never gets modified.

> +
> +       return SBI_OK;
> +}



More information about the opensbi mailing list