Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware: arm_scmi: Remove legacy transport-layer code

Since all SCMI transports have been made standalone drivers, remove all the
core SCMI stack legacy support that was needed to run transports as built
into the stack.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Message-Id: <20240812173340.3912830-10-cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

authored by

Cristian Marussi and committed by
Sudeep Holla
fc789363 20bda12a

+16 -104
-18
drivers/firmware/arm_scmi/common.h
··· 183 183 /** 184 184 * struct scmi_transport_ops - Structure representing a SCMI transport ops 185 185 * 186 - * @link_supplier: Optional callback to add link to a supplier device 187 186 * @chan_available: Callback to check if channel is available or not 188 187 * @chan_setup: Callback to allocate and setup a channel 189 188 * @chan_free: Callback to free a channel ··· 197 198 * @poll_done: Callback to poll transfer status 198 199 */ 199 200 struct scmi_transport_ops { 200 - int (*link_supplier)(struct device *dev); 201 201 bool (*chan_available)(struct device_node *of_node, int idx); 202 202 int (*chan_setup)(struct scmi_chan_info *cinfo, struct device *dev, 203 203 bool tx); ··· 217 219 /** 218 220 * struct scmi_desc - Description of SoC integration 219 221 * 220 - * @transport_init: An optional function that a transport can provide to 221 - * initialize some transport-specific setup during SCMI core 222 - * initialization, so ahead of SCMI core probing. 223 - * @transport_exit: An optional function that a transport can provide to 224 - * de-initialize some transport-specific setup during SCMI core 225 - * de-initialization, so after SCMI core removal. 226 222 * @ops: Pointer to the transport specific ops structure 227 223 * @max_rx_timeout_ms: Timeout for communication with SoC (in Milliseconds) 228 224 * @max_msg: Maximum number of messages for a channel type (tx or rx) that can ··· 237 245 * when requested. 238 246 */ 239 247 struct scmi_desc { 240 - int (*transport_init)(void); 241 - void (*transport_exit)(void); 242 248 const struct scmi_transport_ops *ops; 243 249 int max_rx_timeout_ms; 244 250 int max_msg; ··· 277 287 struct scmi_xfer *xfer, 278 288 unsigned int timeout_ms); 279 289 280 - void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv); 281 - 282 290 enum debug_counters { 283 291 SENT_OK, 284 292 SENT_FAIL, ··· 308 320 MSG_NOMEM = -4, 309 321 MSG_MBOX_SPURIOUS = -5, 310 322 }; 311 - 312 - void scmi_bad_message_trace(struct scmi_chan_info *cinfo, u32 msg_hdr, 313 - enum scmi_bad_msg err); 314 323 315 324 /* shmem related declarations */ 316 325 struct scmi_shared_mem; ··· 456 471 }, \ 457 472 .probe = __tag##_probe, \ 458 473 } 459 - 460 - extern const struct scmi_shared_mem_operations scmi_shmem_ops; 461 - extern const struct scmi_message_operations scmi_msg_ops; 462 474 463 475 void scmi_notification_instance_data_set(const struct scmi_handle *handle, 464 476 void *priv);
+14 -84
drivers/firmware/arm_scmi/driver.c
··· 11 11 * various power domain DVFS including the core/cluster, certain system 12 12 * clocks configuration, thermal sensors and many others. 13 13 * 14 - * Copyright (C) 2018-2021 ARM Ltd. 14 + * Copyright (C) 2018-2024 ARM Ltd. 15 15 */ 16 16 17 17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ··· 195 195 #define handle_to_scmi_info(h) container_of(h, struct scmi_info, handle) 196 196 #define bus_nb_to_scmi_info(nb) container_of(nb, struct scmi_info, bus_nb) 197 197 #define req_nb_to_scmi_info(nb) container_of(nb, struct scmi_info, dev_req_nb) 198 + 199 + static void scmi_rx_callback(struct scmi_chan_info *cinfo, 200 + u32 msg_hdr, void *priv); 201 + static void scmi_bad_message_trace(struct scmi_chan_info *cinfo, 202 + u32 msg_hdr, enum scmi_bad_msg err); 198 203 199 204 static struct scmi_transport_core_operations scmi_trans_core_ops = { 200 205 .bad_message_trace = scmi_bad_message_trace, ··· 845 840 * timed-out message that arrives and as such, can be traced only referring to 846 841 * the header content, since the payload is missing/unreliable. 847 842 */ 848 - void scmi_bad_message_trace(struct scmi_chan_info *cinfo, u32 msg_hdr, 849 - enum scmi_bad_msg err) 843 + static void scmi_bad_message_trace(struct scmi_chan_info *cinfo, u32 msg_hdr, 844 + enum scmi_bad_msg err) 850 845 { 851 846 char *tag; 852 847 struct scmi_info *info = handle_to_scmi_info(cinfo->handle); ··· 1179 1174 * NOTE: This function will be invoked in IRQ context, hence should be 1180 1175 * as optimal as possible. 1181 1176 */ 1182 - void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv) 1177 + static void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, 1178 + void *priv) 1183 1179 { 1184 1180 u8 msg_type = MSG_XTRACT_TYPE(msg_hdr); 1185 1181 ··· 3061 3055 struct device *dev = &pdev->dev; 3062 3056 struct device_node *child, *np = dev->of_node; 3063 3057 3064 - desc = of_device_get_match_data(dev); 3058 + desc = scmi_transport_setup(dev); 3065 3059 if (!desc) { 3066 - desc = scmi_transport_setup(dev); 3067 - if (!desc) { 3068 - err_str = "transport invalid\n"; 3069 - ret = -EINVAL; 3070 - goto out_err; 3071 - } 3060 + err_str = "transport invalid\n"; 3061 + ret = -EINVAL; 3062 + goto out_err; 3072 3063 } 3073 3064 3074 3065 info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); ··· 3104 3101 "SCMI System wide atomic threshold set to %d us\n", 3105 3102 info->atomic_threshold); 3106 3103 handle->is_transport_atomic = scmi_is_transport_atomic; 3107 - 3108 - if (desc->ops->link_supplier) { 3109 - ret = desc->ops->link_supplier(dev); 3110 - if (ret) { 3111 - err_str = "transport not ready\n"; 3112 - goto clear_ida; 3113 - } 3114 - } 3115 3104 3116 3105 /* Setup all channels described in the DT at first */ 3117 3106 ret = scmi_channels_setup(info); ··· 3311 3316 }; 3312 3317 ATTRIBUTE_GROUPS(versions); 3313 3318 3314 - /* Each compatible listed below must have descriptor associated with it */ 3315 - static const struct of_device_id scmi_of_match[] = { 3316 - { /* Sentinel */ }, 3317 - }; 3318 - 3319 - MODULE_DEVICE_TABLE(of, scmi_of_match); 3320 - 3321 3319 static struct platform_driver scmi_driver = { 3322 3320 .driver = { 3323 3321 .name = "arm-scmi", 3324 3322 .suppress_bind_attrs = true, 3325 - .of_match_table = scmi_of_match, 3326 3323 .dev_groups = versions_groups, 3327 3324 }, 3328 3325 .probe = scmi_probe, 3329 3326 .remove_new = scmi_remove, 3330 3327 }; 3331 - 3332 - /** 3333 - * __scmi_transports_setup - Common helper to call transport-specific 3334 - * .init/.exit code if provided. 3335 - * 3336 - * @init: A flag to distinguish between init and exit. 3337 - * 3338 - * Note that, if provided, we invoke .init/.exit functions for all the 3339 - * transports currently compiled in. 3340 - * 3341 - * Return: 0 on Success. 3342 - */ 3343 - static inline int __scmi_transports_setup(bool init) 3344 - { 3345 - int ret = 0; 3346 - const struct of_device_id *trans; 3347 - 3348 - for (trans = scmi_of_match; trans->data; trans++) { 3349 - const struct scmi_desc *tdesc = trans->data; 3350 - 3351 - if ((init && !tdesc->transport_init) || 3352 - (!init && !tdesc->transport_exit)) 3353 - continue; 3354 - 3355 - if (init) 3356 - ret = tdesc->transport_init(); 3357 - else 3358 - tdesc->transport_exit(); 3359 - 3360 - if (ret) { 3361 - pr_err("SCMI transport %s FAILED initialization!\n", 3362 - trans->compatible); 3363 - break; 3364 - } 3365 - } 3366 - 3367 - return ret; 3368 - } 3369 - 3370 - static int __init scmi_transports_init(void) 3371 - { 3372 - return __scmi_transports_setup(true); 3373 - } 3374 - 3375 - static void __exit scmi_transports_exit(void) 3376 - { 3377 - __scmi_transports_setup(false); 3378 - } 3379 3328 3380 3329 static struct dentry *scmi_debugfs_init(void) 3381 3330 { ··· 3336 3397 3337 3398 static int __init scmi_driver_init(void) 3338 3399 { 3339 - int ret; 3340 - 3341 3400 /* Bail out if no SCMI transport was configured */ 3342 3401 if (WARN_ON(!IS_ENABLED(CONFIG_ARM_SCMI_HAVE_TRANSPORT))) 3343 3402 return -EINVAL; 3344 - 3345 - /* Initialize any compiled-in transport which provided an init/exit */ 3346 - ret = scmi_transports_init(); 3347 - if (ret) 3348 - return ret; 3349 3403 3350 3404 if (IS_ENABLED(CONFIG_ARM_SCMI_HAVE_SHMEM)) 3351 3405 scmi_trans_core_ops.shmem = scmi_shared_mem_operations_get(); ··· 3378 3446 scmi_system_unregister(); 3379 3447 scmi_powercap_unregister(); 3380 3448 scmi_pinctrl_unregister(); 3381 - 3382 - scmi_transports_exit(); 3383 3449 3384 3450 platform_driver_unregister(&scmi_driver); 3385 3451
+1 -1
drivers/firmware/arm_scmi/msg.c
··· 110 110 memcpy(xfer->rx.buf, msg->msg_payload, xfer->rx.len); 111 111 } 112 112 113 - const struct scmi_message_operations scmi_msg_ops = { 113 + static const struct scmi_message_operations scmi_msg_ops = { 114 114 .tx_prepare = msg_tx_prepare, 115 115 .command_size = msg_command_size, 116 116 .response_size = msg_response_size,
+1 -1
drivers/firmware/arm_scmi/shmem.c
··· 176 176 return addr; 177 177 } 178 178 179 - const struct scmi_shared_mem_operations scmi_shmem_ops = { 179 + static const struct scmi_shared_mem_operations scmi_shmem_ops = { 180 180 .tx_prepare = shmem_tx_prepare, 181 181 .read_header = shmem_read_header, 182 182 .fetch_response = shmem_fetch_response,