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.web11.4254.1635923841956036527 for ; Wed, 03 Nov 2021 00:17:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OA3Dl5L1; 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=1635923841; 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=tslHS+6y47CpQOWcYKTO7W5XJxvhXzLc4onb6axla74=; b=OA3Dl5L1CUJKlRU3rd8KHQnQ4OGOECwz1sXouj/omoX6J+ErTQhn+NUOikAns7cRqQz3pS RD61CPH4qjavqBMDNe9aOCu0N+KqGXAiglr+EDQ3nlSN2uY5T5kOv4+QiKgfFP9hvxm8rP hlM98dZE/N+zl8CNUUeyi6lBTeiL0oQ= 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-100-uh3bKYQiMH6-4NhvvzDBZA-1; Wed, 03 Nov 2021 03:17:17 -0400 X-MC-Unique: uh3bKYQiMH6-4NhvvzDBZA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6209A1808312; Wed, 3 Nov 2021 07:17:16 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E903D57CB9; Wed, 3 Nov 2021 07:17:15 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 183211800924; Wed, 3 Nov 2021 08:17:14 +0100 (CET) Date: Wed, 3 Nov 2021 08:17:14 +0100 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jordan Justen , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [PATCH V3 29/29] OvmfPkg: Update IoMmuDxe to support TDX Message-ID: <20211103071714.23p72ezydujhwfvy@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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=us-ascii Content-Disposition: inline Hi, > + if (CC_GUEST_IS_SEV (PcdGet64 (PcdConfidentialComputingGuestAttr))) { > + // > + // Clear the memory encryption mask on the plaintext buffer. > + // > + Status = MemEncryptSevClearPageEncMask ( > + 0, > + MapInfo->PlainTextAddress, > + MapInfo->NumberOfPages > + ); > + } else if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) { > + // > + // Set the memory shared bit. > + // > + Status = MemEncryptTdxSetPageSharedBit ( > + 0, > + MapInfo->PlainTextAddress, > + MapInfo->NumberOfPages > + ); Again, this looks very simliar and like a great opportunity to share code. take care, Gerd