From patchwork Thu Sep 21 05:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58067CD4959 for ; Thu, 21 Sep 2023 05:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uef3pN3ybY9FGPyJ5RIbe/kuhewien5Z4iGx3BXIjYs=; b=e7ccurwR8qbrJa XXosM3RjkYu9Tv/v3Vf5uOTu1muYVTO9DPPeGyf4wZShXQxVBgtrtn6M/0wFjfaAxLap8vhFODggd pIzy1X/Fjn4Y09z1TBnRKNUgtUj9R4DykS+UjIFNYyGXSSrmRGIkug3k9fWGaS28PEmFehoFYxoCT fPgmyf/s8/Hc7f1I7G/ZdRDX064l48FogjFb1n5NLYHNM6uCoDYhQVdkYDUXcGZdDur+sKdviQ0LK vzOoZ/b3/oEfZCJFhzMH5lhyt55yZ99p3CIUrNfQu9ZTbqUuQwcy2KMoVF0/+QPoXaCeKNXYW3T5E x5joWObdCWADxEU7KQ1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChW-005Dsz-0B; Thu, 21 Sep 2023 05:58:10 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChT-005Dqh-1X for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275887; x=1726811887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/SeISXjWIzeIA7EW8mGJyfsIPDJVFu9ZBzVproLzXzk=; b=SfTpTt7KfmXkagD1pEi6Ct5luyOI2ehxpsXimnnC6qf+ILnlxvep7Etd dfJhIxeg6SV7RnoO1N7tKgORl2H6nCb8slkfgDGPTW4J/MAlpPhAI3DOd uv/ZfuRquk/EYuUoaiP2Vmf4ln9CiW27Ir8DqyeYo5g7vet+XcpLUMHmN PUYLI1epLV7D8+a4h04xI5+X4p0LV71tEhTtRddFMkQPtotjF7RH1inOY 4wyUFm8t55DrYb0u9/XDbJ/HOuHkRQXNH5dD/TwsjiQWaUk+5LYnLw5+c akZStsc4UxW23q1NbuZsLUoHy3df8xDBmQibvolTDTLc/j+MGMfsj/0uw A==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678485" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678485" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771233" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771233" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:57:53 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 01/12] i3c: master: Inherit DMA masks and parameters from parent device Date: Thu, 21 Sep 2023 08:56:53 +0300 Message-Id: <20230921055704.1087277-2-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225807_523973_448A8AA7 X-CRM114-Status: UNSURE ( 8.25 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Copy the DMA masks and parameters for an I3C master device from parent device so that the master device has them set for the DMA buffer and mapping API. Signed-off-by: Jarkko Nikula --- drivers/i3c/master.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 87283e4a4607..401380c17156 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2629,6 +2629,10 @@ int i3c_master_register(struct i3c_master_controller *master, device_initialize(&master->dev); dev_set_name(&master->dev, "i3c-%d", i3cbus->id); + master->dev.dma_mask = parent->dma_mask; + master->dev.coherent_dma_mask = parent->coherent_dma_mask; + master->dev.dma_parms = parent->dma_parms; + ret = of_populate_i3c_bus(master); if (ret) goto err_put_dev; From patchwork Thu Sep 21 05:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11037CD4958 for ; Thu, 21 Sep 2023 05:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=G67bNzin6zTGMPrJoD21Vp+v17tuMWnxmnzNnSYtNtY=; b=Kg7WlakkbmL5WH BpCHHrwuRLixz0ERm/XwPLxJghSwfZdNAI4llSaKDj3N1VT4JqDhIk9QD8gBNAiy1B9YsYNWA5hX0 TF9xMW8bqV0DVYtvQZDxKuzrcK1eFeBQJds8LqG3JmQO5sRTBzUxuuNLbcm7LSj50VTzGS1rLfdXj uc4LwmLP61Vk3xvpTddvF9WR+QsbJfvxlr3dDCCsjgUEwfeq6riy0ti3gpZrV1Q2wHrHR70Kxvx4H kdKeah4Ay80/ec5wSrDQ9XPWbNl0VUBZ0AeCr59XrIsUPvL+tYvAl+g2qX6Hrsp9hmwunjVasAt/o +nD2rkHx0W5g+OZVQk1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChU-005DrX-27; Thu, 21 Sep 2023 05:58:08 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChS-005Dq5-1M for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275886; x=1726811886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0SpDm6JAqzdnGb98XVXF0fEr2pRDWo0lXrssUg7yu7o=; b=UizzP8a3uoIIK9zNzqzhym26eVz36lKOVRG97zzvCL1z6BQZ8LNIbofZ RyAN08ZZRXsjV0LhbtvSJ5wKIxxwQFIdAGSK23HDMgqFEeCi/at5g2n64 39Kv3LtuW6Zi9LWxxwuwuj4eit2kDbPPEBZGpX2oCK0rRBeCGZJsuUGeL V1fzH15WpMPvNg0BzbEMLqnOAJ0Dv0hTNoMOmAxdTGrCJ8RkDsdqJczrT h0Lq6NTJMo9P5uLKtXEglj8kSlU+MP8DL/9c1+QlpxTY/vVNhSV5yXQht UMx6mup1T13OtrYe1ckKFuPYgnzFJ2gqQFM1VNNmgJpnGoCTbj4utPkdz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678482" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678482" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771255" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771255" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:57:54 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 02/12] i3c: mipi-i3c-hci: Add MODULE_ALIAS Date: Thu, 21 Sep 2023 08:56:54 +0300 Message-Id: <20230921055704.1087277-3-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225806_490340_07891172 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Add MODULE_ALIAS() in order to be able to autoload this driver when the device is added as a platform device from another glue code driver. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 837af83c85f4..8f43ad81fbfd 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -787,6 +787,7 @@ static struct platform_driver i3c_hci_driver = { }, }; module_platform_driver(i3c_hci_driver); +MODULE_ALIAS("platform:mipi-i3c-hci"); MODULE_AUTHOR("Nicolas Pitre "); MODULE_DESCRIPTION("MIPI I3C HCI driver"); From patchwork Thu Sep 21 05:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B5D9CD495B for ; Thu, 21 Sep 2023 05:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+h6BLFocXQk+1R261HXVd+um8MKMEu/Ck0qqK1GhZiA=; b=NjALeyio1IuT9N y+3SjzhQ8S8Oh+kimW1YLXiUO0IrxK0RXp/xq3mxLD+VqjyLPRCvSP4fbuZ+Dj2/XjXQDDUiTUx25 79Ng6Fcmx+bJuQZ2ZX7yqgd8UPurtmD296qmpFSZTtkNyvAFvO9XCY/cpK4Ir2vU7xvyR9OmauhGC 0bfeztmrH1aKWG/m/7OBsw5WIIGlpJCQ+p1eUe3FJEIr6kTQOLqJCPB4WS0V7nf8s+EDhjNA+/sHh RFYrSzSXBZgQUR5NNc55q4Rv5Aaxpl1Z2ndM7BflJiVcSkTcnScC3WAHYFB1R6YgOz6EEhDiSMaKV 6nC2/+3OyZ6NLvuAFNTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChY-005DvY-0f; Thu, 21 Sep 2023 05:58:12 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChU-005Dqh-2T for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275888; x=1726811888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sHwG0LRCGJTQwEECNZVlE5NOiPMorvt1Jj23oTd57hU=; b=O0KMnYI6vbQ37mBkw6qsoN9iLMrqwp/WZcu/MFuvPPrcT7kvgYEKbwVB emHbh79AA8Zoe9UI9edpH26VestZXnlyXj1sHhu4HIbdmaJ34L8ZXWsPl NhDrf6P5UZAb4ppnSs2lU6psKz0qghcqvo9caoRVU+NbVQZYav0q8q+wt +KKZXRYROGwpX+wwuhvY0HLbvGVqpW4mgzED3Oixd9jNaNRuB57D0NFyJ zCgM6Dx4uZYRcJKD+IzhhbgQPBfc3Z5t8DbGgM29UVXojf/ICF6PJkv5i sKHRrwWNZNZPe5iHdol9vydxIvy1oTM1Ic3NZGbn9/hJkZpPzpVgqQDQx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678491" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678491" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771257" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771257" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:57:56 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 03/12] i3c: mipi-i3c-hci: Fix DAT/DCT entry sizes Date: Thu, 21 Sep 2023 08:56:55 +0300 Message-Id: <20230921055704.1087277-4-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225808_820445_279FCD93 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org MIPI I3C HCI specification v1.1 describes the ENTRY_SIZE field for the Device Address Table (DAT) and the Device Characteristics Table (DCT) section offset registers (DAT_SECTION_OFFSET and DCT_SECTION_OFFSET). That field is not documented in earlier version. ENTRY_SIZE value 0 is meant to be backward compatible. For the DAT entry size it is interpreted as 2 DWORDs (8-bytes) and for the DCT entry size as 4 DWORDs (16-bytes). Values 1-15 are reserved for future use. New version I believe fixes also the TABLE_SIZE field description. Before it was defined in DWORDs which I believe is incorrect since the DAT/DCT table entry structures, and sizes, are described having 8-bytes/16-bytes entries. This is more clear in the specification v1.1 which states the TABLE_SIZE fields are interpreted as number of entries in the DAT/DCT tables. I believe this same holds also in earlier version, at least it makes more sense. Fix code accordingly and let the DAT_entry_size and the DCT_entry_size variables carry the size as bytes. Which is how it is already interpreted in the dat_v1.c: hci_dat_v1_init(). Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 8f43ad81fbfd..76a3e6bb3665 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -610,17 +610,17 @@ static int i3c_hci_init(struct i3c_hci *hci) 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); + hci->DAT_entry_size = FIELD_GET(DAT_ENTRY_SIZE, regval) ? 0 : 8; dev_info(&hci->master.dev, "DAT: %u %u-bytes entries at offset %#x\n", - hci->DAT_entries, hci->DAT_entry_size * 4, offset); + hci->DAT_entries, hci->DAT_entry_size, offset); regval = reg_read(DCT_SECTION); offset = FIELD_GET(DCT_TABLE_OFFSET, regval); 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); + hci->DCT_entry_size = FIELD_GET(DCT_ENTRY_SIZE, regval) ? 0 : 16; dev_info(&hci->master.dev, "DCT: %u %u-bytes entries at offset %#x\n", - hci->DCT_entries, hci->DCT_entry_size * 4, offset); + hci->DCT_entries, hci->DCT_entry_size, offset); regval = reg_read(RING_HEADERS_SECTION); offset = FIELD_GET(RING_HEADERS_OFFSET, regval); From patchwork Thu Sep 21 05:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D061CCD495A for ; Thu, 21 Sep 2023 05:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gTjb+P4z6ZcvQDCDssS+hgWnOWnPxK3Jr1JcKGQBIDg=; b=w4TYY3FI76wjwm 0/kS9zZHmNdzRAdO7feI5ueMn29i4ByuBlIa5TIpKYLgHMdkOGDvOD4ByyurePid35xtA2qlMBgii /WqPfQLEGdrWKviz+T09+4dDv5O5Ju8ktzHUVxkgY8x1suHO/TT/xoHmh038Ri89lS/8ZqYMQU/qW GoyvnmbekrB3QbrG8x+yCjkkgSm2icoLbxiQVC0H9eEgevXTRX9x1nHc54UvoKPtS9y+BSPtojbKj 2NGelwctz76GbPOHWikxS+BQMTKpcuNJ6d+LZcmYM1vLxpXlK9TdbKe5gF7Rr/MoYO2inZ+Qthqy8 6qCcm33FHD6jWxS0lZ4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChW-005DtV-1O; Thu, 21 Sep 2023 05:58:10 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChT-005Dq5-26 for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275887; x=1726811887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aan0m4dvxCeGfdoUNPICCR2zLhKGXEacwX5sFFmGqY4=; b=SMKG6gxgc9KaAK2vWivZyVgHs0SlMbrVn7FKIxv6+tqy0NYBGvkkNfkN ang1ZHXijW7Qt7k+v+y9cF9zTJ12W+Vuk11py4mQrTMTO1zuDMJF4QNoR 6G2Pnu3NY1EzxCn0gRVkRQsJrnFREzEePXkMk6WmXmPjl97h3k1U11BzD g7mlL5Cx8L2QEl/HtkeFxgEbmXx4gHfrOktwMBTYlEu+mL++t2YZq8v0r o0Rh0j61OTbMpDo/N1alkE3RwfNUF9TuUGZ5g62SZ1bLcfZWJnmdeliER H2VUJho229vxO6CCfBrQ1YHNv+Xo+yiK8ziILdR9bsgT44RUBw9qF51lc g==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678487" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678487" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771259" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771259" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:57:58 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 04/12] i3c: mipi-i3c-hci: Fix out of bounds access in hci_dma_irq_handler Date: Thu, 21 Sep 2023 08:56:56 +0300 Message-Id: <20230921055704.1087277-5-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225807_719978_819F49F6 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Do not loop over ring headers in hci_dma_irq_handler() that are not allocated and enabled in hci_dma_init(). Otherwise out of bounds access will occur from rings->headers[i] access when i >= number of allocated ring headers. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index 2990ac9eaade..71b5dbe45c45 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -734,7 +734,7 @@ static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask) unsigned int i; bool handled = false; - for (i = 0; mask && i < 8; i++) { + for (i = 0; mask && i < rings->total; i++) { struct hci_rh_data *rh; u32 status; From patchwork Thu Sep 21 05:56:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3D4CCD4959 for ; Thu, 21 Sep 2023 05:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=59JqQKvq0xBut97jRZ0If1gC3zxNNxXV1ihqhu+RTLU=; b=yDvvISNRFGIeHO Ju3PqTLn1FnQibPfGbO3WH2eqsm52C+XDmwUAQqv3k2BdDOKIbQFjGLFNeWtTPHfVj1Kz8aYzyVsU tuvAnB4EMajDPaxO6mMwEqIuU3CUlS/hbDD5CVM9o/Anwr3/e+xRSKE5dmSfZu0Y6s+gcMJrID/n3 Y9Zvb/sSG6xbGvyXGjG9NRV5dRaYKSRHsQQVS/T2Y69X5livzIMWWiSUDtnvFq6jlUdf9V4eM/MdU TnbjvmmvFVgA9iVCTYtd75S+C62AHtjviVEGEUPiHoYiNc5yEnEg/TrkdYHcj+wqFfoPsWLy+1kRk WCww7SNeo70M+J/br0qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChY-005Dvn-1Z; Thu, 21 Sep 2023 05:58:12 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChU-005Dq5-2z for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275888; x=1726811888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n7TnChVZZDKyvjDqT1im7V8qwHEQethEb4GulsQ10/0=; b=UBYLUqFc1IgaIK+TY1X1xx3EYrM+jzr6rAwycY5IXyiuHvar3dBWaQpL 9mgVfz44QEiF4NGNF2/8b8w4t+XRLfcZ46PQ98LLzeQdWwuQywCdeqtwz gaIhYqou/DnouLc3j/Sazdrj2/pDXJrdazLjyQMeVIg1TXa7BwjOkxTaR FXDlPo4JsR5VUT0Cu5XEAaqcZbbdJc7yJVBmYo6dIClJMSbSXeWNVGoqx PtE0Mx4dlMv/QiDLqKm+4I2cI8ouI1+e/Um0NY6953pFP7aHeGkru9mdG u2vzDSQ7SACau72pahWPd5tLw0eeSwQ8ZkKurnGSqHkbITHwlktZcx80i Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678497" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678497" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771262" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771262" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:57:59 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 05/12] i3c: mipi-i3c-hci: Remove BUG() when Ring Abort request times out Date: Thu, 21 Sep 2023 08:56:57 +0300 Message-Id: <20230921055704.1087277-6-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225809_026264_EB85E29A X-CRM114-Status: GOOD ( 10.43 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Ring Abort request will timeout in case there is an error in the Host Controller interrupt delivery or Ring Header configuration. Using BUG() makes hard to debug those cases. Make it less severe and turn BUG() to WARN_ON(). Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index 71b5dbe45c45..a28ff177022c 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -450,10 +450,9 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci, /* * We're deep in it if ever this condition is ever met. * Hardware might still be writing to memory, etc. - * Better suspend the world than risking silent corruption. */ dev_crit(&hci->master.dev, "unable to abort the ring\n"); - BUG(); + WARN_ON(1); } for (i = 0; i < n; i++) { From patchwork Thu Sep 21 05:56:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32CECCD495C for ; Thu, 21 Sep 2023 05:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2RPtJimTpSVTv6JOmF3HaAcF2/G3MkQII33AkBNYTco=; b=VZANIED0Yl4sxf cV3yD7Ps6W0qL8hhkxHWL9Yvu1uRUQ2sJ8zvX/nmRXH+m1QjgcWD752Oam0POmnI4DmzCyhmW1YsJ bS96W9VKDtqqdPHoWS+KgRUJpJaWMIP62Q9c46q7eiHMKgwgCp9TmubwYVderr1cGp/O7oevEL78n /kYqkEmhRBK2NkHd5RGillG7QKRIDl8W5NJU6YR0MkXhmTowshhpFPf0sMe068YahjTgvPRQQ1KiR kNE1MEqNaHj0YpUopzOzoobaW6PV0ctuCkwxKajUNrPTJemOcr6jjg/8eUP5HCLdIOS+Fae4ZZDMi uSFhsDg5r39r2IoS8XDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChX-005DvE-2o; Thu, 21 Sep 2023 05:58:11 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChU-005DrZ-2a for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275888; x=1726811888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hP+81XG99C4zI6YFJe+jxjjbNgZrxEATM1Ajkd2nx5Q=; b=dX4dfg8kE5kZN9gIMqruFw11V4ydhVFFDiqCBqnN4Dw7fo73H9QbkEuB LaRBx7AQLHupl8FkMcJi9iCWq4l6a/JVnXbF6mY9XiICj3HMp4KCGkoqg JDZQS/TT1kPGwULZU6D7T9S+4OzEhWuapYktWXMHs0Xc8/vHRf1zwqMxC //7WTGNN/mzgJAj/O7oh9lO6QB+LtXOIoLD0pKNwLVgyEaU1+CFdkhdyY B5/AxoURBANeZ87uyMIySO6hdtJbspP3F/vZKZFFgldimhVfzi8Jcx68S 2DU51bNKHTSnhfVAR9xGIPCZwvMVMYQ3aj36k3W43yqfCV4F3lI22mCo2 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678494" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678494" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771267" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771267" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:01 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 06/12] i3c: mipi-i3c-hci: Set ring start request together with enable Date: Thu, 21 Sep 2023 08:56:58 +0300 Message-Id: <20230921055704.1087277-7-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225808_870009_C4F017EC X-CRM114-Status: UNSURE ( 8.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Set ring start request together with ring enable in hci_dma_init(). This causes the ring abort request in hci_dma_dequeue_xfer() will raise the INTR_RING_OP (RING_OP_STAT in MIPI I3C HCI specification) interrupt in the RH_INTR_STATUS register. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index a28ff177022c..df569d1351be 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -325,7 +325,8 @@ static int hci_dma_init(struct i3c_hci *hci) rh_reg_write(INTR_SIGNAL_ENABLE, regval); ring_ready: - rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE); + rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE | + RING_CTRL_RUN_STOP); } regval = FIELD_PREP(MAX_HEADER_COUNT, rings->total); From patchwork Thu Sep 21 05:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AA92CD4958 for ; Thu, 21 Sep 2023 05:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fi2UiRRdVhPBGgkdVrHjhYwlB9r5p8H6j8aOaqsMRy4=; b=TuSByGj6B4Ue90 TZz11RW6nWEo/GGyMPOIK+jRrwguamf2EOgobYdm90+1sN74NGS+5pl+drysFe4lMRqq+4fG/ivZO 4LSBqrUig3JfJD1bJjKgM//ss7em+BZUaIITnkcRWQA7KGI44Lmf3zRltCfrY5AMjPBH09cAyS92X WYIlbEp0SGmxfZFx4KtBxH16qMCdBkG5N/qnsFwUy4t4Y0z7H8DnoPeeSgMHLo3EDAJrfsQmdl350 BIafd0b3HHCzx91IxBIPwQ7aMN+7G085r2dvRlPpXl+8cHPBwldztN1AXOL5t9nNviz6N3kRJVOy5 EhxaVzEhnereGnVPu7cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjCha-005Dwz-0H; Thu, 21 Sep 2023 05:58:14 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChW-005DrZ-0T for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275890; x=1726811890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U5inNHpnc+RZt+M0IJnqIW8hyk2cqJ+ZZxi5amaaubw=; b=VrI5hDsrx/bINAGgYwNTvVXKDnx3h6ekzDigJuiBS759N0TsL0y7fVyb IaPYDHV8gEqAOxAZRciPNrjhhw/RPaAijZyOsl4ANE8IP/FpTxJAS3Hyq Q7Ux7U8x2VsVHisd9uSwp6WXX5YyqhNCQ0a21mZqMPX0gnjHC+L8bB4km KhsPCgnrPW2cJHkxJSnpfCBf1WXLJbCYV0kymR3ESzzXv8qenx1Gdfgk2 QUo9gW51UHvKkWjeWH31jjsYUjOHk4ebXEHA3FDw3pjPegREFURflnU3+ UXR1aHZdJcDIlmvnmI79sRoNA7XgpvINmV90HacuLD131/awtI81G96jr g==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678498" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678498" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771271" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771271" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:02 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 07/12] i3c: mipi-i3c-hci: Fix race between bus cleanup and interrupt Date: Thu, 21 Sep 2023 08:56:59 +0300 Message-Id: <20230921055704.1087277-8-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225810_204476_31847FBA X-CRM114-Status: GOOD ( 10.06 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org If there is a transfer error during i3c_master_bus_init() and code goes doing the bus cleanup in i3c_hci_bus_cleanup() there is possibility that i3c_hci_irq_handler() is running in parallel with hci->io->cleanup() which can be racy. Prevent this by waiting there is no pending interrupt on other CPU before doing the IO cleanup. This was observed with ring headers where first transfer failed and sometimes transfer error or ring transfer abort interrupt was coming simultaneously with the bus cleanup path. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 76a3e6bb3665..d7fe8e62820a 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -161,10 +161,12 @@ static int i3c_hci_bus_init(struct i3c_master_controller *m) static void i3c_hci_bus_cleanup(struct i3c_master_controller *m) { struct i3c_hci *hci = to_i3c_hci(m); + struct platform_device *pdev = to_platform_device(m->dev.parent); DBG(""); reg_clear(HC_CONTROL, HC_CONTROL_BUS_ENABLE); + synchronize_irq(platform_get_irq(pdev, 0)); hci->io->cleanup(hci); if (hci->cmd == &mipi_i3c_hci_cmd_v1) mipi_i3c_hci_dat_v1.cleanup(hci); From patchwork Thu Sep 21 05:57:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393658 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4AE8CD495C for ; Thu, 21 Sep 2023 05:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QqqNNPDLPFHPeA82cPTYXo91gEtuqWNN5tAJ3ljPbLI=; b=TIq9BP3zOwKvLD F62bdRY58aeLv1hsuOaKMwNYgms5uhx2gP9vhUQI2L6mRrnRiucvvpoBHciGKva6PXIzNbwxNhTCd UP3+F199st9ywt9Xdn9zXQ6HqOW4Y7mKBhNvfcZTWRJSuRa6wSXtXmnqjrozFZDhpWuj8aMVqn1NJ 436hQVZc7AguSbTPtgnRK5LaocRyhwX8NQcjWJCW+WgkF6VI72r0ll6XNBG37M235dr32T5+3rrQZ Fr6g8i/XNwhpj9acuwbEgj7Nws+OSyT/g8+8s/pk8zv48NXH75MTGrx+BSipkXfLPRhAO112zJ+Ky yrWVVcPm2ktK3SB5e3KQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjCha-005DxO-1H; Thu, 21 Sep 2023 05:58:14 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChW-005Dqh-0z for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275890; x=1726811890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6Wx89J7R8qdjnCZlCvpC5UUeWBxMtjE61nPS/qR6saU=; b=fIKTj0DmMW2gLb3Gdl7hWQ72PKv8EUNhDILM8KqAtxm3eDgi8a/ArwJS Ia18NUHEycEtDagdgGFk6BcmmrurFvuX1joi7M9RwzzThL+zPISG6BAvD y+K+MztvWhaVwu46fMbhPie1OL7h0labf4Drb6E1gA9gmetltY4n+RmK0 U6U/+XSrtmm1B7pgwxqFSpLTAbVQiYg/p5Sncdx3BMQE8dsLC+g4tcdRR OnQMgAbPpjTPjSPUOtZKmNRA6z+ZHWnRsOEgslx3fPr40JlzItlDMrqWh CCO4wtWpIFaKn+ooi6g4bKJbquynyZMfVgSoIADyySznq3BZn4/M+00Ra A==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678500" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678500" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771275" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771275" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:04 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 08/12] i3c: mipi-i3c-hci: Set number of SW enabled Ring Bundles earlier Date: Thu, 21 Sep 2023 08:57:00 +0300 Message-Id: <20230921055704.1087277-9-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225810_450710_30BD8999 X-CRM114-Status: GOOD ( 10.45 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Number of software enabled Ring Bundles must be set before using them. Otherwise Ring will not start and may be power-gated by the Host Controller. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index df569d1351be..6c7eef17921a 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -229,6 +229,9 @@ static int hci_dma_init(struct i3c_hci *hci) hci->io_data = rings; rings->total = nr_rings; + regval = FIELD_PREP(MAX_HEADER_COUNT, rings->total); + rhs_reg_write(CONTROL, regval); + for (i = 0; i < rings->total; i++) { u32 offset = rhs_reg_read(RHn_OFFSET(i)); @@ -329,8 +332,6 @@ static int hci_dma_init(struct i3c_hci *hci) RING_CTRL_RUN_STOP); } - regval = FIELD_PREP(MAX_HEADER_COUNT, rings->total); - rhs_reg_write(CONTROL, regval); return 0; err_out: From patchwork Thu Sep 21 05:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00800CD495B for ; Thu, 21 Sep 2023 05:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n1a70ogWgGJ+P6EW2XLeUKDkXRXgenxPllyXTVPfGC8=; b=JWBb0BTK4kFx1p cIiAygpNJq6mpmegEaCFNBROVQDtf/bSflzdiuZ4bRtacwcos1LsLXyvL0rHGsaNuxgZJ+mIKAnWK tRWvWsI3Dwe49+C4C83VUIJ9xjkCMvHLuyemCdd96tcfTYTGIusmTQQVV0G26uY+ilXUz5+PIzFkS IWBv+KVgM6HutS3WLidSGwng3wpROk/uLpf7afFk1Zby9aP0Uz0ARDGz87U0W2v+KetDUsi/EVApS Xbaidu/EoSOUYWeF0usV7eJs7mz7HZPztfpCgokXJgTBFL9QUAFCbfg2c9/HiPSfSByPiBiMZppDZ auJ5o522bz1o0bFk/Rkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjCha-005Dy0-2J; Thu, 21 Sep 2023 05:58:14 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChW-005Dq5-1Q for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275890; x=1726811890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uE0F/QzPBdoeXwMytzILI4JZgY7ooRtAK/SuixUsuL8=; b=l7IzpqJXmPedP9RLDLRERBpeorsnrf/4d8kpi3yhyzWhxFL06M4hrSJt vXqxFmNJyJVyS5QwFTRnknYO26G02/8OdGka6xGyAYGHGBvVQimvIlNJ7 5GMNq+rLlvcNDY8nCwtjp1JUXHaYdBlJm9kOGCm0/47dkLdOk7npAUw7I vyF6fOZdG8I3Xi9Q4htLTcwdUjqrQenZckujcNF4ZrMtDXwfP6uw9R7Is 0sPZeQmTfQIlQQ5Z/fGHiIPJSbtjKIUYs3EyCRrdbarLyVKGF+lSIbp5e mG+krRlpGTY9RzunIQGhNGA0MwobPboPKNi0lZA3w0fBU83+TbsVDx8Wi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678502" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678502" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771280" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771280" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:05 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 09/12] i3c: mipi-i3c-hci: Do not unmap region not mapped for transfer Date: Thu, 21 Sep 2023 08:57:01 +0300 Message-Id: <20230921055704.1087277-10-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225810_521386_15E5C7C1 X-CRM114-Status: GOOD ( 10.20 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Fix following warning (with CONFIG_DMA_API_DEBUG) which happens with a transfer without a data buffer. DMA-API: i3c mipi-i3c-hci.0: device driver tries to free DMA memory it has not allocated [device address=0x0000000000000000] [size=0 bytes] For those transfers the hci_dma_queue_xfer() doesn't create a mapping and the DMA address pointer xfer->data_dma is not set. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index 6c7eef17921a..00d20a020ffb 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -347,6 +347,8 @@ static void hci_dma_unmap_xfer(struct i3c_hci *hci, for (i = 0; i < n; i++) { xfer = xfer_list + i; + if (!xfer->data) + continue; dma_unmap_single(&hci->master.dev, xfer->data_dma, xfer->data_len, xfer->rnw ? DMA_FROM_DEVICE : DMA_TO_DEVICE); From patchwork Thu Sep 21 05:57:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51C1CCD495A for ; Thu, 21 Sep 2023 05:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4eXcv7hN4a+RM9Vs/RMt4qCz1ah7Q46IKKYzCpp8W/Y=; b=2qB4RCuvoXsgVq 9G7YuBpMAJoCU8YUl4CYRWcPcmyygq1v8Oid6t3sKTlziHqhXg9/i+feKZZIXSQzefHyqb3YRIW7H 5yfAs0z6u1Z0hs9v5qNWsa9oY8F3fkx6wa/eHBjusthPd1RPoVkQHTL3GzveuNqPyotwg5Jl+UJGc gSHgFnzSLCHadZytGiL3FrL6QaoT9tfuQeZ8DXJq2OJj+teZyn8YttzimJ5eO97FPO1v4i17CyagE ylMC124cYbjOjEh6W0zNByiGJgJbbqMF7gl4/v++Tji2BvWX/B/pFmG1cz5Sw1Lr+cRmuRuKLA3Kx RuKfwMfZQvTZ1sL8wDDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChb-005DyH-02; Thu, 21 Sep 2023 05:58:15 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChX-005DrZ-1d for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275891; x=1726811891; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gb5ZLEzIhacXU4uuWImWz0+QTO5VFToCmZ/XNFq97+w=; b=fftRppyzk7vi8RIX8HrgQJGC6OWQJuiIXCFiWX2fm1nPedGLNzmHxj6d qG5d33zPQUHFKILB3vz88BMfYEp3VdWAMPiHd1IhaepjW9awkMS0N7Vmt SelnG9lRECQdvZoDvwqG1ESX4W6nibpRiJTDCLVbx+ihxPG8uSAPY3kLs KUhT8PQxGrWgM6RzjYw5VkWtH3p0vtn2DDD3oRkdp1r9Zs3PeII4Fds8N Xo4+76WdnZrC/qdws3seAeAkFBWaUnhFNujeSoe4EeJXeDrb+fF9s8Qn0 EjIUBGy4x4P3iD2eGGpw9i3+B3llp649Ch4WSr5d5AI1nZ6UubMNItpIO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678504" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678504" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771282" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771282" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:07 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 10/12] i3c: mipi-i3c-hci: Fix missing xfer->completion in hci_cmd_v1_daa() Date: Thu, 21 Sep 2023 08:57:02 +0300 Message-Id: <20230921055704.1087277-11-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225811_557180_702848E1 X-CRM114-Status: UNSURE ( 7.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Due to missing completion object for the ENTDAA command transfer in the hci_cmd_v1_daa() the wait_for_completion_timeout() will obviously timeout even the transfer itself may succeed. Fix this by setting the xfer->completion to the already initialized completion object. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c index 6a781f89b0e4..2b2323aa6714 100644 --- a/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +++ b/drivers/i3c/master/mipi-i3c-hci/cmd_v1.c @@ -332,6 +332,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci) CMD_A0_DEV_COUNT(1) | CMD_A0_ROC | CMD_A0_TOC; xfer->cmd_desc[1] = 0; + xfer->completion = &done; hci->io->queue_xfer(hci, xfer, 1); if (!wait_for_completion_timeout(&done, HZ) && hci->io->dequeue_xfer(hci, xfer, 1)) { From patchwork Thu Sep 21 05:57:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93724CD495F for ; Thu, 21 Sep 2023 05:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KIQsFi1JxfbWtWKyXEbiEpOD7RPOHF4ZfzLddRWWPkE=; b=cGPDTLVdEPENuq AfXN/yqIkTvbNZPj6tOzC4T0EMfJHADq08ASGaDOhrJGnoA/hC1VGwaXBrpLmAmQbZUPiwfKEstDf Z2ICas+e2uCvpmg9ODAEtPKyxE4uoMQfiO44AngSjSGHpTfhubLBd2weeJEVCP38E/iVGJ0IjQNXE E8JKyxIGdYCBAB9Jwft537u9R+KhdfFNbosoYKtonpGa6/VzC4uVr1AGTCBIveqMlp2FpzHA2FjVV 7rCpvxI/9chwD9s4Q/8eLDczvwXIuqJ4ueiY0wUMkauH8Bq4Xh82jfmdjJtP7iNOEE7yW4FpYO5pH 08qATaIDSE9pAw9TQOCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChb-005Dye-13; Thu, 21 Sep 2023 05:58:15 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChX-005Dqh-2L for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275891; x=1726811891; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3qJ1kbEKRiOKgUMdYKHwI/85YY4D8mBZHC6RBZZ0qcs=; b=kPpHAcTxMd1/r7DXKz25pRDDZzGPTf4vwe8YQnc5sC8Z2bT7P4dOUN5z 22r7NreUcEs5tI6cEvSsv6FnRMN7TfWwnq96d7pioTAkHft8X++XMxN03 GkCQkCpz0Xo5TxFAMZQXoWxJW6WeupoHjRYOgGl6dGDFQxUj6fkZKbjmm vg9paKDOLXG1vhmXEwlxEIC5k2hvLLaCkWr61i+ZvrM0CjGKohW7uKYwK Lql0bQ+HLWETWaYnWe8otpDFxxl6B1UyA4heUZv6ozVYSACW3NI7uaWGL bM5n96ivDT6ET0I4PvdPZwgTdZMmrTRcGdxFiv+9sOM/2nNXShyoNvMi8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678506" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678506" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771284" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771284" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:08 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 11/12] i3c: mipi-i3c-hci: Resume controller explicitly Date: Thu, 21 Sep 2023 08:57:03 +0300 Message-Id: <20230921055704.1087277-12-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225811_795193_6F836F26 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org On an HW I'm using in enabling work the RESUME bit is not set in the HC_CONTROLLER register when Host Controller goes to halt state. Value 1 should mean controller is suspended when reading and writing 1 resumes it. Because of this erratic behaviour plain HC_CONTROL read and write back won't resume the controller. Therefore do it by setting the RESUME bit explicitly. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index d7fe8e62820a..1ae56a5699c6 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -174,8 +174,7 @@ static void i3c_hci_bus_cleanup(struct i3c_master_controller *m) void mipi_i3c_hci_resume(struct i3c_hci *hci) { - /* the HC_CONTROL_RESUME bit is R/W1C so just read and write back */ - reg_write(HC_CONTROL, reg_read(HC_CONTROL)); + reg_set(HC_CONTROL, HC_CONTROL_RESUME); } /* located here rather than pio.c because needed bits are in core reg space */ From patchwork Thu Sep 21 05:57:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 13393662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3675CD4959 for ; Thu, 21 Sep 2023 05:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SRu48LdKZ7jA33AYNv6WWTPh/AdAd2GYZBAci9iyR28=; b=ZrcvhzWM5arXfo 6cs603NwgML5hnMpyj6Sn74rVD48AsVx/0r1qaRjheAOTfr+KOlIQh79qlEFCcvhrHjnbXKDvDbJq cj3uzaCc8DRzmu+Ot18Zs2IhphpusYY0VmdqEYxpx5PV+cQbgmG6rQ44XJQWOzTZZqb0SkFajMMqL XbDs2gNu/2fC9ep1RdnGwrCCCuLqlBYppLwXe9KCw0x0OcNP97n/VRmCg0aRsDhyNrdvxJNHqsQn9 eLdOsmRZFuiOf7EhzPf63FeA1B8qzhl5fj5oVqHZxNh4mMV79ne64WqsANqqaS0WGL5TEemNnUUmH x0RoVyUERs5oELbkiC7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjChb-005Dz1-26; Thu, 21 Sep 2023 05:58:15 +0000 Received: from mgamail.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjChZ-005Dqh-09 for linux-i3c@lists.infradead.org; Thu, 21 Sep 2023 05:58:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695275893; x=1726811893; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pbWAG9SFPXwE7QbvhLAd+mzLnlyrpC5vo4oFLD71CXc=; b=BpVqk15gkEsw7eeHsrVsxD8GJtPDoD+WGb3DDSWoHwDkaMn6QshDlRLe OpyuE1FDaJBDFiyH7nf5HwWwk65IlCTSUqhFUxDjrUPAqzRZIduAWuINU 4VkpcZz5BUlUOqwzualzzjQjLxHOufWb42CGhceG61iJiGrytGNKyihTs mn/FVpDy2r2HwofZ1l9KTHnoOhxoOTJsxseZ96LCLKvFU/P2rRvuDIB4P EsLX4yIPTNO27lxo0kQefG/CsjPseDhLX6Uy0Hd7b2aKEE3EpUTSUaWhP ZN6r0icBTExY+bqVcnbDrgTccnDHZUwW4YNEMTX98Mh2mOzGOF02twg3y g==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360678509" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360678509" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 22:58:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="1077771286" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="1077771286" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2023 22:58:10 -0700 From: Jarkko Nikula To: Alexandre Belloni Cc: linux-i3c@lists.infradead.org, Jarkko Nikula Subject: [PATCH 12/12] i3c: mipi-i3c-hci: Resume controller after aborted transfer Date: Thu, 21 Sep 2023 08:57:04 +0300 Message-Id: <20230921055704.1087277-13-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> References: <20230921055704.1087277-1-jarkko.nikula@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230920_225813_099954_4EE0CD89 X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org Host Controller goes to halt state after aborted transfer and needs to be resumed by SW. Add this resuming to DMA mode code too. Signed-off-by: Jarkko Nikula --- drivers/i3c/master/mipi-i3c-hci/dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index 00d20a020ffb..bee47aac6894 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -759,9 +759,11 @@ static bool hci_dma_irq_handler(struct i3c_hci *hci, unsigned int mask) if (status & INTR_RING_OP) complete(&rh->op_done); - if (status & INTR_TRANSFER_ABORT) + if (status & INTR_TRANSFER_ABORT) { dev_notice_ratelimited(&hci->master.dev, "ring %d: Transfer Aborted\n", i); + mipi_i3c_hci_resume(hci); + } if (status & INTR_WARN_INS_STOP_MODE) dev_warn_ratelimited(&hci->master.dev, "ring %d: Inserted Stop on Mode Change\n", i);