From patchwork Tue Feb 16 13:53:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8326081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 688799F38B for ; Tue, 16 Feb 2016 13:57:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D6D420263 for ; Tue, 16 Feb 2016 13:57:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEB23202B8 for ; Tue, 16 Feb 2016 13:57:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVg6E-0003x4-PP; Tue, 16 Feb 2016 13:55:30 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVg57-0002B1-Kb for linux-arm-kernel@lists.infradead.org; Tue, 16 Feb 2016 13:54:26 +0000 Received: by mail-wm0-x233.google.com with SMTP id a4so101167339wme.1 for ; Tue, 16 Feb 2016 05:54:03 -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=hnakRt8AGa2cmZs5KFe/DRtupuYq+jseqDE/EzqxFCU=; b=VnjvuTuOpbaBsoHrWRYT9/0+/CmHzAJj7bPrij2m0osc1Rl2extf7KNhC7TIam86pA Ihw8eV6ij/wKJulCRXqaqbkODKgtik4Yp03KF5w/fK8JWt0UGs54w9KoAorB72eD5mrE XzhVejldeEtitR/V8FhzECC1g+TrH/Jtg07LroNDKQnXtqFKMs14WBK/577rqqGHYHmc +MWjanA366KQbb/1v9TZ0Iwl1ZCNTu6ikEM+GeJEW/0yf+B6Dhgf9NNvTYup4p+ZQ6K2 AO+axOHAWOIl4ZBIHq4Q6EgRjseavXGtO4YTuuyGEnp1L23Wj3VJCp54E14HM6lOs5Ef qxVA== 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=hnakRt8AGa2cmZs5KFe/DRtupuYq+jseqDE/EzqxFCU=; b=WyzoU4GQx1DPWmR0POsG8a0IwPu6ayNU5/EZU1PgKxYoQwyuU+hldRm2Bm+K1N+15y 8PbpIYpIaR43+5NWYTfC21c1hHwdlu+n5u/gBBKLhqXWOY/aV2vnFgoy6Bj2a99lYXsu bbLQmv+BSpDQNzyjDGFCkHHplpbecMOM7eQotq5GshvA47tRsEqCOxFXhwY3M6CPiGka W5KRVDuEUSxzCjq+862l/LJ5F/A3mby5v3l1qDSK4++fdPZBGPV3PjypqUNxnZjp6RXI 0RSJVHwEaM1hbCCo86Zx+FrfUXOexUHdmI/OcA1URTLS7Cx1PeXr+i9kfMKSvwXO+FnK tR+w== X-Gm-Message-State: AG10YOQpT/0M4qPcNBjoAtjZ9mWUaSl1BasSo+yH3zjbGR9akDsRhYXmszKlHyppWgRaiw== X-Received: by 10.28.9.67 with SMTP id 64mr19637418wmj.10.1455630842133; Tue, 16 Feb 2016 05:54:02 -0800 (PST) Received: from tn-HP-4.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id q129sm20833462wmd.14.2016.02.16.05.54.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Feb 2016 05:54:01 -0800 (PST) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jiang.liu@linux.intel.com, jchandra@broadcom.com, Stefano.Stabellini@eu.citrix.com Subject: [PATCH V5 05/15] x86, pci: Cleanup platform specific MCFG data by using ECAM hot_added flag. Date: Tue, 16 Feb 2016 14:53:35 +0100 Message-Id: <1455630825-27253-6-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455630825-27253-1-git-send-email-tn@semihalf.com> References: <1455630825-27253-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160216_055422_184401_B5356528 X-CRM114-Status: GOOD ( 13.92 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 x86 uses lots of arch-specific data to maintain MCFG regions. However, there is no need to. Firstly, information like start_bus, end_bus can be obtained from acpi_pci_root structure. Secondly, mcfg_added flag is already integrated to MCFG library, so it is enough to call functions pci_mmconfig_insert and pci_mmconfig_delete which are handling hot-plugged MCFG regions internally. This patch implements above improvements, as a results we get much smaller pci_root_info structure. Signed-off-by: Tomasz Nowicki Tested-by: Suravee Suthikulpanit Tested-by: Duc Dang Tested-by: Dongdong Liu Tested-by: Hanjun Guo Tested-by: Graeme Gregory Tested-by: Sinan Kaya --- arch/x86/pci/acpi.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index cec68e7..081dc70 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -11,11 +11,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; @@ -179,16 +174,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) @@ -197,13 +189,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,"); @@ -213,14 +203,10 @@ 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; - 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; - } + pci_mmconfig_delete(root->segment, root->secondary.start, + root->secondary.end); } #else static int setup_mcfg_map(struct acpi_pci_root_info *ci)