<div class="gmail_quote"><div>Appreciate your review.</div><div> > +     static int int_no = 0;  /* To remember last used interrupt */</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
<br>
</div>This is a worry. There is nothing AFAIK to stop two drivers (eg. network<br>
& scsi) calling into here at the same time, which could lead to<br>
corrupting int_no. If you just want a global counter you need a lock.<br>
<br>
But, AFAICS this is broken anyway. You never free the interrupt numbers,<br>
so you're going to run out. Some of your device tree entries only have 3<br>
(!!), so ifup/ifdown x 3 will exhaust the supply, won't it?<br>
<br>
I realise I never replied to your mail the other week about the bitmap<br>
code, so perhaps it's my fault :)<br>
<div class="im"><br>
</div></blockquote><div>[Marri] Good point.I will come up with a global array to see if the interrupt nos are free</div><div>and use them.</div><div><br></div><div> > +     return;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
> +}<br>
> +<br>
> +static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec, int type)<br>
> +{<br>
> +     dev_dbg(&pdev->dev, "PCIE-MSI:%s called. vec %x type %d\n",<br>
> +             __func__, nvec, type);<br>
<br>
</div>No constraints at all? What about MSI-X ?<br>
<div class="im">[marri] That will be another patch as it is only specific to some SoCs</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> +     msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys, GFP_KERNEL);</div><div class="im">
> +     msi->msi_addr_hi = 0x0;<br>
> +     msi->msi_addr_lo = (u32) msi_phys;<br>
> +     dev_dbg(&dev->dev, "PCIE-MSI: msi address 0x%x \n", msi->msi_addr_lo);<br>
<br>
</div>So your MSI is a write to just some arbitrary address?<br>
<div class="im"><br></div></blockquote><div>[Marri] We choose a arbitrary address and pass that to msi APIs which would write</div><div>to endpoint device config space. If endpoint wants to cause an MSI it just generates</div>
<div>memory transaction to this address, as soon as it is on system bus PCI-E handler</div><div>will snoop this address and cause interrupt to CPU.</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
> +     /* Progam the Interrupt handler Termination addr registers */<br>
> +     out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);<br>
> +     out_be32(msi->msi_regs + PEIH_TERMADL, msi->msi_addr_lo);<br>
<br>
</div>And the hardware detects it by catching writes to that address? But the<br>
write still lands?<br>
<div class="im"><br></div></blockquote><div>[marri] write still happens to memory but we do't need need to wait for it to complete.</div><div>So the termination would avoid un-necessary delay in acking the write or race condition</div>
<div>to that particular address.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br></div></blockquote></div><br>