[U-Boot] [PATCH 1/1] sandbox: fix phys_to_virt()

Allow for pointers not created by map_to_sysmem().
This fixes the fit image and vboot test.
Fixes: 8b79c294ec57 ("sandbox: Enhance map_to_sysmem() to handle foreign pointers") Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- Alex, this should fix the issues with the efi-next pull request. Would you add it to your queue?
https://travis-ci.org/xypron2/u-boot/builds/433278595 --- arch/sandbox/cpu/cpu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 6098945049..4e28d06e43 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -111,12 +111,8 @@ void *phys_to_virt(phys_addr_t paddr) } }
- printf("%s: Cannot map sandbox address %lx (SDRAM from 0 to %lx)\n", - __func__, (ulong)paddr, (ulong)gd->ram_size); - os_abort(); - - /* Not reached */ - return NULL; + /* Allow for pointers not created by map_to_sysmem() */ + return (void *)(gd->arch.ram_buf + paddr); }
struct sandbox_mapmem_entry *find_tag(const void *ptr)

On 26.09.18 07:12, Heinrich Schuchardt wrote:
Allow for pointers not created by map_to_sysmem().
This fixes the fit image and vboot test.
Fixes: 8b79c294ec57 ("sandbox: Enhance map_to_sysmem() to handle foreign pointers") Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de
Unfortunately I'm afraid this is the wrong approach; we should fix the users of the mapping API instead and ensure that "addresses" are either tokens to host memory or inside the sandbox address range.
I've sent an alternative fix that does this. But thanks for your patch nevertheless - it definitely helped to filter down on what the problem was!
Alex
participants (2)
-
Alexander Graf
-
Heinrich Schuchardt