From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4a::631]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1D94921A16E3F for ; Wed, 10 May 2017 15:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LeBCYg8wDUBEk8nF+d4S9SBiPcjoGkWmNEIIAaBQTgA=; b=NPF6bG9uECK25CUZfszBRiTAOa/FHcTLBkZPOGOk66jX07DEysP2mSkiQRX7Om/chxqrFo5Lutvx6HMQuRsWsUFxQXVCaQHclMe99dLOB/0oVANWHCGxkdqRMnUt6kTvWF+awkR3VJxPM5zjt5qDStOTY50EZpt0o6pFM5kUibo= Authentication-Results: lists.01.org; dkim=none (message not signed) header.d=none;lists.01.org; dmarc=none action=none header.from=amd.com; Received: from brijesh-build-machine.amd.com (165.204.77.1) by CY1PR12MB0149.namprd12.prod.outlook.com (10.161.173.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11; Wed, 10 May 2017 22:09:52 +0000 From: Brijesh Singh To: CC: , , Brijesh Singh Date: Wed, 10 May 2017 18:09:21 -0400 Message-ID: <1494454162-9940-13-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494454162-9940-1-git-send-email-brijesh.singh@amd.com> References: <1494454162-9940-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR21CA0051.namprd21.prod.outlook.com (10.172.93.141) To CY1PR12MB0149.namprd12.prod.outlook.com (10.161.173.19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13916d0f-12be-4011-0bc8-08d497f148a3 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:CY1PR12MB0149; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 3:SZXAlQnkjXUXdXTCDhTZFNCvhi4K3drDMSSYkqwGh6f+GT4uPbAkcL/H807C10/SrQNNiD5vhhQMGSN/rXd9rkBA7lyDNjTIJm9u1tBDcmXOn7E6yuYXLuif4/9N+YMlfs6trAFt8S9O4cJujJHQXTuJC3veDWezc5YUbsBT41foXc8VBN/ya9cfQe3R7H8kOPWPkTML8zHkuuW8DF0sunXAczffLlXjRENLnMEOKqeSWGdq4O2l8PZjU1qd4DTTvOrS/LxJmlv0Lmmxkt+TRDzGMNAH0J4fVZ4gt7DMmxgnNBS/YMr38RHKJ097Z/0EUfe7CFlcbGRw0nt4NtrUDN8emtK3mI+D2MljpQ6wpgw=; 25:2ecb8U3r3UbMsaT+OQZBEa5WXOvKEHUrQroJ7YFoxQ4Rilrnwj66nzqVIJ5tiMSQ+IlJ4sma/lnd2vrsWqJnsfGY2iVDzS+52x6Z1x68rPED/EbGJNtu7Tj9i2M3orcBBl8iTk0l6/tlW+zKKqWl59VTkmF1df6MKwI6IdI5dKlSYjoqC8zqmgHGFYKKS66X4OWjA040KNNJnE0CRSYdR+NCI7YNC+qRDQP7rv8vF5nLvNKs5qdBx6IrFN7cIJrcOacF0R30cvAvQ9FeGdDneTxmy+haPfEz364BlnWbQokONqxUIzXQnt0NIUQl2wLHGtkokA3D4jV3fw2Yvv0z5/1RjQjrQGkvt3llcejGP2fdQoqJ00QN6l7Ki53pTMJjNKB3UvOEzwPE7Vy/JCqDu6Wxi4ge3v4nsRgrhKa5h1W3qJufApjGLxWZZm1BAfdAz/yHFdDrIsne2xZeSpEagz/F//uudEuNO5Y+hnpa0L8= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 31:vNGbAl8Hhd0bKlD7ugY1AWFjftO+Vu1uel3C+03NlpdBMZp/kxszD9MVjnf4AEfVaDEIIpUdty5hLh2IKXHCUatxaPaEP3ZVbh8iwDy2zHJ2tvYtuYmaQpjE50e15A5NVpiCKaX3oSLWeLZDwN1Lkajze7rIhtnnmwozDPEZZIPYtdH4XOmGmqdjW+UdixfUfCkVe4ghlhbmR5mHsKNTdSzWb5jfiRKBiyoT9QMntwo=; 20:8LKQWzAwWbE60DI6jwV4MdpjDjhY+viHQU4IB7PXWjx4aG2PHQUgVqaZChp34U+ZVI7LJv8rPF43luz9VvArcfsGJ6kAUA0O6Eyov3iwkh3FPyHUiQHxM0geHDb5wDkoVX1ldKeRWqBFX4NmBgTmzJJ4ryILr7fTyeoURqrTNKCV5OuT9AqER0tjYeqBRRDwYwoTWtLqPDuVi/+2NUAeo6tJWmsiKJGwo0Z2lIGqKkEwyrHhMpYr+12FYWUMtLPqb2qqmxIMCfU2X/2XRLrL2zVdEHDEF3Eoc+FI9Mq8nWvjBJS4WC98GgG7Tol3Hz3te/fuCddKo37z/z76ebsOcVgdLVminMK8VxP++Zv1a5ruVYuSnbo3DWQ+RNpnseHdiPROaZDOJ9+0KXrAk0/bMaDwivfEAWgnyhXNlXPerAwihhp2Jhgd5A8yZPHmInGudrDgjF0ioVCY4hHj35P5uVlZiLxXPQfNx5EnGaXgy5bc04N+rNNNfZc1gKIyT/6z X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:CY1PR12MB0149; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0149; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 4:CJ3KWdzSckQg55Ysq4woWtyy17M+TOEYpDwFv9F+1jfXGIXphS9RemJA95E6ZCav9R+bHyn1ETwbNJgWlprdrNM6bDLuf7QSG5UxATCy/VCosDR5Dy3BtyZbAETRHKBMXz/NtTtNpWT1B4gswVCPr3XrSyZ/vLX+EywKqEFW0zp2MwoeI04brKz9F5R6DSyiiFY9FIwtI3J+SAKaQpwKt2tY50Hx5wuLFqypVxgxoBdWwQ8+51/aPGfPEBKO6P9knMc3kaqSI15fGynhfGB53zjEaLI/zYeUCu30EMjplbP2kMEvTQGmVJJIynlAeqdqgortZ9uMHKqNFtFqwUO0pMcyfzg4KrFZwGGKKTFcSsytUbiBQNju7t88NZfaq+O0g0ng3az2uZhGFuTfhR5XXOeiMXkvN8R1abhQSj0yH3xNW3UaCwM6sy4QP6BvrEEyZ9LFJL/Lje6jfU8KE5Dz7aaKiOmZmMsVN+rUZe4BZuEEsqdwxgr+8NMzd8JYn/IvQx2zgXzbRWSCokjVlp3oWLZyWgiETqV9BUWP3o3rurqO5DvirU1oa6a+TWeIhqr3wdbT3gkOShP+fUI/KAJi1ZD93HiHI/xsvsOpHsHe6eAbKTHq2XxkIKp6KIFf32Rni+5FlrCBWt4eO+AvUpowuZTuJiqW8t7tGhaIlFiFhp6vH0NnmuuGq0YY4Aa3cLzTXPXLXDzoXkFfy7nTHxyp7Hqh/wZcOKqPucxSRbTvYjxz/98WxLVBBi8xh7k9i2xBCyxstaF1Dml2f+KBX3prijDTgusYFIYtOasm5W/bMZpTo0LQqFN60g4C/7FhYZmOQ7AHbOuUzEXBsokL37TD/A== X-Forefront-PRVS: 03030B9493 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6029001)(6009001)(39840400002)(39400400002)(39410400002)(39850400002)(50986999)(2950100002)(6666003)(6916009)(6486002)(76176999)(50466002)(33646002)(478600001)(86362001)(189998001)(48376002)(110136004)(8676002)(4326008)(2906002)(54906002)(38730400002)(53936002)(3846002)(6116002)(50226002)(25786009)(81166006)(5003940100001)(5660300001)(53416004)(36756003)(42186005)(66066001)(7736002)(305945005)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0149; H:brijesh-build-machine.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0149; 23:ixk83csEaCSjz7j1NB48tnh1wtPPsjgzgDj2MQlXu?= =?us-ascii?Q?m7tJdM+KI25gXhY+T50GbKxeKYaJNuGU4l0zcm4X+dd+gi5QbZ3GqLz9VGf4?= =?us-ascii?Q?vVOw3XoyU6LI/vUPL++Q9o0OaM6+05QV2wKAaqor+oKE4CdN8q5oPx1hf6kX?= =?us-ascii?Q?w1F90bzQ8uEpfWUxp7obvB6m4/FWEIWFomr00y7GIS5TTrlAFFmcMFskeP5Z?= =?us-ascii?Q?Hy6uJpIVU/Cb8+mO/tmoo60vb0rx3lat0mo8hIa+TQsWprZoMULWHfPB0/Wc?= =?us-ascii?Q?YDf20qR5Lym1NJ1dlPQ0dscdVHl2fdUklVBL5Bat/HQBxTpBrotSB8GImUR/?= =?us-ascii?Q?s8cqugH0kK7b2+wb3XIvXe4h0Aglz1VK826pkOpRnULKsERfo9q+WBL3zF7i?= =?us-ascii?Q?gVoEbkRQTe1bMIayY8LaVUSXD9QHDPDv/3aZIWchSsvW5Uh6YB8VejbSsU2S?= =?us-ascii?Q?QQzns3vhZJ3KgTnxQvwpTb37ac7q2SrOpg3pbCZ1tCxC4O1RWjcqy6+YqmFS?= =?us-ascii?Q?I+LPhhLCvmF0d2VBRMnlXnd9OGqdHh8+hXzDxeL0Wa5iaSuBA+b+ll158lIb?= =?us-ascii?Q?AOI2AipMZjBN9a09ki9fRcmS+E5fcegerQHlmiIRQO67omvUk9dlh2Vy3rFG?= =?us-ascii?Q?gu5zzC+1iURVX9REzh/8ppPnYmQk98HtAsKObKrt2PUXaMh0NKDgIEwo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IsnOKDjEq7QFe3osVqXhhy5j0hYN8g5xsUU3lPEskXfMMgGoft6BG0ru3z23n6lPfcHPAQRQG0MeIjw35ybBHEZCA==; 24:mr9mmShYYZUes4HV3lHA2lr6a5ePQIh6dVU1lH+3nIryGAghujTugAoprCfY7jvScUsLk/5bMFQ4B+Xay/mrdazYmeSB/gqIW6fkhP/DVbk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 7:JQQ7tQFvfyJRFymHTtMZfClyBUtO/xD7YcDVNpvD6tT+zKuCKiRBDfTPgHrrglo/6vxCBTgFFiFKJFQQxZ2Sw/tBtx40L0l7rgmbx4KURvHEBC3tMrwC0pgxp97p4KyMAyAkR5hi/pK163FpR08ZmDlk2EP7PimcUuNprU7SpOxsUqO8dihjZ57DqoFK/1xpbfgXOKnWyimfMWy9FAFwNN5miqLpQxXGWinmawdLXgCd/XRGrIWCKbcmNLQ0C3oC3770FZOX2+FkV9aSeQZ4mK3GZaQLZ6gsTriOYWHLB5+Su9ye3dxdsHfEhyrKwjV89b2eRl6x1woEOJ5hsLuhAQ==; 20:kwzgOgp1qf06IpqwonimTKngWYvr0KekIyH1UTREC0gH+0G6hh+Q9NrZIvwfIdYXSgecQpaljjyvIFvIxQeGHUedSz3UiRdBg6UYxqJ4iap63QJz7X8Yg/aHuhjiay7lzZLwPVUeqnfcaGECgHeozD4wGTX2AFSLFrd2GLXWlNTWIm88L7ht2FRyvfmARjcMVAvy1vgXunVU+5qLrfUPzpKEGYJSdaQZxKDVlBpbtWyRg4XotrCI6IxOVqeukahg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 22:09:52.2406 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0149 Subject: [RFC v4 12/13] 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: , X-List-Received-Date: Wed, 10 May 2017 22:09:54 -0000 Content-Type: text/plain 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; @@ -79,9 +80,11 @@ InternalQemuFwCfgDmaBytes ( return; } - Access.Control = SwapBytes32 (Control); - Access.Length = SwapBytes32 (Size); - Access.Address = SwapBytes64 ((UINTN)Buffer); + Access = &LocalAccess; + + Access->Control = SwapBytes32 (Control); + Access->Length = SwapBytes32 (Size); + Access->Address = SwapBytes64 ((UINTN)Buffer); // // Delimit the transfer from (a) modifications to Access, (b) in case of a @@ -92,8 +95,8 @@ InternalQemuFwCfgDmaBytes ( // // Start the transfer. // - AccessHigh = (UINT32)RShiftU64 ((UINTN)&Access, 32); - AccessLow = (UINT32)(UINTN)&Access; + AccessHigh = (UINT32)RShiftU64 ((UINTN)Access, 32); + AccessLow = (UINT32)(UINTN)Access; IoWrite32 (FW_CFG_IO_DMA_ADDRESS, SwapBytes32 (AccessHigh)); IoWrite32 (FW_CFG_IO_DMA_ADDRESS + 4, SwapBytes32 (AccessLow)); @@ -106,7 +109,7 @@ InternalQemuFwCfgDmaBytes ( // Wait for the transfer to complete. // do { - Status = SwapBytes32 (Access.Control); + Status = SwapBytes32 (Access->Control); ASSERT ((Status & FW_CFG_DMA_CTL_ERROR) == 0); } while (Status != 0); -- 2.7.4