[PATCH 0/5] sandbox: Minor Fixes in various areas

This series contains some minor tweaks and fixes to sandbox-related code.
Simon Glass (5): sandbox: Show a message when writing out the ram buffer sandbox: Add the handoff header for spl sandbox: Open host file for read-only access if needed sandbox: Slow down the LCD sync rate sandbox: test: Tidy up spl_test_load() calls
arch/sandbox/cpu/spl.c | 1 + arch/sandbox/cpu/state.c | 3 ++- drivers/block/sandbox.c | 11 ++++++++--- drivers/video/video-uclass.c | 2 +- test/image/spl_load.c | 6 +----- 5 files changed, 13 insertions(+), 10 deletions(-)

If state is not being written, but RAM is, we should still show a message, so it is clear that this is happening.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/sandbox/cpu/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index ce904b1740..e0d01125bb 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -421,7 +421,8 @@ int state_uninit(void) { int err;
- log_info("Writing sandbox state\n"); + if (state->write_ram_buf || state->write_state) + log_info("Writing sandbox state\n"); state = &main_state;
/* Finish the bloblist, so that it is correct before writing memory */

This defines a function declared in handoff.h so add the header.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/sandbox/cpu/spl.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c index 650bdb0a70..3f107b8acb 100644 --- a/arch/sandbox/cpu/spl.c +++ b/arch/sandbox/cpu/spl.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <hang.h> +#include <handoff.h> #include <init.h> #include <log.h> #include <os.h>

Some files cannot be written but read-only access is still useful for tests. Add a fallback to read-only access when needed.
This is useful in CI when opening a large data file provided by docker, where read/write access would result in copying the file, thus needing a lot of extra disk space.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/block/sandbox.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 53925ce9b6..1388498a1d 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -125,9 +125,14 @@ int host_dev_bind(int devnum, char *filename, bool removable)
fd = os_open(filename, OS_O_RDWR); if (fd == -1) { - printf("Failed to access host backing file '%s'\n", filename); - ret = -ENOENT; - goto err; + printf("Failed to access host backing file '%s', trying read-only\n", + filename); + fd = os_open(filename, OS_O_RDONLY); + if (fd == -1) { + printf("- still failed\n"); + ret = -ENOENT; + goto err; + } } ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str, IF_TYPE_HOST, devnum, 512,

There is seldom a need to refresh at 100Hz and it uses a lot of CPU. Reduce the rate to 10Hz which seems to be adequate.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/video/video-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 7d499bcec5..5215114b2d 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -204,7 +204,7 @@ int video_sync(struct udevice *vid, bool force) struct video_priv *priv = dev_get_uclass_priv(vid); static ulong last_sync;
- if (force || get_timer(last_sync) > 10) { + if (force || get_timer(last_sync) > 100) { sandbox_sdl_sync(priv->fb); last_sync = get_timer(0); }

Use the new sandbox_find_next_phase() function, which does what is needed here.
Signed-off-by: Simon Glass sjg@chromium.org ---
test/image/spl_load.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/test/image/spl_load.c b/test/image/spl_load.c index e7cabf5680..df389e26f9 100644 --- a/test/image/spl_load.c +++ b/test/image/spl_load.c @@ -56,7 +56,6 @@ struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
static int spl_test_load(struct unit_test_state *uts) { - const char *cur_prefix, *next_prefix; struct spl_image_info image; struct image_header *header; struct text_ctx text_ctx; @@ -69,10 +68,7 @@ static int spl_test_load(struct unit_test_state *uts) load.bl_len = 512; load.read = read_fit_image;
- cur_prefix = spl_phase_prefix(spl_phase()); - next_prefix = spl_phase_prefix(spl_next_phase()); - ret = os_find_u_boot(fname, sizeof(fname), true, cur_prefix, - next_prefix); + ret = sandbox_find_next_phase(fname, sizeof(fname), true); if (ret) { printf("(%s not found, error %d)\n", fname, ret); return ret;
participants (1)
-
Simon Glass