Re: [PATCH] platform/x86: p2sb: Defer P2SB device scan when P2SB device has func 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux