From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uW5QJEWKp2ge8AgAWB0awg (envelope-from ) for ; Thu, 21 Aug 2025 17:06:13 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=XL8wnwy9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8EB831E023; Thu, 21 Aug 2025 17:06:13 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 340241E023 for ; Thu, 21 Aug 2025 17:06:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB9A9385E441 for ; Thu, 21 Aug 2025 21:06:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB9A9385E441 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=XL8wnwy9 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20609.outbound.protection.outlook.com [IPv6:2a01:111:f403:2414::609]) by sourceware.org (Postfix) with ESMTPS id 791E8385DC3D for ; Thu, 21 Aug 2025 21:05:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 791E8385DC3D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 791E8385DC3D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2414::609 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1755810338; cv=pass; b=Kln8O/XFeGL/R9GOrlVTOSGhtqPlj8ue1dHPRSQuKlOFwbRdLG1eNOGlK2vh1IzVHOL43nb1BxcUwr71Zp7b7fvfrRJzYaU9zBpMQgax7qVEccNaDEJm3diVI5xrToxc4HKgNBgLYSqW0HPzjnYhDoHa92+7OTSTfIC0wIFuyOQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1755810338; c=relaxed/simple; bh=gBIro+f5Wyvdy5aXSNouTma6Qfwj48SISRDYHTnEMsM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GT1Df31g2TLJsDsqU3imASTaQyTPnv6kOJzYupu1FCplxPpBAGMgm/FJnInnp/chQuJD0FmKGAyy8T8K4JQz4En/cgKK7/xXc2GhtX3XJgnCmNy1SPGZ1zfsrQRzbxQ7VT6Xa1YaYzQ2EwV8657gqHTX3xbnqFksglInwbUhSyI= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 791E8385DC3D ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wo5s2avlMTANw6DIaG9uyXqkzGB61cBcS8g3By8BOklr2i/zpN96Ik54/j08idvYdmzQqqN7bQ5uG6CmhEXubMLc6MLuxQ3wkGXyKTCBq6tYRLLmt2OWcm91VMhmXS5lSBlwJA8Q9VI6KP8S+b8lZRJWXctTwMV2ITk2BU7XRllP6bEq3JWrAgWCGWnFUU7irB1h76TQUyjH5NAnc85A3nv0yRKNiwrTBRWVqpNoZ9V6867ygCke5m1p46TlAGkml9Z9E0fIEWBHC08zlV1wGJXFdKW9kxvjxSWl2NOmstXE20b3IgX+y2jEs5YuKI12Vw3epsOlrkxb4xdztWCMzg== 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=s13zdM4hCMwRkv30gioF4RlUOGFi6WMVougsM+DtJ3c=; b=S32MdoCkCmN7NqogCNrRcWr8axCY4MTzhkPv25v9b7UTlroUC8NoWUuGZa14DUsLyTQjYfwU+uIJ/9ynqR4hDuJeD8B5FSk4S3wXbKcI1OLO71hp6KenrmiTJNPFCpBdDin95b/vtaJ7wCWYrZRbtlVkR/ndtHj2RBwasKYBg32rAOUFXHC9uNCK65JCAzx8yywkinuaxHo5xPcrWPWcGARl0BXOpgr6oTYSiUxrjgJZMqXEM/P/9/V9KUSCBJ61QNRDXVIbs+h8C2/OBtKegrRtkhBtDhMX87E7UEIEKVMsq8PpOsVPxaNo/52sXiLbnSI9Bm2LHiRmo01rnlhehw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none 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=s13zdM4hCMwRkv30gioF4RlUOGFi6WMVougsM+DtJ3c=; b=XL8wnwy95GWKnVsoaZoLWSUWZdO3KmhWwKLWxPjoAEs1Kxl/BiEYtbLy5sgTYdxXr7qQOa/M4WvDNeocXCzb0qIw93unDS8vNBOIripk9c8TJQLQBCXiIDZOPlZVHwis6qhJRrGIJNriWKhxFnVAWOeJbXy1L8jLqN9p3HmO+9Q= Received: from DM6PR12MB3625.namprd12.prod.outlook.com (2603:10b6:5:116::21) by PH8PR12MB6793.namprd12.prod.outlook.com (2603:10b6:510:1c4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9009.22; Thu, 21 Aug 2025 21:05:36 +0000 Received: from DM6PR12MB3625.namprd12.prod.outlook.com ([fe80::74ee:2074:3a0d:355d]) by DM6PR12MB3625.namprd12.prod.outlook.com ([fe80::74ee:2074:3a0d:355d%5]) with mapi id 15.20.9052.014; Thu, 21 Aug 2025 21:05:36 +0000 From: "Alkallas, Mouhanad" To: "gdb-patches@sourceware.org" Subject: Proposed Addition to GDB packets Thread-Topic: Proposed Addition to GDB packets Thread-Index: AdwS2y+pb2ysch8USnOoZGj8581ogA== Date: Thu, 21 Aug 2025 21:05:35 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Enabled=True; MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SetDate=2025-08-21T20:50:47.0000000Z; MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Name=Open Source; MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ContentBits=3; MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Method=Privileged authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR12MB3625:EE_|PH8PR12MB6793:EE_ x-ms-office365-filtering-correlation-id: 77e25eab-e9e4-4a10-7f03-08dde0f67969 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018|8096899003; x-microsoft-antispam-message-info: =?us-ascii?Q?G5rYSDbBfDIsSHqm0nUVqjevrZ89xZGvn6hGu2x15BXwY5lJiKRhXel/OfGG?= =?us-ascii?Q?3xcksMM/nqqnmt2vuVw3D+KuT70rJzyEhea3odHmoSxXlCPHVhTMsYxK4SLF?= =?us-ascii?Q?JN1MtJP+DdQ+OyIuCyQTFJY+fCaJtXsHmW0vl9nx5HZEWaQYDUhST0JLFzob?= =?us-ascii?Q?mMzrxwEjUwjFMOLnhUuZYC6rNY++MD8ed2LX34oCa3/r+jnCGxlYQeyQnNyR?= =?us-ascii?Q?EqGsWdWZ0rKT96mq1LvQlWS/+LrY9rn2XBTIl3gsOs09luJlkAj96HhuUmQ7?= =?us-ascii?Q?S2TJ5PFgPvXCntDsNvw777hjVoPY9r/r92+PvivZxaHqiLvApv5WFKNV04oz?= =?us-ascii?Q?5858M41HmZNSJ43tnX/TOMxuF56P22mXpdDoXji+F/bHOs+iCwyrQYg9ej1C?= =?us-ascii?Q?TWaMgLhw07FCz5r3oV2k5l6+gAMtyx5oOVZoiqLP1RAGbSEE8JC3EUw1DbIQ?= =?us-ascii?Q?xAt8rYgI0e7sZz/cCXonYijh0UoMDQ2fK5qF4y8oLAKAaMd5+R0C61jhBcWM?= =?us-ascii?Q?09dgq8kTeCRYH0OVIzw0MzLADWN+7mWNNsPUA/ArA5W0oC5u7Rb5c2gkLSu1?= =?us-ascii?Q?gFJ6yvSt0RGTX8ipWwrwVXvlcWeHFSxb4Vj4S15lw2ShMCvrJrU9NSTyvK1V?= =?us-ascii?Q?aGBNos6+5+0okzPf9ekuK3ZqCzIzqPWSDJ46mSJqocIelNop1z8zTcnPcQ3d?= =?us-ascii?Q?fcFk+5D+rMCPqnY7a6EBEUhTMqt9R3of8CGSm9EQyU1zXMJaoP43/uONsutl?= =?us-ascii?Q?ryJGBz2AAqwWKRE2SKZLjprMtj3vS99V5uV9RD1fIhkOps0fwEPvqu1ggbbe?= =?us-ascii?Q?rcC3UayOPSTC16rHZZ0rDtjfAKZ90v8VsgWmr3LfR69bzxeqGwyIdmb5nrWi?= =?us-ascii?Q?LiKKYrC+rxeDax9jtYoLUPCjWq+/yjNsEL8jiAt11BKb8pUPuFXyj2JdE2JY?= =?us-ascii?Q?UaiTyP5K+O0CHFhiYlx4HHFiZBfpm9gz5L36FisXzqYSDaBFM5C52sPFhuAv?= =?us-ascii?Q?DbZhfpBaVL+ZL+CtubbLls8R6RbQFWypwBEXS2D6ap3qYUnO5nImps7qXw9L?= =?us-ascii?Q?mRgqgEMSjfWWvIwMVyJb3DuKbcqFRm2DmIyRaCGrl+39OBpP8cZPEVCJKqkT?= =?us-ascii?Q?EWrf2m04d9FxJA4DxXgcWT0293Fk2Uao9rIAXfCCm3myM7Xan731bRRdvFRa?= =?us-ascii?Q?KJz+KxG4QdEFEaq4iyfu2XuuQRjotas1rY2uSSfRSLNj83102nLQ2NfU6jqZ?= =?us-ascii?Q?ZSaT62zww2jCpFvw/0o5raG/70AzDstqalSYdIRgZ8uNnX3IkDyGD4z4r3vh?= =?us-ascii?Q?hyJ+W/mAGOyCJ35h3qRDxbQrYHcAIsEVCM2YbOpOFCJznHMgM0NREdtape1z?= =?us-ascii?Q?H5/Bf2YZiZZvRMfrSJyn8UORTiBGGkz9OFGFjOqlArqF9O1eiPgJgwqYCeRj?= =?us-ascii?Q?zyFcIx5h1ajSROjltNKQGRnEAbMhwGlqKJkUpwU1kSlO8y2sYU50OA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3625.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018)(8096899003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rLsYGv8HTMUKVn56M6PNowcusOsbGtTrIo6jraJavtu0j6cNl11HcgO6mypG?= =?us-ascii?Q?8stCiQTzaV2ZwuT7JGoicK+J7+FbOf3Zs5CBFKr/zsBmiCed/gomtHtUeW0h?= =?us-ascii?Q?wk+MSBo5OV/4Ixz5eeyGMsS9wDol/gvVjaVkHmrd2B5dZxAcZuOjnMrFJJ+z?= =?us-ascii?Q?tBeA/AvuSQ6KVKyKDgiFpg7dB/ddon2KWruP7SdWaYGwnrdvk+EkEIuG8FQV?= =?us-ascii?Q?xz/VuOBovdAukS614zkiphQ3p3KbuMZONVVEpAEnCordkrLyPnCNe0lL0BK/?= =?us-ascii?Q?PzN5avbZbORh+U7T8k1nCp0eh6jQeTKT4Rc7reGZ19BeltreusfJyqL9l9Qs?= =?us-ascii?Q?VvnPAsVMBjTGlcw6KP387sEAzqMXR1gtdtWDe0rvZeaEwu0Qntzrz/M98iYK?= =?us-ascii?Q?bcj8xU++tSy/CRjWX+PJEs9LbieVOSdlFSxyZLykiMnXRmkRqNr4neQ4LRt4?= =?us-ascii?Q?Q4tTpewVndHXYmI21Qtb2b9wdZ6lhAS9m0BG/a/FGOZjMYGBq0QFjm7w/JGC?= =?us-ascii?Q?ERlq1t6dlc6YOSADC9UWEo27oRd71Uoe2UeSjrZOUqaT3Eivix0IvK2X6YNZ?= =?us-ascii?Q?HeTFbZRtxpi8dxQWwSIlXlIoqbw+0SJcamTbbgZpiKslesMmbDt3jcC9J3kz?= =?us-ascii?Q?aN7v+5eKXCjGh4CClyDJOr9EMgqX0S+NmaDu9gbL6l0/Tvx4Br10Ug4Wf1UV?= =?us-ascii?Q?8ooNJMlxG5Xi/FBWfd6B3zB8GmrfsCyqCeVjyGwqVZ17EEXN5NGv05SvmAPZ?= =?us-ascii?Q?zVapczzsiFNhA3YaTCo7oCYVoHQKEmz3OjGA46qw1Kis6eVKotnXhmccUprX?= =?us-ascii?Q?5ITHy1mV689lYkIEWLUqpvqDy/mtlh3DfzJ3ArKYRjU7XStg3VQsMHu20A0C?= =?us-ascii?Q?2IRxG9JmqRovhvmQFGt/39O2q27Bu9UTue3e6SaJdpzmjzJtT1mSRTld+yvl?= =?us-ascii?Q?mMdX3qZDqzr7rD4aafE9Qycb8Jw4VhAN0ZmFrSOA7pm/+AI2E+ZVwKIwDNPB?= =?us-ascii?Q?3WxZMmgqkc/w9yiLhR2GeuFRR2hrkaS98wwoQFZ8cbGDbfYEBN3g3u3vryT3?= =?us-ascii?Q?ju4tR6Ly4Sl0+6lczLJVB/yFIfCu4bmAZagiTYOwD59muBk0tbLw6rZZhEur?= =?us-ascii?Q?i4Cf5tmz6Bfb3jGGousD7pUY0VXNR8U0sWKmuU/LgTDCg8NKuv9Qvmnb5Cm5?= =?us-ascii?Q?8yLKbI8vOYVoXY0/UKuDxrZb7dt4vldm4KFjtilDQxl0kNBLtaZYZ9/Z/v12?= =?us-ascii?Q?46uLkn7lihAgMEfJVyqfGCc5TQv1db7vQs6ztV5ipZJnBjF0XnV29sFr5xeJ?= =?us-ascii?Q?COXMbdYi41wBWVRg5k/8spP/DlwEMXkCumvyNeOZtj+0+50jSlmZBnIi5/Kj?= =?us-ascii?Q?J4cpCQI4+jmZLNWUzAEzDKPowO+nrXWAGNqESAij8+8QbuLnilN8BaIxyIxr?= =?us-ascii?Q?hokLYZDFYpmMPpL0zWwzC1Eq0rU8Mm//fAL2Jzkh1VdYwAjOPRIGvDlz+jhd?= =?us-ascii?Q?fnsy7lTZgP9SYv1ZcJabiskzjFbT0v3BdUyrJ2HGlZf99IR2HwfLuT3v7EVd?= =?us-ascii?Q?605gp5lET/5nL37ipxg=3D?= Content-Type: multipart/alternative; boundary="_000_DM6PR12MB362505230AEE5BF14BCE7869F332ADM6PR12MB3625namp_" MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3625.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77e25eab-e9e4-4a10-7f03-08dde0f67969 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Aug 2025 21:05:35.9565 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vo4YxEUdouAOK/p9huSB0JvhGy2N9ES/8GOeXInsRaOnsOIzZ4yxAZIUsIW91YzIToWo8Kiniy+SOTrYPB2ujw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6793 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org --_000_DM6PR12MB362505230AEE5BF14BCE7869F332ADM6PR12MB3625namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [Public] Hi, I am looking extend the capabilities of KGDB for Linux, however in order to= do this I need to define a new packet format. See proposed Linux kernel patch below. The proposal is to add a packet "J" for customization in privately defined = KGDB IO Module. Packet format would "J ", instead of gdbstub.c handling the pa= cket, it would forward the call to the attached KGDB IO Module to service t= he packet. This allows developers to create custom commands meeting their needs, such = as but not limited to: - Extend KGDBoE functionality to handle reading register from MMMIO physica= l address prior to driver load - Extend KGDBoE functionality to perform pci re-enumeration and device rese= t prior to driver load - Extend packets to work cohesively with onboard device firmware's and debu= ggers This change does not require any GDB functional changes or code update, but= does require documentation update and reservation of packets starting with= 'J' The questions I have are: - Are there any reservations about this change? - Is there a process I need to follow to get this change acknowledged acros= s multiple open source projects, Linux & GDB? Linux patch below Subject: [PATCH] KGDB: Extend Serial GDB packet such that custom KGDB IO m= odules can extend the functionality for specific devices without having to = modify the kernel. Extended functionality is meant to be proprietary to ea= ch developer and should have no impact on kernel operation. Sample Use Case: - Extend KGDBoE functionality to handle reading register from MMMIO physica= l address prior to driver load - Extend KGDBoE functionality to perform pci re-enumeration and device rese= t prior to driver load - Extend packets to work cohesively with onboard device firmwares and debug= gers Signed-off-by: Mouhanad Alkallas = > --- include/linux/kgdb.h | 3 +++ kernel/debug/gdbstub.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 5eebbe7a3545= ..7f260ad3ded6 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h @@ -285,6 +285,8 @@ struct kgdb_arch { * the I/O driver. * @post_exception: Pointer to a function that will do any cleanup work * for the I/O driver. + * @custom_packet: Pointer to a function that will handle customer packets= . + * provided parameters are input buffer and output buffer. * @cons: valid if the I/O device is a console; else NULL. */ struct kgdb_io { @@ -296,6 +298,7 @@ struct kgdb_io { void (*deinit) (void); void (*pre_exception) (void); void (*post_exception) (void); + int (*custom_packet) (char *, char *); struct console *cons; }; diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c index f625172d= 4b67..326356f431a6 100644 --- a/kernel/debug/gdbstub.c +++ b/kernel/debug/gdbstub.c @@ -842,6 +842,18 @@ static void gdb_cmd_task(struct kgdb_state *ks) } } +/* Handle the 'J' task query packets */ static void +gdb_cmd_custom_packet(struct kgdb_state *ks) { + if (dbg_io_ops->custom_packet) { + if (!dbg_io_ops->custom_packet(remcom_in_buffer, remcom_out= _buffer)) { + return; + } else + error_packet(remcom_out_buffer, -EINVAL); + } + error_packet(remcom_out_buffer, -EINVAL); } + /* Handle the 'T' thread query packets */ static void gdb_cmd_thread(struc= t kgdb_state *ks) { @@ -1029,6 +1041,9 @@ int gdb_serial_stub(struct kgdb_= state *ks) case 'H': /* task related */ gdb_cmd_task(ks); break; + case 'J': /* Handle custom packet */ + gdb_cmd_custom_packet(ks); + break; case 'T': /* Query thread status */ gdb_cmd_thread(ks); break; -- 2.43.0 --_000_DM6PR12MB362505230AEE5BF14BCE7869F332ADM6PR12MB3625namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

[Public]


Hi,

 

I am looking extend the capabilities of KGDB for = Linux, however in order to do this I need to define a new packet format. See proposed Linux kernel patch below.

The proposal is to add a packet “J” for customization in privat= ely defined KGDB IO Module.
Packet format would “J <custom data>”, instead of gdbstub= .c handling the packet, it would forward the call to the attached KGDB IO M= odule to service the packet.

 

 

This allows developers to create custom commands = meeting their needs, such as but not limited to:

- Extend KGDBoE functionality to handle reading r= egister from MMMIO physical address prior to driver load

- Extend KGDBoE functionality to perform pci re-e= numeration and device reset prior to driver load

- Extend packets to work cohesively with onboard = device firmware’s and debuggers

This change does not require any GDB functional changes or code update, but= does require documentation update and reservation of packets starting with= ‘J’

The questions I have are:
- Are there any reservations about this change?
- Is there a process I need to follow to get this change acknowledged acros= s multiple open source projects, Linux & GDB?

 

Linux patch below



Subject: [PATCH] KGDB: Extend Serial GDB packet such that custom KGDB IO&nb= sp; modules can extend the functionality for specific devices without havin= g to  modify the kernel. Extended functionality is meant to be proprie= tary to each  developer and should have no impact on kernel operation.

 

Sample Use Case:

- Extend KGDBoE functionality to handle reading r= egister from MMMIO physical address prior to driver load

- Extend KGDBoE functionality to perform pci re-e= numeration and device reset prior to driver load

- Extend packets to work cohesively with onboard = device firmwares and debuggers

 

Signed-off-by: Mouhanad Alkallas <malkalla@amd.com>

---

include/linux/kgdb.h   |  3 +++

kernel/debug/gdbstub.c | 15 +++++++++++++++<= /o:p>

2 files changed, 18 insertions(+)

 

diff --git a/include/linux/kgdb.h b/include/linux= /kgdb.h index 5eebbe7a3545..7f260ad3ded6 100644

--- a/include/linux/kgdb.h

+++ b/include/linux/kgdb.h

@@ -285,6 +285,8 @@ struct kgdb_arch {=

  * the I/O driver.

  * @post_exception: Pointer to a function t= hat will do any cleanup work

  * for the I/O driver.

+ * @custom_packet: Pointer to a function that wi= ll handle customer packets.

+ * provided parameters are input buffer and outp= ut buffer.

  * @cons: valid if the I/O device is a cons= ole; else NULL.

  */

struct kgdb_io {

@@ -296,6 +298,7 @@ struct kgdb_io {

        void&n= bsp;            = ;       (*deinit) (void);

        void&n= bsp;            = ;       (*pre_exception) (void);

        void&n= bsp;            = ;       (*post_exception) (void);<= /p>

+       int &n= bsp;            = ;       (*custom_packet) (char *, char *);

        struct= console          *cons;<= /o:p>

};

 

diff --git a/kernel/debug/gdbstub.c b/kernel/debu= g/gdbstub.c index f625172d4b67..326356f431a6 100644

--- a/kernel/debug/gdbstub.c

+++ b/kernel/debug/gdbstub.c

@@ -842,6 +842,18 @@ static void gdb_cmd_task(str= uct kgdb_state *ks)

        }=

}

 

+/* Handle the 'J' task query packets */ static v= oid

+gdb_cmd_custom_packet(struct kgdb_state *ks) {

+       if (dbg_io_= ops->custom_packet) {

+        =        if (!dbg_io_ops->custom_packet(remc= om_in_buffer, remcom_out_buffer)) {

+        =             &nb= sp;  return;

+        =        } else

+        =             &nb= sp;  error_packet(remcom_out_buffer, -EINVAL);

+       }

+       error_packe= t(remcom_out_buffer, -EINVAL); }

+

/* Handle the 'T' thread query packets */  s= tatic void gdb_cmd_thread(struct kgdb_state *ks)  { @@ -1029,6 +1041,9= @@ int gdb_serial_stub(struct kgdb_state *ks)

        &= nbsp;       case 'H': /* task related */=

        &= nbsp;           &nbs= p;   gdb_cmd_task(ks);

        &= nbsp;           &nbs= p;   break;

+        =        case 'J': /* Handle custom packet */

+        =             &nb= sp;  gdb_cmd_custom_packet(ks);

+        =             &nb= sp;  break;

        &= nbsp;       case 'T': /* Query thread status = */

        &= nbsp;           &nbs= p;   gdb_cmd_thread(ks);

        &= nbsp;           &nbs= p;   break;

--

2.43.0

 

--_000_DM6PR12MB362505230AEE5BF14BCE7869F332ADM6PR12MB3625namp_--