Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp884202pxb; Tue, 3 Nov 2020 15:30:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJVEoM9bAiw3R/KPXyEkcU2UXm2/RTi8unIaIa/tAPZQtiC21U9zzTeAe9B9R0T05iDOiA X-Received: by 2002:a17:906:a996:: with SMTP id jr22mr23079241ejb.463.1604446216311; Tue, 03 Nov 2020 15:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604446216; cv=none; d=google.com; s=arc-20160816; b=SR5uY7aAHpNZil+8k2nSeZbyb4eJCVxvgMWX3QPRQTNGRZ4kQFAsSMcD4tPiDs4aQy rX3Sc0npF7GzImyRokpsZnjUeA5kTGiFfYTiHYTC0WJ1LZF1fJUYP6l0uxnV2ePLrIui 7pD63ADmZwAIGHJBYSbtONAYlD1qfJVUVN9ofl+5L5apJMWBYZa8ZfrcOGMSqs9y+9oX F4F6WfxCr2n81EOuNm9WFcVv3P/y+Fns0wIAlRk0FUegUQQBkkYAE0rlVy36rt5TI3AG YW8u37mWRuID7Bob+gOFsKO9zYlEU0RE1PovwqVXfFxy1w4RxgDOmeAkqzwQp7p/iLDm Zcfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2BtKqohaVimYm3JYZpiBY5vH1S7B671OHmw6gVL2WBU=; b=PXWH3mvUUERsX0/WPcZ5KMG9UQjeRG7UBbLq9yx3AIDz6qRwoZusZDHNZjR4VX1078 sgjlO959rdN7MT94KscmFmd5lxZ+HsMnv7KcgZsa8ccwxc1dQLekdHHd2+9DNJOhi1qV Ds/EOSCKuv9Peft4MvU/C2o/lQzEecVb4PNZ52/VduVHymyPU7j7cfP/3yfqB7M4AkFK fP8vQ5+p9cB6560RsN4mDlwiTCDKqth1YVszKkJA+sjAoLjs5cl3PLkDvrhNtBVLfsJO FKauQHRALH8DAu4SNtWbba8dRhCaCAoI5cEYlnhdcC9aq2K8urnxU/Ca3sjtph61BOl0 w8Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dfV9c69g; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si76853edv.389.2020.11.03.15.29.53; Tue, 03 Nov 2020 15:30:16 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dfV9c69g; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729646AbgKCXIw (ORCPT + 99 others); Tue, 3 Nov 2020 18:08:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbgKCXIw (ORCPT ); Tue, 3 Nov 2020 18:08:52 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0352FC061A04 for ; Tue, 3 Nov 2020 15:08:51 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id z3so237960pfb.10 for ; Tue, 03 Nov 2020 15:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2BtKqohaVimYm3JYZpiBY5vH1S7B671OHmw6gVL2WBU=; b=dfV9c69glUI8cTJE5KxhYnSkdH5RZaIREIstIxf0GaULID2vdqdUTZZEZUs4GMwbvJ HXIUEDV03PzkuKmgMQy4uR1m75touThJ0HeVe1P9Fouo1bzjD9KC5pM4zi1WHlSpxxK9 D2ZLizjPUc182Kujje1Sp45hRvbmkJiJ752Yn6NG2LNzcGtXlsu6ABpzq/dkjqqkUWWn j0HmkeSdevzlxMoBAfQg2736qD1PwyzaSwY+S9XDwtk++dPAIkWrjMPesG/SwUqAUHRa uqkehrJYPr6+WTaNTXLWQerzGE1Z5ZCf7nL2K2UB+CH4hV20i403oeLSBxWbblach8bG XjvA== 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=2BtKqohaVimYm3JYZpiBY5vH1S7B671OHmw6gVL2WBU=; b=p2IBYHoE5/drLaGq+9r5j0zPnHgIOEDtFOkPZuURt313DoTo8foq7OMdTAuP90A1+R LpC1GwmdFy+l05RoRbTlbtxi36xKH+iorThxIFIHzvI0KUK+739HLDBmCea+Ivz0W3Ox dS9w6aIUIl+Td6sUrjM8U5P0Qte/SoSTmNwasaZpPfnh9dxoeoahwXh8BLFzk2zy1XIr DMZnBBy7B9fg6JQMvJ2Ha76yT/2QqpoD73+UVD5jP14uuDk3HVTKABoU26loAUmEVkZZ 4FOrz6sRDX/GVGo905q/0Ccub5e5N12dHopWPu/3shg973ji42jzDQmclUwn1XA2Fo7S zF/A== X-Gm-Message-State: AOAM533ffIo2sLm6TkOeDnRqWetqbSKcK9h/qcndUDw/A25NoFUA31vf hXIf62sjQvAeBhFD4m14Q+rfwA== X-Received: by 2002:aa7:8154:0:b029:156:4b89:8072 with SMTP id d20-20020aa781540000b02901564b898072mr28620817pfn.51.1604444931322; Tue, 03 Nov 2020 15:08:51 -0800 (PST) Received: from [10.212.88.145] ([134.134.137.79]) by smtp.gmail.com with ESMTPSA id 9sm173597pfp.102.2020.11.03.15.08.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 15:08:50 -0800 (PST) From: "Sean V Kelley" To: "Ethan Zhao" Cc: "Bjorn Helgaas" , Jonathan.Cameron@huawei.com, rafael.j.wysocki@intel.com, "Ashok Raj" , tony.luck@intel.com, "Sathyanarayanan Kuppuswamy" , qiuxu.zhuo@intel.com, linux-pci , "Linux Kernel Mailing List" Subject: Re: [PATCH] AER: aer_root_reset() non-native handling Date: Tue, 03 Nov 2020 15:08:48 -0800 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <20201030223443.165783-1-sean.v.kelley@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1 Nov 2020, at 22:27, Ethan Zhao wrote: > On Sat, Oct 31, 2020 at 6:36 AM Sean V Kelley = > wrote: >> >> If an OS has not been granted AER control via _OSC, then >> the OS should not make changes to PCI_ERR_ROOT_COMMAND and >> PCI_ERR_ROOT_STATUS related registers. Per section 4.5.1 of >> the System Firmware Intermediary (SFI) _OSC and DPC Updates >> ECN [1], this bit also covers these aspects of the PCI >> Express Advanced Error Reporting. Further, the handling of >> clear/enable of PCI_ERROR_ROOT_COMMAND when wrapped around >> PCI_ERR_ROOT_STATUS should have no effect and be removed. >> Based on the above and earlier discussion [2], make the >> following changes: >> >> Add a check for the native case (i.e., AER control via _OSC) >> Re-order and remove some of the handling: >> - clear PCI_ERR_ROOT_COMMAND ROOT_PORT_INTR_ON_MESG_MASK >> - do reset >> - clear PCI_ERR_ROOT_STATUS >> - enable PCI_ERR_ROOT_COMMAND ROOT_PORT_INTR_ON_MESG_MASK >> >> to this: >> >> - clear PCI_ERR_ROOT_STATUS >> - do reset >> >> The current "clear, reset, enable" order suggests that the reset >> might cause errors that we should ignore. But I am unable to find a >> reference and the clearing of PCI_ERR_ROOT_STATUS does not require = >> them. >> >> [1] System Firmware Intermediary (SFI) _OSC and DPC Updates ECN, Feb = >> 24, >> 2020, affecting PCI Firmware Specification, Rev. 3.2 >> https://members.pcisig.com/wg/PCI-SIG/document/14076 >> [2] = >> https://lore.kernel.org/linux-pci/20201020162820.GA370938@bjorn-Precis= ion-5520/ >> >> Signed-off-by: Sean V Kelley >> --- >> drivers/pci/pcie/aer.c | 21 ++++++--------------- >> 1 file changed, 6 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c >> index 65dff5f3457a..bbfb07842d89 100644 >> --- a/drivers/pci/pcie/aer.c >> +++ b/drivers/pci/pcie/aer.c >> @@ -1361,23 +1361,14 @@ static pci_ers_result_t aer_root_reset(struct = >> pci_dev *dev) >> u32 reg32; >> int rc; >> >> - >> - /* Disable Root's interrupt in response to error messages */ >> - pci_read_config_dword(dev, aer + PCI_ERR_ROOT_COMMAND, = >> ®32); >> - reg32 &=3D ~ROOT_PORT_INTR_ON_MESG_MASK; >> - pci_write_config_dword(dev, aer + PCI_ERR_ROOT_COMMAND, = >> reg32); > There may be some reasons to disable interrupt first and then do = > resetting, > clear status and re-enable interrupt. > Perhaps to avoid error noise, what would happen if the resetting > causes errors itself ? I don=E2=80=99t have the historical context, but in looking at pci_bus_re= set() = it=E2=80=99s clear that it will probe slots for reset capability and then= fall = back to secondary bus reset. It=E2=80=99s possible that an attempt to re= set a = slot could result in an error on some hardware. This would potentially = result in repeated error reporting. Not having the historical context, = it=E2=80=99s best to leave in the clear/re-enabling of the interrupt when= = performing the reset. Sean > > Thanks, > Ethan > >> + if (pcie_aer_is_native(dev)) { >> + /* Clear Root Error Status */ >> + pci_read_config_dword(dev, aer + PCI_ERR_ROOT_STATUS, = >> ®32); >> + pci_write_config_dword(dev, aer + = >> PCI_ERR_ROOT_STATUS, reg32); >> + } >> >> rc =3D pci_bus_error_reset(dev); >> - pci_info(dev, "Root Port link has been reset\n"); >> - >> - /* Clear Root Error Status */ >> - pci_read_config_dword(dev, aer + PCI_ERR_ROOT_STATUS, = >> ®32); >> - pci_write_config_dword(dev, aer + PCI_ERR_ROOT_STATUS, = >> reg32); >> - >> - /* Enable Root Port's interrupt in response to error messages = >> */ >> - pci_read_config_dword(dev, aer + PCI_ERR_ROOT_COMMAND, = >> ®32); >> - reg32 |=3D ROOT_PORT_INTR_ON_MESG_MASK; >> - pci_write_config_dword(dev, aer + PCI_ERR_ROOT_COMMAND, = >> reg32); >> + pci_info(dev, "Root Port link has been reset (%d)\n", rc); >> >> return rc ? PCI_ERS_RESULT_DISCONNECT : = >> PCI_ERS_RESULT_RECOVERED; >> } >> -- >> 2.29.2 >>