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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scmi-updates-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/drivers

ARM SCMI updates for v5.14

- Support for SCMI clocks from the SCMI power domains
- Addition of checks for correct compatibles for shmem devicetree nodes
that were found missing in the process of YAML schema conversion
- Kconfig and associated build fix found when optee transport are being
worked on
- Couple of fixes and cleanups found as with work-in-progress virtio
transport support

The new transports(optee and virtio) themselves are still being worked on
with ongoing reviews, they are not part of this yet

* tag 'scmi-updates-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
firmware: arm_scmi: Avoid multiple initialisations of hdr->protocol_id
firmware: arm_scmi: Move reinit_completion from scmi_xfer_get to do_xfer
firmware: arm_scmi: Add delayed response status check
firmware: arm_scmi: Add compatibility checks for shmem node
firmware: arm_scpi: Add compatibility checks for shmem node
firmware: arm_scmi: Fix the build when CONFIG_MAILBOX is not selected
firmware: arm_scmi: Reset Rx buffer to max size during async commands
firmware: arm_scmi: Add SMCCC discovery dependency in Kconfig
firmware: arm_scmi: Add clock management to the SCMI power domain

Link: https://lore.kernel.org/r/20210611075722.2813550-1-sudeep.holla@arm.com
Signed-off-by: Olof Johansson <olof@lixom.net>

