Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1733428imm; Wed, 1 Aug 2018 23:28:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbaS6MIWKNXWRB2ikxKT7OwO7XFI11IkRYGsE5oAORX0X00VvtrnHywMnbcOqZJbFJXjys X-Received: by 2002:a63:da56:: with SMTP id l22-v6mr1013393pgj.179.1533191293407; Wed, 01 Aug 2018 23:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533191293; cv=none; d=google.com; s=arc-20160816; b=WXOlNCjP+ob6Hi7q1WeiMggwa66yzPXHD5+CXTQn293V9DnZl61zAY35Uay2fcTxJL 8HgIvG5AnE4H6w4ICmjH+19qmtIKvI4BFXzvwgTV2LNamFM+3ZD8wsELvy5awhrHT5S9 mjP8mezVTHbLFYmtlXzDpdr2cPnWBo+wf5iDAfSu79cENotIwL2NRvkoiTqLh/zdMZTs DoVovyiZrowK9dTCP82ZTePIDCWAIi6ZTYqW0gy4Bln8ZT/y9FfBVNvjneCE0vFeqE8Q uh1kZbVPhDGatjQbWCXe0C+yhtrv47hcEanUdUZZ6kOT/RFSpo3ipSulfo8AFTOfwuRE bkXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=Bv1kPYc1sHAvYJzmsSB4FhqYC6vDqKTFjWoXJB9IZFE=; b=u0WmiO8THYwluEZzcMMhKlN4XaoI0t4o/GxAJfu7W4HcHTNsJhyy9aI56Bi7KlK1py WV1icirWPsPE8TsfXcrHJV1/w3z/YYxUdjyxcfbwNSWvx3I4ju1sKYlUR5yVt+fjP7H1 DaCdJbg0w6gaPev35ForxCkJrC97msOjSJ+y40PrNAhIeurHc06mfJ9UStMS84iDFw85 IzLZaMI4I6vPbVrI5lg16WN6FUayJ6BKTime2cGz3dtumljxGdczuhrVqSWTpjX6vw+Q yu6DojNQpIR33T0B7aUa5z9ZBdJRLkcCshswhDhCJOmFCLmPdA9XRim6tV4MiZy83+u8 vzPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oXZKvcsS; dkim=pass header.i=@codeaurora.org header.s=default header.b=ESWloTgI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14-v6si803533plp.112.2018.08.01.23.27.58; Wed, 01 Aug 2018 23:28:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oXZKvcsS; dkim=pass header.i=@codeaurora.org header.s=default header.b=ESWloTgI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbeHBIQS (ORCPT + 99 others); Thu, 2 Aug 2018 04:16:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57766 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbeHBIQS (ORCPT ); Thu, 2 Aug 2018 04:16:18 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A52196035F; Thu, 2 Aug 2018 06:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533191201; bh=Xg/uXoKvrHcZja9r1hixG2flo37HM6vyZ3UPvKp8SCw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oXZKvcsSfZY1vgaNb6kMOjXNCS/hKzTnf1PwrKtpF8Ujvz6p2bOWBY7pH+T3VEvs4 IKPJIg8kwXaF5FUnEmpvYCQOsgj0cXIghv1XOqieQ+rWl2k3o59fExLrAdKghs2N/d sm/wMspYqiZ/GdzH7T827yt6UtgtLsk0bw2qcDek= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 862566035F; Thu, 2 Aug 2018 06:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533191200; bh=Xg/uXoKvrHcZja9r1hixG2flo37HM6vyZ3UPvKp8SCw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ESWloTgIE0X+27dbwtdXz5p9lvNMKc4BiGDSv2WCIr6dRD29UtRPvtp9x9J6VxgjG bB2UgGJYHoTL8zoK28+vRNj/yQjJ2eDWr8KD6T6U1H6MSsNuS7lJJbTAnhEy0YFKjt K3IvaGHKmocrPUv7Sd4ZTkZRlFi23/ipPP1403lA= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 02 Aug 2018 11:56:40 +0530 From: poza@codeaurora.org To: Bjorn Helgaas Cc: Bharat Kumar Gogada , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, linux-pci-owner@vger.kernel.org Subject: Re: [PATCH] PCI/AER: Enable SERR# forwarding in non ACPI flow In-Reply-To: <6a1266c49a5be0d598dd7f1ded94e93d@codeaurora.org> References: <1531406719-18606-1-git-send-email-bharat.kumar.gogada@xilinx.com> <20180731224706.GO45322@bhelgaas-glaptop.roam.corp.google.com> <6a1266c49a5be0d598dd7f1ded94e93d@codeaurora.org> Message-ID: X-Sender: poza@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-08-02 11:53, poza@codeaurora.org wrote: > On 2018-08-01 04:17, Bjorn Helgaas wrote: >> On Thu, Jul 12, 2018 at 08:15:19PM +0530, Bharat Kumar Gogada wrote: >>> Currently PCI_BRIDGE_CTL_SERR is being enabled only in >>> ACPI flow. >>> This bit is required for forwarding errors reported >>> by EP devices to upstream device. >>> This patch enables SERR# for Type-1 PCI device. >> >> This does seem broken. >> >> Figure 6-3 in PCIe r4.0, sec 6.2.6, would be a helpful reference to >> include in the commit log. >> >> Semi-related question: there are about 40 drivers that call >> pci_enable_pcie_error_reporting() and >> pci_disable_pcie_error_reporting(). I see that the PCI core >> calls pci_enable_pcie_error_reporting() for Root Ports and Switch >> Ports in this path: >> >> aer_probe # for root ports only >> aer_enable_rootport >> set_downstream_devices_error_reporting >> set_device_error_reporting >> if (ROOT_PORT || UPSTREAM || DOWNSTREAM) >> pci_enable_pcie_error_reporting >> pci_walk_bus(..., set_device_error_reporting) >> >> But the core doesn't call pci_enable_pcie_error_reporting() for >> endpoints. I wonder why not. Could we? And then remove the calls >> from those drivers? If PCI_EXP_AER_FLAGS should only be set if the >> driver is prepared, the pci_driver.err_handler would be a good hint. >> But I suspect we could do something sensible and at least report >> errors even if the driver doesn't have err_handler callbacks. >> > > what about hot-plug case ? > should not aer_init() call pci_enable_pcie_error_reporting() for all > the downstream pci_dev ? > and remove all the calls from drivers.. > aer_init will be called for each device (pci_dev) while pciehp does re-enumeration. so probable we might want to call pci_enable_pcie_error_reporting() but that dictates the design where AER framework is taking decision to enable error reporting on behalf of drivers as well. but thats fine I think, if drivers do not want to participate then they have to call pci_disable_pcie_error_reporting explicitly. does this make sense ? >> On MIPS Octeon, it looks like pcibios_plat_dev_init() does already set >> PCI_EXP_AER_FLAGS for every device. >> >> But this question is obviously far beyond the scope of this current >> patch. >> >>> Signed-off-by: Bharat Kumar Gogada >>> --- >>> drivers/pci/pcie/aer.c | 23 +++++++++++++++++++++++ >>> 1 files changed, 23 insertions(+), 0 deletions(-) >>> >>> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c >>> index a2e8838..943e084 100644 >>> --- a/drivers/pci/pcie/aer.c >>> +++ b/drivers/pci/pcie/aer.c >>> @@ -343,6 +343,19 @@ int pci_enable_pcie_error_reporting(struct >>> pci_dev *dev) >>> if (!dev->aer_cap) >>> return -EIO; >>> >>> + if (!IS_ENABLED(CONFIG_ACPI) && >>> + dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { >> >> I think this test needs to be refined a little bit. If the kernel >> happens to be built with CONFIG_ACPI=y but the current platform >> doesn't support ACPI, we still want to set PCI_BRIDGE_CTL_SERR, >> don't we? >> >>> + u16 control; >>> + >>> + /* >>> + * A Type-1 PCI bridge will not forward ERR_ messages coming >>> + * from an endpoint if SERR# forwarding is not enabled. >>> + */ >>> + pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &control); >>> + control |= PCI_BRIDGE_CTL_SERR; >>> + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, control); >>> + } >>> + >>> return pcie_capability_set_word(dev, PCI_EXP_DEVCTL, >>> PCI_EXP_AER_FLAGS); >>> } >>> EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); >>> @@ -352,6 +365,16 @@ int pci_disable_pcie_error_reporting(struct >>> pci_dev *dev) >>> if (pcie_aer_get_firmware_first(dev)) >>> return -EIO; >>> >>> + if (!IS_ENABLED(CONFIG_ACPI) && >>> + dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { >>> + u16 control; >>> + >>> + /* Clear SERR Forwarding */ >>> + pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &control); >>> + control &= ~PCI_BRIDGE_CTL_SERR; >>> + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, control); >>> + } >>> + >>> return pcie_capability_clear_word(dev, PCI_EXP_DEVCTL, >>> PCI_EXP_AER_FLAGS); >>> } >>> -- >>> 1.7.1 >>>