From: Marcel Apfelbaum <marcel@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com,
pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH V2 3/4] hw/pc: query both q35 and i440fx bus
Date: Tue, 17 Nov 2015 12:29:04 +0200 [thread overview]
Message-ID: <564B0170.2010106@redhat.com> (raw)
In-Reply-To: <20151116182603.GA4180@thinpad.lan.raisama.net>
On 11/16/2015 08:26 PM, Eduardo Habkost wrote:
> On Sun, Nov 15, 2015 at 05:39:05PM +0200, Marcel Apfelbaum wrote:
>> Look for pxb devices on both i386 machines.
>>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> [...]
>> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
>> index c81507d..2fbbcd3 100644
>> --- a/hw/pci-host/q35.c
>> +++ b/hw/pci-host/q35.c
>> @@ -511,6 +511,14 @@ static void mch_realize(PCIDevice *d, Error **errp)
>> }
>> }
>>
>> +PCIBus *find_q35(void)
>> +{
>> + PCIHostState *s = OBJECT_CHECK(PCIHostState,
>> + object_resolve_path("/machine/q35", NULL),
>> + TYPE_PCI_HOST_BRIDGE);
>
Hi Eduardo,
Thanks for the review.
> Why not use the PCI_HOST_BRIDGE macro?
Do you mean ?
PCIHostState *s = PCI_HOST_BRIDGE(object_resolve_path("/machine/q35", NULL));
I can use it, thanks -- I was doing the usual copy/paste of the i440fx counterpart :)
>
>> + return s ? s->bus : NULL;
>> +}
>> +
>> uint64_t mch_mcfg_base(void)
>> {
>> bool ambiguous;
>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
>> index 4bbc0ff..95d7610 100644
>> --- a/include/hw/i386/pc.h
>> +++ b/include/hw/i386/pc.h
>> @@ -242,6 +242,15 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,
>> MemoryRegion *ram_memory);
>>
>> PCIBus *find_i440fx(void);
>> +PCIBus *find_q35(void);
>> +
>> +static inline PCIBus *find_pc(void)
>> +{
>> + PCIBus *bus = find_i440fx();
>> +
>> + return bus ? bus : find_q35();
>
> Have you considered a /machine/pci link, or (in case you don't
> want to add something new to the QOM tree) a simple
> PCMachineState::pci_bus struct field?
This is a nice idea, I like the PC machine state, I'll look into it.
Thanks,
Marcel
>
next prev parent reply other threads:[~2015-11-17 10:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-15 15:39 [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35 Marcel Apfelbaum
2015-11-15 15:39 ` [Qemu-devel] [PATCH V2 1/4] hw/pxb: remove the built-in pci bridge Marcel Apfelbaum
2015-11-15 15:39 ` [Qemu-devel] [PATCH V2 2/4] hw/acpi: merge pxb adjacent memory/IO ranges Marcel Apfelbaum
2015-11-15 15:39 ` [Qemu-devel] [PATCH V2 3/4] hw/pc: query both q35 and i440fx bus Marcel Apfelbaum
2015-11-16 18:26 ` Eduardo Habkost
2015-11-17 10:29 ` Marcel Apfelbaum [this message]
2015-11-15 15:39 ` [Qemu-devel] [PATCH V2 4/4] hw/pxb: add support for PCIe Marcel Apfelbaum
2015-11-16 8:40 ` [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35 Paolo Bonzini
2015-11-16 9:52 ` Marcel Apfelbaum
2015-11-16 9:56 ` Paolo Bonzini
2015-11-16 10:02 ` Marcel Apfelbaum
2015-11-16 10:03 ` Paolo Bonzini
2015-11-16 10:10 ` Marcel Apfelbaum
2015-11-16 10:11 ` Paolo Bonzini
2015-11-16 10:34 ` Marcel Apfelbaum
2015-11-16 10:37 ` Michael S. Tsirkin
2015-11-16 10:39 ` Marcel Apfelbaum
2015-11-16 10:59 ` Michael S. Tsirkin
2015-11-16 11:37 ` Marcel Apfelbaum
2015-11-16 13:30 ` Paolo Bonzini
2015-11-19 15:05 ` Laine Stump
2015-11-17 8:15 ` Markus Armbruster
2015-11-17 10:42 ` Marcel Apfelbaum
2015-11-17 12:26 ` Markus Armbruster
2015-11-17 13:49 ` Marcel Apfelbaum
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=564B0170.2010106@redhat.com \
--to=marcel@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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;
as well as URLs for NNTP newsgroup(s).