linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] vbe: Support device tree fixups for OS requests
@ 2022-10-11 15:47 Simon Glass
  2022-10-11 15:47 ` [PATCH v2 05/14] fs: Quieten down the filesystems more Simon Glass
  2022-10-17 21:30 ` Simon Glass
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Glass @ 2022-10-11 15:47 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Artem Lapkin, Daniel Golle, Heinrich Schuchardt,
	Jerry Van Baren, John Keeping, Marek Behún, Marek Vasut,
	Pali Rohár, Patrick Delaunay, Pavel Herrmann,
	Philippe Reynes, Qu Wenruo, Ramon Fried, Stefan Roese,
	linux-btrfs

VBE provides the ability for an OS to request that information be passed
to it when it is booted. This is added into the /chosen node, in addition
to things like the bootargs for Linux, for example.

VBE's OS requests are intended to replace the need for the EFI 'boot-time
services'. This works via a 'stub' which runs before Linux, collects the
information from U-Boot, writes it to the device tree (mostly) and then
jumps to Linux with the updated device tree.

Rather than just jumping into Linux and waiting for it to request things
from U-Boot, we can look at the requests in the FIT and process them
before jumping to Linux. This is simpler and easier to test. It is also
more deterministic, since we can tell whether we might lack something
needed by Linux, before jumping to it.

This series adds initial support for OS requests, with just a few simple
ones provided. Further work will expand these out.

Changes in v2:
- Add new patch to update docs about oftree_from_fdt()

Simon Glass (14):
  bootm: Change incorrect 'unsupported' error
  bootm: Avoid returning error codes from command
  bootm: Drop #ifdef from do_bootm()
  boot: Correct handling of addresses in boot_relocate_fdt()
  fs: Quieten down the filesystems more
  fdt: Show a message when the working FDT changes
  bootstd: Move VBE setup into a shared function
  sandbox: Support FDT fixups
  boot: Pass the correct FDT to the EVT_FT_FIXUP event
  boot: Tidy up logging and naming in vbe_simple
  test: Move common FIT code into a separate fit_util file
  vbe: Add fixups for a basic set of OS requests
  dm: core: Update docs about oftree_from_fdt()
  vbe: Add a test for VBE device tree fixups

 arch/sandbox/lib/bootm.c              |  17 ++
 boot/Makefile                         |   2 +-
 boot/bootm.c                          |   2 +-
 boot/image-fdt.c                      |  37 ++--
 boot/vbe_fixup.c                      | 233 ++++++++++++++++++++++++++
 boot/vbe_simple.c                     |  16 +-
 cmd/bootm.c                           |  25 +--
 cmd/fdt.c                             |   1 +
 configs/sandbox_flattree_defconfig    |   2 +-
 disk/part_efi.c                       |  15 +-
 doc/develop/driver-model/livetree.rst |   2 +-
 doc/develop/vbe.rst                   |   3 +-
 doc/usage/cmd/fdt.rst                 |   1 +
 fs/btrfs/disk-io.c                    |   7 +-
 fs/ext4/ext4_common.c                 |   2 +-
 fs/fs_internal.c                      |   3 +-
 include/dm/ofnode.h                   |   3 +
 test/boot/Makefile                    |   1 +
 test/boot/bootflow.c                  |   2 +
 test/boot/bootstd_common.c            |  49 ++++++
 test/boot/bootstd_common.h            |  16 ++
 test/boot/vbe_fixup.c                 |  59 +++++++
 test/boot/vbe_simple.c                |  34 +---
 test/cmd/fdt.c                        |  11 +-
 test/py/tests/fit_util.py             |  93 ++++++++++
 test/py/tests/test_event_dump.py      |   1 +
 test/py/tests/test_fit.py             |  79 +--------
 test/py/tests/test_vbe.py             | 123 ++++++++++++++
 28 files changed, 684 insertions(+), 155 deletions(-)
 create mode 100644 boot/vbe_fixup.c
 create mode 100644 test/boot/vbe_fixup.c
 create mode 100644 test/py/tests/fit_util.py
 create mode 100644 test/py/tests/test_vbe.py

-- 
2.38.0.rc1.362.ged0d419d3c-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 05/14] fs: Quieten down the filesystems more
  2022-10-11 15:47 [PATCH v2 00/14] vbe: Support device tree fixups for OS requests Simon Glass
