All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Julia Suvorova <jusual@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH 4/5] hw/i386/acpi-build: Turn off support of PCIe native hot-plug and SHPC in _OSC
Date: Wed, 15 Jul 2020 15:23:26 +0200	[thread overview]
Message-ID: <20200715152326.2e38ddb8@redhat.com> (raw)
In-Reply-To: <20200714040118-mutt-send-email-mst@kernel.org>

On Tue, 14 Jul 2020 04:39:53 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Mon, Jul 13, 2020 at 04:56:54PM +0200, Igor Mammedov wrote:
> > On Thu,  9 Jul 2020 00:46:14 +0200
> > Julia Suvorova <jusual@redhat.com> wrote:
> >   
> > > Other methods may be used if the system is capable of this and the _OSC bit
> > > is set. Disable them explicitly to force ACPI PCI hot-plug use. The older
> > > versions will still use PCIe native.  
> 
> Do we need that later part btw?
> 
> > > 
> > > Signed-off-by: Julia Suvorova <jusual@redhat.com>
> > > ---
> > >  hw/i386/acpi-build.c | 12 ++++++++----
> > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > > index 5c5ad88ad6..0e2891c3ea 100644
> > > --- a/hw/i386/acpi-build.c
> > > +++ b/hw/i386/acpi-build.c
> > > @@ -1599,6 +1599,7 @@ static Aml *build_q35_osc_method(AcpiPmInfo *pm)
> > >      Aml *method;
> > >      Aml *a_cwd1 = aml_name("CDW1");
> > >      Aml *a_ctrl = aml_local(0);
> > > +    unsigned osc_ctrl;
> > >  
> > >      method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
> > >      aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
> > > @@ -1612,9 +1613,12 @@ static Aml *build_q35_osc_method(AcpiPmInfo *pm)
> > >  
> > >      /*
> > >       * Always allow native PME, AER (no dependencies)
> > > -     * Allow SHPC (PCI bridges can have SHPC controller)
> > > +     * Need to disable native and SHPC hot-plug to use acpihp
> > > +     *
> > > +     * PCI Firmware Specification, Revision 3.2  
> 
> I don't think you have to add a reference as part of this patchset.
> The spec in question documents _OSC so it's not a bad idea to
> add it, but it's a bit more work, e.g. we generally try to list
> the earliest spec that documents the given feature, since
> So I suspect this is 3.0 actually.
> 
> 
> > seems incomplete, were you going to point to a concrete chapter that requires this change?  
> 
> 
> It doesn't as such. A better description would be:
> 
> / * Guests seem to generally prefer native hotplug control. As we want them to
>   * use ACPI, don't enable it.
>   */
> 
> 
> 
> > >       */
> > > -    aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1F), a_ctrl));
> > > +    osc_ctrl = pm->pcihp_bridge_en ? 0x1C : 0x1F;  
> > Since you are touching this, how about converting this magic number to
> > something more readable?
> > i.e.
> >             set_bit(ACPI_OSC_SHPC_EN,  osc_ctrl)
> >           or
> >             osc_ctrl |= BIT(SOME_FEATURE)
> >   
> 
> ... if there is such a macro. If not I suspect it's better as a comment:
> 
> 	0x10 /* PCI Express Capability Structure control */ |
> 	0x80 /* PCI Express Advanced Error Reporting control */ |
> 	0x40 /* PCI Express Native Power Management Events control */

if that is a spec quoted nearby than, I like comments idea as it
follows the same style which we use with ACPI numbers.
We just need split single magic number onto separate features bits
so it would be readable.

> 
> 
> 
> > > +    aml_append(if_ctx, aml_and(a_ctrl, aml_int(osc_ctrl), a_ctrl));
> > >  
> > >      if_ctx2 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1))));
> > >      /* Unknown revision */
> > > @@ -1696,7 +1700,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> > >          aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
> > >          aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
> > >          aml_append(dev, aml_name_decl("_UID", aml_int(1)));
> > > -        aml_append(dev, build_q35_osc_method());
> > > +        aml_append(dev, build_q35_osc_method(pm));
> > >          aml_append(sb_scope, dev);
> > >          aml_append(dsdt, sb_scope);
> > >  
> > > @@ -1771,7 +1775,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
> > >              if (pci_bus_is_express(bus)) {
> > >                  aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
> > >                  aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
> > > -                aml_append(dev, build_q35_osc_method());
> > > +                aml_append(dev, build_q35_osc_method(pm));
> > >              } else {
> > >                  aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
> > >              }  
> 
> 



  reply	other threads:[~2020-07-15 13:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 22:46 [RFC PATCH 0/5] Use ACPI PCI hot-plug for q35 Julia Suvorova
2020-07-08 22:46 ` [RFC PATCH 1/5] hw/acpi/pcihp: Introduce find_host() Julia Suvorova
2020-07-13  9:37   ` Igor Mammedov
2020-07-08 22:46 ` [RFC PATCH 2/5] hw/acpi/ich9: Trace ich9_gpe_readb()/writeb() Julia Suvorova
2020-07-13  9:39   ` Igor Mammedov
2020-07-08 22:46 ` [RFC PATCH 3/5] hw/i386/acpi-build: Add ACPI PCI hot-plug methods to q35 Julia Suvorova
2020-07-13 14:39   ` Igor Mammedov
2020-07-14  9:22     ` Michael S. Tsirkin
2020-07-14 14:57       ` Igor Mammedov
2020-07-15  6:57     ` Gerd Hoffmann
2020-07-15 13:17       ` Igor Mammedov
2020-07-15 14:02         ` Gerd Hoffmann
2020-07-08 22:46 ` [RFC PATCH 4/5] hw/i386/acpi-build: Turn off support of PCIe native hot-plug and SHPC in _OSC Julia Suvorova
2020-07-13 14:56   ` Igor Mammedov
2020-07-14  8:39     ` Michael S. Tsirkin
2020-07-15 13:23       ` Igor Mammedov [this message]
2020-07-08 22:46 ` [RFC PATCH 5/5] hw/acpi/ich9: Enable ACPI PCI hot-plug Julia Suvorova
2020-07-13 15:17   ` Igor Mammedov
2020-07-14  8:54     ` Michael S. Tsirkin
2020-07-15 13:33       ` Igor Mammedov
2020-07-08 23:29 ` [RFC PATCH 0/5] Use ACPI PCI hot-plug for q35 no-reply
2020-07-08 23:33 ` 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=20200715152326.2e38ddb8@redhat.com \
    --to=imammedo@redhat.com \
    --cc=jusual@redhat.com \
    --cc=mst@redhat.com \
    --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.