Skip to content

Commit 772ce13

Browse files
committed
NVIDIA: VR: SAUCE: firmware: smccc: lfa: Emit a uevent on inventory updates
Firmware image directories are plain kobjects under /sys/firmware. udev coldplug does not enumerate them as devices, so rules matching the per-image LFA kobjects do not run reliably at boot. LFA already creates the arm-lfa faux device. Emit KOBJ_CHANGE from that device after the firmware image tree is refreshed, so user space can use the existing driver-core device as the notification anchor for runtime inventory updates. The same udev rule then also covers coldplug via the device add event, e.g.: ACTION=="add|change", SUBSYSTEM=="faux", KERNEL=="arm-lfa", \ RUN+="/usr/local/sbin/lfa-auto-activate" Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
1 parent 01cd0f8 commit 772ce13

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/firmware/smccc/lfa_fw.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ static const struct fw_image_uuid {
154154
};
155155

156156
static struct kset *lfa_kset;
157+
static struct faux_device *lfa_dev;
157158
static struct workqueue_struct *fw_images_update_wq;
158159
static struct work_struct fw_images_update_work;
159160
static struct attribute *image_default_attrs[LFA_ATTR_NR_IMAGES + 1];
@@ -241,6 +242,21 @@ static void remove_invalid_fw_images(struct work_struct *work)
241242

242243
delete_fw_image_node(image);
243244
}
245+
246+
/*
247+
* Notify user space only after the firmware image tree has been
248+
* fully reconciled, so that consumers reading /sys/firmware/lfa/
249+
* see a settled inventory. Anchor the event on the arm-lfa faux
250+
* device because the per-image kobjects under /sys/firmware/ are
251+
* not enumerated by udev coldplug.
252+
*/
253+
if (lfa_dev) {
254+
int ret = kobject_uevent(&lfa_dev->dev.kobj, KOBJ_CHANGE);
255+
256+
if (ret)
257+
pr_warn("failed to send firmware inventory change uevent: %d\n",
258+
ret);
259+
}
244260
}
245261

246262
static void set_image_flags(struct fw_image *image, int seq_id,
@@ -967,7 +983,6 @@ static void lfa_faux_remove(struct faux_device *fdev)
967983
lfa_remove_acpi(&fdev->dev);
968984
}
969985

970-
static struct faux_device *lfa_dev;
971986
static struct faux_device_ops lfa_device_ops = {
972987
.probe = lfa_faux_probe,
973988
.remove = lfa_faux_remove,

0 commit comments

Comments
 (0)