Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2482347pxj; Sat, 19 Jun 2021 13:47:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybo/UuMSTrOxgcwJ7iYQ2BpxIVuxufz8R6x1crkgl/Qgdv+PZ4fz4rlpKozkc/jAT5Y+4g X-Received: by 2002:a17:906:7302:: with SMTP id di2mr16747852ejc.409.1624135632440; Sat, 19 Jun 2021 13:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624135632; cv=none; d=google.com; s=arc-20160816; b=Gq5UZXjzJ3Lkr6zinDg/KA6oevBhKM4IqhDa0rYKHPk7ivlekhWy0IwVx3dh1joMeq u1lxdqj1+fH2LZJcWECwuW2Yyk/OYGC0ra/fIrwC3QRqBFLlmwptD1pjraKG/R7CWLHk lEXgnjdQaTPIJyeHnF4elv4cC8ZOQrVUHp/4w4+duBle7VR3AXJrd6xtXAjL/5Oi84gg lkyNbNYeKeczn2lyFcFAeBWIDoWaRpZj4e+amoJ9wVBXAb3im+GArqf5i861HERxwcJ0 JVYyOhjHmJlULJJtIQP5IDG8eul6luq/uIDA0OHESI7FGvKGOsWEItm1BRlKcAKZKIT6 4frw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tYyzt4cNti3kmXkoi7E1mYGxs62FMf8+WgvjuaIB/pc=; b=kyZiPlnVEog/pTEaRHg9FY474tjyWRVhjd5aqA+qOQ4t1P2ujAGqpNw9Qg3bllpoCT nrod7rZ7Ecy4nIP+FYxjGlwUnYIsPe50OqmDksoHAleqRyk0neWzJmS/Ux3Q5Ue5Sw9T g2Msf8Yqt6MzSluXLYeKzmA3apxZ7DAem0c/WZlbwhzmHuS2vW7lXpRmQVMzEANr5p71 69pdhzlAlt6NsnfLIvejKIfsiAf+mIxRxp1A/V5hALxotA838ISU6SwRyM0+Ra++XIjx ezx0zoBLtdPgjEYRMLVpKgxTmidonglES5iAAraU7Kbcgdd0OXrNjiPHfmZBaEeQM5ph PXww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PNJpJukr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hx5si5338686ejc.283.2021.06.19.13.46.50; Sat, 19 Jun 2021 13:47:12 -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=@redhat.com header.s=mimecast20190719 header.b=PNJpJukr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232959AbhFSQhW (ORCPT + 99 others); Sat, 19 Jun 2021 12:37:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50021 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234001AbhFSQhW (ORCPT ); Sat, 19 Jun 2021 12:37:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624120510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tYyzt4cNti3kmXkoi7E1mYGxs62FMf8+WgvjuaIB/pc=; b=PNJpJukrqsv+jVcYaF1OF0SIN0PxDNxHHFX0DBRe5FHzYs7OeMYAcxEHIO6Y8oKtJBpvXu bVX6hUS0oNNzkyx0UGeMf48yB5tZWd32K9xEAUPK5AI+wnLrnRrhLj2heWhzZZ5MgNYjXw arNunInn0xzWuB2i/gVzfOPmGVu3Mi4= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-58-DPDiRgvHO7ynpNIT14Sf_Q-1; Sat, 19 Jun 2021 12:35:08 -0400 X-MC-Unique: DPDiRgvHO7ynpNIT14Sf_Q-1 Received: by mail-vs1-f71.google.com with SMTP id 2-20020a6715020000b0290265763e68acso2574607vsv.5 for ; Sat, 19 Jun 2021 09:35:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tYyzt4cNti3kmXkoi7E1mYGxs62FMf8+WgvjuaIB/pc=; b=FLb+L5XCkmah8WF34Ekyo9fW8an/x/Y8DkGnmlcmMoII70wIPJZXjRs8l6MihFPcmj C76r6Iqwf3YMrmPcY87yCOdNDARtA69V9NNezZeMpdHc7pNIJC6yvkW5u++US5iXVi+8 KgmbxmjUopNRfBWejCKaM/9LJ4nRXk0Ry/F2zn25mVV3qKsyUkJyiYGM2td1HM5tSbLS JOXa4Bxg8mED04Fv5e03FK+Mv2fWGZsMaQ5QbB4EX1wPbYjVlLEe3hzs4uFiiV+V+BJA plHXP97y1LlPtI5HQMvLSFgPuIH+NHKX0o74rzA/KlEOfp/4xWDEkQ/w3LMrOFS2On6A yVCA== X-Gm-Message-State: AOAM531/wfp0xHoQ/pdWMTbHN9EOoWU95QI13qmEiR8lM8IIW2FLVlE6 OaxsYjQGAJAGpkEKOpyqnitOA5hm4Q9PEo6v1WCveaEGbwAhxMA9wP8UA4vlGsBzX2gwhltrXRb zSTsWyZA+DTA3cimH5XRZw7+7IQTQjI76QTzVYAEU X-Received: by 2002:a9f:3743:: with SMTP id a3mr17073586uae.92.1624120508224; Sat, 19 Jun 2021 09:35:08 -0700 (PDT) X-Received: by 2002:a9f:3743:: with SMTP id a3mr17073574uae.92.1624120508072; Sat, 19 Jun 2021 09:35:08 -0700 (PDT) MIME-Version: 1.0 References: <20210105045735.1709825-1-jeremy.linton@arm.com> <20210107181416.GA3536@willie-the-truck> <56375cd8-8e11-aba6-9e11-1e0ec546e423@jonmasters.org> <20210108103216.GA17931@e121166-lin.cambridge.arm.com> <20210122194829.GE25471@willie-the-truck> <20210126225351.GA30941@willie-the-truck> <20210325131231.GA18590@e121166-lin.cambridge.arm.com> <20210616173646.GA1840163@nvidia.com> <20210618140554.GD1002214@nvidia.com> In-Reply-To: <20210618140554.GD1002214@nvidia.com> From: Jon Masters Date: Sat, 19 Jun 2021 12:34:57 -0400 Message-ID: Subject: Re: [PATCH] arm64: PCI: Enable SMC conduit To: Jason Gunthorpe Cc: Lorenzo Pieralisi , Will Deacon , Vikram Sethi , Vidya Sagar , Thierry Reding , Jon Masters , Jeremy Linton , Mark Rutland , linux-pci@vger.kernel.org, Sudeep Holla , Linux Kernel Mailing List , Catalin Marinas , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Eric Brower , Grant.Likely@arm.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, On Fri, Jun 18, 2021 at 10:06 AM Jason Gunthorpe wrote: > > On Fri, Jun 18, 2021 at 09:21:54AM -0400, Jon Masters wrote: > > Hi Jason, > > On Wed, Jun 16, 2021 at 1:38 PM Jason Gunthorpe <[1]jgg@nvidia.com> > > wrote: > > > > On Thu, Mar 25, 2021 at 01:12:31PM +0000, Lorenzo Pieralisi wrote: > > However, in modern server type systems the PCI config space is often > > a > > software fiction being created by firmware throughout the PCI > > space. This has become necessary as the config space has exploded in > > size and complexity and PCI devices themselves have become very, > > very > > complicated. Not just the config space of single devices, but even > > bridges and topology are SW created in some cases. > > HW that is doing this is already trapping the config cycles somehow, > > presumably with some very ugly way like x86's SMM. Allowing a > > designed > > in way to inject software into the config space cycles does sound a > > lot cleaner and better to me. > > > > This is not required. SMM is terrible, indeed. But we don't have to > > relive it in Arm just because that's [EL3] the easy place to shove > > things :) > > "This is not required"? What does that mean? It's not required to implement platform hacks in SMM-like EL3. The correct place to do this kind of thing is behind the scenes in a platform microcontroller (note that I do not necessarily mean Arm's SCP approach, you can do much better than that). > > For instance it may solve other pain points if ARM systems had a > > cheap > > way to emulate up a "PCI device" to wrapper around some IP blob on > > chip. The x86 world has really driven this approach where everything > > on SOC is PCI discoverable, and it does seem to work well. > > IMHO SW emulation of config space is an important ingredient to do > > this. > > > > There are certainly ways to build PCI configuration space in a > > programmable way that does not require software trapping into > > MM. > > Can you elaborate on what you'd like to see here? Where do you want to > put the software then? There are places other than EL3 where this should live. It should not involve the AP at all in a correct configuration. It should (only) appear to be done in hardware, but where you do it is up to an implementation. Doing it correctly also accounts for others accessing configuration space simultaneously. You don't want to have to stop the world, or break PCI ordering semantics on access. There is a right way (hardware) to do this, and a wrong way (EL3 hacks). But I'll leave folks to figure out how to implement it. There are several possible approaches to do this. > > I strongly agree with the value of an industry standard approach > > to this in hardware, particularly if the PCIe vendors would offer > > this as IP. In a perfect world, ECAM would simply be an > > abstraction and never directly map to fixed hardware, thus one > > could correct defects in behavior in the field. I believe on the > > x86 side of the house, there is some interesting trapping support > > in the LPC/IOH already and this is absolutely what Arm should be > > doing. > > AFAIK x86 has HW that traps the read/writes to the ECAM and can > trigger a FW flow to emulate them, maybe in SMM, I don't know the > details. It ceratinly used to be like this when SMM could trap the > config space io read/write registers. They trap to something that isn't in SMM, but it is in firmware. That is the correct (in my opinion) approach to this. It's one time where I'm going to say that all the Arm vendors should be doing what Intel is doing in their implementation today. > Is that what you want to see for ARM? Is that better than a SMC? Yes, because you preserve perfect ECAM semantics and correct it behind the scenes. That's what people should be building. > That is alot of special magic hardware to avoid a SMC call... And it's the correct way to do it. Either that, or get ECAM perfect up front and do pre-si testing under emulation to confirm. Jon.