Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1559045pxb; Wed, 20 Oct 2021 07:27:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5IArMdXTQMYUgubtxcKCykaB9Da+UPE9rP6QSSsOp34pcXY1cpFQ8ZusIIudmorQnxuCZ X-Received: by 2002:a63:b203:: with SMTP id x3mr236387pge.239.1634740066267; Wed, 20 Oct 2021 07:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634740066; cv=none; d=google.com; s=arc-20160816; b=c/vSOLo5Az+nkLaa6ZXlLqEhCDTECUER6/JIQB4iPRKWpaKeJb8XYk/x08AZs9uf1Q Z+4blY3UeD7GNLZleaZcoA8RmZhA8q0viJHDZxTWkxFGsVWbWJn+tOYPe8btXxmeAuOu pkf5QZFPQYOL2fGMn5Ztlv9krunzv8M9d6d13tj3ydioCk9wC0rpXKAuEYUgiwfnwrgq UnpjGvEAxjT8nS+oTxkyNQ8TZovNUgiqxeTbb7oJabfbYI+UUrNmmwlo4vRjLnhr7aKQ i4YBIxx5dMIQB3a7WYkk0SPcxy3KNkbDDmQSZjtS2X1gWjzC/eVHkHxA+ocvzdRxdMR+ e5Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=oi4ZFYcM9sTBRBMXr9cttcAIxQGx+R9lkntd5NyWgkk=; b=l5sOho7MPx5AOtdl/0+IPp7cRNn0qC5mixUvYzUvfoEzfGIcM1Fg9ZQx4fpa/jR9PR 2mSWjcXgnWjZEhYDEZioWs02KlQFPFh7cWZnRoxdTtfa/6KyQDf09RcKaYji5bPN/b7C dP6yeTQxYPM1pO6aevyqhwrd8JoF2SFciqF6EbpA3Ycow0cbByh+FTxCkHayHMkEQReI 5MQ1RvYLKwZGjIVyq0zZGEv0gJpBN3tmb+n+bWJuaskexyMV+jmVupWUsSNI9sJEcKzl zel9umGWvrbkNU6yDBNjUV7n+xsqgebpRTQsWSFpPcIB36pW7n5a4CIzfBiGtBccSfKS 2j2w== ARC-Authentication-Results: i=1; mx.google.com; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si3135842plc.144.2021.10.20.07.27.31; Wed, 20 Oct 2021 07:27:46 -0700 (PDT) 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; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbhJTO0d (ORCPT + 99 others); Wed, 20 Oct 2021 10:26:33 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:37526 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbhJTO0c (ORCPT ); Wed, 20 Oct 2021 10:26:32 -0400 Received: by mail-ot1-f48.google.com with SMTP id b4-20020a9d7544000000b00552ab826e3aso6467245otl.4; Wed, 20 Oct 2021 07:24:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oi4ZFYcM9sTBRBMXr9cttcAIxQGx+R9lkntd5NyWgkk=; b=YPXNzh3B2boEoGjL4RbGycPCvV+i1fM2GS1x6T/4yzGD8JSSCZ2XEhSOe1p8bNeh1K SAfZ5BuPHgfDayI3XTsPPls8avwjofpO6Ih1RtzlMoSVTUfvc7psCdu01SwrUp6UCzEB R5UiaJE8SDy5GswiBl91LbN+/1N+Q/v7ryuvaWS75gJcG0UmNiMkYSPwiG8lXIxwIGld XVwEvlBl4ZVz5q6B+UCTcFMIu6DaUkCEJxfQY2x8OS72IdF+eobuTu7tAMQlQnSQQtlv vORrD0eh2vHf0QwACP/ziW2K/ULdojZ4WqmOqY8HfMtMdi582F1XvE+tGDW4BiqS5AoP 5wbw== X-Gm-Message-State: AOAM531TX1dym/kH9lA8GoOSOCCwosfEeq93uu23h157C6D13XMCJQLt 9mVirFv/XkDE/BnyboJ3fQGHkuL77/nPA+weowDNLjR9 X-Received: by 2002:a05:6830:1af0:: with SMTP id c16mr170775otd.16.1634739857674; Wed, 20 Oct 2021 07:24:17 -0700 (PDT) MIME-Version: 1.0 References: <11844217.O9o76ZdvQC@kreacher> In-Reply-To: <11844217.O9o76ZdvQC@kreacher> From: "Rafael J. Wysocki" Date: Wed, 20 Oct 2021 16:24:06 +0200 Message-ID: Subject: Re: [PATCH] PCI: PM: Fix ordering of operations in pci_back_from_sleep() To: "Rafael J. Wysocki" Cc: Linux PCI , Linux PM , LKML , Bjorn Helgaas , Mika Westerberg Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 15, 2021 at 6:46 PM Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > The ordering of operations in pci_back_from_sleep() is incorrect, > because the device may be in D3cold when it runs and pci_enable_wake() > needs to access the device's configuration space which cannot be > done in D3cold. > > Fix this by calling pci_set_power_state() to put the device into D0 > before calling pci_enable_wake() for it. > > Signed-off-by: Rafael J. Wysocki If there are no concerns about this one, I will queue it up for 5.16. > --- > drivers/pci/pci.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > Index: linux-pm/drivers/pci/pci.c > =================================================================== > --- linux-pm.orig/drivers/pci/pci.c > +++ linux-pm/drivers/pci/pci.c > @@ -2638,8 +2638,13 @@ EXPORT_SYMBOL(pci_prepare_to_sleep); > */ > int pci_back_from_sleep(struct pci_dev *dev) > { > + int ret = pci_set_power_state(dev, PCI_D0); > + > + if (ret) > + return ret; > + > pci_enable_wake(dev, PCI_D0, false); > - return pci_set_power_state(dev, PCI_D0); > + return 0; > } > EXPORT_SYMBOL(pci_back_from_sleep); > > > >