From nobody Sat Nov 2 10:23:24 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 1493138205334749.5715601672837; Tue, 25 Apr 2017 09:36:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7891021951C95; Tue, 25 Apr 2017 09:36:26 -0700 (PDT) Received: from mail-oi0-x244.google.com (mail-oi0-x244.google.com [IPv6:2607:f8b0:4003:c06::244]) (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 6EA5821951C95 for ; Tue, 25 Apr 2017 09:36:24 -0700 (PDT) Received: by mail-oi0-x244.google.com with SMTP id y11so35432245oie.1 for ; Tue, 25 Apr 2017 09:36:24 -0700 (PDT) Received: from brijesh-build-machine.amd.com ([165.204.77.1]) by smtp.gmail.com with ESMTPSA id j17sm9666356ota.24.2017.04.25.09.36.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Apr 2017 09:36:23 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A4w8j6jdW9KFXn2QRSNSNg4ZXCTUe4iRynynOK7+2Rw=; b=Q+IAOY2hCEH54Lf94P7QHCf4CNUmRzxBu6o0nJmU+5jpV9JaXgIjfi5l0KVL5VmT9I P9OmQ00F4APnlYSD3jML3XReAsJRZNf/ymu8SIs8M1D25zqAH2TLLIZibEAHYMTyFycB EdvR8WfL7L2TWIPs99ZS/9ufl9MWQ5B+tsFNmtwCEnLzQ9jYj7aYtwcje1qPCeP+wKjq CtrAtl+QAOGCMZ5KBPXP7T3bR2EMbOx/rJG1dmpCK0xwquyXR1m0m/DmxDCy7LCnoxf3 ln24h3Xym5MqKEBuF82KTXS1+ih6C9AeLI8IX7sXTZT9dufQKN1ZqT5/0kwb7nobGJ4r L0rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A4w8j6jdW9KFXn2QRSNSNg4ZXCTUe4iRynynOK7+2Rw=; b=QPW+nlq3TKh1hcFrBN0hfHX0QdvLoZgvsnkCyOsCQAGv7ZFTiTOynClzb2YWNmLBxF OKzE3eFNrhPP6rKR895Y/zMwAnCMEIHzlS7Ze3+lVe6o4zG+tQvR6LAP0+/2mTkqiQks CB6nTvN+jO7G07MIga69Lzw/6pl184DBgcWKG/rdPTc447SRbrZpmyojcKHxr97AgQkg ce1k7cvh1U3vb64Jy4XKbl3/r328vmcCSmu564rxIzU3a/vS+I3PmKAdt4SujrdUnAqK flXd4YehGkJNhS434WdawDhoss1JVb7hGpdJlIeIRmmyO1n91uj0MaR6uUr7S0jQEGne pJxQ== X-Gm-Message-State: AN3rC/5dWjcXLaDMuMMcMztEzwoMW8zzWsPvYxfkJV155eha9J36eJHf mrPcb6AhbCV1NL6cy8I= X-Received: by 10.157.36.137 with SMTP id z9mr2575886ota.112.1493138183665; Tue, 25 Apr 2017 09:36:23 -0700 (PDT) From: Brijesh Singh To: edk2-devel@lists.01.org, lersek@redhat.com, jordan.l.justen@intel.com Date: Tue, 25 Apr 2017 12:34:22 -0400 Message-Id: <1493138064-7816-14-git-send-email-brijesh.ksingh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493138064-7816-1-git-send-email-brijesh.ksingh@gmail.com> References: <1493138064-7816-1-git-send-email-brijesh.ksingh@gmail.com> Subject: [edk2] [RFC v3 13/15] OvmfPkg/QemuFwCfgLib: Add option to dynamic alloc FW_CFG_DMA Access 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: thomas.lendacky@amd.com, brijesh.singh@amd.com, ard.biesheuvel@linaro.org, liming.gao@intel.com, leo.duran@amd.com, jiewen.yao@intel.com, star.zeng@intel.com MIME-Version: 1.0 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: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Brijesh Singh Update InternalQemuFwCfgDmaBytes() to work with DMA Access pointer. The change provides the flexibility to dynamically allocate the "Access" when SEV is enabled. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgLib.c index 1bf725d8b7ae..73a19772bee1 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -68,7 +68,8 @@ InternalQemuFwCfgDmaBytes ( IN UINT32 Control ) { - volatile FW_CFG_DMA_ACCESS Access; + volatile FW_CFG_DMA_ACCESS LocalAccess; + volatile FW_CFG_DMA_ACCESS *Access; UINT32 AccessHigh, AccessLow; UINT32 Status; =20 @@ -79,9 +80,11 @@ InternalQemuFwCfgDmaBytes ( return; } =20 - Access.Control =3D SwapBytes32 (Control); - Access.Length =3D SwapBytes32 (Size); - Access.Address =3D SwapBytes64 ((UINTN)Buffer); + Access =3D &LocalAccess; + + Access->Control =3D SwapBytes32 (Control); + Access->Length =3D SwapBytes32 (Size); + Access->Address =3D SwapBytes64 ((UINTN)Buffer); =20 // // Delimit the transfer from (a) modifications to Access, (b) in case of= a @@ -92,8 +95,8 @@ InternalQemuFwCfgDmaBytes ( // // Start the transfer. // - AccessHigh =3D (UINT32)RShiftU64 ((UINTN)&Access, 32); - AccessLow =3D (UINT32)(UINTN)&Access; + AccessHigh =3D (UINT32)RShiftU64 ((UINTN)Access, 32); + AccessLow =3D (UINT32)(UINTN)Access; IoWrite32 (FW_CFG_IO_DMA_ADDRESS, SwapBytes32 (AccessHigh)); IoWrite32 (FW_CFG_IO_DMA_ADDRESS + 4, SwapBytes32 (AccessLow)); =20 @@ -106,7 +109,7 @@ InternalQemuFwCfgDmaBytes ( // Wait for the transfer to complete. // do { - Status =3D SwapBytes32 (Access.Control); + Status =3D SwapBytes32 (Access->Control); ASSERT ((Status & FW_CFG_DMA_CTL_ERROR) =3D=3D 0); } while (Status !=3D 0); =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel