All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH qemu] spapr_pci: Create assigned properties for bridges
@ 2020-01-29  2:31 Alexey Kardashevskiy
  2020-01-29  2:46 ` no-reply
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2020-01-29  2:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, David Gibson

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).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

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,
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
  2020-01-29  2:31 [PATCH qemu] spapr_pci: Create assigned properties for bridges Alexey Kardashevskiy
@ 2020-01-29  2:46 ` no-reply
  2020-01-29  2:50 ` no-reply
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: no-reply @ 2020-01-29  2:46 UTC (permalink / raw)
  To: aik; +Cc: aik, qemu-ppc, qemu-devel, david

Patchew URL: https://patchew.org/QEMU/20200129023111.1699-1-aik@ozlabs.ru/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20200129023111.1699-1-aik@ozlabs.ru/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
  2020-01-29  2:31 [PATCH qemu] spapr_pci: Create assigned properties for bridges Alexey Kardashevskiy
  2020-01-29  2:46 ` no-reply
@ 2020-01-29  2:50 ` no-reply
  2020-01-29  2:52 ` no-reply
  2020-01-29  3:37 ` David Gibson
  3 siblings, 0 replies; 6+ messages in thread
From: no-reply @ 2020-01-29  2:50 UTC (permalink / raw)
  To: aik; +Cc: aik, qemu-ppc, qemu-devel, david

Patchew URL: https://patchew.org/QEMU/20200129023111.1699-1-aik@ozlabs.ru/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20200129023111.1699-1-aik@ozlabs.ru/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
  2020-01-29  2:31 [PATCH qemu] spapr_pci: Create assigned properties for bridges Alexey Kardashevskiy
  2020-01-29  2:46 ` no-reply
  2020-01-29  2:50 ` no-reply
@ 2020-01-29  2:52 ` no-reply
  2020-01-29  3:37 ` David Gibson
  3 siblings, 0 replies; 6+ messages in thread
From: no-reply @ 2020-01-29  2:52 UTC (permalink / raw)
  To: aik; +Cc: aik, qemu-ppc, qemu-devel, david

Patchew URL: https://patchew.org/QEMU/20200129023111.1699-1-aik@ozlabs.ru/



Hi,

This series failed build test on FreeBSD host. Please find the details below.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
if qemu-system-x86_64 --help >/dev/null 2>&1; then
  QEMU=qemu-system-x86_64
elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
  QEMU=/usr/libexec/qemu-kvm
else
  exit 1
fi
make vm-build-freebsd J=21 QEMU=$QEMU
exit 0
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20200129023111.1699-1-aik@ozlabs.ru/testing.FreeBSD/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
  2020-01-29  2:31 [PATCH qemu] spapr_pci: Create assigned properties for bridges Alexey Kardashevskiy
                   ` (2 preceding siblings ...)
  2020-01-29  2:52 ` no-reply
@ 2020-01-29  3:37 ` David Gibson
  2020-01-29 22:57   ` Alexey Kardashevskiy
  3 siblings, 1 reply; 6+ messages in thread
From: David Gibson @ 2020-01-29  3:37 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel

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

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?

> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> 
> 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,

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH qemu] spapr_pci: Create assigned properties for bridges
  2020-01-29  3:37 ` David Gibson
@ 2020-01-29 22:57   ` Alexey Kardashevskiy
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Kardashevskiy @ 2020-01-29 22:57 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel



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 <aik@ozlabs.ru>
>> ---
>>
>> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-29 22:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29  2:31 [PATCH qemu] spapr_pci: Create assigned properties for bridges Alexey Kardashevskiy
2020-01-29  2:46 ` no-reply
2020-01-29  2:50 ` no-reply
2020-01-29  2:52 ` no-reply
2020-01-29  3:37 ` David Gibson
2020-01-29 22:57   ` Alexey Kardashevskiy

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.