From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) (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 DCEAD24A063; Mon, 18 Aug 2025 15:11:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.51 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755529866; cv=fail; b=mb1ZDLO80SNN6XqRaDOz/6i5AixcnvUXF9dl9/zaQLNWphmXHIwk61LvNIdQlRDJmZRAjgoA/IRhxV+sbTOaZ4+m9SsmS0qEIeozbC6oAdjHXOUpOCQm5E5oD+4CRp5iWO2i2pvgDmW2zjOK3E+pYqJu/on/z99UqaaW0jxEcm8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755529866; c=relaxed/simple; bh=zWifkVy9ORwssaByvt0SVZQ3Af1BEL3fqCSRLa8mNvs=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=T+nUsIERGfp7+KbXvz/7J/0EM0653Tx8zmibnnTawvjiS+No0BI4f9tJrdMuJK+meBCuuGhFdEktAPuk4Bgl5fHFoj6bwDbha4CX0/A8i4Axyi0BahOt0NaiwpHo9wDLqM9xpaMwEx3OCQ83Op2IWioKS60s2ygSb5YgYso7ds8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=smabW86B; arc=fail smtp.client-ip=40.107.92.51 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) header.d=amd.com header.i=@amd.com header.b="smabW86B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q9E8M890q99lLzlEAICN5DGdPb9MPb7wnmW/3VebbCJZpN22hdNMsqfk93d6RZE8RUicqCDMWMxLvdAyoIYjUbmDNyqPaRYsiAAi/QL6yFN0H8w/ie2hjwTpsNbd4dFNHp/58p6HN9h62C5ZY8uKzsUNzTxqQjTmguJiSq2Bq/l+nI0GwSpdG3c9tZovdra0bbkGqsu0zTD18/2p2RVpT8LqmIiAHuzj2leUSdnE9JKfZxXEPCUBFab3dj0/Kal8E4iKOA4AR3QZTRblKT8lEpEG7zzlS+ncWF8QNRkn6ZplGBzwGasr9YO6z6ubJ9HE6hP8K1kUtlnIXPmnu1wahA== 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=g4pjkKnpKyJJq3gxFmlsUEniaPL+PFg7H3b+ci/Z0YQ=; b=SKN6JpnOYTrlldOyW27XOvRpOjFR6Uhiqziuy7U+wdczFaqu4gW9+M1BWcJat74hnyE8j1L+wsxYT2ghR45kzoKVZmDNIO1iY+79A2R2DqLLIOIJEnkIaUvnoKTfv6Ko50r3W0FWzCLtCC/WcuKqYdRGPU4kMdC+K36sA27T90+2uvUPezDc8BgYtPcwie4nXLCzQV0hTzQhR/Ac+knx2U3KinFxZFb0ulupMDgF0ezl4y78aOS7r740ekhIdjN7MB0rG0wiVEsM2fAA7D8wvGMUFQa1Vqky9crtq1WDAkEQ8vVd3+pLvrqzTSHeygf0enHsieq6zKzmCssKCY0Jiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=g4pjkKnpKyJJq3gxFmlsUEniaPL+PFg7H3b+ci/Z0YQ=; b=smabW86Bzhl/thj1uAFhWRhjX0KkKspQNjeCQ87InJOceH+Yx9pGUcCS5oAteq5+jw6gaKbFmO0RuIDFbrsP2iVH5dwNHbKqV91t5IQlaEA1v+0t+yqxzlV1MaqUPgBjXIbKYVix+EgsbG3lzBSKiCc++e8vG3mHKhUq+r+c5UA= Received: from BN0PR04CA0180.namprd04.prod.outlook.com (2603:10b6:408:eb::35) by LV8PR12MB9713.namprd12.prod.outlook.com (2603:10b6:408:2a1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9031.24; Mon, 18 Aug 2025 15:11:01 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:408:eb:cafe::c) by BN0PR04CA0180.outlook.office365.com (2603:10b6:408:eb::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9031.20 via Frontend Transport; Mon, 18 Aug 2025 15:11:01 +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 BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9052.8 via Frontend Transport; Mon, 18 Aug 2025 15:11:01 +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; Mon, 18 Aug 2025 10:11:01 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Mon, 18 Aug 2025 10:11:00 -0500 Received: from [172.19.71.207] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 18 Aug 2025 10:11:00 -0500 Message-ID: Date: Mon, 18 Aug 2025 08:11:00 -0700 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] PCI: of: Update parent unit address generation in of_pci_prop_intr_map() Content-Language: en-US To: Lorenzo Pieralisi , CC: , , Bjorn Helgaas , Rob Herring References: <20250818093504.80651-1-lpieralisi@kernel.org> From: Lizhi Hou In-Reply-To: <20250818093504.80651-1-lpieralisi@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|LV8PR12MB9713:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d00d3d5-890b-4ece-4389-08ddde6971bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024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lPbEZEWVhYSjFkL0U4elk1VzVWNXlpNmRpK3NCT0hqamRZOENvaDlVQTB1?= =?utf-8?B?MGNGS2toZk5kSmpaTDhNZXVkS0pNT0x3K04xbE1NYVdqQk1qUEhkYXJpblhO?= =?utf-8?B?YllNQWV0bU83elZMUG11T25FMnlmaVFRNE5Wbi9kMzVZdEVhVnlDVkRZRkFr?= =?utf-8?B?VFMxdElKOG0xSmZuNVliaERGdVNmRXBDREt0a01tUGJNaUZxNW81dUtRNWQx?= =?utf-8?B?N0dIT2ZTM2dnPT0=?= 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)(36860700013)(376014)(1800799024)(82310400026)(7053199007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2025 15:11:01.7072 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d00d3d5-890b-4ece-4389-08ddde6971bb 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: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9713 On 8/18/25 02:35, Lorenzo Pieralisi wrote: > Some interrupt controllers require an #address-cells property in their > bindings without requiring a "reg" property to be present. > > The current logic used to craft an interrupt-map property in > of_pci_prop_intr_map() is based on reading the #address-cells > property in the interrupt-parent and, if != 0, read the interrupt > parent "reg" property to determine the parent unit address to be > used to create the parent unit interrupt specifier. > > First of all, it is not correct to read the "reg" property of > the interrupt-parent with an #address-cells value taken from the > interrupt-parent node, because the #address-cells value define the > number of address cells required by child nodes. > > More importantly, for all modern interrupt controllers, the parent > unit address is irrelevant in HW in relation to the > device<->interrupt-controller connection and the kernel actually > ignores the parent unit address value when hierarchically parsing > the interrupt-map property (ie of_irq_parse_raw()). > > For the reasons above, remove the code parsing the interrupt > parent "reg" property in of_pci_prop_intr_map() - it is not > needed and as it is it is detrimental in that it prevents > interrupt-map property generation on systems with an > interrupt-controller that has no "reg" property in its > interrupt-controller node - and leave the parent unit address > always initialized to 0 since it is simply ignored by the kernel. > > Signed-off-by: Lorenzo Pieralisi > Cc: Bjorn Helgaas > Cc: Rob Herring > Cc: Lizhi Hou > Link: https://lore.kernel.org/lkml/aJms+YT8TnpzpCY8@lpieralisi/ > --- > drivers/pci/of_property.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c > index 506fcd507113..09b7bc335ec5 100644 > --- a/drivers/pci/of_property.c > +++ b/drivers/pci/of_property.c > @@ -279,13 +279,20 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, > mapp++; > *mapp = out_irq[i].np->phandle; > mapp++; > - if (addr_sz[i]) { > - ret = of_property_read_u32_array(out_irq[i].np, > - "reg", mapp, > - addr_sz[i]); > - if (ret) > - goto failed; > - } > + > + /* > + * A device address does not affect the > + * device<->interrupt-controller HW connection for all > + * modern interrupt controllers; moreover, the kernel > + * (ie of_irq_parse_raw()) ignores the values in the > + * parent unit address cells while parsing the interrupt-map > + * property because they are irrelevant for interrupts mapping > + * in modern system. > + * > + * Leave the parent unit address initialized to 0 - just > + * take into account the #address-cells size to build > + * the property properly. > + */ Reviewed-by: Lizhi Hou > mapp += addr_sz[i]; > memcpy(mapp, out_irq[i].args, > out_irq[i].args_count * sizeof(u32));