From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: platform-driver-x86@vger.kernel.org,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Klara Modin" <klarasmodin@gmail.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] platform/x86: p2sb: Defer P2SB device scan when P2SB device has func 0
Date: Fri, 1 Mar 2024 19:39:34 +0200 [thread overview]
Message-ID: <ZeIS1pUcIlfDAcb8@smile.fi.intel.com> (raw)
In-Reply-To: <20240301134504.1887132-1-shinichiro.kawasaki@wdc.com>
On Fri, Mar 01, 2024 at 10:45:04PM +0900, Shin'ichiro Kawasaki wrote:
> The commit 5913320eb0b3 ("platform/x86: p2sb: Allow p2sb_bar() calls
> during PCI device probe") triggered repeated ACPI errors on ASUS
> VivoBook D540NV-GQ065T [1]. It was confirmed that the P2SB device scan
> and remove at the fs_initcall stage triggered the errors.
>
> To avoid the error, defer the P2SB device scan on the concerned device.
> The error was observed on the system with Pentium N4200 in Goldmont micro-
> architecture, and on which P2SB has function 0. Then refer to the P2SB
> function to decide whether to defer or not.
>
> When the device scan is deferred, do the scan later when p2sb_bar() is
> called for the first time. If this first scan is triggered by sysfs
> pci bus rescan, deadlock happens. In most cases, the scan happens during
> system boot process, then there is no chance of deadlock.
...
> +static bool p2sb_resource_cached(void)
> +{
> + int i;
> +
> + for (i = 0; i < NR_P2SB_RES_CACHE; i++)
> + if (p2sb_valid_resource(&p2sb_resources[i].res))
> + return true;
> +
> + return false;
> +}
We don't need this. It's enough to check the cache for P2SB device itself...
...
> + /*
> + * On ASUS VivoBook D540NV-GQ065T which has Goldmont CPU family Pentium
> + * N4200, P2SB device scan including function 0 at fs_initcall step
fs_initcall()
> + * causes ACPI errors. To avoid the errors, defer P2SB device scan and
> + * cache when P2SB devices has function 0.
> + */
> + if (!p2sb_resource_cached())
> + p2sb_cache_resources(false);
Move this after we new devfn of the P2SB and modify to something like
if (!p2sb_valid_resources(...p2sb_devfn...))
...
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2024-03-01 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 13:45 [PATCH] platform/x86: p2sb: Defer P2SB device scan when P2SB device has func 0 Shin'ichiro Kawasaki
2024-03-01 17:39 ` Andy Shevchenko [this message]
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=ZeIS1pUcIlfDAcb8@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=klarasmodin@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=platform-driver-x86@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.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 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.