All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Kevin O'Connor <kevin@koconnor.net>
Cc: seabios@seabios.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [SeaBIOS] [seabios patch 1/5] pci: init all devices
Date: Fri, 04 May 2012 17:35:10 +0200	[thread overview]
Message-ID: <4FA3F72E.7080103@redhat.com> (raw)
In-Reply-To: <20120504131546.GA668@morn.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

On 05/04/12 15:15, Kevin O'Connor wrote:
> On Fri, May 04, 2012 at 10:21:23AM +0200, Gerd Hoffmann wrote:
>> seabios used to initialize root bus devices only, with this patch
>> devices behind pci bridges are initialized too.  This allows to boot
>> from virtio devices behind pci bridges.
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> ---
>>  src/pciinit.c |    3 ---
>>  1 files changed, 0 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/pciinit.c b/src/pciinit.c
>> index 25b04ac..6a7a0d2 100644
>> --- a/src/pciinit.c
>> +++ b/src/pciinit.c
>> @@ -213,9 +213,6 @@ static void pci_bios_init_devices(void)
>>  {
>>      struct pci_device *pci;
>>      foreachpci(pci) {
>> -        if (pci_bdf_to_bus(pci->bdf) != 0)
>> -            // Only init devices on host bus.
>> -            break;
> 
> I think this will then assign an incorrect PCI_INTERRUPT_LINE value to
> non root bus devices.

Attached patch should fix it if I read the specs correctly.
Untested though, review appreciated.

cheers,
  Gerd


[-- Attachment #2: 0001-pci-handle-bridge-irq-mapping.patch --]
[-- Type: text/plain, Size: 1400 bytes --]

>From a36868ea1b32978244624a62ce7742346cbf5e50 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 4 May 2012 17:33:36 +0200
Subject: [PATCH] pci: handle bridge irq mapping

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 src/pciinit.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/pciinit.c b/src/pciinit.c
index 52c5b69..e2bdc0c 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -88,9 +88,15 @@ const u8 pci_irqs[4] = {
 };
 
 // Return the global irq number corresponding to a host bus device irq pin.
-static int pci_slot_get_irq(u16 bdf, int pin)
+static int pci_slot_get_irq(struct pci_device *pci, int pin)
 {
-    int slot_addend = pci_bdf_to_dev(bdf) - 1;
+    int slot_addend = 0;
+
+    while (pci->parent != NULL) {
+        slot_addend += pci_bdf_to_dev(pci->bdf);
+        pci = pci->parent;
+    }
+    slot_addend += pci_bdf_to_dev(pci->bdf) - 1;
     return pci_irqs[(pin - 1 + slot_addend) & 3];
 }
 
@@ -211,7 +217,7 @@ static void pci_bios_init_device(struct pci_device *pci)
     /* map the interrupt */
     int pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
     if (pin != 0)
-        pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(bdf, pin));
+        pci_config_writeb(bdf, PCI_INTERRUPT_LINE, pci_slot_get_irq(pci, pin));
 
     pci_init_device(pci_device_tbl, pci, NULL);
 }
-- 
1.7.1


  reply	other threads:[~2012-05-04 15:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04  8:21 [Qemu-devel] [seabios patch 0/5] dynamic pci i/o windows Gerd Hoffmann
2012-05-04  8:21 ` [Qemu-devel] [seabios patch 1/5] pci: init all devices Gerd Hoffmann
2012-05-04 13:15   ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2012-05-04 15:35     ` Gerd Hoffmann [this message]
2012-05-05  0:10       ` Kevin O'Connor
2012-05-12 18:16       ` Kevin O'Connor
2012-05-04  8:21 ` [Qemu-devel] [seabios patch 2/5] acpi: add qemu fwcfg driver Gerd Hoffmann
2012-05-04  8:21 ` [Qemu-devel] [seabios patch 3/5] acpi: update pci io windows according to fw_cfg info Gerd Hoffmann
2012-05-04  8:21 ` [Qemu-devel] [seabios patch 4/5] pciinit: make pci ressources configurable Gerd Hoffmann
2012-05-04  8:21 ` [Qemu-devel] [seabios patch 5/5] update src/acpi-dsdt.hex Gerd Hoffmann
2012-05-04  9:04   ` [Qemu-devel] [SeaBIOS] " Gerd Hoffmann
2012-05-04  9:24     ` Michael Tokarev
2012-05-04 13:18 ` [Qemu-devel] [SeaBIOS] [seabios patch 0/5] dynamic pci i/o windows Kevin O'Connor
2012-05-04 14:01   ` Gerd Hoffmann
2012-05-04 14:46     ` Kevin O'Connor
2012-05-04 15:37       ` Kevin O'Connor
2012-05-06  8:50         ` Gleb Natapov
2012-05-07  1:58 ` Alexey Korolev
2012-05-07  2:43   ` 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=4FA3F72E.7080103@redhat.com \
    --to=kraxel@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.