From patchwork Mon Jun 24 08:12:49 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: 13709141 X-Patchwork-Delegate: bhelgaas@google.com Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 D6D814F201 for ; Mon, 24 Jun 2024 08:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719216944; cv=none; b=iy1BS1SijmVwC1TwGZdOi10KP/D0AqUHzbTgWc59tkZOT42trnwshOp+8OkR/VNoaxcNIXZH6lasmxYnQL32tFlK1ShOEKQwpaJLVBVRmNuNg174fHewaQqNsHjS2Zr4WxQJZYep8LotPmr3N0+f72v0h7AMe3MuHOQWoPocxbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719216944; c=relaxed/simple; bh=CjLuYcz29twZ86M/ctQCbOvGSLYLZ2EmzaSKfiu4jBo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kQMZzCxsRiuXFC6xnVGNI3W4hNN4ePCCBlFWqZddI/8lEWgTZ+Vh3SEEbz4kR1O/lJbSFdC4waPzzLWqHTTJ3kjh3raxygyq8Y7jr0dHNjITffs5gcrS4C6N2nSTA/NmG3v2s+iELzP4zMG/NUQz78F9+4IqRfw50VQ9u4hOopA= 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=BUF9lKrc; arc=none smtp.client-ip=209.85.214.177 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="BUF9lKrc" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f47f07acd3so32674575ad.0 for ; Mon, 24 Jun 2024 01:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1719216941; x=1719821741; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bykc5Adp4kAKq+9EFQqxeEMKoB9hzt4fqeNrroz1JRY=; b=BUF9lKrc+b/mcwb+ks0nvrpw6gogmkPtwUjMJ+d5Mi2v9Zrpm1c3Gdl5Rbn7XfRTnM RnyPm3ci7zgFovFTjQGCCYn2Qw+LpCfcHkpZfdoqpQy89IoQd3vTEWeBeUcPSx8A9GI6 3vOHdLx5V8W7S2CXLAE8n9ggKtCODtq4axdc0UxUJg4S5ESBOaD3jcQnI61mXtu98PBd xp/gLzqtiIokN6i+DZjX3Eu/wjq0Mcubeyn/5sQu8AMlDN0tD2KKfyeHXVb5trZsEeaF Zazch3S6ySoLUrBeS9IBUeWw8WZcykin1oa717Wh9+3tF0b8nJNgzmuPmcfK5ExQk9YT U0eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719216941; x=1719821741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bykc5Adp4kAKq+9EFQqxeEMKoB9hzt4fqeNrroz1JRY=; b=JyND6zY0Z1MmecQPB025GvI0JWe2cDbtm1fx4+Eg4+5PmNThDIkIhn1ksOTn3kknZV 9v2HGYt6Wldg/S/ciNMBsHY7kQOtjLSjQSUwiM9+jHYxfouL9gbjLr6AniGBHkJQWYsb rBwTANnhzK2jRWQDUMXLkJk3QH55NK+2pMgr8InRfqrTHcW0/e8kfum3LZZAnoJBgHq+ AvkdFRHnQJ70tINYPP2bsHadHATZTDgRg34VN10nzsgTC5AWAXXN2bwXw6MR5aGN3NlE eSGPiFQiI6IPFxaLeJMTjprZ2Uh8MuKNdfAS4JbPRsianmvtKyyYu37aJtIoT+I2mn36 2Ouw== X-Forwarded-Encrypted: i=1; AJvYcCUvJdzKkqgchYxhg0T68hszpFQ7MtSc4DUhyiTuPP3o4S3hFvWzpbF/wg3UT45/f8YNJwElwz1VI4H6FY2T4zToty/+kaXc003p X-Gm-Message-State: AOJu0YxPQozrxw1HkLodXHCTVRdygZI7jTPL7A68tCFSCi5XTrQjkbRa 8bysu9z3VbcN+cD//O6GCFl6dI3PqZfn77W8S3TmMmcQsSBqhKu52lHneRnEzK0= X-Google-Smtp-Source: AGHT+IFIN5qwmK2F5vLzDXKBZU0Nd/r8LpTXxCp7IHSJVDsZnbBK2g6IJ1jps5xuEqKR+HKMLW9gtw== X-Received: by 2002:a17:902:d4cd:b0:1f4:b43f:9c01 with SMTP id d9443c01a7336-1fa1d6a9349mr47525865ad.64.1719216940967; Mon, 24 Jun 2024 01:15:40 -0700 (PDT) Received: from localhost.localdomain ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1f9ebaba068sm56960035ad.248.2024.06.24.01.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 01:15:40 -0700 (PDT) From: Jian-Hong Pan To: Bjorn Helgaas Cc: Johan Hovold , David Box , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Kuppuswamy Sathyanarayanan , Mika Westerberg , Damien Le Moal , Nirmal Patel , Jonathan Derrick , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH v6 1/3] PCI: vmd: Set PCI devices to D0 before enable PCI PM's L1 substates Date: Mon, 24 Jun 2024 16:12:49 +0800 Message-ID: <20240624081248.10177-2-jhp@endlessos.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624081108.10143-2-jhp@endlessos.org> References: <20240624081108.10143-2-jhp@endlessos.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The remapped PCIe Root Port and the child device have PCI PM L1 substates capability, but they are disabled originally. Here is a failed example on ASUS B1400CEAE: Capabilities: [900 v1] L1 PM Substates L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- L1_PM_Substates+ PortCommonModeRestoreTime=32us PortTPowerOnTime=10us L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- T_CommonMode=0us LTR1.2_Threshold=0ns L1SubCtl2: T_PwrOn=10us Power on all of the VMD remapped PCI devices to D0 before enable PCI-PM L1 PM Substates by following "PCIe r6.0, sec 5.5.4". Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394 Signed-off-by: Jian-Hong Pan Reviewed-by: Kuppuswamy Sathyanarayanan --- v2: - Power on the VMD remapped devices with pci_set_power_state_locked() - Prepare the PCIe LTR parameters before enable L1 Substates - Add note into the comments of both pci_enable_link_state() and pci_enable_link_state_locked() for kernel-doc. - The original patch set can be split as individual patches. v3: - Re-send for the missed version information. - Split drivers/pci/pcie/aspm.c modification into following patches. - Fix the comment for enasuring the PCI devices in D0. v4: - The same v5: - Tweak the commit title and message - Change the goto label from out_enable_link_state to out_state_change v6: - The same drivers/pci/controller/vmd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 87b7856f375a..5309afbe31f9 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -751,11 +751,9 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) if (!(features & VMD_FEAT_BIOS_PM_QUIRK)) return 0; - pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); - pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR); if (!pos) - return 0; + goto out_state_change; /* * Skip if the max snoop LTR is non-zero, indicating BIOS has set it @@ -763,7 +761,7 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) */ pci_read_config_dword(pdev, pos + PCI_LTR_MAX_SNOOP_LAT, <r_reg); if (!!(ltr_reg & (PCI_LTR_VALUE_MASK | PCI_LTR_SCALE_MASK))) - return 0; + goto out_state_change; /* * Set the default values to the maximum required by the platform to @@ -775,6 +773,13 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) pci_write_config_dword(pdev, pos + PCI_LTR_MAX_SNOOP_LAT, ltr_reg); pci_info(pdev, "VMD: Default LTR value set by driver\n"); +out_state_change: + /* + * Ensure devices are in D0 before enabling PCI-PM L1 PM Substates, per + * PCIe r6.0, sec 5.5.4. + */ + pci_set_power_state_locked(pdev, PCI_D0); + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); return 0; } From patchwork Mon Jun 24 08:17:50 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: 13709142 X-Patchwork-Delegate: bhelgaas@google.com Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 6D4084AECE for ; Mon, 24 Jun 2024 08:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217138; cv=none; b=R91NLU+lFtrZFfKIM5nKA/qNC1O5UrHVP9dMJZbDHZZdLUa3bDQXGEvZ/JHblcwqAWqm5/Zt5SaJ8TDGbkXpLFvehy4ypE+DtqMkeLlO3xzSrbtWSEGsxJ1+qXB+NmNretmyvk9C4KwO4PJl88isdlwawELeAj7G3sFwNylWVOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217138; c=relaxed/simple; bh=myRZ1WzGtVF+5eRnikKNFfYxz/D/CFBKuWmxRIRoysQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qDWciJ3bKDmn7v8vVFOaMA9pTyIxXEF7/qnwO6ni1mag2hV+tXmgI7YDKge0fNOe30kyqpSPVpBlRfQieOWjCbEe8ANMt/n15+NbxdfmmrLeyvlhiKzs2Q9j/i2IML8nCcy70ESOBN/EVprgOqpJcMm1cou1Kk2rjggs34sRCLQ= 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=nk2hGmy5; arc=none smtp.client-ip=209.85.215.179 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="nk2hGmy5" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7152e097461so2437429a12.1 for ; Mon, 24 Jun 2024 01:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1719217137; x=1719821937; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Cwvf9W24UthLlcjVjH4PS05a8L60/p4gOZ+dA+VoDlg=; b=nk2hGmy5wqfqdcz39L7zILRWoNtBdpYI4O5X3tcHRe1++mTL1OFaHZH/fMJ2Yr5kJi 0jWSc5ur9k1imHL5HXsj2u4rsaynY9+mLNCbLJKqTn2lUgfJqWb6QL6RLLKsV1xzWU6p ITfe7aAR3npV5cEiIcixv4Csl+tdMhy4DqPrfo8AQ0riVJ9RamYA9I/vvY0+Cci3Y7n2 cjkqL33hQWZOBJ7y3MjOv0LsbKHncSlOFJ5cY83ICkDgd5SlvzQPzNatUyEv4FwCJi/6 5Nir5FRPFQZk8guOmFdGxyawES33on/u4Bnp4Mbm16YfhR83lysOcSH7bnPED+wig90f LYqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719217137; x=1719821937; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Cwvf9W24UthLlcjVjH4PS05a8L60/p4gOZ+dA+VoDlg=; b=OaurNa3zUoA/zZ8CgZ1Kdcq076eH22YPhivErnDVOiSVNX7LEH6gKGDNZ6ZhAAMtWQ 7BUbaEiJQlerBfe3bqqlf16QwI6l7yej7ii2tWwNzAXR7HE4BjW7uGMEQGOyBa3LZ1Cs 7x0IHonPrwk4UrWvViBx2C/JWlWnomzHiwl7gC0Skx+hUdCxMOj7/l+33uAAcQU0x8GO s3LDJoZpqHRx3X6q9/WSJeM4l0jDL4sGFAvjEFSC3cqBtB2CauweFciST6SDkH3H1zU+ TPkpTloNyXKl1Rso1XNBNrGNUQVHM6+8uYG7BDaOBQVwHu8vbevHJHuIthxyxJJL+toD Z0sQ== X-Forwarded-Encrypted: i=1; AJvYcCXMSgvuGhrF064YBClYFxZMEZqk4/Yi1wXzYzG9DOoHdhzeI6p/rK9IYlxJviMp+yDNauGgogTlZbZ45hyH0QtWNfTEhCR60k+z X-Gm-Message-State: AOJu0YxPV/BY1rk0BrtrRWC+72X6Jhyt1gATi+s37FPrhazWsdTceBo1 98xF/VTNTpE001hYies0o1myoH3LC4RjKJ2yzs1cJwLXMm8Nnqgqj+FW+ClMH4U= X-Google-Smtp-Source: AGHT+IHKpPCbjA9Lpt04pm8JLXalr5L14MoJzaRmUc7pzlkDhUthY4DIreywW2pKD9J9izxAUgoIRA== X-Received: by 2002:a05:6a20:9782:b0:1bc:b69f:1d93 with SMTP id adf61e73a8af0-1bceccebd90mr5968012637.17.1719217136462; Mon, 24 Jun 2024 01:18:56 -0700 (PDT) Received: from localhost.localdomain ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-706512fed18sm5634954b3a.181.2024.06.24.01.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 01:18:56 -0700 (PDT) From: Jian-Hong Pan To: Bjorn Helgaas Cc: Johan Hovold , David Box , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Kuppuswamy Sathyanarayanan , Mika Westerberg , Damien Le Moal , Nirmal Patel , Jonathan Derrick , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan , Bjorn Helgaas Subject: [PATCH v6 2/3] PCI/ASPM: Add notes about enabling PCI-PM L1SS to pci_enable_link_state(_locked) Date: Mon, 24 Jun 2024 16:17:50 +0800 Message-ID: <20240624081749.10219-2-jhp@endlessos.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624081108.10143-2-jhp@endlessos.org> References: <20240624081108.10143-2-jhp@endlessos.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to "PCIe r6.0, sec 5.5.4", add note about D0 requirement in pci_enable_link_state() kernel-doc. Signed-off-by: Jian-Hong Pan Acked-by: Bjorn Helgaas Reviewed-by: Kuppuswamy Sathyanarayanan --- v3: - Fix as readable comments v4: - The same v5: - Tweak and simplify the commit message v6: - The same 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 cee2365e54b8..bd0a8a05647e 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1442,6 +1442,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 */ @@ -1458,6 +1461,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 * From patchwork Mon Jun 24 08:21:45 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: 13709153 X-Patchwork-Delegate: bhelgaas@google.com Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 08A4745007 for ; Mon, 24 Jun 2024 08:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217371; cv=none; b=ml8Tt6SR57uv9hWIdmxQqIq3qm2WTPNwru3cx7rEFc4XTTGoi2SaTZUF7g0Do9QrIVHj+y1oZarIKIRWIyl3ZfUvNuEwwB0QJ3bvyXhz8/K1cvn4klqQqcVWCA+yTkHOXAgoAwV2hcnGymMOFK/zJiIF36Hw8FjTcralNX8p2eU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719217371; c=relaxed/simple; bh=l8PxRcYIUV+BwhTr/9tnWDMOzSzkqoN1MtjHSsnguGg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RtXTTehJq/u21iod7e51T4qj+qvdjVqvBWDy9dTchRteEeqm33IbCi8TgUq2aLa01tJejZVmQIcC3jE1aOsi5on/A6oyBmjvbw5C7Z0QZbXNaY/HYj5ehRWgXXm7oFr63aR+vrLug0/Nxltmlf7zF3O367dycT+4R813FhK1c48= 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=fxYpPcUZ; arc=none smtp.client-ip=209.85.214.177 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="fxYpPcUZ" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f64ecb1766so29955455ad.1 for ; Mon, 24 Jun 2024 01:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1719217369; x=1719822169; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TKqXgp0PeCY7zVPXIYmvQu6WZY+HEs+Sn2Z47Kgx7oM=; b=fxYpPcUZsuE9aiH3471SZiJQzzMoSlqLkowXosNEkyMWVlKz/QwPk+rVLeFOaDBOWt N4PQkstLuhKl02eVi0yv9ZAkq/dSRCWjcVznar6vEWRu5Qg29be95rINkTgoKhlz7aqw Xjp7AmCl41xYlm+SDDqkZzzxJVXbvURJs6mw/YJnjiBcat0Ut8xOyfmTdC70EkchrZG7 V7eojFfhBN7KsMGLKEmlQUt9dvYfj5QiHHzFvvGfsYQbtPbd/6lVGpyMLBtripypYIf+ ZJEs0UGYOl/fj+BwPZu3u5Yq1mugqVsgo8R9R2ZZPajgCrfFmjxg9Mxsn74g7BjK7r+l r4tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719217369; x=1719822169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TKqXgp0PeCY7zVPXIYmvQu6WZY+HEs+Sn2Z47Kgx7oM=; b=Ac/fD+Z6Czu37PnYLmhy/z1htxG4AWgMpkPqxawC38nxBXS5v6mKiBf/qtqjIDdtCY FMa49dVir4VgS1Y7GZ/73wv+ZtyBw19t96i+IEM0v6TnNSAskPeOXzNZS3e/7ip/+LPI GbpeaAWb9YTBo+iQvUJ3Pi56b2T5xpsIHUMFZTjvaDHUjxC/ier7jGks5B+0qv51WJmu OOWs0jio5de3dziG1Cch1KY4VfnJ9ZzzHLWyhZptnPvjr67iAKjsExCDXz+Ce4FeuS+1 eeotnqUPnqcFwCEM9cqAcNBdHh7TsIRMml9Ab45Jjoc1QdjJ0VmgxQJi77v4L6cCsKOQ y3Kg== X-Forwarded-Encrypted: i=1; AJvYcCWdjKkTpgBXbW2/S9/00reYch4v1qhwxrqhxJ+xo4Fbv0v5UVkXup3JWkXPwomXl0GR1DKsJCs80pXKY4EjoajKwPpkP33buzYl X-Gm-Message-State: AOJu0YxmzbknvgE1DXaVNh3rF35mRiI+/krTp/RpAbFkKuU2JRzhiNQC UcTbRy2LO3p9BRrsDd+Bqu9CgdCklvNOpN6Gqb/lp8kYFRo3NQ54jAPWXyF77Tyd4gK+XXfWesf u X-Google-Smtp-Source: AGHT+IGkoHJq/Uha60iVDfgi2zLJGjHRCAI0OByy2xj9MuNZhuILpLYTi5YuR8zGMv4NTd34FPkw1Q== X-Received: by 2002:a17:902:ec91:b0:1f7:1b97:e91f with SMTP id d9443c01a7336-1fa1d5173d9mr51886265ad.26.1719217369112; Mon, 24 Jun 2024 01:22:49 -0700 (PDT) Received: from localhost.localdomain ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-1f9eb3c8b5dsm57068405ad.181.2024.06.24.01.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 01:22:48 -0700 (PDT) From: Jian-Hong Pan To: Bjorn Helgaas Cc: Francisco Munoz , Johan Hovold , David Box , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Kuppuswamy Sathyanarayanan , Mika Westerberg , Damien Le Moal , Nirmal Patel , Jonathan Derrick , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH v6 3/3] PCI: vmd: Drop resetting PCI bus action after scan mapped PCI child bus Date: Mon, 24 Jun 2024 16:21:45 +0800 Message-ID: <20240624082144.10265-2-jhp@endlessos.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240624081108.10143-2-jhp@endlessos.org> References: <20240624081108.10143-2-jhp@endlessos.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 According to "PCIe r6.0, sec 5.5.4", before enabling ASPM L1.2 on the PCIe Root Port and the child device, they should be programmed with the same LTR1.2_Threshold value. However, they have different values on VMD mapped PCI child bus. For example, Asus B1400CEAE's VMD mapped PCI bridge and NVMe SSD controller have different LTR1.2_Threshold values: 10000:e0:06.0 PCI bridge: Intel Corporation 11th Gen Core Processor PCIe Controller (rev 01) (prog-if 00 [Normal decode]) ... Capabilities: [200 v1] L1 PM Substates L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+ PortCommonModeRestoreTime=45us PortTPowerOnTime=50us L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- T_CommonMode=45us LTR1.2_Threshold=101376ns L1SubCtl2: T_PwrOn=50us 10000:e1:00.0 Non-Volatile memory controller: Sandisk Corp WD Blue SN550 NVMe SSD (rev 01) (prog-if 02 [NVM Express]) ... Capabilities: [900 v1] L1 PM Substates L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- L1_PM_Substates+ PortCommonModeRestoreTime=32us PortTPowerOnTime=10us L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- T_CommonMode=0us LTR1.2_Threshold=0ns L1SubCtl2: T_PwrOn=10us After debug in detail, both of the VMD mapped PCI bridge and the NVMe SSD controller have been configured properly with the same LTR1.2_Threshold value. But, become misconfigured after reset the VMD mapped PCI bus which is introduced from commit 0a584655ef89 ("PCI: vmd: Fix secondary bus reset for Intel bridges") and commit 6aab5622296b ("PCI: vmd: Clean up domain before enumeration"). So, drop the resetting PCI bus action after scan VMD mapped PCI child bus. Signed-off-by: Jian-Hong Pan --- v6: - Introduced based on the discussion https://lore.kernel.org/linux-pci/CAPpJ_efYWWxGBopbSQHB=Y2+1RrXFR2XWeqEhGTgdiw3XX0Jmw@mail.gmail.com/ drivers/pci/controller/vmd.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 5309afbe31f9..af413cdb4f4e 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -793,7 +793,6 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) resource_size_t offset[2] = {0}; resource_size_t membar2_offset = 0x2000; struct pci_bus *child; - struct pci_dev *dev; int ret; /* @@ -935,25 +934,6 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) pci_scan_child_bus(vmd->bus); vmd_domain_reset(vmd); - /* When Intel VMD is enabled, the OS does not discover the Root Ports - * owned by Intel VMD within the MMCFG space. pci_reset_bus() applies - * a reset to the parent of the PCI device supplied as argument. This - * is why we pass a child device, so the reset can be triggered at - * the Intel bridge level and propagated to all the children in the - * hierarchy. - */ - list_for_each_entry(child, &vmd->bus->children, node) { - if (!list_empty(&child->devices)) { - dev = list_first_entry(&child->devices, - struct pci_dev, bus_list); - ret = pci_reset_bus(dev); - if (ret) - pci_warn(dev, "can't reset device: %d\n", ret); - - break; - } - } - pci_assign_unassigned_bus_resources(vmd->bus); pci_walk_bus(vmd->bus, vmd_pm_enable_quirk, &features);