linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: joeyli <jlee@suse.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-usb@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Andreas Noever <andreas.noever@gmail.com>,
	Lukas Wunner <lukas@wunner.de>,
	Mario Limonciello <mario.limonciello@dell.com>,
	Christian Kellner <christian@kellner.me>,
	Len Brown <lenb@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-acpi@vger.kernel.org, iqgrande@gmail.com
Subject: Re: [PATCH v2 3/5] ACPI: Execute platform _OSC also with query bit clear
Date: Mon, 7 Jun 2021 20:31:10 +0800	[thread overview]
Message-ID: <20210607123110.GE22028@linux-l9pv.suse> (raw)
In-Reply-To: <20210203081415.GR2542@lahna.fi.intel.com>

Hi Mika,

There have some machines be found on openSUSE Tumbleweed that this patch
causes that SSDT tables can not be dynamic loaded. The symptom is that
dmesg shows '_CPC not found' because SSDT table did not dynamic load.

[    1.149107] ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210105/psargs-330)

Looks that the firmware didn't response OSC_SB_CPCV2_SUPPORT after
kernel changed to new behavior. The openSUSE bug is here:

Bug 1185513 - ACPI BIOS Error after upgrade to 5.12.0-1-default 
https://bugzilla.suse.com/show_bug.cgi?id=1185513

Could you please help to give any suggestion?

Thanks a lot!
Joey Lee

On Wed, Feb 03, 2021 at 10:14:15AM +0200, Mika Westerberg wrote:
> Hi Rafael,
> 
> I wonder if you are OK with this patch?
> 
> Thanks!
> 
> On Fri, Jan 29, 2021 at 11:32:39AM +0300, Mika Westerberg wrote:
> > From: Mario Limonciello <mario.limonciello@dell.com>
> > 
> > The platform _OSC can change the hardware state when query bit is not
> > set. According to ACPI spec it is recommended that the OS runs _OSC with
> > query bit set until the platform does not mask any of the capabilities.
> > Then it should run it with query bit clear in order to actually commit
> > the changes. Linux has not been doing this for the reasons that there
> > has not been anything to commit, until now.
> > 
> > The ACPI 6.4 introduced _OSC for USB4 to allow the OS to negotiate
> > native control over USB4 tunneling. The platform might implement this so
> > that it only activates the software connection manager path when the OS
> > calls the _OSC with the query bit clear. Otherwise it may default to the
> > firmware connection manager, for instance.
> > 
> > For this reason modify the _OSC support so that we first execute it with
> > query bit set, then use the returned value as base of the features we
> > want to control and run the _OSC again with query bit clear. This also
> > follows what Windows is doing.
> > 
> > Also rename the function to better match what it does.
> > 
> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> >  drivers/acpi/bus.c | 43 +++++++++++++++++++++++++++++++------------
> >  1 file changed, 31 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> > index 1682f8b454a2..a52cb28c40d8 100644
> > --- a/drivers/acpi/bus.c
> > +++ b/drivers/acpi/bus.c
> > @@ -282,9 +282,9 @@ bool osc_pc_lpi_support_confirmed;
> >  EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
> >  
> >  static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
> > -static void acpi_bus_osc_support(void)
> > +static void acpi_bus_osc_negotiate_platform_control(void)
> >  {
> > -	u32 capbuf[2];
> > +	u32 capbuf[2], *capbuf_ret;
> >  	struct acpi_osc_context context = {
> >  		.uuid_str = sb_uuid_str,
> >  		.rev = 1,
> > @@ -321,17 +321,36 @@ static void acpi_bus_osc_support(void)
> >  		capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT;
> >  	if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
> >  		return;
> > -	if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) {
> > -		u32 *capbuf_ret = context.ret.pointer;
> > -		if (context.ret.length > OSC_SUPPORT_DWORD) {
> > -			osc_sb_apei_support_acked =
> > -				capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
> > -			osc_pc_lpi_support_confirmed =
> > -				capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
> > -		}
> > +
> > +	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
> > +		return;
> > +
> > +	capbuf_ret = context.ret.pointer;
> > +	if (context.ret.length <= OSC_SUPPORT_DWORD) {
> >  		kfree(context.ret.pointer);
> > +		return;
> >  	}
> > -	/* do we need to check other returned cap? Sounds no */
> > +
> > +	/*
> > +	 * Now run _OSC again with query flag clear and with the caps
> > +	 * supported by both the OS and the platform.
> > +	 */
> > +	capbuf[OSC_QUERY_DWORD] = 0;
> > +	capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD];
> > +	kfree(context.ret.pointer);
> > +
> > +	if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
> > +		return;
> > +
> > +	capbuf_ret = context.ret.pointer;
> > +	if (context.ret.length > OSC_SUPPORT_DWORD) {
> > +		osc_sb_apei_support_acked =
> > +			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
> > +		osc_pc_lpi_support_confirmed =
> > +			capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
> > +	}
> > +
> > +	kfree(context.ret.pointer);
> >  }
> >  
> >  /* --------------------------------------------------------------------------
> > @@ -1168,7 +1187,7 @@ static int __init acpi_bus_init(void)
> >  	 * _OSC method may exist in module level code,
> >  	 * so it must be run after ACPI_FULL_INITIALIZATION
> >  	 */
> > -	acpi_bus_osc_support();
> > +	acpi_bus_osc_negotiate_platform_control();
> >  
> >  	/*
> >  	 * _PDC control method may load dynamic SSDT tables,
> > -- 
> > 2.29.2


  parent reply	other threads:[~2021-06-07 12:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  8:32 [PATCH v2 0/5] thunderbolt / ACPI: Add support for USB4 _OSC Mika Westerberg
2021-01-29  8:32 ` [PATCH v2 2/5] thunderbolt: Allow disabling XDomain protocol Mika Westerberg
2021-01-29  8:32 ` [PATCH v2 4/5] ACPI: Add support for native USB4 control _OSC Mika Westerberg
     [not found] ` <20210129083241.72497-4-mika.westerberg@linux.intel.com>
2021-02-03  8:14   ` [PATCH v2 3/5] ACPI: Execute platform _OSC also with query bit clear Mika Westerberg
2021-02-03 13:56     ` Rafael J. Wysocki
2021-02-04  7:36       ` Mika Westerberg
2021-06-07 12:31     ` joeyli [this message]
2021-06-07 16:10       ` Mika Westerberg
2021-06-08  3:02         ` joeyli
2021-02-04  7:51 ` [PATCH v2 0/5] thunderbolt / ACPI: Add support for USB4 _OSC Mika Westerberg

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=20210607123110.GE22028@linux-l9pv.suse \
    --to=jlee@suse.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=christian@kellner.me \
    --cc=gregkh@linuxfoundation.org \
    --cc=iqgrande@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mario.limonciello@dell.com \
    --cc=michael.jamet@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /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).