qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ani Sinha <ani@anisinha.ca>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Eduardo Habkost <eduardo@habkost.net>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	qemu-devel@nongnu.org, kkostiuk@redhat.com, yvugenfi@redhat.com,
	yiwei@redhat.com, ybendito@redhat.com, jusual@redhat.com
Subject: Re: [RFC PATCH] hw/acpi: do not let OSPM set pcie native hotplug when acpi hotplug is enabled
Date: Tue, 6 Sep 2022 09:39:52 +0200	[thread overview]
Message-ID: <20220906093952.736ca756@redhat.com> (raw)
In-Reply-To: <971e9a8-f9a1-4280-3fc5-4b695d42698b@anisinha.ca>

On Mon, 5 Sep 2022 22:25:25 +0530 (IST)
Ani Sinha <ani@anisinha.ca> wrote:

> On Mon, 5 Sep 2022, Ani Sinha wrote:
> 
> >
> >  
> 
> > > >
> > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > > index 0355bd3dda..3dc9379f27 100644
> > > > --- a/hw/i386/acpi-build.c
> > > > +++ b/hw/i386/acpi-build.c
> > > > @@ -1348,10 +1348,12 @@ static Aml *build_q35_osc_method(bool enable_native_pcie_hotplug)
> > > >  {
> > > >      Aml *if_ctx;
> > > >      Aml *if_ctx2;
> > > > +    Aml *if_ctx3;
> > > >      Aml *else_ctx;
> > > >      Aml *method;
> > > >      Aml *a_cwd1 = aml_name("CDW1");
> > > >      Aml *a_ctrl = aml_local(0);
> > > > +    Aml *a_pcie_nhp_ctl = aml_local(1);
> > > >
> > > >      method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
> > > >      aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
> > > > @@ -1366,11 +1368,26 @@ static Aml *build_q35_osc_method(bool enable_native_pcie_hotplug)
> > > >      /*
> > > >       * Always allow native PME, AER (no dependencies)
> > > >       * Allow SHPC (PCI bridges can have SHPC controller)
> > > > -     * Disable PCIe Native Hot-plug if ACPI PCI Hot-plug is enabled.
> > > >       */
> > > > -    aml_append(if_ctx, aml_and(a_ctrl,
> > > > -        aml_int(0x1E | (enable_native_pcie_hotplug ? 0x1 : 0x0)), a_ctrl));
> > > > +    aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1F), a_ctrl));  
> > >
> > > that makes us not actually mask any capabilities since you forgot to mask
> > > bit 1 later under if_ctx3 context.
> > >
> > > So OSPM will see a permanent failure (_OSC failure bit in CWD1)
> > > and will have no idea that PCI Hotplug is not supported since we return CWD3
> > > with this bit still set whoever much it tries to negotiate.  
> >
> > The failure is only returned when the OS requests/probes native hotplug
> > capability in CWD1.  
> 
> I meant CWD3.
For OSPM to know which features are denied by platform, the later must mask
them in returned bitmask, how otherwise you would see above behavior.
(or alternatively OSPM might ignore _OSC results and resort to workarounds/probing
as result enabling native hotplug in which case you would see ATS
detected).

To verify which hotplug is used, you can just trace acpi_pci_* in QEMU and observe
if it's used for unplug or not.



  reply	other threads:[~2022-09-06  7:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  7:25 [RFC PATCH] hw/acpi: do not let OSPM set pcie native hotplug when acpi hotplug is enabled Ani Sinha
2022-09-05 10:53 ` Michael S. Tsirkin
2022-09-05 12:57   ` Ani Sinha
2022-09-05 15:52 ` Igor Mammedov
2022-09-05 16:50   ` Ani Sinha
2022-09-05 16:55     ` Ani Sinha
2022-09-06  7:39       ` Igor Mammedov [this message]
2022-09-06  7:45         ` Ani Sinha

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=20220906093952.736ca756@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=eduardo@habkost.net \
    --cc=jusual@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=ybendito@redhat.com \
    --cc=yiwei@redhat.com \
    --cc=yvugenfi@redhat.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).