Re: [PATCH] ACPI: bus: Match first 9 bytes of device IDs

From: Jason A. Donenfeld
Date: Fri Feb 25 2022 - 13:04:22 EST


On Fri, Feb 25, 2022 at 06:33:42PM +0100, Jason A. Donenfeld wrote:
> Either way is fine by me. Looking at all the current users of
> ACPI_ID_LEN, none of them really mind if it's >9. I can't see where
> it'd change any behavior or performance or really anything at all,
> anywhere. So I'm inclined to go with my original simpler solution. But
> again, either way is fine.
>
> Alex, do you want to pick one of these and submit a v2 based on it? Or
> do you see a shortcoming in that approach?

I can confirm from testing that the below trivial diff fixes the issue.
I believe Ard is looking into the userspace/udev ramifications.

diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
index b503c210c2d7..4542ebb68ae0 100644
--- a/drivers/virt/vmgenid.c
+++ b/drivers/virt/vmgenid.c
@@ -78,8 +78,7 @@ static void vmgenid_acpi_notify(struct acpi_device *device, u32 event)
}

static const struct acpi_device_id vmgenid_ids[] = {
- { "QEMUVGID", 0 }, /* QEMU */
- { "VMGENID", 0 }, /* Firecracker */
+ { "VM_GEN_COUNTER", 0 },
{ },
};

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 4bb71979a8fd..5da5d990ff58 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -211,7 +211,7 @@ struct css_device_id {
kernel_ulong_t driver_data;
};

-#define ACPI_ID_LEN 9
+#define ACPI_ID_LEN 16

struct acpi_device_id {
__u8 id[ACPI_ID_LEN];