qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge rea


From: Richard Henderson
Subject: Re: [PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize() handler
Date: Fri, 6 Jan 2023 10:57:21 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 1/5/23 05:07, Philippe Mathieu-Daudé wrote:
The PCI function #0 is an integral part of the PCI bridge,
instantiate it internally during the bridge creation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/pci-host/bonito.c | 11 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index d881c85509..7722636e9e 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -651,6 +651,11 @@ static void bonito_host_realize(DeviceState *dev, Error 
**errp)
      }
create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB);
+
+    bs->pci_dev = PCI_BONITO(pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO));
+    object_property_add_const_link(OBJECT(bs->pci_dev), "host-bridge",
+                                   OBJECT(bs));
+    pci_realize_and_unref(PCI_DEVICE(bs->pci_dev), phb->bus, &error_fatal);

You can avoid this final dynamic cast by saving the result of pci_new.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



reply via email to

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