From patchwork Tue Feb 16 13:53:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8326261 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 1B4A3C02AA for ; Tue, 16 Feb 2016 13:59:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35D2B202AE for ; Tue, 16 Feb 2016 13:59:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6304820263 for ; Tue, 16 Feb 2016 13:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932411AbcBPN7I (ORCPT ); Tue, 16 Feb 2016 08:59:08 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36338 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932534AbcBPNyB (ORCPT ); Tue, 16 Feb 2016 08:54:01 -0500 Received: by mail-wm0-f50.google.com with SMTP id g62so108499106wme.1 for ; Tue, 16 Feb 2016 05:54:00 -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=AocxxZ7bKxBf+JRuzhAwejhLReLN4GiCOO2Gl2mOlG8=; b=HK95nIq0MvVHnli6nX2t9qiq0ZghkQh6jjsB0P8mmILTVhssqfokJ7BbFZaah92aNA CcLDkveE5IRX/ZP/RnLbJdsGdJCLCkqicZRF8MRSBwvskxkgpUptzxsBbRc9jlVMlThf h0ptWcrfcbopg/uwGvcFz6DE2nvXjsoFCyrev1qdFev+Ilk2Gbt0dkHJVjyAW8mLYu+/ TJ85MIdfopCrUBQTe9ELZixTPw/VTlyLlubAmY4zy4uSROBWh8PlXpykMqHAQ8aDKMak 98cElZtJhE6+qW/KMKGyxC/Gpo5lkbdeKtoSoHPEYHVx7Q05qzqh0d6M1Yg0dmsGeLtM sHhw== 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=AocxxZ7bKxBf+JRuzhAwejhLReLN4GiCOO2Gl2mOlG8=; b=Zjyzj5gYOOKRcr+RK374G9B/5DG5Bvrsg6qZhSDNeJ8+SnSuNh+KRVNTqIA3zIMMOi JMtXvdTTQv9RlukYDCaZrJYlyT4MbhWc4oyz+poPHCT6TAOvN6YxrvTKw5yszNFEG9cc PE/Dhh+cSbwjD3vJa+HJqcwQScZ2aCOROGhFARQ9nlT8EOIABrO5dALz3cuiJMwcQrtz l4DCUIElDnGUcPjz3zqKCu+lH4SNKXlUSfC6yNNCNurH+8S+6A7owgFe4M5j3zQffkYz FrCkJmop0+bQBipQFGJybOa9K7bF9LtBoyHuRbmQ2i9wYtIMXgGmcqwXOvcnwjqS3KhS 2ucg== X-Gm-Message-State: AG10YOQZXZF7m4YUUV6pV1S8H2TcU9tC3VBjCOQWnKYAHWJARiTdFhle1N1Zte9vBrac7Q== X-Received: by 10.28.109.141 with SMTP id b13mr18040333wmi.25.1455630839977; Tue, 16 Feb 2016 05:53:59 -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.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Feb 2016 05:53:59 -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 Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, 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, jcm@redhat.com, Tomasz Nowicki Subject: [PATCH V5 04/15] pci, acpi, ecam: Add flag to indicate whether ECAM region was hot added or not. Date: Tue, 16 Feb 2016 14:53:34 +0100 Message-Id: <1455630825-27253-5-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> 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 There are two ways we can get ECAM (aka MCFG) regions using ACPI, first from MCFG static table and second from _CBA method. We cannot remove static regions, however regions coming from _CBA should be removed while removing bridge device. In the light of above we need flag to mark hot added ECAM entries and user to call pci_mmconfig_insert while adding regions from _CBA method. Similarly pci_mmconfig_delete while removing hot added regions. Signed-off-by: Tomasz Nowicki Tested-by: Suravee Suthikulpanit Tested-by: Jeremy Linton Tested-by: Duc Dang Tested-by: Dongdong Liu Tested-by: Hanjun Guo Tested-by: Graeme Gregory Tested-by: Sinan Kaya Reviewed-by: Lorenzo Pieralisi --- drivers/acpi/pci_mcfg.c | 4 +++- include/linux/pci-acpi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_mcfg.c b/drivers/acpi/pci_mcfg.c index 0467b00..3282f2a 100644 --- a/drivers/acpi/pci_mcfg.c +++ b/drivers/acpi/pci_mcfg.c @@ -74,6 +74,7 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start, new->segment = segment; new->start_bus = start; new->end_bus = end; + new->hot_added = false; res = &new->res; res->start = addr + PCI_MMCFG_BUS_OFFSET(start); @@ -205,6 +206,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, } rc = pci_mmconfig_map_resource(dev, cfg); if (!rc) { + cfg->hot_added = true; list_add_sorted(cfg); dev_info(dev, "MMCONFIG at %pR (base %#lx)\n", &cfg->res, (unsigned long)addr); @@ -228,7 +230,7 @@ int pci_mmconfig_delete(u16 seg, u8 start, u8 end) mutex_lock(&pci_mmcfg_lock); list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list) if (cfg->segment == seg && cfg->start_bus == start && - cfg->end_bus == end) { + cfg->end_bus == end && cfg->hot_added) { list_del_rcu(&cfg->list); synchronize_rcu(); pci_mmconfig_unmap_resource(cfg); diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index e9450ef..94d8f38 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -119,6 +119,7 @@ struct pci_mmcfg_region { u8 start_bus; u8 end_bus; char name[PCI_MMCFG_RESOURCE_NAME_LEN]; + bool hot_added; }; extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,