From: Gleb Natapov <gleb@redhat.com>
To: "Kevin O'Connor" <kevin@koconnor.net>
Cc: seabios@seabios.org, kvm@vger.kernel.org
Subject: Re: [PATCH] provide correct pci routing information in mptable
Date: Wed, 23 Dec 2009 20:45:07 +0200 [thread overview]
Message-ID: <20091223184507.GA30203@redhat.com> (raw)
In-Reply-To: <20091223181143.GA27778@morn.localdomain>
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.
next prev parent reply other threads:[~2009-12-23 18:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 15:29 [PATCH] provide correct pci routing information in mptable Gleb Natapov
2009-12-23 18:11 ` Kevin O'Connor
2009-12-23 18:45 ` Gleb Natapov [this message]
2009-12-23 19:48 ` Kevin O'Connor
2009-12-23 19:56 ` Gleb Natapov
2009-12-23 20:26 ` Kevin O'Connor
2009-12-23 20:35 ` Gleb Natapov
2009-12-23 20:58 ` Kevin O'Connor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091223184507.GA30203@redhat.com \
--to=gleb@redhat.com \
--cc=kevin@koconnor.net \
--cc=kvm@vger.kernel.org \
--cc=seabios@seabios.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox