All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] acpi: add kernel option to skip binding drivers to certain devices
@ 2026-08-13  2:41 dmukhin
  2026-08-13  2:41 ` [PATCH 1/2] acpi: Use METHOD_NAME__UID instead of open-coded _UID dmukhin
  2026-08-13  2:41 ` [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter dmukhin
  0 siblings, 2 replies; 5+ messages in thread
From: dmukhin @ 2026-08-13  2:41 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel; +Cc: Denis Mukhin

Mini series to allow fine-grained platform device ownership in
virtualized environment.

Patch 1: cleanup - replace an open-coded string with an existing symbol.
Patch 2: introduce the acpi.skip_ids= boot parameter.

Tested on: Linux 6.12.

Denis Mukhin (2):
  acpi: Use METHOD_NAME__UID instead of open-coded _UID
  acpi: bus: Introduce acpi.skip_ids= boot parameter

 .../admin-guide/kernel-parameters.txt         |  5 ++
 drivers/acpi/acpi_processor.c                 |  2 +-
 drivers/acpi/bus.c                            | 60 +++++++++++++++++--
 3 files changed, 62 insertions(+), 5 deletions(-)

-- 
2.54.0


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

* [PATCH 1/2] acpi: Use METHOD_NAME__UID instead of open-coded _UID
  2026-08-13  2:41 [PATCH 0/2] acpi: add kernel option to skip binding drivers to certain devices dmukhin
@ 2026-08-13  2:41 ` dmukhin
  2026-08-13  2:41 ` [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter dmukhin
  1 sibling, 0 replies; 5+ messages in thread
From: dmukhin @ 2026-08-13  2:41 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel; +Cc: Denis Mukhin

From: Denis Mukhin <dmukhin@ford.com> 

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 drivers/acpi/acpi_processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 00775b91bd41..cb39e4a30f0e 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -739,7 +739,7 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle,
 		break;
 
 	case ACPI_TYPE_DEVICE:
-		status = acpi_evaluate_integer(handle, "_UID", NULL, &uid);
+		status = acpi_evaluate_integer(handle, METHOD_NAME__UID, NULL, &uid);
 		if (ACPI_FAILURE(status))
 			goto err;
 		break;
-- 
2.54.0


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

* [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter
  2026-08-13  2:41 [PATCH 0/2] acpi: add kernel option to skip binding drivers to certain devices dmukhin
  2026-08-13  2:41 ` [PATCH 1/2] acpi: Use METHOD_NAME__UID instead of open-coded _UID dmukhin
@ 2026-08-13  2:41 ` dmukhin
  2026-08-13 10:09   ` Rafael J. Wysocki (Intel)
  1 sibling, 1 reply; 5+ messages in thread
From: dmukhin @ 2026-08-13  2:41 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel; +Cc: Denis Mukhin

From: Denis Mukhin <dmukhin@ford.com> 

In virtualized environments it is possible that a device managed by the
hypervisor or another VM is described in the ACPI tables. In these
cases, binding a device driver to it can cause functional issues.

To resolve device ownership conflicts, skip enumeration of ACPI devices
whose ACPI IDs match entries specified via a new boot-time parameter:

    acpi.skip_ids=<HID[:UID]>[,<HID[:UID]>...]

This parameter may also be used when a single kernel image must support
both bare-metal and virtualized environments - for example, when the
image is shared across multiple VMs and only selected platform devices
are exposed through passthrough.

Note, a single driver may support multiple devices and only a subset of
those devices may require exclusion (for example, ABCD0020:00 but not
ABCD0020:01). As a result, existing 'initcall_blacklist=' is not an
appropriate solution to resolve the ownership conflict.

Add brief explanation for apci.skip_ids= in the kernel command line
documentation.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 .../admin-guide/kernel-parameters.txt         |  5 ++
 drivers/acpi/bus.c                            | 60 +++++++++++++++++--
 2 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 3d35270dddef..a2d4bd9e37b9 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -195,6 +195,11 @@ Kernel parameters
 			ACPI firmware problems, as the system might behave erratically
 			after having encountered a fatal ACPI error.
 
+	acpi.skip_ids=	[ACPI] Skip enumeration of ACPI devices whose HID[:UID]
+			matches an entry in the given comma-separated list
+			(up to 16 entries).
+			Format: HID[:UID][,HID[:UID]...]
+
 	acpi_enforce_resources=	[ACPI]
 			{ strict | lax | no }
 			Check for resource conflicts between native drivers
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index a30a904f6535..86dba970bfc2 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -38,6 +38,15 @@ struct acpi_device *acpi_root;
 struct proc_dir_entry *acpi_root_dir;
 EXPORT_SYMBOL(acpi_root_dir);
 
+#define ACPI_MAX_SKIP_IDS	16 /* Arbitrary limit. */
+
+static char *acpi_skip_ids[ACPI_MAX_SKIP_IDS];
+static int acpi_skip_num;
+module_param_array_named(skip_ids, acpi_skip_ids, charp,
+		&acpi_skip_num, 0444);
+MODULE_PARM_DESC(skip_ids,
+		"Skip binding ACPI drivers to devices with matching _HID[:_UID]");
+
 #ifdef CONFIG_X86
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
 static inline int set_copy_dsdt(const struct dmi_system_id *id)
@@ -1008,6 +1017,9 @@ static bool __acpi_match_device(const struct acpi_device *device,
 {
 	const struct acpi_device_id *id;
 	struct acpi_hardware_id *hwid;
+	struct acpi_device_info *info = NULL;
+	bool ret = false;
+	int i;
 
 	/*
 	 * If the device is not present, it is unnecessary to load device
@@ -1016,8 +1028,42 @@ static bool __acpi_match_device(const struct acpi_device *device,
 	if (!device || !device->status.present)
 		return false;
 
+	if (acpi_skip_num) {
+		acpi_status status;
+
+		status = acpi_get_object_info(device->handle, &info);
+		if (ACPI_FAILURE(status))
+			info = NULL;
+	}
+
 	list_for_each_entry(hwid, &device->pnp.ids, list) {
-		/* First, check the ACPI/PNP IDs provided by the caller. */
+		/* First, check whether device ACPI ID is in the skip list. */
+		for (i = 0; i < acpi_skip_num; i++) {
+			char with_uid[MAX_ACPI_DEVICE_NAME_LEN];
+			u32 uid;
+
+			if (!strcasecmp(acpi_skip_ids[i], hwid->id)) {
+				ret = false;
+				goto out;
+			}
+
+			if (!info || !(info->valid & ACPI_VALID_UID))
+				continue;
+
+			if (kstrtou32(info->unique_id.string, 0, &uid))
+				snprintf(with_uid, sizeof(with_uid), "%s:%s",
+					 hwid->id, info->unique_id.string);
+			else
+				snprintf(with_uid, sizeof(with_uid), "%s:%02x",
+					 hwid->id, uid);
+
+			if (!strcasecmp(acpi_skip_ids[i], with_uid)) {
+				ret = false;
+				goto out;
+			}
+		}
+
+		/* Second, check the ACPI/PNP IDs provided by the caller. */
 		if (acpi_ids) {
 			for (id = acpi_ids; id->id[0] || id->cls; id++) {
 				if (id->id[0] && !strcmp((char *)id->id, hwid->id))
@@ -1031,12 +1077,18 @@ static bool __acpi_match_device(const struct acpi_device *device,
 		 * Next, check ACPI_DT_NAMESPACE_HID and try to match the
 		 * "compatible" property if found.
 		 */
-		if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id))
-			return acpi_of_match_device(device, of_ids, of_id);
+		if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id)) {
+			ret = acpi_of_match_device(device, of_ids, of_id);
+			goto out;
+		}
 	}
-	return false;
+
+out:
+	kfree(info);
+	return ret;
 
 out_acpi_match:
+	kfree(info);
 	if (acpi_id)
 		*acpi_id = id;
 	return true;
-- 
2.54.0


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

* Re: [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter
  2026-08-13  2:41 ` [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter dmukhin
@ 2026-08-13 10:09   ` Rafael J. Wysocki (Intel)
  2026-08-13 22:43     ` dmukhin
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-08-13 10:09 UTC (permalink / raw)
  To: dmukhin; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel

On Thu, Aug 13, 2026 at 4:41 AM <dmukhin@ford.com> wrote:
>
> From: Denis Mukhin <dmukhin@ford.com>
>
> In virtualized environments it is possible that a device managed by the
> hypervisor or another VM is described in the ACPI tables. In these
> cases, binding a device driver to it can cause functional issues.

Examples, please.

> To resolve device ownership conflicts, skip enumeration of ACPI devices
> whose ACPI IDs match entries specified via a new boot-time parameter:
>
>     acpi.skip_ids=<HID[:UID]>[,<HID[:UID]>...]

No, we are not adding this.

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

* Re: [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter
  2026-08-13 10:09   ` Rafael J. Wysocki (Intel)
@ 2026-08-13 22:43     ` dmukhin
  0 siblings, 0 replies; 5+ messages in thread
From: dmukhin @ 2026-08-13 22:43 UTC (permalink / raw)
  To: Rafael J. Wysocki (Intel); +Cc: dmukhin, Len Brown, linux-acpi, linux-kernel

On Thu, Aug 13, 2026 at 12:09:41PM +0200, Rafael J. Wysocki (Intel) wrote:
> On Thu, Aug 13, 2026 at 4:41 AM <dmukhin@ford.com> wrote:
> >
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > In virtualized environments it is possible that a device managed by the
> > hypervisor or another VM is described in the ACPI tables. In these
> > cases, binding a device driver to it can cause functional issues.
> 
> Examples, please.

One example would be a system with two MMIO-based UARTs described in ACPI
tables. Both UARTs have the same _HID, but different _UIDs. One UART reserved
for the hypervisor console, another is assigned to the guest.

Both devices reported as present and same platform driver may probe both device
instances.

I understand that, ideally, guest ACPI tables should omit the unassigned
device or report it unavailable via _STA.

The proposed parameter was intended for configurations where the device
assignment varies between boot environments while the firmware-provided ACPI
description remains common.

What would be the preferred way to prevent Linux from enumerating or probing
one specific _HID/_UID instance in such a configuration?

Thanks,
Denis

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

end of thread, other threads:[~2026-08-13 22:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  2:41 [PATCH 0/2] acpi: add kernel option to skip binding drivers to certain devices dmukhin
2026-08-13  2:41 ` [PATCH 1/2] acpi: Use METHOD_NAME__UID instead of open-coded _UID dmukhin
2026-08-13  2:41 ` [PATCH 2/2] acpi: bus: Introduce acpi.skip_ids= boot parameter dmukhin
2026-08-13 10:09   ` Rafael J. Wysocki (Intel)
2026-08-13 22:43     ` dmukhin

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.