From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8B8B331A7A for ; Thu, 16 Apr 2026 17:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776362245; cv=none; b=F+rDN+cbHtnxCAza/0+m9ORv2ppz+jDXLJuPrTP3/DlP7rxJUbpPAtA/VxG61HSBhA0B81frGRMVbVKQMQ7YyFCU2ghdehMPEPUVuwvL20I3OARLAqIu2d8Btp3DY5WqqesD4GYmvIufRsZb/76DDcn//vhiLvnBVWo1JKZIW2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776362245; c=relaxed/simple; bh=Pb+4SFr1d/dH70wamuLCRSduMxdk78xIhXYWmCU7UPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FVKCOs4hHKN6gFHUpJA1IGp1+DsJ3M5oGqUqDftaxY6UyUWdMYU74A98F/jtCHxKds6dGe/X66qOFU4ZHh/Rpc7nF9p/1awhuwmCqBWRsJISc/6GBsyajC/e8Bm1BDmLnGbTNu551oIyw5+E2cQUpVev2wlokVb90sN7xCofyYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IjQAF+Ro; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IjQAF+Ro" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776362243; x=1807898243; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pb+4SFr1d/dH70wamuLCRSduMxdk78xIhXYWmCU7UPc=; b=IjQAF+Ro0KF/WHkWPtatKhstQRy9qTMY+mK5yUi5D61rfdjTjRPeIOk8 oshHcaZPB1JLx9qjWfMu+xP8pK0xPI4hs45Lk0mbrc579snIz4Jd768Eg TTDOdzncjhnx2L+wx7x0nYMD7R7EyXmfj5aN9SK49THWYndaLT3T5DHiN RGUV2dpeiYwApO/ueJRm5HNN1kWOFoJbaqAdiuofFwweCNtup2qmPX3fe OoLwKREdrARhT4lhi5AKAtMInpSEkQkTVn6hVz3ZSKRbac29BuF41tvvc mJ0G9OV1+gnHqs+I/bl4oVhKNO1BbyUCh0bWPFNTiy3FKwLTRsIwvZcwJ Q==; X-CSE-ConnectionGUID: VW8ItNTWSwekfsorfJyj+w== X-CSE-MsgGUID: 7H0cvgxIT1uSV3le7y65yQ== X-IronPort-AV: E=McAfee;i="6800,10657,11761"; a="94778368" X-IronPort-AV: E=Sophos;i="6.23,181,1770624000"; d="scan'208";a="94778368" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2026 10:57:23 -0700 X-CSE-ConnectionGUID: yWsqRJalScq7QldeDGorzQ== X-CSE-MsgGUID: im98xUr/TeWXLBCEakbfWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,181,1770624000"; d="scan'208";a="235784521" Received: from abityuts-desk.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.244.222]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2026 10:57:22 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/16] i3c: mipi-i3c-hci: Wait for DMA ring restart to complete Date: Thu, 16 Apr 2026 20:56:52 +0300 Message-ID: <20260416175704.41217-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260416175704.41217-1-adrian.hunter@intel.com> References: <20260416175704.41217-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit Although hci_dma_dequeue_xfer() is serialized against itself via control_mutex, this does not guarantee that a DMA ring restart triggered by a previous invocation has fully completed. When the function is called again in rapid succession, the DMA ring may still be transitioning back to the running state, which may confound or disrupt further state changes. Address this by waiting for the DMA ring restart to complete before continuing. Signed-off-by: Adrian Hunter --- drivers/i3c/master/mipi-i3c-hci/dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c index 314635e6e190..28614fdbf558 100644 --- a/drivers/i3c/master/mipi-i3c-hci/dma.c +++ b/drivers/i3c/master/mipi-i3c-hci/dma.c @@ -617,6 +617,7 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci, } /* restart the ring */ + reinit_completion(&rh->op_done); mipi_i3c_hci_resume(hci); rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE); rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE | RING_CTRL_RUN_STOP); @@ -625,6 +626,8 @@ static bool hci_dma_dequeue_xfer(struct i3c_hci *hci, spin_unlock_irq(&hci->lock); + wait_for_completion_timeout(&rh->op_done, HZ); + return did_unqueue; } -- 2.51.0