init: discoverable root partitions, a.k.a. an omittable "root=" cmdline option#968
Open
blktests-ci[bot] wants to merge 19 commits into
Open
init: discoverable root partitions, a.k.a. an omittable "root=" cmdline option#968blktests-ci[bot] wants to merge 19 commits into
blktests-ci[bot] wants to merge 19 commits into
Conversation
DPS [1] assigns native root partition type UUIDs per architecture. Add the ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID config option so that architectures can opt in. Architectures that support this feature should define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h as a string representation of the architecture's DPS root partition type UUID. Add the hidden DPS_ROOT_AUTO_DISCOVERY symbol for the combination of BLOCK, EFI and ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID, and use it to expose DPS_ROOT_PARTITION_TYPE_UUID from the common linux/root_dev.h header only when all prerequisites are met. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for alpha and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Richard Henderson <richard.henderson@linaro.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Magnus Lindholm <linmag7@gmail.com> Cc: linux-alpha@vger.kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for ARC and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Vineet Gupta <vgupta@kernel.org> Cc: linux-snps-arc@lists.infradead.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for ARM and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Russell King <linux@armlinux.org.uk> Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for arm64 and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for LoongArch64 and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Huacai Chen <chenhuacai@kernel.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: loongarch@lists.linux.dev Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for the MIPS endian and 32/64-bit variants described by the specification and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: linux-mips@vger.kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for parisc and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for the powerpc endian and 32/64-bit variants described by the specification and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for the RISC-V 32/64-bit variants described by the specification and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Paul Walmsley <pjw@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: linux-riscv@lists.infradead.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for the s390 (32-bit) and s390x (64-bit) variants described by the specification and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: linux-s390@vger.kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] assigns GPT partition type UUIDs to operating system partitions. Root partitions use architecture-specific type UUIDs so the OS can discover the intended root filesystem without relying on a root= cmdline option. Define DPS_ROOT_PARTITION_TYPE_UUID in asm/dps_root.h for the x86 32/64-bit variants described by the specification and select ARCH_HAS_DPS_ROOT_PARTITION_TYPE_UUID. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Cc: Thomas Gleixner <tglx@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: x86@kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] identifies OS partitions by GPT partition type UUID. Keep that UUID in partition_meta_info and populate it while scanning EFI partition tables so early root discovery can use it. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Add early_lookup_bdev_by_type_uuid() to find the root block device by its GPT type UUID on the disk containing the active EFI System Partition. DPS [1] requires OS partition discovery to be limited to the disk containing the active EFI System Partition. Reuse the existing block class lookup and UUID matching callback to identify that disk, then do a second lookup constrained to it. If the disk contains several partitions with a matching type UUID, use the first match, following the DPS discovery rule. Extend struct uuidcmp with the new disk field so that it can be used in the new match_dev_by_type_uuid() callback function. Update devt_from_partuuid() to initialize cmp with a designated initializer so that the new cmp.disk field is zero-initialized. This is not strictly needed, but keeps the code cleaner. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
struct _gpt_entry_attributes currently models the GPT partition entry attributes field with bitfields. This is broken on machines using the __BIG_ENDIAN_BITFIELD ABI because GPT always stores the attributes on disk as a 64-bit little-endian. No current code consumes individual fields from that structure. So just remove struct _gpt_entry_attributes entirely and replace it by an __le64 value in struct _gpt_entry. Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS [1] defines GPT attribute bit 63 as no-auto. Partitions with this bit set must not be used by automatic discovery. Add the new GPT_ATTRIBUTE_NO_AUTO flag to designate the GPT attribute bit 63. Add the new ADDPART_FLAG_NO_AUTO flag and set it when GPT_ATTRIBUTE_NO_AUTO is set during the partition scan. Then, propagate it to the new BD_NO_AUTO_DISCOVERY flag. Finally, add a condition to match_dev_by_type_uuid() to exclude any partition with that flag from the automatic discovery. [1] The Discoverable Partitions Specification (DPS) Link: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
DPS root detection will also need to work if root_wait is set, meaning that wait_for_root() needs to handle the DPS logic. Move early_lookup_bdev() out of wait_for_root() into the new lookup_root_device() so later changes can extend the lookup policy without duplicating the retry logic. Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
When the root= cmdline option is absent, try to discover the root block device using the architecture's DPS root partition type UUID. DPS limits root discovery to the disk containing the active EFI System Partition. Read LoaderDevicePartUUID from the Boot Loader Interface and pass it to early_lookup_bdev_by_type_uuid() so the block lookup only considers partitions on that disk. Print a dedicated wait message while waiting for a discoverable root partition and emit an informational message when discovery succeeds. If LoaderDevicePartUUID cannot be read or does not contain a valid UUID, clear root_wait so the kernel does not keep retrying a discovery path that cannot succeed. Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Document the automatic root block device discovery feature. Cc: Jonathan Corbet <corbet@lwn.net> Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: linux-doc@vger.kernel.org Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
Author
|
Upstream branch: 062871f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: init: discoverable root partitions, a.k.a. an omittable "root=" cmdline option
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1111812