Re: [PATCH v7 4/5] irqchip/riscv-imsic: Support IOMMU MSI address lists
From: Jason Gunthorpe
Date: Wed Dec 02 2026 - 13:00:10 EST
> [ ... 50 lines skipped ... ]
> @@ -69,8 +70,10 @@ static void imsic_irq_ack(struct irq_data *d)
> irq_move_irq(d);
> }
>
> -static void imsic_irq_compose_vector_msg(struct imsic_vector *vec, struct msi_msg *msg)
> +static void imsic_irq_compose_vector_msg(struct irq_data *d, struct imsic_vector *vec,
> + struct msi_msg *msg)
> {
> + struct msi_desc *desc = irq_data_get_msi_desc(d);
> phys_addr_t msi_addr;
>
> if (WARN_ON(!vec))
> @@ -79,6 +82,12 @@ static void imsic_irq_compose_vector_msg(struct imsic_vector *vec, struct msi_ms
> if (WARN_ON(!imsic_cpu_page_phys(vec->cpu, 0, &msi_addr)))
> return;
>
> + /* A zero shift means no IOMMU MSI mapping is needed. */
> + if (desc->iommu_msi_shift) {
> + msi_addr = (desc->iommu_msi_iova << desc->iommu_msi_shift) +
> + vec->cpu * IMSIC_MMIO_PAGE_SZ;
> + }
> +
> msg->address_hi = upper_32_bits(msi_addr);
> msg->address_lo = lower_32_bits(msi_addr);
> msg->data = vec->local_id;
This function now basically duplicates msi_msg_set_addr()?
I think you should add an arg to msi_msg_set_addr to specify the iova
offset and then call it like expected:
static void imsic_irq_compose_vector_msg(struct irq_data *d, struct imsic_vector *vec,
struct msi_msg *msg)
{
phys_addr_t msi_addr;
if (WARN_ON(!vec))
return;
if (WARN_ON(!imsic_cpu_page_phys(vec->cpu, 0, &msi_addr)))
return;
msi_msg_set_addr_iova_offset(irq_data_get_msi_desc(d), msg, msi_addr,
(u64)vec->cpu * IMSIC_MMIO_PAGE_SZ);
msg->data = vec->local_id;
}
This looks reasonable otherwise
Jason
--
Jason