Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1908693rdb; Mon, 9 Oct 2023 06:51:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHS+Zg+Eu1oEMxvL6qC4YOLMw+2UOMngHBd/Sdk1Bcvjz/r2WJWVTY7FtV9BigTZfxcbAE1 X-Received: by 2002:a9d:6d03:0:b0:6bf:3f4:3edc with SMTP id o3-20020a9d6d03000000b006bf03f43edcmr15784374otp.22.1696859514804; Mon, 09 Oct 2023 06:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696859514; cv=none; d=google.com; s=arc-20160816; b=V7cu8QVAqfimPxD0/Q9ryAmqi0Q0WeC74biLsBwbYbkYrYpVbmMvNVrPNxB0LJgUee kzFcB38dVH5m96jZm7uI/7er7/m4OOD70lT6AW+4iWGotLs80QBwg85AIFnaFFESwOpg fS301kS0DH1O3C6LN8ovmRnsIvbdysH5ppy0Z/n/WQqkJZzo6V5iDRbgYT4Q9hqOYORP BtO37hie6WYYIa6wtvfD7+MnwYWwl+FCcuL6MHxJVNy37tMt+ZdjWB+7ZA9z3YvDX4kh A9he+HM6BVraTM2YMgJa4ou3h55XLEpYRlvEbCYI8ZJKlyrckLIcn6sgvgVPx7lxrBdF OYDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DzlUesFrbiQ7fmMX4j5gFxG0DeXvfqgu7TTzV9EZIAY=; fh=V/oKRQ1CJ71P12HJt88Bl5iDZ1lb4o63YUvZm26M14I=; b=PJ+8G7jSkXyDLMlj1fc0642VIOGPi59CmiBi/JaCAp6yP9gxPDvyDFtXqNMiZfMaVX yagxkgTtpS/vqaDzLjIi5heljl0R1hUdvyVQ8flNDPGcjMK7N4CgtF8m7DyFnqoqYnpD hEuGxdJO2Fry7jKSjW+Z+2G6TLr17J36XLLU1S2XAGilWEsqW+8IwxSjPmqIAKyURJ+7 ILX2Rt8/NvCmWMc/1b9mrIWygg/ZD7BDjqrvKx0J15wc7xybL8qQ9iQG77/cUJD4eZxa iPabAtzrHOYdKV2TVE/YAdSKHiHXxkJ2LhS2Kev1+ZNiPRhYxCep3f+qxZ65jn7lpWu0 xjjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x71-20020a63864a000000b00565e5651c6dsi9299930pgd.766.2023.10.09.06.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 06:51:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7E2708084590; Mon, 9 Oct 2023 06:50:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377067AbjJINuB (ORCPT + 99 others); Mon, 9 Oct 2023 09:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377093AbjJINuA (ORCPT ); Mon, 9 Oct 2023 09:50:00 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6976694; Mon, 9 Oct 2023 06:49:58 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 88AF430001EC2; Mon, 9 Oct 2023 15:49:50 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 77C5D30D471; Mon, 9 Oct 2023 15:49:50 +0200 (CEST) Date: Mon, 9 Oct 2023 15:49:50 +0200 From: Lukas Wunner To: Jonathan Cameron Cc: Dan Williams , Bjorn Helgaas , David Howells , David Woodhouse , Herbert Xu , "David S. Miller" , Alex Williamson , linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, linux-coco@lists.linux.dev, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, kvm@vger.kernel.org, linuxarm@huawei.com, David Box , Dave Jiang , "Li, Ming" , Zhi Wang , Alistair Francis , Wilfred Mallawa , Alexey Kardashevskiy , Tom Lendacky , Sean Christopherson , Alexander Graf Subject: Re: [PATCH 00/12] PCI device authentication Message-ID: <20231009134950.GA7097@wunner.de> References: <652030759e42d_ae7e72946@dwillia2-xfh.jf.intel.com.notmuch> <20231007100433.GA7596@wunner.de> <20231009123335.00006d3d@Huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009123335.00006d3d@Huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 howler.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 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 06:50:25 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 12:33:35PM +0100, Jonathan Cameron wrote: > On Sat, 7 Oct 2023 12:04:33 +0200 Lukas Wunner wrote: > > On Fri, Oct 06, 2023 at 09:06:13AM -0700, Dan Williams wrote: > > > Linux also has an interest in accommodating opt-in to using platform > > > managed keys, so the design requires that key management and session > > > ownership is a system owner policy choice. > > > > You're pointing out a gap in the specification: > > > > There's an existing mechanism to negotiate which PCI features are > > handled natively by the OS and which by platform firmware and that's > > the _OSC Control Field (PCI Firmware Spec r3.3 table 4-5 and 4-6). > > > > There are currently 10 features whose ownership is negotiated with _OSC, > > examples are Hotplug control and DPC configuration control. > > > > I propose adding an 11th bit to negotiate ownership of the CMA-SPDM > > session. > > > > Once that's added to the PCI Firmware Spec, amending the implementation > > to honor it is trivial: Just check for platform ownership at the top > > of pci_cma_init() and return. > > This might want to be a control over the specific DOE instance instead > of a general purpose CMA control (or maybe we want both). > > There is no safe way to access a DOE to find out if it supports CMA > that doesn't potentially break another entity using the mailbox. > Given the DOE instances might be for something entirely different we > can't just decide not to use them at all based on a global control. Per PCIe r6.1 sec 6.31.3, the DOE instance used for CMA-SPDM must support "no other data object protocol(s)" besides DOE discovery, CMA-SPDM and Secured CMA-SPDM. So if the platform doesn't grant the OS control over that DOE instance, unrelated DOE instances and protocols (such as CDAT retrieval) are not affected. E.g. PCI Firmware Spec r3.3 table 4-5 could be amended with something along the lines of: Control Field Bit Offset: 11 Interpretation: PCI Express Component Measurement and Authentication control The operating system sets this bit to 1 to request control over the DOE instance supporting the CMA-SPDM feature. You're right that to discover the DOE instance for CMA-SPDM in the first place, it needs to be accessed, which might interfere with the firmware using it. Perhaps this can be solved with the DOE Busy bit. > Any such control becomes messy when hotplug is taken into account. > I suppose we could do a _DSM based on BDF / path to device (to remain > stable across reenumeration) and config space offset to allow the OS > to say 'Hi other entity / firmware are you using this DOE instance?" > Kind of an OSC with parameters. Also includes the other way around that > the question tells the firmware that if it says "no you can't" the OS > will leave it alone until a reboot or similar - that potentially avoids > the problem that we access DOE instances already without taking care > about this PCI Firmware Spec r3.3 table 4-7 lists a number of _DSM Definitions for PCI. Indeed that could be another solution. E.g. a newly defined _DSM might return the offset in config space of DOE instance(s) which the OS is not permitted to use. > (I dropped ball on this having raised it way back near start > of us adding DOE support.) Not your fault. I think the industry got a bit ahead of itself in its "confidential computing" frenzy and forgot to specify these very basic things. > If we do want to do any of these, which spec is appropriate? Link it to PCI > and propose a PCI firmware spec update? (not sure they have a code > first process available) or make it somewhat generic and propose an > ACPI Code first change? PCI Firmware Spec would seem to be appropriate. However this can't be solved by the kernel community. We need to talk to our confidential computing architects and our representatives at the PCISIG to get the spec amended. Thanks, Lukas