Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4392557rwr; Mon, 8 May 2023 07:07:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vTqxP4ezlkw4nntmSZsFWckRj8Y6x79fN4I51s9FRzGdkF43i0RNSCWJDHY11Wg2DK3Xh X-Received: by 2002:a17:90b:33ce:b0:23d:1143:c664 with SMTP id lk14-20020a17090b33ce00b0023d1143c664mr10752857pjb.31.1683554879293; Mon, 08 May 2023 07:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683554879; cv=none; d=google.com; s=arc-20160816; b=dpM/xWHhkWM61MkOCxtYQZK+nIjMqjK/1pbTby9+PJHnzewX1COvZ06SAQ2VCeiMPc IPT6yzh2iP0FXhiBNsnSSUCBivLzGNuxUTqoQ5B3K22o5+SYOKnDOWbnOOwHmQWE4bWL xC2Ab1WyxAq9F/7pu4XHsvxMK20CUy4a/QjG37YpsgjO9KjKHCx4mAU/5eJtprL3NQ6e vswQ0FOAi4VmE1ip7szFWsx7cSIFjWsUONacQAQUPOJ7o3lATOV6QtqqvUBq/BcCu/cn KHw5/ElYpyNdQHM8JXMXWcRByzNNBoq3BhxlpBLqj/5zpJt7+HKGPAa8T0ZATWpbxZzg q3gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=b+TXP2K1rN6M8cjI/PXxFRn4eAuSPFss48EfB8wsfWE=; b=RGpoRJq32N1vpmu6TJDHHamJ9CYBd+o6ECuB6/qWUkkG2BBWKXp6w/0+aHxrEaAf1D 1PFZpTgFweqZDk5Xp1uC1W6MVlCyQGUnF50PEJHNJnx0yoTOAD+uGKjmhK9qyQUoRJ3y pZsK9dNFvw+otWNlvbY7EwpXPMqT1IH0lST5VwnLnf4acgtUtqW5IN49fahCliDnoNma YTEjAN9RXrA826MP1OmA29aVJo7ildzOXnMjbUPbH4n5E3B/EnB+xW6Is8mDD8is68QP GWASbrL8fFm0kX8hMIVdeu+zOwsKq+2eMw5Dx2AY7AoaxBsgMUe18SWIGsaXAbarDW7O 7Syg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qn40tq6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a17090282c300b001a6565a16c4si8015450plz.493.2023.05.08.07.07.45; Mon, 08 May 2023 07:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qn40tq6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234285AbjEHN53 (ORCPT + 99 others); Mon, 8 May 2023 09:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjEHN51 (ORCPT ); Mon, 8 May 2023 09:57:27 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 345EC33FCE; Mon, 8 May 2023 06:57:26 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4eff4ea8e39so5134058e87.1; Mon, 08 May 2023 06:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683554244; x=1686146244; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=b+TXP2K1rN6M8cjI/PXxFRn4eAuSPFss48EfB8wsfWE=; b=qn40tq6ZNTsDIn0UVGOzO6PrJli7xc8fv59BZ9T8yp0YMF0jcQAH9PJbIciVkTd3fU DZ3/tBaLQbsJynxfNZFSzw8Lm8wq1bwebylDwXrxh0xQxkRER3sc4hecqqB02Cuy8ZQG rhF8p4aA/8cMXr/SV6P09u8utudkW55fukigC5bsRstD+ThFmEn36UT10qJkHcL7Fb3L IjPqtIoiAfGHlAbri6fYmfxZafLt9+sPf5PPg7FelwUAZeU3hU0NWYRrrjidQsP3htdS 2iBvbJ9wZW5QTXOT6T1Xw9nOvx+CVDF//kF+XdC0grayqYfcy1rRlB3NAN0624IpdbTG ZyRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683554244; x=1686146244; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b+TXP2K1rN6M8cjI/PXxFRn4eAuSPFss48EfB8wsfWE=; b=ZzpLI9ykGAsxq5q2jEBHVmW9S9wxqlyifgUIq23tPJwteqDLUn0hRDVnaeHGHt1AyV vaFELjMYlm3grCh42QGttLBla+W4VWXti+AMa+brAPQfQa4ZMJMluS5GVIT2+E/YGJWl Sibr5WB27RwiEBNwB/MUOF4nG05CQiOqJWOaHK9MhvDnuDANfc/CLyLVqCrvibjdEtbG 6KBxFtRwnHKV1vT68rme9Ogg9P0KunDIaiAdKKi0GqgLEQnVsbB3h0XL81rLSia/1Pgv vdANFBSWbsGHm+PH/NjNQV5XNoZg1wcp4ycwxcrQr0pbVpadAwqXpUwKEE5RFdU0MN/b 17kA== X-Gm-Message-State: AC+VfDw3DlESfXPsH3p92fCnL1qHonASLCnWFpZnzUYOE4xl7rPi6NcA XVsg+tKVUBLt8K+8V9GnCcQ9SJFwmsJ4TQsmYU0= X-Received: by 2002:ac2:562f:0:b0:4ed:c7cc:6f12 with SMTP id b15-20020ac2562f000000b004edc7cc6f12mr2587768lff.34.1683554244128; Mon, 08 May 2023 06:57:24 -0700 (PDT) MIME-Version: 1.0 References: <20230420165454.9517-1-jorge.lopez2@hp.com> <20230420165454.9517-6-jorge.lopez2@hp.com> <24fb56f9-49c6-432d-8c2f-17df7f7e37b2@t-8ch.de> <34539db1-98a4-4696-934b-af04d74720cc@t-8ch.de> In-Reply-To: From: Jorge Lopez Date: Mon, 8 May 2023 08:56:55 -0500 Message-ID: Subject: Re: [PATCH v11 05/14] HP BIOSCFG driver - ordered-attributes To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= Cc: hdegoede@redhat.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 6, 2023 at 12:51=E2=80=AFAM Thomas Wei=C3=9Fschuh wrote: > > On 2023-05-05 16:57:59-0500, Jorge Lopez wrote: > > On Fri, May 5, 2023 at 4:11=E2=80=AFPM Thomas Wei=C3=9Fschuh wrote: > > > > > > On 2023-05-05 11:09:55-0500, Jorge Lopez wrote: > > > > On Sun, Apr 23, 2023 at 1:55=E2=80=AFAM wrote: > > > > > > > > > > On 2023-04-20 11:54:45-0500, Jorge Lopez wrote: > > > > > > .../x86/hp/hp-bioscfg/ordered-attributes.c | 563 ++++++++++= ++++++++ > > > > > > 1 file changed, 563 insertions(+) > > > > > > create mode 100644 drivers/platform/x86/hp/hp-bioscfg/ordered-= attributes.c > > > > > > > > > > > > diff --git a/drivers/platform/x86/hp/hp-bioscfg/ordered-attribu= tes.c b/drivers/platform/x86/hp/hp-bioscfg/ordered-attributes.c > > > > > > new file mode 100644 > > > > > > index 000000000000..5e5d540f728d > > > > > > --- /dev/null > > > > > > + elem_found =3D 0; > > > > > > + while (elem_found < bioscfg_drv.ordered_list_data[instanc= e_id].elements_size) { > > > > > > + > > > > > > + value =3D strsep(&new_values, ","); > > > > > > > > > > The docs say the separator is semicolon. > > > > > > > > BIOS reports the current value using ',' as separator instead of ";= ". > > > > > > > > ./hp-bioscfg/attributes/UEFI Boot Order/current_value > > > > HDD:M.2:3,HDD:USB:1(Disabled),HDD:M.2:4,HDD:M.2:1,HDD:M.2:2,NETWORK > > > > IPV4:EMBEDDED:1,NETWORK IPV6:EMBEDDED:1,NETWORK > > > > IPV4:EXPANSION:1,NETWORK IPV6:EXPANSION:1 > > > > > > > > To avoid having to convert from "," to ";" and vice versa, I will > > > > update the documentation to reflect the use of "'," commas as the > > > > separator > > > > > > The enum data format uses ";". Therefore it makes sense to also stick= to > > > ";". > > > The implementation detail of the BIOS using ',' should not matter to > > > users. > > > > The use of ',' does matter because BIOS expects the updated string to > > use commas as separators > > current_value is reported by BIOS using commas. Any changes to the > > order of items in that string needs to use commas. > > > > The difference with enum is the fact the user needs to enter only one > > value out of those possible values available and no separators are > > needed. > > For ordered attributes... > > > > when the current value is "foo,bar,baz". the user provides a string > > which items are ordered differently. i.e. "baz,bar,foo" > > if the new string is using semicolon instead of comma for the > > separator, BIOS will reject the data. > > Of course the BIOS expects the format with comma. > > But the users of this API should not have to care about implementation > details like that. > They want a consistent API. As the ordered-list type is fairly general > it may be promoted to be a general attribute type later. > > If this happens the API can't be changed as that would break users of > hp-bioscfg. So either there would be two APIs for the ordered-list, one > for hp-bioscfg and one for all other drivers, or different attribute > types would use different kinds of separators. > > Was there an issue with the previous replacement logic? No issue. I was anticipating a potential problem/confusion and created a solution. Customers will start using this driver when it becomes part of the upstream code. Users primarily will use Powershell scripts to interact with the driver. The use of powershell will require the user to have the knowledge and convert ';' semicolon to ',' commas prior to submitting the request to the driver. AFIK, the boot order is one of those attributes that is not configured often by the user. Just my opinion. > > The whole point of device drivers is to translate general kernel APIs > into whatever a specific device needs, switching around ',' and ';' > seems not so bad. So, are you saying, it is ok for the driver to convert ';' semicolon to ',' commas prior to submitting a request to change any attribute of type 'ordered-list' or when reading current value ? If that is correct, then we can change the documentation back to use ';' semicolons. Please confirm. > > > > > > > + if (value !=3D NULL) { > > > > > > + if (!*value) > > > > > > + continue; > > > > > > + elem_found++; > > > > > > + } > > > > > > + > > > > > > + found =3D 0; > > > > > > + for (elem =3D 0; elem < bioscfg_drv.ordered_list_= data[instance_id].elements_size; elem++) { > > > > > > + if (!strcasecmp(bioscfg_drv.ordered_list_= data[instance_id].elements[elem], value)) { > > > > > > > > > > It's surprising that this is case-insensitive. > > > > > > > > As validated in earlier reviews, BIOS rejects strings that do not > > > > match the internal values. > > > > > > > > > > + > > > > > > + strscpy(bioscfg_drv.ordered_list_data[instance_id].common= .display_name_language_code, > > > > > > + LANG_CODE_STR, > > > > > > + sizeof(bioscfg_drv.ordered_list_data[instance_id]= .common.display_name_language_code)); > > > > > > > > > > This seems to be the same for every type. Can it not be moved int= o > > > > > common code? > > > > > > > > Each instance requires to report 'display_name_language_code' hence= it > > > > cannot be moved to a common code. > > > > > > Can it every be different from LANG_CODE_STR? > > > > Yes. The string currently is LANG_CODE_STR (en_US.UTF-8) but it > > will change as the BIOS provides additional translations at a later > > time. > > This is a future enhancement for the driver. > > Is this planned for the near future? > And/Or already implemented in the BIOS? > > If there are no concrete plans to implement this soon, in my opinion, > it would be better to only introduce this code when it does something > useful. There are no concrete plans yet for the driver. BIOS provides translations for strings (F10) UI but the attributes are reported in English regardless of the language configured. firmware-attributes requires 'display_name_language_code' to be reported. At this time, the driver can provide a common helper to assign the LANG_CODE_STR to the corresponding attribute. > > > > If not instead of having one kobj_attribute diplay_langcode for each > > > string/enum/integer/etc you could have one kobj_attribute defined in > > > bioscfg.c and then added to each string_attrs, enum_attrs... > > > > > > The _show() callback for this attribute would just return the constan= t > > > string. > > > > > > This removes the need for many attribute definition, members in the d= ata > > > struct, initialization of these member...