All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Jean Delvare <jdelvare@suse.com>, Takashi Iwai <tiwai@suse.de>,
	russianneuromancer@ya.ru, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option
Date: Fri, 3 Mar 2017 15:27:05 +0100	[thread overview]
Message-ID: <43efc13a-d2f9-3fde-c7c0-0471bb6bfc2d@redhat.com> (raw)
In-Reply-To: <20170303102412.52d4b692@endymion>

Hi,

On 03-03-17 10:24, Jean Delvare wrote:
> Hi Hans,
>
> On Sat, 25 Feb 2017 18:23:55 +0100, Hans de Goede wrote:
>> Unfortunately some firmware has all the DMI strings filled with:
>> "Default String" (or something equally useless). This makes it impossible
>> to apply DMI based quirks to certain machines.
>
> Sad but true :-(
>
>> This commit adds a dmi_product_name kernel cmdline option which can
>> be used to override the DMI_PRODUCT_NAME string, so that DMI based
>> quirks can still be used on such boards, there are 3 reasons for this:
>>
>> 1) Rather then add cmdline options for all things which can be DMI quirked
>> and thus may need to be specified, this only requires adding code for
>> a single extra cmdline option
>
> This cuts both ways. It also means that, if you get a new machine which
> needs some of the quirks needed by an older machine, but not all of
> them, you can't get it to work without modifying your kernel first. If
> quirk options are addressed directly to the relevant subsystem, then
> there is a chance that they can be reused directly for other machines
> later.

Quirks being applied for issues which may be fixed by e.g. a BIOS update
already always being applied even if the new BIOS is there already is the
case for any DMI based quirks.

>> 2) Some devices can be quite quirky, e.g. the GPD win mini laptop /
>> clamshell x86 machine, needing several quirks in both kernel and userspace
>> (udev hwdb) in this case being able to fake a unique dmi product name
>> allows making these devices usable with a single kernel cmdline option
>> rather then requiring multiple kernel cmdline options + manual userspace
>> tweaking
>>
>> 3) In some case we may be able to successfully get the manufacturer to
>> fix the DMI strings with a firmware update, but not all users may want
>> to update, this will allow users to use DMI based quirks without forcing
>> them to update their firmware
>
> But that's the only right thing to do. The easier we make it for
> manufacturers shipping crappy BIOSes, the lesser motivated they will be
> to fix them. Writing a decent DMI table is a one hour job, there's no
> excuse for not doing it. So I am very reluctant to accept this patch,
> sorry.

This whole we are going to make users live miserable to pressure manufacturers
into doing the right thing does not work. We (the kernel community) have
tried that for 10 years and not a whole lot has changed and in the cases
where things have changed it was not because of this it was because
there was a business case for FOSS drivers. Unfortunately there is not
a whole lot of business case for correct DMI strings (for consumer hw).

So lets not make users live harder then it needs to be.

We're talking about either giving the users this set of instructions:

a)  Add dmi_product_name=GPD-WINI55 to your kernel commandline, then
reboot

or:

b)
1) Add "quirk1=foo quirk2=bar quirk3=argh quirk4=uhoh" to your kernel cmdline.
2) Edit /lib/udev/hwdb/99-local.hwdb, Add:

sensor:modalias:acpi:KIOX000A*:dmi*:
  ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1

3) As root run: "udevadm hwdb --update"
4) reboot

Which one is more userfriendly?

Esp. the ability to have a single kernel cmdline option influence both
kernel and userspace behavior (by allowing a pre-existing rule for the
hw to exist in hwdb) is important since now a days quirks are
more or less split 50/50 between the 2.

So I would really like to see support for this kernel cmdline option merged.
Takashi Iwai has been working on some quirks for headphone detection for
the GPDwin machine, which also rely on being able to use a fake dmi_id to
identify the machine.

And we will likely hit the same problem with intel based tables using
silead touchscreens which also require extra platform info not available
in the ACPI tables, which currently also gets automatically added based
on dmi data, see:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/silead_dmi.c

If you look at the amount of info we need per tablet here doing this
through the kernel cmdline is going to be quite painful. Also the needed
extra code to be able to specify this and many other quirks which are
currently only settable through dmi on the kernel cmdline will be many
times more then the code for the dmi_product_name kernel cmdline
option.

Regards,

Hans



>
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Note the GPD win: http://www.gpd.hk/gpdwin.asp is the main reason I wrote
>> this patch. I've requested the manufacturer to do a BIOS update fixing the
>> DMI strings, but I cannot guarantee that that will happen.
>> ---
>>  drivers/firmware/dmi_scan.c | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
>> index 54be60e..c99e753 100644
>> --- a/drivers/firmware/dmi_scan.c
>> +++ b/drivers/firmware/dmi_scan.c
>> @@ -1047,3 +1047,17 @@ void dmi_memdev_name(u16 handle, const char **bank, const char **device)
>>  	}
>>  }
>>  EXPORT_SYMBOL_GPL(dmi_memdev_name);
>> +
>> +static int __init dmi_parse_dmi_product_name(char *str)
>> +{
>> +	static char prod_name[32];
>> +
>> +	if (!str)
>> +		return -EINVAL;
>> +
>> +	strlcpy(prod_name, str, sizeof(prod_name));
>> +	dmi_ident[DMI_PRODUCT_NAME] = prod_name;
>> +
>> +	return 0;
>> +}
>> +early_param("dmi_product_name", dmi_parse_dmi_product_name);
>
>

  reply	other threads:[~2017-03-03 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 17:23 [PATCH 0/3] Allow setting dmi-product-name on the cmdline + dmi sdhci quirk Hans de Goede
2017-02-25 17:23 ` [PATCH 1/3] firmware: dmi_scan: Add dmi_product_name kernel cmdline option Hans de Goede
2017-03-03  9:24   ` Jean Delvare
2017-03-03 14:27     ` Hans de Goede [this message]
2017-03-09  9:59       ` Jean Delvare
2017-03-09 10:43         ` Hans de Goede
2017-03-20 17:35           ` Takashi Iwai
2017-04-04 10:21           ` Hans de Goede
2017-04-04 10:21             ` Hans de Goede
2017-02-25 17:23 ` [PATCH 2/3] mmc: sdhci-acpi: Check device status before calling fix_up_power() Hans de Goede
2017-02-25 18:31   ` Hans de Goede
2017-03-02 11:53   ` Adrian Hunter
2017-03-03  9:09   ` Jean Delvare
2017-03-03 13:59     ` Hans de Goede
2017-02-25 17:23 ` [PATCH 3/3] mmc: sdhci-acpi: Add a quirk to not break wifi on GPD WIN I55 machines Hans de Goede

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=43efc13a-d2f9-3fde-c7c0-0471bb6bfc2d@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=jdelvare@suse.com \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=russianneuromancer@ya.ru \
    --cc=tiwai@suse.de \
    --cc=ulf.hansson@linaro.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 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.