@ 2022-10-11 15:47 ` Simon Glass
  2022-10-17 21:30 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-10-11 15:47 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Heinrich Schuchardt, Marek Behún,
	Pali Rohár, Philippe Reynes, Qu Wenruo, Stefan Roese,
	linux-btrfs

When looking for a filesystem on a partition we should do so quietly. At
present if the filesystem is very small (e.g. 512 bytes) we get a host of
messages.

Update these to only show when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 disk/part_efi.c       | 15 +++++++--------
 fs/btrfs/disk-io.c    |  7 ++++---
 fs/ext4/ext4_common.c |  2 +-
 fs/fs_internal.c      |  3 +--
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index ad94504ed90..26738a57d5d 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -264,20 +264,19 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
 
 	/* "part" argument must be at least 1 */
 	if (part < 1) {
-		printf("%s: Invalid Argument(s)\n", __func__);
-		return -1;
+		log_debug("Invalid Argument(s)\n");
+		return -EINVAL;
 	}
 
 	/* This function validates AND fills in the GPT header and PTE */
 	if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1)
-		return -1;
+		return -EINVAL;
 
 	if (part > le32_to_cpu(gpt_head->num_partition_entries) ||
 	    !is_pte_valid(&gpt_pte[part - 1])) {
-		debug("%s: *** ERROR: Invalid partition number %d ***\n",
-			__func__, part);
+		log_debug("*** ERROR: Invalid partition number %d ***\n", part);
 		free(gpt_pte);
-		return -1;
+		return -EPERM;
 	}
 
 	/* The 'lbaint_t' casting may limit the maximum disk size to 2 TB */
@@ -300,8 +299,8 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
 			info->type_guid, UUID_STR_FORMAT_GUID);
 #endif
 
-	debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s\n", __func__,
-	      info->start, info->size, info->name);
+	log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n", info->start,
+		  info->size, info->name);
 
 	/* Remember to free pte */
 	free(gpt_pte);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c80f8e80283..3f0d9f1c113 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
 #include <fs_internal.h>
+#include <log.h>
 #include <uuid.h>
 #include <memalign.h>
 #include "kernel-shared/btrfs_tree.h"
@@ -910,9 +911,9 @@ static int btrfs_scan_fs_devices(struct blk_desc *desc,
 
 	if (round_up(BTRFS_SUPER_INFO_SIZE + BTRFS_SUPER_INFO_OFFSET,
 		     desc->blksz) > (part->size << desc->log2blksz)) {
-		error("superblock end %u is larger than device size " LBAFU,
-				BTRFS_SUPER_INFO_SIZE + BTRFS_SUPER_INFO_OFFSET,
-				part->size << desc->log2blksz);
+		log_debug("superblock end %u is larger than device size " LBAFU,
+			  BTRFS_SUPER_INFO_SIZE + BTRFS_SUPER_INFO_OFFSET,
+			  part->size << desc->log2blksz);
 		return -EINVAL;
 	}
 
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index d49ba4a9954..1185cb2c046 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -2415,7 +2415,7 @@ int ext4fs_mount(unsigned part_length)
 
 	return 1;
 fail:
-	printf("Failed to mount ext2 filesystem...\n");
+	log_debug("Failed to mount ext2 filesystem...\n");
 fail_noerr:
 	free(data);
 	ext4fs_root = NULL;
diff --git a/fs/fs_internal.c b/fs/fs_internal.c
index ae1cb8584c7..111f91b355d 100644
--- a/fs/fs_internal.c
+++ b/fs/fs_internal.c
@@ -29,8 +29,7 @@ int fs_devread(struct blk_desc *blk, struct disk_partition *partition,
 	/* Check partition boundaries */
 	if ((sector + ((byte_offset + byte_len - 1) >> log2blksz))
 	    >= partition->size) {
-		log_err("%s read outside partition " LBAFU "\n", __func__,
-			sector);
+		log_debug("read outside partition " LBAFU "\n", sector);
 		return 0;
 	}
 
-- 
2.38.0.rc1.362.ged0d419d3c-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 05/14] fs: Quieten down the filesystems more
  2022-10-11 15:47 [PATCH v2 00/14] vbe: Support device tree fixups for OS requests Simon Glass
  2022-10-11 15:47 ` [PATCH v2 05/14] fs: Quieten down the filesystems more Simon Glass
@ 2022-10-17 21:30 ` Simon Glass
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-10-17 21:30 UTC (permalink / raw)
  To: Simon Glass
  Cc: Heinrich Schuchardt, Marek Behún, Pali Rohár,
	Philippe Reynes, Qu Wenruo, Stefan Roese, linux-btrfs,
	U-Boot Mailing List

When looking for a filesystem on a partition we should do so quietly. At
present if the filesystem is very small (e.g. 512 bytes) we get a host of
messages.

Update these to only show when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 disk/part_efi.c       | 15 +++++++--------
 fs/btrfs/disk-io.c    |  7 ++++---
 fs/ext4/ext4_common.c |  2 +-
 fs/fs_internal.c      |  3 +--
 4 files changed, 13 insertions(+), 14 deletions(-)

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-17 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 15:47 [PATCH v2 00/14] vbe: Support device tree fixups for OS requests Simon Glass
2022-10-11 15:47 ` [PATCH v2 05/14] fs: Quieten down the filesystems more Simon Glass
2022-10-17 21:30 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).