Re: [PATCH] provide correct pci routing information in mptable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 23, 2009 at 01:11:43PM -0500, Kevin O'Connor wrote:
> Thanks Gleb.
> 
> On Wed, Dec 23, 2009 at 05:29:25PM +0200, Gleb Natapov wrote:
> > -                  + sizeof(struct mpt_intsrc) * 18);
> > +                  + sizeof(struct mpt_intsrc) * 34);
> [...]
> > +    foreachpci(bdf, max) {
> > +        int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
> > +        int irq = pci_config_readb(bdf, PCI_INTERRUPT_LINE);
> > +        if (pin == 0)
> > +        	continue;
> > +        mask |= (1 << irq);
> > +        memset(intsrc, 0, sizeof(*intsrc));
> > +        intsrc->type = MPT_TYPE_INTSRC;
> > +        intsrc->irqtype = 0; /* INT */
> > +        intsrc->irqflag = 1; /* active high */
> > +        intsrc->srcbus = 0; /* PCI bus */
> > +        intsrc->srcbusirq = (pci_bdf_to_dev(bdf) << 2) | (pin - 1);
> > +        intsrc->dstapic = ioapic_id;
> > +        intsrc->dstirq = irq;
> > +        intsrc++;
> > +    }
> 
> Why only increase the allocated storage for intsrc by 16?  The loop
> above seems like it could add a large number of entries.
> 
Unfortunately we have to allocate all memory in advance. The table can
have max 4 entries per device (one entry for each pin), so 16 is enough
for 4 devices.

> Also, the foreachpci() macro will iterate over every PCI function -
> there could be 8 functions to a pci device which could lead to
> duplicates in the table (two pci functions on the same device could
> use the same irq pin).
> 
Yes, correct. Need to rework this loop.

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux