From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.11708.1634033168158834605 for ; Tue, 12 Oct 2021 03:06:08 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NEqNThpE; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634033167; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7+Evv4cwusujq7eGCiJyom5Sn5ssF1tbsRhzAzlA1L4=; b=NEqNThpEGVwXVWX6Waw2I7S/0mtxfFN1nv8yLKK/xIQq55LQZqwb0j4V5dtOTJAWo54k4G rceVumqad9fVmqXfoguv8ea8y89F3ha42zCqr2QTg9S+3Iv6HzetkFWQp6BFBwyZang5lq cqOdHaAHO7zBuVM/tzSo26TuspsAuuE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-0yx4UV3UPqq_MY98lz1jWQ-1; Tue, 12 Oct 2021 06:06:01 -0400 X-MC-Unique: 0yx4UV3UPqq_MY98lz1jWQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1A411923762; Tue, 12 Oct 2021 10:05:59 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC50B60854; Tue, 12 Oct 2021 10:05:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AAAE2180060E; Tue, 12 Oct 2021 12:05:55 +0200 (CEST) Date: Tue, 12 Oct 2021 12:05:55 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, min.m.xu@intel.com Cc: Michael D Kinney , Liming Gao , Zhiguang Liu , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V2 06/28] MdePkg: Update BaseIoLibIntrinsicSev to support Tdx Message-ID: <20211012100555.4sykhkinx3fc6gak@sirius.home.kraxel.org> References: <78bc0164be0e6adb1edf4454bdc3aaf1d55a2771.1633401643.git.min.m.xu@intel.com> MIME-Version: 1.0 In-Reply-To: <78bc0164be0e6adb1edf4454bdc3aaf1d55a2771.1633401643.git.min.m.xu@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Oct 05, 2021 at 11:39:17AM +0800, Min Xu wrote: > RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 > > Intel TDX architecture does not prescribe a specific software convention > to perform I/O from the guest TD. Guest TD providers have many choices to > provide I/O to the guest. The common I/O models are emulated devices, > para-virtualized devices, SRIOV devices and Direct Device assignments. This monster patch needs splitting up. At least into io + mmio + fifo. Adding the tdx helper functions can be a separate patch too. Calling CPUID should not be needed, we have a new fancy ConfidentialComputing PCD for that now. The new wrappers in IoLibFifo.c should also check for sev, so we have something along the lines of ... switch (getpcd(cc)) { case tdx: TdxFifo(...) break; case sev: SevFifo(...) break; default: DefaultFifo(...) break; } ... instead of hiding the default case in IoFifoSev.nasm. Maybe that's something to cleanup for amd (Brijesh?) beforehand, so the structure is there already and the tdx patches just need to add the "case tdx:" bits. take care, Gerd