From patchwork Tue Oct 27 16:38:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 7498081 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 49A679F750 for ; Tue, 27 Oct 2015 16:42:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B669208CE for ; Tue, 27 Oct 2015 16:42:40 +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 70E1D207C8 for ; Tue, 27 Oct 2015 16:42:39 +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 1Zr7J8-0008Uu-PW; Tue, 27 Oct 2015 16:41:10 +0000 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zr7Hp-0006R7-87 for linux-arm-kernel@lists.infradead.org; Tue, 27 Oct 2015 16:39:53 +0000 Received: by lfaz124 with SMTP id z124so175672457lfa.1 for ; Tue, 27 Oct 2015 09:39:31 -0700 (PDT) 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=Ubk/GnaqWet8mtvY2+VUIAgeCndK7lQx1YqgxIxqchY=; b=jK36IpylUyEBYOanLHVIh09Qgbp6BfjdlGrdbuEBwi/Xt7wcHWC/bB5DRPS0W0ogU3 hgfzeN1saj/BRDYPlGxKT6VimStJA3sTMmNKwgbXpcqQ6y41CS+2N5hizBcSChdzOihH rHhmxJ40p0+UrZOdXmqkwLU+g+CqCOvld+UpeSL5Br9ya8UAgyiRNBaMOxH5rTsPfTGi Y8Z2xoMrsFqHAt7XmcyRpOOPhGcYzmemIzKTp3HDJjg5c0TtSsEnPrIGKD7pBqVTiARi 2FB1SLDbxn37gZX6Y7haSDPt4uNZKAnJyWijIN5qgD0qacg83DRPQv9x8Xi6WC7fMN60 YyIg== 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=Ubk/GnaqWet8mtvY2+VUIAgeCndK7lQx1YqgxIxqchY=; b=N772a7l6P7KGVz1/cLDuK8mCORYOMPQGA+ZoORKrCCxpiQGGg/5SEYTPymmotJ3XYF m2DEBoXAgKvzk3wtZjzcf9wXVZXwynoLm3/CaZ0jFeplVim2vkdyvF8OyxefVeI/AhTj ytfCWgGOP4Ma/dBMOOy8f08J3HAhuUsJtKreC8bwg+146oGfJDjUl6HG7UpyDFz0aci4 0wJAH+yT2qKknXmvOi7bGQ+H5JgFfv5dV2lEAx14rpdEE3u63qt5JIN7yyPaG4e5ZvND v1R5xc6MEhx4XNLkzJE6qaRJBNQ824qtNg7+P9jJiOQn+MKY9IdRqy+y7+nEsQzbtxMT e7lA== X-Gm-Message-State: ALoCoQkSEZ7TPuUOUhHwv1oBcTa85tuqM0Ra2cLFRuHbPrTZ0121Bv3AX0odPswXkUQuWxc9tjxN X-Received: by 10.25.152.131 with SMTP id a125mr9348963lfe.13.1445963971090; Tue, 27 Oct 2015 09:39:31 -0700 (PDT) Received: from tn-HP-4.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id kk6sm6988609lbc.48.2015.10.27.09.39.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 09:39:30 -0700 (PDT) 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 Subject: [PATCH V1 09/11] x86, pci: Use previously added ECAM hot_added flag to remove ECAM regions. Date: Tue, 27 Oct 2015 17:38:40 +0100 Message-Id: <1445963922-22711-10-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445963922-22711-1-git-send-email-tn@semihalf.com> References: <1445963922-22711-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151027_093949_626241_19E38CCF X-CRM114-Status: GOOD ( 15.25 ) 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: linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, Narinder.Dhillon@caviumnetworks.com, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , tglx@linutronix.de, jiang.liu@linux.intel.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=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 Now that we have hot_added flag we can get rid of arch specific mcfg_added. Signed-off-by: Tomasz Nowicki --- arch/x86/pci/acpi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 28c9cd6..b4ef761 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -13,7 +13,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 @@ -188,7 +187,6 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci) 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; /* return success if MMCFG is not in use */ @@ -204,7 +202,6 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci) /* 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 +211,17 @@ static int setup_mcfg_map(struct acpi_pci_root_info *ci) static void teardown_mcfg_map(struct acpi_pci_root_info *ci) { + struct pci_mmcfg_region *cfg; struct pci_root_info *info; 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(info->sd.domain, info->start_bus); + if (!cfg) + return; + + if (cfg->hot_added) + pci_mmconfig_delete(info->sd.domain, info->start_bus, + info->end_bus); } #else static int setup_mcfg_map(struct acpi_pci_root_info *ci)