From: Cristian Marussi <cristian.marussi@arm.com> To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, dan.carpenter@oracle.com, cristian.marussi@arm.com Subject: [PATCH v11 0/9] SCMI Notifications Core Support Date: Wed, 1 Jul 2020 16:53:39 +0100 [thread overview] Message-ID: <20200701155348.52864-1-cristian.marussi@arm.com> (raw) Hi all, this series wants to introduce SCMI Notification Support, built on top of the standard Kernel notification chain subsystem. At initialization time each SCMI Protocol takes care to register with the new SCMI notification core the set of its own events which it intends to support. Using the API exposed via scmi_handle.notify_ops a Kernel user can register its own notifier_t callback (via a notifier_block as usual) against any registered event as identified by the tuple: (proto_id, event_id, src_id) where src_id represents a generic source identifier which is protocol dependent like domain_id, performance_id, sensor_id and so forth. (users can anyway do NOT provide any src_id, and subscribe instead to ALL the existing (if any) src_id sources for that proto_id/evt_id combination) Each of the above tuple-specified events will be served on its own dedicated blocking notification chain, dynamically allocated on-demand when at least one user has shown interest on that event. Upon a notification delivery all the users' registered notifier_t callbacks will be in turn invoked and fed with the event_id as @action param and a generated custom per-event struct _report as @data param. (as in include/linux/scmi_protocol.h) The final step of notification delivery via users' callback invocation is instead delegated to a pool of deferred workers (Kernel cmwq): each SCMI protocol has its own dedicated worker and dedicated queue to push events from the rx ISR to the worker. Based on scmi-next/for-next/scmi 5.8-rc3 [1], on top of: commit 29c9e984d8e3 ("firmware: arm_scmi: Fix SCMI genpd domain probing") This series has been tested on JUNO with an experimental firmware only supporting Perf Notifications. Thanks Cristian ---- v10 --> v11: - fixed macros for argument reuse checkpatch warning - added missing mutex comments - removed improper usage of IS_ERR_OR_NULL - switch to int retvals for some core functions instead of bools - removed all likely/unlikely v9 --> v10: - rebased on top of scmi-next 5.8-rc1 - fixed a couple of Warnings (-Wtype-limit) v8 --> v9: - rebased on top of scmi-next 5.8 - moved some pr_info() to dev_dbg() - moved around some macros definitions (using FIELD_PREPARE properly) - introduced some meaningful define - shrunk hashtables' sizes - shortened the naming of some massively long data struct v7 --> v8: - removed unneeded initialized/enabled atomics, added proper barriers - added a few comments about queueing work item and kfifos v6 --> v7: - rebased on top of scmi-next 5.7, dropped the initial 4 patches since now already queued on base scmi-next [1] - fixed some events' proto initialization - removed some notify_enabled explicit methods exposed in some protocol_ops since not supposed to be used directly when using this notification framework (and of no other known use) - exposing SCMI_EVENT_ enums in scmi_protocol.h - added agent_id field in RESET_ISSUED payload as per reviewed SCMI spec - removed POWER_STATE_CHANGE_REQUESTED pre-notification definition and handling as per reviewedSCMI spec - fixed report.timestamp field type v5 --> v6: - added handle argument to fill_custom_report() helper v4 --> v5: - fixed kernel-doc - added proper barriers around registered protocols and events initialization - reviewed queues allocation using devm_add_action_or_reset - reviewed REVT_NOTIFY_ENABLE macro v3 --> v4: - dropped RFC tag - avoid one unneeded evt payload memcpy on the ISR RC code path by redesigning dispatcher to handle partial queue-reads (in_flight events, only header) - fixed the initialization issue exposed by late SCMI modules loading by reviewing the init process to support possible late events registrations by protocols and early callbacks registrations by users (pending) - cleanup/simplification of exit path: SCMI protocols are generally never de-initialized after the initial device creation, so do not deinit notification core either (we do halt the delivery, stop the wq and empty the queues though) - reduced contention on regustered_events_handler to the minimum during delivery by splitting the common registered_events_handlers hashtable into a number of per-protocol tables - converted registered_protocols and registered_events hastable to fixed size arrays: simpler and lockless in our usage scenario v2 --> v3: - added platform instance awareness to the notification core: a notification instance is created for each known handle - reviewed notification core initialization and shutdown process - removed generic non-handle-rooted registration API - added WQ_SYSFS flag to workqueue instance v1 --> v2: - dropped anti-tampering patch - rebased on top of scmi-for-next-5.6, which includes Viresh series that make SCMI core independent of transport (5c8a47a5a91d) - add a few new SCMI transport methods on top of Viresh patch to address needs of SCMI Notifications - reviewed/renamed scmi_handle_xfer_delayed_resp() - split main SCMI Notification core patch (~1k lines) into three chunks: protocol-registration / callbacks-registration / dispatch-and-delivery - removed awkward usage of IDR maps in favour of pure hashtables - added enable/disable refcounting in notification core (was broken in v1) - removed per-protocol candidate API: a single generic API is now proposed instead of scmi_register_<proto>_event_notifier(evt_id, *src_id, *nb) - added handle->notify_ops as an alternative notification API for scmi_driver - moved ALL_SRCIDs enabled handling from protocol code to core code - reviewed protocol registration/unregistration logic to use devres - reviewed cleanup phase on shutdown - fixed ERROR: reference preceded by free as reported by kbuild test robot [1] git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git Cristian Marussi (9): firmware: arm_scmi: Add notification protocol-registration firmware: arm_scmi: Add notification callbacks-registration firmware: arm_scmi: Add notification dispatch and delivery firmware: arm_scmi: Enable notification core firmware: arm_scmi: Add power notifications support firmware: arm_scmi: Add perf notifications support firmware: arm_scmi: Add sensor notifications support firmware: arm_scmi: Add reset notifications support firmware: arm_scmi: Add base notifications support drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/base.c | 108 +- drivers/firmware/arm_scmi/common.h | 4 + drivers/firmware/arm_scmi/driver.c | 10 + drivers/firmware/arm_scmi/notify.c | 1525 +++++++++++++++++++++++++++ drivers/firmware/arm_scmi/notify.h | 66 ++ drivers/firmware/arm_scmi/perf.c | 139 ++- drivers/firmware/arm_scmi/power.c | 92 +- drivers/firmware/arm_scmi/reset.c | 96 +- drivers/firmware/arm_scmi/sensors.c | 69 +- include/linux/scmi_protocol.h | 108 +- 11 files changed, 2189 insertions(+), 30 deletions(-) create mode 100644 drivers/firmware/arm_scmi/notify.c create mode 100644 drivers/firmware/arm_scmi/notify.h -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Cristian Marussi <cristian.marussi@arm.com> To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, lukasz.luba@arm.com, dan.carpenter@oracle.com Subject: [PATCH v11 0/9] SCMI Notifications Core Support Date: Wed, 1 Jul 2020 16:53:39 +0100 [thread overview] Message-ID: <20200701155348.52864-1-cristian.marussi@arm.com> (raw) Hi all, this series wants to introduce SCMI Notification Support, built on top of the standard Kernel notification chain subsystem. At initialization time each SCMI Protocol takes care to register with the new SCMI notification core the set of its own events which it intends to support. Using the API exposed via scmi_handle.notify_ops a Kernel user can register its own notifier_t callback (via a notifier_block as usual) against any registered event as identified by the tuple: (proto_id, event_id, src_id) where src_id represents a generic source identifier which is protocol dependent like domain_id, performance_id, sensor_id and so forth. (users can anyway do NOT provide any src_id, and subscribe instead to ALL the existing (if any) src_id sources for that proto_id/evt_id combination) Each of the above tuple-specified events will be served on its own dedicated blocking notification chain, dynamically allocated on-demand when at least one user has shown interest on that event. Upon a notification delivery all the users' registered notifier_t callbacks will be in turn invoked and fed with the event_id as @action param and a generated custom per-event struct _report as @data param. (as in include/linux/scmi_protocol.h) The final step of notification delivery via users' callback invocation is instead delegated to a pool of deferred workers (Kernel cmwq): each SCMI protocol has its own dedicated worker and dedicated queue to push events from the rx ISR to the worker. Based on scmi-next/for-next/scmi 5.8-rc3 [1], on top of: commit 29c9e984d8e3 ("firmware: arm_scmi: Fix SCMI genpd domain probing") This series has been tested on JUNO with an experimental firmware only supporting Perf Notifications. Thanks Cristian ---- v10 --> v11: - fixed macros for argument reuse checkpatch warning - added missing mutex comments - removed improper usage of IS_ERR_OR_NULL - switch to int retvals for some core functions instead of bools - removed all likely/unlikely v9 --> v10: - rebased on top of scmi-next 5.8-rc1 - fixed a couple of Warnings (-Wtype-limit) v8 --> v9: - rebased on top of scmi-next 5.8 - moved some pr_info() to dev_dbg() - moved around some macros definitions (using FIELD_PREPARE properly) - introduced some meaningful define - shrunk hashtables' sizes - shortened the naming of some massively long data struct v7 --> v8: - removed unneeded initialized/enabled atomics, added proper barriers - added a few comments about queueing work item and kfifos v6 --> v7: - rebased on top of scmi-next 5.7, dropped the initial 4 patches since now already queued on base scmi-next [1] - fixed some events' proto initialization - removed some notify_enabled explicit methods exposed in some protocol_ops since not supposed to be used directly when using this notification framework (and of no other known use) - exposing SCMI_EVENT_ enums in scmi_protocol.h - added agent_id field in RESET_ISSUED payload as per reviewed SCMI spec - removed POWER_STATE_CHANGE_REQUESTED pre-notification definition and handling as per reviewedSCMI spec - fixed report.timestamp field type v5 --> v6: - added handle argument to fill_custom_report() helper v4 --> v5: - fixed kernel-doc - added proper barriers around registered protocols and events initialization - reviewed queues allocation using devm_add_action_or_reset - reviewed REVT_NOTIFY_ENABLE macro v3 --> v4: - dropped RFC tag - avoid one unneeded evt payload memcpy on the ISR RC code path by redesigning dispatcher to handle partial queue-reads (in_flight events, only header) - fixed the initialization issue exposed by late SCMI modules loading by reviewing the init process to support possible late events registrations by protocols and early callbacks registrations by users (pending) - cleanup/simplification of exit path: SCMI protocols are generally never de-initialized after the initial device creation, so do not deinit notification core either (we do halt the delivery, stop the wq and empty the queues though) - reduced contention on regustered_events_handler to the minimum during delivery by splitting the common registered_events_handlers hashtable into a number of per-protocol tables - converted registered_protocols and registered_events hastable to fixed size arrays: simpler and lockless in our usage scenario v2 --> v3: - added platform instance awareness to the notification core: a notification instance is created for each known handle - reviewed notification core initialization and shutdown process - removed generic non-handle-rooted registration API - added WQ_SYSFS flag to workqueue instance v1 --> v2: - dropped anti-tampering patch - rebased on top of scmi-for-next-5.6, which includes Viresh series that make SCMI core independent of transport (5c8a47a5a91d) - add a few new SCMI transport methods on top of Viresh patch to address needs of SCMI Notifications - reviewed/renamed scmi_handle_xfer_delayed_resp() - split main SCMI Notification core patch (~1k lines) into three chunks: protocol-registration / callbacks-registration / dispatch-and-delivery - removed awkward usage of IDR maps in favour of pure hashtables - added enable/disable refcounting in notification core (was broken in v1) - removed per-protocol candidate API: a single generic API is now proposed instead of scmi_register_<proto>_event_notifier(evt_id, *src_id, *nb) - added handle->notify_ops as an alternative notification API for scmi_driver - moved ALL_SRCIDs enabled handling from protocol code to core code - reviewed protocol registration/unregistration logic to use devres - reviewed cleanup phase on shutdown - fixed ERROR: reference preceded by free as reported by kbuild test robot [1] git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git Cristian Marussi (9): firmware: arm_scmi: Add notification protocol-registration firmware: arm_scmi: Add notification callbacks-registration firmware: arm_scmi: Add notification dispatch and delivery firmware: arm_scmi: Enable notification core firmware: arm_scmi: Add power notifications support firmware: arm_scmi: Add perf notifications support firmware: arm_scmi: Add sensor notifications support firmware: arm_scmi: Add reset notifications support firmware: arm_scmi: Add base notifications support drivers/firmware/arm_scmi/Makefile | 2 +- drivers/firmware/arm_scmi/base.c | 108 +- drivers/firmware/arm_scmi/common.h | 4 + drivers/firmware/arm_scmi/driver.c | 10 + drivers/firmware/arm_scmi/notify.c | 1525 +++++++++++++++++++++++++++ drivers/firmware/arm_scmi/notify.h | 66 ++ drivers/firmware/arm_scmi/perf.c | 139 ++- drivers/firmware/arm_scmi/power.c | 92 +- drivers/firmware/arm_scmi/reset.c | 96 +- drivers/firmware/arm_scmi/sensors.c | 69 +- include/linux/scmi_protocol.h | 108 +- 11 files changed, 2189 insertions(+), 30 deletions(-) create mode 100644 drivers/firmware/arm_scmi/notify.c create mode 100644 drivers/firmware/arm_scmi/notify.h -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev reply other threads:[~2020-07-01 15:54 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-19 22:03 [PATCH] firmware: arm_scmi: Fix SCMI Generic Power Domain probing Cristian Marussi 2020-06-19 22:03 ` Cristian Marussi 2020-07-03 14:49 ` Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla 2020-07-01 15:53 ` Cristian Marussi [this message] 2020-07-01 15:53 ` [PATCH v11 0/9] SCMI Notifications Core Support Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 1/9] firmware: arm_scmi: Add notification protocol-registration Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 2/9] firmware: arm_scmi: Add notification callbacks-registration Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 3/9] firmware: arm_scmi: Add notification dispatch and delivery Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 4/9] firmware: arm_scmi: Enable notification core Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 5/9] firmware: arm_scmi: Add power notifications support Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 6/9] firmware: arm_scmi: Add perf " Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 7/9] firmware: arm_scmi: Add sensor " Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 8/9] firmware: arm_scmi: Add reset " Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-01 15:53 ` [PATCH v11 9/9] firmware: arm_scmi: Add base " Cristian Marussi 2020-07-01 15:53 ` Cristian Marussi 2020-07-03 14:49 ` [PATCH v11 0/9] SCMI Notifications Core Support Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla 2020-06-17 9:43 ` [PATCH 1/2] firmware: arm_scmi: Add fast_switch_possible() api Nicola Mazzucato 2020-06-17 9:43 ` Nicola Mazzucato 2020-06-17 9:43 ` [PATCH 2/2] cpufreq: arm_scmi: Set fast_switch_possible conditionally Nicola Mazzucato 2020-06-17 9:43 ` Nicola Mazzucato 2020-06-17 12:47 ` Sudeep Holla 2020-06-17 12:47 ` Sudeep Holla 2020-06-18 6:14 ` Viresh Kumar 2020-06-18 6:14 ` Viresh Kumar 2020-06-18 8:08 ` Sudeep Holla 2020-06-18 8:08 ` Sudeep Holla 2020-06-18 9:54 ` Viresh Kumar 2020-06-18 9:54 ` Viresh Kumar 2020-07-03 14:49 ` [PATCH 1/2] firmware: arm_scmi: Add fast_switch_possible() api Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla 2020-06-25 10:19 ` [PATCH] firmware: arm_scmi: Use HAVE_ARM_SMCCC_DISCOVERY instead of ARM_PSCI_FW Sudeep Holla 2020-06-25 10:19 ` Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla 2020-06-09 13:45 ` [PATCH] firmware: arm_scmi: Use signed integer to report transfer status Sudeep Holla 2020-06-09 13:45 ` Sudeep Holla 2020-06-09 14:00 ` Lukasz Luba 2020-06-09 14:00 ` Lukasz Luba 2020-07-03 14:49 ` Sudeep Holla 2020-07-03 14:49 ` Sudeep Holla
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200701155348.52864-1-cristian.marussi@arm.com \ --to=cristian.marussi@arm.com \ --cc=Jonathan.Cameron@Huawei.com \ --cc=dan.carpenter@oracle.com \ --cc=james.quinlan@broadcom.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lukasz.luba@arm.com \ --cc=sudeep.holla@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.