Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756523AbdGXTKq (ORCPT ); Mon, 24 Jul 2017 15:10:46 -0400 Received: from mail-sn1nam01on0067.outbound.protection.outlook.com ([104.47.32.67]:44920 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756118AbdGXTIx (ORCPT ); Mon, 24 Jul 2017 15:08:53 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Borislav Petkov , Andy Lutomirski , Tony Luck , Piotr Luc , Tom Lendacky , Fenghua Yu , Lu Baolu , Reza Arbab , David Howells , Matt Fleming , "Kirill A . Shutemov" , Laura Abbott , Ard Biesheuvel , Andrew Morton , Eric Biederman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Jonathan Corbet , Dave Airlie , Kees Cook , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Arnd Bergmann , Tejun Heo , Christoph Lameter , Brijesh Singh Subject: [RFC Part1 PATCH v3 06/17] x86/mm: Use encrypted access of boot related data with SEV Date: Mon, 24 Jul 2017 14:07:46 -0500 Message-Id: <20170724190757.11278-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170724190757.11278-1-brijesh.singh@amd.com> References: <20170724190757.11278-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR04CA0049.namprd04.prod.outlook.com (10.171.243.142) To CY1PR12MB0150.namprd12.prod.outlook.com (10.161.173.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7031be9-03bd-40ff-1bd2-08d4d2c75cf4 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;3:NW096t3UY6Dd5fhpoLfE8MXt0IgDTLOq+5scHtqCp2LaTfpNT89I02Ax/Y8KylSeeX3BUOFhj4mzow/uQfifwPKaJxkuvq+2G1lhmkQNvM4C4oYqG/gO7DoHFLRCjFaulEx8hi9PQ/qKHsHsSf06Tlvm2yPpNXfUNJAgFxDu21slrNuSxOwYFcj94V46mPx9OXY6ThpSEj7UEVZKgdmOteh1nVaiOSZ0bRLV/to/KYmHaQtRgKZ/5EkkQXqxLS6oIbatlYRC8BkMsozPq5MTVT13MB1Mq6CSint4ySNNE0eN0RIzW2oMFABvepGc6MuGqzVhBwCLD2LXUURbrj4hItaQZm9BjcU+CNnPvIQ1XFYnEhXKIYFDD3bYFK4zlhzRpw8TlYwJCbboIL2PJKL5vyhuVEKXjNvqaHLr+Vsu0x0BFGuphDG1yEp5WK8+YWOmXo/dQdATdm/Q9KxhXaTe5o4kiWHAbjezsOHYaSl5teipB8Bl2rw02JcU3eoPnoxGoSLJlW9lticqzzxh8OTifhTWkwXduljwnKF3ZQ5rrEr7BOs/xDgRi447yCzvDR3Dd6qokDUdjl/OjMI2tmM27toWghYimc7cmjX9p7CKQpJTOzl1rwICb3gYR0DkJ+OWTlPiw3XJ14fRRPfgT+pPvfxOkudFjM/jylOl9C9Mqaa3BodNftE3Gc8L26h00VNORkOigiClqSkWIWSxpktLPa2UlciOKE43FBK/EcmyxpUobOEmulePsbD65jcdK5n+0Mefgc+mqicwpfW2xHQkLw== X-MS-TrafficTypeDiagnostic: CY1PR12MB0150: X-Microsoft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ibl4kCBenl3/nHuHUEZOXQQRKbbtx7f76aq0LvU7XB8lKqA5dNRxNS37PYb X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR12MB0150;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR12MB0150; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR12MB0150;4:muLPFQQ6ATY8BoDEJI1IEig16tB1U4Ctsygn9suih/?= =?us-ascii?Q?8ZT+mm56EkPrRzv9080VciZyDvzo3YPco0VMUzrRIuxzxhVp4cD0FCkoXTeP?= =?us-ascii?Q?EORG+ctVtesRnU+Tl5f9e/zglU8Pc9MmPFodJgbqJX/POpWspFoqPBjgNzzo?= =?us-ascii?Q?4dh/Ww+UqkHF7Lbe5fTGh8qx3dKPrKm4dnEC3Un3qssboPKNHn/Y8XQ9NUCj?= =?us-ascii?Q?aOWbkosLvBS5vXy59AGFLhKBU8mhlDUTZMc3a/pSb8t5inVDhAIkmoZPRUph?= =?us-ascii?Q?08RK6Gs7le+4rlqgubBGh2YA8kBGXAsSmAkIpLjhS6fYihnLuxYHwj/OR2cu?= =?us-ascii?Q?qAaoX1q8gBOuHLbAWuK8nDMK0aAskfCp9AC1Sk+N6/wi4MIwl5pT1PI0NhBu?= =?us-ascii?Q?flfZZDXMrqS+8fKIamvdV35g4EEgfsCl2x9kAA67RXLzUaG0HVBkyt1s+BZz?= =?us-ascii?Q?V8OtCCJ/njMAhLZI68PjThkcAC7kOqhSEk0DEIUUig+ATckmDOulhl7FCVtl?= =?us-ascii?Q?O9acbvY1l757gjNsE3km6AT2UIMd3AEK7MtsK4ETGTv2WGeSECodiZYlbcCf?= =?us-ascii?Q?qCaYkK95gEMCi5IaKhyySdqzPTBAhxPMZMlczJvwwPstlk60RHLeQuCWJvin?= =?us-ascii?Q?jEJxre8S50SpeAXrSXOErRJ6wT+soG+wed8XMQkMSo/Zmmz8e8eEuefsB8mG?= =?us-ascii?Q?vEYSZdza0pJNx6kUOZ1616i2E2BnCR1Cu+BonkX1fuzQLLkI/f3ISz+6rxqj?= =?us-ascii?Q?x12baWNzhHW0gST7ZMPlyN7AQ+9BIwlmQEbKTMiY/IlI5lW3Pf7FP+5LmGA7?= =?us-ascii?Q?fiTl+cR6hfFKNoyIofGHuS0UxPCyWChTDitltlXFDjNccKi0XpefD2qfNPGm?= =?us-ascii?Q?EW1ycuNCBOnDcK/nSoeLpaVvtY7Siy/K6uEJQm+CKgcWArGbJP1mxVvCo8E0?= =?us-ascii?Q?RGiqCZ38fKnIg99yTj/2CVsAqB1argo9P5F+x8Qp24TlnzWtZmpV8DUXPzWe?= =?us-ascii?Q?xrlsRt35i0L2YnQ4sTWh7b4nRmKr8TibfvnVHRkF/75tdC+dUhawxjAUZ4xs?= =?us-ascii?Q?7kYTwmd3hPAO+eoqsg1mv0Q3pDTduuBz5wo/gXp8eiLZcJvCabEmQ5+4P3Eb?= =?us-ascii?Q?GeH0hbLL9FRARbEQqo4l3hEa5j5glj+1qIeNiX7QQBb+SKJWipWvIM+oo6HD?= =?us-ascii?Q?g+BPt0MZmZJVV+BiU05JNlNtOWBPAd6Fet?= X-Forefront-PRVS: 0378F1E47A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39840400002)(39850400002)(39450400003)(39400400002)(39410400002)(39860400002)(199003)(189002)(4326008)(81156014)(7350300001)(81166006)(50226002)(50466002)(68736007)(36756003)(38730400002)(1076002)(110136004)(53936002)(6116002)(25786009)(48376002)(575784001)(8676002)(86362001)(305945005)(54906002)(7736002)(2950100002)(6666003)(50986999)(101416001)(47776003)(105586002)(5660300001)(5003940100001)(7416002)(33646002)(106356001)(66066001)(6486002)(7406005)(97736004)(189998001)(3846002)(76176999)(2906002)(53416004)(42186005)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR12MB0150;H:ubuntu-010236106000.amd.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR12MB0150;23:aERfSmbPg9o9llwmv2voSHsB7tkljqgGuj9aiMlD1?= =?us-ascii?Q?W54INBuxN6ghIH0dvFmZcf24Hb/8zfArLS5fko1nOlWlkqVuut7X4mWpa0+1?= =?us-ascii?Q?8cV1W2XpfaXxHCXcXpsOwoP6mto1ARtx3cnbXFi9VUlffSzB1uLmu+GwI+KK?= =?us-ascii?Q?PhojPwVOnuKvmoCpdV5O6w9pVATgn7sCoZ14RqosWIfmoUkqin31s5Q+I1qN?= =?us-ascii?Q?CfrPZ+VPlrEAubLSCBIk17to2hWQBVwhRCm5qcUaCXoaHGNjOn5lklHCjoSb?= =?us-ascii?Q?vc/H5CIC43UWjQqTPZ6UyPwlOiSt0QEuxV0/W6TGp5f70mSa4b/YcsmCmURR?= =?us-ascii?Q?QiW4Az1EfMBDJuAP3cT3/ay22Oh5NMsF7OyyeuzIbzLW5ekRXcWyc4/mB65B?= =?us-ascii?Q?I9vHboxPyIkG6/FeJKfzLVRB8s3mC6QoIqTexzSQnretwn+A7YWioaeTD0QF?= =?us-ascii?Q?BjTp/Y21sPyFcsisyukyozpcoTcfGnio7RYo46rzGGtXbdJP3aYrw3ikclHM?= =?us-ascii?Q?UpKui5uznhtZE9C4C5LIdAKeiiRjGeIuPr4/opNRKl8H1tSq+CwGtK4On66X?= =?us-ascii?Q?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Ysv+nq8fdVjnkghbUrJhO22CVO8ovEC/pxloosJapsSKeZel?= =?us-ascii?Q?BmqFaQD9p2U5k8lpSkl7cG?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;5:tsw89oeau7UA0S0WevpS7QIhv/XwdEtXFZB8OyyO/jYVnDSJ0qG7B0JbpAonhMSEH30oRwQKgcfQ7eBMPiIr7Ms8cwJAY38lAHv6vg5zmS5L0/eeDjiZBg9AzH0wRORNjlU5kbdJvJ4/CFZm1QcVliFZilLU/HSUhJf7MDRIzEbcitydY6u9Cl4/D+M9QTtduExcS9WTM/5xT/OZGSa3XHAVXjbPoin5mvxEx4eZvzZ7Wb6Ipygh6oxxvxu8inYU+3u00/VSrV92qVfs1wfzAR9JgA+ChWeP3HJxGa96sDAJ0ozlv0BQnKuPHEHcQHZMdeeCsGKiOI8dw3WeCXChzA7ujIgBAHUl9v162hjGKU2ua2ZQARkWTKPxOsaDXN1yCnxRwwHV/ywnafWRvOps+D/NG/PcPqC82mQykXjuo1Mnh5BGfqgY+ZLOJcANPzIRKwbbN00ck0ArOzAtM8pzCo2K0gqJJaHcfz61NBJl51WkHStOcXiyk1o8orR9WgiT;24:5BRvHImFi5HnP7ucSxeADj42z2/bJssqV1f/K8FA9uQJCP6Vt1s3nxlhm53XvmBtElHMnQoSn9OlYCyyQWpg3lvseEGZ0vA7LO76jFke0OE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;7:w58ceRUt6eLoxreplmYGzSCT3PE0UShBtVFGb9s19rVrMy+aafZspljrRgOeNT4D6P2JqzZYtGlUsUoCZMP660W5dBtFUhmFeb7aNwoAAeOJOwKsC5ufxbrTvT4cUyWxlubxY+ppmJySuNbWl/Q/zZo2VCsFoYFrdKid09tmLn8Lv97l3G04jfbCBCy8d9jKLjxleXFTrfsfMuLX9vDip7p+hrTsDAgjstkYzYfazayO0eyM8Z/8h4XRFnNNUwpLwLe/jcLLQSuVDE3paNv+Dvp2Hib9nle7KurSdn0EnO3gVFgQqhLmVHycH4b8Av1Qnl40l4xXMIMuIFw/w37SG0/CybKNVqff92xvMLKvuVq7LPrxCFq8d7Nf7WK3dIxE9LFcSJncmImVDSA3YzYUQw0FSGiCjyDpiZiyV86KRqPMCCxPhRA/ME9y0cuHrfUlWgx3Jbfp2iL5xRVGgp393EHqarzXE0f/7HH2qWnjJL0Pu7vtIFFnt2LmQDjyHzCCmdhJheJ3HIyruXA6Brh9Eax8rpjfijw+q1ZbLLp4wzhmpOWAgknntJUS1rGLDYZpxwL12to/+6FiPVDY58a7fgJoFWbmFFWQ6c4L5XKN9Fr0DtOzVf6tx0kLX9uyRSpm9rGrHNo2CqaBGxKrUG9dvHzpEGTolboO/nmDrcaFn1AQIdlQMCZKt6has0OEubrcUjPGx+2emC3mQ61JnZpMdSr19t9UJe0hVCqsc7QkNChprVwPinzxsVrF3+Tdj3gANJP/7IvcFB4d2HFQ75Rfv4U7iIMTh5udvaSDSTvzjnY= X-Microsoft-Exchange-Diagnostics: 1;CY1PR12MB0150;20:qZIUf+BsDKRqEC7DjYPXRkvciGCoVumAeLhFqvf9FqBuU/Vh6W8D+kXgxXDpMrco1OxyIUkavjaeIHOPx8HvXMMjA24KOKIl328S4vn+WvAYsqXKRaJn0w2sjI65G26DCYQB0cBW8ovZGbvfbfdbe+i9D8CYKnJkzpwjSCRlWv/4Mc+SAeFyNvFEZMRpf0tM2awm9THYruh8InC3AY6MVPjDahsMXpGyEAmFlAbvH711IATA+s63IjouWzIEUZTe X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2017 19:08:25.1378 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0150 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3334 Lines: 100 From: Tom Lendacky When Secure Encrypted Virtualization (SEV) is active, boot data (such as EFI related data, setup data) is encrypted and needs to be accessed as such when mapped. Update the architecture override in early_memremap to keep the encryption attribute when mapping this data. Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh --- arch/x86/mm/ioremap.c | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 34f0e18..c0be7cf 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -422,6 +422,9 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) * areas should be mapped decrypted. And since the encryption key can * change across reboots, persistent memory should also be mapped * decrypted. + * + * If SEV is active, that implies that BIOS/UEFI also ran encrypted so + * only persistent memory should be mapped decrypted. */ static bool memremap_should_map_decrypted(resource_size_t phys_addr, unsigned long size) @@ -458,6 +461,11 @@ static bool memremap_should_map_decrypted(resource_size_t phys_addr, case E820_TYPE_ACPI: case E820_TYPE_NVS: case E820_TYPE_UNUSABLE: + /* For SEV, these areas are encrypted */ + if (sev_active()) + break; + /* Fallthrough */ + case E820_TYPE_PRAM: return true; default: @@ -581,7 +589,7 @@ static bool __init early_memremap_is_setup_data(resource_size_t phys_addr, bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size, unsigned long flags) { - if (!sme_active()) + if (!sme_active() && !sev_active()) return true; if (flags & MEMREMAP_ENC) @@ -590,10 +598,15 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size, if (flags & MEMREMAP_DEC) return false; - if (memremap_is_setup_data(phys_addr, size) || - memremap_is_efi_data(phys_addr, size) || - memremap_should_map_decrypted(phys_addr, size)) - return false; + if (sme_active()) { + if (memremap_is_setup_data(phys_addr, size) || + memremap_is_efi_data(phys_addr, size) || + memremap_should_map_decrypted(phys_addr, size)) + return false; + } else if (sev_active()) { + if (memremap_should_map_decrypted(phys_addr, size)) + return false; + } return true; } @@ -608,15 +621,22 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, unsigned long size, pgprot_t prot) { - if (!sme_active()) + if (!sme_active() && !sev_active()) return prot; - if (early_memremap_is_setup_data(phys_addr, size) || - memremap_is_efi_data(phys_addr, size) || - memremap_should_map_decrypted(phys_addr, size)) - prot = pgprot_decrypted(prot); - else - prot = pgprot_encrypted(prot); + if (sme_active()) { + if (early_memremap_is_setup_data(phys_addr, size) || + memremap_is_efi_data(phys_addr, size) || + memremap_should_map_decrypted(phys_addr, size)) + prot = pgprot_decrypted(prot); + else + prot = pgprot_encrypted(prot); + } else if (sev_active()) { + if (memremap_should_map_decrypted(phys_addr, size)) + prot = pgprot_decrypted(prot); + else + prot = pgprot_encrypted(prot); + } return prot; } -- 2.9.4