From patchwork Fri Aug 21 03:53:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 248044 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:d4c:0:0:0:0 with SMTP id h12csp4012ilj; Thu, 20 Aug 2020 20:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtnb7t1FwtufdPUBbQk4IVjFtJw9wdGOjZ7RtgW/aDknRVNn6rdU2epngesBcmXD9+y6O1 X-Received: by 2002:a50:dac6:: with SMTP id s6mr978046edj.378.1597982075632; Thu, 20 Aug 2020 20:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597982075; cv=none; d=google.com; s=arc-20160816; b=caC74z6D8y7JEA7bik7DqikJKLr8yeaHgrXybZRDNIJlTZfWvilsCRI08YOVTTaGos LfuTuABMAilBZuXL6XxDKIe9Asl51XwgOq0HX/FhEQU7xVfo8Pi+rRCf7FdL80U/xbKT 9cN/9N3q+nz5yWqgkqC1bmclHLyuKt34j1AxKvEUm7jyOyFiZgfSE16frRo4RGpW6+0S n+YwxAJ1aIbtge/nlaIGv7JOmFxiVhnqlTzVylmZmMhmdikhpw3Y19gR8H2WxRuIicTD 1FXtwiW+ddeIx24qQwD3ZJNl5dXvSu1qMbVFcHwcRfFzR6HRCLJpHcP2LOYYMaNaWkUi g+oQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cRJMVMF9r7qXs+QDp+bx+ovjwoVdm4UDqS7o+cHIDVk=; b=bUH1eueEGahZOldFS83bUvxGB0rPbKJt8IoeMZQkHmv4ftbiUONTMaQ1xlkkERYivv 51Ute+kqaCvtgiPGsmqFqKx/E2C3PquY92Q8lacMEhQgzr0561z+0ofSt1CgSPaxD5iZ qTK3F0OmWiANCU7xFPZaPdoVoSFNAUSu0fsaRGl3SZvpF0zEWmqp8IgwQoKk5++d6Iic 5Z+9My3Jt8D2Nbg8IvhRfrV4RVlCr4Icgs/M+cKtuOkcuroAdNCwlqy5nTAnt4xphxdv oL9Ged1rHm4uRTo02JcJd5UOVJJyGjgYh8MkJvdfhzQGGm47aetvx+H+kXuIqYFI/55o pjbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 j12si399485eja.38.2020.08.20.20.54.35; Thu, 20 Aug 2020 20:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-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 S1727780AbgHUDyb (ORCPT + 4 others); Thu, 20 Aug 2020 23:54:31 -0400 Received: from mail-il1-f193.google.com ([209.85.166.193]:39625 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgHUDyb (ORCPT ); Thu, 20 Aug 2020 23:54:31 -0400 Received: by mail-il1-f193.google.com with SMTP id f12so331954ils.6; Thu, 20 Aug 2020 20:54:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cRJMVMF9r7qXs+QDp+bx+ovjwoVdm4UDqS7o+cHIDVk=; b=YbormMP/lSdNwJ1/TGmk4yojdQkhCyNpGLMD+Jr5lg3zR+Q9fwqexuoQPQj/3FE9Dy 03c9/95uAE1HsVogVHs0wMYMX4gHn1+FzlMRSIQuvtjNCJ3ssKM+xpT6U9dOFD+1lzsh HE8L1ziEAR61MI4Vuk4arz/UoEgdF6E2UeRI1SBBS3HybW2A5N1fCh4RXWQOpK+8kYMc pJZ/fYJ+GrQelTD1XehG8FBIfMQaqP6cgwSWmpvcQrjFxQd8Z1oFZTx3zUAgjrx9Ddcb YuPFOZC7vjPdgJs5sHZJb3nLB5D/zQuiSnsMJ0PDAUKs48QznXbTRP9Tj75loljC4PeK NTaA== X-Gm-Message-State: AOAM531j69Xs/rdj8ZX6k4IAJXdUS2u8YZfDIpCvjh80jY6qs7PtbgzV dz1NXGZF9Sw/HIbZ56cm7w== X-Received: by 2002:a92:c081:: with SMTP id h1mr1021694ile.41.1597982069449; Thu, 20 Aug 2020 20:54:29 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.249]) by smtp.googlemail.com with ESMTPSA id 79sm413923ilc.9.2020.08.20.20.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 20:54:28 -0700 (PDT) From: Rob Herring To: Bjorn Helgaas , Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, Andy Gross , Binghui Wang , Bjorn Andersson , Dilip Kota , Fabio Estevam , Gustavo Pimentel , Jerome Brunet , Jesper Nilsson , Jingoo Han , Jonathan Chocron , Jonathan Hunter , Kevin Hilman , Kishon Vijay Abraham I , Krzysztof Kozlowski , Kukjin Kim , Kunihiko Hayashi , Lucas Stach , Martin Blumenstingl , Masahiro Yamada , Murali Karicheri , Neil Armstrong , NXP Linux Team , Pengutronix Kernel Team , Pratyush Anand , Richard Zhu , Sascha Hauer , Shawn Guo , Shawn Guo , Stanimir Varbanov , Thierry Reding , Xiaowei Song , Yue Wang , Marc Zyngier , linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 01/40] PCI: Allow root and child buses to have different pci_ops Date: Thu, 20 Aug 2020 21:53:41 -0600 Message-Id: <20200821035420.380495-2-robh@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200821035420.380495-1-robh@kernel.org> References: <20200821035420.380495-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org PCI host bridges often have different ways to access the root and child bus config spaces. The host bridge drivers have invented their own abstractions to handle this. Let's support having different root and child bus pci_ops so these per driver abstractions can be removed. Cc: Bjorn Helgaas Signed-off-by: Rob Herring --- drivers/pci/probe.c | 8 +++++++- include/linux/pci.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 03d37128a24f..0c9ebc72532e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1036,6 +1036,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr) { struct pci_bus *child; + struct pci_host_bridge *host; int i; int ret; @@ -1045,11 +1046,16 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, return NULL; child->parent = parent; - child->ops = parent->ops; child->msi = parent->msi; child->sysdata = parent->sysdata; child->bus_flags = parent->bus_flags; + host = pci_find_host_bridge(parent); + if (host->child_ops) + child->ops = host->child_ops; + else + child->ops = parent->ops; + /* * Initialize some portions of the bus device, but don't register * it now as the parent is not properly set up yet. diff --git a/include/linux/pci.h b/include/linux/pci.h index 835530605c0d..1fbe95a7d386 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -523,6 +523,7 @@ struct pci_host_bridge { struct device dev; struct pci_bus *bus; /* Root bus */ struct pci_ops *ops; + struct pci_ops *child_ops; void *sysdata; int busnr; struct list_head windows; /* resource_entry */