All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yubo Miao <miaoyubo@huawei.com>
Cc: peter.maydell@linaro.org, berrange@redhat.com,
	qemu-devel@nongnu.org, xiexiangyou@huawei.com,
	shannon.zhaosl@gmail.com, imammedo@redhat.com, lersek@redhat.com
Subject: Re: [PATCH v6 2/8] fw_cfg: Write the extra roots into the fw_cfg
Date: Mon, 4 May 2020 10:02:32 -0400	[thread overview]
Message-ID: <20200504100057-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200408125816.955-3-miaoyubo@huawei.com>

On Wed, Apr 08, 2020 at 08:58:10PM +0800, Yubo Miao wrote:
> From: miaoyubo <miaoyubo@huawei.com>
> 
> Write the extra roots into the fw_cfg therefore the uefi could
> get the extra roots. Only if the uefi know there are extra roots,
> the config space of devices behind the root could be obtained.
> 
> Signed-off-by: miaoyubo <miaoyubo@huawei.com>
> ---
>  hw/arm/virt.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 7dc96abf72..0fdfe4129c 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -77,6 +77,7 @@
>  #include "hw/acpi/generic_event_device.h"
>  #include "hw/virtio/virtio-iommu.h"
>  #include "hw/char/pl011.h"
> +#include "hw/pci/pci_bus.h"
>  
>  #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
>      static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
> @@ -1435,6 +1436,12 @@ void virt_machine_done(Notifier *notifier, void *data)
>      ARMCPU *cpu = ARM_CPU(first_cpu);
>      struct arm_boot_info *info = &vms->bootinfo;
>      AddressSpace *as = arm_boot_address_space(cpu, info);
> +    PCIHostState *s = OBJECT_CHECK(PCIHostState,
> +                                   object_resolve_path_type("",
> +                                   "pcie-host-bridge", NULL),
> +                                   TYPE_PCI_HOST_BRIDGE);
> +
> +    PCIBus *bus = s->bus;
>  
>      /*
>       * If the user provided a dtb, we assume the dynamic sysbus nodes


Seems duplicated all over the place. Add an API for that?

> @@ -1453,6 +1460,22 @@ void virt_machine_done(Notifier *notifier, void *data)
>          exit(1);
>      }
>  
> +    if (bus) {
> +        int extra_hosts = 0;
> +        QLIST_FOREACH(bus, &bus->child, sibling) {
> +            /* look for expander root buses */
> +            if (pci_bus_is_root(bus)) {
> +                extra_hosts++;
> +            }
> +        }
> +        if (extra_hosts && vms->fw_cfg) {
> +            uint64_t *val = g_malloc(sizeof(*val));
> +            *val = cpu_to_le64(extra_hosts);
> +            fw_cfg_add_file(vms->fw_cfg,
> +                   "etc/extra-pci-roots", val, sizeof(*val));
> +        }
> +    }
> +
>      virt_acpi_setup(vms);
>      virt_build_smbios(vms);


Duplicated from pc. Pls refactor.

>  }
> -- 
> 2.19.1
> 



  reply	other threads:[~2020-05-04 14:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 12:58 [PATCH v6 0/8] pci_expander_brdige:acpi:Support pxb-pcie for ARM Yubo Miao
2020-04-08 12:58 ` [PATCH v6 1/8] acpi: Extract two APIs from acpi_dsdt_add_pci Yubo Miao
2020-04-08 12:58 ` [PATCH v6 2/8] fw_cfg: Write the extra roots into the fw_cfg Yubo Miao
2020-05-04 14:02   ` Michael S. Tsirkin [this message]
2020-05-08 12:50     ` miaoyubo
2020-04-08 12:58 ` [PATCH v6 3/8] acpi: Extract crs build form acpi_build.c Yubo Miao
2020-04-08 12:58 ` [PATCH v6 4/8] acpi: Refactor the source of host bridge and build tables for pxb Yubo Miao
2020-05-04 14:00   ` Michael S. Tsirkin
2020-05-08 13:12     ` miaoyubo
2020-04-08 12:58 ` [PATCH v6 5/8] acpi: Align the size to 128k Yubo Miao
2020-05-04 14:03   ` Michael S. Tsirkin
2020-05-08 13:17     ` miaoyubo
2020-04-08 12:58 ` [PATCH v6 6/8] unit-test: The files changed Yubo Miao
2020-04-08 12:58 ` [PATCH v6 7/8] unit-test: Add testcase for pxb Yubo Miao
2020-04-08 12:58 ` [PATCH v6 8/8] unit-test: Add the binary file and clear diff.h Yubo Miao
2020-04-08 13:11 ` [PATCH v6 0/8] pci_expander_brdige:acpi:Support pxb-pcie for ARM no-reply

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=20200504100057-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=berrange@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=miaoyubo@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=xiexiangyou@huawei.com \
    /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 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.