From nobody Tue Apr 7 00:43:03 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 403303A6EEC for ; Tue, 17 Mar 2026 10:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773743633; cv=none; b=Jof/HQ/ymXY5s5eaQUJWhy1K5X0eM9MrqAN9oyD93o0as5TBeLgFiHtZwoMhgmVwyrR4L62ceRBS0e3wRKR0G5JrZMKe2f5KY5k1L/FncEr20/DtqjvxfZjBQyY9FUpVBckg9lyA0nJvIJCxFXxsC6mqpuUu6FJOOOCKBlGzYNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773743633; c=relaxed/simple; bh=mG+ZMV319adDJ9hbp99R8nbF5ZEu+HaazzxdZTOg7VE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rRByRjF+QpkoZTNVFuJCWnC1BXKhQMJvw0crEo1v5aaJiHJe98i054InCHwqsbrKufHlCZ+zdduwOW5uJe8gFxRYXtcXBmkIP66/DpNZxwEE6KofX15n1qpCiBPEN58nrqss581Q1Jrf4qIuDMYHz2M1YRUhftjeAtIlDX/yhtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90EF31476; Tue, 17 Mar 2026 03:33:45 -0700 (PDT) Received: from e142021.fritz.box (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C60593F7BD; Tue, 17 Mar 2026 03:33:49 -0700 (PDT) From: Andre Przywara To: Mark Rutland , Lorenzo Pieralisi , Sudeep Holla Cc: Salman Nabi , Vedashree Vidwans , Trilok Soni , Nirmoy Das , vsethi@nvidia.com, vwadekar@nvidia.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/8] firmware: smccc: lfa: Move image rescanning Date: Tue, 17 Mar 2026 11:33:29 +0100 Message-ID: <20260317103336.1273582-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260317103336.1273582-1-andre.przywara@arm.com> References: <20260317103336.1273582-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vedashree Vidwans After an image activation, the list of firmware images might change, so we have to re-iterate them through the SMC interface. Move the corresponding code from the activate_fw_image() function into update_fw_images_tree(), where it could be reused more easily, for instance when triggered by an interrupt. Signed-off-by: Vedashree Vidwans [Andre: split off from another patch, rebased] Signed-off-by: Andre Przywara --- drivers/firmware/smccc/lfa_fw.c | 46 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_f= w.c index 284b7c18d3d0..4831abf2b60e 100644 --- a/drivers/firmware/smccc/lfa_fw.c +++ b/drivers/firmware/smccc/lfa_fw.c @@ -310,7 +310,6 @@ static int call_lfa_activate(void *data) =20 static int activate_fw_image(struct fw_image *image) { - struct kobject *kobj; int ret; =20 retry: @@ -320,31 +319,8 @@ static int activate_fw_image(struct fw_image *image) ret =3D call_lfa_activate(image); =20 if (!ret) { - /* - * Invalidate fw_seq_ids (-1) for all images as the seq_ids - * and the number of firmware images in the LFA agent may - * change after a successful activation attempt. - * Negate all image flags as well. - */ - spin_lock(&lfa_kset->list_lock); - list_for_each_entry(kobj, &lfa_kset->list, entry) { - struct fw_image *image =3D kobj_to_fw_image(kobj); - - set_image_flags(image, -1, 0b1000, 0, 0); - } - spin_unlock(&lfa_kset->list_lock); - update_fw_images_tree(); =20 - /* - * Removing non-valid image directories at the end of an - * activation. - * We can't remove the sysfs attributes while in the respective - * _store() handler, so have to postpone the list removal to a - * workqueue. - */ - queue_work(fw_images_update_wq, &fw_images_update_work); - return 0; } =20 @@ -640,6 +616,7 @@ static int update_fw_images_tree(void) { struct arm_smccc_1_2_regs reg =3D { 0 }, res; struct uuid_regs image_uuid; + struct kobject *kobj; char image_id_str[40]; int ret, num_of_components; =20 @@ -649,6 +626,19 @@ static int update_fw_images_tree(void) return -ENODEV; } =20 + /* + * Invalidate fw_seq_ids (-1) for all images as the seq_ids and the + * number of firmware images in the LFA agent may change after a + * successful activation attempt. Negate all image flags as well. + */ + spin_lock(&lfa_kset->list_lock); + list_for_each_entry(kobj, &lfa_kset->list, entry) { + struct fw_image *image =3D kobj_to_fw_image(kobj); + + set_image_flags(image, -1, 0b1000, 0, 0); + } + spin_unlock(&lfa_kset->list_lock); + reg.a0 =3D LFA_1_0_FN_GET_INVENTORY; for (int i =3D 0; i < num_of_components; i++) { reg.a1 =3D i; /* fw_seq_id to be queried */ @@ -666,6 +656,14 @@ static int update_fw_images_tree(void) } } =20 + /* + * Removing non-valid image directories at the end of an activation. + * We can't remove the sysfs attributes while in the respective + * _store() handler, so have to postpone the list removal to a + * workqueue. + */ + queue_work(fw_images_update_wq, &fw_images_update_work); + return 0; } =20 --=20 2.43.0