From patchwork Mon Oct 12 15:24:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 529174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 59676140D8F; Tue, 13 Oct 2015 02:24:39 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Zlexj-0004AM-Ge; Mon, 12 Oct 2015 15:24:31 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Zlexe-0004A8-Uz for kernel-team@lists.ubuntu.com; Mon, 12 Oct 2015 15:24:27 +0000 Received: by pabrc13 with SMTP id rc13so21818949pab.0 for ; Mon, 12 Oct 2015 08:24:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=HiCpLJr4EVFxVuv0n659H0p8ypzpI/joC9jVAip1Trc=; b=YbcUjY9a0R8i2Mom8lzk5mI1twCk0i0nOFWHtLlD+jZgmtlGGDznXmiDLj7UagJHL/ oIw34Bp8k9ynWJe9zhsW8DkfQmUX05jjp2Lww730zyTpqYyAsCBmLzWf2/LFrsIHfraK 2eiRsKj01+sFnkNq83L3JEWfEMbITAX0Lcy8Xq6NGGGv6OXk10UpV2icrAb1RX1F13Yx sKSIYOvtj6IP4Hfhp6wJJn6zWkdIseaETurFfvAgmtkH3lYmn7zhlkUhVUsm6nV6HSBj x5FdRwiuxV9SwTNqdNRPxF+y3bTAA7KLesOWjxhht62DF8DHE5XOwMCeOSuAI+/pBxaA I69w== X-Gm-Message-State: ALoCoQlT8THEu3yXUw1a5ijFCC6VJmcTKrRW2samp8FXMj9fGUMIlXUlzqsck5AuCH3aKZbZD3fK X-Received: by 10.66.145.97 with SMTP id st1mr34392221pab.145.1444663466190; Mon, 12 Oct 2015 08:24:26 -0700 (PDT) Received: from localhost.localdomain (host-174-45-38-91.hln-mt.client.bresnan.net. [174.45.38.91]) by smtp.gmail.com with ESMTPSA id qb7sm7357934pab.47.2015.10.12.08.24.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Oct 2015 08:24:24 -0700 (PDT) From: tim.gardner@canonical.com To: kernel-team@lists.ubuntu.com Subject: [PATCH Vivid SRU] powerpc/eeh: Fix PE#0 check in eeh_add_to_parent_pe() Date: Mon, 12 Oct 2015 09:24:20 -0600 Message-Id: <1444663460-8365-1-git-send-email-tim.gardner@canonical.com> X-Mailer: git-send-email 1.9.1 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Gavin Shan BugLink: http://bugs.launchpad.net/bugs/1502982 The function eeh_add_parent_pe() is used to create a PE or add one edev to its parent PE. Current code checks if PE#0 is valid for the later case. Actually, we should validate PE#0 for both cases when EEH core regards PE#0 as invalid one (without flag EEH_VALID_PE_ZERO). Otherwise, not all EEH devices can be added to its parent PE#0 for EEH on P7IOC. The patch fixes the issue by validating PE#0 for the two cases. So far, we don't have PE#0 for EEH on P7IOC, but it will show up when we enable M64 for P7IOC. The patch also makes the error message more meaningful. Signed-off-by: Gavin Shan Signed-off-by: Benjamin Herrenschmidt (cherry picked from commit 433185d2b4e9c25f2a444424c05af72fbadd4275) Signed-off-by: Tim Gardner --- arch/powerpc/kernel/eeh_pe.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 1e4946c..edf503c 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -330,6 +330,13 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) { struct eeh_pe *pe, *parent; + /* Check if the PE number is valid */ + if (!eeh_has_flag(EEH_VALID_PE_ZERO) && !edev->pe_config_addr) { + pr_err("%s: Invalid PE#0 for edev 0x%x on PHB#%d\n", + __func__, edev->config_addr, edev->phb->global_number); + return -EINVAL; + } + /* * Search the PE has been existing or not according * to the PE address. If that has been existing, the @@ -338,12 +345,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) */ pe = eeh_pe_get(edev); if (pe && !(pe->type & EEH_PE_INVALID)) { - if (!edev->pe_config_addr) { - pr_err("%s: PE with addr 0x%x already exists\n", - __func__, edev->config_addr); - return -EEXIST; - } - /* Mark the PE as type of PCI bus */ pe->type = EEH_PE_BUS; edev->pe = pe;