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: 936769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.b="CsweVeRI"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41HCXD6WLFz9s01 for ; Fri, 29 Jun 2018 20:27:56 +1000 (AEST) 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 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);