From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0609.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::609]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A522421C8D0A7 for ; Fri, 26 May 2017 07:44:39 -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=pjCYtCcYszN1z1nb+lHRlzeQv6vvn5CY7Qv+peYaTjU=; b=0SO6tgx76jJjeqgsbXwSpocAgmBy61AFZ4LqbOPf/CoYuhJ1TVnBob0ko1mvqfTnNWADgvu4Ihb4Kkn1gTxAdQ7rRhOY/ArKQNV4tZqGkVmMpKkjA6eTkZzuPqSgZhgUMvyg7i7lnoeNPN7R09Pkclv0ZyMDbVjPitHocBYO9og= 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 SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Fri, 26 May 2017 14:44:37 +0000 From: Brijesh Singh To: CC: , , Brijesh Singh , Jordan Justen , Laszlo Ersek Date: Fri, 26 May 2017 10:44:03 -0400 Message-ID: <1495809845-32472-16-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495809845-32472-1-git-send-email-brijesh.singh@amd.com> References: <1495809845-32472-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR16CA0024.namprd16.prod.outlook.com (10.172.173.34) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-MS-Office365-Filtering-Correlation-Id: 8d3f70bb-8126-4ea2-e938-08d4a445bc11 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:g9SEPqu9Qpi/B0yWG4qy2rekZhQ8AgyoNFYrq/T+a3geBM9G3w5EfOQtdBDfgQZSfTULn8R0lrpWMbd9p5w2z4oOtuqUelKQNjHXB//DdsqxFdua17eCXt4BU6TDyuomqPUicKYdZkj7lRpy3W4EURZwJd34Fx8o8J9olok8PEq7ocoSuxCv0je8Ul3WtphY/4AYyX/h6MKFrblD5MLUEav/WatuTBryF1MP+cZkP66dVzDeRlnqkYoXhnc7fCjAmcDgo0F0VikmG2hXGMW66caI58i6nSqLaAymO82oB7ixjplalh7hKgmdG5jiTAR3jMSfhzekLqfs9M3PsOuVEzt9xfMkvQXwTxHhy6d+9yk=; 25:Au3Ng9+ceSR7KzVKJK7ZbzpR6iPLPfcM3FhdIJYJdkrSo4O4xdjYsUDu4VvD2veRriJRQcrq8lSq/39bqdJs/d42bkAMstjPggjyeIr2RLHKPeuu3ZrEw6AAfu7BwmWlohMILdHu3wPlqpzNmoDljGV5QUVpMFRabvonAQFLe0Nj1qRptA8WpAXG0pENJGPjV8pXKRzBf1cWlJlGsOYewmjJBZlcKF6JEpEKinCcnzNtR0IknDQZopWX5VSduelyTtWebufqKH5CX7sqrfcOltuz/rHsanO2NM5fJhi87RiHAQQG2HUhvl8irPtNeZJ+d5ulRSdwKia/Zx6XM7NQcsEay9poxIY+8Jr/0AZdpckA7hSWjK+MFWH94I92F4uPD0JBZjB9K5XUiVWO/FGVaExq+2bexj8txBN380AVUnXqeTVVzwc4KIdOJTKYujnO0J1BVSao1eSkuDoZVBMb83YCBeBg8wNLAdxcZRCLb50= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 31:52cWzThcjGsY0mTf9sPKGzvYq/vQftPGYWIEaoeUfUEOuhFVv63WGwdzOm+m2DF6eK87NwMwAUyV3a9B6dNyG/ue10gJ4LuFPXKrYl/orjgfr4MUa/MveXZXHA7yVXlI/X5mFMS7T8/J4FmeN8KZci7e/QZ49fa4O8KeReWMPEcswu2BDFDYDLh7LwF82wld/mMngoNxemumcvOJ0cB2YbZppXtAvUtGMTi8doq17kA=; 20:yIxzbdtQmfA/W8kGuIJNEaE/KDZt5mVUZpgiq+kIx1JlJ+EOIB0/aqF628uWK5RPlvUMWgQAWVFqv6pgDRRUYaGU9YuBVPn7rHcWYdZnWI8xMx1JvPw0FcoI0Rltc4ZPaAKqFKf/uWBpVACiyv9ZbjMHAVIP4NfYIpzdahOQgbzzC0ydJi1kjm9hmuKhWK/Hhs6lSMW7XR8QVGWHmDjdXWcY6KvO97bCktdBWpBjfEm7Lms84/yrLQv5k8g+7momZ7DA0eV9icdelABspAC/JSMptrkVbenSEASNifr8CFNPJckpxDmo3Gmn1TUO7IRkkhcMOzygtHtxYmX+Mm42zEqfFcw97A7aByS9PJJnJk4gLOsyzTFooOaUis5CSPcxezkdCQvZMb4n2AOu4yQEsnMVbO9Y9N2obMBtHsjAwljyPmnfEhMUEX3QHSoJYBYxVBotjDuSj3tIbv8IDy4kjrXPNHhPTrIPsVnuztSox0UttxHuLSI1xcLuFl4pAdA5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 4:erIqVFQxfyuuWqkxOoFijufkgQPUitwVdsWwtpqtTJAC6V50CdlmHTLcMxAIHSL86VasCNEy9MZER7fgP2tNS+l5MZOtFG2OX99lbmhbqrdlBoyS2d0wKk3jB/yUlbuK8RUs7hcxjepY2qOxnAgUO/bEIMwR3vzdAs7/0ZKtotBBjCpWUEtPbkdHdqFDhFfAJIyyFP0nBDcszeUgKii9xT9mXrG/FkyeAnQDXQ/DCvzlf9L7v0XHlgtzLAKMfKd0N11s9ZiYbmEllAr/iOh0gsepbqgVR880KEcuFSYrXKmFDSrDhm3Ao5q9PqMQlkXb/zwiB0sw8K8RrKcnyiwf40qx+h50LmsYYxN8R2sUjSdBZwTghUfgchh19Nphxvkg/tTcDLKti3ox35W6MbsyThIvCiIodza6PPF7IUrjd9EqrSsCsXqGX+wakYplUmIg6pQdu8B1m29c593ReCJsyR06OtP2XeR+TsmfUrJvJ2CHN0LJMmUur1rjp1rOGUTxrz+ZDrqox9qPWwiQ8ZSbjzMi2Y7BiDh8fl0CcwiueoJc0p+kqrq2XlZxcRPP0CTZ045Ri/h6PPP2knrV3jwrDwT/mz4K+HOlaAgFV6MuDwFj+UGtGg29GZ1ayYm7AsuJGYTLQbo3wQewmF1LrCO7+ra046rgvSYR9sn51xbg4B+3Wa6MydRaS6a94JBTKDxmmpEUReQ7QOSvNrMyLBOOR5b+Ng30HG+hCGeTU0gth9UN5gNAZavbhSKt8K8ul7J/9LPVUXuT2mr/smX4iXOIPcddYvk7TwqVAlgTTRCPFJjKPKokKU6pkrXYsbd4x4A6ooSDvHSpgaQ2D+7uq2wJGvKBhJsmWnsNeQ/clAkKQ0XXGl7wTNOMNmezIsMSqVqF X-Forefront-PRVS: 031996B7EF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(39450400003)(39410400002)(39840400002)(39860400002)(39400400002)(39850400002)(2950100002)(6916009)(6666003)(38730400002)(110136004)(50226002)(76176999)(36756003)(81166006)(8676002)(53936002)(86362001)(478600001)(48376002)(54906002)(25786009)(5660300001)(50986999)(189998001)(5003940100001)(33646002)(305945005)(6486002)(2906002)(53416004)(47776003)(2351001)(42186005)(3846002)(6116002)(66066001)(4326008)(50466002)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:brijesh-build-machine.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0158; 23:bVDFMX0Gwb39GLSGizsShYpjH5VXNjfILOj/h+hqI?= =?us-ascii?Q?KMDyayVTPVo92ReYLEuhxCW5tC83TGhaSyoM1Awo+8Ac9me1Zf1Wtf6ehVKM?= =?us-ascii?Q?4UQs0t202dVbxhE2Bmgy4W7kGVi1NUU4vloLEJhpBy5ohEkqZe1kAGPGyAZX?= =?us-ascii?Q?XD9D/5AhNa25tfrEANexSeV/euoz/9it0HHOBos5BzlC2L6+Q4N/ldFOgX2Q?= =?us-ascii?Q?QofF3iREFdaqI5d/tFlZx1mySim+K/Jt4Se9Bv9m2ZaKrh+8nXh2FHcHTgNQ?= =?us-ascii?Q?8xLq+kg1laxXyXDreqo29JwkhzsNlTE0H2nCA88DllLaiLjmODpFUj9HFmuU?= =?us-ascii?Q?nYf28WTKcCw+cIOMLKpAkAHRWYcxy6MX7Zn0LnoAtEh8ua1eOdyvaNLKlTE1?= =?us-ascii?Q?2loh+aDTnhCR/0Yz4m9mSr28zfdMUBVO1RBUDJx3Fojszce1Y0WD2XHNaH24?= =?us-ascii?Q?R0344CEXxQ8aUy7bHD+rAAU+3Oz3OaZeQtKxXcT2ver802Wl90BohIln9zJ6?= =?us-ascii?Q?fdaheOLioxUtNjxMteDL7i/h6enl+CQq9DaScJzXhqpawe7OhP1loQATHGYQ?= =?us-ascii?Q?Dr9evMh5ftFygRMOk80OQV99kmez8O7FsKAXftzf8nOcWwjp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noJL6NIh/rYBzU0JqCYOeN3q7eQHxbOo8vlSVgLO3NuTirl9rAdEDeIuVEH2DGkju1ixH8Pcd4ie0+PgDT9tMYKJ+MxdIQIJKLDjq9k6nr1nwZ0=; 5:MS/rAxbEWXcMSyLluDAN7dx8Il3lgDY9ASOktRvxcRPPzz2x2JFsiYW0glroxIbWQ1tSZuanqNw/3naw5DhIhCWcojX/6EsDezxp4sgtG5Ymf15SOaWbQXx5o7kErpc58bkAMC1XoXTBRD29upgbGA==; 24:7OAX7YIws7V+ErReV7NotqNg+IMuIonByYJB4c/gUuc0v6vrFzzisOkbrZXzMOFSqGKr7q7igdvx0rFY6nHyrWxNJSOZZ/ZZ71CtwJL/LVg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 7:W2bvAUOueC0A7P/sKk9JbXuaNYDQdPTFJY6W/SfvNyykhmaIQhiBQQhCUvbWbvMyLX6F0srVypGDoepkbJckjlaanVCVd18mRmQNeNMQxs13ugvnqaKb+BpEjp/YFbb4RK/Xt+2BAxwtHuscx/HXnUYEZ9oNYI7MVNbevcibIVdbT3ZZu0ovzGNzjEptgllQsmO9bBA7aiL492dE+zuzL5rGE1LUCAWb372WBh7Qm04vvZJqmgD0ZYSB7ycD8mUQJG594lOQTLBuVz/Vm0HvUvFNWJOt3wlcRdSdPr5LGHzl5/vaMYjKiaxm+xPauJmC09a9lLPH3Ga/dMHtjK66Jw==; 20:V7sF/ri1JYxVaXQaLg/W559jkTtWEdRTAvXakkpzu3r3FnC3WgoY7sCgcFo4cPRFoelQMl8uFK7ieGc7YzctOM15k52+rzHFwxwLpm2/TpF9KLGqSYGrN5uRO6jBStXpd5VgubLxHaT1QO6XHeABeFyDKWCQrdza/N7SATxQuCzmibexpxjrfVQh/LPxQhPiD4DP+8A++OfEh2TNIPDSb+pE27fpFg4S0lS72ydh3ud17btgFzR/rwE0c5LUzPEu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2017 14:44:37.6267 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Subject: [PATCH v6 15/17] 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: Fri, 26 May 2017 14:44:39 -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. Cc: Jordan Justen Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- 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