Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7502653rdb; Wed, 3 Jan 2024 20:11:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYYl4rOnLqGxgZKp6S2UtHmuArIUVLQvJsLu3SHEiHcnF/+ZlF1KiKcf85rc5Nqh+rU3no X-Received: by 2002:a05:6a00:3cc9:b0:6d9:b319:294e with SMTP id ln9-20020a056a003cc900b006d9b319294emr58067pfb.44.1704341460901; Wed, 03 Jan 2024 20:11:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704341460; cv=none; d=google.com; s=arc-20160816; b=Q36SJK4wPHoBgBZWRfh5AEFJnbU1Va0/8WniImx474dUTrUpegpBRTY4zge+sdaXWz AN4waKfJPA3x3F5tCBBlyEIwJ4qiFYDDU0fXjEAgCj+Sk9ujgPcn5wIcqMAxvbVK30jP o6QnXZ1F0aV5MHMB93v0Fk12DfKN3SxfxYTyFCu9D4YS//UgTL46/izpgdgGcAz6PIT0 hurbjLkPovLqFdsjP2cjtFnJ3kND8Yx0uDCnQZ5c4SVNgA8+sDIl+0ewikNjirFsYrp3 ZDkf4/WbccyZ4+lbCX79B3Aen6xWZJ3ytYcuK7ec9qfsAGiaKmn2csQv93RDNVgfXNdV WD8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=r0hcB3RaDLd8lTvJ9no/dztI+HIZc74x3uNUcPsxxEg=; fh=bpTqItwEegTdnoRKx4peXznGx/O5d0hhPU6eHOhB0/4=; b=QT0onbwErelv5AHg9C+VOOdOkTDGDOWkQT8uRIx7WBjytH2qdgJV3cQFvDkY1JaCxT iflxarc8TwC+BXTWxGoq57PkXzUwcU1TyBzmx+MLDfZxlMc6YBOKBu9skB89u22dIx4B Wo17NkMgSA5CAblCF1C9Oj2jvx4TUYr6XQQhWAjEjUhCDTa2avC8jyfXiF8uDGLL8rVr tSMifaITjsvnimUIBx0uwbTkrzj/9UgLIIGubLEugHQAWuOt33ldbzwZ1Ypbik73gif3 +WSbFSRNkVGmSXgObYw6NbLHj4oHvg8HtvqKLfS66HmafjHsg3/pJBYJxOBwizT1C4l5 w5Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=rwLBuq1t; spf=pass (google.com: domain of linux-kernel+bounces-16240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ck3-20020a056a00328300b006d28dec60cbsi19209645pfb.251.2024.01.03.20.11.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 20:11:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=rwLBuq1t; spf=pass (google.com: domain of linux-kernel+bounces-16240-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5E95DB24F1D for ; Thu, 4 Jan 2024 04:10:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72EE7134C2; Thu, 4 Jan 2024 04:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="rwLBuq1t" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (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 0233CD297 for ; Thu, 4 Jan 2024 04:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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-1.canonical.com (Postfix) with ESMTPS id 26C683F04D for ; Thu, 4 Jan 2024 04:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1704341433; bh=r0hcB3RaDLd8lTvJ9no/dztI+HIZc74x3uNUcPsxxEg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rwLBuq1tG6LZmsmOzdh/rycbMhCrFy8n2p9Mv7drC0PTpCKYqF2XiUqipAGZ+ic+8 3F4wVs5i1+CRlikUq/CsqScGyMomwyUoHhBDIniwiA+1Ykqo0Rz56X7bJazLuAaA3b auBYhYM2lgCIxViKj/zAav1sKPJwEpgazwmaAhbYGpud5WanCeksfVoEdwV7P2cCrv EVtzd0Fb3Dz4zHEcKbltyWdbPvTxEFICpdbWSPdNmGmJsu+dBpCqRcqjlAxWVqX/vz Ljra87jFyMQwfnVH8F1d6FtCzWur0d4a4H1FODpoqmdX/4/peo7Q7x8BekL0Bdbvgm iinoRp/YyaU9w== Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-6d9b266183eso93191b3a.1 for ; Wed, 03 Jan 2024 20:10:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704341432; x=1704946232; 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=r0hcB3RaDLd8lTvJ9no/dztI+HIZc74x3uNUcPsxxEg=; b=P/5f/JoGF4vnHqbdzvdNl1l6lfD2UsDdc/WOXsEYddhoOdBvMVswl+M+5dTNvl0/fJ iTAH3lN/7oxV+zzI97yqsSHLbl+2wr77WLY/crzWMlthQH3P0XBcc/VXx9H8eKlEfBU6 KdVgRVGgnVO8ekdR+0djDpG6XeMV80tIQF9IRLsiEErChpOeCH6YhlAUgUTqpXhCMeGq /x3q+IOyFX0oVthN/1HyivnrbCrTuQev/vcVM6jmpwUclA+BRkDWEHikIl1cOoZd/xdh jpeqvuRWXgjiO4v73WfmYOk+U6HyJqDdnz1vX60icXeWUOL+gkGiTHoa7V+7F0HhxIG8 lQ0Q== X-Gm-Message-State: AOJu0YxUBUH3zYe7OGR4DqlOFayLSefcP6VlutYR54HeSMR6twsySHKv OINhfhaWG/OAJYita8/zQoNv6kRIOyJD1rfPQjEWEvRn+s01tFTygypCAP2RyCS76XafH5Qo3U/ W1/NmTxy7ZmWI3R9ku49JSVwhFJ1pp/MmZ4x/fVmzief4P9zkvtcG2Fji3UWMV+Pc X-Received: by 2002:aa7:8512:0:b0:6d9:beca:3a40 with SMTP id v18-20020aa78512000000b006d9beca3a40mr47645pfn.56.1704341431767; Wed, 03 Jan 2024 20:10:31 -0800 (PST) X-Received: by 2002:aa7:8512:0:b0:6d9:beca:3a40 with SMTP id v18-20020aa78512000000b006d9beca3a40mr47642pfn.56.1704341431443; Wed, 03 Jan 2024 20:10:31 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231221032147.434647-1-kai.heng.feng@canonical.com> In-Reply-To: From: Kai-Heng Feng Date: Thu, 4 Jan 2024 12:10:19 +0800 Message-ID: Subject: Re: [PATCH v2] mmc: sdhci-pci-gli: GL975x: Mask rootport's replay timer timeout during suspend To: Ulf Hansson Cc: adrian.hunter@intel.com, Victor Shih , Ben Chuang , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 3, 2024 at 6:53=E2=80=AFPM Ulf Hansson = wrote: > > On Thu, 21 Dec 2023 at 04:23, Kai-Heng Feng = wrote: > > > > Spamming `lspci -vv` can still observe the replay timer timeout error > > even after commit 015c9cbcf0ad ("mmc: sdhci-pci-gli: GL9750: Mask the > > replay timer timeout of AER"), albeit with a lower reproduce rate. > > > > Such AER interrupt can still prevent the system from suspending, so let > > root port mask and unmask replay timer timeout during suspend and > > resume, respectively. > > > > Cc: Victor Shih > > Cc: Ben Chuang > > Signed-off-by: Kai-Heng Feng > > --- > > v2: > > - Change subject to reflect it works on GL9750 & GL9755 > > - Fix when aer_cap is missing > > > > drivers/mmc/host/sdhci-pci-core.c | 2 +- > > drivers/mmc/host/sdhci-pci-gli.c | 55 +++++++++++++++++++++++++++++-- > > drivers/mmc/host/sdhci-pci.h | 1 + > > 3 files changed, 55 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci= -pci-core.c > > index 025b31aa712c..59ae4da72974 100644 > > --- a/drivers/mmc/host/sdhci-pci-core.c > > +++ b/drivers/mmc/host/sdhci-pci-core.c > > @@ -68,7 +68,7 @@ static int sdhci_pci_init_wakeup(struct sdhci_pci_chi= p *chip) > > return 0; > > } > > > > -static int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip) > > +int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip) > > { > > int i, ret; > > > > diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-= pci-gli.c > > index 77911a57b12c..54943e9df835 100644 > > --- a/drivers/mmc/host/sdhci-pci-gli.c > > +++ b/drivers/mmc/host/sdhci-pci-gli.c > > @@ -1429,6 +1429,55 @@ static int sdhci_pci_gli_resume(struct sdhci_pci= _chip *chip) > > return sdhci_pci_resume_host(chip); > > } > > > > +#ifdef CONFIG_PCIEAER > > +static void mask_replay_timer_timeout(struct pci_dev *pdev) > > +{ > > + struct pci_dev *parent =3D pci_upstream_bridge(pdev); > > + u32 val; > > + > > + if (!parent || !parent->aer_cap) > > Wouldn't it be more correct to use pci_aer_available(), rather than > just checking the aer_cap? pci_aer_available() is more of a global check, so checking aer_cap is still required for the device. > > If pci_aer_available() can be used, we wouldn't even need the stubs as > the is already stubs for pci_aer_available(). A helper that checks both aer_cap and pci_aer_available() can be added for such purpose, but there aren't many users of that. Kai-Heng > > > + return; > > + > > + pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MAS= K, &val); > > + val |=3D PCI_ERR_COR_REP_TIMER; > > + pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MA= SK, val); > > +} > > + > > +static void unmask_replay_timer_timeout(struct pci_dev *pdev) > > +{ > > + struct pci_dev *parent =3D pci_upstream_bridge(pdev); > > + u32 val; > > + > > + if (!parent || !parent->aer_cap) > > + return; > > + > > + pci_read_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK,= &val); > > + val &=3D ~PCI_ERR_COR_REP_TIMER; > > + pci_write_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK= , val); > > +} > > +#else > > +static inline void mask_replay_timer_timeout(struct pci_dev *pdev) { } > > +static inline void unmask_replay_timer_timeout(struct pci_dev *pdev) {= } > > +#endif > > + > > +static int sdhci_pci_gl975x_suspend(struct sdhci_pci_chip *chip) > > +{ > > + mask_replay_timer_timeout(chip->pdev); > > + > > + return sdhci_pci_suspend_host(chip); > > +} > > + > > +static int sdhci_pci_gl975x_resume(struct sdhci_pci_chip *chip) > > +{ > > + int ret; > > + > > + ret =3D sdhci_pci_gli_resume(chip); > > + > > + unmask_replay_timer_timeout(chip->pdev); > > + > > + return ret; > > +} > > + > > static int gl9763e_resume(struct sdhci_pci_chip *chip) > > { > > struct sdhci_pci_slot *slot =3D chip->slots[0]; > > @@ -1547,7 +1596,8 @@ const struct sdhci_pci_fixes sdhci_gl9755 =3D { > > .probe_slot =3D gli_probe_slot_gl9755, > > .ops =3D &sdhci_gl9755_ops, > > #ifdef CONFIG_PM_SLEEP > > - .resume =3D sdhci_pci_gli_resume, > > + .suspend =3D sdhci_pci_gl975x_suspend, > > + .resume =3D sdhci_pci_gl975x_resume, > > #endif > > }; > > > > @@ -1570,7 +1620,8 @@ const struct sdhci_pci_fixes sdhci_gl9750 =3D { > > .probe_slot =3D gli_probe_slot_gl9750, > > .ops =3D &sdhci_gl9750_ops, > > #ifdef CONFIG_PM_SLEEP > > - .resume =3D sdhci_pci_gli_resume, > > + .suspend =3D sdhci_pci_gl975x_suspend, > > + .resume =3D sdhci_pci_gl975x_resume, > > #endif > > }; > > > > diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.= h > > index 153704f812ed..19253dce687d 100644 > > --- a/drivers/mmc/host/sdhci-pci.h > > +++ b/drivers/mmc/host/sdhci-pci.h > > @@ -190,6 +190,7 @@ static inline void *sdhci_pci_priv(struct sdhci_pci= _slot *slot) > > } > > > > #ifdef CONFIG_PM_SLEEP > > +int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip); > > int sdhci_pci_resume_host(struct sdhci_pci_chip *chip); > > #endif > > int sdhci_pci_enable_dma(struct sdhci_host *host); > > Kind regards > Uffe