From patchwork Fri Jun 29 10:27:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hari Vyas X-Patchwork-Id: 10496113 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6408B60230 for ; Fri, 29 Jun 2018 10:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49000297C0 for ; Fri, 29 Jun 2018 10:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D8DE297C4; Fri, 29 Jun 2018 10:27:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D246D297C0 for ; Fri, 29 Jun 2018 10:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935358AbeF2K14 (ORCPT ); Fri, 29 Jun 2018 06:27:56 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:41993 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935356AbeF2K1z (ORCPT ); Fri, 29 Jun 2018 06:27:55 -0400 Received: by mail-qk0-f193.google.com with SMTP id u62-v6so4616392qkf.9 for ; Fri, 29 Jun 2018 03:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=opLaatnGT1h8QJWeFj/cCU/v/CyE5akP05a79RBaB1g=; b=CsweVeRIxZQL/PjJeyo8mtHgA8RHKXgdBzbD/AC4jiO4kE0TUrZYENmsqPJ87ycuBJ 42Z5OhgHan7NpdbLoN6+GfYxnl0GRLszV4YrY0HToWnwdXGk2EqS8ceXjzMMtL+FxUGM QFio5PxytUCR8e3VETvkJMvAwB6u+q3mLV/14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=opLaatnGT1h8QJWeFj/cCU/v/CyE5akP05a79RBaB1g=; b=faOsu92KRQzm7RCu6Fex9gpcVnK67AKRJsvDIYmrGUZJxSre/PGLQHGibZksoNv79a MAWzhHvGnyJg3Xy4QpgjUygdSZbComau+chNYwvMXKKYKjUsk7J8tZWTbFWr0v3qQUrT dHzcVPb7oFhjNhDStHrtjPnOGCbsl/DoPEVoQL4nGzIVMpnKER8wHotp2cy9XHvklSeM q2sGZPeXF6iEHs96KUSY7qYLQg2Unbqxs5DIWBcZ5CuCWgXhNOfD4P/R7A7vb5szD6ce AyXplO8tnnejwzvW/Gvjv9F5efBjmuzgAFNB35gpqptb4uv1Ld4VkE6RmW5vz9aPl1kP lEQQ== X-Gm-Message-State: APt69E1rwn4BmA93Q2emIY96T8ypmxOaYS0pvH62UA7/tLRMZwfej7gD AeuGpkD3eBjSyZfPQW9CkXWJ/g== X-Google-Smtp-Source: AAOMgpfXlOYaGQ4UVK92vgmv3jWKKHzUQg1lz5jmwMU549zKxBdeLX8YD6cHkafEkmEju8R3wfovBg== X-Received: by 2002:a37:1f53:: with SMTP id f80-v6mr11744487qkf.1.1530268074474; Fri, 29 Jun 2018 03:27:54 -0700 (PDT) Received: from hariv-server.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id v88-v6sm2188365qkv.63.2018.06.29.03.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jun 2018 03:27:54 -0700 (PDT) From: Hari Vyas To: bhelgaas@google.com, benh@kernel.crashing.org Cc: linux-pci@vger.kernel.org, ray.jui@broadcom.com, Hari Vyas Subject: [PATCH v2 2/3] PCI: use new pci function to get device addition state Date: Fri, 29 Jun 2018 15:57:40 +0530 Message-Id: <1530268061-17324-3-git-send-email-hari.vyas@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530268061-17324-1-git-send-email-hari.vyas@broadcom.com> References: <1530268061-17324-1-git-send-email-hari.vyas@broadcom.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to one race condition happening while updating pci device addition and master status bits in a particular scenario, device addition state is moved to a independent private flag variable. This change uses newly proposed pci_dev_is_added() function to retrieve device addition state. Signed-off-by: Hari Vyas --- arch/powerpc/kernel/pci-common.c | 4 +++- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- arch/powerpc/platforms/pseries/setup.c | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index fe9733f..471aac3 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -42,6 +42,8 @@ #include #include +#include "../../../drivers/pci/pci.h" + /* hose_spinlock protects accesses to the the phb_bitmap. */ static DEFINE_SPINLOCK(hose_spinlock); LIST_HEAD(hose_list); @@ -1014,7 +1016,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) /* Cardbus can call us to add new devices to a bus, so ignore * those who are already fully discovered */ - if (dev->is_added) + if (pci_dev_is_added(dev)) continue; pcibios_setup_device(dev); diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 5bd0eb6..70b2e1e 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -46,6 +46,7 @@ #include "powernv.h" #include "pci.h" +#include "../../../../drivers/pci/pci.h" #define PNV_IODA1_M64_NUM 16 /* Number of M64 BARs */ #define PNV_IODA1_M64_SEGS 8 /* Segments per M64 BAR */ @@ -3138,7 +3139,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) struct pci_dn *pdn; int mul, total_vfs; - if (!pdev->is_physfn || pdev->is_added) + if (!pdev->is_physfn || pci_dev_is_added(pdev)) return; pdn = pci_get_pdn(pdev); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 139f0af..8a4868a 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -71,6 +71,7 @@ #include #include "pseries.h" +#include "../../../../drivers/pci/pci.h" int CMO_PrPSP = -1; int CMO_SecPSP = -1; @@ -664,7 +665,7 @@ static void pseries_pci_fixup_iov_resources(struct pci_dev *pdev) const int *indexes; struct device_node *dn = pci_device_to_OF_node(pdev); - if (!pdev->is_physfn || pdev->is_added) + if (!pdev->is_physfn || pci_dev_is_added(pdev)) return; /*Firmware must support open sriov otherwise dont configure*/ indexes = of_get_property(dn, "ibm,open-sriov-vf-bar-info", NULL);