From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (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 7C2FF255E30 for ; Fri, 25 Apr 2025 14:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745590665; cv=none; b=CHwYgJM0IZI+Bidr6lZqcfK+Q2uTMKfGwAiKJudtaK1RXKbzJB+xsF6fySgEH9U3mTxxdoCFsBQWxjAEHSN0kr3vzripDElGhe2Aq8bTtpK1C8iIVUx7wK5Y4B7QEoFNm2KLHXoMf0xSSCAVW+ZvurBdDow8x8mjaVZ79+O4XPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745590665; c=relaxed/simple; bh=fH/frdL2bOaSon7Fx79vcYibtR1RwRHpxY8Bjyl6usU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Me+q9Tbj1Dw108trGHFV3AbXpN+7ao+b/8dFJSDLN/jJTqlDwDGdbmDiA57V+/WyB61X97HWy3OqijUuQ1gq/rILWW/YlHvUJMan4qrNScSC0HII93T56Pp4S1NHU6Lv3RL4JResUy87I+10JlsHPuzUkTJgPu/F9G4D3yylFcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=biNrtMnU; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="biNrtMnU" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OgRFlnCvjj648D8iR0QQBHGxrbfFaZPGsHm3wINncqI=; b=biNrtMnU9rZ9tJTJodO4ZWVmDQ lOXqNJFbJgLvAvqg/9g73LjENxIYaudnuIeBOu0tVe0LA75xrnhLZTLr8pip8lz9yM+zbWZP8plb4 RzV3YP5TFZZAif+lC1UkDTq3FyuYM8w1TJyyK5mO0JZYQTMzUEPqf6kEnhtIf2KD9uoIsxPeY4eOW /Ai/9Guurye8mumDh8y/7sg0uiFPZ1lm7gadQX6udLIVKZPMQvHW4ZnuOB1LauAJVUUpAUOMPng52 ZVYX0Htjdp4FmcDrZJbE+zil1uMp9krPvPQqxRs9go3y95KltlCV45k/XnNgpe2wdbXK+YoDfoSNO Ii7ZRk9g==; Received: from [77.26.4.178] (helo=edoras.jupiter) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1u8Jrq-008MK6-Jc; Fri, 25 Apr 2025 16:17:26 +0200 From: Jose Maria Casanova Crespo To: Melissa Wen , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Kocialkowski Cc: Jose Maria Casanova Crespo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com Subject: [PATCH v2 1/2] drm/v3d: fix client obtained from axi_ids on V3D 4.1 Date: Fri, 25 Apr 2025 14:25:07 +0200 Message-ID: <20250425122522.18425-1-jmcasanova@igalia.com> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the case of MMU errors caused by the TFU unit, the client that causes the MMU error is expected to be reported. But in the case of MMU TFU errors, a non existing client was being reported. This happened because the client calculation was taking into account more than the bits 0-7 from the axi_id that were representing the client. [ 27.845132] v3d fec00000.v3d: MMU error from client ? (13) at 0x3bb1000, pte invalid Masking the bits and using the correct exi_id ranges fixes the calculation to report the real guilty client on V3D 4.1 and 4.2. Make the MMU error print axi_id with hexadecimal as used in the ranges. Fixes: 38c2c7917adc ("drm/v3d: Fix and extend MMU error handling.") Signed-off-by: Jose Maria Casanova Crespo --- drivers/gpu/drm/v3d/v3d_irq.c | 37 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) Changes in v2: - Now axi_id is showed in hexadecimal in error message (Maira Canal) - Improved commit log description with error example. (Maira Canal) - Fixed typos in commit log (Maira Canal) diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c index 29f63f572d35..d6ce1324905d 100644 --- a/drivers/gpu/drm/v3d/v3d_irq.c +++ b/drivers/gpu/drm/v3d/v3d_irq.c @@ -186,27 +186,38 @@ v3d_hub_irq(int irq, void *arg) u32 axi_id = V3D_READ(V3D_MMU_VIO_ID); u64 vio_addr = ((u64)V3D_READ(V3D_MMU_VIO_ADDR) << (v3d->va_width - 32)); - static const char *const v3d41_axi_ids[] = { - "L2T", - "PTB", - "PSE", - "TLB", - "CLE", - "TFU", - "MMU", - "GMP", + static const struct { + u32 begin; + u32 end; + const char *client; + } v3d41_axi_ids[] = { + {0x00, 0x20, "L2T"}, + {0x20, 0x21, "PTB"}, + {0x40, 0x41, "PSE"}, + {0x60, 0x80, "TLB"}, + {0x80, 0x88, "CLE"}, + {0xA0, 0xA1, "TFU"}, + {0xC0, 0xE0, "MMU"}, + {0xE0, 0xE1, "GMP"}, }; const char *client = "?"; V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL)); if (v3d->ver >= V3D_GEN_41) { - axi_id = axi_id >> 5; - if (axi_id < ARRAY_SIZE(v3d41_axi_ids)) - client = v3d41_axi_ids[axi_id]; + size_t i; + + axi_id = axi_id & 0xFF; + for (i = 0; i < ARRAY_SIZE(v3d41_axi_ids); i++) { + if (axi_id >= v3d41_axi_ids[i].begin && + axi_id < v3d41_axi_ids[i].end) { + client = v3d41_axi_ids[i].client; + break; + } + } } - dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n", + dev_err(v3d->drm.dev, "MMU error from client %s (0x%x) at 0x%llx%s%s%s\n", client, axi_id, (long long)vio_addr, ((intsts & V3D_HUB_INT_MMU_WRV) ? ", write violation" : ""), -- 2.49.0