Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1991612rwd; Thu, 15 Jun 2023 19:53:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aMwoDHJa0Y717IfoN9lrl7o1uQxa7ve8OkQ7gF/h6Wt0L0OvttIaISxhsEbW3d7bopipZ X-Received: by 2002:a05:6214:c22:b0:62e:ffc3:a9cc with SMTP id a2-20020a0562140c2200b0062effc3a9ccmr793974qvd.58.1686884001274; Thu, 15 Jun 2023 19:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686884001; cv=none; d=google.com; s=arc-20160816; b=izDskvBbjF67UP1ObbH6wLARt4RoBbPJArAhYb39kY024fUEcjU5mTSKkFKlfD3QVf 6TxdtJjMd5hRQrJqVNTDjUSk2lwtujBEfp/KCOTqxoXJlLcsUdwr102NunOZeh2MvhO5 RnIFEXDLwG2Xu0yuwd5GPLzd0jYqId9wKIGoolXqDyu6wMUmCy2lkAjJ0KaMtjMWwoTx ydz6wNqQW2LMJbLB+cmBGL1NWm48A/ooZmo5/MNanwX/DQZWb6zsM3VSVRKPH3hn6q3x sMCdMGera54PylyEKxdkeCyW5H7G3fkUkI/bKmtvat+Jf32JR+GiTo+qbd7fkXPPhh6T ppGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uIgMGFsFWXeYaOH9c0y1e36aMXOPZcT20Gk+4ok8oCc=; b=ovQkMDGC1XJ+lJ7LeAG1buJc8jB0kbJN9XElj90zJ/jPo90tVKnYSSVr4KLItSNewB bXeUu8WgAMIfX72rbWAvJff+qZrrzRBiaD4v/H2u89P66HXLX6vTQh+7uGoCTLFVHfE0 0+ilTuWw6Efr6/e6SLpsmW4vNvpSlAgVNDVn5y1rcy8qrgK7azKBf7br81EvVIsfTWRt vmAvDDVV4kx9P1w5kcY9mQtUGdx+5/DMHhb3hFk3malYL7nzTqqxzOXNx/VXPPNr5iLH RBiiSlOC53k4Wz38cGX8DjBSwu7fMXQNK+gol8mAQd1BRJ4iQc3DeuZN/QI0J0N6Y9Vg /GPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ARd40C9X; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a63de51000000b00542918676f4si4561024pgi.381.2023.06.15.19.53.09; Thu, 15 Jun 2023 19:53:21 -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; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ARd40C9X; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241089AbjFPCiK (ORCPT + 99 others); Thu, 15 Jun 2023 22:38:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbjFPCiJ (ORCPT ); Thu, 15 Jun 2023 22:38:09 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A48297A for ; Thu, 15 Jun 2023 19:38:08 -0700 (PDT) Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id A817E3F18B for ; Fri, 16 Jun 2023 02:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686883086; bh=uIgMGFsFWXeYaOH9c0y1e36aMXOPZcT20Gk+4ok8oCc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ARd40C9Xi8rhp6Ne1WtaQEHB09pdiradyd2KvyBLbJ4BPyKtNHnuemV7OhFLhnn76 hHWsDH5SpG2eyflbT7BH6p8iSXuowIn5rBjOmZ6MpYvFYqGCdAIV5O8qxqjRKEAi9g 4kUJLBKNTb7zLrDHzQ0+iA9JSlxDqolyL2RmTm9BTcqnKBocWU2IqblAbIrB/cij6u MXRFr7lNM8RHjQ3OXvr7uVmO/95RYPqXNuz8A1NwJvjnr1w1wpR0Br609zmnHHyU+q Cp+CV3ClZDs4ae+As/nQ2rFIVi5PhxUu8XRWQ/8eTlLp2kqf4kmbLyHR3ahXmIkztQ 2VXFh5SajW3TQ== Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-1a6ba8c60b9so313101fac.2 for ; Thu, 15 Jun 2023 19:38:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686883085; x=1689475085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uIgMGFsFWXeYaOH9c0y1e36aMXOPZcT20Gk+4ok8oCc=; b=ee1MkKY1e2hUJtLJf8XYb4cFvT9UUpuly/LCAbwkpLbpVVuCGdt2ng47JYAwcxZUm5 Dvd6FvSLWgs2rfhPvtYPcIa0j5uOiBl+OXdcUVTEI/vfvApZRH/PI1od92tp4hqDx/0F rt5o6nrnbDst2dHB7/ub7hqarT1Tuz9cemDtj/LBTWWHRMw53iQpPv1evRgzfaQeAmNy YRUjL59XqkN7ydac5Uljk1JkDUJ3xFIwIm9Dd0sUni6oWoXrM70GSvmBy/xUjMyZfN0Z Is3oURERdcJXxz/OZEROFjSTih13JqYN67rAg3FdHP5PzcyjpgkGs+8jyBFrnwKbsaIU aA3Q== X-Gm-Message-State: AC+VfDwIlrgBts1URujV3sjpeb8+B24d5IkgnqHfiLWJ/JqxomVhq/a6 OEOmPTnQIKOptREHB1RHKl20S7cQnmngpx9w0TcFQqqb0hRaYjpT3xgdT9WsfuLwiT7xR+jS5ru 1QDuzszed55NFoWTKk5ZOXelmzM22QYSPBOWqUktBJfzzJDppMOqP3s0BdT4BChzV/Q== X-Received: by 2002:a05:6870:7384:b0:19f:202:4fb9 with SMTP id z4-20020a056870738400b0019f02024fb9mr909999oam.38.1686883085417; Thu, 15 Jun 2023 19:38:05 -0700 (PDT) X-Received: by 2002:a05:6870:7384:b0:19f:202:4fb9 with SMTP id z4-20020a056870738400b0019f02024fb9mr909984oam.38.1686883085177; Thu, 15 Jun 2023 19:38:05 -0700 (PDT) MIME-Version: 1.0 References: <20230615070421.1704133-1-kai.heng.feng@canonical.com> In-Reply-To: From: Kai-Heng Feng Date: Fri, 16 Jun 2023 10:37:53 +0800 Message-ID: Subject: Re: [PATCH] PCI/ASPM: Enable ASPM on external PCIe devices To: Sathyanarayanan Kuppuswamy Cc: bhelgaas@google.com, Mario Limonciello , Mika Westerberg , Vidya Sagar , Michael Bottini , "Rafael J. Wysocki" , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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 Fri, Jun 16, 2023 at 1:07=E2=80=AFAM Sathyanarayanan Kuppuswamy wrote: > > > > On 6/15/23 12:04 AM, Kai-Heng Feng wrote: > > When a PCIe device is hotplugged to a Thunderbolt port, ASPM is not > > enabled for that device. However, when the device is plugged preboot, > > ASPM is enabled by default. > > > > The disparity happens because BIOS doesn't have the ability to program > > ASPM on hotplugged devices. > > > > So enable ASPM by default for external connected PCIe devices so ASPM > > settings are consitent between preboot and hotplugged. > > Why it has to be consistent? Can you add info about what it solves? It enables ASPM when BIOS can't program LNKCTL. Enabling ASPM can bring significant power saving for modern CPUs. It's also quite nice that it can make the BadDLLP caused by I225 device go = away. Kai-Heng > > > > > On HP Thunderbolt Dock G4, enable ASPM can also fix BadDLLP error: > > pcieport 0000:00:1d.0: AER: Corrected error received: 0000:07:04.0 > > pcieport 0000:07:04.0: PCIe Bus Error: severity=3DCorrected, type=3DDat= a Link Layer, (Receiver ID) > > pcieport 0000:07:04.0: device [8086:0b26] error status/mask=3D0000008= 0/00002000 > > pcieport 0000:07:04.0: [ 7] BadDLLP > > > > The root cause is still unclear, but quite likely because the I225 on > > the dock supports PTM, where ASPM timing is precalculated for the PTM. > > > > Cc: Mario Limonciello > > Cc: Mika Westerberg > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D217557 > > Signed-off-by: Kai-Heng Feng > > --- > > drivers/pci/pcie/aspm.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c > > index 66d7514ca111..613b0754c9bb 100644 > > --- a/drivers/pci/pcie/aspm.c > > +++ b/drivers/pci/pcie/aspm.c > > @@ -119,7 +119,9 @@ static int policy_to_aspm_state(struct pcie_link_st= ate *link) > > /* Enable Everything */ > > return ASPM_STATE_ALL; > > case POLICY_DEFAULT: > > - return link->aspm_default; > > + return dev_is_removable(&link->downstream->dev) ? > > + link->aspm_capable : > > + link->aspm_default; > > } > > return 0; > > } > > -- > Sathyanarayanan Kuppuswamy > Linux Kernel Developer