Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1389451imm; Tue, 3 Jul 2018 10:14:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKtKG4acrmiGZsNVkIJzXnuFE6gs24NOyH0C7Nrz3k+D0wPXmIoREK7Yq66E8HQQtFMfFZr X-Received: by 2002:a17:902:583:: with SMTP id f3-v6mr31006887plf.115.1530638066836; Tue, 03 Jul 2018 10:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530638066; cv=none; d=google.com; s=arc-20160816; b=QndxmW/Irel36cO4pakwNRSFTji7RyOixrW3BPFCWaV5TVJVsCxtKAOuW3aAfZs9p5 E/CucnfcurfG3J1Vy2mmq+kc9kONiyH6xcHy/PSxWY3+hffW2SZeqp0CoTwV9Gymd/CL GywfObDQ01lYCzntaHd1wjCjWhC5eXwNkNCcyMZ1BJDkS+wbmI1G1ZDtVXkxTdmeKip2 u1BeNf/bfj3uCINIMXfd2qM9GO+5g1hvBLpgWFq130QI6N9vgn5X12HxKncAjGF+DcTh I2enPCajLzkowXKWn44jVutuoCKZloQIL7seI/Gqy0CkYuqmtS70JYPDMUZgtLUwBeBS CGxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Uh71ulaA1LfzeXhOY5/Hx+a+R02bnZVW6b4dA7lhlRk=; b=k0x1wiXhDo6Ec1jHPw3IdKu4ye/HuxKSgfM8Qkn7UGelfmWkILvvQGgT/sCZ5WMmzn PrOlFCTm2L6imCaJiaa0SGY/gxeraC40jFg/fasOc0pm2xmPOoGDFMbI58NaSidxgB47 4Bw33jnAVNHDPE30nSDKXNhowZRU7X2TEDegfZLABrLE2mspoeKxOZTlNuO0wFp3zcNh M4VS9j/3OFAU9iXYGFL17GtVwsCbnPlN7LW1tVZCOvS1+BLYMTglaFtW4XSSK2ciqccM YvHB7hlsFSwja7gj/7yoTWiZy7POnSCMZo9+zK/rGqwpJ8YdQS574lmjZ0XELd7iKON1 HADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jcaSif9M; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w25-v6si1484953pga.58.2018.07.03.10.14.12; Tue, 03 Jul 2018 10:14:26 -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=@gmail.com header.s=20161025 header.b=jcaSif9M; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934194AbeGCRNY (ORCPT + 99 others); Tue, 3 Jul 2018 13:13:24 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:46698 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933568AbeGCRNW (ORCPT ); Tue, 3 Jul 2018 13:13:22 -0400 Received: by mail-oi0-f68.google.com with SMTP id y207-v6so5286639oie.13; Tue, 03 Jul 2018 10:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Uh71ulaA1LfzeXhOY5/Hx+a+R02bnZVW6b4dA7lhlRk=; b=jcaSif9M5qhueJZdM6P7k0fycicYY41ZuFalRXrnb8j77phGodAq7HAhsF+IMfSdCx mfI1kJ8Uv16Xj3JHbWUQVq8xzMOXIQDZHKArZSNaij1/urXbELrg+IFITAVAZHxJYSs4 6uxKweQ+9+rP5eNOBoXgnH1Ke6Bz81gxRc8YLGGkHsdfrVovxpV2woidrQTKL4KzqGnO K6DpyX2G4mMsl75c1WYk/K0me3FIL/KEqv6p/14frG3qJdH68WVxCG6YW3F31YU4IMxL jKDxIy1oaPYJ2Y+tShm59UiDWjXSGZl5oh3P1eQXKqxlbC4SFCcHZqyP2UKvYDjLQDEu hG+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Uh71ulaA1LfzeXhOY5/Hx+a+R02bnZVW6b4dA7lhlRk=; b=UmkEIXlJyMjsyzpXcnru5YH9juGRm7QUvWv6z9UmcNaP9WzsbFUfh7y4c0yIOA2fE1 wBoMiskQcuUiDrengmXUEMphJRlViGxF+dKSV73f/E3fQQF1XcOPQYMPT0gWYqMaBJaA JmE+k6zsB94QHZLgnVVZpLSz1yFjUIraem/M9yvGIDCY++kLABxnxIPeSXcFpExWfBZ3 2GTU6Rli854mdppMKd4xGh1ofCqlqazb3Wn28Oz0mDHuDmSu9Bh1mdVDChhhkNvxkyMt K4aTFzisABPRPXGwiCwz+ohkpga9pL/cDz1m9ehxC4Z6hins7Ni9oemXwOZ2Co3JRnkp BRJQ== X-Gm-Message-State: APt69E3DCAevVyBQWOcT15qn0CXWyP1V0B2cVPlKKXpst0+SVzvqV3uN 0m2HycCi5plRdFkSmcP1KDk3Ny9Z1x4= X-Received: by 2002:aca:6655:: with SMTP id a82-v6mr15653985oic.228.1530638001725; Tue, 03 Jul 2018 10:13:21 -0700 (PDT) Received: from nuclearis2_1.gtech (c-98-201-114-184.hsd1.tx.comcast.net. [98.201.114.184]) by smtp.gmail.com with ESMTPSA id 93-v6sm353953otc.27.2018.07.03.10.13.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 10:13:20 -0700 (PDT) Subject: Re: [PATCH v3] PCI/AER: Fix aerdrv loading with "pcie_ports=native" parameter To: Bjorn Helgaas Cc: bhelgaas@google.com, keith.busch@intel.com, alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, Frederick Lawler , Oza Pawandeep , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180702131923.GB15983@bhelgaas-glaptop.roam.corp.google.com> <20180702161611.2048-1-mr.nuke.me@gmail.com> <20180703163854.GA61685@bhelgaas-glaptop.roam.corp.google.com> From: "Alex G." Message-ID: <77bd7f4b-adf6-15f8-e506-61fe934c4493@gmail.com> Date: Tue, 3 Jul 2018 12:13:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180703163854.GA61685@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/2018 11:38 AM, Bjorn Helgaas wrote: > On Mon, Jul 02, 2018 at 11:16:01AM -0500, Alexandru Gagniuc wrote: >> According to the documentation, "pcie_ports=native", linux should use >> native AER and DPC services. While that is true for the _OSC method >> parsing, this is not the only place that is checked. Should the HEST >> table list PCIe ports as firmware-first, linux will not use native >> services. >> >> This happens because aer_acpi_firmware_first() doesn't take >> 'pcie_ports' into account. This is wrong. DPC uses the same logic when >> it decides whether to load or not, so fixing this also fixes DPC not >> loading. >> >> Signed-off-by: Alexandru Gagniuc >> --- >> drivers/pci/pcie/aer.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c >> index a2e88386af28..db2c01056dc7 100644 >> --- a/drivers/pci/pcie/aer.c >> +++ b/drivers/pci/pcie/aer.c >> @@ -283,13 +283,14 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) >> >> static void aer_set_firmware_first(struct pci_dev *pci_dev) >> { >> - int rc; >> + int rc = 0; >> struct aer_hest_parse_info info = { >> .pci_dev = pci_dev, >> .firmware_first = 0, >> }; >> >> - rc = apei_hest_parse(aer_hest_parse, &info); >> + if (!pcie_ports_native) >> + rc = apei_hest_parse(aer_hest_parse, &info); >> >> if (rc) >> pci_dev->__aer_firmware_first = 0; >> @@ -324,7 +325,9 @@ bool aer_acpi_firmware_first(void) >> }; >> >> if (!parsed) { >> - apei_hest_parse(aer_hest_parse, &info); >> + if (!pcie_ports_native) >> + apei_hest_parse(aer_hest_parse, &info); >> + >> aer_firmware_first = info.firmware_first; >> parsed = true; >> } > > I was thinking something along the lines of the patch below, so we > don't have to work through the settings of "rc" and "info". But maybe > I'm missing something subtle? > > One subtle thing that I didn't look into is the > pcie_aer_get_firmware_first() stub for the non-CONFIG_ACPI_APEI case. > > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index b24f2d252180..5ccbd7635f33 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -342,6 +342,9 @@ int pcie_aer_get_firmware_first(struct pci_dev *dev) > if (!pci_is_pcie(dev)) > return 0; > > + if (pcie_ports_native) > + return 0; > + Here we're not setting dev->__aer_firmware_first_valid. Assuming we only check for it via pcie_aer_get_firmware_first(), we should be fine. THis field is used in portdrv.h, but its use seems safe. I think this approach can work. > if (!dev->__aer_firmware_first_valid) > aer_set_firmware_first(dev); > return dev->__aer_firmware_first; > @@ -362,6 +365,9 @@ bool aer_acpi_firmware_first(void) > .firmware_first = 0, > }; > > + if (pcie_ports_native) > + return false; > + This makes better sense. > if (!parsed) { > apei_hest_parse(aer_hest_parse, &info); > aer_firmware_first = info.firmware_first; >