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: 7498171 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 07E099F327 for ; Tue, 27 Oct 2015 16:44:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35AD4208D7 for ; Tue, 27 Oct 2015 16:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E458E2087A for ; Tue, 27 Oct 2015 16:44:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752411AbbJ0Qnu (ORCPT ); Tue, 27 Oct 2015 12:43:50 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35309 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965167AbbJ0Qjc (ORCPT ); Tue, 27 Oct 2015 12:39:32 -0400 Received: by lfbn126 with SMTP id n126so140179886lfb.2 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=gxhzgG0psN6gF8NgaRVwZL/UQxkp3QFSGFRRJnlsH2GFsUI7IWbcCB6shj6meq16QS EC9a5O0flbyJCWMFPYZx1yF+/kgGXXWtUcH0mlb0pBdszirU6ep+zcCvHd7r6oenCae+ K1xOf5RHmqcm1FZzsk+/Rn0dKtfiohxz3x/dnmROrU0/lllEFMignv7Z30IHpPm1p5Io bWk1W6kYq8c5YyTS2cCXf2yuOcVA52FZ8mhMjjLpghooluSIN4SPSO/U5/t5l8we5N4y jbA6esVrO3QTEFMGL4G58BgPcjf56V0+98aBpvO2jSTGu1BIZp5GWwH8gcLiJE1aTSkA MD5w== X-Gm-Message-State: ALoCoQnTUvwHjJYssJWFf13HXV5vxYU2U+TDx0NbiDc7WR4DyUM60SCvJfrkpkxXGGFtO2HuRNH2 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 Cc: jiang.liu@linux.intel.com, robert.richter@caviumnetworks.com, Narinder.Dhillon@caviumnetworks.com, ddaney@caviumnetworks.com, Liviu.Dudau@arm.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, Tomasz Nowicki 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> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 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)