From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe4a::62b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1AE0A21A16E24 for ; Wed, 10 May 2017 15:09:51 -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=bEX8iT2eHzUsuUqs0ceUqCfs7jcjXFkrcN304SUw+DI=; b=Kyuntf7Y8lA22KGYJe5tVQ4n/VEZwhitYmk5/S9eWcz4wfDOEOyqchGAoihtbqqGoGnFniR1on9fq+1Z5BnPUkmJ+Ctvy4vYGx6NhkPh1wopo6lnmcNhRUUUXh+Y7WekkSONtx346T7STyJCc2qpTNbRDRQORRRcIoXeqisR9MQ= 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:49 +0000 From: Brijesh Singh To: CC: , , Brijesh Singh , Jordan Justen , Laszlo Ersek Date: Wed, 10 May 2017 18:09:18 -0400 Message-ID: <1494454162-9940-10-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: f194ccc9-dfc7-4151-9114-08d497f14701 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:hiBpDkID91j0ILL2XNYn3MOLwUcmBgZXawpNx8TAnFppPWb/TYYHLyfL2TGktsIBKSjbjvnv+CYcL6biFi13Uv4RIqTugXvpfyrVemX5LaHNdEI7L1m6RfVNlpcGX3sOi9DbUxx+w38bDDSfWWhNoLoghAmylCOyNfeU82LT+0gXOGdnk6lR/RCQALGVdoAEb5CHqAosgV03s2TuvXeyzkz3WLIXCDjHcUxykJECxBqMsKIrccR4XRnMr/T4rm60kAsMd/xISdjAT5kTRyOTkJ7C/Sd5/7qQye6FqgMxqysKR15760hxcLTd2MyQMkD/9f2XCidxbnLjbDZE6DyUdBoMrx6twjXXKh5nqXLkO1w=; 25:iBWkgsz5X9b/fN1FiZz1sV1fC3g7p8RfYc2X2YjF4F4NKBryCLGtNxnM0WYiGM64OFyjgXGCEYAX4GaDr7Tr/et+c/INhedHmMPDQsOc9pigcoVkQHvxVms+eRURsEM+fu2Olr0SqGYEGo6LXEIXcF3smFz57o5/WyqYqbJ4rgQkAPn4XKDHL9ytxD4UcqPZjJXEeaY9cti2Kc0nAZeEKHIg6kxhdmF25m5yeASPBJC4jFfohM7oXI6YTChlYQ+hcndUlsJZbHNCMSqwxZ8w8/jnMEsWHonJnD99pItt47c+ISEQemOUU6IVexWulggI4kIxhTWhthsTatPAJCJVt87LidfMxTtlAbhugoVa4IsQiYghYaGKJXwkFN2wS9+In4cTBdB+IgIWNPCsqqC4fNl5aFTr/9XT5Xic2Z1oCRoSAN7ef/5UQcNr90gZu8fWabfhDmE64RRfrNmPwC0hlbVmTRSYFR8dIL70foQn6v0= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 31:7glX1Tum2MaQZVqH7FaJYIxapNDKKrveWgzupqmfStgFX1F3UGyUKp7vGLI4GXmSXyltc008OpFFp+KuwOaiquXiXFMv0WAZ3TTxh4jY1WB8ekCoUZYD//1rnKSf+VlyVgOyRIP4aHNy4O0qpQHP1glmCFueyH7Rh/OEdza2woxWaznVRgIqteN++sF15hVByCyFf1Ni/KC7mYk+0/CmEw4CDetqG9qJ/Yn9v3bNDpM=; 20:34iD35JObUm1sIuAoroa3fZaphLlzFYfCDquem+rS6YCc16JzRYWsibwLmS8SoICcCdcbXkYIVD+dpDVERGSnjztmXeZaOVng7sj1bhKqvlSIrQd3dGcaPrWdB8qdQ8/SWAdz/lsMfaZ/vNdsh6Nz7pHVjNerMMfiX9dgE8h9STzUAkc9KsJ5+y+Ydajs8rAaGMRsq7Y8fQZQvnG9fF4JIUhlHalRTSHAHfY0JQNbY69XeR+XlNfbQV5SNimvRLoXqcnFjaDkIlYQlkZrX/x2FxBNwJ7Lprh7YLW2MYAnp2Y5RqIaljAvLMnwzVt31989JHNxkJ7fHLCDTyL4MIXve3b6qXpVT8MR0Nql3ospFI16HT5/45MsTw+PErnTBzCrwrcTP+fgEt9z0kN34o04/iMXQVfqU2EQPL/myGcs3xbCwxSGpau5bc4EhUTJlc+10HKJGoavePv/+XlcF2CQyYbuL076BKQHk5ICP5YmbJgdtkzWl+iJZosACKn+tY4 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)(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:8lyMNopEUevnC95hilXjlMpsXlEFivDS9Ab3IHFXHW/jz4crg2biPD3Ot06EPnyxR3TWprSdyMvrQq/J3kgDldBzeLpCaU/ekQijFhI8mYCoxUtH05DbNlRd9E7rtNg7LfF9bfWMvXBsUm6wJJNfSe+eiCIDXTFeLMYjmWLXIuo2q6uYbkcs2cAoFxBdhbTT7cLay/MkxVh/GMbALgdEXd0JEoLD6Mu9ftrD2Jqz3cz7mKxqkjwWmOhoRDtZ8dqLPH44NzyyXhgE539jDC+ArJr/QmeQJ3cGlf7uM3vCplAuiSF/dZK7vRr92DyHaE0xXCwDBOZ1rx6kHPiovFAnqOT4wK6LeMXmcHWPVdvXUXuMHh9U4zAlesXVzGSUt9IKNlAYw17auZap/H3+Fdb31vZ38baeTGl6grIh7pWjau2w72jmARbJQf1ElctU0f3m2ciHyw2BC+zwdVXmsB1X7EY0laFWmz79pmJlTlVJ0o7tZRLvbiHiJoQytWVH0Z0zGL5A3Gw4wf+Fa1p7SQRHknXkLkFkmUjCm13DVlv+R4k43vaqgC6GYEf/sE5TEWegg0L2XlASffxdU788oQv9L3uF4092HQpTuQWErSQwsG/tfxSaAo2eiXdyWDbsOrg/VpvMUNBh4s9qDlfh5bXXuW7fm5jSS9QilXcb3ai7aHpIHnK4fyiXPBGIrUNQ2kVdHtOzpy2wGQPSwOsD+23X4zxOXkd6ICfeL9g1g3RdwaCxfSv9tP07YQsjmEOS2aO0OCifJ87WsUwR9xSQnDvPQBpt8SWdQY7iYfA8eds86lANoVsdIenippziDmSBHIYFBoxkJ3UxPy/KpD5oAXZhen3/rd++AOyis4zngD9EQypApb+JF28tPL7rfshoKIMm 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)(575784001)(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:EhJwLLS4SGTA1Kd6M0kTj3cvFN7J+IH5n7XAWbsAh?= =?us-ascii?Q?G2iSQhrSQTetMRvCMB6KqNSn4I6EsdojGnLcI4B2VbN69TM+wUF7FpXuodlg?= =?us-ascii?Q?k8Z57XafhokfX3tx9ZysVPOLUdV+V+cstbChHEPZDt5AUjc7KdTJD6kD/u3z?= =?us-ascii?Q?FJQkILgzi2zKQi6HXwyZBDw3l6tFQrLK13RD5vDDadw1OV0dYHkenV+52x/W?= =?us-ascii?Q?n/OmJG6cPviGwGj1S5DNfvaUrHaryvk++L45RJpYfrF8jRdkaAO7quUOUhQC?= =?us-ascii?Q?Dgh59d7kqYcF8xEQsdaZRBb4y5O1gXWaQnW2LmbUXqdAuff2/CF2IWUsMV55?= =?us-ascii?Q?htx+v+Rw41iWOzjkyhiuCgJQk1fvSXww1jjBqkQ0w2PhhqBoVlwX0nqUv763?= =?us-ascii?Q?2xmxrBeUTPPEHWfB75Klq2ZD+y/8jmNVA35QENPIrrKK6IEGF+0oqH7RgKjd?= =?us-ascii?Q?x65XaetGKpTe0DOA5y/rTkTMIAQE90gXaxdkF1cyaNBb9i8FOre2TViM2sCl?= =?us-ascii?Q?0DdnTaAFvB6lVANDyMGMK2R49mOwmw/5XozG82xsZ568kw9/ojRBNdNHLIEq?= =?us-ascii?Q?sLtQ0GzZVzD/Ivz270/hgzhaPznODO41MkQ0+8A9BFPtHnAzGWRNy70whuLn?= =?us-ascii?Q?A/EpSNZetgTq+JFPAmIofWWnoEjvg/fY1STH+/8vhyn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I=; 5:1K+GRpRJ2pDfvcNYkGJdw4gqBvVkDSlykAQ1dSkFzqSsMqkI+ZxQj8fDXyMqJF2ctDC3AUX0yUzMvyIpom1c4PGP97sboHu3npLZiYG+sCmYNPpOcU9gFp2hGpYWI1nv5QLQzMckJoOyNME5jz5Gug==; 24:z2n9e4XYYmDcAR0/aXR4HaHwUVyB2QgGCFmS432PXiLOklFN+pbjAMKrZ3gp1SWC9oYVBnCPq+EaSRwozfWenxUxqtK+3Pr0ZXJnKnTlu4s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0149; 7:OP687xHZDAjV1LPfvkA2bFtwtvUELutqXZpAJrAbGbdz+WlyHYgaD/SgU786re6Zhim5HYqYA0PRMJyzuC7LDQIkKo2mAXUEjqIfHW/43eV6rZysqGsi0ZMpjwYBJOb/q450yEo+Jp9EKLNP5qa5e6LS0Qscdux9+CV6TNMObhpeSbONRGjJ6azQX9qQEZYYpBYQgdt5Wek3PLzKBI36ulqUzsBejrbY3rA7MeSCt2eiYDD5qaflJQDUi9G4maKR0/C3cS2nax1Bggk0PHwYvmQX12x40thIkc+CzP0ddnYbh84nAdM1l+KJO18Ci7tmKY98XLFj3f+sqWHfD6RBJA==; 20:vg4mhW7CwiKzsIj27fs3FJUOxktIvcOPPyDIHYMiA1PgKN5doL6oCET084F/EtYctgaNV+eVFnErI+nn8QlFz5uf+Aq3gd0Y/0W5EUgkwfZeeDQVL9eU0FIWYl3O0OTwSWUT9eXrFGzIMptxvq8PqKTEWwTnil8tWSSUEcixqo2nxRn0/2CYR/ERc4kTjXWQKLJDPq7jxyObN+7lfOCoa6sJlKYl45U56//Fe9dOmgqlXPTYSZKK9YKPoyid2fab X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 22:09:49.3545 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0149 Subject: [RFC v4 09/13] OvmfPkg/QemuFwCfgLib: Implement SEV internal function for SEC phase 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:51 -0000 Content-Type: text/plain Cc: Jordan Justen Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf | 1 + OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c | 57 ++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf index 7a96575d1851..b782ac6c0aa2 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf @@ -45,4 +45,5 @@ [LibraryClasses] DebugLib IoLib MemoryAllocationLib + MemEncryptSevLib diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c index 465ccbe90dad..cd04cc814063 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSec.c @@ -6,6 +6,7 @@ Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this @@ -18,6 +19,7 @@ #include #include +#include #include "QemuFwCfgLibInternal.h" @@ -94,3 +96,58 @@ InternalQemuFwCfgDmaIsAvailable ( { return FALSE; } + +/** + + Returns a boolean indicating whether SEV is enabled + + @retval TRUE SEV is enabled + @retval FALSE SEV is disabled +**/ +BOOLEAN +InternalQemuFwCfgSevIsEnabled ( + VOID + ) +{ + return MemEncryptSevIsEnabled (); +} + +/** + Allocate a bounce buffer for SEV DMA. + + @param[in] NumPage Number of pages. + @param[out] Buffer Allocated DMA Buffer pointer + +**/ +VOID +InternalQemuFwCfgSevDmaAllocateBuffer ( + IN UINT32 NumPages, + OUT VOID **Buffer + ) +{ + // + // We should never reach here + // + ASSERT (FALSE); + CpuDeadLoop (); +} + +/** + Free the DMA buffer allocated using InternalQemuFwCfgSevDmaAllocateBuffer + + @param[in] NumPage Number of pages. + @param[in] Buffer DMA Buffer pointer + +**/ +VOID +InternalQemuFwCfgSevDmaFreeBuffer ( + IN VOID *Buffer, + IN UINT32 NumPages + ) +{ + // + // We should never reach here + // + ASSERT (FALSE); + CpuDeadLoop (); +} -- 2.7.4