Re: [PATCH 17/19] x86, msi: Introduce x86_msi.compose_msi_msgcall-back

From: Joerg Roedel
Date: Tue Sep 25 2012 - 09:59:56 EST


On Sun, Aug 26, 2012 at 08:41:40PM +0200, Sebastian Andrzej Siewior wrote:
> On Mon, Aug 20, 2012 at 03:56:03PM +0200, Joerg Roedel wrote:
> > This call-back points to the right function for initializing
> > the msi_msg structure.
>
> So you pull out the compose_remapped_msi_msg() out of msi_compose_msg() and
> put this in a callback. Such information is good since you don't see this in
> diff and even --patience does not help here.

Added that to the commit message.

>
> > --- a/drivers/iommu/irq_remapping.c
> > +++ b/drivers/iommu/irq_remapping.c
> > @@ -242,10 +243,12 @@ void compose_remapped_msi_msg(struct pci_dev *pdev,
> > unsigned int irq, unsigned int dest,
> > struct msi_msg *msg, u8 hpet_id)
> > {
> > - if (!remap_ops || !remap_ops->compose_msi_msg)
> > - return;
> > + struct irq_cfg *cfg = irq_get_chip_data(irq);
> >
> > - remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);
> > + if (cfg && !irq_remapped(cfg))
> > + native_compose_msi_msg(pdev, irq, dest, msg, hpet_id);
> > + else if (remap_ops && remap_ops->compose_msi_msg)
> > + remap_ops->compose_msi_msg(pdev, irq, dest, msg, hpet_id);
>
> cfg _has_ to be valid here and if it is not than you shouldn't assume that
> this irq is remapped.
> Also remap_ops has to be set here. And ->compose_msi_msg() should be set
> here as well. Would it make sense if it is not set?

I removed the check for cfg, but I am still conservative on calling
function pointers without checking them first.


Joerg

--
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/