All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Cc: Simon Glass <sjg@chromium.org>,
	 casey.connolly@linaro.org, neil.armstrong@linaro.org,
	 sumit.garg@kernel.org,  trini@konsulko.com,
	aswin.murugan@oss.qualcomm.com,  joe.hershberger@ni.com,
	ilias.apalodimas@linaro.org,  quentin.schulz@cherry.de,
	javier.tia@linaro.org,  quic_varada@quicinc.com,
	marek.vasut+renesas@mailbox.org,  michal.simek@amd.com,
	ansuelsmth@gmail.com,  mwalle@kernel.org,  anshuld@ti.com,
	jan.kiszka@siemens.com,  javierm@redhat.com,
	 u-boot-qcom@groups.io, u-boot@lists.denx.de
Subject: Re: [PATCH v1 3/4] env: scsi: Add support for partition type GUID based environment
Date: Fri, 09 Jan 2026 12:55:56 +0100	[thread overview]
Message-ID: <874iovrodv.fsf@prevas.dk> (raw)
In-Reply-To: <bb66d91b-667a-4c28-8acc-b64fa84fb7f6@oss.qualcomm.com> (Balaji Selvanathan's message of "Fri, 9 Jan 2026 14:21:28 +0530")

On Fri, Jan 09 2026, Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> wrote:

> Hi Simon,
>
> On 1/8/2026 11:12 PM, Simon Glass wrote:
>> Hi Balaji,
>>
>> On Wed, 7 Jan 2026 at 23:50, Balaji Selvanathan
>> <balaji.selvanathan@oss.qualcomm.com> wrote:
>>> Add support for locating SCSI environment partition using GPT type
>>> GUID instead of unique UUID. This enables the saveenv command to
>>> work with partitions identified by their type rather than unique
>>> identifiers, providing flexibility for systems where partition
>>> UUIDs may vary across devices but types remain constant.
>>>
>>> Introduce CONFIG_SCSI_ENV_PART_TYPE_GUID configuration option that
>>> allows specifying a partition type GUID for environment storage.
>>> When enabled, the environment subsystem uses the new type GUID
>>> based lookup method via scsi_get_blk_by_type_guid() to find the
>>> first matching partition.
>>>
>>> This change maintains backward compatibility with the existing
>>> UUID-based approach.
>>>
>>> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
>>> ---
>>>   env/Kconfig |  7 +++++++
>>>   env/scsi.c  | 13 +++++++++++++
>>>   2 files changed, 20 insertions(+)
>>>
>>> diff --git a/env/Kconfig b/env/Kconfig
>>> index b312f9b5324..97cb3d05daf 100644
>>> --- a/env/Kconfig
>>> +++ b/env/Kconfig
>>> @@ -768,6 +768,13 @@ config SCSI_ENV_PART_UUID
>>>          help
>>>            UUID of the SCSI partition that you want to store the environment in.
>>>
>>> +config SCSI_ENV_PART_TYPE_GUID
>>> +       string "SCSI partition type GUID for saving environment"
>>> +       depends on ENV_IS_IN_SCSI
>>> +       help
>>> +         Type GUID of the SCSI partition to store the environment in.
>>> +         Uses the first partition matching this type GUID.
>>> +
>>>   config ENV_USE_DEFAULT_ENV_TEXT_FILE
>>>          bool "Create default environment from file"
>>>          depends on !COMPILE_TEST
>>> diff --git a/env/scsi.c b/env/scsi.c
>>> index 207717e17b1..6182ae26679 100644
>>> --- a/env/scsi.c
>>> +++ b/env/scsi.c
>>> @@ -35,8 +35,13 @@ static inline struct env_scsi_info *env_scsi_get_part(void)
>>>   {
>>>          struct env_scsi_info *ep = &env_part;
>>>
>>> +#ifdef CONFIG_SCSI_ENV_PART_TYPE_GUID
>>> +       if (scsi_get_blk_by_type_guid(CONFIG_SCSI_ENV_PART_TYPE_GUID, &ep->blk, &ep->part))
>> Can you use if IS_ENABLED(CONFIG_SCSI_ENV_PART_TYPE_GUID)
>>
>> (we try to avoid #ifdef)
> Thanks for the feedback.
>
> In this respin
> https://lore.kernel.org/u-boot/20260109070912.4106466-4-balaji.selvanathan@oss.qualcomm.com/,
> I've introduced a choice statement in env/Kconfig to ensure mutual
> exclusivity between CONFIG_SCSI_ENV_PART_UUID and
> CONFIG_SCSI_ENV_PART_TYPE_GUID.
>
> Due to this choice-based configuration, only one of these string
> configs is defined at compile time. When I attempted to use `if
> (IS_ENABLED(...))` for the string concatenation cases, I encountered
> compilation errors because the compiler tries to evaluate both
> branches, but the undefined config macro causes an "undeclared
> identifier" error.
>

I think you could do

config SCSI_ENV_PART_TYPE_GUID
	string "SCSI partition type GUID for saving environment" if SCSI_ENV_PART_USE_TYPE_GUID
	help
	  Type GUID of the SCSI partition to store the environment in.
	  Uses the first partition matching this type GUID.

instead of

config SCSI_ENV_PART_TYPE_GUID
	string "SCSI partition type GUID for saving environment"
	depends on SCSI_ENV_PART_USE_TYPE_GUID
	help
	  Type GUID of the SCSI partition to store the environment in.
	  Uses the first partition matching this type GUID.


Then the config symbol always exists, but is only visible/changable when
relevant.

Also, I suggest adding

  default "3de21764-95bd-54bd-a5c3-4abe786f38a8"

There's really no reason everybody should come up with their own, and we
already have exactly that type guid defined to mean "partition
containing a u-boot environment".

Rasmus

  reply	other threads:[~2026-01-09 11:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08  6:49 [PATCH v1 0/4] Add partition type GUID support for environment Balaji Selvanathan
2026-01-08  6:49 ` [PATCH v1 1/4] disk: Add partition lookup by type GUID functionality Balaji Selvanathan
2026-01-08  6:49 ` [PATCH v1 2/4] scsi: Add partition lookup by type GUID for SCSI devices Balaji Selvanathan
2026-01-08  9:37   ` Varadarajan Narayanan
2026-01-08 17:41     ` Simon Glass
2026-01-09  7:13     ` Balaji Selvanathan
2026-01-08  6:49 ` [PATCH v1 3/4] env: scsi: Add support for partition type GUID based environment Balaji Selvanathan
2026-01-08  9:41   ` Varadarajan Narayanan
2026-01-08 14:32     ` Tom Rini
2026-01-09  7:16       ` Balaji Selvanathan
2026-01-09  7:15     ` Balaji Selvanathan
2026-01-08 17:42   ` Simon Glass
2026-01-09  8:51     ` Balaji Selvanathan
2026-01-09 11:55       ` Rasmus Villemoes [this message]
2026-01-09 14:48       ` Tom Rini
2026-01-08  6:49 ` [PATCH v1 4/4] configs: Enable partition type GUID for QCM6490 and QCS615 boards Balaji Selvanathan

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=874iovrodv.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=anshuld@ti.com \
    --cc=ansuelsmth@gmail.com \
    --cc=aswin.murugan@oss.qualcomm.com \
    --cc=balaji.selvanathan@oss.qualcomm.com \
    --cc=casey.connolly@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jan.kiszka@siemens.com \
    --cc=javier.tia@linaro.org \
    --cc=javierm@redhat.com \
    --cc=joe.hershberger@ni.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=michal.simek@amd.com \
    --cc=mwalle@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quentin.schulz@cherry.de \
    --cc=quic_varada@quicinc.com \
    --cc=sjg@chromium.org \
    --cc=sumit.garg@kernel.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.denx.de \
    /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.