Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp523315pxu; Wed, 14 Oct 2020 07:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvktOdfbDXgo/SVMg2+kK4iK90QKKF38fdu9ocuN4LVRh/9MYiiOI1gMCcfYCYKHMhIFUk X-Received: by 2002:a50:8e5a:: with SMTP id 26mr5542315edx.161.1602685058656; Wed, 14 Oct 2020 07:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602685058; cv=none; d=google.com; s=arc-20160816; b=fE89pEyZixZWJIe83gwQRoynQACfqFLYHEEF22Ixgm/fBKXDCyDPJ58JYOie7hglg3 0gd6KClsN4YIwT1DEqtwMaJ1MXTGJ6/a5P8o31uUTHe/3qFaw65dBwihPyfGwCrn8cEp luBcwsjI15+NmcaKY/oyDVhA02jTko0uRmd1xS8ax0Xyy3avV5qqgVGHA4+huaShoens hnXWlwFNFbrKUWYQtyBqJB704wM50Gl384cORljJl+OnsbMRCqFrRmIsPVVxxtsUNgiG d8BvCTmnFpJBDbSMrijfJVR48cjy1lnddMzpGSye6PhXit5Vj6OoXIYYN2J+hsSACmTB RfNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=MsmwDeBwbMhZ+wEja7HHQKA9CZMajw1I+xNpemJZSMc=; b=IFEEtVxSTSTa3O1hfuMG1Xhdwt6sk17j5gJdL5fJcoFntL4g/pDXaQSilImkC5fw4o TnGb1sG9khOmAarPm0WPloX2L0EBojeXt8WHTcj2HPdPLHW/CsJlQ7lYIuB4SzMyIVn8 NKqw8P7qGD0NytScoEckvjDYOftogva/FrRqhoMxin5LtWbYUerzSHuQzGgVLFoxNzm/ f1StjihbvjwR6elcS/FFYvxiducKx8MYXjdjBdLvhykT0h5w7hfneNpvs7uT5X3cRlcP wdcZewBM+MI6ZBzleidw0siAjSHgR5pnjZ3CW5AVUDhWEG/D2A1uugVq94Ftoh8/yU8D WafA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="si/FJSTL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si2235611eju.372.2020.10.14.07.17.12; Wed, 14 Oct 2020 07:17:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="si/FJSTL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727747AbgJNISc (ORCPT + 99 others); Wed, 14 Oct 2020 04:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgJNISb (ORCPT ); Wed, 14 Oct 2020 04:18:31 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1095AC051110; Wed, 14 Oct 2020 01:18:34 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id u3so1196393pjr.3; Wed, 14 Oct 2020 01:18:34 -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; bh=MsmwDeBwbMhZ+wEja7HHQKA9CZMajw1I+xNpemJZSMc=; b=si/FJSTLT0kQv5FMreJXGtioyykblBOgCn3QLdGtt+CkOd4AGdXsrdei0X5PBOVfxX kNvmjJzAJRbe+tCQ8a6oe+IDKBn2CogANSaLsaO0F+3ACu9WVn49VkvPzOeEJiIYbD00 ikol/t9jfa+YsgY/i4hTfcXsELOdBV2kdNkIiwntrIbSrtWc6IAk7OCAzFyiN7CUTUOZ mmGehVjiAHccvduj0NsA6Hggaj1fP8uMn8iYSzxqJu3vgrfCHk+xzsfI75TkrxEKMdZq DRIrZoOFbfcRtWVPQHpEtiaHZUMIoJWzS0kM06iBOw9F65JhmVmLFOzZTz10xF9rpaRh Ep2Q== 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; bh=MsmwDeBwbMhZ+wEja7HHQKA9CZMajw1I+xNpemJZSMc=; b=TtbmBQRWXrXoFT5VrM82M8iAtJnpoBUY7keyp7RZcebUF4uOVmF/dG13aOkSv8/Aps 0ko3frtiFkhRlJX6aiAqWaW6qqQE5uYXK/kMJbenqfDCgtTdp1cZYM5AWSMRcdDlgOAt HOuUkSj/8LSM8uRx1hJgQeL5rMPLVLPTLlmFM0okop9KOzjCE+3T593D7i+IEvEBlTH6 hko+Z0IZMMENHAKHbgx4pMDIUZMfWRfGrH0bjQ5IhUA/C/PyQPe2z8KUgu+eel8WGMgW MIITdEoSE8ZXJwydHmOnQF3iZlvZzeDlyjKkK+keH0ocW9eXKxAcMgwX4596Qt/cgG1X Wpew== X-Gm-Message-State: AOAM531drIoxsBXrXYE9Zq8Yng+7tkcMCYuyco7qEJIF+/YCFJpjWBGq eiL3Y0Qx/M+Y5jfm4zHm9xI= X-Received: by 2002:a17:90b:3849:: with SMTP id nl9mr2491651pjb.54.1602663513512; Wed, 14 Oct 2020 01:18:33 -0700 (PDT) Received: from skuppusw-mobl5.amr.corp.intel.com ([134.134.139.76]) by smtp.gmail.com with ESMTPSA id t6sm2356594pgn.26.2020.10.14.01.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 01:18:32 -0700 (PDT) From: Kuppuswamy Sathyanarayanan X-Google-Original-From: Kuppuswamy Sathyanarayanan To: bhelgaas@google.com, okaya@kernel.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ashok.raj@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com Subject: [PATCH v6 1/2] PCI/ERR: Call pci_bus_reset() before calling ->slot_reset() callback Date: Wed, 14 Oct 2020 01:18:27 -0700 Message-Id: <546d346644654915877365b19ea534378db0894d.1602663397.git.sathyanarayanan.kuppuswamy@linux.intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if report_error_detected() or report_mmio_enabled() functions requests PCI_ERS_RESULT_NEED_RESET, current pcie_do_recovery() implementation does not do the requested explicit device reset, but instead just calls the report_slot_reset() on all affected devices. Notifying about the reset via report_slot_reset() without doing the actual device reset is incorrect. So call pci_bus_reset() before triggering ->slot_reset() callback. Signed-off-by: Kuppuswamy Sathyanarayanan Reviewed-by: Sinan Kaya Reviewed-by: Ashok Raj --- Changes since v4: * Added check for pci_reset_bus() return value. Changes since v5: * Added Ashok's Reviewed-by tag. drivers/pci/pcie/err.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index c543f419d8f9..315a4d559c4c 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -152,6 +152,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, { pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; struct pci_bus *bus; + int ret; /* * Error recovery runs on all subordinates of the first downstream port. @@ -181,11 +182,12 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, } if (status == PCI_ERS_RESULT_NEED_RESET) { - /* - * TODO: Should call platform-specific - * functions to reset slot before calling - * drivers' slot_reset callbacks? - */ + ret = pci_reset_bus(dev); + if (ret < 0) { + pci_err(dev, "Failed to reset %d\n", ret); + status = PCI_ERS_RESULT_DISCONNECT; + goto failed; + } status = PCI_ERS_RESULT_RECOVERED; pci_dbg(dev, "broadcast slot_reset message\n"); pci_walk_bus(bus, report_slot_reset, &status); -- 2.17.1