From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: peter.maydell@linaro.org, jusual@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] acpi: x86: pcihp: cleanup devfn usage in build_append_pci_bus_devices()
Date: Thu, 22 Jul 2021 13:56:18 -0400 [thread overview]
Message-ID: <20210722135030-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210722105945.2080428-2-imammedo@redhat.com>
I would add a description: we want to scan all functions
not just function 0 to describe hotplug into bridges
at function != 0. in preparation for this, refactor code to not
skip functions != 0.
On Thu, Jul 22, 2021 at 06:59:44AM -0400, Igor Mammedov wrote:
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/i386/acpi-build.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 17836149fe..b40e284b72 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -374,7 +374,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> Aml *dev, *notify_method = NULL, *method;
> QObject *bsel;
> PCIBus *sec;
> - int i;
> + int devfn;
>
> bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL);
> if (bsel) {
> @@ -384,11 +384,11 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED);
> }
>
> - for (i = 0; i < ARRAY_SIZE(bus->devices); i += PCI_FUNC_MAX) {
> + for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) {
> DeviceClass *dc;
> PCIDeviceClass *pc;
> - PCIDevice *pdev = bus->devices[i];
> - int slot = PCI_SLOT(i);
> + PCIDevice *pdev = bus->devices[devfn];
> + int slot = PCI_SLOT(devfn);
> bool hotplug_enabled_dev;
> bool bridge_in_acpi;
> bool cold_plugged_bridge;
I am a bit puzzled about why this is equivalent. so we used to scan just
function 0 on each slot. now we are scanning them all.
won't this generate a different AML code? in fact duplicate
descriptions?
I suspect you need to move the check for slot == 0 from the next patch
to this one otherwise bisect will be broken.
Or just squash this part into next patch. up to you.
> @@ -525,13 +525,12 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
> /* Notify about child bus events in any case */
> if (pcihp_bridge_en) {
> QLIST_FOREACH(sec, &bus->child, sibling) {
> - int32_t devfn = sec->parent_dev->devfn;
> -
> if (pci_bus_is_root(sec)) {
> continue;
> }
>
> - aml_append(method, aml_name("^S%.02X.PCNT", devfn));
> + aml_append(method, aml_name("^S%.02X.PCNT",
> + sec->parent_dev->devfn));
> }
> }
>
this is a refactor, sure.
> --
> 2.27.0
next prev parent reply other threads:[~2021-07-22 18:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 10:59 [PATCH 0/2] acpi: pcihp: fix hotplug when bridge is wired to function > 0 Igor Mammedov
2021-07-22 10:59 ` [PATCH 1/2] acpi: x86: pcihp: cleanup devfn usage in build_append_pci_bus_devices() Igor Mammedov
2021-07-22 17:56 ` Michael S. Tsirkin [this message]
2021-07-23 7:34 ` Igor Mammedov
2021-07-22 10:59 ` [PATCH 2/2] acpi: x86: pcihp: add support hotplug on multifunction bridges Igor Mammedov
2021-07-22 12:38 ` Laurent Vivier
2021-07-22 17:49 ` Michael S. Tsirkin
2021-07-22 18:13 ` Laurent Vivier
2021-07-23 7:47 ` Igor Mammedov
2021-07-23 8:05 ` Michael S. Tsirkin
2021-07-23 8:33 ` Igor Mammedov
2021-07-23 8:48 ` Daniel P. Berrangé
2021-07-23 9:34 ` Michael S. Tsirkin
2021-07-23 8:50 ` Daniel P. Berrangé
2021-07-22 17:56 ` [PATCH 0/2] acpi: pcihp: fix hotplug when bridge is wired to function > 0 Michael S. Tsirkin
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=20210722135030-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=imammedo@redhat.com \
--cc=jusual@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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.