| bd496a44 | 26-Mar-2025 |
Manjunatha Venkatesh <[email protected]> |
i3c: Add NULL pointer check in i3c_master_queue_ibi()
The I3C master driver may receive an IBI from a target device that has not been probed yet. In such cases, the master calls `i3c_master_queue_ib
i3c: Add NULL pointer check in i3c_master_queue_ibi()
The I3C master driver may receive an IBI from a target device that has not been probed yet. In such cases, the master calls `i3c_master_queue_ibi()` to queue an IBI work task, leading to "Unable to handle kernel read from unreadable memory" and resulting in a kernel panic.
Typical IBI handling flow: 1. The I3C master scans target devices and probes their respective drivers. 2. The target device driver calls `i3c_device_request_ibi()` to enable IBI and assigns `dev->ibi = ibi`. 3. The I3C master receives an IBI from the target device and calls `i3c_master_queue_ibi()` to queue the target device driver’s IBI handler task.
However, since target device events are asynchronous to the I3C probe sequence, step 3 may occur before step 2, causing `dev->ibi` to be `NULL`, leading to a kernel panic.
Add a NULL pointer check in `i3c_master_queue_ibi()` to prevent accessing an uninitialized `dev->ibi`, ensuring stability.
Fixes: 3a379bbcea0af ("i3c: Add core I3C infrastructure") Cc: [email protected] Link: https://lore.kernel.org/lkml/Z9gjGYudiYyl3bSe@lizhi-Precision-Tower-5810/ Signed-off-by: Manjunatha Venkatesh <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 465e5486 | 21-Mar-2025 |
Andy Shevchenko <[email protected]> |
i3c: master: Drop duplicate check before calling OF APIs
OF APIs are usually NULL-aware and returns an error in case when device node is not present or supported. We already have a check for the ret
i3c: master: Drop duplicate check before calling OF APIs
OF APIs are usually NULL-aware and returns an error in case when device node is not present or supported. We already have a check for the returned value, no need to check for the parameter.
Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| e8d2d287 | 19-Mar-2025 |
Nathan Chancellor <[email protected]> |
i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work()
Clang warns (or errors with CONFIG_WERROR=y):
drivers/i3c/master/svc-i3c-master.c:596:2: error: unannotated fall-through be
i3c: master: svc: Fix implicit fallthrough in svc_i3c_master_ibi_work()
Clang warns (or errors with CONFIG_WERROR=y):
drivers/i3c/master/svc-i3c-master.c:596:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough] 596 | default: | ^ drivers/i3c/master/svc-i3c-master.c:596:2: note: insert 'break;' to avoid fall-through 596 | default: | ^ | break; 1 error generated.
Clang is a little more pedantic than GCC, which does not warn when falling through to a case that is just break or return. Clang's version is more in line with the kernel's own stance in deprecated.rst, which states that all switch/case blocks must end in either break, fallthrough, continue, goto, or return. Add the missing break to silence the warning.
Fixes: 0430bf9bc1ac ("i3c: master: svc: Fix missing STOP for master request") Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| c06acf71 | 18-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Use readsb helper for reading MDB
The target can send the MDB byte followed by additional data bytes. The readl on MRDATAB reads one actual byte, but the readsl advances the destin
i3c: master: svc: Use readsb helper for reading MDB
The target can send the MDB byte followed by additional data bytes. The readl on MRDATAB reads one actual byte, but the readsl advances the destination pointer by 4 bytes. This causes the subsequent payload to be copied to wrong position in the destination buffer.
Cc: [email protected] Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 9cecad13 | 18-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Fix missing the IBI rules
The code does not add IBI rules for devices with controller capability. However, the secondary controller has the controller capability and works at targe
i3c: master: svc: Fix missing the IBI rules
The code does not add IBI rules for devices with controller capability. However, the secondary controller has the controller capability and works at target mode when the device is probed. Therefore, add IBI rules for such devices.
Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| d6cb667b | 10-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Fix i3c_master_get_free_addr return check
The return value of i3c_master_get_free_addr is assigned to a variable with wrong type, so it can't be negative. Use a signed integer for
i3c: master: svc: Fix i3c_master_get_free_addr return check
The return value of i3c_master_get_free_addr is assigned to a variable with wrong type, so it can't be negative. Use a signed integer for the return value. If the value is negative, break the process and propagate the error code.
This commit also fixes the uninitialized symbol 'dyn_addr', reported by Smatch static checker.
Fixes: 4008a74e0f9b ("i3c: master: svc: Fix npcm845 FIFO empty issue") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 2a785307 | 06-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Fix npcm845 DAA process corruption
When MCONFIG.SKEW=0 and MCONFIG.ODHPP=0, the ENTDAA transaction gets corrupted and results in a no repeated-start condition at the end of address
i3c: master: svc: Fix npcm845 DAA process corruption
When MCONFIG.SKEW=0 and MCONFIG.ODHPP=0, the ENTDAA transaction gets corrupted and results in a no repeated-start condition at the end of address assignment.
Workaround: Set MCONFIG.SKEW to 1 before initiating the DAA process. After the DAA process is completed, return MCONFIG.SKEW to its previous value.
Reviewed-by: Frank Li <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 4dd12e94 | 06-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Fix npcm845 invalid slvstart event
I3C HW may generate an invalid SlvStart event when emitting a STOP. If it is a true SlvStart, the MSTATUS state is SLVREQ. Check the MSTATUS stat
i3c: master: svc: Fix npcm845 invalid slvstart event
I3C HW may generate an invalid SlvStart event when emitting a STOP. If it is a true SlvStart, the MSTATUS state is SLVREQ. Check the MSTATUS state to ignore the false event.
Reviewed-by: Frank Li <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 4008a74e | 06-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Fix npcm845 FIFO empty issue
I3C HW stalls the write transfer if the transmit FIFO becomes empty, when new data is written to FIFO, I3C HW resumes the transfer but the first transm
i3c: master: svc: Fix npcm845 FIFO empty issue
I3C HW stalls the write transfer if the transmit FIFO becomes empty, when new data is written to FIFO, I3C HW resumes the transfer but the first transmitted data bit may have the wrong value. Fill the FIFO in advance to prevent FIFO from becoming empty.
Reviewed-by: Frank Li <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 98d87600 | 06-Mar-2025 |
Stanley Chu <[email protected]> |
i3c: master: svc: Add support for Nuvoton npcm845 i3c
Nuvoton npcm845 SoC uses an older IP version, which has specific hardware issues that need to be addressed with a different compatible string.
i3c: master: svc: Add support for Nuvoton npcm845 i3c
Nuvoton npcm845 SoC uses an older IP version, which has specific hardware issues that need to be addressed with a different compatible string.
Add driver data for different compatible strings to define platform specific quirks. Add compatible string for npcm845 to define its own driver data.
Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| a892ee4c | 29-Jan-2025 |
Frank Li <[email protected]> |
i3c: master: svc: Flush FIFO before sending Dynamic Address Assignment(DAA)
Ensure the FIFO is empty before issuing the DAA command to prevent incorrect command data from being sent. Align with othe
i3c: master: svc: Flush FIFO before sending Dynamic Address Assignment(DAA)
Ensure the FIFO is empty before issuing the DAA command to prevent incorrect command data from being sent. Align with other data transfers, such as svc_i3c_master_start_xfer_locked(), which flushes the FIFO before sending a command.
Signed-off-by: Frank Li <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 5eb6d356 | 12-Dec-2024 |
Defa Li <[email protected]> |
i3c: master: Improve initialization of numbered I2C adapters
Add logic to initialize I2C adapters with a specific ID if available, improving device identification and configuration.
For mixed buses
i3c: master: Improve initialization of numbered I2C adapters
Add logic to initialize I2C adapters with a specific ID if available, improving device identification and configuration.
For mixed buses, in addition to the i3c alias, an i2c alias can be added to assign a fixed bus number to the i2c adapter.
This allows an alias node such as: aliases { i2c2 = &mixed_bus_a, i3c2 = &mixed_bus_a, i3c4 = &mixed_bus_b, };
/* assigned "i3c-2" and "i2c-2" */ mixed_bus_a: i3c-master { };
If there is no i2c alias for a mixed bus, the i2c adapter numbers will remain as is and will be assigned starting after the highest fixed bus number.
/* assigned "i3c-4" and likely assigned "i2c-3" */ mixed_bus_b: i3c-master { };
Signed-off-by: Defa Li <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| b266e0d4 | 08-Jan-2025 |
Frank Li <[email protected]> |
i3c: master: Fix missing 'ret' assignment in set_speed()
Fix a probe failure in the i3c master driver that occurs when no i3c devices are connected to the bus.
The issue arises in `i3c_master_bus_i
i3c: master: Fix missing 'ret' assignment in set_speed()
Fix a probe failure in the i3c master driver that occurs when no i3c devices are connected to the bus.
The issue arises in `i3c_master_bus_init()` where the `ret` value is not updated after calling `master->ops->set_speed()`. If no devices are present, `ret` remains set to `I3C_ERROR_M2`, causing the code to incorrectly proceed to `err_bus_cleanup`.
Cc: [email protected] Fixes: aef79e189ba2 ("i3c: master: support to adjust first broadcast address speed") Signed-off-by: Frank Li <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Tested-by: Wolfram Sang <[email protected]> Acked-by: Mukesh Kumar Savaliya <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| e55905a3 | 07-Jan-2025 |
Wolfram Sang <[email protected]> |
i3c: mipi-i3c-hci: use parity8 helper instead of open coding it
The kernel has now a generic helper for getting parity with easier to understand semantics. Make use of it. Here, it also fixes a bug
i3c: mipi-i3c-hci: use parity8 helper instead of open coding it
The kernel has now a generic helper for getting parity with easier to understand semantics. Make use of it. Here, it also fixes a bug because the correct algorithm is using XOR ('^=') instead of ADD ('+=').
Signed-off-by: Wolfram Sang <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| ccdb2e0e | 31-Dec-2024 |
Jarkko Nikula <[email protected]> |
i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming
MIPI I3C HCI on Intel hardware requires a quirk where ring needs to stop and set to run again after resuming the halted controller. This
i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming
MIPI I3C HCI on Intel hardware requires a quirk where ring needs to stop and set to run again after resuming the halted controller. This is not expected from the MIPI I3C HCI specification and is Intel specific.
Add this quirk to generic aborted transfer handling and execute it only when ring is not in running state after a transfer error and attempted controller resume. This is the case on Intel hardware.
It is not fully clear to me what is the ring running state in generic hardware in such case. I would expect if ring is not running, then stop request is a no-op and run request is either required or does the same what controller resume would do.
Signed-off-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 6cf7b65f | 07-Nov-2024 |
Defa Li <[email protected]> |
i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock
A deadlock may happen since the i3c_master_register() acquires &i3cbus->lock twice. See the log below. Use i3cd
i3c: Use i3cdev->desc->info instead of calling i3c_device_get_info() to avoid deadlock
A deadlock may happen since the i3c_master_register() acquires &i3cbus->lock twice. See the log below. Use i3cdev->desc->info instead of calling i3c_device_info() to avoid acquiring the lock twice.
v2: - Modified the title and commit message
============================================ WARNING: possible recursive locking detected 6.11.0-mainline -------------------------------------------- init/1 is trying to acquire lock: f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_bus_normaluse_lock
but task is already holding lock: f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
other info that might help us debug this: Possible unsafe locking scenario:
CPU0 ---- lock(&i3cbus->lock); lock(&i3cbus->lock);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by init/1: #0: fcffff809b6798f8 (&dev->mutex){....}-{3:3}, at: __driver_attach #1: f1ffff80a6a40dc0 (&i3cbus->lock){++++}-{3:3}, at: i3c_master_register
stack backtrace: CPU: 6 UID: 0 PID: 1 Comm: init Call trace: dump_backtrace+0xfc/0x17c show_stack+0x18/0x28 dump_stack_lvl+0x40/0xc0 dump_stack+0x18/0x24 print_deadlock_bug+0x388/0x390 __lock_acquire+0x18bc/0x32ec lock_acquire+0x134/0x2b0 down_read+0x50/0x19c i3c_bus_normaluse_lock+0x14/0x24 i3c_device_get_info+0x24/0x58 i3c_device_uevent+0x34/0xa4 dev_uevent+0x310/0x384 kobject_uevent_env+0x244/0x414 kobject_uevent+0x14/0x20 device_add+0x278/0x460 device_register+0x20/0x34 i3c_master_register_new_i3c_devs+0x78/0x154 i3c_master_register+0x6a0/0x6d4 mtk_i3c_master_probe+0x3b8/0x4d8 platform_probe+0xa0/0xe0 really_probe+0x114/0x454 __driver_probe_device+0xa0/0x15c driver_probe_device+0x3c/0x1ac __driver_attach+0xc4/0x1f0 bus_for_each_dev+0x104/0x160 driver_attach+0x24/0x34 bus_add_driver+0x14c/0x294 driver_register+0x68/0x104 __platform_driver_register+0x20/0x30 init_module+0x20/0xfe4 do_one_initcall+0x184/0x464 do_init_module+0x58/0x1ec load_module+0xefc/0x10c8 __arm64_sys_finit_module+0x238/0x33c invoke_syscall+0x58/0x10c el0_svc_common+0xa8/0xdc do_el0_svc+0x1c/0x28 el0_svc+0x50/0xac el0t_64_sync_handler+0x70/0xbc el0t_64_sync+0x1a8/0x1ac
Signed-off-by: Defa Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|
| 2b50719d | 13-Nov-2024 |
Billy Tsai <[email protected]> |
i3c: mipi-i3c-hci: Support SETDASA CCC
When the I3C subsystem wants to assign a dynamic address using the SETDASA CCC, it needs to attach the I3C device with device info that includes only the stati
i3c: mipi-i3c-hci: Support SETDASA CCC
When the I3C subsystem wants to assign a dynamic address using the SETDASA CCC, it needs to attach the I3C device with device info that includes only the static address. In the HCI, if the driver want to send this SETDASA CCC, a DAT entry is required to temporarily fill the device's static address into the dynamic address field. Afterward, the reattach API will be executed to update the DAT with the correct dynamic addrees value.
Signed-off-by: Billy Tsai <[email protected]> Reviewed-by: Jarkko Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
show more ...
|