Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp8747imm; Mon, 2 Jul 2018 06:50:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf42kuq0QwmXKPuE5DekG8loEQLKmium/L++jv23aGllbnq19NW69Ylz8r5/rk7qEmsKxFg X-Received: by 2002:a62:f04:: with SMTP id x4-v6mr15278164pfi.255.1530539454822; Mon, 02 Jul 2018 06:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530539454; cv=none; d=google.com; s=arc-20160816; b=phagT3DuNYVzspqMjBWXXKaiIot/4US0L7IZC8YkSbNHMcmKXY1jmvP4UOQaGBoid1 KHdy8x7g7LfpR9Rx65rZWNYmoZgAJy8Wss/ZVBWR/NbGQSfXEo2PQwHy3RbXbI1gAzTr Xyq5pHn1YjZmbc6cap98p+jjv6miAmOmjVkHP17z6YI1N6DQKikxklaRvBtVBlzEeuuZ ncWKYopPhX28J2ToyJLY+MoOx8c6hA18ER0rm/rwXz9iqhP+Kl31/wXNARb6nGhRQoT0 hPb9Btu/IkR5X4hKTNeFyAi/BG32wqlDgX79Es3rz3sgVyl/YrGMb1WE8MSXDrsIbNUO x79w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=WiAQ7VDmU61peVFWLRsz+/GxKinO9Nja+F+ssTwdal4=; b=aiOsIi3hcolCrhpnZVcaK7HI2Me9/LspZ+NJT+k4bVpJvAKYDPHvgC7wO+SjBBHuyD k//lslLpxoJ7v+rH1+NWwd+m9epkjb9xqxg/vawAqcbI13JaV0UhverF8OsgkMMqayjI +zWGvnrbFhIOXDkd1+zdjxYAgY5qVZoOPdRsAugC/91CjbGQhSte9kNSXQmU/DGpisGz uowgr/TEC0XPIOhAiUznWxMDNuga3B63WCZBdPHH6pbOkoU5vI7xrIaQJD/CEHym3KeH HrHPirNnZx+rgxG9jvgA9/okSkPxhn2pwX4paJYWOApC41KmTl3G+wmETBpOnBZwI4iL Qjqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rMM75r+o; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i4-v6si2320521pgl.435.2018.07.02.06.50.40; Mon, 02 Jul 2018 06:50:54 -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=@kernel.org header.s=default header.b=rMM75r+o; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752381AbeGBNuB (ORCPT + 99 others); Mon, 2 Jul 2018 09:50:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbeGBNt7 (ORCPT ); Mon, 2 Jul 2018 09:49:59 -0400 Received: from localhost (173-25-171-118.client.mchsi.com [173.25.171.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73C9625D8D; Mon, 2 Jul 2018 13:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530539398; bh=F05uWfQIsRNnbY+4wpaFAydpqoxZMhOCKqTa6VWH0Jc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rMM75r+o/yCJTQIsFaAKDbJD1BZ0JOgn1IeKf/2g8dXlIq4AxpOP60GbF1nd2pPrS 3iXWKFLYhzjW7azRwIjCWftiau1hKAq8emEe5rlNN3ZP8uiKEaF/eEL7oZVmfVkcJz HeVTy4o0NrQ/jqtsAjgXIklIw618pAs6isLQITls= Date: Mon, 2 Jul 2018 08:49:57 -0500 From: Bjorn Helgaas To: christian.koenig@amd.com Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] PCI: fix restoring resized BAR state on resume Message-ID: <20180702134957.GA43045@bhelgaas-glaptop.roam.corp.google.com> References: <20180614122146.62118-1-christian.koenig@amd.com> <20180630005718.GJ40928@bhelgaas-glaptop.roam.corp.google.com> <064ebaf7-8953-fd29-a688-26a5646111a0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <064ebaf7-8953-fd29-a688-26a5646111a0@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 02, 2018 at 03:20:59PM +0200, Christian K?nig wrote: > Am 30.06.2018 um 02:57 schrieb Bjorn Helgaas: > > On Thu, Jun 14, 2018 at 02:21:45PM +0200, Christian K?nig wrote: > > > Resize BARs after resume to the expected size again. > > > > > > Signed-off-by: Christian K?nig > > > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199959 > > > CC: stable@vger.kernel.org # v4.15+ > > I applied both of these to pci/resource for v4.19, thanks! It'd be nice to > > have them in v4.18, but since it's not a regression and the problem has > > been there since v4.15, I'm not sure I could justify it. > > Well it is a regression. The change to enable this in the upstream driver > was added in 4.16, but a good bunch of people also compile our backported > DKMS module. > > And now those people are complaining that the driver stopped working after > resume in 4.15 with the DKMS module and with 4.16 with the upstream module. > > Alternatively I can disable resizing from the driver from kernels older than > v4.19. Feel free to help justify including this in v4.18 by providing the details of the regression and the relevant commits. If this is something that worked in v4.17, and some commit we merged for v4.18-rc1 broke it, it would be a slam dunk to include the fix for v4.18. I took a quick look through the commits we added in v4.18-rc1 but didn't see anything obvious. Obviously, putting a fix in v4.18 doesn't help the people running v4.15 or v4.16. The stable backports *will* help with that, and we already have the tag for that. The current trajectory we're on is that these are headed for v4.19-rc1, and soon after they appear there, they will be backported to the v4.15-v4.18 stable kernels. Bjorn > > > --- > > > drivers/pci/pci.c | 28 ++++++++++++++++++++++++++++ > > > 1 file changed, 28 insertions(+) > > > > > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > > > index bd6f156dc3cf..d4685090378b 100644 > > > --- a/drivers/pci/pci.c > > > +++ b/drivers/pci/pci.c > > > @@ -1159,6 +1159,33 @@ static void pci_restore_config_space(struct pci_dev *pdev) > > > } > > > } > > > +static void pci_restore_rebar_state(struct pci_dev *pdev) > > > +{ > > > + unsigned int pos, nbars, i; > > > + u32 ctrl; > > > + > > > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); > > > + if (!pos) > > > + return; > > > + > > > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > > > + nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> > > > + PCI_REBAR_CTRL_NBAR_SHIFT; > > > + > > > + for (i = 0; i < nbars; i++, pos += 8) { > > > + struct resource *res; > > > + int bar_idx, size; > > > + > > > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > > > + bar_idx = ctrl & PCI_REBAR_CTRL_BAR_IDX; > > > + res = pdev->resource + bar_idx; > > > + size = order_base_2((resource_size(res) >> 20) | 1) - 1; > > > + ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE; > > > + ctrl |= size << 8; > > > + pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); > > > + } > > > +} > > > + > > > /** > > > * pci_restore_state - Restore the saved state of a PCI device > > > * @dev: - PCI device that we're dealing with > > > @@ -1174,6 +1201,7 @@ void pci_restore_state(struct pci_dev *dev) > > > pci_restore_pri_state(dev); > > > pci_restore_ats_state(dev); > > > pci_restore_vc_state(dev); > > > + pci_restore_rebar_state(dev); > > > pci_cleanup_aer_error_status_regs(dev); > > > -- > > > 2.14.1 > > > >