From patchwork Fri Apr 11 15:03:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 880166 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp811591wrq; Fri, 11 Apr 2025 08:03:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXdNwejQVyXXB2ZsL3eL1u3MgypEuGIgMkEC7x6+Sy+bXZ6J3BlURM5RkSvW/iAKSUH2hL32A==@linaro.org X-Google-Smtp-Source: AGHT+IGhiNAmF1RCyhpSkY/NV4WnGCuUI720BfnO4tgObqw4oLcD/a8X/L74TbaP8x+iBPksXRU3 X-Received: by 2002:a05:6102:c4a:b0:4b6:d108:cac1 with SMTP id ada2fe7eead31-4c9e4eec888mr2206770137.9.1744383826373; Fri, 11 Apr 2025 08:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744383826; cv=none; d=google.com; s=arc-20240605; b=H+TNx6dYdwHvwOc0op96GFQ2vmynvT6c15OA9ZxgvayKMDrrxgehA7jiqKItK4eWyN QA+5H8tGJiyGXCdRgz5PHjBs4xqINd1ttZk835aMlzjo5DEeR6FdGqHGMfR0JahUjkA2 W0ersiCTTTR8xTCWNsswp9TQVXeUIxwdVisx6utGCt/6VRIj4Fd0/ULKggc0Y48XyDmA +5cJhNECqMe0B59SaCeUqkHXTviaW661FEVyL/uC1AieWQ6gcX5ixvDAW5LQYT8gdBJH IZ5orUyRn922Ye6RxCqTjmaDcwUwFGchsipGSzJBTfoZj+7EL2lSU3AGZmG3LHtHAeVH YWLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:content-transfer-encoding :mime-version:message-id:date:subject:from:dkim-signature; bh=bo4WFpYmlvS4V+xunHdmQ9QU9WR2rtXFyZkvEqHMmZ8=; fh=G8Bjta7OuL+bFRRB13meU67ZDQCKHgitHZMfV9AhwSQ=; b=aOzhgcvbXU2eNhBril1WvPxmJiMNWy8gIpymfCZn2PLoo12gC3BRojtNff4VnXbRQb mWj0YJyExPvV5LsmmZxMID0U686bC+mwrlbKz8MjSrbvbGdyQ02G4uWOD8HybGcYjHUl xjDvjnfsCW61+2WAS1SOR8yfh7YoXPcY7YzQ1r+zed1fKWit67s8fN1rL7S7bQQEEIjy Oaqt7Trqg9soe/nSv0JJ5FS07uIZzmed0Fl5WuUrdCIoQbcF7cvzFfcdz8jQKCxc9llL /vqiMDM607HIsUBKEWjIXIYtkor8wEfHBHe0f4NQfbuhvZl7m0RCIkBhLLgUTE3INTHY CghA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lhvMdh4l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c98fcb47si2393442137.572.2025.04.11.08.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:03:46 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lhvMdh4l; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1452084144; Fri, 11 Apr 2025 17:03:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lhvMdh4l"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD43984148; Fri, 11 Apr 2025 17:03:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74C1284107 for ; Fri, 11 Apr 2025 17:03:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-39c266c2dd5so1729916f8f.3 for ; Fri, 11 Apr 2025 08:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744383820; x=1744988620; darn=lists.denx.de; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=bo4WFpYmlvS4V+xunHdmQ9QU9WR2rtXFyZkvEqHMmZ8=; b=lhvMdh4lk2FHxQ8/O/lnsG5plwPjIL58VfTrAGRIUJc+7hO8SXeGY2pAj8ahRGewU0 b8IEto1hcrOdaKgpm1R7pBQ1eF3vpbwTz9Jyg0ltLJjNUaevjQo8nhpHLgnrZp7+4YJj nlawSfrj4Th2WY3u7mqTxnPw5NbxJom7+W/wKhszn03e23TFNQaIMrl0Ew1BPnzzjElh NyjvVMdRsyj4nBsysBAusGBff31JacXf8etuKo0+vb3ZAJ2QN47O2wjBsIWAZoRRKC6H wmUSOJ/zde4veULLPBqxqq/mW1FR0ELxKsZfGmSzBa2oW3uTSIKmLmc36Z/NKOjR0z3q ToRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744383820; x=1744988620; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bo4WFpYmlvS4V+xunHdmQ9QU9WR2rtXFyZkvEqHMmZ8=; b=cLseX4Ixtx7h6ggpNo2Hxk52Tgkg/4VldgS8Q+9DZhxpq9uCOHnKNSB2Ot5TN90JvW fJwt6rk3LgTKq8eGsr3toDsyevUj6dnVp+6qKi2NYvSF4Mnt/OhbkcRq5BRxhy2CkeS6 RZx/JOrCwQmgPfu1JrPNUOr7Ht7CbLj4DO3HdHemTbsrlS18GxHxsdMlbrlJlNe/bBfc ZDIwssPJhrx07LA3TogoqCeqQXbPmfghkE5IVZciRSBrguPa47bIHJb6xpj8Mo6buwCj 01NLQc2r6kfDQt/cxpG+KGDAUtvQs/utFnUlpRqKehxLV7oAQPw3pML6oO/zy4DMukhu WNWQ== X-Gm-Message-State: AOJu0Yx1p8yQYEIvpRX492AP/IYcYxWRu4YQNtYsogPtv3c2QHS+P16A 7ocaUnmNHjRnlkX6TPTN5fJyH6z2BysqWvJ2MrP25kHzjjsLsTfjlVv3hzUZfPlTCGW/quTCsiR UH24= X-Gm-Gg: ASbGncueTVd34F8IDnjMMXmoTWuK4xsRralLtwDSWhXaQl/ESpe65gnXruLP9D5YZJd diTOKuPFomUXOM8RB/A4wnWQPdg6R5pTK/75T3HQMl/xqoCXxAVBI1arg06Js5tCq4XYQIG7G72 vYKQIXLRw4Z1zfPbqaldnnTF7+ZeDqGQ0nuXHZU2oOinvtaaVxbkYzacTYJKg0rHrSf0PfB/l++ xlSGn47Bxw5jGaaQD/djTio2ZOYLcJCLvlVQs5nfbhMtXtaogyTI2KliZmioy3HL6sQLbnIfxjl 9ZOVRWoc+U5ooMAoBzjt2X9HFqd5JFpvusQ7hLZFprU78hC0eCtPRmwCJaWzKdvCKD9Es4Uhb0H ETInyr1HrL5hlt59WKw== X-Received: by 2002:a05:6000:4285:b0:39c:1efb:ee8a with SMTP id ffacd0b85a97d-39eaaebdecfmr2616617f8f.38.1744383819557; Fri, 11 Apr 2025 08:03:39 -0700 (PDT) Received: from toyger.tail248178.ts.net (35-60-142-46.pool.kielnet.net. [46.142.60.35]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39eaf445270sm2201005f8f.81.2025.04.11.08.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:03:38 -0700 (PDT) From: Caleb Connolly Subject: [PATCH v2 0/4] Qualcomm: expand capsule update support Date: Fri, 11 Apr 2025 17:03:33 +0200 Message-Id: <20250411-b4-qcom-capsule-update-improvements-v2-0-27f6b2fcc4a9@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAEUv+WcC/5WNQQ6DIBBFr9Kw7jSCFdOueo/GBcKgJAp0UNLGe PdSb9Dl+/l5b2MJyWFi99PGCLNLLvgC4nxielR+QHCmMBOVaKpaSOiv8NJhBq1iWieENRq1lNc cKWSc0S8JuLS27bUw3AhWTJHQuvdReXaFR5eWQJ8jmvlv/c+fOVSgLAqs5U3KtnlMzisKl0AD6 /Z9/wISKMhH1wAAAA== X-Change-ID: 20250326-b4-qcom-capsule-update-improvements-16ff7bc2d1d2 To: Lukasz Majewski , Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Mattijs Korpershoek Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io, Ilias Apalodimas X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2510; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=jzym53EOTdW5ol47c2dfDkyQ+qA3CMyzvsIBAoDyXoM=; b=owEBbQKS/ZANAwAKAQWDMSsZX2S2AcsmYgBn+S9Jh4jj5b9DFE+TSx6Agq7gg52p1/+dx4p0G xgezc0w1pGJAjMEAAEKAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZ/kvSQAKCRAFgzErGV9k toteD/47R5bzgiV/hli+TgYIZNWN3jU3OGikTbUc1lbAO0W2FbzQDD92putOabKhtU2HzEGu9w/ WfoSoMUfeNsNmM23l6TfUR+X8NMyeSm74/n7B0gyr0DTEeibJyVFaMQ7wS55/ebbCPbFwwc7eX9 IL/g9TEtMDjfthyi0GeCnV4il+GQKFjDaLPec9Hz/68R/mvteLz457y61vyxn1KuaHx0UXS9FVS ow3zEE4ppRS8ZKfDRDCnYPhSt6dYq8jtWUCRrTRKR/vvwVCBwN2LJLIw6JP3dv0dfimNlyk+tG1 K6GZm4SPBDdruePDjtZ31upH+91m7qoixWfcN7nISGEtc5pylgjUAk9PtWq5DBRzPTSQ3M/hbiK aWlbcH78nwrPA8M97dVyhNR6y5y2IFBhwnCLUCmm2h0joLBqs77kKANspdGBWuh3e9PyUbteY2U t1GtfunoQHqGh0tZyZWl5CLFHNwyngabbKzhFlJpbMZcUCzIL82c5+lAyk9U2GSFJ0to0VQFg1W rfwhXZP4edt4E6T+TtZnFJLhCrAuRAg1PCAmVmRONbvXrsUbj0J04PlEfxOTKSFmABhNIUBt9Be LgSSksZfVXSmoCAxmR1F/BgsVCgkB07R34vgfLlktVK5/wuLrDT1Q3YxkhndmM2TrjzJ2ATDw3N a8s4tov/FjsNpyw== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The initial capsule update support only worked on the RB3 Gen 2 and made a lot of assumptions specific to that board. Implement the logic necessary to update U-Boot no matter where it was flashed to, independent of any particular board. First, we keep track of how U-Boot was loaded, specifically if we had a valid external FDT (even if we didn't use it) this indicates that we were booted via the Android bootloader, in this case the target for capsule updates is the boot partition. Otherwise, we target the uefi partition (if it exists) or the xbl partition. We handle A/B support for all 3 (currently we always flash to the currently active partition with a minor exception for the uefi partition). We introduce two new fw_name strings to differentiate the GUIDs based on the target partition, this means one board can support multiple boot methods with capsule update support for all of them (typically this would be chainloading OR flashing U-Boot to XBL). Lastly, the call to scsi_scan() in dfu_scsi.c is removed. Since scsi_scan() unbinds all scsi devices it breaks device handles maintained in the EFI layer for the duration of the capsule update process and causes the EFI filesystem access to delete the capsule file after the update to fail. Boards should instead be responsible for calling scsi_scan() before initiating DFU. --- Changes in v2: - Restrict the partition hunt to either UFS storage or the first MMC device so that we never accidentally write to some external storage (like an sdcard) during a capsule update. - Fix typo - Link to v1: https://lore.kernel.org/r/20250326-b4-qcom-capsule-update-improvements-v1-0-afe2e3696675@linaro.org --- Caleb Connolly (4): mach-snapdragon: track boot source mach-snapdragon: CapsuleUpdate: support all boot methods dfu: scsi: don't call scsi_scan() qcom_defconfig: enable capsule update support arch/arm/mach-snapdragon/board.c | 26 +++ arch/arm/mach-snapdragon/capsule_update.c | 274 ++++++++++++++++++++++++------ arch/arm/mach-snapdragon/qcom-priv.h | 14 ++ configs/qcm6490_defconfig | 6 - configs/qcom_defconfig | 3 + drivers/dfu/dfu_scsi.c | 5 - 6 files changed, 266 insertions(+), 62 deletions(-) --- base-commit: 885d68280c29b8011731b6a7cdac32b8d9a4e6fd change-id: 20250326-b4-qcom-capsule-update-improvements-16ff7bc2d1d2 Caleb Connolly