Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7239720ybh; Thu, 8 Aug 2019 12:20:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA7i/gSTs9eXysqqXK1qSVvaAkR5SgcaYG0QhpbCV/LuK5CQebzQL2IXFLs0cAQWmyV1bk X-Received: by 2002:a62:1750:: with SMTP id 77mr17374311pfx.172.1565292008252; Thu, 08 Aug 2019 12:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565292008; cv=none; d=google.com; s=arc-20160816; b=sXsQxE8hxxgCjC2AUt+L54stYUOySwkMH8Ust2kcPEkjJZ5nv+hQMfBst5DqsdTi5T FCgZQXMvUTlq7fFiUMDritnb381hSSU9Ku4Hawd1MxvMcV5J3++uJsaHr1WGSL/EdDYL rFCwt/KXZr9ciArbVoZRzlyhf6721JEudKt8uk7NAUx8HGkLvirZ5/ecwNcELrX9j8/q GnkK780AkapFjdxrIcignLLHehiYb/dcj+8WeDqou5lvHMCr+nzY2reo7anduVex+GXD Ccd8RE/fff7jsaX5bbPvljKtsVKBEXWyoGk2epD3FvZOdaBj9+728fMjGbz7SJ9z5CoM /5jA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JldOoK4AAaEBlNnrVesttUhwqWzUEUOncOwJJPHqMSg=; b=NXHy+Uyc4IN+QkJXQKKgES2BgHyuhiVAJvdj2Rv3MMfU9ZIsLMq9y0u+/LUGGv3cgO /xh/fhBMsk2Jc0MkfWtGDgRCscdkdxxuOikHPMtu0fZsUNGtGcVD4AFWj8ZEUES5Mo+Q 5L0mw7YRVE40D4/XJcxjG0E/U3KPlgP5z7W6h18yxa1RXM72gXFQzzOwhjnxWp6Z3eWF t5qL+WjJHbaI/BWyi5VAAyPMIwPTbcbTTmQcVAQTibeU2ZM3M4clxHKU0rXAdKRpf/7G Od+OMYKgX10r8oobp+NvZYV/NB51LSrqMGdbcPoAjXSv/y1q/ujqpxM2hbecBL0yy9D+ FNLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="vpDboZe/"; 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 q13si2619543pjb.13.2019.08.08.12.19.52; Thu, 08 Aug 2019 12:20:08 -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="vpDboZe/"; 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 S2404376AbfHHTTQ (ORCPT + 99 others); Thu, 8 Aug 2019 15:19:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404214AbfHHTTP (ORCPT ); Thu, 8 Aug 2019 15:19:15 -0400 Received: from localhost (unknown [150.199.191.185]) (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 BC811214C6; Thu, 8 Aug 2019 19:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565291955; bh=I85MDT/rKbkFPix7KBGWUeZg9LoqJU6dSIlhS3m8a5g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vpDboZe/vRDL5+uvHLu9w2zQuVsD051Exm+FqXk436rp7K5xoYjKyulcfTeuL8yjC sEIg4r0zhQrZhCELdFKxA94tDML8MTm3kLCdhxj9kNz5nYgIwfXikWQBhFLPNv//U7 vpQfbZpj3jEk3bfxfpq1LoEehzSSIGbZ7u5v0fPw= Date: Thu, 8 Aug 2019 14:19:13 -0500 From: Bjorn Helgaas To: Dexuan Cui Cc: "lorenzo.pieralisi@arm.com" , "linux-pci@vger.kernel.org" , Michael Kelley , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "driverdev-devel@linuxdriverproject.org" , Sasha Levin , Haiyang Zhang , KY Srinivasan , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" , vkuznets , "marcelo.cerri@canonical.com" , Stephen Hemminger , "jackm@mellanox.com" Subject: Re: [PATCH] PCI: PM: Also move to D0 before calling pci_legacy_resume_early() Message-ID: <20190808191913.GI151852@google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 08, 2019 at 06:46:51PM +0000, Dexuan Cui wrote: > > In pci_legacy_suspend_late(), the device state is moved to PCI_UNKNOWN. > In pci_pm_thaw_noirq(), the state is supposed to be moved back to PCI_D0, > but the current code misses the pci_legacy_resume_early() path, so the > state remains in PCI_UNKNOWN in that path, and during hiberantion this > causes an error for the Mellanox VF driver, which fails to enable > MSI-X: pci_msi_supported() is false due to dev->current_state != PCI_D0: s/hiberantion/hibernation/ Actually, it sounds more like "during *resume*, this causes an error", so maybe you want s/hiberantion/resume/ instead? > mlx4_core a6d1:00:02.0: Detected virtual function - running in slave mode > mlx4_core a6d1:00:02.0: Sending reset > mlx4_core a6d1:00:02.0: Sending vhcr0 > mlx4_core a6d1:00:02.0: HCA minimum page size:512 > mlx4_core a6d1:00:02.0: Timestamping is not supported in slave mode > mlx4_core a6d1:00:02.0: INTx is not supported in multi-function mode, aborting > PM: dpm_run_callback(): pci_pm_thaw+0x0/0xd7 returns -95 > PM: Device a6d1:00:02.0 failed to thaw: error -95 > > Signed-off-by: Dexuan Cui > --- > drivers/pci/pci-driver.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index 36dbe960306b..27dfc68db9e7 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -1074,15 +1074,16 @@ static int pci_pm_thaw_noirq(struct device *dev) > return error; > } > > - if (pci_has_legacy_pm_support(pci_dev)) > - return pci_legacy_resume_early(dev); > - > /* > * pci_restore_state() requires the device to be in D0 (because of MSI > * restoration among other things), so force it into D0 in case the > * driver's "freeze" callbacks put it into a low-power state directly. > */ > pci_set_power_state(pci_dev, PCI_D0); > + > + if (pci_has_legacy_pm_support(pci_dev)) > + return pci_legacy_resume_early(dev); > + > pci_restore_state(pci_dev); > > if (drv && drv->pm && drv->pm->thaw_noirq) > -- > 2.19.1 >