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 9B5093A8745 for ; Tue, 17 Mar 2026 10:33:58 +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=1773743639; cv=none; b=jcgg5XlSG0YB1MThnSkJKrg8b39Jpqu9uS7kl4n5tafA+sT4Tbrn+bYSNKg2okIIq36S6BjArWQhyzzsY5rExhQnWgifvC8DTJHfTAoLP2Rg4djvyRIpDvujM+BRVEt9gm2f6vKS1LodH/IlpWoGw9bcLd4x6vN/NP8p335MNs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773743639; c=relaxed/simple; bh=1U5bCnqrA4/aCxWFSX8mysPlUD08c4SxqZ6xt0FXu5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eMxWqnqMe06v64k8sRUUaQPDMH4oBYo50fX2bLdzFNCmaaMw1fVJSa6DRfQ3cgZ+Pzwul/O6olpZ9kN9T0t5rhwAexmfeijOSes9QEMXdwXeduGV9s0LG65O90HSsQx9rThlYYe5cDCDgoYych4RJg7VJcK3uwMcE0Fvlz6LFUs= 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 249C41477; Tue, 17 Mar 2026 03:33:52 -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 564BD3F7BD; Tue, 17 Mar 2026 03:33:56 -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 6/8] firmware: smccc: lfa: Add auto_activate sysfs file Date: Tue, 17 Mar 2026 11:33:32 +0100 Message-ID: <20260317103336.1273582-7-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" The Arm LFA spec places control over the actual activation process in the hands of the non-secure host OS. An platform initiated interrupt or notification signals the availability of an updateable firmware image, but does not necessarily need to trigger it automatically. Add a sysfs control file that guards such automatic activation. If an administrator wants to allow automatic platform initiated updates, they can activate that by echoing a "1" into the auto_activate file in the respective sysfs directory. Any incoming notification would then result in the activation triggered. Signed-off-by: Andre Przywara --- drivers/firmware/smccc/lfa_fw.c | 34 ++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_f= w.c index f20ea45cdbd9..5dc531e462eb 100644 --- a/drivers/firmware/smccc/lfa_fw.c +++ b/drivers/firmware/smccc/lfa_fw.c @@ -101,6 +101,7 @@ enum image_attr_names { LFA_ATTR_FORCE_CPU_RENDEZVOUS, LFA_ATTR_ACTIVATE, LFA_ATTR_CANCEL, + LFA_ATTR_AUTO_ACTIVATE, LFA_ATTR_NR_IMAGES }; =20 @@ -115,6 +116,7 @@ struct fw_image { bool may_reset_cpu; bool cpu_rendezvous; bool cpu_rendezvous_forced; + bool auto_activate; struct kobj_attribute image_attrs[LFA_ATTR_NR_IMAGES]; }; =20 @@ -561,6 +563,28 @@ static ssize_t cancel_store(struct kobject *kobj, stru= ct kobj_attribute *attr, return count; } =20 +static ssize_t auto_activate_store(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t count) +{ + struct fw_image *image =3D kobj_to_fw_image(kobj); + int ret; + + ret =3D kstrtobool(buf, &image->auto_activate); + if (ret) + return ret; + + return count; +} + +static ssize_t auto_activate_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct fw_image *image =3D kobj_to_fw_image(kobj); + + return sysfs_emit(buf, "%d\n", image->auto_activate); +} + static struct kobj_attribute image_attrs_group[LFA_ATTR_NR_IMAGES] =3D { [LFA_ATTR_NAME] =3D __ATTR_RO(name), [LFA_ATTR_CURRENT_VERSION] =3D __ATTR_RO(current_version), @@ -571,7 +595,8 @@ static struct kobj_attribute image_attrs_group[LFA_ATTR= _NR_IMAGES] =3D { [LFA_ATTR_CPU_RENDEZVOUS] =3D __ATTR_RO(cpu_rendezvous), [LFA_ATTR_FORCE_CPU_RENDEZVOUS] =3D __ATTR_RW(force_cpu_rendezvous), [LFA_ATTR_ACTIVATE] =3D __ATTR_WO(activate), - [LFA_ATTR_CANCEL] =3D __ATTR_WO(cancel) + [LFA_ATTR_CANCEL] =3D __ATTR_WO(cancel), + [LFA_ATTR_AUTO_ACTIVATE] =3D __ATTR_RW(auto_activate), }; =20 static void init_image_default_attrs(void) @@ -640,6 +665,7 @@ static int update_fw_image_node(char *fw_uuid, int seq_= id, image->kobj.kset =3D lfa_kset; image->image_name =3D image_name; image->cpu_rendezvous_forced =3D true; + image->auto_activate =3D false; set_image_flags(image, seq_id, image_flags, reg_current_ver, reg_pending_ver); if (kobject_init_and_add(&image->kobj, &image_ktype, NULL, @@ -709,7 +735,8 @@ static int update_fw_images_tree(void) =20 /* * Go through all FW images in a loop and trigger activation - * of all activatible and pending images. + * of all activatible and pending images, but only if automatic + * activation for that image is allowed. * We have to restart enumeration after every triggered activation, * since the firmware images might have changed during the activation. */ @@ -728,7 +755,8 @@ static int activate_pending_image(void) continue; /* Invalid FW component */ =20 update_fw_image_pending(image); - if (image->activation_capable && image->activation_pending) { + if (image->activation_capable && image->activation_pending && + image->auto_activate) { found_pending =3D true; break; } --=20 2.43.0