+60 -11
+1 -1
drivers/firmware/Kconfig
··· 9 9 config ARM_SCMI_PROTOCOL 10 10 tristate "ARM System Control and Management Interface (SCMI) Message Protocol" 11 11 depends on ARM || ARM64 || COMPILE_TEST 12 - depends on MAILBOX 12 + depends on MAILBOX || HAVE_ARM_SMCCC_DISCOVERY 13 13 help 14 14 ARM System Control and Management Interface (SCMI) protocol is a 15 15 set of operating system-independent software interfaces that are
+1 -1
drivers/firmware/arm_scmi/common.h
··· 331 331 }; 332 332 333 333 extern const struct scmi_desc scmi_mailbox_desc; 334 - #ifdef CONFIG_HAVE_ARM_SMCCC 334 + #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY 335 335 extern const struct scmi_desc scmi_smc_desc; 336 336 #endif 337 337
+15 -9
drivers/firmware/arm_scmi/driver.c
··· 241 241 242 242 xfer = &minfo->xfer_block[xfer_id]; 243 243 xfer->hdr.seq = xfer_id; 244 - reinit_completion(&xfer->done); 245 244 xfer->transfer_id = atomic_inc_return(&transfer_last_id); 246 245 247 246 return xfer; ··· 333 334 __scmi_xfer_put(minfo, xfer); 334 335 return; 335 336 } 337 + 338 + /* rx.len could be shrunk in the sync do_xfer, so reset to maxsz */ 339 + if (msg_type == MSG_TYPE_DELAYED_RESP) 340 + xfer->rx.len = info->desc->max_msg_size; 336 341 337 342 scmi_dump_header_dbg(dev, &xfer->hdr); 338 343 ··· 432 429 struct scmi_chan_info *cinfo; 433 430 434 431 /* 435 - * Re-instate protocol id here from protocol handle so that cannot be 432 + * Initialise protocol id now from protocol handle to avoid it being 436 433 * overridden by mistake (or malice) by the protocol code mangling with 437 - * the scmi_xfer structure. 434 + * the scmi_xfer structure prior to this. 438 435 */ 439 436 xfer->hdr.protocol_id = pi->proto->id; 437 + reinit_completion(&xfer->done); 440 438 441 439 cinfo = idr_find(&info->tx_idr, xfer->hdr.protocol_id); 442 440 if (unlikely(!cinfo)) ··· 509 505 struct scmi_xfer *xfer) 510 506 { 511 507 int ret, timeout = msecs_to_jiffies(SCMI_MAX_RESPONSE_TIMEOUT); 512 - const struct scmi_protocol_instance *pi = ph_to_pi(ph); 513 508 DECLARE_COMPLETION_ONSTACK(async_response); 514 - 515 - xfer->hdr.protocol_id = pi->proto->id; 516 509 517 510 xfer->async_done = &async_response; 518 511 519 512 ret = do_xfer(ph, xfer); 520 - if (!ret && !wait_for_completion_timeout(xfer->async_done, timeout)) 521 - ret = -ETIMEDOUT; 513 + if (!ret) { 514 + if (!wait_for_completion_timeout(xfer->async_done, timeout)) 515 + ret = -ETIMEDOUT; 516 + else if (xfer->hdr.status) 517 + ret = scmi_to_linux_errno(xfer->hdr.status); 518 + } 522 519 523 520 xfer->async_done = NULL; 524 521 return ret; ··· 566 561 xfer->tx.len = tx_size; 567 562 xfer->rx.len = rx_size ? : info->desc->max_msg_size; 568 563 xfer->hdr.id = msg_id; 569 - xfer->hdr.protocol_id = pi->proto->id; 570 564 xfer->hdr.poll_completion = false; 571 565 572 566 *p = xfer; ··· 1571 1567 1572 1568 /* Each compatible listed below must have descriptor associated with it */ 1573 1569 static const struct of_device_id scmi_of_match[] = { 1570 + #ifdef CONFIG_MAILBOX 1574 1571 { .compatible = "arm,scmi", .data = &scmi_mailbox_desc }, 1572 + #endif 1575 1573 #ifdef CONFIG_HAVE_ARM_SMCCC_DISCOVERY 1576 1574 { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, 1577 1575 #endif
+3
drivers/firmware/arm_scmi/mailbox.c
··· 69 69 return -ENOMEM; 70 70 71 71 shmem = of_parse_phandle(cdev->of_node, "shmem", idx); 72 + if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) 73 + return -ENXIO; 74 + 72 75 ret = of_address_to_resource(shmem, 0, &res); 73 76 of_node_put(shmem); 74 77 if (ret) {
+26
drivers/firmware/arm_scmi/scmi_pm_domain.c
··· 8 8 #include <linux/err.h> 9 9 #include <linux/io.h> 10 10 #include <linux/module.h> 11 + #include <linux/pm_clock.h> 11 12 #include <linux/pm_domain.h> 12 13 #include <linux/scmi_protocol.h> 13 14 ··· 51 50 static int scmi_pd_power_off(struct generic_pm_domain *domain) 52 51 { 53 52 return scmi_pd_power(domain, false); 53 + } 54 + 55 + static int scmi_pd_attach_dev(struct generic_pm_domain *pd, struct device *dev) 56 + { 57 + int ret; 58 + 59 + ret = pm_clk_create(dev); 60 + if (ret) 61 + return ret; 62 + 63 + ret = of_pm_clk_add_clks(dev); 64 + if (ret >= 0) 65 + return 0; 66 + 67 + pm_clk_destroy(dev); 68 + return ret; 69 + } 70 + 71 + static void scmi_pd_detach_dev(struct generic_pm_domain *pd, struct device *dev) 72 + { 73 + pm_clk_destroy(dev); 54 74 } 55 75 56 76 static int scmi_pm_domain_probe(struct scmi_device *sdev) ··· 124 102 scmi_pd->genpd.name = scmi_pd->name; 125 103 scmi_pd->genpd.power_off = scmi_pd_power_off; 126 104 scmi_pd->genpd.power_on = scmi_pd_power_on; 105 + scmi_pd->genpd.attach_dev = scmi_pd_attach_dev; 106 + scmi_pd->genpd.detach_dev = scmi_pd_detach_dev; 107 + scmi_pd->genpd.flags = GENPD_FLAG_PM_CLK | 108 + GENPD_FLAG_ACTIVE_WAKEUP; 127 109 128 110 pm_genpd_init(&scmi_pd->genpd, NULL, 129 111 state == SCMI_POWER_STATE_GENERIC_OFF);
+3
drivers/firmware/arm_scmi/smc.c
··· 76 76 return -ENOMEM; 77 77 78 78 np = of_parse_phandle(cdev->of_node, "shmem", 0); 79 + if (!of_device_is_compatible(np, "arm,scmi-shmem")) 80 + return -ENXIO; 81 + 79 82 ret = of_address_to_resource(np, 0, &res); 80 83 of_node_put(np); 81 84 if (ret) {
+11
drivers/firmware/arm_scpi.c
··· 899 899 {}, 900 900 }; 901 901 902 + static const struct of_device_id shmem_of_match[] __maybe_unused = { 903 + { .compatible = "amlogic,meson-gxbb-scp-shmem", }, 904 + { .compatible = "amlogic,meson-axg-scp-shmem", }, 905 + { .compatible = "arm,juno-scp-shmem", }, 906 + { .compatible = "arm,scp-shmem", }, 907 + { } 908 + }; 909 + 902 910 static int scpi_probe(struct platform_device *pdev) 903 911 { 904 912 int count, idx, ret; ··· 942 934 struct scpi_chan *pchan = scpi_info->channels + idx; 943 935 struct mbox_client *cl = &pchan->cl; 944 936 struct device_node *shmem = of_parse_phandle(np, "shmem", idx); 937 + 938 + if (!of_match_node(shmem_of_match, shmem)) 939 + return -ENXIO; 945 940 946 941 ret = of_address_to_resource(shmem, 0, &res); 947 942 of_node_put(shmem);