Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbdFGTQg (ORCPT ); Wed, 7 Jun 2017 15:16:36 -0400 Received: from mail-sn1nam02on0064.outbound.protection.outlook.com ([104.47.36.64]:28568 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752379AbdFGTQ1 (ORCPT ); Wed, 7 Jun 2017 15:16:27 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; From: Tom Lendacky Subject: [PATCH v6 17/34] efi: Update efi_mem_type() to return an error rather than 0 To: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Rik van Riel , Radim =?utf-8?b?S3LEjW3DocWZ?= , Toshimitsu Kani , Arnd Bergmann , Jonathan Corbet , Matt Fleming , "Michael S. Tsirkin" , Joerg Roedel , Konrad Rzeszutek Wilk , Paolo Bonzini , Larry Woodman , Brijesh Singh , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , Andrey Ryabinin , Alexander Potapenko , Dave Young , Thomas Gleixner , Dmitry Vyukov Date: Wed, 07 Jun 2017 14:16:17 -0500 Message-ID: <20170607191617.28645.8923.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170607191309.28645.15241.stgit@tlendack-t1.amdoffice.net> References: <20170607191309.28645.15241.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0038.namprd17.prod.outlook.com (10.175.189.24) To DM5PR12MB1148.namprd12.prod.outlook.com (10.168.236.143) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR12MB1148: X-MS-Office365-Filtering-Correlation-Id: 667ed021-a05e-44ac-c244-08d4add9af3b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:DM5PR12MB1148; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1148;3:RlcxGhmRDzjgHZXaNXiUkg248j03yRgwUb4FAtjYXEcfWyaTCs3MmxCL+jMLU0G18ViL6V1NmORUzg2ctI7mVQOow7Oe+i5IV81HH9Y1NKBQQVv5F0ooznw83ejAq5COYsPb4hRUnq5Qm7I+m3B1xusmyU1M8UgxyXFgEhG/L3TD4JkGsIsmaZglhnmGEcXXzKAd77tN16sEEG2dWaEgEAdjV3z96l+RxkHMSsv/RWJsQ0w64si4jEIj+nQQ5w6HPuwCoVGDFRYTDPPOpTfjVWuFppaiGfhj2RYWLJVFltWtODiSSAjuzCG6/4ly2cEY8QTf6stFkFvnuAG5s5KDGZRIcr+Qcod9FYDvoaRtMMw=;25:sEl3TuvuVbsuqwj7aleniCleaLUjjNfVAhyhv9gEHF8HhKL5HUFUxdpStwtWlogzHN5epYBhiAeTRET5ScIhzki4wTro4jvsNmGXRnxAwbu8grWu7nb0cnfqp7Ji1PUDqCIfifAf+wFRxMExQccHDZ8tsJqvaOg9W76YArQsvm0sL7r4gBjJeNqPt1IeTxfwySt/0bt48k4ELVIOYrDvHTR4u4iS+91ufJZ/ohXdZ8xVAJgbzYtuwNrngDnn9Ntgp0hcMhkvg5qeCJ1iOAeHk1oa83GVlg3w5hgqlQSSvkWtuJOLjKpCfpkuOsDW0rg2QVpLRmHlmguA5xVEMMjE7XdX/1hg+JxrGP3I9SSt5tua1oJstK3owBgyjaDV0iRY9UDaiwXME62O76X7a7BAEHMtCtAAdy6FdGNYhfEmoBCd76woaGH+uSnyuX/m+8I5MLi9ZDKAEJ7y061ziatSL9rx/bXjSomvXsIOVadoP48= X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1148;31:PBCTomv9WAIjTpj0fbqNArctndCP8W58YHzY6C9pyjHEtHHs2tyhPt9WrDfalOT67nUcGRZL3pVCS2q2li2jEHqJTM2XSyexBJYutHTRRdY3pLzL092NefEjOo5BgOoFhB79lhASZY8Qr0b7bAYKtgW5oWrQjW3in+BAp+Zv41Jgu1wnCLdaV/tcM4J4/75m62x0Ki/XZv4skkScTApfurmONQJ4pFYEo+iQnAE6v8c=;20:U4NeKrMNYtq/ZNBATrb4R8xOAevj8kIJj7Z0p+pjphl5mpwjNs5j4zDQmES1/aSdp2DznRhSh4CQhsi3jalMp0GGYTTDPT1WT0Y0wpBg+7knpnW3QDaZncreRtyWaaaPiCHIPY5VRoEUGiVO3Ng1TXA3xFXhM9Xn7h1r1XHeOR9f+LM43At0Qt4hVFgkGR0S5O2ST4SFwhCGCD6gLnArFIXhKElg9bUHcU1l4rXzEz/pmy6z/qd0L8M/+Icv81F8/QBUkmZiyxMLFYv3lz41oHEBG0cd+aO0dKVAIWwJFkF/n5r6eHm/k124gJvK0uN8ON4o9OP+uv9z0An58bjnWlwL3Sa5CCNHTVglwuxGv05BsTe8Rh+Z8CYqMg5jfUENR4hU+0EE8QweMZ2FaFGPOsqPOxuuwk8eG8a3q4OWIAheOFOifvpgM1eWBoN0PazhQESokX/LRjdtVpUGLPu+Yi4gGwwBaZ6XplhmoCPKoKWaiH7oYMH7OgNPSXRhzTtD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR12MB1148;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR12MB1148; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ4OzQ6R0loNVZObitSMUl4TlpVSy80TVoyaUN0Lzh3?= =?utf-8?B?R0gwb0YxU28ySERmWmcvWEZjT2VrZWt1V0tBQ3d4dDIrdXVFSitqdVh0Viti?= =?utf-8?B?R3BnSjNDY0lUREo3NEhCelJvWFZ4RnRjMThaWVBDNlhnY25JandraERRbm9B?= =?utf-8?B?MU1xUk41YWo2eGNOZSsvc2FhcDh2UHM5dXdHQ1U4d2o5UHBWd0VtaTRKbkIv?= =?utf-8?B?eDhDL3NWQ0N6dnVKN29nOEdPSmtTRDA1TkYzU1JBeGp4ZDBYZEZRN04wcXlU?= =?utf-8?B?NnJiWU1GMU5VQjh2anlyL2JhTVdFcitiZUxET3M1c21temVjK1lQTlA3Ry9s?= =?utf-8?B?VkozaW90WUIyZmRrdDBQamx6MktIRUpRMlpwWUNTRUlYKzRXaXd4b2RtdU9y?= =?utf-8?B?c3V3R24yT216aGxSREFLKzN5ZHdHSlFhb0o3Z0ppWVVyQllMQm0xUEFIcjdM?= =?utf-8?B?czF6dlU5clhyQm0yNjVxa01RZWlyUWdJY3JWemdvek14VlRGMURoNXdKWWZB?= =?utf-8?B?RlQrSUZTTDN0MWd2WHFIZi9SRjN4bkFrVmJydnFpQ1luU1FuQkN6SHhURVgv?= =?utf-8?B?bitoZWgzSCsrMkhRNzh2TVZ6c20zZDROVkRXNjVZMERncFhmY2Zqang4eVlC?= =?utf-8?B?ZE1NMVFjdzNlUVhqVjAxblhldlRjOVZpNVRyNU5Pc0xuMTlWbWxjaElna1NR?= =?utf-8?B?NE1LKytnZ3dHQTV6eTJFVXlPOVpPWlFTU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fIsfC?= X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39410400002)(39450400003)(39850400002)(39860400002)(39840400002)(39400400002)(5660300001)(6506006)(6116002)(1076002)(4001350100001)(103116003)(3846002)(55016002)(230700001)(47776003)(50466002)(189998001)(8676002)(54906002)(110136004)(54356999)(81166006)(66066001)(53936002)(97746001)(50986999)(305945005)(2950100002)(6666003)(76176999)(38730400002)(23676002)(33646002)(7736002)(2906002)(9686003)(86362001)(7416002)(7406005)(83506001)(53416004)(42186005)(25786009)(72206003)(4326008)(478600001)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1148;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMTQ4OzIzOnk4ciszdHVLZmh0TXA3TGJ5NERjazN2WGJQ?= =?utf-8?B?ZmovY3E2dUVRTzB6WEZYSU40TnZJS0NvYVlOaERwc2Y2WEpKTmVybitXakFk?= =?utf-8?B?YVlMaFZZUzBibHByUEM1Q0hGQUdVbW40VmV4NE5YK0RIejV0OGR6UkJ0ZWlX?= =?utf-8?B?L2NvTmI2OHZpQXBtZXJnRFBDU1AvdkNsWGt1dGpIRERCc0R5STNKVjF0S2RC?= =?utf-8?B?b05MMHVtWUNPSVJxaDBrZEEwb1l0QjhOZ3JrZzdWWWZiNy95eG52QW51YkFM?= =?utf-8?B?OHdxVUtUQjg5Y1Q0UWpNM2Y4d0o4dzRsYjhSYVlGeTQzWGVtMHNxMjNST2U1?= =?utf-8?B?QkY4cjYxaTU1MGQ1UzhNSEt2RmRHV1BHQklLZ016bmNXYkVZaVJac2Q1bUdG?= =?utf-8?B?YTBBK1ZjblNPbzE2UzVXUlJEcjQ4NGhxT2xwN0VpdWJ4eUYzVDA2bS9ySmNW?= =?utf-8?B?TXNZcDI0Nk95NCszOTN2WWs5aGtjVH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pB5iMnZBy7Hg3Uixp6NXH8kaXfYABZ7cwqheR80g0ERwFmKoicj0dwmVVeSk3spQeok2Cd8VgzXWhNqnYijd2sR/b/sgWJYcrpo9QPwBO5AsbJWtR1o/QmdJwqLyBdWSVbGHqZBJsfMwZ8NSlpWKR0SOF+gncvdixKCpG X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2017 19:16:20.0520 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1148 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2449 Lines: 76 The efi_mem_type() function currently returns a 0, which maps to EFI_RESERVED_TYPE, if the function is unable to find a memmap entry for the supplied physical address. Returning EFI_RESERVED_TYPE implies that a memmap entry exists, when it doesn't. Instead of returning 0, change the function to return a negative error value when no memmap entry is found. Signed-off-by: Tom Lendacky --- arch/ia64/kernel/efi.c | 4 ++-- arch/x86/platform/efi/efi.c | 6 +++--- include/linux/efi.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 1212956..8141600 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c @@ -757,14 +757,14 @@ static void __init handle_palo(unsigned long phys_addr) return 0; } -u32 +int efi_mem_type (unsigned long phys_addr) { efi_memory_desc_t *md = efi_memory_descriptor(phys_addr); if (md) return md->type; - return 0; + return -EINVAL; } u64 diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 43b96f5..a6a26cc 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -1034,12 +1034,12 @@ void __init efi_enter_virtual_mode(void) /* * Convenience functions to obtain memory types and attributes */ -u32 efi_mem_type(unsigned long phys_addr) +int efi_mem_type(unsigned long phys_addr) { efi_memory_desc_t *md; if (!efi_enabled(EFI_MEMMAP)) - return 0; + return -ENOTSUPP; for_each_efi_memory_desc(md) { if ((md->phys_addr <= phys_addr) && @@ -1047,7 +1047,7 @@ u32 efi_mem_type(unsigned long phys_addr) (md->num_pages << EFI_PAGE_SHIFT)))) return md->type; } - return 0; + return -EINVAL; } static int __init arch_parse_efi_cmdline(char *str) diff --git a/include/linux/efi.h b/include/linux/efi.h index 504fa85..8bcb271 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -973,7 +973,7 @@ static inline void efi_esrt_init(void) { } extern int efi_config_parse_tables(void *config_tables, int count, int sz, efi_config_table_type_t *arch_tables); extern u64 efi_get_iobase (void); -extern u32 efi_mem_type (unsigned long phys_addr); +extern int efi_mem_type(unsigned long phys_addr); extern u64 efi_mem_attributes (unsigned long phys_addr); extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); extern int __init efi_uart_console_only (void);