Patch "i3c: mipi-i3c-hci: Fix number of DAT/DCT entries for HCI versions < 1.1" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    i3c: mipi-i3c-hci: Fix number of DAT/DCT entries for HCI versions < 1.1

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     i3c-mipi-i3c-hci-fix-number-of-dat-dct-entries-for-h.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f3598fb3f1c3ba3177a75d479a2d8897a2475527
Author: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
Date:   Fri Jun 14 17:02:08 2024 +0300

    i3c: mipi-i3c-hci: Fix number of DAT/DCT entries for HCI versions < 1.1
    
    [ Upstream commit be90ae1ba14a83962b33c4d4c854ef081186b0e4 ]
    
    I was wrong about the TABLE_SIZE field description in the
    commit 0676bfebf576 ("i3c: mipi-i3c-hci: Fix DAT/DCT entry sizes").
    
    For the MIPI I3C HCI versions 1.0 and earlier the TABLE_SIZE field in
    the registers DAT_SECTION_OFFSET and DCT_SECTION_OFFSET is indeed defined
    in DWORDs and not number of entries like it is defined in later versions.
    
    Where above fix allowed driver initialization to continue the wrongly
    interpreted TABLE_SIZE field leads variables DAT_entries being twice and
    DCT_entries four times as big as they really are.
    
    That in turn leads clearing the DAT table over the boundary in the
    dat_v1.c: hci_dat_v1_init().
    
    So interprete the TABLE_SIZE field in DWORDs for HCI versions < 1.1 and
    fix number of DAT/DCT entries accordingly.
    
    Fixes: 0676bfebf576 ("i3c: mipi-i3c-hci: Fix DAT/DCT entry sizes")
    Signed-off-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
    Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index d7e966a255833..4e7d6a43ee9b3 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -631,6 +631,7 @@ static irqreturn_t i3c_hci_irq_handler(int irq, void *dev_id)
 static int i3c_hci_init(struct i3c_hci *hci)
 {
 	u32 regval, offset;
+	bool size_in_dwords;
 	int ret;
 
 	/* Validate HCI hardware version */
@@ -654,11 +655,16 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->caps = reg_read(HC_CAPABILITIES);
 	DBG("caps = %#x", hci->caps);
 
+	size_in_dwords = hci->version_major < 1 ||
+			 (hci->version_major == 1 && hci->version_minor < 1);
+
 	regval = reg_read(DAT_SECTION);
 	offset = FIELD_GET(DAT_TABLE_OFFSET, regval);
 	hci->DAT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DAT_entries = FIELD_GET(DAT_TABLE_SIZE, regval);
 	hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8;
+	if (size_in_dwords)
+		hci->DAT_entries = 4 * hci->DAT_entries / hci->DAT_entry_size;
 	dev_info(&hci->master.dev, "DAT: %u %u-bytes entries at offset %#x\n",
 		 hci->DAT_entries, hci->DAT_entry_size, offset);
 
@@ -667,6 +673,8 @@ static int i3c_hci_init(struct i3c_hci *hci)
 	hci->DCT_regs = offset ? hci->base_regs + offset : NULL;
 	hci->DCT_entries = FIELD_GET(DCT_TABLE_SIZE, regval);
 	hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16;
+	if (size_in_dwords)
+		hci->DCT_entries = 4 * hci->DCT_entries / hci->DCT_entry_size;
 	dev_info(&hci->master.dev, "DCT: %u %u-bytes entries at offset %#x\n",
 		 hci->DCT_entries, hci->DCT_entry_size, offset);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux