public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin
@ 2024-08-29 21:13 Frank Li
  2024-08-29 21:13 ` [PATCH v4 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Frank Li
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:13 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li, Ravindra Yashvant Shinde,
	stable

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Changes in v4:
- See each patch
- Link to v3: https://lore.kernel.org/r/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com

Changes in v3:
- Fix build warning
kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Frank-Li/i3c-master-Remove-i3c_dev_disable_ibi_locked-olddev-on-device-hotjoin/20240814-234209
base:   41c196e567fb1ea97f68a2ffb7faab451cd90854
patch link:    https://lore.kernel.org/r/20240813-i3c_fix-v2-10-68fe4a050188%40nxp.com
patch subject: [PATCH v2 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step
config: x86_64-randconfig-161-20240817 (https://download.01.org/0day-ci/archive/20240818/202408180012.ifcIOjgX-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202408180012.ifcIOjgX-lkp@intel.com/

- Link to v2: https://lore.kernel.org/r/20240813-i3c_fix-v2-0-68fe4a050188@nxp.com

Changes in v2:
- add help function at i3c: master: svc: manually emit NACK/ACK for hotjoin F
Add below new fix patch
i3c: master: svc: fix possible assignment of the same address to two devices
i3c: master: svc: wait for Manual ACK/NACK Done before next step
i3c: master: svc: use spinlock_saveirq at svc_i3c_master_ibi_work()
i3c: master: svc: need check IBIWON for dynamtica address assign

- Link to v1: https://lore.kernel.org/r/20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com

---
Frank Li (11):
      i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin
      i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
      i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT
      i3c: master: Fix dynamic address leak when 'assigned-address' is present
      i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs()
      i3c: master: svc: use repeat start when IBI WIN happens
      i3c: master: svc: manually emit NACK/ACK for hotjoin
      i3c: master: svc: need check IBIWON for dynamtica address assign
      i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work()
      i3c: master: svc: wait for Manual ACK/NACK Done before next step
      i3c: master: svc: fix possible assignment of the same address to two devices

 drivers/i3c/master.c                | 100 +++++++++++++++++++++--------
 drivers/i3c/master/svc-i3c-master.c | 122 +++++++++++++++++++++++++++---------
 include/linux/i3c/master.h          |   9 ++-
 3 files changed, 175 insertions(+), 56 deletions(-)
---
base-commit: f2b9f0aeff2b3bb0446c955f0d8fac7659644c75
change-id: 20240724-i3c_fix-371bf8fa9e00

Best regards,
---
Frank Li <Frank.Li@nxp.com>


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v4 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
@ 2024-08-29 21:13 ` Frank Li
  2024-08-29 21:13 ` [PATCH v4 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS Frank Li
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:13 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li, Ravindra Yashvant Shinde

When a new device hotjoins, a new dynamic address is assigned.
i3c_master_add_i3c_dev_locked() identifies that the device was previously
attached to the bus and locates the olddev.

i3c_master_add_i3c_dev_locked()
{
    ...
    olddev = i3c_master_search_i3c_dev_duplicate(newdev);
    ...
    if (olddev) {
        ...
        i3c_dev_disable_ibi_locked(olddev);
        ^^^^^^
        The olddev should not receive any commands on the i3c bus as it
        does not exist and has been assigned a new address. This will
        result in NACK or timeout. So remove it.
    }

    i3c_dev_free_ibi_locked(olddev);
    ^^^^^^^^
    This function internally calls i3c_dev_disable_ibi_locked() function
    causing to send DISEC command with old Address.

    The olddev should not receive any commands on the i3c bus as it
    does not exist and has been assigned a new address. This will
    result in NACK or timeout. So, update the olddev->ibi->enabled
    flag to false to avoid DISEC with OldAddr.
}

Include part of Ravindra Yashvant Shinde's work:
https://lore.kernel.org/linux-i3c/20240820151917.3904956-1-ravindra.yashvant.shinde@nxp.com/T/#u

Fixes: 317bacf960a4 ("i3c: master: add enable(disable) hot join in sys entry")
Co-developed-by: Ravindra Yashvant Shinde <ravindra.yashvant.shinde@nxp.com>
Signed-off-by: Ravindra Yashvant Shinde <ravindra.yashvant.shinde@nxp.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- merge https://lore.kernel.org/linux-i3c/20240820151917.3904956-1-ravindra.yashvant.shinde@nxp.com/T/#u
- add Miquel Raynal review tag
- add Ravindra Yashvant Shinde 's signed-off
---
 drivers/i3c/master.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7028f03c2c42e..82f031928e413 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2039,11 +2039,16 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 			ibireq.max_payload_len = olddev->ibi->max_payload_len;
 			ibireq.num_slots = olddev->ibi->num_slots;
 
-			if (olddev->ibi->enabled) {
+			if (olddev->ibi->enabled)
 				enable_ibi = true;
-				i3c_dev_disable_ibi_locked(olddev);
-			}
-
+			/*
+			 * The olddev should not receive any commands on the
+			 * i3c bus as it does not exist and has been assigned
+			 * a new address. This will result in NACK or timeout.
+			 * So, update the olddev->ibi->enabled flag to false
+			 * to avoid DISEC with OldAddr.
+			 */
+			olddev->ibi->enabled = false;
 			i3c_dev_free_ibi_locked(olddev);
 		}
 		mutex_unlock(&olddev->ibi_lock);

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
  2024-08-29 21:13 ` [PATCH v4 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Frank Li
@ 2024-08-29 21:13 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Frank Li
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:13 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

Replace the hardcoded value 2, which indicates 2 bits for I3C address
status, with the predefined macro I3C_ADDR_SLOT_STATUS_BITS.

Improve maintainability and extensibility of the code.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v3 to v4
- rename to I3C_ADDR_SLOT_STATUS_BITS
---
 drivers/i3c/master.c       | 4 ++--
 include/linux/i3c/master.h | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 82f031928e413..2c9d45486ed8b 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -348,7 +348,7 @@ static enum i3c_addr_slot_status
 i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
 {
 	unsigned long status;
-	int bitpos = addr * 2;
+	int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS;
 
 	if (addr > I2C_MAX_ADDR)
 		return I3C_ADDR_SLOT_RSVD;
@@ -362,7 +362,7 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
 static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
 					 enum i3c_addr_slot_status status)
 {
-	int bitpos = addr * 2;
+	int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS;
 	unsigned long *ptr;
 
 	if (addr > I2C_MAX_ADDR)
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 074f632868d98..2fac4a45ec600 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -299,6 +299,8 @@ enum i3c_addr_slot_status {
 	I3C_ADDR_SLOT_STATUS_MASK = 3,
 };
 
+#define I3C_ADDR_SLOT_STATUS_BITS 2
+
 /**
  * struct i3c_bus - I3C bus object
  * @cur_master: I3C master currently driving the bus. Since I3C is multi-master
@@ -340,7 +342,7 @@ enum i3c_addr_slot_status {
 struct i3c_bus {
 	struct i3c_dev_desc *cur_master;
 	int id;
-	unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG];
+	unsigned long addrslots[((I2C_MAX_ADDR + 1) * I3C_ADDR_SLOT_STATUS_BITS) / BITS_PER_LONG];
 	enum i3c_bus_mode mode;
 	struct {
 		unsigned long i3c;

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
  2024-08-29 21:13 ` [PATCH v4 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Frank Li
  2024-08-29 21:13 ` [PATCH v4 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Frank Li
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

Extend the address status bit to 4 and introduce the I3C_ADDR_SLOT_EXT_INIT
macro to indicate that a device prefers a specific address. This is
generally set by the 'assigned-address' in the device tree source (dts)
file.

 ┌────┬─────────────┬───┬─────────┬───┐
 │S/Sr│ 7'h7E RnW=0 │ACK│ ENTDAA  │ T ├────┐
 └────┴─────────────┴───┴─────────┴───┘    │
 ┌─────────────────────────────────────────┘
 │  ┌──┬─────────────┬───┬─────────────────┬────────────────┬───┬─────────┐
 └─►│Sr│7'h7E RnW=1  │ACK│48bit UID BCR DCR│Assign 7bit Addr│PAR│ ACK/NACK│
    └──┴─────────────┴───┴─────────────────┴────────────────┴───┴─────────┘

Some master controllers (such as HCI) need to prepare the entire above
transaction before sending it out to the I3C bus. This means that a 7-bit
dynamic address needs to be allocated before knowing the target device's
UID information.

However, some I3C targets want a specific address (called as
"init_dyn_addr"), which is typically specified by the DT's assigned-address
property. (Lower addresses have higher IBI priority, and the target can
adjust this by using the assigned-address property if using DT). The
function i3c_master_add_i3c_dev_locked() will switch to this
"init_dyn_addr" if it is not in use.

Therefore, i3c_bus_get_free_addr() should return a free address that has
not been claimed by any target devices as "init_dyn_addr" (indicated by
I3C_ADDR_SLOT_EXT_INIT). This allows the device with the "init_dyn_addr"
to switch to its "init_dyn_addr" when it hot-joins the I3C bus. Otherwise,
if the "init_dyn_addr" is already in use by another I3C device, the target
device will not be able to switch to its desired address.

If all of above address are already used, i3c_bus_get_free_addr() return
one from the claimed as init_dyn_addr and free address slot. This ensures
support devices as much as possible.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- rewrite commit message and comment for i3c_bus_get_free_addr()
---
 drivers/i3c/master.c       | 68 ++++++++++++++++++++++++++++++++++++++++------
 include/linux/i3c/master.h |  7 +++--
 2 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 2c9d45486ed8b..1dad727e28435 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -345,7 +345,7 @@ const struct bus_type i3c_bus_type = {
 EXPORT_SYMBOL_GPL(i3c_bus_type);
 
 static enum i3c_addr_slot_status
-i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
+i3c_bus_get_addr_slot_status_ext(struct i3c_bus *bus, u16 addr)
 {
 	unsigned long status;
 	int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS;
@@ -356,11 +356,17 @@ i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
 	status = bus->addrslots[bitpos / BITS_PER_LONG];
 	status >>= bitpos % BITS_PER_LONG;
 
-	return status & I3C_ADDR_SLOT_STATUS_MASK;
+	return status & I3C_ADDR_SLOT_EXT_STATUS_MASK;
 }
 
-static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
-					 enum i3c_addr_slot_status status)
+static enum i3c_addr_slot_status
+i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
+{
+	return i3c_bus_get_addr_slot_status_ext(bus, addr) & I3C_ADDR_SLOT_STATUS_MASK;
+}
+
+static void i3c_bus_set_addr_slot_status_mask(struct i3c_bus *bus, u16 addr,
+					      enum i3c_addr_slot_status status, int mask)
 {
 	int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS;
 	unsigned long *ptr;
@@ -369,11 +375,22 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
 		return;
 
 	ptr = bus->addrslots + (bitpos / BITS_PER_LONG);
-	*ptr &= ~((unsigned long)I3C_ADDR_SLOT_STATUS_MASK <<
-						(bitpos % BITS_PER_LONG));
+	*ptr &= ~((unsigned long)mask << (bitpos % BITS_PER_LONG));
 	*ptr |= (unsigned long)status << (bitpos % BITS_PER_LONG);
 }
 
+static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
+					 enum i3c_addr_slot_status status)
+{
+	i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_STATUS_MASK);
+}
+
+static void i3c_bus_set_addr_slot_status_ext(struct i3c_bus *bus, u16 addr,
+					     enum i3c_addr_slot_status status)
+{
+	i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_EXT_STATUS_MASK);
+}
+
 static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr)
 {
 	enum i3c_addr_slot_status status;
@@ -383,11 +400,44 @@ static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr)
 	return status == I3C_ADDR_SLOT_FREE;
 }
 
+/*
+ * ┌────┬─────────────┬───┬─────────┬───┐
+ * │S/Sr│ 7'h7E RnW=0 │ACK│ ENTDAA  │ T ├────┐
+ * └────┴─────────────┴───┴─────────┴───┘    │
+ * ┌─────────────────────────────────────────┘
+ * │  ┌──┬─────────────┬───┬─────────────────┬────────────────┬───┬─────────┐
+ * └─►│Sr│7'h7E RnW=1  │ACK│48bit UID BCR DCR│Assign 7bit Addr│PAR│ ACK/NACK│
+ *    └──┴─────────────┴───┴─────────────────┴────────────────┴───┴─────────┘
+ * Some master controllers (such as HCI) need to prepare the entire above transaction before
+ * sending it out to the I3C bus. This means that a 7-bit dynamic address needs to be allocated
+ * before knowing the target device's UID information.
+ *
+ * However, some I3C targets want a specific address (called as "init_dyn_addr"), which is
+ * typically specified by the DT's assigned-address property. (Lower addresses have higher IBI
+ * priority, and the target can adjust this by using the assigned-address property if using DT).
+ * The function i3c_master_add_i3c_dev_locked() will switch to this "init_dyn_addr" if it is not
+ * in use.
+ *
+ * Therefore, i3c_bus_get_free_addr() should return a free address that has not been claimed by any
+ * target devices as "init_dyn_addr". This allows the device with the "init_dyn_addr" to switch to
+ * its "init_dyn_addr" when it hot-joins the I3C bus. Otherwise, if the "init_dyn_addr" is already
+ * in use by another I3C device, the target device will not be able to switch to its desired
+ * address.
+ *
+ * If all of above address are already used, i3c_bus_get_free_addr() return one from the claimed as
+ * init_dyn_addr and free address slot. This ensures support devices as much as possible.
+ */
 static int i3c_bus_get_free_addr(struct i3c_bus *bus, u8 start_addr)
 {
 	enum i3c_addr_slot_status status;
 	u8 addr;
 
+	for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) {
+		status = i3c_bus_get_addr_slot_status_ext(bus, addr);
+		if (status == I3C_ADDR_SLOT_FREE)
+			return addr;
+	}
+
 	for (addr = start_addr; addr < I3C_MAX_ADDR; addr++) {
 		status = i3c_bus_get_addr_slot_status(bus, addr);
 		if (status == I3C_ADDR_SLOT_FREE)
@@ -1906,9 +1956,9 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 			goto err_rstdaa;
 		}
 
-		i3c_bus_set_addr_slot_status(&master->bus,
-					     i3cboardinfo->init_dyn_addr,
-					     I3C_ADDR_SLOT_I3C_DEV);
+		i3c_bus_set_addr_slot_status_ext(&master->bus,
+						 i3cboardinfo->init_dyn_addr,
+						 I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT);
 
 		/*
 		 * Only try to create/attach devices that have a static
diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h
index 2fac4a45ec600..2c826d17eb571 100644
--- a/include/linux/i3c/master.h
+++ b/include/linux/i3c/master.h
@@ -284,7 +284,8 @@ enum i3c_bus_mode {
  * @I3C_ADDR_SLOT_I2C_DEV: address is assigned to an I2C device
  * @I3C_ADDR_SLOT_I3C_DEV: address is assigned to an I3C device
  * @I3C_ADDR_SLOT_STATUS_MASK: address slot mask
- *
+ * @I3C_ADDR_SLOT_EXT_INIT: the bitmask represents addresses that are preferred by some devices,
+ *			    such as the "assigned-address" property in a device tree source (DTS).
  * On an I3C bus, addresses are assigned dynamically, and we need to know which
  * addresses are free to use and which ones are already assigned.
  *
@@ -297,9 +298,11 @@ enum i3c_addr_slot_status {
 	I3C_ADDR_SLOT_I2C_DEV,
 	I3C_ADDR_SLOT_I3C_DEV,
 	I3C_ADDR_SLOT_STATUS_MASK = 3,
+	I3C_ADDR_SLOT_EXT_STATUS_MASK = 7,
+	I3C_ADDR_SLOT_EXT_INIT = BIT(2),
 };
 
-#define I3C_ADDR_SLOT_STATUS_BITS 2
+#define I3C_ADDR_SLOT_STATUS_BITS 4
 
 /**
  * struct i3c_bus - I3C bus object

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (2 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Frank Li
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li, stable

If the DTS contains 'assigned-address', a dynamic address leak occurs
during hotjoin events.

Assume a device have assigned-address 0xb.
  - Device issue Hotjoin
  - Call i3c_master_do_daa()
  - Call driver xxx_do_daa()
  - Call i3c_master_get_free_addr() to get dynamic address 0x9
  - i3c_master_add_i3c_dev_locked(0x9)
  -     expected_dyn_addr  = newdev->boardinfo->init_dyn_addr (0xb);
  -     i3c_master_reattach_i3c_dev(newdev(0xb), old_dyn_addr(0x9));
  -         if (dev->info.dyn_addr != old_dyn_addr &&
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0x9 -> TRUE
                (!dev->boardinfo ||
                 ^^^^^^^^^^^^^^^ ->  FALSE
                 dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) {
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 0xb != 0xb      ->  FALSE
                 ...
                 i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr,
                                                     I3C_ADDR_SLOT_FREE);
		 ^^^
                 This will be skipped. So old_dyn_addr never free
            }

  - i3c_master_get_free_addr() will return increased sequence number.

Remove dev->info.dyn_addr != dev->boardinfo->init_dyn_addr condition check.
dev->info.dyn_addr should be checked before calling this function because
i3c_master_setnewda_locked() has already been called and the target device
has already accepted dyn_addr. It is too late to check if dyn_addr is free
in i3c_master_reattach_i3c_dev().

Add check to ensure expected_dyn_addr is free before
i3c_master_setnewda_locked().

Fixes: cc3a392d69b6 ("i3c: master: fix for SETDASA and DAA process")
Cc: stable@kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change v3 to v4
- none
---
 drivers/i3c/master.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 1dad727e28435..7c8fc4378b979 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1556,16 +1556,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
 				       u8 old_dyn_addr)
 {
 	struct i3c_master_controller *master = i3c_dev_get_master(dev);
-	enum i3c_addr_slot_status status;
 	int ret;
 
-	if (dev->info.dyn_addr != old_dyn_addr &&
-	    (!dev->boardinfo ||
-	     dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) {
-		status = i3c_bus_get_addr_slot_status(&master->bus,
-						      dev->info.dyn_addr);
-		if (status != I3C_ADDR_SLOT_FREE)
-			return -EBUSY;
+	if (dev->info.dyn_addr != old_dyn_addr) {
 		i3c_bus_set_addr_slot_status(&master->bus,
 					     dev->info.dyn_addr,
 					     I3C_ADDR_SLOT_I3C_DEV);
@@ -1956,9 +1949,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 			goto err_rstdaa;
 		}
 
+		/* Not mark as occupied until real device exist in bus */
 		i3c_bus_set_addr_slot_status_ext(&master->bus,
 						 i3cboardinfo->init_dyn_addr,
-						 I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT);
+						 I3C_ADDR_SLOT_EXT_INIT);
 
 		/*
 		 * Only try to create/attach devices that have a static
@@ -2126,7 +2120,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master,
 	else
 		expected_dyn_addr = newdev->info.dyn_addr;
 
-	if (newdev->info.dyn_addr != expected_dyn_addr) {
+	if (newdev->info.dyn_addr != expected_dyn_addr &&
+	    i3c_bus_get_addr_slot_status(&master->bus, expected_dyn_addr) == I3C_ADDR_SLOT_FREE) {
 		/*
 		 * Try to apply the expected dynamic address. If it fails, keep
 		 * the address assigned by the master.

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs()
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (3 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 06/11] i3c: master: svc: use repeat start when IBI WIN happens Frank Li
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li, stable

if (dev->boardinfo && dev->boardinfo->init_dyn_addr)
                                      ^^^ here check "init_dyn_addr"
	i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, ...)
						             ^^^^
							free "dyn_addr"
Fix copy/paste error "dyn_addr" by replacing it with "init_dyn_addr".

Cc: stable@kernel.org
Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- mention copy/paste error
- Add Miquel's review tag
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 7c8fc4378b979..e7cbfaf13b599 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1467,7 +1467,7 @@ static void i3c_master_put_i3c_addrs(struct i3c_dev_desc *dev)
 					     I3C_ADDR_SLOT_FREE);
 
 	if (dev->boardinfo && dev->boardinfo->init_dyn_addr)
-		i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr,
+		i3c_bus_set_addr_slot_status(&master->bus, dev->boardinfo->init_dyn_addr,
 					     I3C_ADDR_SLOT_FREE);
 }
 

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 06/11] i3c: master: svc: use repeat start when IBI WIN happens
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (4 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Frank Li
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

There is a possibility of an IBI WIN occurring when addressing issues, even
when sending CCC commands. Most of the time, returning -EAGAIN is
acceptable, but the case below becomes highly complex.

When a Hotjoin event occurs:
- i3c_master_do_daa()
  - i3c_master_add_i3c_dev_locked()
    - A dynamic address (e.g., 0x9) is already set during DAA.
    - i3c_master_getpid_locked()
      - Another device issues HJ or IBI here. Returning -EAGAIN causes
        failure in adding the new device. However, the dynamic address(0x9)
        has already been assigned to this device. If another device issues
        HJ, it will get this address 0x9 again, causing two devices on the
        bus to use the same dynamic address 0x9.
      - Attempting to send RSTDAA when the first device fails at
        i3c_master_getpid_locked() could also fail when sending RSTDAA for
        the same reason.

According to the I3C spec, address arbitration only happens at START, never
at REPEAT start. Using repeat start when an IBI WIN occurs simplifies this
case, as i3c_master_getpid_locked() will not return an error when another
device tries to send HJ or IBI.

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- add miquel's ack tag
---
 drivers/i3c/master/svc-i3c-master.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 71a9359c5c794..ad999a1346686 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1099,6 +1099,24 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 		if (ret)
 			goto emit_stop;
 
+		/*
+		 * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a
+		 * Frame with I3C Target Address.
+		 *
+		 * The I3C Controller normally should start a Frame, the Address may be arbitrated,
+		 * and so the Controller shall monitor to see whether an In-Band Interrupt request,
+		 * a Controller Role Request (i.e., Secondary Controller requests to become the
+		 * Active Controller), or a Hot-Join Request has been made.
+		 *
+		 * If missed IBIWON check, the wrong data will be return. When IBIWON happen, issue
+		 * repeat start. Address arbitrate only happen at START, never happen at REPEAT
+		 * start.
+		 */
+		if (SVC_I3C_MSTATUS_IBIWON(reg)) {
+			writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
+			continue;
+		}
+
 		if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) {
 			/*
 			 * According to I3C Spec 1.1.1, 11-Jun-2021, section: 5.1.2.2.3.
@@ -1132,24 +1150,6 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 		}
 	}
 
-	/*
-	 * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a Frame
-	 * with I3C Target Address.
-	 *
-	 * The I3C Controller normally should start a Frame, the Address may be arbitrated, and so
-	 * the Controller shall monitor to see whether an In-Band Interrupt request, a Controller
-	 * Role Request (i.e., Secondary Controller requests to become the Active Controller), or
-	 * a Hot-Join Request has been made.
-	 *
-	 * If missed IBIWON check, the wrong data will be return. When IBIWON happen, return failure
-	 * and yield the above events handler.
-	 */
-	if (SVC_I3C_MSTATUS_IBIWON(reg)) {
-		ret = -EAGAIN;
-		*actual_len = 0;
-		goto emit_stop;
-	}
-
 	if (rnw)
 		ret = svc_i3c_master_read(master, in, xfer_len);
 	else

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (5 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 06/11] i3c: master: svc: use repeat start when IBI WIN happens Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign Frank Li
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

When the address is arbitrated at send address, the hardware can auto-send
NACK if it is an IBI. However, manual emission of NACK/ACK is needed for
hot join or controller request events.

Add help function svc_i3c_master_handle_ibi_won() to check event type and
send out NACK if the event is not an IBI.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- add Miquel review tag
---
 drivers/i3c/master/svc-i3c-master.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index ad999a1346686..122778b51c720 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -405,6 +405,24 @@ static void svc_i3c_master_nack_ibi(struct svc_i3c_master *master)
 	       master->regs + SVC_I3C_MCTRL);
 }
 
