Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp29103ybj; Fri, 8 May 2020 05:53:37 -0700 (PDT) X-Google-Smtp-Source: APiQypI5FmVobaPDKgQfw+c8+ZjxgfvwgYM4tUi+yy9sBq9Zl5zj4u/IMqs//ebanchqtY7ck91D X-Received: by 2002:a50:f61b:: with SMTP id c27mr1892883edn.256.1588942417044; Fri, 08 May 2020 05:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588942417; cv=none; d=google.com; s=arc-20160816; b=zaRwgzwUQ0BE5S5NhjWQhK+MH41lzLnF9hLLfktgEXmMsyU8X2u6c1Pw4B/fH1F+en /v0obOrllRKzsLPLFUR41mcmOdEm6bECymopfOMDeU2wuykvUuenZSibYGSTd823Ejgf ho8+EJ3DjT0qP4zHz2jOQIqH/lHPZfoBEfGsNeu7Msrpa4VqkFaI90c5xiIWd4EQT5+e 4279UQc4git8nbgxjZiovmR0/6kl+bwE9yyeKaopcVYDpkYKUcKVaGtVg5qup05AJDlg d3mLZ1W2xZn98ZC7eDqreF0lbQNrhgjqtDHh8R8uo6k+UZDke1c4hjDEWF3Xsip/Tzz8 3Fpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GjMUSvfMuKH2w6jeU8lpm8XRe13+wRaU+egFzv6zHAI=; b=llfQ/LKhlCl8P8Fzryu51YGNwaX9wbrmIlAKnsXrSNnwzR2npBLDDtPk+LdZQY40Ok LffF0zrBm/yfaKBnO4YDua/Z6Qx3qCuXxXku4bC7gaRTkIFtI0m4a63iiaaoHTQem6Nm DNCXoIQXmgOBVA3C6YWE+NAWxlY7l3G2NvuatjKr3T6CevmfCVNkSzfBZc7EEWTZjM/3 WR1Z15F4u/uauN19ypl42Bi4TFK3FARHpAxTGDpLZR9+Y0CSv8pAbTzPonHUc5BTUIB9 lf6ktwKL+yfQPV4ui5kLwaQCavkTfUO7lwnpct8fCXIthUhDZA8h3zxxOWXh3XpscYhb agyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OzSJak2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw24si908018edb.248.2020.05.08.05.53.14; Fri, 08 May 2020 05:53:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OzSJak2m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729766AbgEHMtt (ORCPT + 99 others); Fri, 8 May 2020 08:49:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:55986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729770AbgEHMtq (ORCPT ); Fri, 8 May 2020 08:49:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55143218AC; Fri, 8 May 2020 12:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942185; bh=dH39vX1jFQ/TFkb+BTCWZyIAmD9Vcg+f2I8YszPGVZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OzSJak2mYpwEXs4QDgS+dCQ+lvVS9eknm4El9VcYTJKvo8EahMBhgVwitzck2ACqs vNgkF/H3r1hqApTz0Xh68qHCgC89WnV2JEaTv0FgUrciQAWphfh2zM6SgZ6iyeIbDX BtLagHRga8jlnl3ScEICWHutG22EFBCI71QSYZ9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Michael Ellerman , Guenter Roeck Subject: [PATCH 4.9 02/18] powerpc/pci/of: Parse unassigned resources Date: Fri, 8 May 2020 14:35:05 +0200 Message-Id: <20200508123031.588689946@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123030.497793118@linuxfoundation.org> References: <20200508123030.497793118@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexey Kardashevskiy commit dead1c845dbe97e0061dae2017eaf3bd8f8f06ee upstream. The pseries platform uses the PCI_PROBE_DEVTREE method of PCI probing which reads "assigned-addresses" of every PCI device and initializes the device resources. However if the property is missing or zero sized, then there is no fallback of any kind and the PCI resources remain undiscovered, i.e. pdev->resource[] array remains empty. This adds a fallback which parses the "reg" property in pretty much same way except it marks resources as "unset" which later make Linux assign those resources proper addresses. This has an effect when: 1. a hypervisor failed to assign any resource for a device; 2. /chosen/linux,pci-probe-only=0 is in the DT so the system may try assigning a resource. Neither is likely to happen under PowerVM. Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Ellerman Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/pci_of_scan.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -82,10 +82,16 @@ static void of_pci_parse_addrs(struct de const __be32 *addrs; u32 i; int proplen; + bool mark_unset = false; addrs = of_get_property(node, "assigned-addresses", &proplen); - if (!addrs) - return; + if (!addrs || !proplen) { + addrs = of_get_property(node, "reg", &proplen); + if (!addrs || !proplen) + return; + mark_unset = true; + } + pr_debug(" parse addresses (%d bytes) @ %p\n", proplen, addrs); for (; proplen >= 20; proplen -= 20, addrs += 5) { flags = pci_parse_of_flags(of_read_number(addrs, 1), 0); @@ -110,6 +116,8 @@ static void of_pci_parse_addrs(struct de continue; } res->flags = flags; + if (mark_unset) + res->flags |= IORESOURCE_UNSET; res->name = pci_name(dev); region.start = base; region.end = base + size - 1;