Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2291661rdb; Sun, 11 Feb 2024 22:32:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9rsHdJYAMfXVZqta4Yuaf2iyHnSKw/si7WOm1IeDOh1AhnmtSE2lA6X9v6Z0fq/K1oZNH4VfctIL20anvtye7oa5mJqnqIxzoe7f+Dw== X-Google-Smtp-Source: AGHT+IFZXjnIX38JHwB0QQ5I2jx5xZfF8xqEKWuMMGayNEcctHc6LYWALcxdNlcuVFARiXDrNoow X-Received: by 2002:a05:6871:5314:b0:219:2865:24c7 with SMTP id hx20-20020a056871531400b00219286524c7mr8135038oac.42.1707719575863; Sun, 11 Feb 2024 22:32:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707719575; cv=pass; d=google.com; s=arc-20160816; b=UgT/PQBB2xQ7IZa0sTG3jUj9H4s9WgBHR8AMbi+MfvIfV9kaHjJ1NXVoP/7L4LH4Ju X+O6GoEdxirHqnWqAifikh+Q4h4OblAQ72yASRU7xSdbCLNWuVNRS8Nev3GuycXUKDwj eMRrNhlOFd5iJqSxK6Z+QD8rQBWHIUYpOlGF1jnGH9g1ysGttOGAmOTpz9M5w4J29s6l m/8kVcbGuAlWv561g2LDJBBK97Wn9km2TqkGFHayxHYM8zjGLF+M4pVlSLFaefLRifGz gLagRqQsEaNlOuh4XxqmB96wuijUQRgt3k6BMs3AFqBDPLWyDAqenXaRqX34GY229f4D MzCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=KhvZMxAwi/Nw57syHx49fBIb/QN5OuARUtRvir17eRU=; fh=gji93zYxSPHjfKiCoK6Wg/2Zd+wPTFXRSTZ/Tcxqav4=; b=T16UBOCW4jB8kY1V5dAN7XgT4LzPStk0biqDsiA07N9vZngF+Z1EzsAaOJxVoFW2l8 kU/9XhsjZlqfMRU9rFtGZsjcg4QDqogQb/H7Q9JRhep/AY4vbpGkOcfLiTYG2f0IpU0Q 9BWbBAatzJ5czuRHYPBOs+yzx4SbiCB8pgyw5SZyrx7ZLPqWMNF1wLJxzM0nyTRvwmqO k5bnCjqaIUcztHbZWSejINJQJea/gf9sm5l4SHoHy/MsLJimdjLvBNIGecJwpErY6Uqn iHzSI2Jz27pPPPxvq+hM7hzmGjOe3d5LZVOGJwTKDsoNOSBXzVevZpaKVk1KOuJ/8CRg kOtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KeZ6oAxh; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61119-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVFHflmwu0NohZiuSGFjJ19ampSWdTjI+fJgxAJV7iGQ1t1oPHiGgQdjOo6YQtSYI83qyGUVWhr+mxUHT/gunNA1JiAy4x9yGKwrflSDA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 9-20020a630009000000b005dc71c7b944si1542772pga.144.2024.02.11.22.32.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 22:32:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KeZ6oAxh; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61119-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61119-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 72DF0285A16 for ; Mon, 12 Feb 2024 06:32:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7274B7462; Mon, 12 Feb 2024 06:32:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KeZ6oAxh" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C74AF1876; Mon, 12 Feb 2024 06:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707719565; cv=none; b=f8nqdqzXdnynHaKnNrPoFZbYBTXMnzZ2E888e5chuimPgjgKDpByNQdKfNefY42xqve98BknC7529bQIGlMtQontq/fjDpQ6jbIEMBnrPY2v+Wk8oyrjVEvkMtc1DllUWNGbhCqlt5nlgJVQ8Sosm2t/N10JgaPXe3bMSU0Qgh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707719565; c=relaxed/simple; bh=WtENbaXqtArIZ1h/ul86KKlsUh8sF5NCgydYyrUusME=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=icVHeoPGZGiRuz1UhSqnuzo1YwDa0h/FR2aFLqlE5wDkoTcG0CRJzJMFUUjJHi73J3wWWRSY2Vj+MmUB5nWQSaOTTCp9ZiIvdWzsIw/SGTvnbvvojDYgB23ljYlKnT47iLZxlujrPDyDYu4zH4lNWFfFRpk1paJB/LaLfqIrADU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KeZ6oAxh; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707719564; x=1739255564; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WtENbaXqtArIZ1h/ul86KKlsUh8sF5NCgydYyrUusME=; b=KeZ6oAxh/OFsHP3Hpk3UKglRsnIl0Aq+h/ANK0HNVQ7YfO8i3BZiiqv0 KF8inZLt9ZeeeJPMVJpC41yuA/ik4WnjGrTR575psTLTSAbV/vA3Klykm eyJ+uVGlh3ABwyjugCl3pS5gmwJr64QdChhifDPDG9zZTSWWD3ORVfaOL p+zi/AVHITwMQUxiF4lcOwdk+hoSSX2vKSCN8/COdkCGLh0n3HITgpb9d q46HPILfwtfZd7jDbYix/5SbCRKzwDcUrTtDtR4YJR/NzIpJWvttufZso HZHprdb3Db9vr4bBP/lhT5mrhNHgSehhwXm4w966oCObMWWZI4p8ihi/V Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="1538558" X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="1538558" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2024 22:32:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="2897133" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by orviesa008.jf.intel.com with ESMTP; 11 Feb 2024 22:32:41 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 882D01CAEA; Mon, 12 Feb 2024 12:02:39 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 837061600100; Mon, 12 Feb 2024 12:02:39 +0530 (IST) From: Raag Jadav To: bhelgaas@google.com, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, stanislaw.gruszka@linux.intel.com, lukas@wunner.de, rafael@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, Raag Jadav Subject: [PATCH v1] PCI / PM: Really allow runtime PM without callback functions Date: Mon, 12 Feb 2024 12:02:33 +0530 Message-Id: <20240212063233.5599-1-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") tried to eliminate the need for runtime PM callbacks by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't modify pci_pm_runtime_idle() with relevant changes, which still returns -ENOSYS if the driver supplies no runtime PM callbacks. Fix this by modifying pci_pm_runtime_idle() such that it allows PCI device power state transitions without runtime PM callbacks. 0) | pm_runtime_work() { 0) | rpm_idle() { 0) | rpm_check_suspend_allowed() { 0) 1.500 us | __dev_pm_qos_resume_latency(); /* = 0x7fffffff */ 0) 4.840 us | } /* rpm_check_suspend_allowed = 0x0 */ 0) 1.550 us | __rpm_get_callback(); /* = 0xffffffffb4bc84f0 */ 0) 1.800 us | pci_pm_runtime_idle(); /* = -38 */ 0) + 17.070 us | } /* rpm_idle = -38 */ 0) + 22.450 us | } /* pm_runtime_work = -38 */ Debugged-by: Mika Westerberg Signed-off-by: Raag Jadav Tested-by: Jarkko Nikula Reviewed-by: Andy Shevchenko Reviewed-by: Stanislaw Gruszka --- This is not marked for linux-stable for the need of extensive testing and can be backported after a few releases if no issues are reported. drivers/pci/pci-driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 51ec9e7e784f..bb7f6775b350 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) if (!pci_dev->driver) return 0; - if (!pm) - return -ENOSYS; - - if (pm->runtime_idle) + if (pm && pm->runtime_idle) return pm->runtime_idle(dev); return 0; -- 2.35.3