public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel: resourse: Add conditional handling for ACPI device
@ 2025-10-17  2:35 Szuying Chen
  2025-10-17 14:11 ` Gregory Price
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Szuying Chen @ 2025-10-17  2:35 UTC (permalink / raw)
  To: akpm, andriy.shevchenko, dan.j.williams, gourry, jhubbard,
	akinobu.mita, sumanthk, peterz, huang.ying.caritas, linux-kernel
  Cc: Andrew_Su, Yd_Tseng, Ed_Huang, Cindy1_Hsu, Jesse1_Chang,
	Richard_Hsu, Chloe_Chen

To avoid address conflicts and related errors, specific checks for
the ACPI device "AMDIF031" should be bypassed.

Signed-off-by: Szuying Chen <Chloe_Chen@asmedia.com.tw>
---
 kernel/resource.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/kernel/resource.c b/kernel/resource.c
index b9fa2a4ce089..9ffcd5bdb62e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -177,6 +177,27 @@ static struct resource *alloc_resource(gfp_t flags)
 	return kzalloc(sizeof(struct resource), flags);
 }

+static int IgnoreResource(struct resource *tmp)
+{
+	char *pt, *name_sep;
+	char *name;
+
+	pt = kstrdup(tmp->name, GFP_KERNEL);
+	name_sep = pt;
+	if (!name_sep)
+		goto out;
+
+	name = strsep(&name_sep, ":");
+	if (strcmp(name, "AMDIF031") == 0) {
+		kfree(pt);
+		return 1;
+	}
+
+out:
+	kfree(pt);
+	return 0;
+}
+
 /* Return the conflict entry if you can't request it */
 static struct resource * __request_resource(struct resource *root, struct resource *new)
 {
@@ -202,6 +223,8 @@ static struct resource * __request_resource(struct resource *root, struct resour
 		p = &tmp->sibling;
 		if (tmp->end < start)
 			continue;
+		if (IgnoreResource(tmp))
+			continue;
 		return tmp;
 	}
 }
--
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* Re: [PATCH] kernel: resourse: Add conditional handling for ACPI device
@ 2025-10-27  6:36 Szuying Chen
  0 siblings, 0 replies; 8+ messages in thread
From: Szuying Chen @ 2025-10-27  6:36 UTC (permalink / raw)
  To: akpm, andriy.shevchenko, dan.j.williams, gourry, jhubbard,
	akinobu.mita, sumanthk, peterz, huang.ying.caritas, linux-kernel
  Cc: Andrew_Su, Yd_Tseng, Ed_Huang, Cindy1_Hsu, Jesse1_Chang,
	Richard_Hsu, Chloe_Chen


On Sun, Oct 23, 2025 at 04:51PM, Andy Shevchenko wrote:
> On Thu, Oct 23, 2025 at 04:04:55PM +0800, Szuying Chen wrote:
> > On Sun, Oct 19, 2025 at 03:07AM, Andy Shevchenko wrote:
> > > On Fri, Oct 17, 2025 at 10:35:31AM +0800, Szuying Chen wrote:
> > > > To avoid address conflicts and related errors, specific checks for
> > > > the ACPI device "AMDIF031" should be bypassed.
> > > 
> > > TL;DR: NAK.
> > > 
> > > No, this is not how we should do the quirks (besides the use of CamelCase).
> > > Also, please provide more info why firmware may not be fixed properly at
> > > the same time, so we won't need this on an updated version?
> > > 
> > The ACPI device AMDIF031 is a virtual (non-PCI) device located on the PCI
> > upstream port. Its memory resource is assigned by the BIOS within the bridge
> > windows of the PCI upstream port.
> > 
> > When the kernel creates ACPI/AMDIF031 and verifies memory resources, it may
> > detect an address conflict between AMDIF031 and the PCI upstream port. The
> > kernel then attempts to reassign resources for the PCI upstream port tree,
> > causing AMDIF031's memory resource to fall outside the bridge windows. This
> > makes the device inaccessible.
> > 
> > To prevent this and allow AMDIF031 to use the BIOS-assigned memory range,
> > skip resource reallocation when an address conflict is detected for this 
> > device.
> 
> We have such devices in many platforms, older ones use MFD framework with
> specific flag set, you may check how it's done there. But for this change is
> definitely NAK, take your time to find proper solution (see above for the
> hint).
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko

Hi Andy & Gregory,

Thanks for your feedback.
I will investigate the proper solution as you suggested.

Best Regards,
Chloe
        


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-27  6:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  2:35 [PATCH] kernel: resourse: Add conditional handling for ACPI device Szuying Chen
2025-10-17 14:11 ` Gregory Price
2025-10-18 19:07 ` Andy Shevchenko
2025-10-23  8:04   ` Szuying Chen
2025-10-23  8:51     ` Andy Shevchenko
2025-10-20  8:46 ` kernel test robot
2025-10-20 10:01   ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2025-10-27  6:36 Szuying Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox