From patchwork Fri Nov 8 09:42:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea della Porta X-Patchwork-Id: 841830 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 441C91E0DAC for ; Fri, 8 Nov 2024 09:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731058963; cv=none; b=JPrtZQpAxmKviyRdGh3uVdabDSzueo5SqoVQOjoKUtBsIBrqWUO0pCyWrUvYuN/YeQ0IOwbu0rSbEXnhFwaU0KJj0wpjxRa9yk8iHjhnZq2fTSRboPV6FxI5JfRc3erieEWvvLMrPWUuKSUGxtHrcktePj2vHX2VZ/Xq17BeNKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731058963; c=relaxed/simple; bh=jWCpeLpkpA4YVoOMmIryFg1kg6ULL3RS7k8t4Z+C5X0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=C9+IGg0b7HcQ6BZ2wkZuzDB36HZUmPgFvIaQ6hNkr5oHDuBXm0+LCkoDNfBsCbmpZyluJaYg0SgFoK2/sJ2ydN1li/zmjDPRTfDEnt/DoA2D7psJ9mO4N7A6ltWDHAVpX5GbTsAbRp1Y7nK6Um7C0cxK3dauAe2ILFjHqNBKU8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=XR0saLoa; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="XR0saLoa" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a9a5f555cfbso145013466b.1 for ; Fri, 08 Nov 2024 01:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731058959; x=1731663759; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=edr4i5ZXuzi2MqMxkWzTe9XDLfbB9N2JCAr3MU/xkAQ=; b=XR0saLoa0ONaS3dhsQouwcbhFB1/EfQETF2IRDWoymrBj8tkGjHaEc3e1eM7qTMKxG wnFTyFchqpr3NeD5qJKQY8r/FcpkZDGHulOip3CT4BgKDbbjjCLNkpzJDOJvBqUee2/n mSlvCMV6N602vvCPAr4eanj89VlvXbisQNdgto913yJ2/xznvTwxwmWC8supDKouwhwz V0ah+sgaaLvI4kmJVvCmgy4LKyVeWEcqtZ2RHPx5kiSMAUEJ6XEwxZIhpgfa/zs99p6K Eo/4NA3QqO+bPmonVuxgD32dF6xxThKMGDx08eTHpztjK2VJC8ot+kO2PjVqiaAbbk4K Je9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731058960; x=1731663760; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=edr4i5ZXuzi2MqMxkWzTe9XDLfbB9N2JCAr3MU/xkAQ=; b=HWz5YFSn+F1s+/RmCtf4vA3iUwkU9XlTysPSkO1zD4egJ28aY70rVdfvJOmgV6EZqi Hc4RoHrqSlmmKO/tER5mPhEXRuUsJe82OLkmqSSJ/i3CNmWTEFNLr/DYE+05W7SIX255 y8aHkWi9hjTxONtFIY4AZBNQwy5JWQxRF5V5CH2s5chXoeuvDkbE2XBPfLttcmcVOk5j ny8zoBgTGKV+SMF14k1I19cEJ0TlvlTcr07UcyawM/Q37CTVLYYZSLjlET7Eiz0h+cRt GxbTz1m1wmp+b2Bmx2H9lIApgQHNYe3rQ92ECqIB9/os4cknOLMwYeJOVky80AErOHA8 CtDQ== X-Forwarded-Encrypted: i=1; AJvYcCVa1TnGyeNBVrkS1aLlFDhnbg2D3dREMtxvvM4BlENX/WOFCfI92oz9IjXpytGSeftA0JyasZUpixxZ@vger.kernel.org X-Gm-Message-State: AOJu0YxbzwIpR3H/GQSVr+xIXXy1GF2315w84tAyZXvHPHK+H0UqvmYi UI41R1xM+1V4QJCWU2OglmqDa8rX8s/ICF8NIdJ+42PcXgVJbeqaRTyUrx0HqsA= X-Google-Smtp-Source: AGHT+IGmVFg6dGCdJ94MvP+GtpTJm4h6Vp+aWc3AX4E8KZIkMCx5imWZRQaFghSdUOFYkB1RH36WSQ== X-Received: by 2002:a05:6402:3510:b0:5c9:34b4:69a8 with SMTP id 4fb4d7f45d1cf-5cf0a2fb6f9mr2077935a12.6.1731058959540; Fri, 08 Nov 2024 01:42:39 -0800 (PST) Received: from localhost (host-79-35-211-193.retail.telecomitalia.it. [79.35.211.193]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03c4ed68sm1765328a12.63.2024.11.08.01.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 01:42:39 -0800 (PST) From: Andrea della Porta To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Lorenzo Pieralisi , Krzysztof Wilczynski , Manivannan Sadhasivam , Bjorn Helgaas , Linus Walleij , Catalin Marinas , Will Deacon , Bartosz Golaszewski , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Saravana Kannan , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, Masahiro Yamada , Stefan Wahren , Herve Codina , Luca Ceresoli , Thomas Petazzoni , Andrew Lunn Cc: Andrea della Porta , stable@vger.kernel.org Subject: [PATCH] PCI: of_property: Assign PCI instead of CPU bus address to dynamic PCI nodes Date: Fri, 8 Nov 2024 10:42:56 +0100 Message-ID: <20241108094256.28933-1-andrea.porta@suse.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When populating "ranges" property for a PCI bridge or endpoint, of_pci_prop_ranges() incorrectly use the CPU bus address of the resource. In such PCI nodes, the window should instead be in PCI address space. Call pci_bus_address() on the resource in order to obtain the PCI bus address. Fixes: 407d1a51921e ("PCI: Create device tree node for bridge") Cc: stable@vger.kernel.org Signed-off-by: Andrea della Porta Acked-by: Bjorn Helgaas Tested-by: Herve Codina --- This patch, originally preparatory for a bigger patchset (see [1]), has been splitted in a standalone one for better management and because it contains a bugfix which is probably of interest to stable branch. drivers/pci/of_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c index 5a0b98e69795..886c236e5de6 100644 --- a/drivers/pci/of_property.c +++ b/drivers/pci/of_property.c @@ -126,7 +126,7 @@ static int of_pci_prop_ranges(struct pci_dev *pdev, struct of_changeset *ocs, if (of_pci_get_addr_flags(&res[j], &flags)) continue; - val64 = res[j].start; + val64 = pci_bus_address(pdev, &res[j] - pdev->resource); of_pci_set_address(pdev, rp[i].parent_addr, val64, 0, flags, false); if (pci_is_bridge(pdev)) {