Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp955466rdg; Wed, 11 Oct 2023 09:58:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFTRTsu3Seu9+fUQgLotad1A9CWqVWWzmnT0u+G4+R+yVueADbmuacPPexAb812EFDFmR+o X-Received: by 2002:a05:6a00:2e20:b0:68e:42c9:74e0 with SMTP id fc32-20020a056a002e2000b0068e42c974e0mr22635643pfb.3.1697043483471; Wed, 11 Oct 2023 09:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697043483; cv=none; d=google.com; s=arc-20160816; b=gXg8bDgajLbEFd2ORti+/v46eAKRiyNVkoRZSK9AlP6Qg3sQnGOrX0s37xlLwFbspw rZWefm4yzDR6ngrRy8XBH8wu1E6MZQlkbEx/C3MnJiSM8yEpDB9CKDjWhWQ57o+YhieN 2Xjy2GrxO2snh6rl56ZJfEqHoi+ywLeYrEUzWHJMB7ooI3qOmgzEiSyf6dqqO8ZOCSbj cCCXTKCR7KBV1FV8JKf84xgNjsWvkYPFQwLVEdezjJDuCH6Qwc7kY5HVWwxV9P3a3Wx/ te/hZKiCa6nLOmkmXWfDMtFKEa4ae6Dr/3XN6U+wsmicM6Lq3WbFcN68z0Q6kFQcw/GO ZTuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=BNRH6S0kI3jFUcJCOXjoQ9SlCXCIT5n7MnTLrz2CWZo=; fh=nVeYImsOYR1A/Jh/OzbrC0FS4eEAfOM5ie/ymRWIB3w=; b=GgFGgQB6ZGAMNzKgOx8oagc4CBx8wZZkOl72J9OnhZ3R7CnLta7C/1j/iFe3rk7HxN SVaCaohk8HAOcW53YoQ3sLUTBFbARXLfG+QmOH6h42Wp08GUyY5/zdzRemYtR4q1P8Uq h0Fd6IBER9hf719KZAO6gwAfpe8noXQV1K7B852nZmzEZ1Yc0XF/hyspVirScDhPsMNK 6H7FP2xfeUJPyD9vaVn/vtivYn92fYoqE7UfTX7pZxMT8hdciuolmWa+1buq3F4a1OS2 H4r1JUqfKQP3I8FoKCfFevR4bBBL52w/FDvUGVpCD/mnNBBAsooZ8kPHi/RACFZkZM8m rWag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t11-20020a056a0021cb00b006933bf8404dsi12227163pfj.10.2023.10.11.09.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 09:58:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 60A1381DDD64; Wed, 11 Oct 2023 09:57:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232975AbjJKQ5x (ORCPT + 99 others); Wed, 11 Oct 2023 12:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbjJKQ5x (ORCPT ); Wed, 11 Oct 2023 12:57:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 042D28F; Wed, 11 Oct 2023 09:57:51 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4S5Jpv2CChz6K7GN; Thu, 12 Oct 2023 00:57:27 +0800 (CST) Received: from localhost (10.126.175.8) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 11 Oct 2023 17:57:47 +0100 Date: Wed, 11 Oct 2023 17:57:46 +0100 From: Jonathan Cameron To: Alexey Kardashevskiy CC: Lukas Wunner , Dan Williams , Bjorn Helgaas , David Howells , David Woodhouse , Herbert Xu , "David S. Miller" , Alex Williamson , , , , , , , , David Box , Dave Jiang , "Li, Ming" , Zhi Wang , Alistair Francis , Wilfred Mallawa , Tom Lendacky , Sean Christopherson , Alexander Graf Subject: Re: [PATCH 00/12] PCI device authentication Message-ID: <20231011175746.00003d57@Huawei.com> In-Reply-To: <2a21b730-9ad4-4585-b636-9aa139266f94@amd.com> References: <652030759e42d_ae7e72946@dwillia2-xfh.jf.intel.com.notmuch> <20231007100433.GA7596@wunner.de> <20231009123335.00006d3d@Huawei.com> <20231009134950.GA7097@wunner.de> <20231010081913.GA24050@wunner.de> <2a21b730-9ad4-4585-b636-9aa139266f94@amd.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.126.175.8] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 09:57:57 -0700 (PDT) X-Spam-Level: ** On Tue, 10 Oct 2023 23:53:16 +1100 Alexey Kardashevskiy wrote: > On 10/10/23 19:19, Lukas Wunner wrote: > > On Tue, Oct 10, 2023 at 03:07:41PM +1100, Alexey Kardashevskiy wrote: > >> On 10/10/23 00:49, Lukas Wunner wrote: > >>> PCI Firmware Spec would seem to be appropriate. However this can't > >>> be solved by the kernel community. > >> > >> How so? It is up to the user to decide whether it is SPDM/CMA in the kernel > >> or the firmware + coco, both are quite possible (it is IDE which is not > >> possible without the firmware on AMD but we are not there yet). > > > > The user can control ownership of CMA-SPDM e.g. through a BIOS knob. > > And that BIOS knob then influences the outcome of the _OSC negotiation > > between platform and OS. > > > > > >> But the way SPDM is done now is that if the user (as myself) wants to let > >> the firmware run SPDM - the only choice is disabling CONFIG_CMA completely > >> as CMA is not a (un)loadable module or built-in (with some "blacklist" > >> parameters), and does not provide a sysfs knob to control its tentacles. > > > > The problem is every single vendor thinks they can come up with > > their own idea of who owns the SPDM session: > > > > I've looked at the Nvidia driver and they've hacked libspdm into it, > > so their idea is that the device driver owns the SPDM session. > > > > AMD wants the host to proxy DOE but not own the SPDM session. > > > > We have *standards* for a reason. So that products are interoperable. > > There is no "standard PCI ethernet device", somehow we survive ;) > > > If the kernel tries to accommodate to every vendor's idea of SPDM ownership > > we'll end up with an unmaintainable mess of quirks, plus sysfs knobs > > which were once intended as a stopgap but can never be removed because > > they're userspace ABI. > > The host kernel needs to accommodate the idea that it is not trusted, > and neither is the BIOS. > > > This needs to be solved in the *specification*. > > > > And the existing solution for who owns a particular PCI feature is _OSC. > > Hence this needs to be taken up with the Firmware Working Group at the > > PCISIG. > > I do like the general idea of specifying things, etc but this place does > not sound right. The firmware you are talking about has full access to > PCI, the PSP firmware does not have any (besides the IDE keys > programming), is there any example of such firmware in the PCI Firmware > spec? From the BIOS standpoint, the host OS owns DOE and whatever is > sent over it (on AMD SEV TIO). The host OS chooses not to compose these > SPDM packets itself (while it could) in order to be able to run guests > without having them to trust the host OS. As a minimum I'd like to see something saying - "keep away from discovery protocol on this DOE instance". An ACPI _OSC or _DSM or similar could do that. It won't be needed for every approach, but it might for some. Then either firmwware knows what to do, or a specific driver does. If your proxy comes up late enough that we've already done (and cached) discovery protocols results then this might not be a problem for this particular approach as we have no reason to rerun discovery (other than hotplug in which case there is lots of other stuff to do anyway). For your case we need some hooks for the PSP to be able to drive the SPDM session but that should be easy to allow. I don't think precludes the hypervisor also verifying the hardware is trusted by it along the way (though not used for IDE). So if you are relying on a host OS proxy I don't thing you need to disable CONFIG_CMA (maybe something around resets?) Potentially the host OS tries first (maybe succeeds - that doesn't matter though nothing wrong with defense in depth) and then the PSP via a proxy does it all over again which is fine. All we need to do is guarantee ordering and I think we are fine for that. Far too many possible models here but such is life I guess. > > >> Note, this PSP firmware is not BIOS (which runs on the same core and has > >> same access to PCI as the host OS), it is a separate platform processor > >> which only programs IDE keys to the PCI RC (via some some internal bus > >> mechanism) but does not do anything on the bus itself and relies on the host > >> OS proxying DOE, and there is no APCI between the core and the psp. > > > > Somewhat tangentially, would it be possible in your architecture > > that the host or guest asks PSP to program IDE keys into the Root Port? > > Sure it is possible to implement. But this does not help our primary use > case which is confidential VMs where the host OS is not trusted with the > keys. > > > Or alternatively, access the key registers directly without PSP involvement? > > No afaik, for the reason above. > > > > > > Thanks, > > > > Lukas >