Re: [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS

From: Muhammad Bilal

Date: Sat Jul 04 2026 - 12:57:10 EST


Hi Armin,

I've posted v2 of the series, which includes an additional preparatory
patch to ensure parser iteration remains bounded before relaxing the
package-length check.

https://lore.kernel.org/all/20260704160759.236249-1-meatuni001@xxxxxxxxx/

Thanks for your review.

On Wed, Jul 1, 2026 at 1:29 AM Armin Wolf <W_Armin@xxxxxx> wrote:
>
> Am 26.06.26 um 22:49 schrieb Muhammad Bilal:
>
> > The hp_bioscfg driver silently fails to enumerate BIOS attributes on
> > HP EliteBook 840 G2 (and potentially other older HP models) because:
> >
> > 1. hp_init_bios_package_attribute() hard-fails when a WMI ACPI package
> > contains fewer elements than the per-type expected count (11 < 13),
> > even though only the first 10 common elements are required to
> > register an attribute.
> >
> > 2. hp_populate_enumeration_elements_from_package() returns -EIO and
> > discards the entire attribute when any single element has an
> > unexpected ACPI object type — typically after a BIOS AML error
> > returns malformed data.
>
> Hi,
>
> it could be that the ACPI firmware still transmits all the necessary data, its just
> that some package elements are combined into a single buffer element
> (see https://docs.kernel.org/wmi/acpi-interface.html section "Conversion rules for ACPI data types"
> for details).
>
> The correct solution would be to migrate the driver to the new buffer-based WMI API,
> because said API ensures that ACPI objects are properly marshaled into the common
> WMI data format. However this might require a lot of work :/.
>
> Regarding the BIOS error: this usually happens because creating a ByteField with and
> invalid length does not cause an error under Windows. Passing a larger buffer usually
> fixes this problem.
>
> Thanks,
> Armin Wolf
>
> >
> > Hardware affected:
> > HP EliteBook 840 G2 (DMI: Hewlett-Packard HP EliteBook 840 G2/2216)
> > BIOS: M71 Ver. 01.31 (02/24/2020)
> >
> > How to reproduce:
> > 1. Boot a kernel with CONFIG_HP_BIOSCFG=m on an HP EliteBook 840 G2
> > 2. modprobe hp_bioscfg
> > 3. Observe dmesg:
> > hp_bioscfg: ACPI-package does not have enough elements: 11 < 13
> > Error expected type 2 for elem 13, but got type 1 instead
> >
> > Testing notes:
> > Tested on HP EliteBook 840 G2 running Arch Linux kernel 7.0.13-arch1-1.
> > After patches, hp_bioscfg loads successfully and enumerates available
> > BIOS attributes. Attributes with shortened packages are partially
> > populated and accessible via sysfs. No regressions on systems that
> > return full 13-element packages (checked via code inspection —
> > pr_warn path is only reached when count < min_elements).
> >
> > Relevant dmesg (before fix):
> > [ 11.xxx] hp_bioscfg: ACPI-package does not have enough elements:
> > 11 < 13
> > [ 11.xxx] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT,
> > Index (0x000000032) is beyond end of object (length 0x32)
> > [ 11.xxx] ACPI Error: Aborting method \_SB.WMID.WQBE
> > [ 11.xxx] Error expected type 2 for elem 13, got type 1
> > [ 11.xxx] hp_bioscfg: Returned error 0x3
> >
> > Muhammad Bilal (2):
> > platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP
> > BIOS
> > platform/x86: hp-bioscfg: warn on element type mismatch instead of
> > failing
> >
> > drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 11 ++++++++---
> > drivers/platform/x86/hp/hp-bioscfg/bioscfg.h | 3 +++
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 7 ++++---
> > 3 files changed, 15 insertions(+), 6 deletions(-)
> >