From patchwork Thu Feb 4 17:28:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8226291 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 DC4BA9F1C0 for ; Thu, 4 Feb 2016 17:35:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3C0F2012E for ; Thu, 4 Feb 2016 17:35:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDD2E20108 for ; Thu, 4 Feb 2016 17:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964867AbcBDRfF (ORCPT ); Thu, 4 Feb 2016 12:35:05 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34424 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966128AbcBDR3P (ORCPT ); Thu, 4 Feb 2016 12:29:15 -0500 Received: by mail-wm0-f44.google.com with SMTP id 128so37632999wmz.1 for ; Thu, 04 Feb 2016 09:29:14 -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=1bWGWOCGGoHcnNC2RCTAUY8TGumywLlg93t5l3Py+70=; b=hrdG5v+fpL8eO6Rs0zTKkT0ci6BC69I+zAxuwgA2v0ONqH8+VH6CEIFv7bXlhnR18R 3YfNjekQZW+G6XIb+9Pj6PZyzJc3u95HkWv5GtI05fuyzKv56Cc72aBhW7tZkwdmNGaF 39JnP6a19i+EbTarFyedjCIpQaqjvlk2lp0U5PfH8LxY5RG22f+Xnm/bvSApO9gh35+l jJ8PZOvLgqB3qEPNogRfzIucbvwscGVEDhTVzljzJ+yWQaP0ouYrYV6n7oiDO8aetizv MyBX290qULYQXrw82zDmJMLP0LJTpQ368iQJ+VKb5/zdpGrpuvd4A8AO32l4gYqVb0pY t2hQ== 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=1bWGWOCGGoHcnNC2RCTAUY8TGumywLlg93t5l3Py+70=; b=JF0HMEEZpINCtS3yxd+9OejUB7NT2UHgBUcrvQzbmVm5a30poLWT+3oIGWu6OKA+hV Nh0UixE7IkrTvoiPvQtAQpM7cRwerPUH2C0wpFG6MxY7lg6qiT1l3nDPwli/1pxkHr5M WyY4a28DxYAsAuscFe/gg6Vn8IJb5tCwkQEHbzifAlswN5y6+JS6eKyKXRLeZP+vQyKQ ku03VHstSqpNFdhQW/UjbNLnPE2xllLwTjeKgZFELlIBbEjs/cijQyLdxq+3K4keP3zS NCDVVlVdjI/8KbSNWqP40w1kxKdoWnAb4cUy45Yn7YxzkKQArZml0VcqAoBZeYK20JiB 2KCQ== X-Gm-Message-State: AG10YOSD+cZjDWtz8HBV0aYbpCiewBzpK9r1LMGgGywDabrpUGDiSOz8lsqmFvjPgFDCJQ== X-Received: by 10.28.50.137 with SMTP id y131mr33803635wmy.102.1454606954062; Thu, 04 Feb 2016 09:29:14 -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.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 09:29:13 -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 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, jchandra@broadcom.com, jcm@redhat.com, Tomasz Nowicki Subject: [PATCH V4 09/23] pci, acpi, ecam: Add flag to indicate whether ECAM region was hot added or not. Date: Thu, 4 Feb 2016 18:28:47 +0100 Message-Id: <1454606941-9523-10-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> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.2 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, from MCFG static table and 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 so that user should use pci_mmconfig_inject while adding regions from _CBA method. 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 --- drivers/pci/ecam.c | 2 ++ include/linux/ecam.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/pci/ecam.c b/drivers/pci/ecam.c index 7bc75af..fea5700 100644 --- a/drivers/pci/ecam.c +++ b/drivers/pci/ecam.c @@ -131,6 +131,7 @@ 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); @@ -221,6 +222,7 @@ int pci_mmconfig_inject(struct pci_mmcfg_region *cfg) err = -ENOMEM; goto out; } else { + cfg->hot_added = true; list_add_sorted(cfg); pr_info("MMCONFIG at %pR (base %#lx)\n", &cfg->res, (unsigned long)cfg->address); diff --git a/include/linux/ecam.h b/include/linux/ecam.h index 813acd1..e0f322e 100644 --- a/include/linux/ecam.h +++ b/include/linux/ecam.h @@ -17,6 +17,7 @@ struct pci_mmcfg_region { u8 start_bus; u8 end_bus; char name[PCI_MMCFG_RESOURCE_NAME_LEN]; + bool hot_added; }; struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);