From patchwork Wed Jan 13 13:20:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8025151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F19A2BEEE5 for ; Wed, 13 Jan 2016 13:26:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2600120499 for ; Wed, 13 Jan 2016 13:26:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2543A20490 for ; Wed, 13 Jan 2016 13:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754657AbcAMN0M (ORCPT ); Wed, 13 Jan 2016 08:26:12 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36125 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757970AbcAMNVj (ORCPT ); Wed, 13 Jan 2016 08:21:39 -0500 Received: by mail-wm0-f50.google.com with SMTP id l65so293162896wmf.1 for ; Wed, 13 Jan 2016 05:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cyL7E9gs9uQmXw5P8F3pqt9ky9ZrdTnl+L/3rC21jXg=; b=kbtpusVxK1GthOHge3yNa4ihnUM54voMclNbAUyY2dUGSwmvyWrhetwES+k3feDH/i dCc2dLIRJ46lAzJ+SZxgXU9+YcuK3hBURc5aw0qQ+Wn6Ux9lCcu0XjuL6iVerkENfITR Qj+BNzhhGGRTsdu6fM3cO+MciTdnNY46M6BAGT8B9Y37KMqtCTcwHcbdbLb2CZrFRH2j DdfwYuqfBGYkX0KnnwbvD3FOHaepGJP0PbWITjIyzm1u+82vb+qsOIy7aRW5QJmq0pSA 3JIY4iDuC4VROppFHcln41eKIcnhKKltyeu5Ri3QWdsQwTGyKjuABzxUAmkcF7jupeiP FSnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cyL7E9gs9uQmXw5P8F3pqt9ky9ZrdTnl+L/3rC21jXg=; b=PvL/KdU/m08nHVCImTUVzUUThpvWtDlVjqgg9oBvKFZsz1SGFB9aHWPY66g9hVARtS tQHSArkmbM/xlJ5kr2gs6Sb6h49EGCsuLItJTYP9EdjihDQMVu/F/YOFkxBleZTLJYME 3b09WqS5LChVXnvmC1IfH3mcoIOjkT9tKYl1bn5log9mmNsNOo9vCWufixnP27gq4u0q VzzfgfzDiSjk61hQyvTxxaMsy+nkPf++gTBxAfQn318hk2IkuSelpKB44IUAcUDoR7m/ R4FJr/CNXLbnBxy4DrTijxKDELdbC8/XaSQPSCzKzK/K0XYaAjx2ZPBe9cmpqI4d3Q2f 7vlw== X-Gm-Message-State: ALoCoQm/VlkNO00Wj4ypuEnMRc6QmDEJd7Vp+0CEn9+ZA1nRVYolrNHeKx2J7EifQ8V5uZFnvIhzTJ3LGO2pgHhjdSZHbXq5yw== X-Received: by 10.28.182.133 with SMTP id g127mr9569934wmf.61.1452691297967; Wed, 13 Jan 2016 05:21:37 -0800 (PST) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id y124sm8858741wmg.3.2016.01.13.05.21.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jan 2016 05:21:37 -0800 (PST) From: Tomasz Nowicki To: bhelgaas@google.com, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rjw@rjwysocki.net, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jiang.liu@linux.intel.com, Stefano.Stabellini@eu.citrix.com Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, tglx@linutronix.de, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jchandra@broadcom.com, jcm@redhat.com, Tomasz Nowicki Subject: [PATCH V3 10/21] x86, pci: Cleanup platform specific MCFG data using previously added ECAM hot_added flag. Date: Wed, 13 Jan 2016 14:20:56 +0100 Message-Id: <1452691267-32240-11-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452691267-32240-1-git-send-email-tn@semihalf.com> References: <1452691267-32240-1-git-send-email-tn@semihalf.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BRBL_LASTEXT, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have hot_added flag and all information in struct acpi_pci_root we need, we can get rid of arch specific mcfg data from struct pci_root_info. Signed-off-by: Tomasz Nowicki Tested-by: Suravee Suthikulpanit --- arch/x86/pci/acpi.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 64caf2b..56714a9 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -12,11 +12,6 @@ struct pci_root_info { struct acpi_pci_root_info common; struct pci_sysdata sd; -#ifdef CONFIG_PCI_MMCONFIG - bool mcfg_added; - u8 start_bus; - u8 end_bus; -#endif }; static bool pci_use_crs = true; @@ -180,16 +175,13 @@ static int check_segment(u16 seg, struct device *dev, char *estr) static int setup_mcfg_map(struct acpi_pci_root_info *ci) { - int result, seg; - struct pci_root_info *info; + int result, seg, start, end; struct acpi_pci_root *root = ci->root; struct device *dev = &ci->bridge->dev; - info = container_of(ci, struct pci_root_info, common); - info->start_bus = (u8)root->secondary.start; - info->end_bus = (u8)root->secondary.end; - info->mcfg_added = false; - seg = info->sd.domain; + seg = root->segment; + start = root->secondary.start; + end = root->secondary.end; /* return success if MMCFG is not in use */ if (raw_pci_ext_ops && raw_pci_ext_ops != &pci_mmcfg) @@ -198,13 +190,11 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci) if (!(pci_probe & PCI_PROBE_MMCONF)) return check_segment(seg, dev, "MMCONFIG is disabled,"); - result = pci_mmconfig_insert(dev, seg, info->start_bus, info->end_bus, - root->mcfg_addr); + result = pci_mmconfig_insert(dev, seg, start, end, root->mcfg_addr); if (result == 0) { /* enable MMCFG if it hasn't been enabled yet */ if (raw_pci_ext_ops == NULL) raw_pci_ext_ops = &pci_mmcfg; - info->mcfg_added = true; } else if (result != -EEXIST) return check_segment(seg, dev, "fail to add MMCONFIG information,"); @@ -214,14 +204,16 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci) static void teardown_mcfg_map(struct acpi_pci_root_info *ci) { - struct pci_root_info *info; + struct acpi_pci_root *root = ci->root; + struct pci_mmcfg_region *cfg; - info = container_of(ci, struct pci_root_info, common); - if (info->mcfg_added) { - pci_mmconfig_delete(info->sd.domain, - info->start_bus, info->end_bus); - info->mcfg_added = false; - } + cfg = pci_mmconfig_lookup(root->segment, root->secondary.start); + if (!cfg) + return; + + if (cfg->hot_added) + pci_mmconfig_delete(root->segment, root->secondary.start, + root->secondary.end); } #else static int setup_mcfg_map(struct acpi_pci_root_info *ci)