From patchwork Thu Feb 4 17:28:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8226161 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 BFD329F1C0 for ; Thu, 4 Feb 2016 17:34:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4BDE20122 for ; Thu, 4 Feb 2016 17:34:05 +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 B172720108 for ; Thu, 4 Feb 2016 17:34:04 +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 1aRNlN-0001jW-9B; Thu, 04 Feb 2016 17:32:13 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRNip-0006jF-GI for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2016 17:29:40 +0000 Received: by mail-wm0-x22f.google.com with SMTP id g62so15056965wme.0 for ; Thu, 04 Feb 2016 09:29:17 -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=XrfDmVfWXPZosi0D5+XQRLLvXCuNNfjdGgq1dgRxg5M=; b=lrTV6plslyDy83b/xUnqgM8OjVVnYIjTxAa5bvx90Ij+YOS95LhrjAcGgBgto72RHQ YmEmQr5BMgnsYj/4+jq9otuMZacJk8UOTgl6TEogXewheJn2OPN4xTc5S5W5yp1edl6Y 32pTGGU8f5Hc7EctE5Q/L1dLm5wTocHos5Zz80x8N913xgLR7pwDWhNwTCRKUZ025Bvr P9Jgvk6ECeeODl/9S1lMyF8RJ2ODg9PlDsTqUz+XDQ/VoCA6vCyZybc3+7tbee7dfyo1 DfpvxrI2mH0W9NNn9K6dEBF/Zy0CaOVdeYJ6DqahwLv+MYulb5FUqclmE+O5YESxZVrg 1bug== 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=XrfDmVfWXPZosi0D5+XQRLLvXCuNNfjdGgq1dgRxg5M=; b=OE9cLC4FORsoycqj3cWVQ64wgwzaWHPsQeFZDe1DRwN2kP48SOhO6EyWxest1876IF 7SXBZ1FjiwDoCxI0g5ulECAEUAwBCepYEvcwzydB2F+UkoQIVKShn1lQQq8M/XfrCgBN C4+8fKn4stuRhxWpRcVsWm6JjnidFkVOUg7rkEi5+YJN23qKWsTSdEDdwbJjiVWdNG6A u8AoAl85DPJA3FcY2C1DmblzykIIKWFD5XT825H4kdf5V3skum+S6VxwOq/l3cXQNDMM fKnym4anOnIAiqYoKh+tKzpxUgCquEsJGA/JFABZTbUi7+oZWrFzju22w2DkkBjiT80y 9r+g== X-Gm-Message-State: AG10YOTbsWOw3XOv2p/Oiz5jwwmZAQ2db1P0/xGlRymIvmPDXZalmAKmmNY/WMNVIRuyUQ== X-Received: by 10.28.57.131 with SMTP id g125mr11062088wma.17.1454606956455; Thu, 04 Feb 2016 09:29:16 -0800 (PST) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id w8sm12238889wjx.21.2016.02.04.09.29.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 09:29:15 -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 Subject: [PATCH V4 10/23] x86, pci: Cleanup platform specific MCFG data by using ECAM hot_added flag. Date: Thu, 4 Feb 2016 18:28:48 +0100 Message-Id: <1454606941-9523-11-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454606941-9523-1-git-send-email-tn@semihalf.com> References: <1454606941-9523-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160204_092936_058767_82BA7081 X-CRM114-Status: GOOD ( 14.22 ) 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: jchandra@broadcom.com, 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Because of two facts: 1. MCFG region has hot_added flag 2. struct acpi_pci_root has topology info (domain, bus number) we can get rid of arch specific mcfg data from x86 struct pci_root_info. 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 | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index a997d7c..8e89921 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)