[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
From: |
Alexey Kardashevskiy |
Subject: |
Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges |
Date: |
Thu, 30 Jan 2020 09:57:38 +1100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
On 29/01/2020 14:37, David Gibson wrote:
> On Wed, Jan 29, 2020 at 01:31:11PM +1100, Alexey Kardashevskiy wrote:
>> QEMU assigns bus numbers so tell the guest about assigned values.
>>
>> This also adds an empty "ranges" to let the existing linux kernels proceed
>> far enough to trigger resource reassignment (which is rather a
>> hack).
>
> That is rather a hack, but AIUI this makes things better than they
> were before, so I've applied it to ppc-for-5.0.
>
> What would a less hacky approach to this look like?
Assigning the bridge resources in QEMU is the proper fix I suppose. Thanks,
>
>>
>> Signed-off-by: Alexey Kardashevskiy <address@hidden>
>> ---
>>
>> This is a part of the "kill CAS reboot" effort, the SLOF's side of it was
>> posted as "[PATCH slof] fdt: Fix creating new nodes at H_CAS"
>>
>> ---
>> hw/ppc/spapr_pci.c | 18 +++++++++++++++++-
>> 1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
>> index 723373de732c..877ff1d0d5fa 100644
>> --- a/hw/ppc/spapr_pci.c
>> +++ b/hw/ppc/spapr_pci.c
>> @@ -1336,7 +1336,23 @@ static int spapr_dt_pci_bus(SpaprPhbState *sphb,
>> PCIBus *bus,
>> if (pci_bus_is_root(bus)) {
>> owner = OBJECT(sphb);
>> } else {
>> - owner = OBJECT(pci_bridge_get_device(bus));
>> + PCIDevice *pdev = pci_bridge_get_device(bus);
>> + uint8_t pri = pci_default_read_config(pdev, PCI_PRIMARY_BUS, 1);
>> + uint8_t sec = pci_default_read_config(pdev, PCI_SECONDARY_BUS, 1);
>> + uint8_t sub = pci_default_read_config(pdev, PCI_SUBORDINATE_BUS,
>> 1);
>> + uint32_t range[] = { cpu_to_be32(sec), cpu_to_be32(sub) };
>> +
>> + /*
>> + * Create these to get existing Linux kernels proceed far enough to
>> + * trigger resource reassignment. We creates these for vPHB already.
>> + */
>> + _FDT(fdt_setprop_cell(fdt, offset, "primary-bus", pri));
>> + _FDT(fdt_setprop_cell(fdt, offset, "secondary-bus", sec));
>> + _FDT(fdt_setprop_cell(fdt, offset, "subordinate-bus", sub));
>> + _FDT(fdt_setprop(fdt, offset, "bus-range", range, sizeof(range)));
>> + _FDT(fdt_setprop_string(fdt, offset, "device_type", "pci"));
>> + _FDT(fdt_setprop(fdt, offset, "ranges", NULL, 0));
>> + owner = OBJECT(pdev);
>> }
>>
>> ret = spapr_dt_drc(fdt, offset, owner,
>
--
Alexey