Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4519411pxv; Tue, 6 Jul 2021 02:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKXtv39nsjF0Qt+4e2/i/r1z3rJndcHMFPiP9fABSGXozc0E5DgmTdCh2h5TtldNPlP0Ds X-Received: by 2002:a05:6402:487:: with SMTP id k7mr21661789edv.315.1625565491896; Tue, 06 Jul 2021 02:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625565491; cv=none; d=google.com; s=arc-20160816; b=IQjO9l/dhwzOZE2WvaCwSBrdKLkbbDl+LS4kN+AS4PCX3/NNo9SHEzhVyjEXaqzHKx DT6aWY/BNsm3VdwCVqSJZzIqe9Tpt1f192obgi4T2vqf8E9mgaJR8D3Nhe4OZSq/1jhe +S4HxKhmjklzk3It9H+Tz5iK7EGvJW1sn3RaV0PrhjnLYcLKgNjmC9AZx9SNMh2emqAL SrZrvgPZibSGdEnTfJkxQYisFj6D2dVB4kN7oSARnRu0gijYw0l4Mt8xAPqRNcN4xF86 2ifIg7ww9qS4PsyDnqfTbg2QFdurjG5NT0GxFMM/T9WMbciST2XN+p8CMRSM87pj9Zl7 +aMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=g0tC4MUw9+SlqVFCUMsi7lqIq0CVDtng7PTCdgO5oEU=; b=YhVwYNQVOJP0k5eK2ONYdV1Tceh0FotmBC/ldeoceJL2TvebdhX3MbB/UzIqjNBq3P o/IM8U1cDtgcBUbzA4Z4tS6KGYkeB4vPRt308IAgn9lwzqM5Q4ZeJrFzWNJBmEggCLbC SQCo+NjoaN21FiXY3C5VaCnQ0MbXnEMMhLgul78uBTLEwUqG5GHcn3eHzNWMg5IoWu4u qkHtYKJspj7x1NtaksEorMN8eWP8QDD3S+HTgS8NllA0esCCletWDeaPHRbUI9yxTB9x QZqBlK8gw2/UWyZXd+qPKHIrJdD09vZTHXBT1YUUxlK4gaFnt/Y2M3C9JAR392ihlivr Gn9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=S+dyx3xg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si13359775ejv.450.2021.07.06.02.57.48; Tue, 06 Jul 2021 02:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=S+dyx3xg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbhGFJ4s (ORCPT + 99 others); Tue, 6 Jul 2021 05:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbhGFJ4r (ORCPT ); Tue, 6 Jul 2021 05:56:47 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14997C06175F for ; Tue, 6 Jul 2021 02:54:09 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id v5so25345176wrt.3 for ; Tue, 06 Jul 2021 02:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=g0tC4MUw9+SlqVFCUMsi7lqIq0CVDtng7PTCdgO5oEU=; b=S+dyx3xgcpj4V3ANCC/A6Amv96T6RfsrHnI9Uz0FsZM7M1pQr864n7wdcaBDSg5Vbd lSGSdbe5aZ7zVjxxd8F3zNng8k7IdH9JrfTHCb6mrD9gTr8Xuf7RacFgLdU5FwOZMpDE /5SWAXvxFc6XhtmPg+H9EO6ov+vEG+E41XGQweMOGVHNECJ6mUL4VfMJ8L1FScR+leFe 0WRWQ4MGc4yS43o/cqzD1xSwhjXiUjKMSdBvuTAKvIfDabwOnMUx3BlyDP7xrVSCBsPl YoqCvWxCZ8hn7ZglybVg4QTJlaFVIBsgzc8hxEma6a1XaJhJr1SyqaPdJ1wk96tEEFo/ s4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=g0tC4MUw9+SlqVFCUMsi7lqIq0CVDtng7PTCdgO5oEU=; b=tmF0T7LLBQyZitutOsoDb7Ayc3dEzxy8fT9m5hjgNxSgVoSYPNG0eR6QIeWVyMfr+0 dJpVVZGsApOKG7Rmdn3CnJGEW2Iv3dSvqAEBbKT0y7v7U78PZrNyizDPlLz5vl/1GETg NJV0lpA332TVWk4Y2kzzVPhsdkNe1uaDPgddUtvsiDfhkPg5nS9efQ6n68nzK2QYbpGV +GYy0pnbyuVwmC1TLqPtle/waco9QRcxn5ISIW9Q94vNAy7bamJ971KkREyB+2hmcfA3 vD0sWV9V+jJDt2dhv9BMMnLTiow+7tWI61iy941fsTclGvaGVb4M2IcbhgUcqwfeKVak 39vA== X-Gm-Message-State: AOAM530d1pX0eftbZKeVhNvUULjv/LQOU1Jc6vEk5pgkPA/1ReBYgifm ZnQcRx8n0n2s0ROcuObCxzc1HQ== X-Received: by 2002:adf:fb51:: with SMTP id c17mr21148359wrs.106.1625565246820; Tue, 06 Jul 2021 02:54:06 -0700 (PDT) Received: from ?IPv6:2001:861:44c0:66c0:7257:ae4e:a17f:5800? ([2001:861:44c0:66c0:7257:ae4e:a17f:5800]) by smtp.gmail.com with ESMTPSA id e23sm2264839wme.31.2021.07.06.02.54.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 02:54:06 -0700 (PDT) Subject: Re: [PATCH 0/4] PCI: replace dublicated MRRS limit quirks To: Art Nikpal , Huacai Chen Cc: =?UTF-8?B?6ZmI5Y2O5omN?= , Bjorn Helgaas , Yue Wang , Kevin Hilman , Lorenzo Pieralisi , Rob Herring , Krzysztof Wilczynski , Jerome Brunet , Christian Hewitt , Martin Blumenstingl , PCI , linux-arm-kernel , "open list:ARM/Amlogic Meson..." , LKML , Artem Lapkin , Nick Xie , Gouwa Wang References: <20210701154634.GA60743@bjorn-Precision-5520> <67a9e1fa.81a9.17a64c8e7f7.Coremail.chenhuacai@loongson.cn> From: Neil Armstrong Organization: Baylibre Message-ID: <1271fa28-dddd-01a3-5ad5-e3b4898f5482@baylibre.com> Date: Tue, 6 Jul 2021 11:54:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 06/07/2021 08:06, Art Nikpal wrote: >> But, Loongson platform has newer revision of hardware, and the MRRS >> quirk has changed, please see: >> https://patchwork.kernel.org/project/linux-pci/list/?series=509497 >> Huacai > > OK! tnx for information ! maybe we can cooperate and make one > universal quirk for all In their Designware PCIe controller driver, amlogic sets the Max_Payload_Size & Max_Read_Request_Size to 256: https://elixir.bootlin.com/linux/latest/source/drivers/pci/controller/dwc/pci-meson.c#L260 https://elixir.bootlin.com/linux/latest/source/drivers/pci/controller/dwc/pci-meson.c#L276 in their root port PCIe Express Device Control Register. Looking at the Synopsys DW-PCIe Databook, Max_Payload_Size & Max_Read_Request_Size are used to decompose into AXI burst, but it seems the Max_Payload_Size & Max_Read_Request_Size are set by default to 512 but the internal Max_Payload_Size_Supported is set to 256, thus changing these values to 256 at runtime to match and optimize bandwidth. It's said, "Reducing Outbound Decomposition" : - "Ensure that your application master does not generate bursts of size greater than or equal to Max_Payload_Size" - "Program your PCIe system with a larger value of Max_Payload_Size without exceeding Max_Payload_Size_Supported" - "Program your PCIe system with a larger value of Max_Read_Request without exceeding Max_Payload_Size_Supported: So leaving 512 in Max_Payload_Size & Max_Read_Request leads to Outbound Decomposition which decreases PCIe link and degrades the AXI bus by doubling the bursts, leading to this fix to avoid overflowing the AXI bus. So it seems to be still needed, I assume this *should* be handled in the core somehow to propagate these settings to child endpoints to match the root port Max_Payload_Size & Max_Read_Request sizes. Maybe by adding a core function to set these values instead of using the dw_pcie_find_capability() & dw_pcie_write/readl_dbi() helpers and set a state on the root port to propagate the value ? Neil > > On Tue, Jul 6, 2021 at 9:36 AM Huacai Chen wrote: >> >> Hi, Art, >> >> On Mon, Jul 5, 2021 at 4:35 PM Art Nikpal wrote: >>> >>>> Does that means keystone and Loongson has the same MRRS problem? And what should I do now? >>> >>> Look like yes ! and amlogic has the same problem. >>> I think somebody need to rewrite it all to one common quirk for this problem. >>> >>> If no one has any objection, I can try to remake it again. >> But, Loongson platform has newer revision of hardware, and the MRRS >> quirk has changed, please see: >> https://patchwork.kernel.org/project/linux-pci/list/?series=509497 >> >> Huacai >>> >>> On Fri, Jul 2, 2021 at 9:15 AM 陈华才 wrote: >>>> >>>> Hi, Bjorn, >>>> >>>> > -----原始邮件----- >>>> > 发件人: "Bjorn Helgaas" >>>> > 发送时间: 2021-07-01 23:46:34 (星期四) >>>> > 收件人: "Artem Lapkin" >>>> > 抄送: narmstrong@baylibre.com, yue.wang@Amlogic.com, khilman@baylibre.com, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, jbrunet@baylibre.com, christianshewitt@gmail.com, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, art@khadas.com, nick@khadas.com, gouwa@khadas.com, "Huacai Chen" >>>> > 主题: Re: [PATCH 0/4] PCI: replace dublicated MRRS limit quirks >>>> > >>>> > [+cc Huacai] >>>> > >>>> > On Sat, Jun 19, 2021 at 02:39:48PM +0800, Artem Lapkin wrote: >>>> > > Replace dublicated MRRS limit quirks by mrrs_limit_quirk from core >>>> > > * drivers/pci/controller/dwc/pci-keystone.c >>>> > > * drivers/pci/controller/pci-loongson.c >>>> > >>>> > s/dublicated/duplicated/ (several occurrences) >>>> > >>>> > Capitalize subject lines. >>>> > >>>> > Use "git log --online" to learn conventions and follow them. >>>> > >>>> > Add "()" after function names. >>>> > >>>> > Capitalize acronyms appropriately (NVMe, MRRS, PCI, etc). >>>> > >>>> > End sentences with periods. >>>> > >>>> > A "move" patch must include both the removal and the addition and make >>>> > no changes to the code itself. >>>> > >>>> > Amlogic appears without explanation in 2/4. Must be separate patch to >>>> > address only that specific issue. Should reference published erratum >>>> > if possible. "Solves some issue" is not a compelling justification. >>>> > >>>> > The tree must be consistent and functionally the same or improved >>>> > after every patch. >>>> > >>>> > Add to pci_ids.h only if symbol used more than one place. >>>> > >>>> > See >>>> > https://lore.kernel.org/r/20210701074458.1809532-3-chenhuacai@loongson.cn, >>>> > which looks similar. Combine efforts if possible and cc Huacai so >>>> > you're both aware of overlapping work. >>>> > >>>> > More hints in case they're useful: >>>> > https://lore.kernel.org/linux-pci/20171026223701.GA25649@bhelgaas-glaptop.roam.corp.google.com/ >>>> > >>>> > > Both ks_pcie_quirk loongson_mrrs_quirk was rewritten without any >>>> > > functionality changes by one mrrs_limit_quirk >>>> Does that means keystone and Loongson has the same MRRS problem? And what should I do now? >>>> >>>> Huacai >>>> > > >>>> > > Added DesignWare PCI controller which need same quirk for >>>> > > * drivers/pci/controller/dwc/pci-meson.c (PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3) >>>> > > >>>> > > This quirk can solve some issue for Khadas VIM3/VIM3L(Amlogic) >>>> > > with HDMI scrambled picture and nvme devices at intensive writing... >>>> > > >>>> > > come from: >>>> > > * https://lore.kernel.org/linux-pci/20210618063821.1383357-1-art@khadas.com/ >>>> > > >>>> > > Artem Lapkin (4): >>>> > > PCI: move Keystone and Loongson device IDs to pci_ids >>>> > > PCI: core: quirks: add mrrs_limit_quirk >>>> > > PCI: keystone move mrrs quirk to core >>>> > > PCI: loongson move mrrs quirk to core >>>> > > >>>> > > -- >>>> > > 2.25.1 >>>> > > >>>> >>>> >>>>