Re: [PATCH v3 01/18] irqchip: Add IMS (Interrupt Message Storage) driver

From: Thomas Gleixner
Date: Wed Sep 30 2020 - 14:23:45 EST


On Tue, Sep 15 2020 at 16:27, Dave Jiang wrote:
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> +config IMS_MSI_ARRAY
> + bool "IMS Interrupt Message Storm MSI controller for device memory storage arrays"

Hehe, you missed a Message Storm :)

> + depends on PCI
> + select IMS_MSI
> + select GENERIC_MSI_IRQ_DOMAIN
> + help
> + Support for IMS Interrupt Message Storm MSI controller

and another one.

> + with IMS slot storage in a slot array in device memory
> +
> +static void ims_array_mask_irq(struct irq_data *data)
> +{
> + struct msi_desc *desc = irq_data_get_msi_desc(data);
> + struct ims_slot __iomem *slot = desc->device_msi.priv_iomem;
> + u32 __iomem *ctrl = &slot->ctrl;
> +
> + iowrite32(ioread32(ctrl) | IMS_VECTOR_CTRL_MASK, ctrl);
> + ioread32(ctrl); /* Flush write to device */

Bah, I fundamentaly hate tail comments. They are a distraction and
disturb the reading flow. Put it above the ioread32() please.

> +static void ims_array_unmask_irq(struct irq_data *data)
> +{
> + struct msi_desc *desc = irq_data_get_msi_desc(data);
> + struct ims_slot __iomem *slot = desc->device_msi.priv_iomem;
> + u32 __iomem *ctrl = &slot->ctrl;
> +
> + iowrite32(ioread32(ctrl) & ~IMS_VECTOR_CTRL_MASK, ctrl);

Why is this one not flushed?

> +}
> +
> +static void ims_array_write_msi_msg(struct irq_data *data, struct msi_msg *msg)
> +{
> + struct msi_desc *desc = irq_data_get_msi_desc(data);
> + struct ims_slot __iomem *slot = desc->device_msi.priv_iomem;
> +
> + iowrite32(msg->address_lo, &slot->address_lo);
> + iowrite32(msg->address_hi, &slot->address_hi);
> + iowrite32(msg->data, &slot->data);
> + ioread32(slot);

Yuck? slot points to the struct and just because ioread32() accepts a
void pointer does not make it any more readable.

> +static void ims_array_reset_slot(struct ims_slot __iomem *slot)
> +{
> + iowrite32(0, &slot->address_lo);
> + iowrite32(0, &slot->address_hi);
> + iowrite32(0, &slot->data);
> + iowrite32(0, &slot->ctrl);

Flush?

Thanks,

tglx