Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2110C433FE for ; Thu, 16 Dec 2021 14:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237843AbhLPOTH convert rfc822-to-8bit (ORCPT ); Thu, 16 Dec 2021 09:19:07 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:60973 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbhLPOTH (ORCPT ); Thu, 16 Dec 2021 09:19:07 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MCsDe-1mp6Aj1WF6-008vRY; Thu, 16 Dec 2021 15:19:05 +0100 Received: by mail-wr1-f49.google.com with SMTP id e5so11065576wrc.5; Thu, 16 Dec 2021 06:19:05 -0800 (PST) X-Gm-Message-State: AOAM532Og1NAamdQ4IykJsrGX5en4sWA919JvtSJzq74nhr5o0GvmUir dHY5M61u632Bkn2nif7CbB9QpMIFr4KpamBoBJc= X-Google-Smtp-Source: ABdhPJxmplO/8wUtDmbZb8q9bqy7ZOfHV5yg368TQTzX4lBN+OEsoFiUjwpCE3vTs4ls9wlTx+wNiOOu6o9NNRcFeqQ= X-Received: by 2002:a05:6000:52:: with SMTP id k18mr9356273wrx.192.1639664344795; Thu, 16 Dec 2021 06:19:04 -0800 (PST) MIME-Version: 1.0 References: <20210925203224.10419-1-sergio.paracuellos@gmail.com> <20210925203224.10419-6-sergio.paracuellos@gmail.com> <67687e579e633d42dc501cfb6746c1cb9f600112.camel@mengyan1223.wang> <6ee31420-ef67-471e-a924-a0158b4a9428@www.fastmail.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 16 Dec 2021 15:18:49 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 5/6] MIPS: implement architecture-specific 'pci_remap_iospace()' To: Jiaxun Yang Cc: Arnd Bergmann , Xi Ruoyao , Sergio Paracuellos , Thomas Bogendoerfer , Rob Herring , Catalin Marinas , Liviu Dudau , Bjorn Helgaas , Matthias Brugger , Greg Kroah-Hartman , "linux-mips@vger.kernel.org" , linux-pci , linux-staging@lists.linux.dev, NeilBrown , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Provags-ID: V03:K1:IgD0XB8DIUQjREsvuF1C3HD3944VUT61B2OriSnVMbiFXOdkvap O1lFdYUXI7kaNNJMBs5ZtyZHev1LquHSgazOunDmIgdwooZ8FOabTNhviJpzn22oMbsh7ga VVSOzehekRPVU1ka/2LvuUIFyd5YuBwuHQySwRtbWoBe3xLMwcQOnXW5AG+kZX3PIDA/IYT NqkgirYoJpAoN2Rmkj9mA== X-UI-Out-Filterresults: notjunk:1;V03:K0:lDzxYfROAWU=:V6SAkS6NSz6czEHRo1NFM5 zbjpP9ugIGMv1E9M3UMxd5h3U6u2E3INp75GevJKkI1k/BnSRBvuPQp1TVQShMu6tPjgvqwkl Meyriy3oznMWAfJEPJPF+WO8MmUxS4ObmkoDSPANtquK8/PwOTaY1AAeLOqf/Wy4C6/er9JYy A+K/kSllzzRWMgh0KEAERE42kAz/JrNGqvJbAZBXI0wGClFrM9wOPmp579BFFG+8iNUwwWlPP 4tQREkhLITgAmWg8FGgLpLenuuppNvx7LBKzKrXZHvO494/4VkNKkzKF8ZCrQKo2egOEEUtNU AQdI5PfG+J2xIOC+yEo71xW7v28uP8vkTkdu2C5f3pLNWj3F4TANAfTZjxDzYFW5g7e6fHVgq ONACbz6HJN/y7WGxRiOtTTQxg+0zzUCWhNeep5D1Ott12q5GgwdkUXSjKkXSNA41wgGofV1X4 qAXRE1ybP43WGnishkx+WeMKZ4NwJDL3OAqQSVclinp79bxWRmNzgexSVM5bNg1cWlxO7B2fo Ve4RNfQtvFlWp7RZKebYJabTSdu3jvAden6RRutoiFzDeYMwNZpzyRiMqXd2HPIoZeWniqjXB EEMVCNimWGDP+MBw1nfRwHph0f8hSI6+ERToDZiQkCMZhBgMZ+KvEDz7GQtfvFw9sQA5nn6f4 7DGoa71ER1og0ReN/c4q23ttyLUk2ZtaXeuB7qCkSpJpI2HkMRHgAytLRiAQXuzfyYEFZURUZ 9MWb7XzknP4mPQx3mzTZVG6EbPhsGJH0NCdZtCBNXimulHGkfFMjqqRX+/uE+Sh3x3s+70SZ9 Gn2/eFbWhgG1O4DDc+crRCuyvhlfbH5CR9lVIXVXFtT+1lTLSg= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 16, 2021 at 3:14 PM Jiaxun Yang wrote: > 在 2021/12/16 13:50, Arnd Bergmann 写道: > > On Thu, Dec 16, 2021 at 2:07 PM Jiaxun Yang wrote: > >> 在2021年12月16日十二月 上午11:44,Xi Ruoyao写道: > >> Another way could be keeping a linked list about PIO->PHYS mapping instead of using the single io_port_base variable. > > I think that would add a lot of complexity that isn't needed here. Not > > sure if all MIPS CPUs > > can do it, but the approach used on Arm is what fits in best with the > > PCI drivers, these > > reserve a virtual address range for the ports, and ioremap the > > physical addresses into > > the PIO range according to the mapping. > > Yes, the Arm way was my previous approach when introducing PCI IO map > for Loongson. > > It got refactored by this patch as TLB entries are expensive on MIPS, > also the size of IO range doesn't always fits a page. Are PIO accesses common enough that the TLB entry makes a difference? I would imagine that on most systems with a PCI bus, there is not even a single device that exposes an I/O resource, and even on those devices that do, the kernel drivers tend to pick MMIO whenever both are available. Arnd