From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id wMOsH16aZGeARwAAqHPOHw:P1 (envelope-from ) for ; Thu, 19 Dec 2024 22:12:46 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id wMOsH16aZGeARwAAqHPOHw (envelope-from ) for ; Thu, 19 Dec 2024 23:12:46 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=B4Bi+yjM; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=JozMWzfv; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734646366; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=L68rz6CPRym1MXeQo+0wQrYP6+EEAK+qGXwVHupYwrs=; b=MbCc+K2ZlhU6UpLET8MzGDOPmJYGf2mWKlNdv9Pb+ittqvjx1lAj/fx76zIZAqAv44Wqyt XoyINN5J7NxH8jTNSBD7L6JCshcAx43Efv1AnBBWCjfM++S7Yyiy+sYuJfhCfDPD7gbTf0 3VWsJMyFCk/+ydo70Avh5ltF6b6b9XtOlveeqYESee0YkNpvm1eQOtO/CN7yYXyoPaYftd lEowsCUlMLkMOXoZfoB2AYn9t8swLGoOc4It26lLYEIneBvKbnosUA3kkr5vfqDbmH3qWy eMJRrGHcpKikO9n9Uz7VERW5OgsN23Mzxeqwkk73flY2adwhlUId0TDkURtZ8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=B4Bi+yjM; dkim=fail ("headers rsa verify failed") header.d=rimm.ee header.s=herman header.b=JozMWzfv; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734646366; a=rsa-sha256; cv=none; b=KToqohANbmx0nOeUFPsEwq9NM3jz7lX7AstyRyXy1Ie40Ln66Rfxhw2w/VTOQQXXK34AWR rc/wbhMMqcYCnCsrz65ElvxSz9LOuH31fa7O+dLPT55LshdzpBozgmO1KvdTdL6wDoRmoR xoE+YOTvGHOMwMfJIlBqF+qsnR8QWcaABLMzeP/h2lQlsdIDwfv8V/odbrgqyRqXpVlSn8 KJPXgepvcAm44B9maqxSUPzxIFW3lv9gdePQVExChzP+lfE4NlfO+Oo7JAbIF+Hi2gemqN t4ZjF+vA/2QSaBvjbyFEBKhRaHLq3lJw8n3g60n8KeJ3um9qnxkxdqYKPo0ilQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1A87C7FB9F for ; Thu, 19 Dec 2024 23:12:46 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOOkh-00033c-Ov; Thu, 19 Dec 2024 17:12:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOOkX-00032G-Sz for guix-patches@gnu.org; Thu, 19 Dec 2024 17:12:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOOkX-0007qh-Hl for guix-patches@gnu.org; Thu, 19 Dec 2024 17:12:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=L68rz6CPRym1MXeQo+0wQrYP6+EEAK+qGXwVHupYwrs=; b=B4Bi+yjMl4V4SvZi3FeiSqHRTfcvpOJYxpfm1B2EBLQXacpK8OY0P23gCvfblxNjip/JuxmbdqmZf5WkfXc12S1FdmtCIyIOSz2xDusZ2exxyohnKe2mc+UqOwOmC9V6tQ/lLtPuo5SBrZko9swfriqgTNjb/ocRcWPkb0IPstE+9YR6Uta5TTcXUF7U3/RabJAWMZa2tseGd9pMCNZ556EnHQ0zZyeKm4EaMw+TbA1RCerKqxPto5i9USD9hSm7jv3vpgKtdpswTBKsjMI2pFMHwA76a7X/A378m+wDgpdxDAVXQnbYQ9Te6/40kRcjOnNZN/UtY0HmYAFKD68jlw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOOkX-0007u1-6Y; Thu, 19 Dec 2024 17:12:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74849] [PATCH v2 6/6] gnu: arm-trusted-firmware-imx8mq: Fix build. Resent-From: Herman Rimm Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 19 Dec 2024 22:12:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74849 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74849@debbugs.gnu.org Cc: Efraim Flashner , Vagrant Cascadian X-Debbugs-Original-Xcc: Efraim Flashner , Vagrant Cascadian Received: via spool by 74849-submit@debbugs.gnu.org id=B74849.173464630930283 (code B ref 74849); Thu, 19 Dec 2024 22:12:05 +0000 Received: (at 74849) by debbugs.gnu.org; 19 Dec 2024 22:11:49 +0000 Received: from localhost ([127.0.0.1]:40447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOOkG-0007sH-MM for submit@debbugs.gnu.org; Thu, 19 Dec 2024 17:11:49 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:38239 helo=email.rimm.ee) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOOkA-0007qq-6t for 74849@debbugs.gnu.org; Thu, 19 Dec 2024 17:11:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1734646286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L68rz6CPRym1MXeQo+0wQrYP6+EEAK+qGXwVHupYwrs=; b=JozMWzfvecoUlIskO/V5FtSPMPs35oTKR43hshfvYK0S3Lyq/41n8EWJU2uoWX51EnJk19 636bBXwCSrhHsBFadK6HjpKTW2uPrkj9GJDQ6H5dJ1JvFvPXw0Tf7m7iM1PnL1w0vpwupW I+ccvqx6AVZVheTPmCyKBLKr2/AX/jCdp9Q0Ib3q7xcJZcCoehFho3/vKMjHy+dMN5lfOL HWpAFc/ExeYQ9sMicNzZGEGg52zg6jfJQlublX/kuVMUkh0EK4jlnkcZAbalzSpf3w2SvE nlgY42kyniiTWBkoajBMvEW6CsBYekaxEiir0HtOHJQYh8QemKUpibAMzmZb/A== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 5505c856 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <74849@debbugs.gnu.org>; Thu, 19 Dec 2024 22:11:26 +0000 (UTC) Date: Thu, 19 Dec 2024 23:10:35 +0100 Message-ID: <467ea8c43a9f99b9202ae603c378d31106851f0b.1734645720.git.herman@rimm.ee> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Herman Rimm X-ACL-Warn: , Herman Rimm via Guix-patches From: Herman Rimm via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 0.76 X-Spam-Score: 0.76 X-Migadu-Queue-Id: 1A87C7FB9F X-TUID: X+y4LAe7pHCt * gnu/local.mk (dist_patch_DATA): Register patches. * gnu/packages/firmware.scm (make-arm-trusted-firmware): Add make-flags argument. [source]: Use patches. (arm-trusted-firmware-imx8mq): Refactor. * gnu/packages/patches/8mq-enable-imx_hab_handler.patch: Add file. * gnu/packages/patches/8mq-move-stack-to-ocram_s.patch: Add file. Change-Id: I8a72c1ceb5e00e113ae91a7c2f5b733d981185d6 --- gnu/local.mk | 2 + gnu/packages/firmware.scm | 35 ++------ .../patches/8mq-enable-imx_hab_handler.patch | 36 ++++++++ .../patches/8mq-move-stack-to-ocram_s.patch | 88 +++++++++++++++++++ 4 files changed, 134 insertions(+), 27 deletions(-) create mode 100644 gnu/packages/patches/8mq-enable-imx_hab_handler.patch create mode 100644 gnu/packages/patches/8mq-move-stack-to-ocram_s.patch diff --git a/gnu/local.mk b/gnu/local.mk index fbe9dfbb0e..8155a5ae34 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -934,6 +934,8 @@ MODULES_NOT_COMPILED += \ patchdir = $(guilemoduledir)/%D%/packages/patches dist_patch_DATA = \ + %D%/packages/patches/8mq-enable-imx_hab_handler.patch \ + %D%/packages/patches/8mq-move-stack-to-ocram_s.patch \ %D%/packages/patches/abcl-fix-build-xml.patch \ %D%/packages/patches/ableton-link-system-libraries-debian.patch \ %D%/packages/patches/abiword-explictly-cast-bools.patch \ diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 81ebd5efd8..6f6a406c8b 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -1099,8 +1099,9 @@ (define-public ovmf-riscv64 (define-public ovmf (deprecated-package "ovmf" ovmf-x86-64)) -(define* (make-arm-trusted-firmware platform - #:key (triplet "aarch64-linux-gnu")) +(define* (make-arm-trusted-firmware platform #:key + (triplet "aarch64-linux-gnu") + (make-flags '("DEBUG=1"))) (define (native-build?) "Return #t if the host and target platforms differ." (or (not triplet) @@ -1119,6 +1120,8 @@ (define* (make-arm-trusted-firmware platform (file-name (git-file-name "arm-trusted-firmware" version)) (sha256 (base32 "18rzhygvq0afcylirq9yis3kaa1nli14k2jrm64ih85gz4nhl99w")) + (patches (search-patches "8mq-enable-imx_hab_handler.patch" + "8mq-move-stack-to-ocram_s.patch")) (modules '((guix build utils))) ;; Remove binary blobs: they don't reference a source or license. (snippet #~(for-each delete-file (find-files "." "\\.bin$"))))) @@ -1147,7 +1150,7 @@ (define* (make-arm-trusted-firmware platform #$@(if (not (native-build?)) (list (string-append "CROSS_COMPILE=" triplet "-")) '("CC=gcc")) - "DEBUG=1") + #$@make-flags) #:tests? #f)) ;no test suite (native-inputs (list python)) (home-page "https://www.trustedfirmware.org/") @@ -1182,30 +1185,8 @@ (define-public arm-trusted-firmware-rk3399 (cross-binutils "arm-none-eabi"))))))) (define-public arm-trusted-firmware-imx8mq - (let ((base (make-arm-trusted-firmware "imx8mq"))) - (package - (inherit base) - ;; Newer versions do not build and are essentially not supported - ;; upstream. - ;; XXX: explore using NXP maintained branch - ;; https://github.com/nxp-imx/imx-atf - (version "2.8") - (source - (origin - (method git-fetch) - (uri (git-reference - ;; There are only GitHub generated release snapshots. - (url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/") - (commit (string-append "v" version)))) - (file-name (git-file-name "arm-trusted-firmware" version)) - (sha256 - (base32 - "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3")))) - (arguments - (substitute-keyword-arguments (package-arguments base) - ((#:make-flags flags ''()) - ;; Adding debug symbols causes the size to exceed limits. - #~(delete "DEBUG=1" #$flags))))))) + ;; Remove debug symbols because of limited OCRAM. + (make-arm-trusted-firmware "imx8mq" #:make-flags '())) (define make-crust-firmware (mlambda (platform) diff --git a/gnu/packages/patches/8mq-enable-imx_hab_handler.patch b/gnu/packages/patches/8mq-enable-imx_hab_handler.patch new file mode 100644 index 0000000000..0ead773e4e --- /dev/null +++ b/gnu/packages/patches/8mq-enable-imx_hab_handler.patch @@ -0,0 +1,36 @@ +From: Herman Rimm +Date: Sun, 8 Dec 2024 01:13:59 +0100 +Subject: [PATCH] fix(imx8m): 8mq: enable imx_hab_handler + +This completes af799814e2639a03b3453744f06a73e77cb66e86. + +Signed-off-by: Herman Rimm +--- +To submit to review.trustedfirmware.org, sign in with a GitHub account. + +diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h +index 404a82959..1948bc2eb 100644 +--- a/plat/imx/common/include/imx_sip_svc.h ++++ b/plat/imx/common/include/imx_sip_svc.h +@@ -88,7 +88,8 @@ int imx_src_handler(uint32_t smc_fid, u_register_t x1, + u_register_t x2, u_register_t x3, void *handle); + #endif + +-#if defined(PLAT_imx8mm) || defined(PLAT_imx8mn) || defined(PLAT_imx8mp) ++#if defined(PLAT_imx8mm) || defined(PLAT_imx8mn) || defined(PLAT_imx8mp) || \ ++ defined(PLAT_imx8mq) + int imx_hab_handler(uint32_t smc_fid, u_register_t x1, + u_register_t x2, u_register_t x3, u_register_t x4); + #endif +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index 73179dd0c..b1b954f1d 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -30,6 +30,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \ + plat/imx/imx8m/imx8mq/imx8mq_psci.c \ + plat/imx/imx8m/gpc_common.c \ + plat/imx/imx8m/imx_aipstz.c \ ++ plat/imx/imx8m/imx_hab.c \ + plat/imx/imx8m/imx8m_caam.c \ + plat/imx/imx8m/imx8m_ccm.c \ + plat/imx/imx8m/imx8m_psci_common.c \ diff --git a/gnu/packages/patches/8mq-move-stack-to-ocram_s.patch b/gnu/packages/patches/8mq-move-stack-to-ocram_s.patch new file mode 100644 index 0000000000..1174881181 --- /dev/null +++ b/gnu/packages/patches/8mq-move-stack-to-ocram_s.patch @@ -0,0 +1,88 @@ +From: Jacky Bai +Date: Tue, 7 Jan 2020 15:48:36 +0800 +Subject: [PATCH] plat: imx8mq: move the stack & xlat table into ocram_s + +Move the stack & xlat table into ocram_s due to the +ocram is not enough. + +Signed-off-by: Jacky Bai +Change-Id: I40a8e6c91f707598a38e420ff9f4be0c0a5dbf6c +--- +Commit ae90cc5773abf5656e0e49f2ce746aa54f712b7b of: +https://github.com/nxp-imx/imx-atf.git + +diff --git a/bl31/bl31.ld.S b/bl31/bl31.ld.S +index 867dedb99..8be52bc7c 100644 +--- a/bl31/bl31.ld.S ++++ b/bl31/bl31.ld.S +@@ -25,6 +25,10 @@ MEMORY { + #else /* SEPARATE_RWDATA_REGION */ + #define RAM_RW RAM + #endif /* SEPARATE_RWDATA_REGION */ ++ ++#if XLAT_TABLE_IN_OCRAM_S ++ RAM_S (rwx): ORIGIN = 0x180000, LENGTH = 0x8000 ++#endif + } + + #ifdef PLAT_EXTRA_LD_SCRIPT +@@ -198,9 +202,13 @@ SECTIONS { + __NOBITS_START__ = .; + #endif /* SEPARATE_NOBITS_REGION */ + ++#if !STACK_IN_OCRAM_S + STACK_SECTION >NOBITS ++#endif + BSS_SECTION >NOBITS ++#if !XLAT_TABLE_IN_OCRAM_S + XLAT_TABLE_SECTION >NOBITS ++#endif + + #if USE_COHERENT_MEM + /* +@@ -253,4 +261,15 @@ SECTIONS { + /DISCARD/ : { + *(.dynsym .dynstr .hash .gnu.hash) + } ++ ++#if XLAT_TABLE_IN_OCRAM_S ++ . = 0x180000; ++ XLAT_TABLE_SECTION >RAM_S ++ ++#if STACK_IN_OCRAM_S ++ STACK_SECTION >RAM_S ++#endif ++ ++ASSERT(. <= OCRAM_S_LIMIT, "OCRAM_S limit has been exceeded.") ++#endif + } +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 70c2def7d..ddff0925c 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -48,6 +48,7 @@ static uint8_t mmio_read_8_ldrb(uintptr_t address) + static const mmap_region_t imx_mmap[] = { + MAP_REGION_FLAT(GPV_BASE, GPV_SIZE, MT_DEVICE | MT_RW), /* GPV map */ + MAP_REGION_FLAT(IMX_ROM_BASE, IMX_ROM_SIZE, MT_MEMORY | MT_RO), /* ROM map */ ++ MAP_REGION_FLAT(OCRAM_S_BASE, OCRAM_S_SIZE, MT_MEMORY | MT_RW), /* ROM map */ + MAP_REGION_FLAT(IMX_AIPS_BASE, IMX_AIPS_SIZE, MT_DEVICE | MT_RW), /* AIPS map */ + MAP_REGION_FLAT(IMX_GIC_BASE, IMX_GIC_SIZE, MT_DEVICE | MT_RW), /* GIC map */ + MAP_REGION_FLAT(IMX_DDRPHY_BASE, IMX_DDR_IPS_SIZE, MT_DEVICE | MT_RW), /* DDRMIX map */ +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index 73179dd0c..20a73d691 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -45,7 +45,12 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \ + ${XLAT_TABLES_LIB_SRCS} \ + ${IMX_GIC_SOURCES} + +-ENABLE_PIE := 1 ++XLAT_TABLE_IN_OCRAM_S := 1 ++STACK_IN_OCRAM_S := 1 ++ ++$(eval $(call add_define,XLAT_TABLE_IN_OCRAM_S)) ++$(eval $(call add_define,STACK_IN_OCRAM_S)) ++ + USE_COHERENT_MEM := 1 + RESET_TO_BL31 := 1 + A53_DISABLE_NON_TEMPORAL_HINT := 0 -- 2.45.2