Message ID | 20180618140835.195901-20-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Alexander Graf |
Headers | show |
Series | efi: Enable sandbox support for EFI loader | expand |
On 06/18/2018 04:08 PM, Simon Glass wrote: > Sandbox only has 128MB of memory so we cannot relocate the device tree up > to start at 128MB. Use 127MB instead, which should be safe. > > Signed-off-by: Simon Glass <sjg@chromium.org> We should just drop into the fallback case if allocation fails, no? Alex > --- > > Changes in v8: None > Changes in v7: None > Changes in v6: None > Changes in v5: None > Changes in v4: None > Changes in v3: None > Changes in v2: None > > cmd/bootefi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > index 3fa4f181ba..d2458e2397 100644 > --- a/cmd/bootefi.c > +++ b/cmd/bootefi.c > @@ -141,8 +141,8 @@ static void *copy_fdt(void *fdt) > fdt_size = ALIGN(fdt_size + 4096, EFI_PAGE_SIZE); > fdt_pages = fdt_size >> EFI_PAGE_SHIFT; > > - /* Safe fdt location is at 128MB */ > - new_fdt_addr = fdt_ram_start + (128 * 1024 * 1024) + fdt_size; > + /* Safe fdt location is at 127MB */ > + new_fdt_addr = fdt_ram_start + (127 * 1024 * 1024) + fdt_size; > if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, > EFI_RUNTIME_SERVICES_DATA, fdt_pages, > &new_fdt_addr) != EFI_SUCCESS) {
Hi Alex, On 18 June 2018 at 08:52, Alexander Graf <agraf@suse.de> wrote: > On 06/18/2018 04:08 PM, Simon Glass wrote: >> >> Sandbox only has 128MB of memory so we cannot relocate the device tree up >> to start at 128MB. Use 127MB instead, which should be safe. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> > > > We should just drop into the fallback case if allocation fails, no? I cannot see how the allocation could ever fail, now that we are definitely in sandbox RAM. So I'm OK with doing that if you are. Regards, Simon
On 06/21/2018 04:01 AM, Simon Glass wrote: > Hi Alex, > > On 18 June 2018 at 08:52, Alexander Graf <agraf@suse.de> wrote: >> On 06/18/2018 04:08 PM, Simon Glass wrote: >>> Sandbox only has 128MB of memory so we cannot relocate the device tree up >>> to start at 128MB. Use 127MB instead, which should be safe. >>> >>> Signed-off-by: Simon Glass <sjg@chromium.org> >> >> We should just drop into the fallback case if allocation fails, no? > I cannot see how the allocation could ever fail, now that we are > definitely in sandbox RAM. So I'm OK with doing that if you are. I think that's perfectly reasonable, yes :) Alex
Hi Alex, On 21 June 2018 at 04:01, Alexander Graf <agraf@suse.de> wrote: > On 06/21/2018 04:01 AM, Simon Glass wrote: >> >> Hi Alex, >> >> On 18 June 2018 at 08:52, Alexander Graf <agraf@suse.de> wrote: >>> >>> On 06/18/2018 04:08 PM, Simon Glass wrote: >>>> >>>> Sandbox only has 128MB of memory so we cannot relocate the device tree >>>> up >>>> to start at 128MB. Use 127MB instead, which should be safe. >>>> >>>> Signed-off-by: Simon Glass <sjg@chromium.org> >>> >>> >>> We should just drop into the fallback case if allocation fails, no? >> >> I cannot see how the allocation could ever fail, now that we are >> definitely in sandbox RAM. So I'm OK with doing that if you are. > > > I think that's perfectly reasonable, yes :) OK I will update the patch. Regards, Simon
On 06/21/2018 09:45 PM, Simon Glass wrote: > Hi Alex, > > On 21 June 2018 at 04:01, Alexander Graf <agraf@suse.de> wrote: >> On 06/21/2018 04:01 AM, Simon Glass wrote: >>> Hi Alex, >>> >>> On 18 June 2018 at 08:52, Alexander Graf <agraf@suse.de> wrote: >>>> On 06/18/2018 04:08 PM, Simon Glass wrote: >>>>> Sandbox only has 128MB of memory so we cannot relocate the device tree >>>>> up >>>>> to start at 128MB. Use 127MB instead, which should be safe. >>>>> >>>>> Signed-off-by: Simon Glass <sjg@chromium.org> >>>> >>>> We should just drop into the fallback case if allocation fails, no? >>> I cannot see how the allocation could ever fail, now that we are >>> definitely in sandbox RAM. So I'm OK with doing that if you are. >> >> I think that's perfectly reasonable, yes :) > OK I will update the patch. No worries. I pulled in most parts that I consider ready to efi-next already. I'll prepare a small patch set that takes patches from your set and my set and gets us a working sandbox efi_loader on top. Alex
diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 3fa4f181ba..d2458e2397 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -141,8 +141,8 @@ static void *copy_fdt(void *fdt) fdt_size = ALIGN(fdt_size + 4096, EFI_PAGE_SIZE); fdt_pages = fdt_size >> EFI_PAGE_SHIFT; - /* Safe fdt location is at 128MB */ - new_fdt_addr = fdt_ram_start + (128 * 1024 * 1024) + fdt_size; + /* Safe fdt location is at 127MB */ + new_fdt_addr = fdt_ram_start + (127 * 1024 * 1024) + fdt_size; if (efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_RUNTIME_SERVICES_DATA, fdt_pages, &new_fdt_addr) != EFI_SUCCESS) {
Sandbox only has 128MB of memory so we cannot relocate the device tree up to start at 128MB. Use 127MB instead, which should be safe. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None cmd/bootefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)