History

Merge tag 'soc-fixes-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC fixes from Arnd Bergmann: "A couple of fixes for firmware drivers have come up, addressing kernel side bugs in op-tee and ff-a code, as well as compatibility issues with exynos-acpm and ff-a protocols. The only devicetree fixes are for the Apple platform, addressing issues with conformance to the bindings for the wlan, spi and mipi nodes" * tag 'soc-fixes-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: arm64: dts: apple: Move touchbar mipi {address,size}-cells from dtsi to dts arm64: dts: apple: Drop {address,size}-cells from SPI NOR arm64: dts: apple: t8103: Fix PCIe BCM4377 nodename optee: ffa: fix sleep in atomic context firmware: exynos-acpm: fix timeouts on xfers handling arm64: defconfig: update renamed PHY_SNPS_EUSB2 firmware: arm_ffa: Fix the missing entry in struct ffa_indirect_msg_hdr firmware: arm_ffa: Replace mutex with rwlock to avoid sleep in atomic context firmware: arm_ffa: Move memory allocation outside the mutex locking firmware: arm_ffa: Fix memory leak by freeing notifier callback node

Linus Torvalds committed 1 year ago

Commit b1bf2ef2 parents c435a4f 3f3fb9712 files · +86 −68Browse files

Unified · Split

12 files
  1. arch/arm64/boot/dts/apple/spi1-nvram.dtsi +0 −2
  2. arch/arm64/boot/dts/apple/t8103-j293.dts +2 −0
  3. arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +1 −1
  4. arch/arm64/boot/dts/apple/t8103.dtsi +0 −2
  5. arch/arm64/boot/dts/apple/t8112-j493.dts +2 −0
  6. arch/arm64/boot/dts/apple/t8112.dtsi +0 −2
  7. arch/arm64/configs/defconfig +1 −1
  8. drivers/firmware/arm_ffa/driver.c +36 −35
  9. drivers/firmware/samsung/exynos-acpm.c +9 −16
  10. drivers/tee/optee/ffa_abi.c +32 −9
  11. drivers/tee/optee/optee_private.h +2 −0
  12. include/linux/arm_ffa.h +1 −0
