From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.23 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796061827; b=hZPEF5idNu902qX6sdnyoi1NJ6CemPAO/T/hc7DhQPa9XCgq2GqRrANo6eArttTgIhR5 KxTxb0La7jVYv2auM9nR2JqqyBZVCXRfqdCeFRBSUdkNma3qK1clqc/xZVaAvDoVuj/d3 3h6NNFJ87IhHrsDeMStjiqEFAJO/nmVte1hW9zZBZUyhOrrC4ByZ4EyVZseIjpLPWk7TV I55ibfCU+3laTOO+95tZc7mA2UE9WGs4lfp5GS9H3r1kHK7lhucNd9zVrtRmEu9g1iXof 7RLpX8VBReD2ZRAvOUYdLJjjx4y83TpUnjgen738xEum9ch7CEfuZGaf2Ex7IeptdVQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796061827; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:Content-Type:Content-Disposition: In-Reply-To:X-ClientProxiedBy:MIME-Version: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-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=ibbvn8QtvB+hyM80DpMaU3Yex4SnPwE9ooKe2wCduMg=; b=oZesxeTeUMbcoZDpEK4Nxb1f62vvKGyoX7epquEe1uxg22acRitIYYXGpx2pioykHFwN Sl7FYUsGQX/zi/v+IFMVPjO8gLXxmWFvdLfSA6XDWwO7Rm2WWcSq6sZN1CyCDYD5Gaq67 xOG12Cxn6M3HfCMZ7phS3WjpKE8mwfKZp25iHxWH1HfVH5X9Ut3ltA4YbW0UyvoscgDDY PfPuGmID4I7AjGFHua1Conly4tuCyinISiH7HiSvJ60463yhGyzk8ELz6Z/RyEmLxp+n/ 3z+86QMPcABjk6nTVGpGXKwqWDEe1/7EIVby9uuql2RIJkz4Ke82h3NEDp7xKP5sGxg== 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=WWHiMBRi; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.23 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012023.outbound.protection.outlook.com [52.101.53.23]) (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 0AE31606A31C for ; Mon, 30 Nov 2026 18:03:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0AE31606A31C 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=WWHiMBRi ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mk7mPm/DzWu4rVeLiL71v4nGC6vU47WJgFpB9ugNEgCUY5gpllOIgHCncHWN09oeOnw5T7y8uLRdHx51Zdy4t68I8/lK3/WLGthGlLcZuRm0WiDpcLmx8WYgj8CsNhbG8am3EQ+rHpWDXj8XlPNkKZXP3duV3P89I17ej/iyunw2lv26/l351EWxxOczaH7h2WPCXu87adTR2SCUVfvpuO1MVNx8rDlLkJUWxGvEkR5uyPNSVLz0stdOZDr7DJN3V2ubnwf6/7LKNm0KS/HDeWuuZFQm7GjMvkSHvJcokWGGJTWst7lRD011O5A7AJ1Tz+GfhceQdtnTuDU4l1jnQQ== 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=ibbvn8QtvB+hyM80DpMaU3Yex4SnPwE9ooKe2wCduMg=; b=QYu17X3InSq6v2dU6GAyrDicU2+CimsH/sM4rDPqyoyggL3QhUOFCI+pyadYuJwYu5K2iTxJWasfaeljZDseVo+uIKVIAufUSobx7OTCeTnsbxhD6P1vKvDg2lPezNdrgPYhehTYOy7q1v1KoG0TpZApfGRkY3ECF+93RBRBBJ+6qvEzAabXzcHCihg+SnEQSGkpykOOeOyGqI5lfOKrgpqoPga2n7zrkhUAu29fs2MICSRbHUMivgA/VZGSvt8Iau8nAwIayFIFZ/nu32OMqLVJSjf+eih+N/SaEXr9KQ55XrFHzx4GSJraOZwyR894NgfqT2xfb67KVlz56v7bew== 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=ibbvn8QtvB+hyM80DpMaU3Yex4SnPwE9ooKe2wCduMg=; b=WWHiMBRiSJ4CRSe17BiH8xkBsQs1ycKnY5LRv5h1XdkmC9I6dJBYNX5oLT5tHKdCK/gMIZRduQMNB4wakNVaaZPWhvXOXxdz2WkbC1NVGN8u1w7/7aWAN5eXwZRLcUnHTItG+iZ9K7bEJrxKLUpwpSW6Da/28XcLwaVcNVgCuV0= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from EAYPR12MB923140.namprd12.prod.outlook.com (2603:10b6:303:2fd::15) by DS0PR12MB8293.namprd12.prod.outlook.com (2603:10b6:8:f3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.639.12; Mon, 30 Nov 2026 18:03:00 +0000 Received: from EAYPR12MB923140.namprd12.prod.outlook.com ([fe80::b986:8b81:beda:c167]) by EAYPR12MB923140.namprd12.prod.outlook.com ([fe80::b986:8b81:beda:c167%4]) with mapi id 15.21.0662.004; Mon, 30 Nov 2026 18:02:57 +0000 Date: Mon, 30 Nov 2026 13:02:48 -0500 From: Yazen Ghannam To: Lukas Wunner Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, Sourabh Jain , Oliver OHalloran , linuxppc-dev@lists.ozlabs.org, Sathyanarayanan Kuppuswamy , Keith Busch , Maciej Grochowski Subject: Re: [PATCH] PCI/AER: Check error status registers if Error Source ID is zero Message-ID: <20261130180248.GA212336@yaz-khff2.amd.com> References: <1ddc35c51b5317988bbf235c467a9534218c6ea4.1795717157.git.lukas@wunner.de> <20261130161857.GA14048@yaz-khff2.amd.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN0PR04CA0021.namprd04.prod.outlook.com (2603:10b6:208:52d::32) To EAYPR12MB923140.namprd12.prod.outlook.com (2603:10b6:303:2fd::15) X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: EAYPR12MB923140:EE_|DS0PR12MB8293:EE_ X-MS-Office365-Filtering-Correlation-Id: e6c452d4-d20c-4a67-5756-08df4f0c2a30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024|23010399003|6133799003|18002099003|22082099003|261021121427099003|261022075727099003|261026140227099003|261026121527099003|261028144727099003|261022105027099003|261102123227099003|4143699003|10067099003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: iI2e037u5esQUxpnC2+cVzABakUqXZWYQ1MCIcnBJde/H5JRQ409GkC2mZ8A4qenmNwKPrfI5VFMyrJ9WqlDExFdpobq0bhv7m7tvynQFV0U4D+1HdiSeYiLhdGr97AjXim52rVAAq7fmGzEyixKQwt+kOat2675OPNIbqtAKWB80ZRWEt79toc6VkTyzYRyr2r0CGzrgNrc+odsq2IDJrGJuurWysruHBAQe8VAD+z0WLrMjoRPio5DlHgg8u6r8zfb06IbJyNxlPXuxOd6JvIfMMFG+zXtO8hAomw1fknuHX59DUC/QvS49+IfEiooiWbzmZPcCXF3uYIMA9ZAHXBpkdxOXsk7UGE7/xgHMZCwPfxFT1eXbJtZyanL07x5mXMKIFezlkTEn55+z7SNWF33BbloX5mMXO4BNxJmUt0LY9zuBijjxfJWwn2NSJdOPJNrG1TrJJXqaxCQMhow66wKFGOYq/fryOCN01qPOJJN/Tk6jtYcQDnnRct8rnh0vg28H1rjXI9mZJ/+Mdako8sDrUzMcaR/4YJU1L4pQeurOSApHDsxIpY9AbfYPj8KLmoe9sy4qc0egSkD+vGzwgMDBrSx0VZyuuNsVCDfLfh7jHT+3eeIaJB82pha3FyxnA2PkjCaAncEpXr2KLt2pyBgicbwlwfUufYeGJSnSKA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:EAYPR12MB923140.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(23010399003)(6133799003)(18002099003)(22082099003)(261021121427099003)(261022075727099003)(261026140227099003)(261026121527099003)(261028144727099003)(261022105027099003)(261102123227099003)(4143699003)(10067099003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?C0NczKogS4SInB/kEj7rJRDOoZZudyue11gVWmFiYRaMMaueY5lDO2w1DgnK?= =?us-ascii?Q?9XNlLZWT/6pPjZoJyiIGxxfrndkOdMW8+c+EjML7DjRAV+WnQY2p7DoVFbpp?= =?us-ascii?Q?VHkUoi0rU7IsvkdKcVZHGqzLQ2zTPACD2stADsdZss8/wpXUkkInx0EZCf87?= =?us-ascii?Q?IdUTIKedeB51e+620X5S7uyCv7CMVC8Bh9TTPsEYQM5+GqWMoluHBgdch9t8?= =?us-ascii?Q?Rg05E2N8DnNFFsiPlKGaFBzIWZdeMlYDuOAv+8tIlx20TP4kTvOFjtjtOHQL?= =?us-ascii?Q?NdKW94zHXZvz07vuNPipSXBQiVU4oqwHZDzt+y7Gh7G1kqhviyAOSVo0h8+x?= =?us-ascii?Q?lQYTpsECRb6I+3qRBgK1fBUWvXiUSPqF8p/xJ8ZsFvvKbSmgKdu7Sbw47g3+?= =?us-ascii?Q?zJasneTLgXxBKgiN5PvcNTcKPa+nf9sMGDPl95Jy+xoFJaE/Fpyk7y1N6zVx?= =?us-ascii?Q?V0CY53cWCZ/XRFWYXJjnjx/BWe/I/6u0ti0Kp8yJ4+JyMe4+qk5XI/sjeC2H?= =?us-ascii?Q?JbvbTffeB7JiLRdsa0arDcBH+WpQQKz/c9YPH/dSwLWa1OH74XuCG9VNuOWk?= =?us-ascii?Q?VwfT4f1fR375am10qe/gqktSeWrUK7TINbHgersWn2lOKxjNjec9Q6ywkb58?= =?us-ascii?Q?sMHgGIScStLnZ6jxgoF3hfnFNTP7r76imDCpOVoSHh6ADAfSvTVoTIpTqgkY?= =?us-ascii?Q?RuN/fTLRkZFrSL/GyFtAAcEx/i6n2NTl6jQJICnyMkma3uhYH/T4NFJOF0gi?= =?us-ascii?Q?FetAPqFRq7iNF5yUwer8EzNk3M+xwVW5L2JZDhuTlZPbryl09ctXPlSCpgar?= =?us-ascii?Q?YA2+3n4SvryDre7XMGru5cthGsgJbavlOz6vVD/OPAMLF0zWkLFtu3ApxqJj?= =?us-ascii?Q?nRCbnd9Y530pvsrZH2yAsIEgmQc/+C/BGsTsfYE9KrylLLrZfvkLsv2FgmRx?= =?us-ascii?Q?APhgPDVI389iktMLA9Ni144M7FHQ3BJALeMZFrygfh/7IsykKX7yfQ3EKz6M?= =?us-ascii?Q?NMjaYne58tI7iVwBtJPk8Ij4UOiuHnRxhvboq+8QR68eBTixasi/+arVKZ0L?= =?us-ascii?Q?q/ZPDXp4PecuMcqL4TL6hvS1R69hTqEwygwOwJeTeJ0wLV7c8s3qLIwg+YTF?= =?us-ascii?Q?Yg55oXIDcOsHufcX+gbZAPs2N8m2k+MSfrDn99h3Mx5lJ3i++rph2Ou+44Tl?= =?us-ascii?Q?zDbO5vWokmPIlj7jV31puilD/paoZ5BFu7vaM7HG3NVKna1I4GkyT0UTZO2c?= =?us-ascii?Q?nB3B5w4xA4s1CbM16dv7kqoCzFY40XdgHzKNyD57ssa+muFzkQzuUBB1RNyO?= =?us-ascii?Q?/tA1B8WyXNbRpf8m/InPRjyfCUR5vRglEadl0B9GykeyQBqXrAK5haPf8YdD?= =?us-ascii?Q?McSsa7splFjKVpe4+WxEq5OaX7a+Tx3cUZaoggC3S2h4XVmSVlMev7JmUeA3?= =?us-ascii?Q?v3RyhZrtWZpuFRkgCVxNoNN7QNjfI1hP4q3B5lHFXt2560bhqEH5jTajvt/s?= =?us-ascii?Q?XeyR0fmnxlA7rzNz7AmtJ6NEMDFCDrosMNSvgM63UX9PSAkI3WZRrSCWUguu?= =?us-ascii?Q?3m9TaWQF5Wv0cv47+if4lEtBSakqRv67lSbWbyenKRTJxKfw4TRbJXFvI7m/?= =?us-ascii?Q?i3QSE4/Niv5J710lLASFurd90cPElDVKBkIRGwzXhGVJlQyeFY/NDpX/G+vt?= =?us-ascii?Q?XZexCnHRZfWJlZG0hpw9rmXmW7yXMN58iE3OHBwhBqBQJxmpzDyFKo24OAIH?= =?us-ascii?Q?QDt7gaf6pw=3D=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6c452d4-d20c-4a67-5756-08df4f0c2a30 X-MS-Exchange-CrossTenant-AuthSource: EAYPR12MB923140.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 18:02:57.7235 (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: Ax7EhguXXXs5bUsNuVY3kcEqQhvA5dc3txVhSmPPqu8VVWwD/pVjLANrjKCiEq2OhtV3l0Ap7nZ1Y2VHDhTa6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8293 On Mon, Nov 30, 2026 at 06:09:00PM +0100, Lukas Wunner wrote: > On Mon, Nov 30, 2026 at 11:18:57AM -0500, Yazen Ghannam wrote: > > On Thu, Nov 26, 2026 at 07:35:00PM +0100, Lukas Wunner wrote: > > > However per PCIe r7.1 sec 2.2.9.1, devices may send Completions with a > > > zero Completer ID "prior to the initial device Configuration Write > > > Request". Similarly, CXL r4.0 sec 8.1.5.1 states that a Component may > > > generate a CREDIT_RTN IP2PM message with a zero bus number after reset, > > > which can fail ACS Source Validation and trigger an ACS Violation Error. > > > > The Error Source ID records the "Requester ID" of a device. So how does > > the "Completer ID" behavior relate here? > > > > Can a device send ERR_* messages before it is initialized? > > As an example, at any point in time can an Endpoint raise a Receiver > Error due to signaling issues at the physical layer. That could occur > prior to the Endpoint receiving its initial device Configuration Write > Request from which it learns its bus, device and function number. > > So yes I do believe that an error message could be generated with > a zero Requester ID. The reason for referencing sec 2.2.9.1 is to > make it clear that the device learns its BDF from the first Config > Write Request and prior to that, the device uses zero as its ID. > > I'm wondering if we should perform a single Config Write (e.g. to > the Vendor ID register) immediately after issuing a SBR, FLR or coming > out of D3hot/D3cold, to ensure the device gets its ID as early as > possible. However that would only shrink, not eliminate the time window > within which the device uses a zero ID. So we have to cope with a > zero ID regardless. > > > > static bool source_id_valid(struct pci_dev *root, u16 id) > > > { > > > + /* ID is zero prior to initial device config (PCIe r7.1 sec 2.2.9.1) */ > > > + if (id == 0) > > > + return true; > > > + > > > > > > > What is this hunk supposed to catch? > > Without this, if the Root Port is not located at 00:00.0, users would > see a gratuitous " (invalid source)" message in dmesg for a zero > Error Source ID. That message would not be correct because zero *is* > a valid Error Source ID if the device is uninitialized. > > (The message was introduced by 6d69eeae8966, which is queued on pci/aer > and which is fixed by this patch.) > Yes, that's fair if the premise above is correct. But I think you are still applying the explicit spec details for Completer ID to Requester ID. And it seems like a logical jump. The device *should not* send ERR_* messages before the enable bits are set. And those require a config write, which means the device should be initialized. So basically, the premise is not possible according to the spec. **BUT, I think your point is that a device *could* send spurious ERR_* messages before it is actually initialized. IMO, this seems more like a busted device rather than race condition gap in the spec. All that to say, I agree this could happen, but it's not clear to me that it is "valid" vs broken device behavior. Thanks, Yazen