All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] pci: add standard bridge device
Date: Thu, 08 Sep 2011 11:43:14 +0200	[thread overview]
Message-ID: <4E688E32.7060207@redhat.com> (raw)
In-Reply-To: <4E686E0C.7090906@cn.fujitsu.com>

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

   Hi,

> I modify the code like this, and the PCI_INTERRUPT_LINE register is set, and I can bind
> it to uio_pci_generic:

> --- a/src/pciinit.c
> +++ b/src/pciinit.c
> @@ -575,6 +575,8 @@ static int pci_bios_init_root_regions(u32 start, u32 end)

>       pci_bios_init_bus_bases(&busses[0]);
> -    pci_bios_map_device_in_bus(0 /* host bus */);
> +    for (bus = 0; bus<= MaxPCIBus; bus++) {
> +        pci_bios_map_device_in_bus(bus /* host bus */);

No.  pci_bios_map_device_in_bus goes down recursively when it finds a 
bridge, so it should cover all devices already.

> -    pci_bios_init_device_in_bus(0 /* host bus */);
> +        pci_bios_init_device_in_bus(bus /* host bus */);
> +    }

That is correct.  Can be done easier though by just not limiting device 
initialization to a specific bus like in the attached patch.  Does that 
one work for you?

cheers,
   Gerd

[-- Attachment #2: fix --]
[-- Type: text/plain, Size: 1197 bytes --]

diff --git a/src/pciinit.c b/src/pciinit.c
index 597c8ea..676e35e 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -45,7 +45,7 @@ static struct pci_bus {
 } *busses;
 static int busses_count;
 
-static void pci_bios_init_device_in_bus(int bus);
+static void pci_bios_init_device_all(void);
 static void pci_bios_check_device_in_bus(int bus);
 static void pci_bios_init_bus_bases(struct pci_bus *bus);
 static void pci_bios_map_device_in_bus(int bus);
@@ -254,15 +254,10 @@ static void pci_bios_init_device(struct pci_device *pci)
     pci_init_device(pci_device_tbl, pci, NULL);
 }
 
-static void pci_bios_init_device_in_bus(int bus)
+static void pci_bios_init_device_all(void)
 {
     struct pci_device *pci;
     foreachpci(pci) {
-        u8 pci_bus = pci_bdf_to_bus(pci->bdf);
-        if (pci_bus < bus)
-            continue;
-        if (pci_bus > bus)
-            break;
         pci_bios_init_device(pci);
     }
 }
@@ -605,7 +600,7 @@ pci_setup(void)
     pci_bios_init_bus_bases(&busses[0]);
     pci_bios_map_device_in_bus(0 /* host bus */);
 
-    pci_bios_init_device_in_bus(0 /* host bus */);
+    pci_bios_init_device_all();
 
     struct pci_device *pci;
     foreachpci(pci) {

  reply	other threads:[~2011-09-08  9:43 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04  9:43 [Qemu-devel] [PATCH] pci: add standard bridge device Michael S. Tsirkin
2011-07-05 13:29 ` Isaku Yamahata
2011-07-05 13:43   ` Michael S. Tsirkin
2011-08-17  8:37 ` Wen Congyang
2011-08-18  3:22   ` Wen Congyang
2011-08-18 15:15     ` Avi Kivity
2011-08-19  5:12       ` Wen Congyang
2011-08-19 15:26         ` Avi Kivity
2011-08-22  3:13           ` Wen Congyang
2011-08-22  6:23             ` Avi Kivity
2011-09-02  1:32               ` Wen Congyang
2011-09-02  2:56               ` Wen Congyang
2011-09-04  8:25                 ` Avi Kivity
2011-09-06  3:06                   ` Wen Congyang
2011-09-06  7:45                     ` Avi Kivity
2011-09-07  4:39                       ` Wen Congyang
2011-09-07 11:52                         ` Michael S. Tsirkin
2011-09-08  6:15                           ` Wen Congyang
2011-09-08  7:26                             ` Wen Congyang
2011-09-08  9:43                               ` Gerd Hoffmann [this message]
2011-09-08  9:58                                 ` Wen Congyang
2011-09-08 10:42                                   ` Michael S. Tsirkin
2011-09-08 11:03                                     ` Wen Congyang
2011-09-08 11:13                                       ` Michael S. Tsirkin
2011-09-09  6:43           ` Wen Congyang
2011-09-09  7:12             ` Michael S. Tsirkin
2011-09-09  7:24               ` Wen Congyang
2011-09-09  7:34                 ` Michael S. Tsirkin
2011-09-09  7:35                   ` Wen Congyang
2011-08-26  9:43       ` Michael S. Tsirkin
2011-08-28  7:50         ` Avi Kivity
2011-08-28 11:41           ` Michael S. Tsirkin
2011-08-28 13:10             ` Avi Kivity
2011-08-28 13:42               ` Michael S. Tsirkin
2011-08-28 13:53                 ` Avi Kivity
2011-09-04 12:30                   ` Michael S. Tsirkin
2011-09-04 12:40                     ` Avi Kivity
2011-09-04 13:01                       ` Michael S. Tsirkin
2011-09-04 13:05                         ` Avi Kivity
2011-09-04 13:09                           ` Avi Kivity
2011-09-04 13:41                           ` Michael S. Tsirkin
2011-09-04 13:55                             ` Avi Kivity
2011-09-04 14:21                               ` Michael S. Tsirkin
2011-09-04 14:36                                 ` Avi Kivity
2011-09-04 14:54                                   ` Michael S. Tsirkin
2011-09-04 15:14                                     ` Avi Kivity
2011-09-04 15:24                                       ` Michael S. Tsirkin
2011-09-04 15:37                                         ` Avi Kivity
2011-09-04 15:45                                           ` Michael S. Tsirkin
2011-09-04 15:46                                             ` Avi Kivity
2011-09-04 16:19                                               ` Michael S. Tsirkin
2011-09-04 16:22                                                 ` Avi Kivity
2011-09-04 17:03                                                   ` Michael S. Tsirkin
2011-09-05  5:36                                                     ` Avi Kivity
2011-09-04 15:26                                   ` Michael S. Tsirkin
2011-09-04 15:42                                     ` Avi Kivity
2011-09-04 15:46                                       ` Michael S. Tsirkin
2011-09-04 15:49                                         ` Avi Kivity
2011-09-04 16:20                                           ` Michael S. Tsirkin
2011-08-26  9:57     ` Michael S. Tsirkin
2011-09-04 17:11 ` Michael S. Tsirkin
2011-09-05  8:17   ` Markus Armbruster
2011-09-05  9:38     ` Michael S. Tsirkin
2011-09-05  9:53       ` Gerd Hoffmann
2011-09-05 11:40         ` Michael S. Tsirkin
2011-09-06  9:18         ` Markus Armbruster
     [not found] ` <4E801927.8020708@cn.fujitsu.com>
     [not found]   ` <20110926070824.GB5860@redhat.com>
     [not found]     ` <4EAF4AFD.6040102@cn.fujitsu.com>
     [not found]       ` <20111101084439.GA11958@redhat.com>
2011-11-01  8:49         ` Wen Congyang
2011-11-01 11:48           ` Michael S. Tsirkin
2011-11-02  1:00             ` Wen Congyang
2011-11-02  2:15           ` Isaku Yamahata
2011-11-02  2:38             ` Wen Congyang

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=4E688E32.7060207@redhat.com \
    --to=kraxel@redhat.com \
    --cc=avi@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wency@cn.fujitsu.com \
    --cc=yamahata@valinux.co.jp \
    /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.