From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 990E7480348 for ; Thu, 4 Jun 2026 13:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780581184; cv=none; b=mQDxcihKZYT0uJU/qWps7s/p4ZsC9zWao4fvbhHDdvB3XgTybfCe7J/TGdh2IFc6LAIcHDKyZTVwL+BerwbAZ4/GFz8RR7NEDix0xvs5KJY1VKQudiZXTIS9PIkbJlGdL2EHT8PXa6CB9M2qFzJJDpEUSMJqicag1PU9ofRHvAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780581184; c=relaxed/simple; bh=KmQHc3v3JVs4EnW94C19ZfoNPOYoCnubmp9LMyZqsGA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MJq0H3OlBE61SB5B4bXAGdKWX9HZ2jGNs3h69T86JYJOBsM7hEhL8lJZGjJ7limfgSEnhq1plzvOZLAnC06N+0/h77+sk+tUGJd7UjoPbUjx1jObjxB2MMDvaNygXNNDQg1zil1YEs69jrYlWTBbZmszOczt0ul25thKYKros1s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g2yIlWch; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g2yIlWch" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-45ef189aa1cso573353f8f.0 for ; Thu, 04 Jun 2026 06:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780581181; x=1781185981; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OH9hQQFNIkDpasnao4boz8/RAiMZ7MOKPgy4BqZR+6c=; b=g2yIlWchXL6NYzmukT+J/sICsgBvebfW7FmoqIKk049vPq9fLUIvbWl/JX6UNHLbkP uFrHcqDVu+bXLBDm1bJjoZWFk9DN0Tm3IfeKdIftx/65//rcROnpzHaEq+vpjTdCbsuI uVTz8iFOJjQuEtRZ4DR+W+33AulqPnCY+Zal808OmncJuaD1aSREVnzJ0DP/+Z0LdRDH XAitOxoFd4eB9+nIeGpEPasBfZXuzEzoJwc6WUw2hTViECuEoDqo1vlzHP1tx8AQ3Uwf Frtn5tl6+g6OTTBpoQo1ZpXVDBPcW3u1WYJydmGK3h6/fS0nHOgfEbBa3unGPf47Mwiu woZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780581181; x=1781185981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OH9hQQFNIkDpasnao4boz8/RAiMZ7MOKPgy4BqZR+6c=; b=fYLMjRIUrauENztUtI62WsIqr6Y8FAAhrwbdKHj9BtraYwBK0ka5HYsskvl9EptVtp fBQQ1tld/DyH1cNqg1jKN25FFWlHjGp80OZSwZzfo2RwmZTcrOV/FUy2Pcd0G0+LImPK 4lu+eu2VCzfKEW8uN/ywh7C3inMgV4YuVkcTBZ24GMb5ucdA+iDJthtuYeh0Kdn04zNY rxLpKvmLBBAeuu/jvoNNTonzKAByWiUWm7NOSN1yJh1h7yOs/uVEMopsalapty31sGX1 JxvVKudDSrG/+i3COZbCaCu4yZ5+OqzXTX37lNO2Q43YI/8iyyOdQMxbVnn1JBu+/psV jw9A== X-Forwarded-Encrypted: i=1; AFNElJ9J1YAwoWDg+8kb3gBGLIM6Gj/1gENZWECe4U8g4anVogOjpSSvxxnTelrWFq0qBji4tAKAfdsOcxRitaU=@vger.kernel.org X-Gm-Message-State: AOJu0YxC7zQ/ukbrxrO7+J7l5AW98T7JpmMWWFvIdQMFfTjDmg/E2ZM5 qqZ6OLrxG1NpHDQvmHxvB1fRUcZcKDqQY7mwCGhy7jY3NopG1GF209QM X-Gm-Gg: Acq92OHGs9maP/fT6j/nhfwBwXVKsKDslXOy3zJWJwrs9/Gj0dFZ8WuRih/+c1ylwsj 9dPa/3ceEZMQ8wa9xWHvMQMcEV2KJrmx8RLquyIomogNNswrVXwTXuEHbnXnb1+4OAZkDbT58Pf K2vpkoo7eYArWhrscGvF8eDZ522YzC/r91TyPXETz8Lj0Xyy7qTW84y4L0cOtKlWkQnVbLBUAj8 K/cK7j/7oiUjBMxin+yYXvb4R1h60bcpuiZMzTAX7o5Trz2EE0ibdS5M9FyOb2vugkGm93GWIQ6 QbCom+N2cfVUCYcjRymprO6CyRYhH9O4l5KygNPikcUc0mksF51CdBC6/6vjiu9ONh5q9av7mhv ZayMbsIyBZhsLLtwPCizZd9J0OOgh4YQwPFx1bb3BzxtHIMWqWzikC2XWySQNWjYsHquih8uOdD ig6Jf2VeMRF3C6OjTdxEjZlb8ze/N3FlGOUtEX+jIhpUpBCjjAe+LsQZcWnKWgm5Y= X-Received: by 2002:adf:eed2:0:b0:452:6aaf:76cb with SMTP id ffacd0b85a97d-4602178b717mr9418813f8f.1.1780581180807; Thu, 04 Jun 2026 06:53:00 -0700 (PDT) Received: from compiler-rock3b.tailb81abf.ts.net ([2a01:e0a:104a:4d80:be24:11ff:fe12:2776]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f0a43e9sm16661068f8f.0.2026.06.04.06.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 06:53:00 -0700 (PDT) From: Midgy BALON To: tomeu@tomeuvizoso.net, ogabbay@kernel.org, heiko@sntech.de, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, joro@8bytes.org, will@kernel.org Cc: robin.murphy@arm.com, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH v3 4/9] accel: rocket: Reset the NPU before detaching the IOMMU on timeout Date: Thu, 4 Jun 2026 13:52:50 +0000 Message-Id: <20260604135255.62682-5-midgy971@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260604135255.62682-1-midgy971@gmail.com> References: <20260604135255.62682-1-midgy971@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On a job timeout the NPU AXI master can be left wedged with outstanding transactions. rocket_reset() detached the IOMMU group before resetting the hardware, so iommu_detach_group() -> __iommu_group_set_core_domain() asked the rk_iommu to stall and wait for the in-flight transactions to drain. They never did, the stall request timed out (-ETIMEDOUT) and the IOMMU core WARNed: WARNING: drivers/iommu/iommu.c:157 __iommu_group_set_core_domain iommu_detach_group rocket_reset rocket_job_timedout Assert the core reset first: it quiesces the AXI master so the following IOMMU detach completes cleanly. Move the detach after rocket_core_reset() and out of the job_lock (it does not touch in_flight_job). Signed-off-by: Midgy BALON --- drivers/accel/rocket/rocket_job.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c index ac51bff39833f..e25234261536b 100644 --- a/drivers/accel/rocket/rocket_job.c +++ b/drivers/accel/rocket/rocket_job.c @@ -364,14 +364,20 @@ rocket_reset(struct rocket_core *core, struct drm_sched_job *bad) if (core->in_flight_job) pm_runtime_put_noidle(core->dev); - iommu_detach_group(NULL, core->iommu_group); - core->in_flight_job = NULL; } - /* Proceed with reset now. */ + /* + * Reset the NPU hardware before detaching the IOMMU. A timed-out job + * leaves the NPU AXI master wedged; detaching the IOMMU then issues a + * stall request that never drains and times out (warning in the IOMMU + * core). Asserting the core reset first quiesces the master so the + * detach completes cleanly. + */ rocket_core_reset(core); + iommu_detach_group(NULL, core->iommu_group); + /* NPU has been reset, we can clear the reset pending bit. */ atomic_set(&core->reset.pending, 0); -- 2.39.5