Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp505973lqb; Thu, 29 Feb 2024 07:14:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWBIODnVtWtmUXMOBIadBz3coHAq2JvcCtoO4zA0RwdEZ+Y3cAoKJU6o4FrZ4rZrEv0MusoGmmX80wr/qM7QjhPNn44SIvnRNRlFAzLMQ== X-Google-Smtp-Source: AGHT+IGPoDA5bR3VS683KnPWuCXLBFtn58KxrfGVq/Vop0UccDVTGIvswtVUECJfgIQoDv3zjq3N X-Received: by 2002:a05:6a21:3405:b0:1a0:ecb4:d79d with SMTP id yn5-20020a056a21340500b001a0ecb4d79dmr2536409pzb.4.1709219650189; Thu, 29 Feb 2024 07:14:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709219650; cv=pass; d=google.com; s=arc-20160816; b=XK7E3O2nJVOr8uShsveXwVs/0YTHS6X6eAQ4M5ywyvrQmNOzwqDPiOjoS10meK5uIP UaduBRB2bd9aEZup6mPMA54IO8v8jrCcbsUGqitD23st+bKd4o3Sdpm981MOW9VcQFsT Gtg3bHZSENpr+WexF7WOaUm3mi1AfloWqy4Vsln/DfdJ662yf9JT96GeaWWgxzpuvfOk 8Q+sNikrHjlhiZDo8R9Oi6lZ0UABFlE2JZVQurBdsg0L6bbRyHz2DgKmcoTrDnaaen/y gXUNS1ryZ+0zGC7dXHSrhnlrni2v4XTkLG1IdNTRjiyxxfyEnt4RIISRQV+AJs+e356E /qNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=s2Da8QpzYGJnE3+m5b3M6LDX5+HGh2yCkMufQF1zdzY=; fh=TZR1PWRcDg3rbQgaLqPirasuuIjKc41nHmrDKouwvSY=; b=dfJ94MlWuc/Or+eU+DrrJXAv4J7/AY7UaABLGjft1Jl7623NJgyX7uJgQAbVLD2WI0 6QvEFZNRXRZecbyrKgN9C4jjUPhHUjehysRsyxgpCWhr7P4B0ySZpaRJcA7T8NO+MSMX UTZFk+pjxz/RnB2mTbu8Cmku6gv/ZzaN7D3fm96EdKkXfvgWXByHZy8LW4gcte2L8h5i vHNG0QJoHEiZ/2VG4xq+Q90+W/+3Ta6XaeuVIEr7I64VaSoYu0N6rFHIbT1LXxBERLyP 3XGUF6UAdlkK7PENUFXF9tgwjdD7gQFylOrjLnRnPwIFe0Y80miyPnbpqr0U8bXy/q8a gPAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qbE142na; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q196-20020a632acd000000b005b95ee3edc6si1549499pgq.628.2024.02.29.07.14.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 07:14:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86896-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=@kernel.org header.s=k20201202 header.b=qbE142na; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 83FBAB26301 for ; Thu, 29 Feb 2024 15:09:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C46141448D7; Thu, 29 Feb 2024 15:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qbE142na" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D42D7141995; Thu, 29 Feb 2024 15:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709219331; cv=none; b=ob++XbgfYLMCWtYvz0q3r2v8ZLBhRbAuhgf/cbPzSGKmRYJG99tc+/9IFO8HtvXX3rGG0wmxJpJRMNjXKB+M2twec0+8+/P01Wl+DT6+fiY3ZmXj/zEggwpc59g9+EXGtBPu5wauslAsKjyq6tQeL5RnO0j4OdYZCvxu3BH52pI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709219331; c=relaxed/simple; bh=1Zyw6/15dc8py4UHaheILppIr29j2DVuoJ+GnLmxmI0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X9XJiR3pC9M4eo+I2oYI5kOqL8g/TeCyy3VLvHFl3GyvsQopbtVY6d8G9W20DJ7ufg/uBiRgo2mV4xJwdftuYY9AzyA4/hEFWG9XA9x76yd6BYciaOQjGaGsUN7FuCe7Y3ekJkUIBzHlyaYsp2w5fkZg5PkSvb0vvmqLnHE2ILk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qbE142na; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C5DC43394; Thu, 29 Feb 2024 15:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709219331; bh=1Zyw6/15dc8py4UHaheILppIr29j2DVuoJ+GnLmxmI0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qbE142naa92rUgW7jL/DgquUxvIA8orHcRMgUTDyddce65pfDrm5hqA2gW1XhNEW1 M9mhn4t1LH5FmGr+9vxIZj3lWezTgwutUTT9MFvgOEbxD3MUXBEe2+gj4i08VwWHnU AZRLl0FrHrOBNbBj3B9joRiitw1QbIUaM58sENEelec+3rzJe+v9gtvOJ1DxJBcLVC Q992XY0FVty+LT18+GMGFLjH+GGFEJ1RwHcuUU8sIFGQGNxQ6B3B/4vFkw5Aq7alGS 57Xq1IPbNKu1IcM0c12i1Q/3MttMRGg6tdlxmEibgCn3P5lMdEJsiugpx10dhXtF+l hPvdF3nQRkfWg== Date: Thu, 29 Feb 2024 16:08:43 +0100 From: Lorenzo Pieralisi To: Minda Chen Cc: Conor Dooley , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Thomas Gleixner , Daire McNamara , Emil Renner Berthing , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie Subject: Re: [PATCH v15,RESEND 22/23] PCI: starfive: Offload the NVMe timeout workaround to host drivers. Message-ID: References: <20240227103522.80915-1-minda.chen@starfivetech.com> <20240227103522.80915-23-minda.chen@starfivetech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240227103522.80915-23-minda.chen@starfivetech.com> On Tue, Feb 27, 2024 at 06:35:21PM +0800, Minda Chen wrote: > From: Kevin Xie > > As the Starfive JH7110 hardware can't keep two inbound post write in > order all the time, such as MSI messages and NVMe completions. If the > NVMe completion update later than the MSI, an NVMe IRQ handle will miss. Please explain what the problem is and what "NVMe completions" means given that you are talking about posted writes. If you have a link to an erratum write-up it would certainly help. This looks completely broken to me, if the controller can't guarantee PCIe transactions ordering it is toast, there is not even a point considering mainline merging. > As a workaround, we will wait a while before going to the generic > handle here. > > Verified with NVMe SSD, USB SSD, R8169 NIC. > The performance are stable and even higher after this patch. I assume this is a joke even though it does not make me laugh. Thanks, Lorenzo > > Signed-off-by: Kevin Xie > Signed-off-by: Minda Chen > --- > drivers/pci/controller/plda/pcie-plda-host.c | 12 ++++++++++++ > drivers/pci/controller/plda/pcie-plda.h | 1 + > drivers/pci/controller/plda/pcie-starfive.c | 1 + > 3 files changed, 14 insertions(+) > > diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c > index a18923d7cea6..9e077ddf45c0 100644 > --- a/drivers/pci/controller/plda/pcie-plda-host.c > +++ b/drivers/pci/controller/plda/pcie-plda-host.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > > #include "pcie-plda.h" > > @@ -44,6 +45,17 @@ static void plda_handle_msi(struct irq_desc *desc) > bridge_base_addr + ISTATUS_LOCAL); > status = readl_relaxed(bridge_base_addr + ISTATUS_MSI); > for_each_set_bit(bit, &status, msi->num_vectors) { > + /* > + * As the Starfive JH7110 hardware can't keep two > + * inbound post write in order all the time, such as > + * MSI messages and NVMe completions. > + * If the NVMe completion update later than the MSI, > + * an NVMe IRQ handle will miss. > + * As a workaround, we will wait a while before > + * going to the generic handle here. > + */ > + if (port->msi_quirk_delay_us) > + udelay(port->msi_quirk_delay_us); > ret = generic_handle_domain_irq(msi->dev_domain, bit); > if (ret) > dev_err_ratelimited(dev, "bad MSI IRQ %d\n", > diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h > index 04e385758a2f..feccf285dfe8 100644 > --- a/drivers/pci/controller/plda/pcie-plda.h > +++ b/drivers/pci/controller/plda/pcie-plda.h > @@ -186,6 +186,7 @@ struct plda_pcie_rp { > int msi_irq; > int intx_irq; > int num_events; > + u16 msi_quirk_delay_us; > }; > > struct plda_event { > diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/controller/plda/pcie-starfive.c > index 9bb9f0e29565..5cfc30572b7f 100644 > --- a/drivers/pci/controller/plda/pcie-starfive.c > +++ b/drivers/pci/controller/plda/pcie-starfive.c > @@ -391,6 +391,7 @@ static int starfive_pcie_probe(struct platform_device *pdev) > > plda->host_ops = &sf_host_ops; > plda->num_events = PLDA_MAX_EVENT_NUM; > + plda->msi_quirk_delay_us = 1; > /* mask doorbell event */ > plda->events_bitmap = GENMASK(PLDA_INT_EVENT_NUM - 1, 0) > & ~BIT(PLDA_AXI_DOORBELL) > -- > 2.17.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv