From patchwork Mon Jul 15 08:56:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1131891 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45nHXY3lLnz9sDQ for ; Mon, 15 Jul 2019 18:59:41 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PQQudcCY"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45nHXY1dBRzDqQT for ; Mon, 15 Jul 2019 18:59:41 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::643; helo=mail-pl1-x643.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PQQudcCY"; dkim-atps=neutral Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45nHSr5RGMzDqQn for ; Mon, 15 Jul 2019 18:56:27 +1000 (AEST) Received: by mail-pl1-x643.google.com with SMTP id i2so7972546plt.1 for ; Mon, 15 Jul 2019 01:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPda7gPSdqwWVcRAT6/H4iPhUo7uiT7B8qZSeaWNhFY=; b=PQQudcCYIthEFvsjyPr/G9LE9ZSZFXwG0Pu6QqgIpdxY5zY2i0VFmvHz/N/kot9fKX bfrGpSXQytdfzur9v2jb7UwPVVhmizm1KHahwywpfssYlur9dWrKIRTptJze4MHpYWUc dkLSSiV/GwVxGVt4FbtG/5X5TqtI93s4wHUvlYxGc6PLlxZAvnfuj+JcSPM3IvQGn18z OUhpxQCJGFrHWPbZqE8EIZ6RLv4N4ZlbnKsHkOs2zgIpAQUxL5PeHwXVU/U14J62VjrJ uy++wxRPbz99ytrwFxbQZqvkjpUtzisKRG5tGMn+hT5Ynm94bJrNG0mB05mx+c8KuwlY ZAig== 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:mime-version:content-transfer-encoding; bh=tPda7gPSdqwWVcRAT6/H4iPhUo7uiT7B8qZSeaWNhFY=; b=XEWPlrUCyKn5t56/idsl7FO4rST7BwqUL+US1qS9DAVeEUHu6KmK6X8jyvYfnzKOBs qiGAWHEAkFFhz1uXjigxUtLFQVo9Eu744C9L1fjanXQ8l6NLFrf/upgLzn61dzLWIoZU 85lqR+mZ11TH3M13JE+DkG3/v7BmSLeqTguj7U6T+H4ETvIaodwXhWuFTP28h2DsrcVh v3YfXmNKkn1ebfOKPVCiGlGZJMueOBlOE7S0bJDwzbV233I/ltSAhRrULsUTxhv8WkUz PlhcAuBtpxwFCgW0SkB9TDhyYu+Rlku+wydfHjW5rxB35bNqxXE2d4K6Akx9DP88d5aO T/2Q== X-Gm-Message-State: APjAAAVQPhucu+N7jPSnLsZBx3UlSxZG+tkEBXhz7HHC74MaZMKRFjo2 aWCs3TCVW5LF13HolQCIRaw3pKGZBSQ= X-Google-Smtp-Source: APXvYqztEKewgkpEppoid+GYzcawvreBxhWaff06LIJ6AixEPyY7A9CtFNZ4l6S4n0cQepeKjEhaiA== X-Received: by 2002:a17:902:1125:: with SMTP id d34mr27142286pla.40.1563180985223; Mon, 15 Jul 2019 01:56:25 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d14sm22514815pfo.154.2019.07.15.01.56.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 01:56:24 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/5] powerpc/eeh_cache: Don't use pci_dn when inserting new ranges Date: Mon, 15 Jul 2019 18:56:08 +1000 Message-Id: <20190715085612.8802-2-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190715085612.8802-1-oohall@gmail.com> References: <20190715085612.8802-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, Oliver O'Halloran Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" At the point where we start inserting ranges into the EEH address cache the binding between pci_dev and eeh_dev has already been set up. Instead of consulting the pci_dn tree we can retrieve the eeh_dev directly using pci_dev_to_eeh_dev(). Signed-off-by: Oliver O'Halloran Reviewed-by: Sam Bobroff Tested-by: Sam Bobroff --- arch/powerpc/kernel/eeh_cache.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c index 3204723..908ba69 100644 --- a/arch/powerpc/kernel/eeh_cache.c +++ b/arch/powerpc/kernel/eeh_cache.c @@ -156,18 +156,10 @@ eeh_addr_cache_insert(struct pci_dev *dev, resource_size_t alo, static void __eeh_addr_cache_insert_dev(struct pci_dev *dev) { - struct pci_dn *pdn; struct eeh_dev *edev; int i; - pdn = pci_get_pdn_by_devfn(dev->bus, dev->devfn); - if (!pdn) { - pr_warn("PCI: no pci dn found for dev=%s\n", - pci_name(dev)); - return; - } - - edev = pdn_to_eeh_dev(pdn); + edev = pci_dev_to_eeh_dev(dev); if (!edev) { pr_warn("PCI: no EEH dev found for %s\n", pci_name(dev)); From patchwork Mon Jul 15 08:56:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1131892 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45nHbN2BDnz9sDQ for ; Mon, 15 Jul 2019 19:02:08 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JtzeVjUl"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45nHbL3J2xzDqTL for ; Mon, 15 Jul 2019 19:02:06 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::642; helo=mail-pl1-x642.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JtzeVjUl"; dkim-atps=neutral Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45nHSs6ygVzDqQT for ; Mon, 15 Jul 2019 18:56:29 +1000 (AEST) Received: by mail-pl1-x642.google.com with SMTP id b3so7958476plr.4 for ; Mon, 15 Jul 2019 01:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nLAi09/WQzIs/j8bJLFsma1ombGiigM6qxBcnWHiUEs=; b=JtzeVjUlQbRW8Q7PknryB7pEHdIkY1Bz/6jv6aMtX9KfBK3SV/9khE595AiDnqAObZ pxECD0GU6C/sC8khHtsVvrNV2jcYU1AbQu4w5NRU7UMM0fjl2MrA784CsyDxW+XZr0tg ogs7MAS1J5bfZ5bmbB2Dh49jJTUK96I9yrgx5gHBuIjrXzhvLRnHJuhHeULxBFppYtQJ p3qIN3zKz2yBi0KW+MSwusmPpUi62ai3xtARiskArT5GjqG6BFcLky1vkjFI/ny+KiEa hQEluL80ThcWFN8HZnndo3UVOpCu2Z4ygEkMBCcFRC3jXjA8VwAxxh+8YGBY1cdt/l6Z cSfQ== 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:mime-version:content-transfer-encoding; bh=nLAi09/WQzIs/j8bJLFsma1ombGiigM6qxBcnWHiUEs=; b=CDlbYdadZNWk8oxyW/jUUitrs2g+m6HOijYqJdV+rIuINTKi6gmjWVfCo1x6vlMz8I 3vlNxCL+5Dq+eaB67L/R5nkUo9k/ryqfahcyqyWSPg+uErMqwI2FiCMxQXi3RKPk9Imj 5VrcKVkCx47qSNX+qfOQ6NsgGkAfXaeOaalvCCMSZrdsXHceL7TRNYSXehmrQWgMBWxp o5cj0MlBTTlF/JAnC23CWXWXaIvZgOcIF1jg/d6I2WhBxKhh53cxn8dFZxwIAwQqp8kQ 7nECnyuAR6jaBSZ27bHocSOohS1ixkQYoOWiP6wQNG9sml2Y4n07gQpWsUMS1ZX8Ta4Y Hv6Q== X-Gm-Message-State: APjAAAXsald59gA9F148jlZ4Nn2HNDAkjHHUS2YVVvpSWAM7Y5d53+ip JmIxMJ+tI2vPoDUx6tp1OkpeYxcX1DM= X-Google-Smtp-Source: APXvYqz/g+jKFEhfSc+DXR4ag1cKhI3NH6OKNaiSChiK3wXoLIgobAqRQJAPOKWFwPZWMUXweg7q8Q== X-Received: by 2002:a17:902:b612:: with SMTP id b18mr953796pls.8.1563180987318; Mon, 15 Jul 2019 01:56:27 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d14sm22514815pfo.154.2019.07.15.01.56.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 01:56:26 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/5] powerpc/eeh_sysfs: Fix incorrect comment Date: Mon, 15 Jul 2019 18:56:09 +1000 Message-Id: <20190715085612.8802-3-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190715085612.8802-1-oohall@gmail.com> References: <20190715085612.8802-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, Oliver O'Halloran Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The EEH_ATTR_SHOW() helper is used to display fields from struct eeh_dev not struct pci_dn. Signed-off-by: Oliver O'Halloran Reviewed-by: Sam Bobroff --- arch/powerpc/kernel/eeh_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index 3fa04dd..6a2c2886f 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -30,7 +30,7 @@ /** * EEH_SHOW_ATTR -- Create sysfs entry for eeh statistic * @_name: name of file in sysfs directory - * @_memb: name of member in struct pci_dn to access + * @_memb: name of member in struct eeh_dev to access * @_format: printf format for display * * All of the attributes look very similar, so just From patchwork Mon Jul 15 08:56:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1131893 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45nHdh6X7mz9sDQ for ; Mon, 15 Jul 2019 19:04:08 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iwHnF4Tv"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45nHdh26zlzDqQN for ; Mon, 15 Jul 2019 19:04:08 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::441; helo=mail-pf1-x441.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iwHnF4Tv"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45nHSv4wKgzDqQT for ; Mon, 15 Jul 2019 18:56:31 +1000 (AEST) Received: by mail-pf1-x441.google.com with SMTP id t16so7093125pfe.11 for ; Mon, 15 Jul 2019 01:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zdiFcOQdpxvyzMoMOi7bPjgrBc4m1TxaTwRnN2L23Fs=; b=iwHnF4Tvyz/EIsstgDUUqlbgf4VBeTsI7VIDEZt1DUdKikIpuu+84UW9mNNWJe+o+o RTBRJE0BA1h9rivXUCpA1p1J46t+x5qK7KBizauNs7gDkKXMBWueF0WTqqbI/XvS6aOn hyRLfyWHwd2ZRSHOfgxmZ6dtTZkogg+yWqi4m1Wp3Ng2NO7AOAaV/Fm1JnvYmmFsyJv3 /L9U+N9ej8v05lbinT4FyMRhpxU5vmAvGGaRYeMJYwT5ek0UKDgChZ1WTWHSNqSaGKob 24z6qRHn4jK4PMkxSbFkloEWmNhQVk/G6QwLdCi2szupB8mmLnB+ULqrl7gGcKJ8yZYm lxsg== 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:mime-version:content-transfer-encoding; bh=zdiFcOQdpxvyzMoMOi7bPjgrBc4m1TxaTwRnN2L23Fs=; b=m2L0cdGNMsVQcRGL8mRi9GARI+yBAwHVtl+wM1ejeflJUP5LNtjt6eT3o16KA0BIeU eqQXZ4udD9F8mWmHYmFvICjI6IWz9OqBBHVtB5sxpEAZiqk+MkLDGKlhPozfx6uuXwvX 74PE6NPLCQBp3QQwvfYhKINi0CUm6vNwyoKDUrjRW9PjDBsZe0L4FI9m8Xmbw3OWI9bs tH/iNMGcx3SyN3iDLFHM3SGn4esoq7VN1Cn2TyuFytVw9DU/03mKunSTL5Eqm+ecY19U A7HGT4jJr61gezEViNXAo5N3KoKM5w11msN8exFN4e+lsq/g8wdq9l4iBzm63GxAZ8Xp Hdtw== X-Gm-Message-State: APjAAAXDNByrjD+FgvNHylQezx6AvQVwzOtQXdjapIT3HexWcOKfZONi Bjxmt0B3sl5W+/PT0hfj/bfB0gRbWU4= X-Google-Smtp-Source: APXvYqw38CWQ/zvMSVqnehzFfCUWmMsluGFer5nDDJVosG9A5dBeo5uGKFAhklptr3dA9CZNc1ILCg== X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr26930773pjb.37.1563180989505; Mon, 15 Jul 2019 01:56:29 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d14sm22514815pfo.154.2019.07.15.01.56.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 01:56:29 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 3/5] powerpc/eeh_sysfs: ifdef pseries sr-iov sysfs properties Date: Mon, 15 Jul 2019 18:56:10 +1000 Message-Id: <20190715085612.8802-4-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190715085612.8802-1-oohall@gmail.com> References: <20190715085612.8802-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, Oliver O'Halloran Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" There are several EEH sysfs properties that only exists when the "ibm,is-open-sriov-pf" property appears in the device tree node of the PCI device. This used on pseries to indicate to the guest that the hypervisor allows the guest to configure the SR-IOV capability. Doing this requires some handshaking between the guest, hypervisor and userspace when a VF is EEH frozen which is why these properties exist. This is all dead code on non-pseries platforms so wrap it in an #ifdef CONFIG_PPC_PSERIES to make the dependency clearer. Signed-off-by: Oliver O'Halloran Tested-by: Sam Bobroff Reviewed-by: Sam Bobroff --- arch/powerpc/kernel/eeh_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index 6a2c2886f..3adf8cd 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -91,7 +91,7 @@ static ssize_t eeh_pe_state_store(struct device *dev, static DEVICE_ATTR_RW(eeh_pe_state); -#ifdef CONFIG_PCI_IOV +#if defined(CONFIG_PCI_IOV) && defined(CONFIG_PPC_PSERIES) static ssize_t eeh_notify_resume_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -148,7 +148,7 @@ static void eeh_notify_resume_remove(struct pci_dev *pdev) #else static inline int eeh_notify_resume_add(struct pci_dev *pdev) { return 0; } static inline void eeh_notify_resume_remove(struct pci_dev *pdev) { } -#endif /* CONFIG_PCI_IOV */ +#endif /* CONFIG_PCI_IOV && CONFIG PPC_PSERIES*/ void eeh_sysfs_add_device(struct pci_dev *pdev) { From patchwork Mon Jul 15 08:56:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1131894 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45nHgz2KfBz9sDQ for ; Mon, 15 Jul 2019 19:06:07 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GPm2JlWD"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45nHgz0YylzDqQN for ; Mon, 15 Jul 2019 19:06:07 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::543; helo=mail-pg1-x543.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GPm2JlWD"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45nHSx66ZNzDqQT for ; Mon, 15 Jul 2019 18:56:33 +1000 (AEST) Received: by mail-pg1-x543.google.com with SMTP id g15so7394508pgi.4 for ; Mon, 15 Jul 2019 01:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UXHO2NDyuDVxfFPUSLDKgRXqIpvkAdkXTkmw0S2mGGw=; b=GPm2JlWDjI11u2op0yT4DqcnDEcsDgk3o8XPYW/YCNpDHnCNQc23v734YZgra0tsIH ShI2mr9ke6eSV6vUUyPiiuDS3t6ubDYeaXMwiVbcOcS7S7YqCnhUa0ClbJ6UoGKIZ62w 98mYfX4eJtuXfdeybgpZTzjc8mAJxM1+vv8EaYVVXrAGXQxOTKmKwUqicc0glObWGh1B I0jMoYZkfn2oKIZVjAWvsIzw0F7x5dhtBEVVBFU+d7WXrKljHc+3Ja0AfvfqquAu3xcB Zcrm7A6yiIuXU5NaepCOFTERn6utt3qghooHoU5ks7lzE6oa91Qcugjtt8uH4TcIb01c OXzg== 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:mime-version:content-transfer-encoding; bh=UXHO2NDyuDVxfFPUSLDKgRXqIpvkAdkXTkmw0S2mGGw=; b=uax+balFgr4dF3w3cVqXFhZzIRmTwqbJfijXkSRqVC4qpq5cke8YtEZJkYqGSRsE1L XBfGzj3qxchsvzZAZ4aB8XwQ6nzIDe+IXoEOHYF7dgHvddT35Ae/LVqfB0B5TZJC1jCL xtLxPJ6jvDjWjZvrQE5e38nyNB0LFyDEMsquAkHD5L5EMAyKbHCEG8DVOqTRG9S+kgU1 zRjMookVeljzhXurP2td3rP0xUBbBsPRX+jki42EY7BQ6wgCoOMiVtHPKmI/cEpIuwu6 tPv7tQyrliCQZyNoGp1QnUOyUW5H7/LjhcYMoQire6qmJO18YK4EoYy/Qb7AZFHYDISk 93nA== X-Gm-Message-State: APjAAAWzpFNKVC5NRjlexboUqVE0EyqhUjFPNIu/TGuqs8y7FB5J9t7f mZxwmHbP+KeZd7LiF/IuZp1FTn9mUaA= X-Google-Smtp-Source: APXvYqxuZfOAbZy7NHMNHkIVpjvJUHAyiQbDN0gjq7LShqWOjUq9hlQC8jkJGXQgkM8R37nXhGNVtw== X-Received: by 2002:a17:90a:22c6:: with SMTP id s64mr28455442pjc.5.1563180991692; Mon, 15 Jul 2019 01:56:31 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d14sm22514815pfo.154.2019.07.15.01.56.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 01:56:31 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/5] powerpc/eeh_sysfs: Remove double pci_dn lookup. Date: Mon, 15 Jul 2019 18:56:11 +1000 Message-Id: <20190715085612.8802-5-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190715085612.8802-1-oohall@gmail.com> References: <20190715085612.8802-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, Oliver O'Halloran Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In eeh_notify_resume_show() the pci_dn for the device is looked up once in the declaration block and then once after checking for a NULL eeh_dev. Remove the second lookup since it's pointless. Signed-off-by: Oliver O'Halloran Reviewed-by: Sam Bobroff Tested-by: Sam Bobroff --- arch/powerpc/kernel/eeh_sysfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index 3adf8cd..c4cc8fc 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -102,7 +102,6 @@ static ssize_t eeh_notify_resume_show(struct device *dev, if (!edev || !edev->pe) return -ENODEV; - pdn = pci_get_pdn(pdev); return sprintf(buf, "%d\n", pdn->last_allow_rc); } From patchwork Mon Jul 15 08:56:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1131895 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45nHkP5dwZz9sPM for ; Mon, 15 Jul 2019 19:08:13 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L7T1JwLb"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45nHkP2t2xzDqRC for ; Mon, 15 Jul 2019 19:08:13 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L7T1JwLb"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45nHSz6rxdzDqRw for ; Mon, 15 Jul 2019 18:56:35 +1000 (AEST) Received: by mail-pf1-x443.google.com with SMTP id p184so7105376pfp.7 for ; Mon, 15 Jul 2019 01:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eS/9mMyCx/umiRMz4C0GDQdEH0XNXkIVKstdfBzpTgI=; b=L7T1JwLbICl0sU8GxGOyINvgGEbIaXxbHdLdhOZLpHuZKto9qH5BkQ6Dw+w9CUqs4F 2fzOZYz7zVg8AeBtFfyydUyHKgEE0L1agNRcc3xmwuivnxGJAovJTsqhydaew5mK4XB3 n8vaVwfXCW6rty5ctzGp/pfURb5yDIpkT7IE2j602FywraxoUgJbtS+Z9lf8Xbgh78K5 1sPlaeJLnzd3StnJXJdLFT1XEF0cyB1bLvTS/LgUZZFSo+1iW9tg0+hgdgQOO/76XDMr fHnfsN5WSW7eBbsJLS0YVShU6gH4mx56d5hKt1E4jnHeDwKvRh1MBsv+KbDu/6ZYf/DV 0xBw== 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:mime-version:content-transfer-encoding; bh=eS/9mMyCx/umiRMz4C0GDQdEH0XNXkIVKstdfBzpTgI=; b=EnV1Wex39S1ZKIYDx3z7HiSrOGuuDD2+wClQ+rbwlkJKqNgM9smNAKsq0yaPQ/cfYD 7RJ7NFiZ6eDR6gIAuS+wnMXNRDJmSXg6C0AaLbdYHz/ukSHz5Y4ImgpRPejEIp7Pd4Aj r8V2tES/D189PPUeLEHTXaPTcuBkQSbOqWtEz93yGt27btMZE0H29tGKMWKP6DVcRc+y kgbwewarIxAx82U/CeSk5bMxYgfad9DTvEO+86sZ1QBHDiy6hopfe3yff1mDS26QOkR7 Ff9YQ/WKujgtSLlYER+Lc5ic9MuC/S5id6dAaaGtu36bs3ObyvFuqoZy/L4Ir1T0RbL6 SfUg== X-Gm-Message-State: APjAAAUU5sadupdJYogT3ymWys5leJ+Eo3L0sJBrabXVVhVtURl+z9kr uu5wt61Ahy7Iw+TI57O8s/0KuxId4vc= X-Google-Smtp-Source: APXvYqy1DfFVtpftpJ1xyuGJ71VE/uhrU4EBG+X9m3Fj5CiAHA2eSKs4aOB5HgMx5uyKJlal5YuOeQ== X-Received: by 2002:a17:90a:d997:: with SMTP id d23mr26809432pjv.84.1563180993841; Mon, 15 Jul 2019 01:56:33 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id d14sm22514815pfo.154.2019.07.15.01.56.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 01:56:33 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/5] powerpc/eeh_sysfs: Make clearing EEH_DEV_SYSFS saner Date: Mon, 15 Jul 2019 18:56:12 +1000 Message-Id: <20190715085612.8802-6-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190715085612.8802-1-oohall@gmail.com> References: <20190715085612.8802-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sbobroff@linux.ibm.com, Oliver O'Halloran Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The eeh_sysfs_remove_device() function is supposed to clear the EEH_DEV_SYSFS flag since it indicates the EEH sysfs entries have been added for a pci_dev. When the sysfs files are removed eeh_remove_device() the eeh_dev and the pci_dev have already been de-associated. This then causes the pci_dev_to_eeh_dev() call in eeh_sysfs_remove_device() to return NULL so the flag can't be cleared from the still-live eeh_dev. This problem is worked around in the caller by clearing the flag manually. However, this behaviour doesn't make a whole lot of sense, so this patch fixes it by: a) Re-ordering eeh_remove_device() so that eeh_sysfs_remove_device() is called before de-associating the pci_dev and eeh_dev. b) Making eeh_sysfs_remove_device() emit a warning if there's no corresponding eeh_dev for a pci_dev. The paths where the sysfs files are only reachable if EEH was setup for the device for the device in the first place so hitting this warning indicates a programming error. Signed-off-by: Oliver O'Halloran Reviewed-by: Sam Bobroff Tested-by: Sam Bobroff --- arch/powerpc/kernel/eeh.c | 30 +++++++++++++++++------------- arch/powerpc/kernel/eeh_sysfs.c | 15 ++++++++------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index f192d57..6e24896 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c @@ -1203,7 +1203,6 @@ void eeh_add_device_late(struct pci_dev *dev) eeh_rmv_from_parent_pe(edev); eeh_addr_cache_rmv_dev(edev->pdev); eeh_sysfs_remove_device(edev->pdev); - edev->mode &= ~EEH_DEV_SYSFS; /* * We definitely should have the PCI device removed @@ -1306,17 +1305,11 @@ void eeh_remove_device(struct pci_dev *dev) edev->pdev = NULL; /* - * The flag "in_error" is used to trace EEH devices for VFs - * in error state or not. It's set in eeh_report_error(). If - * it's not set, eeh_report_{reset,resume}() won't be called - * for the VF EEH device. + * eeh_sysfs_remove_device() uses pci_dev_to_eeh_dev() so we need to + * remove the sysfs files before clearing dev.archdata.edev */ - edev->in_error = false; - dev->dev.archdata.edev = NULL; - if (!(edev->pe->state & EEH_PE_KEEP)) - eeh_rmv_from_parent_pe(edev); - else - edev->mode |= EEH_DEV_DISCONNECTED; + if (edev->mode & EEH_DEV_SYSFS) + eeh_sysfs_remove_device(dev); /* * We're removing from the PCI subsystem, that means @@ -1327,8 +1320,19 @@ void eeh_remove_device(struct pci_dev *dev) edev->mode |= EEH_DEV_NO_HANDLER; eeh_addr_cache_rmv_dev(dev); - eeh_sysfs_remove_device(dev); - edev->mode &= ~EEH_DEV_SYSFS; + + /* + * The flag "in_error" is used to trace EEH devices for VFs + * in error state or not. It's set in eeh_report_error(). If + * it's not set, eeh_report_{reset,resume}() won't be called + * for the VF EEH device. + */ + edev->in_error = false; + dev->dev.archdata.edev = NULL; + if (!(edev->pe->state & EEH_PE_KEEP)) + eeh_rmv_from_parent_pe(edev); + else + edev->mode |= EEH_DEV_DISCONNECTED; } int eeh_unfreeze_pe(struct eeh_pe *pe) diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index c4cc8fc..5614fd83 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c @@ -175,22 +175,23 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev) { struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); + if (!edev) { + WARN_ON(eeh_enabled()); + return; + } + + edev->mode &= ~EEH_DEV_SYSFS; + /* * The parent directory might have been removed. We needn't * continue for that case. */ - if (!pdev->dev.kobj.sd) { - if (edev) - edev->mode &= ~EEH_DEV_SYSFS; + if (!pdev->dev.kobj.sd) return; - } device_remove_file(&pdev->dev, &dev_attr_eeh_mode); device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); device_remove_file(&pdev->dev, &dev_attr_eeh_pe_state); eeh_notify_resume_remove(pdev); - - if (edev) - edev->mode &= ~EEH_DEV_SYSFS; }