arch/arm64/boot/dts/apple/spi1-nvram.dtsi+0−2
@@ -20,8 +20,6 @@ · 19 unmodified lines
2020 compatible = "jedec,spi-nor";
2121 reg = <0x0>;
2222 spi-max-frequency = <25000000>;
23− #address-cells = <1>;
24− #size-cells = <1>;
2523
2624 partitions {
2725 compatible = "fixed-partitions";
arch/arm64/boot/dts/apple/t8103-j293.dts+2−0
@@ -100,6 +100,8 @@ · 99 unmodified lines
100100
101101 &displaydfr_mipi {
102102 status = "okay";
103+ #address-cells = <1>;
104+ #size-cells = <0>;
103105
104106 dfr_panel: panel@0 {
105107 compatible = "apple,j293-summit", "apple,summit";
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi+1−1
@@ -71,7 +71,7 @@ · 70 unmodified lines
7171 */
7272 &port00 {
7373 bus-range = <1 1>;
74− wifi0: network@0,0 {
74+ wifi0: wifi@0,0 {
7575 compatible = "pci14e4,4425";
7676 reg = <0x10000 0x0 0x0 0x0 0x0>;
7777 /* To be filled by the loader */
arch/arm64/boot/dts/apple/t8103.dtsi+0−2
@@ -405,8 +405,6 @@ · 404 unmodified lines
405405 compatible = "apple,t8103-display-pipe-mipi", "apple,h7-display-pipe-mipi";
406406 reg = <0x2 0x28600000 0x0 0x100000>;
407407 power-domains = <&ps_mipi_dsi>;
408− #address-cells = <1>;
409− #size-cells = <0>;
410408 status = "disabled";
411409
412410 ports {
arch/arm64/boot/dts/apple/t8112-j493.dts+2−0
@@ -63,6 +63,8 @@ · 62 unmodified lines
6363
6464 &displaydfr_mipi {
6565 status = "okay";
66+ #address-cells = <1>;
67+ #size-cells = <0>;
6668
6769 dfr_panel: panel@0 {
6870 compatible = "apple,j493-summit", "apple,summit";
arch/arm64/boot/dts/apple/t8112.dtsi+0−2
@@ -420,8 +420,6 @@ · 419 unmodified lines
420420 compatible = "apple,t8112-display-pipe-mipi", "apple,h7-display-pipe-mipi";
421421 reg = <0x2 0x28600000 0x0 0x100000>;
422422 power-domains = <&ps_mipi_dsi>;
423− #address-cells = <1>;
424− #size-cells = <0>;
425423 status = "disabled";
426424
427425 ports {
arch/arm64/configs/defconfig+1−1
@@ -1573,6 +1573,7 @@ CONFIG_RESET_QCOM_AOSS=y · 1572 unmodified lines
15731573 CONFIG_RESET_QCOM_PDC=m
15741574 CONFIG_RESET_RZG2L_USBPHY_CTRL=y
15751575 CONFIG_RESET_TI_SCI=y
1576+CONFIG_PHY_SNPS_EUSB2=m
15761577 CONFIG_PHY_XGENE=y
15771578 CONFIG_PHY_CAN_TRANSCEIVER=m
15781579 CONFIG_PHY_NXP_PTN3222=m
@@ -1597,7 +1598,6 @@ CONFIG_PHY_QCOM_EDP=m · 18 unmodified lines
15971598 CONFIG_PHY_QCOM_PCIE2=m
15981599 CONFIG_PHY_QCOM_QMP=m
15991600 CONFIG_PHY_QCOM_QUSB2=m
1600−CONFIG_PHY_QCOM_SNPS_EUSB2=m
16011601 CONFIG_PHY_QCOM_EUSB2_REPEATER=m
16021602 CONFIG_PHY_QCOM_M31_USB=m
16031603 CONFIG_PHY_QCOM_USB_HS=m
drivers/firmware/arm_ffa/driver.c+36−35
@@ -110,7 +110,7 @@ struct ffa_drv_info { · 109 unmodified lines
110110 struct work_struct sched_recv_irq_work;
111111 struct xarray partition_info;
112112 DECLARE_HASHTABLE(notifier_hash, ilog2(FFA_MAX_NOTIFICATIONS));
113− struct mutex notify_lock; /* lock to protect notifier hashtable */
113+ rwlock_t notify_lock; /* lock to protect notifier hashtable */
114114 };
115115
116116 static struct ffa_drv_info *drv_info;
@@ -1250,13 +1250,12 @@ notifier_hnode_get_by_type(u16 notify_id, enum notify_type type) · 1133 unmodified lines
12501250 return NULL;
12511251 }
12521252
1253−static int
1254−update_notifier_cb(struct ffa_device *dev, int notify_id, void *cb,
1255− void *cb_data, bool is_registration, bool is_framework)
1253+static int update_notifier_cb(struct ffa_device *dev, int notify_id,
1254+ struct notifier_cb_info *cb, bool is_framework)
12561255 {
12571256 struct notifier_cb_info *cb_info = NULL;
12581257 enum notify_type type = ffa_notify_type_get(dev->vm_id);
1259− bool cb_found;
1258+ bool cb_found, is_registration = !!cb;
12601259
12611260 if (is_framework)
12621261 cb_info = notifier_hnode_get_by_vmid_uuid(notify_id, dev->vm_id,
@@ -1270,20 +1269,10 @@ update_notifier_cb(struct ffa_device *dev, int notify_id, void *cb, · 7 unmodified lines
12701269 return -EINVAL;
12711270
12721271 if (is_registration) {
1273− cb_info = kzalloc(sizeof(*cb_info), GFP_KERNEL);
1274− if (!cb_info)
1275− return -ENOMEM;
1276−
1277− cb_info->dev = dev;
1278− cb_info->cb_data = cb_data;
1279− if (is_framework)
1280− cb_info->fwk_cb = cb;
1281− else
1282− cb_info->cb = cb;
1283−
1284− hash_add(drv_info->notifier_hash, &cb_info->hnode, notify_id);
1272+ hash_add(drv_info->notifier_hash, &cb->hnode, notify_id);
12851273 } else {
12861274 hash_del(&cb_info->hnode);
1275+ kfree(cb_info);
12871276 }
12881277
12891278 return 0;
@@ -1300,20 +1289,19 @@ static int __ffa_notify_relinquish(struct ffa_device *dev, int notify_id, · 10 unmodified lines
13001289 if (notify_id >= FFA_MAX_NOTIFICATIONS)
13011290 return -EINVAL;
13021291
1303− mutex_lock(&drv_info->notify_lock);
1292+ write_lock(&drv_info->notify_lock);
13041293
1305− rc = update_notifier_cb(dev, notify_id, NULL, NULL, false,
1306− is_framework);
1294+ rc = update_notifier_cb(dev, notify_id, NULL, is_framework);
13071295 if (rc) {
13081296 pr_err("Could not unregister notification callback\n");
1309− mutex_unlock(&drv_info->notify_lock);
1297+ write_unlock(&drv_info->notify_lock);
13101298 return rc;
13111299 }
13121300
13131301 if (!is_framework)
13141302 rc = ffa_notification_unbind(dev->vm_id, BIT(notify_id));
13151303
1316− mutex_unlock(&drv_info->notify_lock);
1304+ write_unlock(&drv_info->notify_lock);
13171305
13181306 return rc;
13191307 }
@@ -1334,6 +1322,7 @@ static int __ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu, · 14 unmodified lines
13341322 {
13351323 int rc;
13361324 u32 flags = 0;
1325+ struct notifier_cb_info *cb_info = NULL;
13371326
13381327 if (ffa_notifications_disabled())
13391328 return -EOPNOTSUPP;
@@ -1341,28 +1330,40 @@ static int __ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu, · 1 unmodified line
13411330 if (notify_id >= FFA_MAX_NOTIFICATIONS)
13421331 return -EINVAL;
13431332
1344− mutex_lock(&drv_info->notify_lock);
1333+ cb_info = kzalloc(sizeof(*cb_info), GFP_KERNEL);
1334+ if (!cb_info)
1335+ return -ENOMEM;
1336+
1337+ cb_info->dev = dev;
1338+ cb_info->cb_data = cb_data;
1339+ if (is_framework)
1340+ cb_info->fwk_cb = cb;
1341+ else
1342+ cb_info->cb = cb;
1343+
1344+ write_lock(&drv_info->notify_lock);
13451345
13461346 if (!is_framework) {
13471347 if (is_per_vcpu)
13481348 flags = PER_VCPU_NOTIFICATION_FLAG;
13491349
13501350 rc = ffa_notification_bind(dev->vm_id, BIT(notify_id), flags);
1351− if (rc) {
1352− mutex_unlock(&drv_info->notify_lock);
1353− return rc;
1354− }
1351+ if (rc)
1352+ goto out_unlock_free;
13551353 }
13561354
1357− rc = update_notifier_cb(dev, notify_id, cb, cb_data, true,
1358− is_framework);
1355+ rc = update_notifier_cb(dev, notify_id, cb_info, is_framework);
13591356 if (rc) {
13601357 pr_err("Failed to register callback for %d - %d\n",
13611358 notify_id, rc);
13621359 if (!is_framework)
13631360 ffa_notification_unbind(dev->vm_id, BIT(notify_id));
13641361 }
1365− mutex_unlock(&drv_info->notify_lock);
1362+
1363+out_unlock_free:
1364+ write_unlock(&drv_info->notify_lock);
1365+ if (rc)
1366+ kfree(cb_info);
13661367
13671368 return rc;
13681369 }
@@ -1406,9 +1407,9 @@ static void handle_notif_callbacks(u64 bitmap, enum notify_type type) · 37 unmodified lines
14061407 if (!(bitmap & 1))
14071408 continue;
14081409
1409− mutex_lock(&drv_info->notify_lock);
1410+ read_lock(&drv_info->notify_lock);
14101411 cb_info = notifier_hnode_get_by_type(notify_id, type);
1411− mutex_unlock(&drv_info->notify_lock);
1412+ read_unlock(&drv_info->notify_lock);
14121413
14131414 if (cb_info && cb_info->cb)
14141415 cb_info->cb(notify_id, cb_info->cb_data);
@@ -1446,9 +1447,9 @@ static void handle_fwk_notif_callbacks(u32 bitmap) · 31 unmodified lines
14461447
14471448 ffa_rx_release();
14481449
1449− mutex_lock(&drv_info->notify_lock);
1450+ read_lock(&drv_info->notify_lock);
14501451 cb_info = notifier_hnode_get_by_vmid_uuid(notify_id, target, &uuid);
1451− mutex_unlock(&drv_info->notify_lock);
1452+ read_unlock(&drv_info->notify_lock);
14521453
14531454 if (cb_info && cb_info->fwk_cb)
14541455 cb_info->fwk_cb(notify_id, cb_info->cb_data, buf);
@@ -1973,7 +1974,7 @@ static void ffa_notifications_setup(void) · 518 unmodified lines
19731974 goto cleanup;
19741975
19751976 hash_init(drv_info->notifier_hash);
1976− mutex_init(&drv_info->notify_lock);
1977+ rwlock_init(&drv_info->notify_lock);
19771978
19781979 drv_info->notif_enabled = true;
19791980 return;
drivers/firmware/samsung/exynos-acpm.c+9−16
@@ -430,6 +430,9 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer) · 429 unmodified lines
430430 return -EOPNOTSUPP;
431431 }
432432
433+ msg.chan_id = xfer->acpm_chan_id;
434+ msg.chan_type = EXYNOS_MBOX_CHAN_TYPE_DOORBELL;
435+
433436 scoped_guard(mutex, &achan->tx_lock) {
434437 tx_front = readl(achan->tx.front);
435438 idx = (tx_front + 1) % achan->qlen;
@@ -446,25 +449,15 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer) · 10 unmodified lines
446449
447450 /* Advance TX front. */
448451 writel(idx, achan->tx.front);
449− }
450452
451− msg.chan_id = xfer->acpm_chan_id;
452− msg.chan_type = EXYNOS_MBOX_CHAN_TYPE_DOORBELL;
453− ret = mbox_send_message(achan->chan, (void *)&msg);
454− if (ret < 0)
455− return ret;
456−
457− ret = acpm_wait_for_message_response(achan, xfer);
453+ ret = mbox_send_message(achan->chan, (void *)&msg);
454+ if (ret < 0)
455+ return ret;
458456
459− /*
460− * NOTE: we might prefer not to need the mailbox ticker to manage the
461− * transfer queueing since the protocol layer queues things by itself.
462− * Unfortunately, we have to kick the mailbox framework after we have
463− * received our message.
464− */
465− mbox_client_txdone(achan->chan, ret);
457+ mbox_client_txdone(achan->chan, 0);
458+ }
466459
467− return ret;
460+ return acpm_wait_for_message_response(achan, xfer);
468461 }
469462
470463 /**
drivers/tee/optee/ffa_abi.c+32−9
@@ -728,12 +728,21 @@ static bool optee_ffa_exchange_caps(struct ffa_device *ffa_dev, · 727 unmodified lines
728728 return true;
729729 }
730730
731+static void notif_work_fn(struct work_struct *work)
732+{
733+ struct optee_ffa *optee_ffa = container_of(work, struct optee_ffa,
734+ notif_work);
735+ struct optee *optee = container_of(optee_ffa, struct optee, ffa);
736+
737+ optee_do_bottom_half(optee->ctx);
738+}
739+
731740 static void notif_callback(int notify_id, void *cb_data)
732741 {
733742 struct optee *optee = cb_data;
734743
735744 if (notify_id == optee->ffa.bottom_half_value)
736− optee_do_bottom_half(optee->ctx);
745+ queue_work(optee->ffa.notif_wq, &optee->ffa.notif_work);
737746 else
738747 optee_notif_send(optee, notify_id);
739748 }
@@ -817,9 +826,11 @@ static void optee_ffa_remove(struct ffa_device *ffa_dev) · 77 unmodified lines
817826 struct optee *optee = ffa_dev_get_drvdata(ffa_dev);
818827 u32 bottom_half_id = optee->ffa.bottom_half_value;
819828
820− if (bottom_half_id != U32_MAX)
829+ if (bottom_half_id != U32_MAX) {
821830 ffa_dev->ops->notifier_ops->notify_relinquish(ffa_dev,
822831 bottom_half_id);
832+ destroy_workqueue(optee->ffa.notif_wq);
833+ }
823834 optee_remove_common(optee);
824835
825836 mutex_destroy(&optee->ffa.mutex);
@@ -835,6 +846,13 @@ static int optee_ffa_async_notif_init(struct ffa_device *ffa_dev, · 9 unmodified lines
835846 u32 notif_id = 0;
836847 int rc;
837848
849+ INIT_WORK(&optee->ffa.notif_work, notif_work_fn);
850+ optee->ffa.notif_wq = create_workqueue("optee_notification");
851+ if (!optee->ffa.notif_wq) {
852+ rc = -EINVAL;
853+ goto err;
854+ }
855+
838856 while (true) {
839857 rc = ffa_dev->ops->notifier_ops->notify_request(ffa_dev,
840858 is_per_vcpu,
@@ -851,19 +869,24 @@ static int optee_ffa_async_notif_init(struct ffa_device *ffa_dev, · 10 unmodified lines
851869 * notifications in that case.
852870 */
853871 if (rc != -EACCES)
854− return rc;
872+ goto err_wq;
855873 notif_id++;
856874 if (notif_id >= OPTEE_FFA_MAX_ASYNC_NOTIF_VALUE)
857− return rc;
875+ goto err_wq;
858876 }
859877 optee->ffa.bottom_half_value = notif_id;
860878
861879 rc = enable_async_notif(optee);
862− if (rc < 0) {
863− ffa_dev->ops->notifier_ops->notify_relinquish(ffa_dev,
864− notif_id);
865− optee->ffa.bottom_half_value = U32_MAX;
866− }
880+ if (rc < 0)
881+ goto err_rel;
882+
883+ return 0;
884+err_rel:
885+ ffa_dev->ops->notifier_ops->notify_relinquish(ffa_dev, notif_id);
886+err_wq:
887+ destroy_workqueue(optee->ffa.notif_wq);
888+err:
889+ optee->ffa.bottom_half_value = U32_MAX;
867890
868891 return rc;
869892 }
drivers/tee/optee/optee_private.h+2−0
@@ -165,6 +165,8 @@ struct optee_ffa { · 164 unmodified lines
165165 /* Serializes access to @global_ids */
166166 struct mutex mutex;
167167 struct rhashtable global_ids;
168+ struct workqueue_struct *notif_wq;
169+ struct work_struct notif_work;
168170 };
169171
170172 struct optee;
include/linux/arm_ffa.h+1−0
@@ -283,6 +283,7 @@ struct ffa_indirect_msg_hdr { · 282 unmodified lines
283283 u32 offset;
284284 u32 send_recv_id;
285285 u32 size;
286+ u32 res1;
286287 uuid_t uuid;
287288 };
288289

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t