Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4049394imw; Thu, 7 Jul 2022 11:50:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s2FmoiwLF4Y+DO/skwO0nkI7uFQGwj5QombSQW9ofeQtFlodvWG/HJOYnQpkvGKEJpKtj6 X-Received: by 2002:a17:90b:1a8c:b0:1ef:c1b2:b2cd with SMTP id ng12-20020a17090b1a8c00b001efc1b2b2cdmr6825467pjb.190.1657219827613; Thu, 07 Jul 2022 11:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657219827; cv=none; d=google.com; s=arc-20160816; b=Pko4GLUX6xkBPQ0cuUgmU13oIV8MElpO6YeQcavYCaCN2w8to8QRsVwaGpzyXLM/Oz GePMvD0lF8dhi6cfJeju5i9WBAMoZzsNRginJXGAlqJbhb/G3FOAmu8Bs/KAQlK7uO4B WnGoRG4M+qR8Da1ZIyr0KQQMdBBAqcxQT86V8g+NlAc/aSkxb+dznsMvA5IjQlqr6P7a wZ5sy1D8gvCqsMR25iV0TfvSlabYLa2lFx8F4c84VsjATg6Km8EuIZbU74laTHi700/m ptoFzgUxmq+2h9d1GyriIGNrmk8bhw4FUlGcrmnH7HWejkXigvm2VT0EVewmgavF8jKB Htgw== 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=GRf9ml7jXebCmHJtIo9hXGmvl5NfH5hP6TYRGyysBr4=; b=Z7LxnS/4oAVHznPj6p7IWBwpLkvKPc3RUnEFX/hcTv4uyXR0A7+Gd+RfnIX30CgXCI eUr5EcL1t5Ny9vAkVq/Bxzciyi7eBHqknkbI38wrS3IrU+lliRMI86EgZe4U1v8Hkbg7 2HfsGQ0kIIkqfoLUIVHzhCbuaVWfENuhSeL67Pmb6Fm/Hjv+Aw0/zc7TW+eB14Ny06E7 qfhlKPmMGScToq1o0EH1OiSHBeKLBl7DkxS3aUGQxiy82pH1ezWgJt90BiUFWLHgR7s8 5X19FRTychIlpUQXljmRfNWcoD8LBB7wd8e8Ho7rvjhn8ze7BecH01E0UshQNSEkhhfY Wx9g== 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 d9-20020a655889000000b00408aa327355si1666445pgu.98.2022.07.07.11.50.16; Thu, 07 Jul 2022 11:50:27 -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 S236031AbiGGSej (ORCPT + 99 others); Thu, 7 Jul 2022 14:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236627AbiGGSeG (ORCPT ); Thu, 7 Jul 2022 14:34:06 -0400 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A33C5C967; Thu, 7 Jul 2022 11:32:25 -0700 (PDT) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-31c89111f23so128348077b3.0; Thu, 07 Jul 2022 11:32:25 -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=GRf9ml7jXebCmHJtIo9hXGmvl5NfH5hP6TYRGyysBr4=; b=JB4bSD1u8UUZi8mBn59N2M9WdomsmlUxoBGxmNUP1deyObKnULkRtWjiLu0ObNdWiW Qgr+p/LXQfoACrK8fYMDqNoxcqbu2U0nBB8Hn6y78jIPH7Kyu2PGO0jRmFNCkWmnarG4 F+2KFSL1ys8msVqTzKB/sunfTtx5QjyE6mfUQyXro8A/0L7zC23OMAajOPS/bRueQorY 1MNiqrzCgSF/Wf2smZZT8Mp9dv2MGh5wX6oJ66TGRYLE71BSd5GNiBPq9ZyFO9ZMNHWf Ddw5eqHtFRS82okeHilyCuecLHN5x+EiW70CNSnRdDmk1BwPtM1HCi0UffbCk2XYSF9W GvFA== X-Gm-Message-State: AJIora9Y3R6KaTbhQ2enPMpNxHFIFJ3AjLuS7pXRDXKfWc0MZQcj4QdF KUoUF2g1NJ+3e1SntCpPnQVXwGY3vFLgyAQDSsFH2JwiLiI= X-Received: by 2002:a81:6943:0:b0:31c:ee3e:47c6 with SMTP id e64-20020a816943000000b0031cee3e47c6mr10527897ywc.515.1657218744731; Thu, 07 Jul 2022 11:32:24 -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: From: "Rafael J. Wysocki" Date: Thu, 7 Jul 2022 20:32:13 +0200 Message-ID: Subject: Re: [PATCH 2/2] PCI/PTM: fix in pci_disable_ptm() To: Rajvi Jingar Cc: 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_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 8:27 PM Rafael J. Wysocki wrote: > > 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 -> s/set/say/ sorry. > > 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". And arguably, this function doesn't need to do anything if dev->ptm_enabled is 0 already and this is the only check it needs to do, because dev->ptm_enabled will only be set for PCIe devices that have PTM. > > } > > > > void pci_save_ptm_state(struct pci_dev *dev) > > --