qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH 1/3] tests: add libpci qtest library


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC PATCH 1/3] tests: add libpci qtest library
Date: Mon, 16 Apr 2012 13:05:03 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 04/16/2012 04:14 AM, Stefan Hajnoczi wrote:
On Sat, Apr 14, 2012 at 12:32:00PM +0000, Blue Swirl wrote:
On Fri, Apr 13, 2012 at 14:27, Stefan Hajnoczi
<address@hidden>  wrote:
This patch adds a common PCI bus driver library which works for
i386/x86-64 targets.  Tests can use the library to probe for PCI
devices, map BARs, and access configuration space.

I guess we have almost identical code in SeaBIOS, OpenBIOS, various OS
and maybe userland PCI tools. Would it be possible to reduce NIH
somewhere?

Probably not given how small these functions are and how they use glib
assert calls because they are part of tests.

+void pci_config_writel(PciDevice *dev, unsigned int offset, uint32_t l)
+{
+    pci_config_setup(dev, offset);
+    outl(PCI_CONFIG_DATA, l);
+}

All code above is specific to i440fx or similar PCI bridges, other
bridges may use different config space access methods. If we want to
share the rest for example with Sparc64 or PPC, the above would need
to be changed. How about splitting the above to a separate file? It
could be done later too.

Yes, it's only i440fx for now.  I think it makes sense to move it later
since we have no non-x86 qtests yet.

Note that this isn't i440fx specific at all. cf8 is the standard port for PCI on the PC.

I think what we'll want to eventually do is make a pci_config_read/pci_write() set of function pointers that can be overloaded.

But definitely don't name it libqtest-i440fx.  At least call it libqtest-pc.c

Regards,

Anthony Liguori


+
+/* Initialize a PciDevice if a device is present on the bus */

The comment talks about initalizing instead of only probing which is
actually what the code does, please fix.

Sorry this comment is unclear.  I meant initializing the "PciDevice"
struct, not the physical PCI device.  Will change.

Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]