From nobody Tue Sep 29 04:09:39 2026 Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B0B1480325 for ; Wed, 12 Aug 2026 17:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555378; cv=none; b=GEOKoAK5CxQgar4g2KpgSe4TtOq3begdgxysQM5K+c98SprEsSe4U7FclVrNO5VRvgfmKkDln8a3SW2zFANou4PSME/GSfMKrN5AKS6fwVraO8PUcvsL10EOcGEB09hv50louHdMxvda5uu6mPHfo0hNjiHqRwKhrTTBL+RKRXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555378; c=relaxed/simple; bh=6MU93lD7oPCvVgWA1NeStXtYPktufCBo3mj6HDbyAGg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dLreA0buRkLqZKGdMtXSd95k/e+smh+5cp2KO9yeVry0e3k3uD9bjNbUVcW/YAQEB/M7eba9D79xfi3Di/PKKAokJWQfqiANxWKYnvDjysD5w8mb+hESk3i0R2Wuub1hhuaxb+oVQkp91aXzH/dNXFQ5fVi1q1RtfdyjDWWzm9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b=Z+qUtLgx; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b="Z+qUtLgx" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-92e6a434cabso67093085a.1 for ; Wed, 12 Aug 2026 10:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1786555374; x=1787160174; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=y08cvUPAERT8DtacgubgZYXObs4Ve5NXsThRcrzdsK4=; b=Z+qUtLgx+oq9V3oy0k6sRn8V1y8xOMf0dg+auyyVCU65P7e3OjOVgxr/n0H/S8J2mA CikliHIfztA0Bl2QQdU1L+r1/x0Uslr6fTQcZlzpfaQfZ0+qA+IPQtx1+GYtvZpVlWSm l/FgB+3gr5j7omazItHXkCFUJ55LxCG/A4f8JpJI3gBtQEAz5ZNslU6kgJcjMe/fAKkv JP7GvSYZtJj7RshSPdf3L84NY4TCPyd7ySeZykJirKra+xyAOUU3VLWhvDKMgM0Dy9RQ XLp5B+0wjss/0xOQtHTpikT/JbY8wctqm6sRKHLeQs/bx6b3ZmCeM2M180ofg30c2NlT dKrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786555374; x=1787160174; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=y08cvUPAERT8DtacgubgZYXObs4Ve5NXsThRcrzdsK4=; b=Kf3e9It4oZEmykkGV2kvS2QTcQ3UvyhCSpoieHYA6gX2lUzkU0HWSdF2wQbBalBGsK 615p2VAVI5o+jfmPFC7T77FftlaEkZOMJBoJCYofMoA4D2kSuBNP6TZ1JxAskbglH/yR b5eyxiXGZ9+m/A8R/2gsh1RQwrr/2M9QCF4579ujq3c1t3QQgGK5CfQ/KbqKY0qABgn/ H6GE92l3kiYlVbDDcssWYYUK/kGrf1bE+IlWdZMYqedh56nDH8wkVYzVgVyUIzuZz+Vu J1udQMkiOlThpaq+CIdZtII4qf153QVmx/G0ek6VmmU+3AxD9tGD9knLGCgnJU8nRWHW fruA== X-Forwarded-Encrypted: i=1; AHgh+RqtTWw22xaAj9xlCFFVLz6RB9LUjlKDr6e1fruaFilNJQ4YVd4+cExpu7zD2H1kvqx42JkRUWEYXzEPNio=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1lX7Q2rduvLm9cPyBMwGzjzP1E1y34IyrqVlGbvFIOYx/gTha VkKK1vZflr74nLi87+64QnKH/Y6OQrUfC8pQk0cogx8kcAqmTJ7TmCRjx82ysdYuR5UyZToMr+r 5HAFjgO4= X-Gm-Gg: AR+sD10RUspafHef9joPkchVIyj5hOuch+RLpoTd1OulDila00B90qCw6Ir1VkR9AxV 2/Exb7pvBMUtMxVUHv1Qs7DalNM00Dz/R54JnvPBVAbincdlBClhPIqlqmKBpGVH9zTa5WozBu3 ZgwDKAdreycW9VY3ZcXRUK9vYYrQxI9twXiO5sQE12+puUtudijz/5OYIUYTgVUzYNxaLoOCXAz bvRW+hKbOF2OUZcHixnam+cwiPck8HrCQ2HwtInidT5Tr/ltcijBcOcvx+WUSdqas2SLIpyon5S k0vMQSiTnBLnw1uyuzKPyP4E7NnNUGR/zaYrHbs5wQZZYvb44LRoMG6LWYojRnN6y6g8h6ubfER UIEhG5S6qtyjZ+UjkX/aKvfggX74S4qSoHizDWTZKM+EtGj1MZoXGW+6Cj76cBN/y1rcd36PjOY RGvy2qVS2PF1UjUiC8L9Yb2DfZNz53WRqKmBqJsNqqju+YKborsuglqarICQjQWLKP X-Received: by 2002:a05:620a:4710:b0:930:fbdd:c242 with SMTP id af79cd13be357-936b3d241eamr541326885a.29.1786555374150; Wed, 12 Aug 2026 10:22:54 -0700 (PDT) Received: from zippy.localdomain ([73.62.185.64]) by smtp.gmail.com with ESMTPSA id af79cd13be357-936b5f720eesm173587685a.47.2026.08.12.10.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 10:22:53 -0700 (PDT) From: Alex Elder To: bhelgaas@google.com, robh@kernel.org Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com, lorenzo.bianconi@oss.qualcomm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina Subject: [PATCH v2 1/4] PCI: of: drop the reg_num argument to of_pci_set_address() Date: Wed, 12 Aug 2026 12:22:44 -0500 Message-ID: <20260812172247.276554-2-elder@riscstar.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812172247.276554-1-elder@riscstar.com> References: <20260812172247.276554-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The reg_num argument passed to of_pci_set_address() is always zero, so get rid of it. Reviewed-by: Herve Codina Signed-off-by: Alex Elder --- drivers/pci/of_property.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 75a358f73e694..505226b876c56 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -52,7 +52,7 @@ enum of_pci_prop_compatible { }; =20 static void of_pci_set_address(struct pci_dev *pdev, u32 *prop, u64 addr, - u32 reg_num, u32 flags, bool reloc) + u32 flags, bool reloc) { if (pdev) { prop[0] =3D FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) | @@ -61,7 +61,7 @@ static void of_pci_set_address(struct pci_dev *pdev, u32 = *prop, u64 addr, } else prop[0] =3D 0; =20 - prop[0] |=3D flags | reg_num; + prop[0] |=3D flags; if (!reloc) { prop[0] |=3D OF_PCI_ADDR_FIELD_NONRELOC; prop[1] =3D upper_32_bits(addr); @@ -131,7 +131,7 @@ static int of_pci_prop_ranges(struct pci_dev *pdev, str= uct of_changeset *ocs, continue; =20 val64 =3D pci_bus_address(pdev, &res[j] - pdev->resource); - of_pci_set_address(pdev, rp[i].parent_addr, val64, 0, flags, + of_pci_set_address(pdev, rp[i].parent_addr, val64, flags, false); if (pci_is_bridge(pdev)) { memcpy(rp[i].child_addr, rp[i].parent_addr, @@ -164,7 +164,7 @@ static int of_pci_prop_reg(struct pci_dev *pdev, struct= of_changeset *ocs, struct of_pci_addr_pair reg =3D { 0 }; =20 /* configuration space */ - of_pci_set_address(pdev, reg.phys_addr, 0, 0, 0, true); + of_pci_set_address(pdev, reg.phys_addr, 0, 0, true); =20 return of_changeset_add_prop_u32_array(ocs, np, "reg", (u32 *)®, sizeof(reg) / sizeof(u32)); @@ -458,7 +458,7 @@ static int of_pci_host_bridge_prop_ranges(struct pci_ho= st_bridge *bridge, /* PCI bus address */ val64 =3D res->start; of_pci_set_address(NULL, &ranges[ranges_sz], - val64 - window->offset, 0, flags, false); + val64 - window->offset, flags, false); ranges_sz +=3D OF_PCI_ADDRESS_CELLS; =20 /* Host bus address */ --=20 2.53.0 From nobody Tue Sep 29 04:09:39 2026 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED71F47F76A for ; Wed, 12 Aug 2026 17:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555379; cv=none; b=Z52iA2/rmlZybPqgvuZSsiPyga8E4lqtWoVqCUzWQ73Aio98ZWmeS9Gx1dP865e05uzPBIckKXBRfHID2VuoHgQg3T57u9hHq/Du6ZbLELwSGZZ8MisSoym9ggZWQVsCugcTuGzmP+sQIWmPF4PVskTnPE0wuF3YMCYJILMxbtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555379; c=relaxed/simple; bh=BtmQtSAcOc1sMwXsSXHd/N0LJhsNzGr+XDlMMcgHhfo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adAmZYES+7X3GEYAYNx76gZ7VCBLmWuPPP+lLWH2NszPs/vAnT+TsCpJ8lfHlKMxWICrquqL0hEppmJtIVPMEBeYngaJDTYPL10WS17vE/6yL9N2sRjzwXWPsFnual015eG8TebE2nKGzIWJTFJUPicdZ3Qo+9TIbOLu4D6iANE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b=ub1ESb4b; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b="ub1ESb4b" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-92e99ef0902so52867385a.2 for ; Wed, 12 Aug 2026 10:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1786555375; x=1787160175; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=H/KJ6sckLCdEVJDbpdFqbeYqPNdthT6c5yyUBXrsMRU=; b=ub1ESb4bq7Cw5S2kHeARt5oVAtAfhEkHYf5hTHxujEMAKKj05skRtsyxjj4HleHk04 R46hlXOjyEKIveU9dPsl7vVUHhs7snOKGkLPBOYfre2uJ43UOmZd/LcKtDECa7eJ9hj4 V7ABs4tltxlN4xxFYHSrf8KJC7SNz4pWxLvXGMnRLIv/g3cYV/s3pQGgJsWbYwRgoRb8 /K8l6wem26pXXzpWVMC6qswKJqfrwAtEZ7N8bqy4NJMx5Ee93ABv/W0wTvuZrqK5fGnl LaIZdYihofxKMzrF35tVwA3TL06A3Xe7JuQyzuzHTa+s/IsLHXDHckczoAF1AVEkMYLn DjBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786555375; x=1787160175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=H/KJ6sckLCdEVJDbpdFqbeYqPNdthT6c5yyUBXrsMRU=; b=lGgJe/fT08TEcHqpMC92z3cpvplF3jG1cjoL91TMLG9Cta+Gi2IDJ0avCqX9o8JMqb CmNJMbwQsmiB8hRgwCAeadfUqcZxtHK7xKOoS8YrO5A1elW6zlm6XAIb1+dkUipB2Urq CJvxeE6ZypiZ6bCIe0Ae7vkaSRgYIcp6B8H22ZSUrP3Ti+R+eWAyM45EzI922vDVesPb zWx8Ze4ee0oTy0QPHmJsKA8nWAX/y+hgC8Mv2x4nyatUvwTUpRfxHlg2JRodEX9AXQNV CNIL/xO/utrAZ1hSAjJCr5xv0aK/iyRHB0IFHRfJhhGQoOgUXIxJwyjM/A3lgsWppree dQug== X-Forwarded-Encrypted: i=1; AHgh+Rru8gnjId80qmvBB7MZtVh/uq+qB8BxDh1FVc8pD/iy2rewR9Hi9Gcw5lM77uxfw47bXfq7Aq7Z5jWuKQU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx08M3TmeA4RwD5Vy/i4Mmq7gJY2RaW4LZyeaum353oNGu7WRP4 2QcjYPHun8cur/Mvtsm79gXHEj51jRlbsRIi2B6phf22L8GhsBDGaKIs9syzteNNzUnodyshk6P p+ryHrkM= X-Gm-Gg: AR+sD11lCxrH5lIjjz+BwjjX60onyt9wPtjyi5y31blOs3Y8Bc77r74QaUiYIFM6cCe pvaV5PQa2MDSol11Zzke/PMaABbwnBH7sc9Mr8HjrP4FNOlHmni+IAZoM0oDx2oDHqtWYsny1ev ct0ISzX984U4g72KKtKChk4gZT+eVYaW9R8uI1n00cHmlrReddJew7xXL3IvCOYGtbHS9AzFnJx zLSdWAGHdQjoPBfOds01xGtcpa749LNgrboa5d6r2GHcONUconSWu99w95aGlQkyhlavE6BX02w hjBbN9tXirQvsUT+gta0IlUflwAdqKnXV2sfNhiMW5bNoXY8jlKvf5mg+24lUnt21jr8/ae797Q ju0BOox0gBbmSlwvGiUOKb5GxFGI00pUKVJNXieTKGMI5W1LMoAZ42rNKfQtbCmSnx642axBJ1g 3BMhwx2Maou0lNmezmci3uIXA5F1mv1J09JFKszy8ND05inYNR0gZdI/9ojAXnYJ5w X-Received: by 2002:a05:620a:45a9:b0:915:9e84:85d1 with SMTP id af79cd13be357-936b3d3ad7fmr560175485a.23.1786555375639; Wed, 12 Aug 2026 10:22:55 -0700 (PDT) Received: from zippy.localdomain ([73.62.185.64]) by smtp.gmail.com with ESMTPSA id af79cd13be357-936b5f720eesm173587685a.47.2026.08.12.10.22.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 10:22:55 -0700 (PDT) From: Alex Elder To: bhelgaas@google.com, robh@kernel.org Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com, lorenzo.bianconi@oss.qualcomm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina Subject: [PATCH v2 2/4] PCI: of: don't zero flags in of_pci_get_addr_flags() Date: Wed, 12 Aug 2026 12:22:45 -0500 Message-ID: <20260812172247.276554-3-elder@riscstar.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812172247.276554-1-elder@riscstar.com> References: <20260812172247.276554-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The flags variable whose address is passed to of_pci_get_addr_flags() is zeroed before assigning a value to it. Skip the zeroing and just assign it instead. Reviewed-by: Herve Codina Signed-off-by: Alex Elder --- drivers/pci/of_property.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 505226b876c56..22fea1905a080 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -82,12 +82,10 @@ static int of_pci_get_addr_flags(const struct resource = *res, u32 *flags) else return -EINVAL; =20 - *flags =3D 0; + *flags =3D FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss); if (res->flags & IORESOURCE_PREFETCH) *flags |=3D OF_PCI_ADDR_FIELD_PREFETCH; =20 - *flags |=3D FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss); - return 0; } =20 --=20 2.53.0 From nobody Tue Sep 29 04:09:39 2026 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A292C480942 for ; Wed, 12 Aug 2026 17:22:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555387; cv=none; b=AMxjeoopg5z6Nx34ZM03wBXIH9eyB4skriQauilTRVE5JARh2xsDKWx7TeMwYdtinRtvOVy/bguFYKp1bJQ49sW0cO/Vd0wb7njg6Qgxapcw0Fu0oLqZCmM3WywgxdjelIMCMofYCdNI2IWDw1xjBzDA22x9ygh+qGKD2J98kd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555387; c=relaxed/simple; bh=3Jdw+CyC9X0d79MV1LbaD6UPSSq5mFOk7p6L7fDLBfs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXjqrpnGZqBgdluAkJ9tiIA1ns6b/EtaUlzxGaIukmtwN/pO6Qh657UwrW87MvqsI73TnKsAgtNbRKrFEBxmJtUsteU4lJ0VeLNBUmQ8unSEPniniEcQnL6ZjMKL4Gm8/bbHaS2FNZ92y8nLX33QyMQh8O2KI7BcgamW5EMA5Wo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b=Gs6WmnPA; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b="Gs6WmnPA" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-93108a3c326so6701085a.1 for ; Wed, 12 Aug 2026 10:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1786555377; x=1787160177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9BzvpIUyox01epeMSGpQoUeAfJbQUXyU3IcN4aSet1k=; b=Gs6WmnPALN7O69rQrj0ZkftYOVY8vOQmEcV25FZR093yfrEg1KG32bj7rymy8YLKuT sTDRYfYyeSl/uqR96hZd68CK9mW/WUbejQTNxx07u4pt63glszid/2wmg4mk64IVYKhm 4H4JAkO4HnkL3sgf+8UD+HtAALhxbTmrZ8SEq6CfKl3NdAkosywdu2QrvysG6+A5Rniu CTNe0yTkBrzHqbk1b5ZZtsmHNGJiV3duchmEXSXLBdI/2AadP7/zPiXGkP1xZ+FKN9tG ND8d32IyJQoJFQvLV2E4uZvep7bz7dW7Yv/SgmhPkBJEQbFSozoLZjrKmSgweFOajlUA qNrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786555377; x=1787160177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=9BzvpIUyox01epeMSGpQoUeAfJbQUXyU3IcN4aSet1k=; b=IEIwOZNOyPbOk//l74rQUEC2nlFZ1dtUBPOXhqewU8M038d1Z/eRaGrxuGNLxpv7kt FK3m6RHSo9kJQtLq0TnLlxj6Zt6gpbZe/2Fi2SFJXl+PgG2jdA4+mlm0iZ1z7JDVUqvc hhHoSHisOIhzNlzq79Gs+qpmmsdM1djmFT5NDFDGdjBzIwR5K/xvzsz8Iynf60X8DUtY 8ibLZagMr9pQB8oZv0Z57WKe4fEzRDJybgUviDgQo4c2xUFb56kSX8KZKF7Dg9dzVZwt 9y1lFZGLaF1mz3ngGJmWq0XJjkD2WeBIceB3uhZpgH3lNFnEy+4VaQuhGhWWKnRFeyso ENQQ== X-Forwarded-Encrypted: i=1; AHgh+Rq70gvN5PofgOB+pYo43/f2ECMp+7ropGCozZPgVS/xjhYpJzMHYDkBULVAJnaWMyu9ZrW8i66bZs9yAl8=@vger.kernel.org X-Gm-Message-State: AOJu0YwxuAr6X5hNr7/qvk6HE4B9+zTriU7g2EUet5YIk2cVovR+j9St 9QhlXvvkwScnuWB8U4Is+4qJp4Op9X/flhQQneDYbMdGqbY+mL0VUsM/QUea8LGKeGE= X-Gm-Gg: AR+sD10jdNTeshffxEUrjQWmk2LANYT3+bMw0iTa5PyhcaasoVxJJ8Q71i95t/XK9kU qhkN6TRvAUiPLjJR0AXL/hYTUink512ZdEd1n5S1Q7rcLq0oH8Wqy9R/1gHqfuXM2AsdneEPXX6 0qE5nG2uU7SoSLTDMUUt3OTIATlraKJWe/pbMqimtHshdz5xwiXX/OkB8wr0MfUIY75pAObLver It6L8QccJvi/Agw74osAq/SAGVqQY/AcC7aQnOwA7gdM48+ssE+A7TwRhXtlhMeFPH/EuYuBo0V gPTBYz+OWaeV0RoWQtMKMM0QJC0hN8gKS1wartIqBCSGGD2pV6Zdbz/2THbAIGXHPEvzk7OJEmC VIift7tKpHBiItJbnt6e45333yfXQPrVKoMZlkXT1xJijtQX2yKexRmrbRpJwn/eWPLEaXhwh7q q3RrOSuNXXtICXHfAQKITBWEx4lkKJ+9r+HhgD9k2PrhO8iWb54KiAnN/B7aafA0rT X-Received: by 2002:a05:620a:3acc:b0:915:29cd:306c with SMTP id af79cd13be357-936bd96e80emr60472985a.9.1786555377390; Wed, 12 Aug 2026 10:22:57 -0700 (PDT) Received: from zippy.localdomain ([73.62.185.64]) by smtp.gmail.com with ESMTPSA id af79cd13be357-936b5f720eesm173587685a.47.2026.08.12.10.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 10:22:56 -0700 (PDT) From: Alex Elder To: bhelgaas@google.com, robh@kernel.org Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com, lorenzo.bianconi@oss.qualcomm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] PCI: of: make a flags argument optional Date: Wed, 12 Aug 2026 12:22:46 -0500 Message-ID: <20260812172247.276554-4-elder@riscstar.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812172247.276554-1-elder@riscstar.com> References: <20260812172247.276554-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The address of a u32 object is passed to of_pci_get_addr_flags() so it can be filled with the computed flags value. Allow a null pointer to be passed, so that the validity of the resource's flags can be checked without filling in the flags value. Signed-off-by: Alex Elder --- drivers/pci/of_property.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 22fea1905a080..5e1820b8bb79b 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -82,9 +82,11 @@ static int of_pci_get_addr_flags(const struct resource *= res, u32 *flags) else return -EINVAL; =20 - *flags =3D FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss); - if (res->flags & IORESOURCE_PREFETCH) - *flags |=3D OF_PCI_ADDR_FIELD_PREFETCH; + if (flags) { + *flags =3D FIELD_PREP(OF_PCI_ADDR_FIELD_SS, ss); + if (res->flags & IORESOURCE_PREFETCH) + *flags |=3D OF_PCI_ADDR_FIELD_PREFETCH; + } =20 return 0; } --=20 2.53.0 From nobody Tue Sep 29 04:09:39 2026 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F77647DF99 for ; Wed, 12 Aug 2026 17:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555385; cv=none; b=srUqvaEqf65KJWUDwsBcFfoedTpr6mknvWNAlVVIbNiTkr40yc8JH1qj/TrWVgjqtKRfHh/bdKP5yudoR/XSrfXGfPbN3pEqX1+p/nlTmxQpzaGWhB1unI4BhQeDtnoFCybcmbI76iejFcPZDcL9w3CYEBBK608P4t/7RBHEa/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786555385; c=relaxed/simple; bh=mPn73CqzfrdOvjuc2ohN6xC//Fl39RO2mkY8Ijir1Xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uigQFxLBfsoxMRU6aVwDG+AFilqVqXBLBI8BqsEWoiK+0jEjVlMSD8okcOBRO011oZObEvAi82JLuEBwFod23xIrt680y/UtoO1mKhzAoaG5+nQqa47E2AsQ0ZRt0gQNKCNsWGZkQq+DsSDPYhUuP5/NjwWfPW8QJnLHs6U6H+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b=Tj5YEt9g; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b="Tj5YEt9g" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-930f4e5eed1so95797285a.2 for ; Wed, 12 Aug 2026 10:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1786555379; x=1787160179; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3K2YFyPbwee3TOPI2L++unR/lM5wpp/EyOEokJr7A+U=; b=Tj5YEt9g0cbsLqAdp6LjKTPrlJKVAxLH95aNmoaK+AGXsOHBVentwmaElh+9tDBtoU fUT+dLlJpBZ7TCZYCGUbOHtGbtJ+Gc2GEju5ydJbrsuyVqxs5lu7ankCuA2Vkdv+dU9N VciOiOeEsJ0XVBdvbFJVvMe07Y2rFbppJoyIdl00pAvV78baD5oEauVejLpRAwszDGVa HPXfr5BDn3ewg9uHIJx8v4PfWkShE7mW5HJH4zv05LvJ0NzsG2v7zifRcrr4B2jrSXW1 VyIX82yo/OUrNML9yYmySdBhnJaHahw8Aat6v0mkh+JQbRqLeNBCWzuc3YmK6Qfj7Cqs AIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786555379; x=1787160179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3K2YFyPbwee3TOPI2L++unR/lM5wpp/EyOEokJr7A+U=; b=Qdw0bW2sW8GAT0glIvjKaR+E43evdwi1dnlo0d950H6b+QHFSOi/q3ITI4Mfb8+kYi msHYXtqacDWHp/Q6OG2MaqQ6aIU6iGeunpZE1olhHjTwrQXPVuIndffQrQ3HGzCGTOVy aZL2lko/QQ3I30yE2d/uJpuFeW4+76rUswESgVeV8wWBE88VLOQh4Z6zRAqXYCuVaIoL Eu1pIOEat8oKuf3hy0ahLQNJ+BJFjxap/2ItMh2YPhopZMGh+GOPdNhl8PjJVSwqoz4H mFobdsc/otHhEC+lerW5aEbDKdao8kG47x4wO7+YMD8wLAnXjiQ/H9g3Z6wGBKfSvkcW 1bYQ== X-Forwarded-Encrypted: i=1; AHgh+RrvuTyyeeVupNNG/tldYG7jbFuS1CspAbc6+858e1t6tIAJM1lKvyBYAWdL79P2ULTA4JAVECUUnAVnIag=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+IPjNFMrSrO67Gw9vincD2KM7YzMTMYLKItZsZDipb4sj3FVh jbiZrJPc/EvwIEJXfOIKM2okROLJfgg+MC5/8MI6aS1VB+WMlIFUcCVwztQkSHwZghw= X-Gm-Gg: AR+sD12tbbkTWalJxEbxxF2GzDjIpCVpKKhBoEpcbXsOMJ4pSyR8cLhzHaHGzDBxi62 2TvrmUeuTa6DlpEqjuA87nqro0VtohYsrRcUo38wKpic4vChmue2ccSfBIvuSdIqmbXX8u9tRlv P+eVBSAZrfPX4o62utzbdBUmUpLvTRzevzANUJwjhReIsOWY5JRkWxBhwAGkzCNbJQg8MCKoh7d B+wUWalEz3B8zKi0oRyhzSxULqSm6ik/WzWTXjjuACkTrTbCHRdb6qLv+hkT46Md7gjW/m6ThWS HPwr5vXlKGRSZgwdkbCfCuJA1GJEPDAgS8ZlpYxtf5FiAbxolvHttdpavaAY3lz8VqMGgEzD+oe RxP/44HIlbRzWugYMWeehfP8hAXktIkY32juJBSDOwvSTIo3DaA0+Her921Ni+eyWybAwP19sY0 h6waqd2ILpfL0hSDS2Oo34T6DARJDlfjZzRpM9ZAk9pGCR38PuqmglFObrK3kAxapXcw== X-Received: by 2002:a05:620a:a718:b0:92e:535b:e08b with SMTP id af79cd13be357-936b3d68c02mr526104385a.33.1786555378959; Wed, 12 Aug 2026 10:22:58 -0700 (PDT) Received: from zippy.localdomain ([73.62.185.64]) by smtp.gmail.com with ESMTPSA id af79cd13be357-936b5f720eesm173587685a.47.2026.08.12.10.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2026 10:22:58 -0700 (PDT) From: Alex Elder To: bhelgaas@google.com, robh@kernel.org Cc: daniel@riscstar.com, mohd.anwar@oss.qualcomm.com, lorenzo.bianconi@oss.qualcomm.com, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] PCI: of: introduce of_pci_verify_node() Date: Wed, 12 Aug 2026 12:22:47 -0500 Message-ID: <20260812172247.276554-5-elder@riscstar.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260812172247.276554-1-elder@riscstar.com> References: <20260812172247.276554-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 407d1a51921e9 ("PCI: Create device tree node for bridge") linked the PCI enumeration process together with devicetree, creating a devicetree node for discovered PCI bridges. Its successor commit ae9813db1dc5a ("PCI: Add quirks to generate device tree node for Xilinx Alveo U50") shows how to use a PCI final fixup quirk to also create a devicetree node for a non-bridge PCI device. These changes allowed devicetree overlays to describe components downstream of a PCI device, by providing a place to attach the overlay. Note that the dynamic devicetree node is only created if the device didn't already have an assigned node. Later, commit aa7b4bbcb3a1d ("arm64: dts: qcom: qcs6490-rb3gen2: Add TC9563 PCIe switch node") *pre-defined* devicetree nodes to represent the PCI device nodes that would (also) be discovered via the PCI enumeration process. The devicetree node in this case is created with the content from the DTS file. So when a (host) bridge is done being initialized during PCI enumeration, no node is dynamically created (the commits mentioned above do not apply). Ideally, any pre-defined PCI devicetree node would contain exactly the same information as whatever the dynamic creation process would produce (though it could include more). However that is not the case for the pre-defined Qualcomm RB3gen2 nodes. And in particular, the endpoint (function) nodes include this property: device_type =3D "pci"; This is simply wrong; that property is meant only for bridge nodes. Rob Herring requested that a runtime check to be added to spot this specific error, only for non-bridge PCI devices. (There are many things that could be verified for statically-defined devicetree nodes, but this is all we'll do for now.) Signed-off-by: Alex Elder --- v2: Verify even if PCI_DYNAMIC_OF_NODES is not defined (Sashiko) drivers/pci/bus.c | 1 + drivers/pci/of.c | 26 ++++++++++++++++++++++++++ drivers/pci/pci.h | 3 +++ 3 files changed, 30 insertions(+) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 655ed53436d3e..679afbc6d3109 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -351,6 +351,7 @@ void pci_bus_add_device(struct pci_dev *dev) * are not assigned yet for some devices. */ pcibios_bus_add_device(dev); + of_pci_verify_node(dev); pci_fixup_device(pci_fixup_final, dev); if (pci_is_bridge(dev)) of_pci_make_dev_node(dev); diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 8b18c4ba845cf..0bbf1a915b7d2 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -1006,3 +1006,29 @@ int of_pci_get_equalization_presets(struct device *d= ev, return 0; } EXPORT_SYMBOL_GPL(of_pci_get_equalization_presets); + +/* + * Check a pre-existing devicetree node for errors. The PCI enumeration + * process gathered a lot of information about the device, and ideally it + * matches what the devicetree node says. + */ +void of_pci_verify_node(struct pci_dev *pdev) +{ + struct device_node *np =3D pci_device_to_OF_node(pdev); + + /* If there's no pre-existing node, there's nothing to check */ + if (!np) + return; + + if (pci_is_bridge(pdev)) + return; + + /* + * Currently we just verify that non-bridges don't contain a + * device_type =3D "pci" property. + */ + if (!of_node_is_type(np, "pci")) + return; + + dev_err(&pdev->dev, "\"pci\" device_type NOT VALID for PCI endpoint\n"); +} diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 4469e1a77f3c1..88dde67bd60cb 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -1205,6 +1205,7 @@ bool of_pci_supply_present(struct device_node *np); int of_pci_get_equalization_presets(struct device *dev, struct pci_eq_presets *presets, int num_lanes); +void of_pci_verify_node(struct pci_dev *pdev); #else static inline int of_get_pci_domain_nr(struct device_node *node) @@ -1260,6 +1261,8 @@ static inline int of_pci_get_equalization_presets(str= uct device *dev, =20 return 0; } + +static inline void of_pci_verify_node(struct pci_dev *pdev) { } #endif /* CONFIG_OF */ =20 struct of_changeset; --=20 2.53.0