Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4777193pxv; Tue, 27 Jul 2021 16:34:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBaeFESXFNHIuMBRgV9Yjk1MQbVhuCpu8CG1ARJXeATq5TnKwBD2epSutzQzwchK4H3Acm X-Received: by 2002:a17:906:7f16:: with SMTP id d22mr2866624ejr.135.1627428854024; Tue, 27 Jul 2021 16:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627428854; cv=none; d=google.com; s=arc-20160816; b=oZIPkY2oTppx+4iz6buHTyIO5hzE4yltsh+wXLfXHNNBj6eZt0M9j8ajSFeaxnFqyP uAoC2KaE5cw9q5iW0kyGm72RGP4u8NUm4hpra5EhFfHQgfhbnYRuH+P86dt2w4NHw7Im 1U9xtKp0sOwg9Jl/pzAGBS/dUCzGmDV1EhcgDFQJCERMqZ4C7XGjDcDeaWUSMalGsP5G mnF+UE6EGe5AxkuwDRMdOA+kUlD6JcWZTUDYSY4YWCtHr/aEQkBs6lUjXlGnuFqs+lB6 O9FoFQ+/mngRwxKM5Rw0AHZRs45XjFJ+s7IQxLCTQjxtdQQE5An4Kyipu7ArBIYQE5gz DaFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=TQ2x1lqQZFAiAGYKENF2zEnWO34J/ZTiHGt9UcYh6Qo=; b=LM2sipeJMHHdw1fe77WLPicHlePSfiIA7rbP82wZ0stXSYMKUjhrmebQt7CbH1yYiy RV+dNmA5hpCMVxaA6gCF06rOWG5d6fdn8YJqcxXIzP4IQrfypEmFAPWdcbD5v+46WA9Q gl28uU/kyzu4ngQ67obrqepJfM1o5Km0xtPYhWl5mTEtfIN10Kwp0+WJ55nTvNJNpilq uSp1LJonlHGDAf65e2LtnGFqyxTjzDaSHC1UUywD+OWYkS2UEClRWm0jdYdV/dux3bzl aH6PpsPPa7xhrc5eNW+dzWN5Cl6oPnyMEAvFbxMUwWpt+iZCtZZkZqG8jR/NOP7ijGUx nfXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oUoxzdzw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si4938213ejk.210.2021.07.27.16.33.49; Tue, 27 Jul 2021 16:34:14 -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=k20201202 header.b=oUoxzdzw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233023AbhG0Xa3 (ORCPT + 99 others); Tue, 27 Jul 2021 19:30:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:44476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbhG0Xa1 (ORCPT ); Tue, 27 Jul 2021 19:30:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C4CF760FE7; Tue, 27 Jul 2021 23:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627428627; bh=C+hq6qoVwouKkZahhd4EeTOs3dFZy6RWX6t25IskRfY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=oUoxzdzwJhoALmsycWC7djvElgH91p+1NvuikzzLGHIXdpUbX/yvT2dN9PornItps JCPKr0FLkyXoze6OFR9wLxOaME35C8ckoNvcRRMu+ESi3NVSzF6W5RyeDznuhPtVU5 MbhdHy12fYJL7ln+lKENMAwrg4y5BqTC9rkHB24km/NK5zMM5kO5d4wEq3payvTuVA WLoyIeKA3J93HOL23gqTxO1XGz3pKlup2gQi5oL8zeJMutiDoq5B8iqC5rgSdaCX2r AaFXifFyIH3plcaXIJQimN6K3M99SLT4/q9gWWyUvANyQgJJoSebIIGmz/SeqMYCQZ h0ZAS3QLGVcbw== Date: Tue, 27 Jul 2021 18:30:25 -0500 From: Bjorn Helgaas To: Amey Narkhede Cc: Bjorn Helgaas , alex.williamson@redhat.com, Raphael Norwitz , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kw@linux.com, Shanker Donthineni , Sinan Kaya , Len Brown , "Rafael J . Wysocki" Subject: Re: [PATCH v10 6/8] PCI: Setup ACPI fwnode early and at the same time with OF Message-ID: <20210727233025.GA756574@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210709123813.8700-7-ameynarkhede03@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 09, 2021 at 06:08:11PM +0530, Amey Narkhede wrote: > From: Shanker Donthineni > > The pci_dev objects are created through two mechanisms 1) during PCI > bus scan and 2) from I/O Virtualization. The fwnode in pci_dev object > is being set at different places depends on the type of firmware used, > device creation mechanism, and acpi_pci_bridge_d3() WAR. WAR? > The software features which have a dependency on ACPI fwnode properties > and need to be handled before device_add() will not work. One use case, > the software has to check the existence of _RST method to support ACPI > based reset method. > > This patch does the two changes in order to provide fwnode consistently. > - Set ACPI and OF fwnodes from pci_setup_device(). > - Remove pci_set_acpi_fwnode() in acpi_pci_bridge_d3(). > > After this patch, ACPI/OF firmware properties are visible at the same > time during the early stage of pci_dev setup. And also call sites should > be able to use firmware agnostic functions device_property_xxx() for the > early PCI quirks in the future. > > Signed-off-by: Shanker Donthineni > --- > drivers/pci/pci-acpi.c | 1 - > drivers/pci/probe.c | 7 ++++--- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c > index eaddbf701..dae021322 100644 > --- a/drivers/pci/pci-acpi.c > +++ b/drivers/pci/pci-acpi.c > @@ -952,7 +952,6 @@ static bool acpi_pci_bridge_d3(struct pci_dev *dev) > return false; > > /* Assume D3 support if the bridge is power-manageable by ACPI. */ > - pci_set_acpi_fwnode(dev); > adev = ACPI_COMPANION(&dev->dev); > > if (adev && acpi_device_power_manageable(adev)) > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index c272e23db..c911d6a5c 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1790,6 +1790,9 @@ int pci_setup_device(struct pci_dev *dev) > dev->error_state = pci_channel_io_normal; > set_pcie_port_type(dev); > > + pci_set_of_node(dev); > + pci_set_acpi_fwnode(dev); > + > pci_dev_assign_slot(dev); > > /* > @@ -1925,6 +1928,7 @@ int pci_setup_device(struct pci_dev *dev) > default: /* unknown header */ > pci_err(dev, "unknown header type %02x, ignoring device\n", > dev->hdr_type); > + pci_release_of_node(dev); > return -EIO; > > bad: > @@ -2352,10 +2356,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) > dev->vendor = l & 0xffff; > dev->device = (l >> 16) & 0xffff; > > - pci_set_of_node(dev); > - > if (pci_setup_device(dev)) { > - pci_release_of_node(dev); > pci_bus_put(dev->bus); > kfree(dev); > return NULL; > -- > 2.32.0 >