From: Alexander Graf <graf@amazon.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Greg KH <gregkh@linuxfoundation.org>, <ardb@kernel.org>,
<dwmw@amazon.co.uk>
Subject: Re: [PATCH] ACPI: bus: Match first 9 bytes of device IDs
Date: Fri, 25 Feb 2022 18:09:59 +0100 [thread overview]
Message-ID: <7a98e9c5-e0e5-9bf9-71b5-f75b9ddcdc4b@amazon.com> (raw)
In-Reply-To: <YhkKc2fa8dSTA9pc@zx2c4.com>
Hey Jason,
On 25.02.22 17:57, Jason A. Donenfeld wrote:
> Hi Alex,
>
> Thanks for this.
>
> I tested this out with the vmgenid driver, and I found a bug in this v1:
>
> On Fri, Feb 25, 2022 at 04:55:52PM +0100, Alexander Graf wrote:
>> - if (id->id[0] && !strcmp((char *)id->id, hwid->id))
>> + if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN))
> This only worked once I made that `ACPI_ID_LEN - 1`, because that length
> includes the null terminator. The below patch works fine. If you adjust
> that and send a quick v2 follow-up, I'm happy to ack it.
>
> Regards,
> Jason
>
> --------8<--------------------------
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 07f604832fd6..f179ebf16f21 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -829,7 +829,7 @@ static bool __acpi_match_device(struct acpi_device *device,
> /* First, 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))
> + if (id->id[0] && !strncmp((char *)id->id, hwid->id, ACPI_ID_LEN - 1))
> goto out_acpi_match;
> if (id->cls && __acpi_match_device_cls(id, hwid))
> goto out_acpi_match;
> diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c
> index b503c210c2d7..04751fc1d365 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_C", 0 }, /* Truncated "VM_Gen_Counter" */
You have to make this "VM_GEN_CO". I now match the full 9 bytes - unlike
the previous patch I sent :)
Alex
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
next prev parent reply other threads:[~2022-02-25 17:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 15:55 [PATCH] ACPI: bus: Match first 9 bytes of device IDs Alexander Graf
2022-02-25 16:57 ` Jason A. Donenfeld
2022-02-25 17:09 ` Alexander Graf [this message]
2022-02-25 17:16 ` Jason A. Donenfeld
2022-02-25 17:13 ` Ard Biesheuvel
2022-02-25 17:21 ` Jason A. Donenfeld
2022-02-25 17:30 ` Ard Biesheuvel
2022-02-25 17:33 ` Jason A. Donenfeld
2022-02-25 18:03 ` Jason A. Donenfeld
2022-02-25 18:39 ` Jason A. Donenfeld
2022-02-25 19:06 ` Alexander Graf
2022-02-25 21:03 ` Jason A. Donenfeld
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=7a98e9c5-e0e5-9bf9-71b5-f75b9ddcdc4b@amazon.com \
--to=graf@amazon.com \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=dwmw@amazon.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).