[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState wi
From: |
Eric Blake |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with QPCIBus |
Date: |
Wed, 6 Sep 2017 15:48:23 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/01/2017 02:20 PM, Philippe Mathieu-Daudé wrote:
> Hi Eric,
>
> On 09/01/2017 03:03 PM, Eric Blake wrote:
>> When initializing a QPCIBus, track which QTestState the bus is
>> associated with (so that a later patch can then explicitly use
>> that test state for all communication on the bus, rather than
>> blindly relying on global_qtest). Update the initialization
>> functions to take another parameter, and update all callers to
>> pass in state (for now, most callers get away with passing the
>> current global_qtest as the current state, although this required
>> fixing the order of initialization to ensure qtest_start() is
>> called before qpci_init*() in rtl8139-test, and provided an
>> opportunity to pass in the allocator in e1000e-test).
>>
>> +++ b/tests/libqos/pci-pc.c
>> @@ -115,11 +115,14 @@ static void qpci_pc_config_writel(QPCIBus *bus,
>> int devfn, uint8_t offset, uint3
>> outl(0xcfc, value);
>> }
>>
>> -QPCIBus *qpci_init_pc(QGuestAllocator *alloc)
>> +QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc)
>> {
>> QPCIBusPC *ret;
>>
>> + assert(qts);
>> +
>> ret = g_malloc(sizeof(*ret));
>
> I'd rather use g_malloc0() here (safer!)
Pre-existing, but yes, I can touch it while in the area.
>
>> + ret->bus.qts = qts;
>>
>> ret->bus.pio_readb = qpci_pc_pio_readb;
>> ret->bus.pio_readw = qpci_pc_pio_readw;
>
> or init qts field in same order than struct:
Okay.
>
> Either ways:
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature