Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.61.48 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796378236; b=qIwWpxZwT3Tlyhzmym2uWDgbaQ6A3vZeq5UO85JNJulaE07PFrppRaKAXECJFsX92sF5 lJiFT7DpLmVJsQZhG/8IKDWlL/MA0atDGV/OrZ1wCTOuL8aIQxZa9nY/gVVZ7eAGjTWXQ a1GrvTgHp6EtvrCzcBDYHP/5+YrN8/f3oLx8iJirt1oNSJE/J9jw594ghMasYBt0YAkUY RuUFDnZBxQRYQKn1bsdj3SQcCPqowQOYu0YXXXyl9hYbWhjna6L57p93i7s1BtstKg9Km G/H6JHM4vO/OyT4vxPVPmXxb0+Go22tHViPLqpL3HykUCf6MMMpRGFCH/QeeEQ2adtA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796378236; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=WhLvK3HchCaOwiuuEIm/uGl9rW/0/875uIy33PCpqCQ=; b=l8LklW9CQbNoAghxqytczIy0mePAimPPpwTM8qZC3aoM7TAX5guUnG5nhlnUc0TUY7ad Q0xyVPccYgFwPeSRKoLqpPyPs2Lzn+8xe8ZpRP8CZ/VtUKXE1981I/XrEerv1q3q5tA5x x+LUln2UF+44whdmRqBm1VS8PtMFFOwnnTGaIDAcqwq+cznEhzdNc3FBMP2tsz0KhCAkL 8rktLDXwLxjLTFwcqxhFJ8OXEc/kT6hrJH3tHtNbXwwDt0nSXeCKJ8h18m31Io0lK+eDC WKDBHUYMDo6cGMO7wqhAaZVvNhCygOpnbtN8TVp0q6+OypRStEWvNiNV0Jf6L1Fwlww== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=gQtOhbkM; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.61.48 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010048.outbound.protection.outlook.com [52.101.61.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A38CA606A32D for ; Fri, 4 Dec 2026 09:57:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A38CA606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=gQtOhbkM ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UqpOJZKfrFOlxvnFDBe/0rQcXqlc+zE1e1uv/0v3T5Qy7XwqGhYH4rHpYTSO6EMMObC7FFVlO+y7xF50jCR25R3htFkr1KvtV1nk+0qB2gtAXWkoW+ETzDn78BYDY40hkxN5CyHc7zCOSrrWzNpVkNhBx9jLg8t30DprBSvu0F1etu4xM1VfiOa9PqmaDS5m/hG05oe8tt2XuEKDmE8qlHkcJI+EOaBbds5DTbNKy1eE6Bw3PyzU1SHPrJ4tK6E3mIXIhySTmQXY3h9tqKCj0yIG3919QOPuvJUdv5T5F/PRWfOiCMXGghSWqM2VuM64w8ywOliiRGz7R6HSuFslug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WhLvK3HchCaOwiuuEIm/uGl9rW/0/875uIy33PCpqCQ=; b=rtvioUxHVlvlvXEKqPWkx0IcOGzBlkD9KvG4VwYlJQqIk9wBQqtxWutMdjOu1ichk3kVfhyHu6giZhH4nam6YyIbKvu7x/4UUX13DhKHkxNUEB/zw588zyUFTdJm69GNMXgKy2dcDQqfa8ffbCXHDctNtpRsHx/WVS9XTe/ytfkrf4FQ3ZiORKmXqsAENpnrpHXR50JeJJydfw56sMDSyhSo1t2fYc2IYvlEKM8YFI6bpwepOwr74h1ZRmnE11dsnYAbaBf25termW53dHKDo5jPoP1na2a4lOatpTrAWGwdildWHjEDIezun6kJxsraH1mHqaJRJW4FVKvYqJlsJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=8bytes.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WhLvK3HchCaOwiuuEIm/uGl9rW/0/875uIy33PCpqCQ=; b=gQtOhbkMk9aVZgMcFoBsO5MB1isRiH4aOJ4aGeJ9y3oZiQJBHjbS5K7c0kKWgdt6mmEFJqVe6oMBU6Jm1MxVVpGlMtjocxoO4E/1P3dvREatzVv0lbcMajBwn9Di8lOqny0t1YG9Geu6vd1M2Aa4gFoP++sJ1eU1xHKQsKEpnVs= Received: from CH2PR18CA0020.namprd18.prod.outlook.com (2603:10b6:610:4f::30) by CH3PR12MB7716.namprd12.prod.outlook.com (2603:10b6:610:145::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Fri, 4 Dec 2026 09:57:08 +0000 Received: from CH2PEPF00016D4E.namprd02.prod.outlook.com (2603:10b6:610:4f:cafe::86) by CH2PR18CA0020.outlook.office365.com (2603:10b6:610:4f::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.13 via Frontend Transport; Fri, 4 Dec 2026 09:57:07 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH2PEPF00016D4E.mail.protection.outlook.com (10.167.244.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Fri, 4 Dec 2026 09:57:06 +0000 Received: from kali.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Fri, 4 Dec 2026 03:57:05 -0600 From: Vasant Hegde To: CC: Subject: [PATCH 01/38] iommu/amd: Enhance "Command buffer timeout" error message Date: Fri, 4 Dec 2026 09:55:59 +0000 Message-ID: <20261204095636.335222-2-vasant.hegde@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261204095636.335222-1-vasant.hegde@amd.com> References: <20261204095636.335222-1-vasant.hegde@amd.com> X-Mailing-List: iommu@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00016D4E:EE_|CH3PR12MB7716:EE_ X-MS-Office365-Filtering-Correlation-Id: 90e24883-c22c-4fca-a385-08df51ecf4c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|36860700016|376014|82310400026|1800799024|18002099003|22082099003|10067099003|56012099006|261028144727099003|261102123227099003|261021123027099003|261021121427099003|261026121527099003|261026140227099003|261022075727099003|261022113327099003|261022105027099003|261009223027099003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: F1kva2xMmWe534ufCkXUIXiu2d8606XH1ikNjy7QyduXM1PFpN5DY28hpwaWApBbyvXjdkWUmNXvOM4uZhfgPLVgvm46EIbD1eDsMur5CE9GonlJTx60+ZMaTaRuLk9jCXLJKUzhCFFAz6/cyI39OIWnlrQsCt1GDf7WrOGRziVEIXai7tTSKhTHtsgbFuVAOKov68hiqB8wphMQGwyYVC2wegvhFB8ZdkheVMqHAN2N3QVl3i9IJMuv75j8+g7erBK3ATmWPnKhJgxnguzXVAS8Pjeoni4odHrHHUGnU1o4Yeh1Hos5A1zJLOVYo5i6TZmRYQFfZPw99WKJl7TbF8jN2qgFg3FKJo2/LqQPeyfzoip1kScMejMOL0njgE4tGomyezfBgbExI7mFkvxRJlqpkgq7z+6C4iGlcaQg7vyGiWsiKsCIg+C4dQDwZk1FaiEA6KxV/5v/YWpqUuQFkiM4Tfo2UaLP74OJUrRntXvox2XdkyP2pZ9BR5enHRoW7WKat6CqSLawyp5QHeFsCoY2+cxMl+o7e2Mhg0Ef5EfqBWLszlMzQbcjaG4bNwUmLgAqgm+YmdK5CmEz/guaHo+FcGrZmczxG7E8s4kqGrICtsth9crC+I2d8pBfv03gKAzKEwu0ljU2WA2KhHG8/ONRaQYpWz3hV3ypzRnSo6f+P9ZYV+aJoepZMXQgczZKIjdtL9EzHInWIpyA5OFdbw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(23010399003)(36860700016)(376014)(82310400026)(1800799024)(18002099003)(22082099003)(10067099003)(56012099006)(261028144727099003)(261102123227099003)(261021123027099003)(261021121427099003)(261026121527099003)(261026140227099003)(261022075727099003)(261022113327099003)(261022105027099003)(261009223027099003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ePwwMMTq1Y7L/YRvGMIc3ZidfUo+7VXqszgJJuWk56ttc3cuYw+Kjce8LcBM3dWV7KfANm2B9gxome4SGHzXHtdkqmuTn+Stnuysb5WnwoSY2stbgkeaWf5OKKWzQY35BN5HQDyipIp3awT4IoVz/hrYVP9E/GTW5XcpG5gQc5tA6bf2+cUECmUrRntR0nl2KdeCSTXFodpRj6lDfRmig/pMomp9aOWLPBoOkZ90w95aQ9txWh2IGtynIrdTpeCmDgeXq5l2YKAMBiUfDakIVzkkMxFNBsJxKO0IP4kNEKCr65wSZZHNh8mI3s98TgMxmnFoZUl+xCnCRpLbdKVgQ6qU7A9+y90C33XmzYrsNX85dhvBVGSxcrZS+1hqAtZ1Z+k6K4ZxeQ3iHEHWOxFGCiijbTdIR5SjpYSREK1Z/pj5d4pXPGi5gWoTKnWgQxfw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 09:57:06.9971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90e24883-c22c-4fca-a385-08df51ecf4c0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00016D4E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7716 From: Dheeraj Kumar Srivastava Current IOMMU driver prints "Command buffer timeout" error message with insufficient information to further debug the issue. Enhance the error message as follows: 1. Log the IOMMU PCI device ID in the error message. 2. With the "amd_iommu_dump=1" kernel command line option, dump the entire command buffer entries, including the Head and Tail offsets. Consolidate the timeout logging and the command buffer dump into a single helper and use DO_ONCE_LITE() to dump the command buffer only once to avoid dmesg spam. While at it, apply the same reporting to the completion-wait timeout path as well. Signed-off-by: Dheeraj Kumar Srivastava Signed-off-by: Vasant Hegde --- drivers/iommu/amd/iommu.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 41ee4ad1dcf8..60aeb10362f2 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1209,6 +1209,16 @@ static void dump_command_buffer(struct amd_iommu *iommu) } } +static void report_command_buffer_timeout(struct amd_iommu *iommu, const char *reason) +{ + pr_err_ratelimited("IOMMU %04x:%02x:%02x.%01x: %s\n", + iommu->pci_seg->id, PCI_BUS_NUM(iommu->devid), + PCI_SLOT(iommu->devid), PCI_FUNC(iommu->devid), reason); + + if (amd_iommu_dump) + DO_ONCE_LITE(dump_command_buffer, iommu); +} + static int wait_on_sem(struct amd_iommu *iommu, u64 data) { int i = 0; @@ -1224,14 +1234,7 @@ static int wait_on_sem(struct amd_iommu *iommu, u64 data) } if (i == LOOP_TIMEOUT) { - - pr_alert("IOMMU %04x:%02x:%02x.%01x: Completion-Wait loop timed out\n", - iommu->pci_seg->id, PCI_BUS_NUM(iommu->devid), - PCI_SLOT(iommu->devid), PCI_FUNC(iommu->devid)); - - if (amd_iommu_dump) - DO_ONCE_LITE(dump_command_buffer, iommu); - + report_command_buffer_timeout(iommu, "Completion-Wait loop timed out"); return -EIO; } @@ -1403,7 +1406,7 @@ static int __iommu_queue_command_sync(struct amd_iommu *iommu, /* Skip udelay() the first time around */ if (count++) { if (count == LOOP_TIMEOUT) { - pr_err("Command buffer timeout\n"); + report_command_buffer_timeout(iommu, "Command buffer timeout"); return -EIO; } -- 2.31.1