From nobody Sat Nov 2 14:30:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490130828322173.81364586686118; Tue, 21 Mar 2017 14:13:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3044A80408; Tue, 21 Mar 2017 14:13:47 -0700 (PDT) Received: from mail-oi0-x242.google.com (mail-oi0-x242.google.com [IPv6:2607:f8b0:4003:c06::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E11D780408 for ; Tue, 21 Mar 2017 14:13:45 -0700 (PDT) Received: by mail-oi0-x242.google.com with SMTP id a94so7282093oic.0 for ; Tue, 21 Mar 2017 14:13:45 -0700 (PDT) Received: from [127.0.1.1] ([165.204.77.1]) by smtp.gmail.com with ESMTPSA id c35sm9227567otb.48.2017.03.21.14.13.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 14:13:44 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=FplWb6kLd1trYKcGjsiAEfE1kQEOGjaTujOAwxRaIeM=; b=QQ17THbj9Ei8fN6W6DLYhUOfEzrwgBdZXCuzVBMQmsaThsm1JOa0++Flt/AmyOcuql MgzCS9n3MuR2Sc+G52q5wUZiI+IAqIItWVHZ86BG+MnkQElj+Z94SpEzlmjg5RoBmGaI kJmE5WBFBj3inrX+ErqtR9Dj7dEHGpasl48kPSmETMf6RLSQF2jikIfOZ7ektOWCzry/ ORTUX5kU9wfKTPYPBOrGkX297a5NpTegE7AAJmzOZ9am6wkImYmEvu70uYH91X9J5LsB cVeIWRHGt8ou6eHL4Xubne9Jgi9/j0zy9NETt9WhztpqezveGvYlpgVuQqHRFofbI1dk u1mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=FplWb6kLd1trYKcGjsiAEfE1kQEOGjaTujOAwxRaIeM=; b=AwSJ/q1NkmljCW7N9NzFdDTWjet2pGqFwajYQFSPcR6muJr7T6M589p0xZurJJ97ZA CfUruuVIV7Zhp5hOxTDpY6y0Yo10ufNB8un+7/8yPEcm0wudltCtJgKDCUEqDI1nmFAY rNw1mPzlRc1vnVZ8UmQT3SLXrCBFaM9VAbxg4EyeL7QkSAy5HXbalVELc4aghRdT7hfE ZZZR7sjF07yWNUBzAdZcDGMsD/QrOUevMTMjYhYWWJ8aI7WW5p8AAXA5VnX1uE/B43JX vFWojuho0cugg+6+oYdc4n6pucKs6zvwkkWBU0qUu5owRxnOJBDUq5jivnbQkfFIgJKi OLrw== X-Gm-Message-State: AFeK/H1WZjdKpGF05i1fzYWUHB19WqRL1ss6+coumF8DT56eqSFfZZg1wQkgQ6ZNPX2G1A== X-Received: by 10.202.190.67 with SMTP id o64mr17958716oif.0.1490130825263; Tue, 21 Mar 2017 14:13:45 -0700 (PDT) From: Brijesh Singh X-Google-Original-From: Brijesh Singh To: michael.d.kinney@intel.com, jordan.l.justen@intel.com, edk2-devel@ml01.01.org, lersek@redhat.com, liming.gao@intel.com Date: Tue, 21 Mar 2017 17:13:44 -0400 Message-ID: <149013082409.27235.9271750185308365336.stgit@brijesh-build-machine> In-Reply-To: <149013076154.27235.10725020825643505862.stgit@brijesh-build-machine> References: <149013076154.27235.10725020825643505862.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [edk2] [RFC PATCH v2 10/10] OvmfPkg/QemuVideoDxe: Clear the C-bit from framebuffer region when SEV is enabled X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: brijesh.singh@amd.com, leo.duran@amd.com, Thomas.Lendacky@amd.com Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since the framebuffer memory region is shared between the guest and hypervi= sor hence we must clear the memory encryption bit from this memory region when = SEV is enabled. Signed-off-by: Brijesh Singh --- OvmfPkg/QemuVideoDxe/Gop.c | 15 +++++++++++++++ OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 1 + 2 files changed, 16 insertions(+) diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c index 359e921..96661d1 100644 --- a/OvmfPkg/QemuVideoDxe/Gop.c +++ b/OvmfPkg/QemuVideoDxe/Gop.c @@ -13,6 +13,8 @@ =20 **/ =20 +#include + #include "Qemu.h" =20 STATIC @@ -65,6 +67,19 @@ QemuVideoCompleteModeData ( (VOID**) &FrameBufDesc ); =20 + // + // Framebuffer memory region is shared between hypervisor and guest, + // Clear the memory encryption mask when SEV is active. + // + if (MemEncryptSevIsEnabled ()) { + EFI_STATUS Status; + + Status =3D MemEncryptSevClearPageEncMask (FrameBufDesc->AddrRangeMin, = EFI_SIZE_TO_PAGES (FrameBufDesc->AddrLen)); + if (EFI_ERROR(Status)) { + DEBUG ((EFI_D_WARN, "Failed to clear memory encryption mask 0x%#Lx+0= x%x\n", FrameBufDesc->AddrRangeMin, FrameBufDesc->AddrLen)); + } + } + Mode->FrameBufferBase =3D FrameBufDesc->AddrRangeMin; Mode->FrameBufferSize =3D Info->HorizontalResolution * Info->VerticalRes= olution; Mode->FrameBufferSize =3D Mode->FrameBufferSize * ((ModeData->ColorDepth= + 7) / 8); diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/Q= emuVideoDxe.inf index affb6ff..83ea86c 100644 --- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf @@ -60,6 +60,7 @@ UefiBootServicesTableLib UefiDriverEntryPoint UefiLib + MemEncryptSevLib =20 [Protocols] gEfiDriverSupportedEfiVersionProtocolGuid # PROTOCOL ALWAYS_PRODUCED _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel