Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4052695imw; Thu, 7 Jul 2022 11:54:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1prhgiBcCr9nSK08W4sGSKybXD+SxSaRhgl/9sEFY7Ol6rccEWI67q6N499rMYOzstUl8 X-Received: by 2002:a05:6a00:b8b:b0:51b:eefc:7fd2 with SMTP id g11-20020a056a000b8b00b0051beefc7fd2mr53296585pfj.74.1657220079917; Thu, 07 Jul 2022 11:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657220079; cv=none; d=google.com; s=arc-20160816; b=OcMsWEowutIkgQNvrQwUJGzc0AX3zPXgwNDLahQZI426hwt9fJEEVqzOMOqtBHR3i6 ZO0TBe81HBXcEQQE5vg8LjP1t7OUqlgAfNDCTQ846HeBMrwrIk7H01TgRIVaSMudB3n7 j0QD2c+41DQjILLQuoJTQ14w/3amz7mtgSlQOBufddOj8YasOTbQxmuAYJNCq3npXVVV fSKzcpH3q0SnpzuWwvPi7/KBmk9p0ZufCYjD7sLg3JuIC/jDy4sZUXF1/xUxjHEt6t8K 7IjSSptZ2YYRMV7Jd/ku+RySRgv3C8RI1YGnCvCex/Bz7F4YoyvnZAMjZfSMbUMyeHIP 6YIA== 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=TifmE1HEl56S1YpPiai/weo9z8davOP03Mm+nvK33w0=; b=Qtd1TjX0sRNmF/Vq5CvzeHp3AwYxKZZ3PV2hXu6TIUqr6DYwEfH027c+/pGHmHEmhp sfaJCvr4tqDRvjydFFZXa4r2TX7y1oSEhUEyKayvCMJ8WYnAcxretKB5pTQHHVMx1E0L vbGT8rrSXNOwLuMmEhkHUkiPPOfSZdy6+XkSoUWzRfEIDdRVBa7yDyBeGVCdC0RNHTRw 5ih7j324DS86TZ812D0pApJYh1dXKA6/jj+CYachYHJEN/Lx00CT3hSFZWbuoUhMR7IK ZPDlWl9WJImCkQO1r4Dq586lnIQd19afjQW+xawavtdyALQp1bqe4iUFYVjKEHRnBhb2 4BXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a128-20020a636686000000b003c62121f239si52067712pgc.808.2022.07.07.11.54.28; Thu, 07 Jul 2022 11:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236399AbiGGS1n (ORCPT + 99 others); Thu, 7 Jul 2022 14:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236349AbiGGS1f (ORCPT ); Thu, 7 Jul 2022 14:27:35 -0400 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A0C5A449; Thu, 7 Jul 2022 11:27:34 -0700 (PDT) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-2ef5380669cso178364897b3.9; Thu, 07 Jul 2022 11:27:34 -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=TifmE1HEl56S1YpPiai/weo9z8davOP03Mm+nvK33w0=; b=HoTi7lBuHulMxExt8/BO4GExS7PRonz8jEbbAKvg37ZP/YdC3e/2sDIgpY90/zgfMe 7Y7WW8EBX3NffDKzvalChaVKHhRMvrcCin6CFBogBuTChclA4/tYMdSZdLg9s7JsP6Yj 0xZnkT6dckig778Sw4nDK7UJGotJ4zD/m9hPjgeHHGWiROPtyjfjxUuvaIHnq7v5ga2o ys8jk0FxrZlB3A/38/Nn13QQRyzo4XtbyeAjTHYrPoHWS4Ik83FbFToVwZ1AtHTJhRsM 25ZOV7l1KZOD/4IM7twNMMyGWDvwOSclNWGaKLjvmRhir5iVobQ+Pa6cXH28ioTXu08R iRfw== X-Gm-Message-State: AJIora/yNqV0kPgFFWHDOL4ofC9mqz+WcPAnDV1azkP2mQhMefVxnGPa aGXB0jHMCqpFIp1c4nQ1BRXsvr6YxCk+QwyRk/k= X-Received: by 2002:a81:1b97:0:b0:2db:640f:49d8 with SMTP id b145-20020a811b97000000b002db640f49d8mr52740543ywb.326.1657218453124; Thu, 07 Jul 2022 11:27:33 -0700 (PDT) MIME-Version: 1.0 References: <20220707172205.3205110-1-rajvi.jingar@linux.intel.com> <20220707172205.3205110-2-rajvi.jingar@linux.intel.com> In-Reply-To: <20220707172205.3205110-2-rajvi.jingar@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 7 Jul 2022 20:27:22 +0200 Message-ID: Subject: Re: [PATCH 2/2] PCI/PTM: fix in pci_disable_ptm() To: Rajvi Jingar Cc: Rafael Wysocki , Bjorn Helgaas , David Box , Linux PCI , Linux Kernel Mailing List , Linux PM Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 7, 2022 at 7:22 PM Rajvi Jingar wrote: > > Set ptm_enabled from 'struct pci_dev' to 0 in pci_ptm_disable() to I would set "Clear" here instead of "Set", but moreover -> > save the disabled PTM state for the device. > > Fixes: a697f072f5da ("PCI: Disable PTM during suspend to save power") > Signed-off-by: Rajvi Jingar > --- > drivers/pci/pcie/ptm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c > index 368a254e3124..746e29779c27 100644 > --- a/drivers/pci/pcie/ptm.c > +++ b/drivers/pci/pcie/ptm.c > @@ -44,6 +44,7 @@ void pci_disable_ptm(struct pci_dev *dev) > pci_read_config_word(dev, ptm + PCI_PTM_CTRL, &ctrl); > ctrl &= ~(PCI_PTM_CTRL_ENABLE | PCI_PTM_CTRL_ROOT); > pci_write_config_word(dev, ptm + PCI_PTM_CTRL, ctrl); > + dev->ptm_enabled = 0; -> I don't think that this is going to work without setting dev->ptm_enabled in pci_restore_ptm_state() if the restored state turns out to be "enabled". > } > > void pci_save_ptm_state(struct pci_dev *dev) > --