From patchwork Wed Feb 7 11:14:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jian-Hong Pan X-Patchwork-Id: 197860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2155213dyb; Wed, 7 Feb 2024 03:19:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrIMZTU3RxH8/a8QgUcv0zYpElkNySQWX0aVHYOtWr+iXVWDJqRgBUz3ej+vJNqKUKP3dS X-Received: by 2002:a17:907:7803:b0:a37:501c:9eab with SMTP id la3-20020a170907780300b00a37501c9eabmr3679679ejc.43.1707304744956; Wed, 07 Feb 2024 03:19:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707304744; cv=pass; d=google.com; s=arc-20160816; b=rnYntpIu2yZWNWMpFST6YdgWkVH4tKsX6MbH9EAnMsVK04Y1L8d8pXKwNJgj8+ni6i Y8TU7TQ4fku8FyKRh9gJmF9D113TvLg+oxc++fDsiG+mTQTMzxdAx2ITC0vg1fcDjbC2 NEJPMVJ8vNiwAoDR/jX59RHjgBvWx856VYqsPD6AvkvnpzPaw6mUqq7bCRtZBdiVfBRP nHT+A0RKc4YeyiEFyP05he+Wc6QH7PPKesBKsX7WENpGXsq5VI4+h1rHv6mAVFzVb3Pk 8eUmDNrH0C5n7Kq1aQcdlSG/G43y23Bkm7zYW7SG0Yo65KPBEpqPggNG/Sm8FfzlDIBi sO8Q== 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=nIqTMBlwECCoaCjtSPu7GBMR63K3xYDhekgHdgyJ3Uw=; fh=9yFsuty8v467MY34L3KwlqjHiF5Pe2JZFbyJqkYssh4=; b=KOopJdV4nyLlu/ok0c/yfKJ2Sb83cN28PDlOMLHhpn53i1SvgkzdQouclhlaA1674j NmBeH78KRp3+Ao1UCN0WfGT2R0LCFQnHZ0IMUZcPQ6HqPVY1KlBkfGwQR1P+DkpqOQPq TfmWmF4gECBLzn2h8sRkwZJn22TWaIh4XU9jyf45L+bNZnUvUlkftrIe6mouhWLYqJVT 6475jPoxm0aCTCWz2zu29RbpFvYHzlJiUpT7i0emLQBPW+tTYfXv4X0z33RxacS2Yhi0 z8tZxK8wPaUjghyeopU1W8IsSknYctxEGfl7FsFV5eJi8CNvqEHkT7xv8MW1GJVQmgAS doxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=qENNfVFe; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-56380-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56380-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org X-Forwarded-Encrypted: i=2; AJvYcCUB/8Yl336AtgmXmQ5NDzyBL26qg223Ayq5X7a46PonqNStNo9AdSCXOXfYKZdYQifMxaaLhXwRwV72CwZSbzL+d/FMxA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gh9-20020a170906e08900b00a379065c2f5si791293ejb.980.2024.02.07.03.19.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 03:19:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56380-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=qENNfVFe; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-56380-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56380-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8FE391F224D0 for ; Wed, 7 Feb 2024 11:19:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DF151B295; Wed, 7 Feb 2024 11:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="qENNfVFe" Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2A251B7EE for ; Wed, 7 Feb 2024 11:18:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304728; cv=none; b=AFLdsz5+9DVxKivcUuO6l0k09mCWyCQqrF9ULwszLnpt4PWylEW0SqXZ5kxwSNMFnJTUcePD9HI4b1xL7K6u3bkRuf8nmvgyH88C+txOlpND+KjqJVOSrFgHe6zI/WgvGisRDftn6W3pHMHM7C4Kih/11J1lxu30+10kx43nK+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707304728; c=relaxed/simple; bh=s3WTcI1IzbnotT+6dXJtqKdBOVBRXYxNAwhJyvsJF28=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Va7zknPpA/PnuPUS9/C7HMhaDb/vi/oZ2QEnZqtiIO/Tf8eOR7knuzpUPl7OmUp6WvE79N8krIcOrDJtpnc0xQSrpI0I8Z4hIeKIi1DrWbJ1zNXYforQxigIwwB2uHga+ykNFofbcXD8/ZUYWFRRCzJDm1a6NhLJq1Fbczd3VK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org; spf=pass smtp.mailfrom=endlessos.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b=qENNfVFe; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=endlessos.org Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6e141ee9c14so204760a34.3 for ; Wed, 07 Feb 2024 03:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1707304725; x=1707909525; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nIqTMBlwECCoaCjtSPu7GBMR63K3xYDhekgHdgyJ3Uw=; b=qENNfVFesUHYbzwpT3BDEyzFcoz58qmGVjjApob/E5LXmPDwTyLepmi8F0ZP77Uyeb eB3GbtMpSQ1lAXVaxk/WooOE1Ww8vWuYeq5jje0gZnZckC9pFldSQm2x6LNq85Ilxj0E Q3MyfcTBl8ZPPDAw/5+x9mbZxvcew8kRtfdi4dY/WEBehMKMaELhCa8AXtqWbvFDhdAO qaahOIWZ7ejMZYNNB8i0mHmUH7nCT6EmSr072XDgBLiSM6+e7cjlQ5ClM9vlqtZmZDth q/kuyikDjA1MwstO2kJ/OluVWIKKsyDm1PV/INU7ZfN2DiS9cj6GulCdgB8yKDW2Sufq B9kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707304725; x=1707909525; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nIqTMBlwECCoaCjtSPu7GBMR63K3xYDhekgHdgyJ3Uw=; b=jzjegRNQ6JpG2l+acKWgYp6qTdmUjhAidK9+gPeLAelZW8/qfTDgr1qIMy6syazEME ynzL505VNLKoljbMHBAzGuf2wdWO+1Ahh/bM8Y21PrH2/hO7BAeujN4uiNNsOFy1ah2c AJellLbvK8xkq3GYqSrMbH9JFquSKsL/Xpw3htNc6Pojwbk2vFtS9Fi6uxyskPnsEqy+ yjk2CGz0oI33w4zwH9iSwNUjGp1knHPsqY4Zgnw79lnaqXiwiYur3C6zE3YHICgz1K1u WvrEN6Lomq+9pFdDoZsPeA2iRMoBadM6IKzPQzkt275StqkV5EwPZG0qD4ZEU6ZLoL4p OvPw== X-Gm-Message-State: AOJu0Yw3yZQ8Tsl4IqcOvIcgoxwxJgndv5uFGhK7S6Iyf0HX1AKY+29I rbGDJ/3+FVF4SOqh0L8ugUyrqkkuaSGwX71oDjJ8cKhGVi9/HOF4Y4QxXiwA8LI= X-Received: by 2002:a05:6358:a1e:b0:176:5d73:34ef with SMTP id 30-20020a0563580a1e00b001765d7334efmr2300769rwa.24.1707304724801; Wed, 07 Feb 2024 03:18:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXDBZCqcU/ecjQFFfP1Fws3n8TlrjNFryuwLPxlTqdCVYrMnCBBXxfUkyHK/WGAHh7R821tL1nBH0Krw1wdwFkcxI1TcgsdG0qVVMep+k4mNLwoC+1Rnuh5Nvc6N9B4Epa4BrMW7/qxCg2Xk9zXVp4+ruO8p9V9Rr2bez48P9wSQgfJ/xOCO51cgF6uYzt0FMMAGTurzzygILHrwjN960mB9/ca05xbqCGSlC/r8lIwq0JZMiGtMWhYybPCCvcOBIYDNecQM2QcYmz8Sx5DM9aozAcsQa8anjRJL2Q5SkDdOSCEr03LHMEyhbfJQ7VvJkgqOVBwdkp7EhXg+ZHD1GyhRp2KQMoTqOsosogCheDiR5XmXosLoKE= Received: from starnight.endlessm-sf.com ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id z6-20020a17090a468600b002961ccd55e4sm3492799pjf.31.2024.02.07.03.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 03:18:44 -0800 (PST) From: Jian-Hong Pan To: Bjorn Helgaas , Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , David Box Cc: Mika Westerberg , Nirmal Patel , Jonathan Derrick , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH v3 2/3] PCI/ASPM: Add notes about enabling PCI-PM L1SS to pci_enable_link_state(_locked) Date: Wed, 7 Feb 2024 19:14:04 +0800 Message-ID: <20240207111402.576152-3-jhp@endlessos.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790238779793269624 X-GMAIL-MSGID: 1790238779793269624 According to PCI Express Base Specification Revision 6.0, Section 5.5.4: "If setting either or both of the enable bits for PCI-PM L1 PM Substates, both ports must be configured as described in this section while in D0." Add notes into pci_enable_link_state(_locked) for kernel-doc. Hope these notify callers ensuring the devices in D0, if PCI-PM L1 PM Substates are going to be enabled. Signed-off-by: Jian-Hong Pan --- v3: - Fix as readable comments drivers/pci/pcie/aspm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 7f1d674ff171..a39d2ee744cb 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1416,6 +1416,9 @@ static int __pci_enable_link_state(struct pci_dev *pdev, int state, bool locked) * touch the LNKCTL register. Also note that this does not enable states * disabled by pci_disable_link_state(). Return 0 or a negative errno. * + * Note: Ensure devices are in D0 before enabling PCI-PM L1 PM Substates, per + * PCIe r6.0, sec 5.5.4. + * * @pdev: PCI device * @state: Mask of ASPM link states to enable */ @@ -1432,6 +1435,9 @@ EXPORT_SYMBOL(pci_enable_link_state); * can't touch the LNKCTL register. Also note that this does not enable states * disabled by pci_disable_link_state(). Return 0 or a negative errno. * + * Note: Ensure devices are in D0 before enabling PCI-PM L1 PM Substates, per + * PCIe r6.0, sec 5.5.4. + * * @pdev: PCI device * @state: Mask of ASPM link states to enable *