{"id":2175516,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2175516/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20251218-bootconfig-v4-2-5bbbdb0be1dc@baylibre.com>","date":"2025-12-18T11:16:57","name":"[v4,2/5] boot: android: Add sandbox memory mapping support","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"b782517177a47ecb7f7355d3dfa72801f7a5dc20","submitter":{"id":76253,"url":"http://patchwork.ozlabs.org/api/1.0/people/76253/?format=json","name":"Guillaume La Roque","email":"glaroque@baylibre.com"},"delegate":{"id":117687,"url":"http://patchwork.ozlabs.org/api/1.0/users/117687/?format=json","username":"mkorpershoek","first_name":"Mattijs","last_name":"Korpershoek","email":"mkorpershoek@baylibre.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20251218-bootconfig-v4-2-5bbbdb0be1dc@baylibre.com/mbox/","series":[{"id":485825,"url":"http://patchwork.ozlabs.org/api/1.0/series/485825/?format=json","date":"2025-12-18T11:16:55","name":"android: add bootconfig support","version":4,"mbox":"http://patchwork.ozlabs.org/series/485825/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2175516/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20230601.gappssmtp.com\n header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256\n header.s=20230601 header.b=FFl2ZiP1;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=baylibre-com.20230601.gappssmtp.com\n header.i=@baylibre-com.20230601.gappssmtp.com header.b=\"FFl2ZiP1\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=baylibre.com","phobos.denx.de;\n spf=pass smtp.mailfrom=glaroque@baylibre.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dX7Rw5dVJz1y2F\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 22:17:32 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 67A9783D00;\n\tThu, 18 Dec 2025 12:17:13 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id DCFE983D77; Thu, 18 Dec 2025 12:17:11 +0100 (CET)","from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n [IPv6:2a00:1450:4864:20::336])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 8AA8883D77\n for <u-boot@lists.denx.de>; Thu, 18 Dec 2025 12:17:09 +0100 (CET)","by mail-wm1-x336.google.com with SMTP id\n 5b1f17b1804b1-4775e891b5eso2078675e9.2\n for <u-boot@lists.denx.de>; Thu, 18 Dec 2025 03:17:09 -0800 (PST)","from [127.0.1.1] ([2a01:e0a:e50:3860:3734:1277:36b8:3f57])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-47be273f147sm38070965e9.7.2025.12.18.03.17.07\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 18 Dec 2025 03:17:08 -0800 (PST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1766056629;\n x=1766661429;\n darn=lists.denx.de;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=CBwiaKkvO5eXDRopF8AQNlDioUaSlMXOzj94JLV1Qtw=;\n b=FFl2ZiP15/aRmFy6RKaK6chYHWEA1HBweN7rMwrnTV4X3R1LAkHDmMdyEWc0iYghXj\n 2Rj57p1Vs64si0feN3upahtxbLANJrg6rSGAntjF4O0pDBg3NjddcizfKzhJ3J9MopE8\n JhG0RZD6tjACN0tGju4KJUzW6m5Rc7ra3s/zhqBlKnvhw/LJy/7/+eVjMm78gv4vwHjQ\n VMJNz0z/fSuZPoa9n2OtjbNSt9RQdoQkKOj/vENWiW41AqULNuvbViFupL4c5+Zr509h\n 2CqwPH3cj9c81zXQwtHXdR+iWHoj2dw2XH/+Zu1mceVdqwxtmipRV2+c3ehsJUM/JRUg\n xpBQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1766056629; x=1766661429;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=CBwiaKkvO5eXDRopF8AQNlDioUaSlMXOzj94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rMYvGIg0RFKLNzbX3TJ\n 67BcaaHFm4FsUKJQ==","X-Google-Smtp-Source":"\n AGHT+IEG+jrk2MDLw48Yb+qde1p3ZkHbFumfcMUuS+a88umRyUHRFj/Wn27zfZW67IcW4Cq33Te29A==","X-Received":"by 2002:a05:600c:46cb:b0:477:7a78:3016 with SMTP id\n 5b1f17b1804b1-47a8f8a7f0fmr227346215e9.8.1766056628927;\n Thu, 18 Dec 2025 03:17:08 -0800 (PST)","From":"\"Guillaume La Roque (TI.com)\" <glaroque@baylibre.com>","Date":"Thu, 18 Dec 2025 12:16:57 +0100","Subject":"[PATCH v4 2/5] boot: android: Add sandbox memory mapping support","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20251218-bootconfig-v4-2-5bbbdb0be1dc@baylibre.com>","References":"<20251218-bootconfig-v4-0-5bbbdb0be1dc@baylibre.com>","In-Reply-To":"<20251218-bootconfig-v4-0-5bbbdb0be1dc@baylibre.com>","To":"Tom Rini <trini@konsulko.com>,\n Mattijs Korpershoek <mkorpershoek@kernel.org>","Cc":"Julien Masson <jmasson@baylibre.com>,\n Guillaume La Roque <glaroque@baylibre.com>, u-boot@lists.denx.de,\n Simon Glass <sjg@chromium.org>, Nicolas Belin <nbelin@baylibre.com>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Aaron Kling <webgeek1234@gmail.com>, George Chan <gchan9527@gmail.com>,\n Sam Day <me@samcday.com>, Jerome Forissier <jerome.forissier@linaro.org>,\n Maxime Fournier <mfournier@baylibre.com>, Eddie Kovsky <ekovsky@redhat.com>,\n Casey Connolly <casey.connolly@linaro.org>,\n Guillaume Ranquet <ranquet.guillaume@gmail.com>","X-Mailer":"b4 0.14.3","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Use map_to_sysmem() to convert header pointers to physical addresses\nin parse_hdr functions, and add proper map_sysmem()/unmap_sysmem()\ncalls in android_image_get_data() for sandbox compatibility.\n\nReviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>\nReviewed-by: Simon Glass <sjg@chromium.org>\nSigned-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>\n---\n boot/image-android.c | 41 ++++++++++++++++++++++++++++-------------\n 1 file changed, 28 insertions(+), 13 deletions(-)","diff":"diff --git a/boot/image-android.c b/boot/image-android.c\nindex 877cd39fbef..48886f39e4c 100644\n--- a/boot/image-android.c\n+++ b/boot/image-android.c\n@@ -114,7 +114,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3\n \t * The header takes a full page, the remaining components are aligned\n \t * on page boundary.\n \t */\n-\tend = (ulong)hdr;\n+\tend = map_to_sysmem(hdr);\n \tend += ANDR_GKI_PAGE_SIZE;\n \tdata->kernel_ptr = end;\n \tdata->kernel_size = hdr->kernel_size;\n@@ -127,7 +127,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3\n \tif (hdr->header_version > 3)\n \t\tend += ALIGN(hdr->signature_size, ANDR_GKI_PAGE_SIZE);\n \n-\tdata->boot_img_total_size = end - (ulong)hdr;\n+\tdata->boot_img_total_size = end - map_to_sysmem(hdr);\n }\n \n static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vnd_boot_img_hdr\n@@ -146,7 +146,7 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vnd_boot\n \tdata->ramdisk_addr = hdr->ramdisk_addr;\n \tdata->dtb_load_addr = hdr->dtb_addr;\n \tdata->bootconfig_size = hdr->bootconfig_size;\n-\tend = (ulong)hdr;\n+\tend = map_to_sysmem(hdr);\n \n \tif (hdr->header_version > 3)\n \t\tend += ALIGN(ANDR_VENDOR_BOOT_V4_SIZE, hdr->page_size);\n@@ -167,12 +167,16 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vnd_boot\n \tend += ALIGN(hdr->vendor_ramdisk_table_size, hdr->page_size);\n \tdata->bootconfig_addr = end;\n \tif (hdr->bootconfig_size) {\n-\t\tdata->bootconfig_size += add_trailer(data->bootconfig_addr,\n+\t\tvoid *bootconfig_ptr = map_sysmem(data->bootconfig_addr,\n+\t\t\t\t\t\t  data->bootconfig_size +\n+\t\t\t\t\t\t  BOOTCONFIG_TRAILER_SIZE);\n+\t\tdata->bootconfig_size += add_trailer((ulong)bootconfig_ptr,\n \t\t\t\t\t\t     data->bootconfig_size);\n+\t\tunmap_sysmem(bootconfig_ptr);\n \t\tdata->ramdisk_size += data->bootconfig_size;\n \t}\n \tend += ALIGN(data->bootconfig_size, hdr->page_size);\n-\tdata->vendor_boot_img_total_size = end - (ulong)hdr;\n+\tdata->vendor_boot_img_total_size = end - map_to_sysmem(hdr);\n }\n \n static void android_boot_image_v0_v1_v2_parse_hdr(const struct andr_boot_img_hdr_v0 *hdr,\n@@ -187,7 +191,7 @@ static void android_boot_image_v0_v1_v2_parse_hdr(const struct andr_boot_img_hdr\n \tdata->header_version = hdr->header_version;\n \tdata->dtb_load_addr = hdr->dtb_addr;\n \n-\tend = (ulong)hdr;\n+\tend = map_to_sysmem(hdr);\n \n \t/*\n \t * The header takes a full page, the remaining components are aligned\n@@ -220,7 +224,7 @@ static void android_boot_image_v0_v1_v2_parse_hdr(const struct andr_boot_img_hdr\n \t\tend += ALIGN(hdr->dtb_size, hdr->page_size);\n \t}\n \n-\tdata->boot_img_total_size = end - (ulong)hdr;\n+\tdata->boot_img_total_size = end - map_to_sysmem(hdr);\n }\n \n bool android_image_get_bootimg_size(const void *hdr, u32 *boot_img_size)\n@@ -271,31 +275,42 @@ bool android_image_get_vendor_bootimg_size(const void *hdr, u32 *vendor_boot_img\n bool android_image_get_data(const void *boot_hdr, const void *vendor_boot_hdr,\n \t\t\t    struct andr_image_data *data)\n {\n+\tconst struct andr_boot_img_hdr_v0 *bhdr;\n+\tconst struct andr_vnd_boot_img_hdr *vhdr;\n+\n \tif (!boot_hdr || !data) {\n \t\tprintf(\"boot_hdr or data params can't be NULL\\n\");\n \t\treturn false;\n \t}\n \n-\tif (!is_android_boot_image_header(boot_hdr)) {\n+\tbhdr = map_sysmem((ulong)boot_hdr, sizeof(*bhdr));\n+\tif (!is_android_boot_image_header(bhdr)) {\n \t\tprintf(\"Incorrect boot image header\\n\");\n+\t\tunmap_sysmem(bhdr);\n \t\treturn false;\n \t}\n \n-\tif (((struct andr_boot_img_hdr_v0 *)boot_hdr)->header_version > 2) {\n+\tif (bhdr->header_version > 2) {\n \t\tif (!vendor_boot_hdr) {\n \t\t\tprintf(\"For boot header v3+ vendor boot image has to be provided\\n\");\n+\t\t\tunmap_sysmem(bhdr);\n \t\t\treturn false;\n \t\t}\n-\t\tif (!is_android_vendor_boot_image_header(vendor_boot_hdr)) {\n+\t\tvhdr = map_sysmem((ulong)vendor_boot_hdr, sizeof(*vhdr));\n+\t\tif (!is_android_vendor_boot_image_header(vhdr)) {\n \t\t\tprintf(\"Incorrect vendor boot image header\\n\");\n+\t\t\tunmap_sysmem(vhdr);\n+\t\t\tunmap_sysmem(bhdr);\n \t\t\treturn false;\n \t\t}\n-\t\tandroid_boot_image_v3_v4_parse_hdr(boot_hdr, data);\n-\t\tandroid_vendor_boot_image_v3_v4_parse_hdr(vendor_boot_hdr, data);\n+\t\tandroid_boot_image_v3_v4_parse_hdr((const struct andr_boot_img_hdr_v3 *)bhdr, data);\n+\t\tandroid_vendor_boot_image_v3_v4_parse_hdr(vhdr, data);\n+\t\tunmap_sysmem(vhdr);\n \t} else {\n-\t\tandroid_boot_image_v0_v1_v2_parse_hdr(boot_hdr, data);\n+\t\tandroid_boot_image_v0_v1_v2_parse_hdr(bhdr, data);\n \t}\n \n+\tunmap_sysmem(bhdr);\n \treturn true;\n }\n \n","prefixes":["v4","2/5"]}