qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eric DeVolder <eric.devolder@oracle.com>
Cc: shannon.zhaosl@gmail.com, imammedo@redhat.com, ani@anisinha.ca,
	peter.maydell@linaro.org, qemu-arm@nongnu.org,
	qemu-devel@nongnu.org, marcel.apfelbaum@gmail.com,
	pbonzini@redhat.com, richard.henderson@linaro.org,
	eduardo@habkost.net, boris.ostrovsky@oracle.com
Subject: Re: [PATCH 2/2] hw/acpi: i386: bump MADT to revision 5
Date: Wed, 29 Mar 2023 12:55:49 -0400	[thread overview]
Message-ID: <20230329125543-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5ff9199b-0149-45dc-6138-3ad9b2d71fd3@oracle.com>

On Wed, Mar 29, 2023 at 08:19:22AM -0500, Eric DeVolder wrote:
> 
> 
> On 3/29/23 08:16, Eric DeVolder wrote:
> > 
> > 
> > On 3/29/23 00:03, Michael S. Tsirkin wrote:
> > > On Tue, Mar 28, 2023 at 11:59:26AM -0400, Eric DeVolder wrote:
> > > > Currently i386 QEMU generates MADT revision 3, and reports
> > > > MADT revision 1. ACPI 6.3 introduces MADT revision 5.
> > > > 
> > > > For MADT revision 4, that introduces ARM GIC structures, which do
> > > > not apply to i386.
> > > > 
> > > > For MADT revision 5, the Local APIC flags introduces the Online
> > > > Capable bitfield.
> > > > 
> > > > Making MADT generate and report revision 5 will solve problems with
> > > > CPU hotplug (the Online Capable flag indicates hotpluggable CPUs).
> > > > 
> > > > Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
> > > 
> > > I am looking for ways to reduce risk of breakage with this.
> > > We don't currently have a reason to change it if cpu
> > > hotplug is off, do we? Maybe make it conditional on that.
> > 
> > By "cpu hotplug off", do you mean, for example, no maxcpus= option?
> > In other words, how should I detect "cpu hotplug off"?
> > eric
> > 
> 
> Actually, if, for example, one had -smp 30,maxcpus=32, then there would be
> two hotpluggable cpus reported, the last two with the Enabled=0 and Online
> Capable=1. If one had -smp 32 (ie "cpu hotplug off"), then all cpus would be
> reported as Enabled and no cpu would have its Online Capable flag set.
> 
> Granted in both cases, MADT.revision would report 5, but it would still be accurate.
> 
> eric

sounds good.

> > > 
> > > 
> > > 
> > > 
> > > 
> > > > ---
> > > >   hw/i386/acpi-common.c | 13 ++++++++++---
> > > >   1 file changed, 10 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
> > > > index 52e5c1439a..1e3a13a36c 100644
> > > > --- a/hw/i386/acpi-common.c
> > > > +++ b/hw/i386/acpi-common.c
> > > > @@ -38,8 +38,15 @@ void pc_madt_cpu_entry(int uid, const CPUArchIdList *apic_ids,
> > > >   {
> > > >       uint32_t apic_id = apic_ids->cpus[uid].arch_id;
> > > >       /* Flags – Local APIC Flags */
> > > > -    uint32_t flags = apic_ids->cpus[uid].cpu != NULL || force_enabled ?
> > > > -                     1 /* Enabled */ : 0;
> > > > +    bool enabled = apic_ids->cpus[uid].cpu != NULL || force_enabled ?
> > > > +                     true /* Enabled */ : false;
> > > > +    /*
> > > > +     * ACPI 6.3 5.2.12.2 Local APIC Flags: OnlineCapable must be 0
> > > > +     * if Enabled is set.
> > > > +     */
> > > > +    bool onlinecapable = enabled ? false : true; /* Online Capable */
> > > > +    uint32_t flags = onlinecapable ? 0x2 : 0x0 |
> > > > +        enabled ? 0x1 : 0x0;
> > > >       /* ACPI spec says that LAPIC entry for non present
> > > >        * CPU may be omitted from MADT or it must be marked
> > > > @@ -102,7 +109,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
> > > >       MachineClass *mc = MACHINE_GET_CLASS(x86ms);
> > > >       const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
> > > >       AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(adev);
> > > > -    AcpiTable table = { .sig = "APIC", .rev = 1, .oem_id = oem_id,
> > > > +    AcpiTable table = { .sig = "APIC", .rev = 5, .oem_id = oem_id,
> > > >                           .oem_table_id = oem_table_id };
> > > >       acpi_table_begin(&table, table_data);
> > > > -- 
> > > > 2.31.1
> > > > 
> > > > 
> > > > 
> > > 



  reply	other threads:[~2023-03-29 16:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 15:59 [PATCH 0/2] hw/acpi: bump MADT to revision 5 Eric DeVolder
2023-03-28 15:59 ` [PATCH 1/2] hw/acpi: arm: " Eric DeVolder
2023-04-11 14:49   ` Igor Mammedov
2023-03-28 15:59 ` [PATCH 2/2] hw/acpi: i386: " Eric DeVolder
2023-03-29  5:03   ` Michael S. Tsirkin
2023-03-29 13:16     ` Eric DeVolder
2023-03-29 13:19       ` Eric DeVolder
2023-03-29 16:55         ` Michael S. Tsirkin [this message]
2023-03-31 16:29       ` Igor Mammedov
2023-04-11 16:00   ` Igor Mammedov
2023-04-12  7:58     ` Igor Mammedov
2023-04-18 16:58       ` Eric DeVolder
2023-03-28 16:37 ` [PATCH 0/2] hw/acpi: " Eric DeVolder
2023-03-29  5:19 ` Michael S. Tsirkin
2023-03-29 13:14   ` Eric DeVolder
2023-03-29 16:47     ` Michael S. Tsirkin
2023-03-30  7:36       ` Ani Sinha
2023-03-30 13:44         ` Michael S. Tsirkin
2023-03-30 14:02           ` Ani Sinha
2023-03-30 14:11             ` Michael S. Tsirkin
2023-03-31 16:25       ` Igor Mammedov
2023-04-04 14:52         ` Eric DeVolder

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=20230329125543-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eduardo@habkost.net \
    --cc=eric.devolder@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shannon.zhaosl@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).