From patchwork Wed Nov 27 09:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wayne Lin X-Patchwork-Id: 13886767 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 620EAD609C1 for ; Wed, 27 Nov 2024 09:50:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF0F710E16E; Wed, 27 Nov 2024 09:50:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="IaejP9le"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8620B10E16E for ; Wed, 27 Nov 2024 09:49:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wpfrHAuZEQlg1b6OsSzQib7iu99N8UX5jWTHe3Q3lSFsLmOnM0OHb0+2DT4yCfHRNbOG0GQYC77FAiT55l0G82nNnfWvDl0Y5HzjjPBNgDZZOKKpJ92mvbEXLSVrLnogaXzYLLzcPnG2tLMYP0k8L0VQFDag+GP/ILciD/jgPu1vuRRNGqRPNsuovJ0jfwAnt0lqDlc4rhm1TInvB24RNB9fYJxBbxqQCNiduCZJCvbZTBpXosVgqWWZakWn4wlI0njw1tgY/FNzWcbBa0X+51zk+QPyIchCk8Fbm++JSjiiuSKNCHxQPA3yKyDxWUQH/NbtQC+aDsTupdo5v36Z0A== 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=/Zp5i8jwRkhn9dG9uLHEAIkKwaO0u1wK9BvRSZc2fhA=; b=q7tJiW5ljpckWE7NeB9J//Z2XSf1/riBKNEOFnQaZ5/Y8DH/VVlKu1VVfEF27K31nZrdMBIiNh08LYV13yGuWGt5RXj6VHTELeEaSEgkIYJuJz8AiYcuTt8JmSsQzd2WM7pkGY+C453nfYErap+7p4qoTsCQ106PVJalXjBOaQhTO4KFlBaVwZq2CXGmP2LOZ88YWXLWKOxpguwAkLF1iOh0QQDb4tQCP+MiVOQmA1rVrN/KYA+QNfOrH3B88ONWotV7LfQKhnKo3/acem4MtGiXxkoknUIFTxDBJUvk6r+XoAvD7NVHOJjx8HZJ2eltgjrO9FEzmCNxLE5iubaHdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.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=/Zp5i8jwRkhn9dG9uLHEAIkKwaO0u1wK9BvRSZc2fhA=; b=IaejP9leskxyxJ1/qja1hAux1K58mbQSaCwoKx/ElPlgR/Y9l/LY8RoB/k06m6QQHfY0QAyzIu5zqwKS9YNHePVmM0vqbCLeAXHLnY//pt4RPRN1R5B+XnhUKgT6QTB/7qYYr0ZGwxP6oNK/6OOfLg8yVQqjiiMGq74I6vHFZCY= Received: from MN0P220CA0023.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::27) by MW4PR12MB6900.namprd12.prod.outlook.com (2603:10b6:303:20e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.21; Wed, 27 Nov 2024 09:49:52 +0000 Received: from BN3PEPF0000B373.namprd21.prod.outlook.com (2603:10b6:208:52e:cafe::b5) by MN0P220CA0023.outlook.office365.com (2603:10b6:208:52e::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 09:49:51 +0000 X-MS-Exchange-Authentication-Results: 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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN3PEPF0000B373.mail.protection.outlook.com (10.167.243.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 09:49:51 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 27 Nov 2024 03:49:50 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 27 Nov 2024 03:49:50 -0600 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 27 Nov 2024 03:49:47 -0600 From: Wayne Lin To: CC: , Wayne Lin , Imre Deak , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Harry Wentland Subject: [PATCH] drm/dp_mst: Fix drm RAD print Date: Wed, 27 Nov 2024 17:49:38 +0800 Message-ID: <20241127094938.3640463-1-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B373:EE_|MW4PR12MB6900:EE_ X-MS-Office365-Filtering-Correlation-Id: 9dcca2c9-b2c5-4299-3086-08dd0ec8d692 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?f1PrauFYfulR92MX2vjkuJjDmrj8h4J?= =?utf-8?q?0QY+Mz1K8s5cNKEQ4ZEMV3uT0A96ROTNGVMEZZ5VRipxXKt90NzziOiaDqLXxRZOe?= =?utf-8?q?pnFoEwOlQYKpdp+iJEoulT2+xogBLRCxCpJG+Sq6rM6l0fVwyg6zevUUt8wEp8H7v?= =?utf-8?q?7hujX0o8D5cGuGV3BL7d/KtrvDlg5A7dx9dwjIsNTLikNOVGZUYIXAaK47LaVgDrZ?= =?utf-8?q?TBQkO4Z9aUyd+VPpfIdjMEPeRVyDuRd+qLQmrwnTec9Uli3/SnzGuwfKea0n2fCcW?= =?utf-8?q?9mk2ta0vWM5090n6eqr4AOViER1GT50dXiHRtNIYc4YtXuEYJHLLbbgItnjqhmclK?= =?utf-8?q?C3mr/BpCfTIWYmQbaOpojvveRDVbA4GMWFa4R4iNBrzmAXq0bnOwe3cDD0xmcJWx3?= =?utf-8?q?KXGJazeFlRxks2HBF7+ShKyMXY+aEKKlQFlh8+jtU9RF2a/z6xGegLUo60BbD1XT0?= =?utf-8?q?hFwOpV+SOLRfyUAoBcmMsjF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YloOk9FpFCd2NVh4HmlRPGsK?= =?utf-8?q?k09E6/BGgzf?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 09:49:51.2006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dcca2c9-b2c5-4299-3086-08dd0ec8d692 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B373.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6900 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] The RAD of sideband message printed today is incorrect. For RAD stored within MST branch - If MST branch LCT is 1, it's RAD array is untouched and remained as 0. - If MST branch LCT is larger than 1, usd nibble to store the up facing port number in cascaded sequence as illustrated below: u8 RAD[0] = (LCT_2_UFP << 4) | LCT_3_UFP RAD[1] = (LCT_4_UFP << 4) | LCT_5_UFP ... In drm_dp_mst_rad_to_str(), it wrongly to use BIT_MASK(4) to fetch the port number of one nibble. [How] Adjust the code by: - RAD array items are valuable only for LCT >= 1. - Use 0xF as the mask to replace BIT_MASK(4) Fixes: 2f015ec6eab6 ("drm/dp_mst: Add sideband down request tracing + selftests") Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Wayne Lin --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index f7c6b60629c2..152c60f1e80f 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -179,13 +179,13 @@ static int drm_dp_mst_rad_to_str(const u8 rad[8], u8 lct, char *out, size_t len) { int i; - u8 unpacked_rad[16]; + u8 unpacked_rad[16] = {0}; - for (i = 0; i < lct; i++) { + for (i = 1; i < lct; i++) { if (i % 2) - unpacked_rad[i] = rad[i / 2] >> 4; + unpacked_rad[i] = rad[(i - 1) / 2] >> 4; else - unpacked_rad[i] = rad[i / 2] & BIT_MASK(4); + unpacked_rad[i] = rad[(i - 1) / 2] & 0xF; } /* TODO: Eventually add something to printk so we can format the rad