+static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 mstatus)
+{
+	u32 ibitype;
+
+	ibitype = SVC_I3C_MSTATUS_IBITYPE(mstatus);
+
+	writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
+
+	/* Hardware can't auto emit NACK for hot join and master request */
+	switch (ibitype) {
+	case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN:
+	case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST:
+		svc_i3c_master_nack_ibi(master);
+	}
+
+	return 0;
+}
+
 static void svc_i3c_master_ibi_work(struct work_struct *work)
 {
 	struct svc_i3c_master *master = container_of(work, struct svc_i3c_master, ibi_work);
@@ -1113,7 +1131,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 		 * start.
 		 */
 		if (SVC_I3C_MSTATUS_IBIWON(reg)) {
-			writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
+			svc_i3c_master_handle_ibi_won(master, reg);
 			continue;
 		}
 

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (6 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 09/11] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work() Frank Li
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

When sending REQUEST_PROC_DAA, emit START and address 7E. Address
arbitration may occur at this time if other devices trigger HJ, IBI, or
CR events.

When IBIWON happen during a REQUEST_PROC_DAA, NACK the IBI request then
send a repeated start to continue current dynamtica address assign.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- rework commit message
---
 drivers/i3c/master/svc-i3c-master.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 122778b51c720..9f456639d1aad 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -808,6 +808,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master,
 	int ret, i;
 
 	while (true) {
+		/* clean SVC_I3C_MINT_IBIWON w1c bits */
+		writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
+
 		/* SVC_I3C_MCTRL_REQUEST_PROC_DAA have two mode, ENTER DAA or PROCESS DAA.
 		 *
 		 * ENTER DAA:
@@ -859,6 +862,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master,
 			ret = svc_i3c_master_readb(master, data, 2);
 			if (ret)
 				break;
+		} else if (SVC_I3C_MSTATUS_IBIWON(reg)) {
+			svc_i3c_master_handle_ibi_won(master, reg);
+			continue;
 		} else if (SVC_I3C_MSTATUS_MCTRLDONE(reg)) {
 			if (SVC_I3C_MSTATUS_STATE_IDLE(reg) &&
 			    SVC_I3C_MSTATUS_COMPLETE(reg)) {

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 09/11] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work()
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (7 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step Frank Li
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5:

The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Phase of
I3C/I2C transfer. But maximum stall time is 100us. The IRQs have to be
disabled to prevent schedule during the whole I3C transaction, otherwise,
the I3C bus timeout may happen if any irq or schedule happen during
transaction.

Replace mutex with spin_lock_irqsave() to avoid stalling SCL more than
100us.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v3-v4
- improve commit message
- needn't mutex here, other place already use spin_lock_saveirq to protent
i3c transfer.
---
 drivers/i3c/master/svc-i3c-master.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 9f456639d1aad..2b000f446f1cc 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -432,7 +432,16 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
 	u32 status, val;
 	int ret;
 
-	mutex_lock(&master->lock);
+	/*
+	 * According to I3C spec ver 1.1, 09-Jun-2021, section 5.1.2.5:
+	 *
+	 * The I3C Controller shall hold SCL low while the Bus is in ACK/NACK Phase of I3C/I2C
+	 * transfer. But maximum stall time is 100us. The IRQs have to be disabled to prevent
+	 * schedule during the whole I3C transaction, otherwise, the I3C bus timeout may happen if
+	 * any irq or schedule happen during transaction.
+	 */
+	guard(spinlock_irqsave)(&master->xferqueue.lock);
+
 	/*
 	 * IBIWON may be set before SVC_I3C_MCTRL_REQUEST_AUTO_IBI, causing
 	 * readl_relaxed_poll_timeout() to return immediately. Consequently,
@@ -452,7 +461,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
 	       master->regs + SVC_I3C_MCTRL);
 
 	/* Wait for IBIWON, should take approximately 100us */
-	ret = readl_relaxed_poll_timeout(master->regs + SVC_I3C_MSTATUS, val,
+	ret = readl_relaxed_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, val,
 					 SVC_I3C_MSTATUS_IBIWON(val), 0, 1000);
 	if (ret) {
 		dev_err(master->dev, "Timeout when polling for IBIWON\n");
@@ -525,7 +534,6 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
 
 reenable_ibis:
 	svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART);
-	mutex_unlock(&master->lock);
 }
 
 static irqreturn_t svc_i3c_master_irq_handler(int irq, void *dev_id)

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (8 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 09/11] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work() Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-08-29 21:14 ` [PATCH v4 11/11] i3c: master: svc: fix possible assignment of the same address to two devices Frank Li
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li

Wait for the controller to complete emitting ACK/NACK, otherwise the next
command may be omitted by the hardware.

A "command done" check in svc_i3c_master_nack(ack)_ibi() and change the
return type to int to flag possible timeouts.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v3 to v4
- rework commit message
- add miquel's review tag
- directly return readl(...)
---
 drivers/i3c/master/svc-i3c-master.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 2b000f446f1cc..83b2943074866 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -384,10 +384,11 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
 	return 0;
 }
 
-static void svc_i3c_master_ack_ibi(struct svc_i3c_master *master,
+static int svc_i3c_master_ack_ibi(struct svc_i3c_master *master,
 				   bool mandatory_byte)
 {
 	unsigned int ibi_ack_nack;
+	u32 reg;
 
 	ibi_ack_nack = SVC_I3C_MCTRL_REQUEST_IBI_ACKNACK;
 	if (mandatory_byte)
@@ -396,18 +397,30 @@ static void svc_i3c_master_ack_ibi(struct svc_i3c_master *master,
 		ibi_ack_nack |= SVC_I3C_MCTRL_IBIRESP_ACK_WITHOUT_BYTE;
 
 	writel(ibi_ack_nack, master->regs + SVC_I3C_MCTRL);
+
+	return readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg,
+					 SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000);
+
 }
 
-static void svc_i3c_master_nack_ibi(struct svc_i3c_master *master)
+static int svc_i3c_master_nack_ibi(struct svc_i3c_master *master)
 {
+	int ret;
+	u32 reg;
+
 	writel(SVC_I3C_MCTRL_REQUEST_IBI_ACKNACK |
 	       SVC_I3C_MCTRL_IBIRESP_NACK,
 	       master->regs + SVC_I3C_MCTRL);
+
+	ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, reg,
+					SVC_I3C_MSTATUS_MCTRLDONE(reg), 1, 1000);
+	return ret;
 }
 
 static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 mstatus)
 {
 	u32 ibitype;
+	int ret = 0;
 
 	ibitype = SVC_I3C_MSTATUS_IBITYPE(mstatus);
 
@@ -417,10 +430,10 @@ static int svc_i3c_master_handle_ibi_won(struct svc_i3c_master *master, u32 msta
 	switch (ibitype) {
 	case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN:
 	case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST:
-		svc_i3c_master_nack_ibi(master);
+		ret = svc_i3c_master_nack_ibi(master);
 	}
 
-	return 0;
+	return ret;
 }
 
 static void svc_i3c_master_ibi_work(struct work_struct *work)
@@ -871,7 +884,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master,
 			if (ret)
 				break;
 		} else if (SVC_I3C_MSTATUS_IBIWON(reg)) {
-			svc_i3c_master_handle_ibi_won(master, reg);
+			ret = svc_i3c_master_handle_ibi_won(master, reg);
+			if (ret)
+				break;
 			continue;
 		} else if (SVC_I3C_MSTATUS_MCTRLDONE(reg)) {
 			if (SVC_I3C_MSTATUS_STATE_IDLE(reg) &&
@@ -1145,7 +1160,9 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 		 * start.
 		 */
 		if (SVC_I3C_MSTATUS_IBIWON(reg)) {
-			svc_i3c_master_handle_ibi_won(master, reg);
+			ret = svc_i3c_master_handle_ibi_won(master, reg);
+			if (ret)
+				goto emit_stop;
 			continue;
 		}
 

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v4 11/11] i3c: master: svc: fix possible assignment of the same address to two devices
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (9 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step Frank Li
@ 2024-08-29 21:14 ` Frank Li
  2024-09-26 17:02 ` [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
  2024-10-01 17:17 ` Frank Li
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-08-29 21:14 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Frank Li, stable

svc_i3c_master_do_daa() {
    ...
    for (i = 0; i < dev_nb; i++) {
        ret = i3c_master_add_i3c_dev_locked(m, addrs[i]);
        if (ret)
            goto rpm_out;
    }
}

If two devices (A and B) are detected in DAA and address 0xa is assigned to
device A and 0xb to device B, a failure in i3c_master_add_i3c_dev_locked()
for device A (addr: 0xa) could prevent device B (addr: 0xb) from being
registered on the bus. The I3C stack might still consider 0xb a free
address. If a subsequent Hotjoin occurs, 0xb might be assigned to Device A,
causing both devices A and B to use the same address 0xb, violating the I3C
specification.

The return value for i3c_master_add_i3c_dev_locked() should not be checked
because subsequent steps will scan the entire I3C bus, independent of
whether i3c_master_add_i3c_dev_locked() returns success.

If device A registration fails, there is still a chance to register device
B. i3c_master_add_i3c_dev_locked() can reset DAA if a failure occurs while
retrieving device information.

Cc: stable@kernel.org
Fixes: 317bacf960a4 ("i3c: master: add enable(disable) hot join in sys entry")
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
change from v3 to v4
- add comments about not check return value
- add miquel's review tag
---
 drivers/i3c/master/svc-i3c-master.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 83b2943074866..a520f5482b592 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1039,12 +1039,27 @@ static int svc_i3c_master_do_daa(struct i3c_master_controller *m)
 	if (ret)
 		goto rpm_out;
 
-	/* Register all devices who participated to the core */
-	for (i = 0; i < dev_nb; i++) {
-		ret = i3c_master_add_i3c_dev_locked(m, addrs[i]);
-		if (ret)
-			goto rpm_out;
-	}
+	/*
+	 * Register all devices who participated to the core
+	 *
+	 * If two devices (A and B) are detected in DAA and address 0xa is assigned to
+	 * device A and 0xb to device B, a failure in i3c_master_add_i3c_dev_locked()
+	 * for device A (addr: 0xa) could prevent device B (addr: 0xb) from being
+	 * registered on the bus. The I3C stack might still consider 0xb a free
+	 * address. If a subsequent Hotjoin occurs, 0xb might be assigned to Device A,
+	 * causing both devices A and B to use the same address 0xb, violating the I3C
+	 * specification.
+	 *
+	 * The return value for i3c_master_add_i3c_dev_locked() should not be checked
+	 * because subsequent steps will scan the entire I3C bus, independent of
+	 * whether i3c_master_add_i3c_dev_locked() returns success.
+	 *
+	 * If device A registration fails, there is still a chance to register device
+	 * B. i3c_master_add_i3c_dev_locked() can reset DAA if a failure occurs while
+	 * retrieving device information.
+	 */
+	for (i = 0; i < dev_nb; i++)
+		i3c_master_add_i3c_dev_locked(m, addrs[i]);
 
 	/* Configure IBI auto-rules */
 	ret = svc_i3c_update_ibirules(master);

-- 
2.34.1


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (10 preceding siblings ...)
  2024-08-29 21:14 ` [PATCH v4 11/11] i3c: master: svc: fix possible assignment of the same address to two devices Frank Li
@ 2024-09-26 17:02 ` Frank Li
  2024-09-30  9:34   ` Miquel Raynal
  2024-10-01 17:17 ` Frank Li
  12 siblings, 1 reply; 16+ messages in thread
From: Frank Li @ 2024-09-26 17:02 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Ravindra Yashvant Shinde, stable

On Thu, Aug 29, 2024 at 05:13:57PM -0400, Frank Li wrote:
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---

Alex:

https://lore.kernel.org/linux-i3c/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com/T/#m16fa9bb875b0ae9d37c5f6e91f90e375551c6366

There is some discuss about assiged address, I already explain the reason
and ping 3 times,

These patch are actual fixed hot join issues.

How move forward?

best regard
Frank Li

> Changes in v4:
> - See each patch
> - Link to v3: https://lore.kernel.org/r/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com
>
> Changes in v3:
> - Fix build warning
> kernel test robot noticed the following build warnings:
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Frank-Li/i3c-master-Remove-i3c_dev_disable_ibi_locked-olddev-on-device-hotjoin/20240814-234209
> base:   41c196e567fb1ea97f68a2ffb7faab451cd90854
> patch link:    https://lore.kernel.org/r/20240813-i3c_fix-v2-10-68fe4a050188%40nxp.com
> patch subject: [PATCH v2 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step
> config: x86_64-randconfig-161-20240817 (https://download.01.org/0day-ci/archive/20240818/202408180012.ifcIOjgX-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202408180012.ifcIOjgX-lkp@intel.com/
>
> - Link to v2: https://lore.kernel.org/r/20240813-i3c_fix-v2-0-68fe4a050188@nxp.com
>
> Changes in v2:
> - add help function at i3c: master: svc: manually emit NACK/ACK for hotjoin F
> Add below new fix patch
> i3c: master: svc: fix possible assignment of the same address to two devices
> i3c: master: svc: wait for Manual ACK/NACK Done before next step
> i3c: master: svc: use spinlock_saveirq at svc_i3c_master_ibi_work()
> i3c: master: svc: need check IBIWON for dynamtica address assign
>
> - Link to v1: https://lore.kernel.org/r/20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com
>
> ---
> Frank Li (11):
>       i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin
>       i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
>       i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT
>       i3c: master: Fix dynamic address leak when 'assigned-address' is present
>       i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs()
>       i3c: master: svc: use repeat start when IBI WIN happens
>       i3c: master: svc: manually emit NACK/ACK for hotjoin
>       i3c: master: svc: need check IBIWON for dynamtica address assign
>       i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work()
>       i3c: master: svc: wait for Manual ACK/NACK Done before next step
>       i3c: master: svc: fix possible assignment of the same address to two devices
>
>  drivers/i3c/master.c                | 100 +++++++++++++++++++++--------
>  drivers/i3c/master/svc-i3c-master.c | 122 +++++++++++++++++++++++++++---------
>  include/linux/i3c/master.h          |   9 ++-
>  3 files changed, 175 insertions(+), 56 deletions(-)
> ---
> base-commit: f2b9f0aeff2b3bb0446c955f0d8fac7659644c75
> change-id: 20240724-i3c_fix-371bf8fa9e00
>
> Best regards,
> ---
> Frank Li <Frank.Li@nxp.com>
>

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin
  2024-09-26 17:02 ` [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
@ 2024-09-30  9:34   ` Miquel Raynal
  2024-09-30 15:16     ` Frank Li
  0 siblings, 1 reply; 16+ messages in thread
From: Miquel Raynal @ 2024-09-30  9:34 UTC (permalink / raw)
  To: Frank Li
  Cc: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Conor Culhane,
	linux-i3c, linux-kernel, imx, Ravindra Yashvant Shinde, stable

Hi Frank,

Frank.li@nxp.com wrote on Thu, 26 Sep 2024 13:02:06 -0400:

> On Thu, Aug 29, 2024 at 05:13:57PM -0400, Frank Li wrote:
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---  
> 
> Alex:
> 
> https://lore.kernel.org/linux-i3c/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com/T/#m16fa9bb875b0ae9d37c5f6e91f90e375551c6366
> 
> There is some discuss about assiged address, I already explain the reason
> and ping 3 times,

Pinging will not help as long as the code is not clear and simplified.
I honestly think the PID should be retrieved earlier in the HCI part
and that would solve most of your issues.

Otherwise if that is not possible I still find hard to understand the
big picture, the comments and the code. I've already spent quite a bit
of time trying to improve it with you, but the logic is still a little
bit too specific and complex from my point of view.

> These patch are actual fixed hot join issues.

It should not be the case. Hot-join should work without the devices
having all the time the preferred address. If hot-join really does
not work, then please split the series with the "preferred address"
handling being done apart in a second series.

Thanks,
Miquèl

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin
  2024-09-30  9:34   ` Miquel Raynal
@ 2024-09-30 15:16     ` Frank Li
  0 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-09-30 15:16 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Conor Culhane,
	linux-i3c, linux-kernel, imx, Ravindra Yashvant Shinde, stable

On Mon, Sep 30, 2024 at 11:34:36AM +0200, Miquel Raynal wrote:
> Hi Frank,
>
> Frank.li@nxp.com wrote on Thu, 26 Sep 2024 13:02:06 -0400:
>
> > On Thu, Aug 29, 2024 at 05:13:57PM -0400, Frank Li wrote:
> > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > ---
> >
> > Alex:
> >
> > https://lore.kernel.org/linux-i3c/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com/T/#m16fa9bb875b0ae9d37c5f6e91f90e375551c6366
> >
> > There is some discuss about assiged address, I already explain the reason
> > and ping 3 times,
>
> Pinging will not help as long as the code is not clear and simplified.

The problem is that no reply after I posted last reply and ping 3 times
have not response about it.

> I honestly think the PID should be retrieved earlier in the HCI part
> and that would solve most of your issues.

If there are problem or difference opinion, we can continue to discuss it.
But no reply will stop the whole thing move forward.

I3C HCI Spec 1.2, sec 6.4.1, when do DAA,  "DAA CMD and dynmatic address"
queue to cmd together.  We don't know PID before DAA CMD. So dynmatic
address can NOT get based on PID.

If I am wrong about HCI, let me know since I have not worked HCI before.

>
> Otherwise if that is not possible I still find hard to understand the
> big picture, the comments and the code. I've already spent quite a bit
> of time trying to improve it with you, but the logic is still a little
> bit too specific and complex from my point of view.
>
> > These patch are actual fixed hot join issues.
>
> It should not be the case. Hot-join should work without the devices
> having all the time the preferred address. If hot-join really does
> not work, then please split the series with the "preferred address"
> handling being done apart in a second series.

I can do that, could you check svc part and most already acked you? I can
post svc part only later by addressing your comments if you have.

Frank

>
> Thanks,
> Miquèl

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin
  2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
                   ` (11 preceding siblings ...)
  2024-09-26 17:02 ` [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
@ 2024-10-01 17:17 ` Frank Li
  12 siblings, 0 replies; 16+ messages in thread
From: Frank Li @ 2024-10-01 17:17 UTC (permalink / raw)
  To: Alexandre Belloni, Boris Brezillon, Parshuram Thombare,
	Greg Kroah-Hartman, Boris Brezillon, Arnd Bergmann, Miquel Raynal,
	Conor Culhane
  Cc: linux-i3c, linux-kernel, imx, Ravindra Yashvant Shinde, stable

On Thu, Aug 29, 2024 at 05:13:57PM -0400, Frank Li wrote:
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---

Alex:

    you can superseded this serie. According to mirquel's suggestion,

I splitted into 4 parts:
	1. svc driver fix patches: https://lore.kernel.org/imx/ZvwpMBWzNjTXpPZF@lizhi-Precision-Tower-5810/T/#t
	2. i3c master fix patches with miquel's ack
	   a: https://lore.kernel.org/imx/20241001162608.224039-1-Frank.Li@nxp.com/T/#u
	   b: https://lore.kernel.org/imx/20241001162232.223724-1-Frank.Li@nxp.com/T/#u
	3. ongoing discussion on about dt assigne address:
	   https://lore.kernel.org/imx/20241001-i3c_dts_assign-v1-0-6ba83dc15eb8@nxp.com/T/#t

    I hope above help you manage these patches.

Frank

> Changes in v4:
> - See each patch
> - Link to v3: https://lore.kernel.org/r/20240819-i3c_fix-v3-0-7d69f7b0a05e@nxp.com
>
> Changes in v3:
> - Fix build warning
> kernel test robot noticed the following build warnings:
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Frank-Li/i3c-master-Remove-i3c_dev_disable_ibi_locked-olddev-on-device-hotjoin/20240814-234209
> base:   41c196e567fb1ea97f68a2ffb7faab451cd90854
> patch link:    https://lore.kernel.org/r/20240813-i3c_fix-v2-10-68fe4a050188%40nxp.com
> patch subject: [PATCH v2 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step
> config: x86_64-randconfig-161-20240817 (https://download.01.org/0day-ci/archive/20240818/202408180012.ifcIOjgX-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202408180012.ifcIOjgX-lkp@intel.com/
>
> - Link to v2: https://lore.kernel.org/r/20240813-i3c_fix-v2-0-68fe4a050188@nxp.com
>
> Changes in v2:
> - add help function at i3c: master: svc: manually emit NACK/ACK for hotjoin F
> Add below new fix patch
> i3c: master: svc: fix possible assignment of the same address to two devices
> i3c: master: svc: wait for Manual ACK/NACK Done before next step
> i3c: master: svc: use spinlock_saveirq at svc_i3c_master_ibi_work()
> i3c: master: svc: need check IBIWON for dynamtica address assign
>
> - Link to v1: https://lore.kernel.org/r/20240724-i3c_fix-v1-0-bfa500b023d6@nxp.com
>
> ---
> Frank Li (11):
>       i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin
>       i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS
>       i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT
>       i3c: master: Fix dynamic address leak when 'assigned-address' is present
>       i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs()
>       i3c: master: svc: use repeat start when IBI WIN happens
>       i3c: master: svc: manually emit NACK/ACK for hotjoin
>       i3c: master: svc: need check IBIWON for dynamtica address assign
>       i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work()
>       i3c: master: svc: wait for Manual ACK/NACK Done before next step
>       i3c: master: svc: fix possible assignment of the same address to two devices
>
>  drivers/i3c/master.c                | 100 +++++++++++++++++++++--------
>  drivers/i3c/master/svc-i3c-master.c | 122 +++++++++++++++++++++++++++---------
>  include/linux/i3c/master.h          |   9 ++-
>  3 files changed, 175 insertions(+), 56 deletions(-)
> ---
> base-commit: f2b9f0aeff2b3bb0446c955f0d8fac7659644c75
> change-id: 20240724-i3c_fix-371bf8fa9e00
>
> Best regards,
> ---
> Frank Li <Frank.Li@nxp.com>
>

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-10-01 17:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29 21:13 [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
2024-08-29 21:13 ` [PATCH v4 01/11] i3c: master: Remove i3c_dev_disable_ibi_locked(olddev) on device hotjoin Frank Li
2024-08-29 21:13 ` [PATCH v4 02/11] i3c: master: Replace hard code 2 with macro I3C_ADDR_SLOT_STATUS_BITS Frank Li
2024-08-29 21:14 ` [PATCH v4 03/11] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT Frank Li
2024-08-29 21:14 ` [PATCH v4 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Frank Li
2024-08-29 21:14 ` [PATCH v4 05/11] i3c: master: Fix miss free init_dyn_addr at i3c_master_put_i3c_addrs() Frank Li
2024-08-29 21:14 ` [PATCH v4 06/11] i3c: master: svc: use repeat start when IBI WIN happens Frank Li
2024-08-29 21:14 ` [PATCH v4 07/11] i3c: master: svc: manually emit NACK/ACK for hotjoin Frank Li
2024-08-29 21:14 ` [PATCH v4 08/11] i3c: master: svc: need check IBIWON for dynamtica address assign Frank Li
2024-08-29 21:14 ` [PATCH v4 09/11] i3c: master: svc: use spin_lock_irqsave at svc_i3c_master_ibi_work() Frank Li
2024-08-29 21:14 ` [PATCH v4 10/11] i3c: master: svc: wait for Manual ACK/NACK Done before next step Frank Li
2024-08-29 21:14 ` [PATCH v4 11/11] i3c: master: svc: fix possible assignment of the same address to two devices Frank Li
2024-09-26 17:02 ` [PATCH v4 00/11] i3c: master: some fix and improvemnt for hotjoin Frank Li
2024-09-30  9:34   ` Miquel Raynal
2024-09-30 15:16     ` Frank Li
2024-10-01 17:17 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox