From patchwork Fri Aug 13 16:59:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1E49C4320E for ; Fri, 13 Aug 2021 17:00:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0007610FC for ; Fri, 13 Aug 2021 17:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbhHMRA1 (ORCPT ); Fri, 13 Aug 2021 13:00:27 -0400 Received: from mail-bn1nam07on2069.outbound.protection.outlook.com ([40.107.212.69]:7591 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229841AbhHMRAZ (ORCPT ); Fri, 13 Aug 2021 13:00:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=flWRAT8fnukugsURVuo2WbUPXpwDWendO4ukKnsHjcWpY8A9QAkJJtY4iJlPI4VIu/lZFacuI+WkdLT6dZu3xY1JjormMK2Rc6mtKzDMsbcjYnsYwzX9YomVVEOfL4y9ZD/jTY3Nt8NLk0m6BFUwqZsTIIZWj2YSfs2yIzQMa35NBHUMILWxp1ht3p2xNnJb/ClcXI17wQBfJKkqXwcLCeK5pl9pfewySUXhDwUh4eXwuZ1K9GDPPrm3Y7qRZv591Uhc5m7Ba2/9ncXCPqLzsvYTT5/9YbZ4Fwo8JOA+kbnD8BKIw5Le+RahuCG9PdRBG266pmDVgQ1uYbFqYp1Ycg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TejLyUpzQ6IZ/s6ownAXRi5rr4cs8ph09jrUknc3bNM=; b=Eovxw3Y1p+BqOOOMzTrBcsS8nGtmdw1qL+1IztB2B/R/VIbuJ98vbgr6IylGs/x4/EvHg+LjB6YrEy4O+y+sXLQaZqJCGusM+EC0cvUm2JzGSQVA1sC4xRUWn/b7KG+naKYGg3OW2jssnO+5uK8cJKbX5uQytTCgddrHO/rksHd4bjuh6d5WvzpBNVsMwfMO84YN2bbDKBW7Q23reZsIutlYtke0gqnRrva5pFwFICfS763h46golsioraO6ifVeOy0tjwr0loHSndm0kyB5tL6CY2375GqdU7dB8knkxs1hxG4pN0UuRww+kZGVRywbplKEEPcs9Vmu+o/BkgliKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TejLyUpzQ6IZ/s6ownAXRi5rr4cs8ph09jrUknc3bNM=; b=RglP/G+LcNi0YHCOgvnduuygjDSeuu5hRUB1mj+L8bcopCm1WpI7qqP7ozBGf+uq7jzlMVSm9A+Xlb7PHwLu3Ll5A+MD3q+tbFSlB+J8zjK7MXlj1+K9AFj8QL7GmvzEZc453JqFvTIX1MsYH6Hjm5RSre3Ctc5HTHF53Jf5xdo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM6PR12MB5518.namprd12.prod.outlook.com (2603:10b6:5:1b9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Fri, 13 Aug 2021 16:59:56 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 16:59:56 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Thomas Gleixner , Ingo Molnar , Dave Hansen , Andy Lutomirski , Peter Zijlstra Subject: [PATCH v2 01/12] x86/ioremap: Selectively build arch override encryption functions Date: Fri, 13 Aug 2021 11:59:20 -0500 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SN4PR0801CA0017.namprd08.prod.outlook.com (2603:10b6:803:29::27) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN4PR0801CA0017.namprd08.prod.outlook.com (2603:10b6:803:29::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Fri, 13 Aug 2021 16:59:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6594ab2-8c4e-4483-e4aa-08d95e7bc6dd X-MS-TrafficTypeDiagnostic: DM6PR12MB5518: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YKOeCVWLQxbtanGHAmPBV5sIWlHP6OHhnoq0XBmHo4/PdrH+PBsrxVWM8o+3rzk1sR5fAwf95B7niVB3W6Da7+OznKMOyazCckXkvRWDOROkp6zOjl8c5mPJDv/dfjsJtzhyjAM3ATVuO3SgBEhm1AdVIFwAzIUDFNfhcfFWM96SNgvwnfpxWdMYZW6EwB4pxilBREjEQ0jMxl63zGOORpRONthh+EeVY+P0GGg88spXGiOFBnynfNClUNSwZlseoUIcOK5UbhoSE4ywgwRCTQqVrf8Xsafx3wZCKrqxOKUjzeWxdIAEKA/8YD6+7M6T0t879L/Zbrw/LN/brqbevnWTCWx0YxWKBGgjcPUNYYRHT/10KgVVQ5/11BXqtdFF5oTUTBBZsbK6WgAOrVyP/q8RwVtf5VKPcvf5Py27MBtLGONaBQzluTg+ARisiatIsqtp05pVWqhDSLaCNGg+VRmHgEDTn5qGNAKcz0bIO1+BalckIrpSuFOnq7+++aa0LNYhPTD+qWImYxAYABjhAuHl23BcHJnvupXYsw6M4uYJspzk6jLqRCutLVyC3ORNrLz9yFbdjIS3UHj47EirHndCrA86QG3I986GwpLCOz3bgu4lIZivsBxPe+3puEW3QMm11I92+rtG6aiQx9fqclmJecVEI1umO63c4JuFqe5l+kmxY7hY/+NH5/KpB7I0PUFYg+XoSMSEsKNExmovfrL6O0kD94ucZxt3mEIlxF0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(136003)(346002)(396003)(376002)(66946007)(66476007)(66556008)(478600001)(921005)(7696005)(8936002)(8676002)(26005)(52116002)(6666004)(36756003)(186003)(86362001)(2906002)(7416002)(83380400001)(2616005)(38100700002)(956004)(38350700002)(5660300002)(4326008)(6486002)(316002)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k2uuyrFNe794i9ZdcxzXMnabqnIA3Q49tsutonfhvqTHsXiHHXoPOvBVfkxhNYn/E26ALsENT1KX3eTFKB8gTErrnqCshkYd+KQDL2a5O5s0t8WbpoZ2arbSZn9ST09FaWtH8HH9in7UVoorySmCYHdIeNmrpK5pi2O/sbpcta7tGul1Q3gG8u0VDTfK6JLTBz1LYBVQ0pPQxKS+cFzXiH2ZLZzTqFmgfw+6TNNAlXUajcJ6N3mYcwt1refTvd9492Kn9SMg/CH6L8r0SHHjmYKa+8O/oxTs2qwQh4b0JB5PwBj/X1KrDQBFo/ABLSyyonIMCfW/+Psbvv1+DKwp+UY9EFRj4EZiwkx1xsnUCdSMRADfqbTqWHlJZZme/4IYLCepNAkKgmI2ttCZWxxnL/lQ7PMYAh4yqa0251lstnffzSHtabkvQCI7MPdQZsAc/EYagxX+i+QGeMWKmh5rOjcz8nSVboXU52tSRKVUdVYZnqO8fW1Yt1+lM1WbZqYvhVYZY05EIt57TQKR0Nzx2inn4ARSGNwlektUBGExYyVP4dg2+fgHl/P3Oazx2g6R199y3djMDizzP1YG/tx8zOMbEllOPnWC3mc2iBm6FyLoDPmfjMbeIKManNzku+hCMUQyyf8GnFj/azoP3ynwCcPG/zZYbtCqNgoWte9dNXwI3V83pxBQ6AHry44R3Fsa+hC1/ByA2CmjH7rAqcbfUYh6K6BeVMO258ZnteuCGEi+x5q+TVIjIImMi03XTXD1Ek9cbk2rVjgWGNBFq4+biPEK70v1/+h5Dh7dco/AXttUQFa8v/OaH7s7ItdNn9N7G/iS6guwiShhsQ2r0fsVIXaBNudCs4qk4tILFmunZLaOWtCigzWH2XF5+amjKJFMULM1fx3r8DENksp3E7OuUzKfT7jI+gY9rDqhRYwWiRUWTWArQzZDVPddveNI0UptyLdle3rDYW0q2kKr8LxYpbKXk4N5YpD3+t4LqdZa90hPjZknS1JdTrY+4tYoCvvGO+X3nppKhzIGhvTT+eJAk15w84e+MmcPrhLHhVLa3HYY93JmHGquqck32ifypPw3iPHb8BAMXDga1RhqQSOGFeh2IzvtHQxe3B4ecO00NMxbtCuY/Ff7bSCaFXKz8XnZOYcfvweZWmQ2oXWgGY8/GzB2JSVD2+hhqNLY/yAKyIFNfuut4aco6xe8bgIAsU7ZeY5sDyz+xw2iw1Jh1tZ+TT5vswFHQmuupOryLlZAtZ97+1TWugC5Behm/wEBSXob3k9crZc4/E03YHEp4xGvnKX1DkizSA7jNY+m28sd9upG9TkMiEJXCLjdl07kd5mT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6594ab2-8c4e-4483-e4aa-08d95e7bc6dd X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 16:59:56.0771 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T9NlcWMTlrVaBAyUizVvPvLOMQQ0pIyEWQVdbL8QkKK29ZIS24x7X1mfitpwkh5+PzcCMhzqmp4EtNAM5lbopA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5518 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org In prep for other uses of the prot_guest_has() function besides AMD's memory encryption support, selectively build the AMD memory encryption architecture override functions only when CONFIG_AMD_MEM_ENCRYPT=y. These functions are: - early_memremap_pgprot_adjust() - arch_memremap_can_ram_remap() Additionally, routines that are only invoked by these architecture override functions can also be conditionally built. These functions are: - memremap_should_map_decrypted() - memremap_is_efi_data() - memremap_is_setup_data() - early_memremap_is_setup_data() And finally, phys_mem_access_encrypted() is conditionally built as well, but requires a static inline version of it when CONFIG_AMD_MEM_ENCRYPT is not set. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Signed-off-by: Tom Lendacky --- arch/x86/include/asm/io.h | 8 ++++++++ arch/x86/mm/ioremap.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 841a5d104afa..5c6a4af0b911 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -391,6 +391,7 @@ extern void arch_io_free_memtype_wc(resource_size_t start, resource_size_t size) #define arch_io_reserve_memtype_wc arch_io_reserve_memtype_wc #endif +#ifdef CONFIG_AMD_MEM_ENCRYPT extern bool arch_memremap_can_ram_remap(resource_size_t offset, unsigned long size, unsigned long flags); @@ -398,6 +399,13 @@ extern bool arch_memremap_can_ram_remap(resource_size_t offset, extern bool phys_mem_access_encrypted(unsigned long phys_addr, unsigned long size); +#else +static inline bool phys_mem_access_encrypted(unsigned long phys_addr, + unsigned long size) +{ + return true; +} +#endif /** * iosubmit_cmds512 - copy data to single MMIO location, in 512-bit units diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 60ade7dd71bd..ccff76cedd8f 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -508,6 +508,7 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr) memunmap((void *)((unsigned long)addr & PAGE_MASK)); } +#ifdef CONFIG_AMD_MEM_ENCRYPT /* * Examine the physical address to determine if it is an area of memory * that should be mapped decrypted. If the memory is not part of the @@ -746,7 +747,6 @@ bool phys_mem_access_encrypted(unsigned long phys_addr, unsigned long size) return arch_memremap_can_ram_remap(phys_addr, size, 0); } -#ifdef CONFIG_AMD_MEM_ENCRYPT /* Remap memory with encryption */ void __init *early_memremap_encrypted(resource_size_t phys_addr, unsigned long size) From patchwork Fri Aug 13 16:59:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E16C19F39 for ; Fri, 13 Aug 2021 17:00:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C24F8610FC for ; Fri, 13 Aug 2021 17:00:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbhHMRAn (ORCPT ); Fri, 13 Aug 2021 13:00:43 -0400 Received: from mail-bn1nam07on2053.outbound.protection.outlook.com ([40.107.212.53]:7758 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232124AbhHMRAm (ORCPT ); Fri, 13 Aug 2021 13:00:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUqzTUNKgDJTbc+3czmmRG/ouMQXddukoPIQarYuSl5EP+e5NqHL4u/DK+LkiTBExMzevaHth/1m7P0OoY5OHPHVhCTI2eR2QalkZZCvf2ARgAi0zele/ij+yHuqDMh1rjcDwfhNwN1B/ktPthkVcWpK8x9Xwbj6hFHlhCcWDhmTsoGUehu+bpOHsuIAw2FDcLXCrOwbcem3XSm0Ku/71xFJ8kPby3+fJeQdReifwnnMBVkBmy6fSzeb9mPYmW8ZivLhF5dJwHpjHCtwvssY2eMWoWeK+VUSF1uVbkr6lCYkiy6pf3D8Wbg5V8JBM3QndL2xhhUYK3frxSJKml4qSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UuLcJW+E15YGcvv29k84VPEZb+rr27P9muWMmGZdDk4=; b=hgyJWL4yNVx20DPg/YcChMSewOd3/1O+GeByG3JNlu1CBQdKGHeU1iRF6RS5Lk7fWm3GZsjgpqQ7qDnHTKXmiSzdDxldlwylPmBcvi6yUC359UFXAlstwB4SdNmEfgLpFNJNZgrP2dWUzlHrDPnxjF/lKAXjuQP9j6A+t8F+NNfGueUIqCt7WldRMhAnMgLATz+EPY61TkeR4Yfxwgw/T27vzGA2O+6rzZf3P0PY1hvu6R88vkCSfuq5ZlNgr9SdSrNbw24ljRm+f1wRTx6KqCgTrq7dl5n6K9G8QGHQxCCIU5lLo3hdE6LN8WvC2pM27mIrMCxaEeHgLo5bnn1NKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UuLcJW+E15YGcvv29k84VPEZb+rr27P9muWMmGZdDk4=; b=h74Ok9b75CY/+Fx8CnJDKHkZvmfLwPiDkEFCY4nPjqzNpDY7IY3Phmy/PvKurpvcxozwBAfvsJyf+6GcWQMwrYpYjCBk2Fd+tlSL6/v6DcJ3pGa+FlAkNkZGPGhPGAQMNiapWAjh2v1HroCoiFMb9FOqOo80NQLbhX+7CmAKO9E= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM6PR12MB5518.namprd12.prod.outlook.com (2603:10b6:5:1b9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Fri, 13 Aug 2021 17:00:13 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 17:00:12 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Thomas Gleixner , Ingo Molnar , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Joerg Roedel Subject: [PATCH v2 03/12] x86/sev: Add an x86 version of prot_guest_has() Date: Fri, 13 Aug 2021 11:59:22 -0500 Message-Id: <7d55bac0cf2e73f53816bce3a3097877ed9663f3.1628873970.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SN7PR04CA0057.namprd04.prod.outlook.com (2603:10b6:806:120::32) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN7PR04CA0057.namprd04.prod.outlook.com (2603:10b6:806:120::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Fri, 13 Aug 2021 17:00:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5f97b9c-957b-4214-04ff-08d95e7bd0d6 X-MS-TrafficTypeDiagnostic: DM6PR12MB5518: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r/NUz6w5jJM7GGJ6YvdsS40louMSqdi7c8uC58YY1Kh3jc/VmXGyw3v1JkzukbEImPndFQ0/8V/LuhziWw64AHwpNYw9NA4nueDozLzhHrhnJhFy7y0MxIMCEI7IGftw1nI93hfRoQDHf0k147Cjid/T1o/t3ioR6Sz8XgdNbFCVc5OOaf6MY7cpcqhLK5riAbGtwS+bdnoEX9y5uLvGyDMntJvDe3sYEEwHXWVP96lHjvc/6SjY60j3nul1+v1ljPpJ4WpLoVGIFW1r9m2onPoJYdwg9SV/xg0Yjug/WuQCpdJ/2k7f6oCQx2SVqjLt1goF9hfuZGRNKIlWBJss/Nbdu/ZtStoS0x1EmtL+FpCI1R8hNpS44JMMLFKu5J7TXStd1J3PYcRXHjwEzIGsnj+clk2F6f2C/ciVia8ovtxBYwrmjtpXcjo85tBbkTGrAsm7nc/zkVOGXC/osq5tUk3DUWo5vGQpxl3XefRoqi36irbhZCqiMkqE8VQVT2P0v/MMMo5IQJXA+U/pFx1Hyr9SVIFA1E6R68O1TwtuNsKxdrU6GOozOhQtU71g4SmVQIGUIkhD0+G7tkyc+7CWLPN6rRbOsRonDDewRIcfWKRC99tG9HcH78DADrEXmUM+Nnp+CztxoI2qgKDA/ImhO3NjghS9HsQEqujbBduT0CPtyZeC1QGa/QuNRS3xjdb3G2ipYtLYvRbJlWysal59yp9Zm2oDctPLlfxlin27AQY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(136003)(346002)(396003)(376002)(66946007)(66476007)(66556008)(478600001)(921005)(7696005)(8936002)(8676002)(26005)(52116002)(6666004)(36756003)(186003)(86362001)(2906002)(7416002)(83380400001)(2616005)(38100700002)(956004)(38350700002)(5660300002)(4326008)(6486002)(316002)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KxFT9aBqUdOzsjtqL3L6GpbGsQF1fa1ZZn+lzWo0PKEIfs0BfMV0QiHItHPZ8P5lGuGGM8DiVTZ2CnvwumPXgag6Y1yYTevBrBwcEe0lansLUVNnnydIj7BNdgf3huF3VaL4bQ6+E7U0/o7lcNTVvR8Yqdw6J3VJjfv4arXmnfoHtQSl/dWq3TLWQopKu007OmFFtq984BEG28+4IiMFbNGy01p5QMwsA9XY9Xb3DInKHwPvMlo8SWN4kD1a97WlbOFbUVxGjNFXEgI7EENGrMsVlxSJTEBlOJ64/tyNRr+wU+z9ZMYcVaVOzHUYsGL5XUNUeqqu3eyGQbG/7vc0T4g7Zp5DQ1Zw7IQx6LlzqGjyTGVx1bFD9Ak+DJ46docHjkjafJif40JL+c0dbOZ+srTY42xRi+c6h250IwqJWco53Cc+WSs15BdzJuw2rFOEAwjA/D6wwfstOq2dczZRg8/vO1513gXyv4FVtvFSs25L6bLXNgEnghp5f3oRVB9qz6k/Djv+JTlMgDZr6uncrYjqxFKkl4rwihCF4hsKNY8dXTC0qeanFK2CGH+Gwc5Sbzf+EVUeXjI0vZ9VV6AiIM+ZI34ZN4IFr+DCNTOIwKcUaaKPOcM/svQKOBi7dOleHBj2ApkyqTxjW1q3sAppE1cuyZdON/yqGWPczZ3+8Hj7hXlKl+bCoNRwkpH015SNhMeYSuvOw6uvdtPHO8jPMN1fJKHbgyNAWZGdmdvsr3+b1JnwGbRpBMElfuN6phyniCod0TUcbbAUf540Ni9NsDPUheILUaQCXh0bxni4NZJpCR9lfyOVf5rV3MXYUOPdCV3BRZo+fRhPpzVvRFetXGiO7nkIdymSNmmrN1GpzTicVXryHqJtTbk0+IyhEdOdtQVyW8lWSNfh5MsJS5qwzEn28M9VcOQ5gdjPk7SkpiHWneEYb78zrB5EIzlqaE4eQc9MgO0fb1Xwsl716ojivbCjSe9olaHRfHWrXge66CSqOdxO7dm23qp1FrPH3xCqrVRaQwtnAOyx4zbgxjh3PTL+K4pph/Y6xWV11GBq8m6j0HsvudCTOqigrvGenZbIEXvV2ytn6xfHtvtpMlx9E5HttWdhvaqKhKkTwGEIS3T4yPC0moLgFGRyTmYMpELfpxq+4dNQH8Gv/65v4fqEenhZpKivDecLVIuvRg372Rmt1KrRsyptJ6/djbeaVOiT3JHgs9GHH5bp5dlGqLBy6tDwjDX4mOxfgmcqZZyDJfNUEBTE1r2OF6bc1+KP1RiK4SgpStrPvJkobuSbhRvPgXsrGWy9bK+1bT7uS+S77rx/tRAHEPJAC8JPNUX5KnUj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5f97b9c-957b-4214-04ff-08d95e7bd0d6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 17:00:12.8296 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mgJH5nvaD3AfbaqDT83Kpjzld6tRalsn09ncBpTYhmmh66wJ4mCI4bJ3NWpLx/lLSYTIc0J0vq6YzFW8Jv5GOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5518 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Introduce an x86 version of the prot_guest_has() function. This will be used in the more generic x86 code to replace vendor specific calls like sev_active(), etc. While the name suggests this is intended mainly for guests, it will also be used for host memory encryption checks in place of sme_active(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Reviewed-by: Joerg Roedel Co-developed-by: Andi Kleen Signed-off-by: Andi Kleen Co-developed-by: Kuppuswamy Sathyanarayanan Signed-off-by: Kuppuswamy Sathyanarayanan Signed-off-by: Tom Lendacky --- arch/x86/Kconfig | 1 + arch/x86/include/asm/mem_encrypt.h | 2 ++ arch/x86/include/asm/protected_guest.h | 29 ++++++++++++++++++++++++++ arch/x86/mm/mem_encrypt.c | 25 ++++++++++++++++++++++ include/linux/protected_guest.h | 5 +++++ 5 files changed, 62 insertions(+) create mode 100644 arch/x86/include/asm/protected_guest.h diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 421fa9e38c60..82e5fb713261 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1514,6 +1514,7 @@ config AMD_MEM_ENCRYPT select ARCH_HAS_FORCE_DMA_UNENCRYPTED select INSTRUCTION_DECODER select ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS + select ARCH_HAS_PROTECTED_GUEST help Say yes to enable support for the encryption of system memory. This requires an AMD processor that supports Secure Memory diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 9c80c68d75b5..a46d47662772 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -53,6 +53,7 @@ void __init sev_es_init_vc_handling(void); bool sme_active(void); bool sev_active(void); bool sev_es_active(void); +bool amd_prot_guest_has(unsigned int attr); #define __bss_decrypted __section(".bss..decrypted") @@ -78,6 +79,7 @@ static inline void sev_es_init_vc_handling(void) { } static inline bool sme_active(void) { return false; } static inline bool sev_active(void) { return false; } static inline bool sev_es_active(void) { return false; } +static inline bool amd_prot_guest_has(unsigned int attr) { return false; } static inline int __init early_set_memory_decrypted(unsigned long vaddr, unsigned long size) { return 0; } diff --git a/arch/x86/include/asm/protected_guest.h b/arch/x86/include/asm/protected_guest.h new file mode 100644 index 000000000000..51e4eefd9542 --- /dev/null +++ b/arch/x86/include/asm/protected_guest.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Protected Guest (and Host) Capability checks + * + * Copyright (C) 2021 Advanced Micro Devices, Inc. + * + * Author: Tom Lendacky + */ + +#ifndef _X86_PROTECTED_GUEST_H +#define _X86_PROTECTED_GUEST_H + +#include + +#ifndef __ASSEMBLY__ + +static inline bool prot_guest_has(unsigned int attr) +{ +#ifdef CONFIG_AMD_MEM_ENCRYPT + if (sme_me_mask) + return amd_prot_guest_has(attr); +#endif + + return false; +} + +#endif /* __ASSEMBLY__ */ + +#endif /* _X86_PROTECTED_GUEST_H */ diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index ff08dc463634..edc67ddf065d 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -389,6 +390,30 @@ bool noinstr sev_es_active(void) return sev_status & MSR_AMD64_SEV_ES_ENABLED; } +bool amd_prot_guest_has(unsigned int attr) +{ + switch (attr) { + case PATTR_MEM_ENCRYPT: + return sme_me_mask != 0; + + case PATTR_SME: + case PATTR_HOST_MEM_ENCRYPT: + return sme_active(); + + case PATTR_SEV: + case PATTR_GUEST_MEM_ENCRYPT: + return sev_active(); + + case PATTR_SEV_ES: + case PATTR_GUEST_PROT_STATE: + return sev_es_active(); + + default: + return false; + } +} +EXPORT_SYMBOL_GPL(amd_prot_guest_has); + /* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */ bool force_dma_unencrypted(struct device *dev) { diff --git a/include/linux/protected_guest.h b/include/linux/protected_guest.h index 43d4dde94793..5ddef1b6a2ea 100644 --- a/include/linux/protected_guest.h +++ b/include/linux/protected_guest.h @@ -20,6 +20,11 @@ #define PATTR_GUEST_MEM_ENCRYPT 2 /* Guest encrypted memory */ #define PATTR_GUEST_PROT_STATE 3 /* Guest encrypted state */ +/* 0x800 - 0x8ff reserved for AMD */ +#define PATTR_SME 0x800 +#define PATTR_SEV 0x801 +#define PATTR_SEV_ES 0x802 + #ifdef CONFIG_ARCH_HAS_PROTECTED_GUEST #include From patchwork Fri Aug 13 16:59:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496800 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 127F8C4320A for ; Fri, 13 Aug 2021 17:00:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1B9A61103 for ; Fri, 13 Aug 2021 17:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232168AbhHMRA5 (ORCPT ); Fri, 13 Aug 2021 13:00:57 -0400 Received: from mail-dm6nam10on2088.outbound.protection.outlook.com ([40.107.93.88]:34945 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232179AbhHMRAu (ORCPT ); Fri, 13 Aug 2021 13:00:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oK/2Ut8+AGCxUJx0W5zycF1x+1t2XqAU92mfds1VP60UjNDCnHUNw8cedHlTpjai+brFHkbEwAFiDbnfrPmWQHrewRLtO0HhI+6nl5fyQnobsge5ggCM6laOfBMk0s5uI5Wxh7pUu9VJob15xl+bH4s9BO+5rTMHCYsy3zZsr/w1Ni8G95rHPbMQROFDT6hIODSeb0K2U9U/5lfV12gxzs/WVIlJrLAFtS19OIT+sGqYnkYMsT8kibIJBeFJhLLR4FdrRdkr9UApazqpmp6mOC8oL0EZSRXvBMSoezpMD5W8z5im0gs6jISYwsV+FICiinCpDxym0sfV1BVb2b4KgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7rBYhxwUFw8fcyx0fuQ206NyJJMRUZngGck8eTaViKU=; b=ixPBh0cVUClx3XazcvSoLSGIhzRwzxGV48OibUA7sLo06G7Ai5zul/+fkl/TKOBM6RGbChtxv9TzxM3iQMrvNX+JgSeyuw7kLr4/ZgzKO7TeQO5OiIMZjJEEGxkErwjXAxfkHrf4EMJrQmiNm1B1RlyqSGOmd1/TtV1I8OWpxh+qpWAvMYSDiHnfnZUclaA3/cGpQYXSNIyFzRMjLZhcCEQpW66mizS8CPdzCpN/pA1Hu45+vr1rXOy7HSyuGuw2vKHXkih2dYZkvcxihBraQLcJF0XoWX9X7PTTv6+FPh8XltQIbIRsltJ6o46qJ58EZjaNDo+PIqc+LHWebNyuSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7rBYhxwUFw8fcyx0fuQ206NyJJMRUZngGck8eTaViKU=; b=GVgMojjDS175NnefMN+kjwSgsWvicHKrgnLflWnzkYu1E+ihwWIVwsZi6W1puvRbBZP6enC6s28BGlg24IjQ4moo/RnwC6K0QStCVdRfJjgBrE+hQBzY3t/SMrEO+BIdlV8gnvGyGnvggOo3zLQAF0otdFhgrvscggqXzgUstww= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM6PR12MB5535.namprd12.prod.outlook.com (2603:10b6:5:20a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Fri, 13 Aug 2021 17:00:21 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 17:00:21 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Subject: [PATCH v2 04/12] powerpc/pseries/svm: Add a powerpc version of prot_guest_has() Date: Fri, 13 Aug 2021 11:59:23 -0500 Message-Id: <000f627ce20c6504dd8d118d85bd69e7717b752f.1628873970.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0100.namprd11.prod.outlook.com (2603:10b6:806:d1::15) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SA0PR11CA0100.namprd11.prod.outlook.com (2603:10b6:806:d1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17 via Frontend Transport; Fri, 13 Aug 2021 17:00:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6bce5eff-be55-45d7-dbbb-08d95e7bd5e9 X-MS-TrafficTypeDiagnostic: DM6PR12MB5535: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z5HTomtymFVTmu4fZ5h4REqZZbJsO/VgEfAZoc7RxxTHii4xYzMYghE2G/djmL6z5ncpMekJtllsReLXD1Opx8ikmjHftat8V8SIdoFn70Aoy2Tx3jl0FWB4QBPBKVvK85S6exN363NEeD3mTZJS9eN+DWq0H4lcICxm9mfY5G+RWYIZ1qp3Pg3P/VO2UQPJOueymH7j+vnedPE+xIkvyqv2u47av/2QYafashGp+EJx0Ht1aAUKQubBxIiGvvr9ocsdoDbv3OM4j+lqHKGn3gpvy6U5BDb19QvrseLsa4hWXeuv/S/p0erTYoMMPEHkKhT8MmcbiymegA5mUZMinlCltm80Je/N1YAG7c2ln3yhxe82FECa5zBeu30KXWPagB3WbLfwXEFjNTGBmRcU2oaqsqyCmGWsAwayed8/k6PlWwZqqqmM3sfQV5yCqJ+X8GN9OJmRnDu7/5XBtLGIUhSlO9eyP+4Dw6Ov15Ydd0DIsCToOw0QbXNGqnHyM0uf9TxLJGGUHpQhLaKbu2vgPVosntgRnu/2kg200hx/QEIl0sVGBLhkc5a3H2pyJxTpLUdeXNzGLS1IeLF2IWGGqGlpUIS+jcujpF0KinNCqSyOYhXMmCRWz58pBxyO3az7Ph/+u9s8lTDj8OVHgBYuBbkbbzaKOZbuX/RvSdKByqjcJlNGeKX5pjmk6oWEzGjWq4qUA+8wDZvsjiI8kLikUg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(508600001)(66556008)(66476007)(921005)(52116002)(66946007)(4326008)(36756003)(38350700002)(38100700002)(7416002)(7696005)(2616005)(956004)(186003)(5660300002)(2906002)(26005)(8676002)(316002)(6486002)(54906003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: co/jy0FU9OZZPjQPiXPlHdwTIioZtB+0e7VWEGI9UYLUnE+4eh4wtxWPA1mGUXQIMesbYMFDDWCSgdc3l0pXWhKMTSrG4ocP9WWIFufkSnGNCJzZ/k9WYEG5PM04wTK7rPo0aqOuSJLZn/A5gSJcR1AO6gte755ENRmi6bn+NoTgDAntoVf1Y0O+xK1UT5sD8HQnKwq0BICObSKjcThZ1xnNHy5mZQUaqlL1XMkZ6aI8FJBz+of5XGXGWxmrV2MKxat4ySeKdyhNe4d/qJRJlLGaOElGmN5jiaF4JRcT2kusGpjbwfFaxMzz9akJxIbia4KdIC8MH3XTwny1g48OTmN0THOwxHiP1eyUx0yqcN+Z+xgsWKmeVoe96PzPvR6ez0V6vNJiFWVmdrzTmDKRMRATAaTDxGNfLBGPatac91jE6ux1wt9b/BE32r3y1KVnf2zi1F4DnJG4Is4AbXM8L0itrplb8fVBVamWiG0Re6LD9OpOdnC2fLAo6cU8BdN72xQY0V/bxKtK6EdW6fKXY3gGrBSccbJWizA/tB/JlZKH4LT1LZsf6Qu1OP15MKDdRihy8jpfdAwY4/ZA9yZBZ2uKi1HvEt2TlXpWWAs2EMaPJASFsHQme9KPDDw7l4vWE5D8EAEwxmGSkpjnXFWdCErEggUaB67A8z+PFbrfD7VjZr76R7nTdQESla+MiW+4yG2Feca/oQi4IyZ+vW17Q/6fVXKmPSunLfPvA3TnUn55UKZGHhn0iXqweP6y1dkSG8eK0ca533bxz90vtx8x7mrrD2MSpxvHVm8Kr4bN7v/tgQ1ECbZJ+y8wJVYy4QlHefwcFaTOJ4Kw2TFuCj3vBUVZ6CfxRXlFoJHXYzmkYm7qyU2sqmtpeVZKlwyK/hZnV9jr6q8IRlSxM4UKhhNL/1Y3JJOAwK6BInMInBGDc2/UwThZVWLj6UrCQpP19LuDkfP3PSapX2SqoffFbtTneOopIBtW5vp6oBd8OdyNxFW4c1PKG37t+5q10ZiUOm4572FByc77RCbdnyQUGWjrT8g6I7WFmORWQxfDiOHMiS+E8DDFm4nh8hLVGuiSruQ83IJj9XEHd6nWQaklUvnsPTWTcdaH0Bl48UTzwzOOCfJitN8sKAYqUZbF1IeETSLVbOdRHdts6Q8AzDJxg6fVFs1DsMeHWUoj/ErnXF5B7nHqZhNfwB/BEG16+r/GGDm5UabMJ8TNEcr0mpLl8xX6GYABOhNUSZ8SLnBnaFPkHRKRJUlm5KWezfEJanVgyLCRZKPIsQIOLPpLSw3uAns76i+NOhAiwKfoks2jj8yNePnJb5peZWngkO+Bm1KiuiXj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bce5eff-be55-45d7-dbbb-08d95e7bd5e9 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 17:00:21.3463 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WqOAYCkbdSu6ytyOLP1tIRY5qvQs3lxBTGCT65o9ueikarKZb5dV+FsMz+OhuldzCP+naJUQwedpRL3RGpKHHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5535 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Introduce a powerpc version of the prot_guest_has() function. This will be used to replace the powerpc mem_encrypt_active() implementation, so the implementation will initially only support the PATTR_MEM_ENCRYPT attribute. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Tom Lendacky Acked-by: Michael Ellerman --- arch/powerpc/include/asm/protected_guest.h | 30 ++++++++++++++++++++++ arch/powerpc/platforms/pseries/Kconfig | 1 + 2 files changed, 31 insertions(+) create mode 100644 arch/powerpc/include/asm/protected_guest.h diff --git a/arch/powerpc/include/asm/protected_guest.h b/arch/powerpc/include/asm/protected_guest.h new file mode 100644 index 000000000000..ce55c2c7e534 --- /dev/null +++ b/arch/powerpc/include/asm/protected_guest.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Protected Guest (and Host) Capability checks + * + * Copyright (C) 2021 Advanced Micro Devices, Inc. + * + * Author: Tom Lendacky + */ + +#ifndef _POWERPC_PROTECTED_GUEST_H +#define _POWERPC_PROTECTED_GUEST_H + +#include + +#ifndef __ASSEMBLY__ + +static inline bool prot_guest_has(unsigned int attr) +{ + switch (attr) { + case PATTR_MEM_ENCRYPT: + return is_secure_guest(); + + default: + return false; + } +} + +#endif /* __ASSEMBLY__ */ + +#endif /* _POWERPC_PROTECTED_GUEST_H */ diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 5e037df2a3a1..8ce5417d6feb 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig @@ -159,6 +159,7 @@ config PPC_SVM select SWIOTLB select ARCH_HAS_MEM_ENCRYPT select ARCH_HAS_FORCE_DMA_UNENCRYPTED + select ARCH_HAS_PROTECTED_GUEST help There are certain POWER platforms which support secure guests using the Protected Execution Facility, with the help of an Ultravisor From patchwork Fri Aug 13 16:59:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1A1FC432BE for ; Fri, 13 Aug 2021 17:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7A1261103 for ; Fri, 13 Aug 2021 17:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbhHMRBU (ORCPT ); Fri, 13 Aug 2021 13:01:20 -0400 Received: from mail-bn1nam07on2082.outbound.protection.outlook.com ([40.107.212.82]:62205 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232969AbhHMRBQ (ORCPT ); Fri, 13 Aug 2021 13:01:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G+GQEW84pYzlWZkt5TGT6BajDi44dxIFVur0j7kpaMW7J4ydgnQzsrPege685DXzTgb1YoTvkQYX/DLN+6dfw0hr/ppdI9eUSwer5tc11ZiifcPIfJX5Qn3GeXk5/LzNrzrt5svTZu15j2lX3nM9uBYmZkmB/N6AWd72oZ567IaM+7Rk1tSllPmAlCxWCL9FSw8/aR+jni1J1FIx8OQVJ8uaPNwgnyqJHagLo/Q3HJtVypeNLi4Y+gln988DB7s9cq8aR1hv1ygYBGfwCxZ8+annHVe8U6klf9TofnBQEx021If1g4MyleuxbXqZ/F8juw87BdGaj+z8gzhee4Ctzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OxQwjbCDOmZPUdDVU8qcPUZnXp0Y4tgFBdlcjBGS8Fw=; b=AoTqvqV8k1ik8mgDUE4HfZM6kjcfNh5JgCKVyuTg4BedsZJH2mttz2gZEh/eKqt7eCmx97fLYW/Zprb3urHpUXv2uZRyMK1EMcAAVW0KPHQHbu5FVQ6a9b/1RXiQ5UzSN2ooxsOWIVp6B7cLaPqWoQVs53PrHLKbL+2hB6Z1z1Sf1HNMY9Z66gSPdADDA8WTib57m3zz8lsr9gZWdCjO0EP/RRSKKoYygpL+MSUV3xeE4GqsicB4/PbNL1tm8Ft2uD15k83ih4XHZHOnMCRfOsM4el93y3u3U1sPNK0bCNC6KJpPoB/Ogu6lj1/hC5yYCBIlETl9xttvN1je7d8ZNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OxQwjbCDOmZPUdDVU8qcPUZnXp0Y4tgFBdlcjBGS8Fw=; b=YpspKJG2ulW2xhf7W0j3kDtwdjXIb68/aeQcmKACPQIm4JDBwQFMC6UtgQ5Lk6rvsXQBF58gHCQt9asa18z56bltDgBFiFXMZ/EN5go61iLGJLhBlJ0i6v4+YNB4ui5GzGazJJ+bgf8Tdt+iZW+rjDZLyhJqXjGA/7DlqZaf45s= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM4PR12MB5341.namprd12.prod.outlook.com (2603:10b6:5:39e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Fri, 13 Aug 2021 17:00:47 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 17:00:47 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Thomas Gleixner , Ingo Molnar Subject: [PATCH v2 07/12] x86/sev: Replace occurrences of sev_es_active() with prot_guest_has() Date: Fri, 13 Aug 2021 11:59:26 -0500 Message-Id: <0b8480d93b5090fcc34cf5d5035d4d89aa765d79.1628873970.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA9PR13CA0040.namprd13.prod.outlook.com (2603:10b6:806:22::15) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SA9PR13CA0040.namprd13.prod.outlook.com (2603:10b6:806:22::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.4 via Frontend Transport; Fri, 13 Aug 2021 17:00:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11ba6adf-8653-42e6-4d33-08d95e7be537 X-MS-TrafficTypeDiagnostic: DM4PR12MB5341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SCrJFva1dfjLBMcm9Cd87ldLHocutxUrMU9yGDJlei9CzMXT7KBNFWCLDseUOoF+0FaroulvuDGFT0ZiK2I+VN0lMWcrSwqLRuEb0NtW5zPfphcsZ6MKS2Uopj7gGuSJbCDvYzJMBi7JVwI5qQXqMriRHL6azkXkzYRbynawIl/yrgq4hcOyJsVtbWzsnpuKWZPM7o6VlSjp8DX7u6+ZHTzf2+MYOJzj4YD/FDGV0/viw0XnqtwH9/OmafZKM0nMqM2/WS3eOHfm5S9mzsJPojqNE5Y35iwOPwQI/5Iww+LvGGW8UU+VFVobnjDcSjGbgQCrDvQ3ANTIyG5SovWkH/0PvKQiprABptNm3YRrz2/ISbUi7ZPJ4Jz0W7bfyodWQPkqs0vvbZ880J4lrzZu8k2keArJaGe/ZTUvcEGHidfqbo/rpPYR1WtZnQoyD3AznDFc5Ab4gQoZSUxwORni/UypcBcetNlsIvyRFxncKgZAOCpI1Gyk6+GUWvfo+AcF9zHful3DH3wNwn1zSauravnkYph71Ni3gcE+kJEFHxoQEziGLAIOy0IbxEbKcqi0t3NLw2lywWwBubhNoHxxVKJ37VvZW9KSBfKI2QLV43d0BDZa0zO3Rrg8OXVByFrx5zNYvW9LQmdEGQfBnFt6N/loGHfu1FyY+MjFOVuEIuYEZwlPFiePKFJX2BM/ZsFK3RfZuBTY8xDzrXRpy2mpzmRqFZzIrdU62yVS0vgx1Uo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(86362001)(8676002)(2616005)(5660300002)(6666004)(54906003)(36756003)(38100700002)(7696005)(38350700002)(921005)(52116002)(8936002)(2906002)(478600001)(83380400001)(4326008)(186003)(6486002)(7416002)(26005)(956004)(66476007)(66556008)(316002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O+z6sArCNkmvuq1B8GmeZZr94DJ+LJ41tbhZAERdadQxupH31EuD4Qw0NcxMf41uuLLRNdm23pC9twbl0FzDQkM/52zSJ89gHE8DwsvNtLhKMtNciBRJDpIpOhnZqr/Ja15XUJIq3624p/s1V8T0tddBKPpEpngANdYpQQPhD0VLO/62pohC59ONDapb/AZ+2c3dlehrt6XhT3gzGxUG2GteUrXPEn4u5y5rXa+w36Y256AJRHWkWwv1XgF5cS0J6ZyB3l+EW7bTUEj+XT4MfUQiAyQciSglMNmNrFgOk4YN/2I12b+fX1YGeqa0tDTgZ3P4rJ4wb3TXJDrWZSc9EL/P+3mi+ByEOf0qJvZhmG9TWSULY8J34qV5bE8mjmQd1eyndvnhAsnZTm8v8J4Ds6EML1t7/bXyAAitqJLqlYm3awE736BFgDEMFtIXtwnuzGGantMx2kFUIrNvAVXUXSgvj/4huUT4SAcnE/1eu0U8FrGWn+mpvPBkwY2puaB6E986aBBWVQuC3J+M6hDPar9ooEcRvvy70Lw2nTbCmtLO8HBGLepNnxH/B48rQb8QrpiWmNiXD1ic1Nw1x2ACqRK7FRDQ+2e0R4xMm7sh8iJiFC0MfstsV3HGiOXVGG7fL6gdDifXsuQw6FhfLGlJDsyexsRW9GLfs8DfqLWGppeuXeoCUPUecZLPbVbi0NG1i3FavxBR1mdia+i0XerePxdjkpGHQF3P7NIc61l4DWOIr721x48FKj0v87g7jua+1xbgNCyg4ZFj2cSr8TN0ANymsH3c3QkPKtxsFHm2I3cPKozsSKkSjRiR9qc+P9Q+X9LjyIMehKy63Ag/oQ9vvLP+Js5Mo4aQ2TEMWHBIAvu4NPxutF3mNv0bPcDntnH35VPxrSlacgeuT0jW5C3VbrG2IxC6KvnQy9Hpt+fVQMreeXPv1mdtHPxFZ6Z3yQe9a+YDcRsKFqbW88JoJSTAWpqK7CBoiDR54/dQlc2v05AxwzI73vfjrV8FB1Ecm+qrKTOmpvQR9CNh0IWA2giXvA63MPXwDuqgqQEhklvMFx+NhBiQyjeanfgaexOFuRbrKKhWbVuyH6xTJaFu8wWeeOwiuHNkZVay19cu3YQVLBIMtH5DoiBkAjFL1mSJfqqr2Ng7/0cs9FRfpqYv0xFikyABEyD0SI59C0QghH104z4hQR4bUR6jWGQH+ZiP/O/EQrU/JaLoDW2EmEm7NUKKERadZEOGypnGwd3gzVtFa6A7aycki5k+fzoMKbF7b+WMV1WHpgWsDlVCCAYszgtlnF+gQKm7o9U6yFL57028PIrKe9pikYs1HYTcBZXNYy7h X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11ba6adf-8653-42e6-4d33-08d95e7be537 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 17:00:47.0047 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cNF5CDhDN7Y+Sj5vN0RvJOmG7fDWjeYVucQO7vg8NlZeRenoV0bfdWtVZsmtXeCxON9n5suSvwdSdnc9Tsrhjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5341 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Replace occurrences of sev_es_active() with the more generic prot_guest_has() using PATTR_GUEST_PROT_STATE, except for in arch/x86/kernel/sev*.c and arch/x86/mm/mem_encrypt*.c where PATTR_SEV_ES will be used. If future support is added for other memory encyrption techonologies, the use of PATTR_GUEST_PROT_STATE can be updated, as required, to specifically use PATTR_SEV_ES. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/include/asm/mem_encrypt.h | 2 -- arch/x86/kernel/sev.c | 6 +++--- arch/x86/mm/mem_encrypt.c | 7 +++---- arch/x86/realmode/init.c | 3 +-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 7e25de37c148..797146e0cd6b 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -50,7 +50,6 @@ void __init mem_encrypt_free_decrypted_mem(void); void __init mem_encrypt_init(void); void __init sev_es_init_vc_handling(void); -bool sev_es_active(void); bool amd_prot_guest_has(unsigned int attr); #define __bss_decrypted __section(".bss..decrypted") @@ -74,7 +73,6 @@ static inline void __init sme_encrypt_kernel(struct boot_params *bp) { } static inline void __init sme_enable(struct boot_params *bp) { } static inline void sev_es_init_vc_handling(void) { } -static inline bool sev_es_active(void) { return false; } static inline bool amd_prot_guest_has(unsigned int attr) { return false; } static inline int __init diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index a6895e440bc3..66a4ab9d95d7 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -11,7 +11,7 @@ #include /* For show_regs() */ #include -#include +#include #include #include #include @@ -615,7 +615,7 @@ int __init sev_es_efi_map_ghcbs(pgd_t *pgd) int cpu; u64 pfn; - if (!sev_es_active()) + if (!prot_guest_has(PATTR_SEV_ES)) return 0; pflags = _PAGE_NX | _PAGE_RW; @@ -774,7 +774,7 @@ void __init sev_es_init_vc_handling(void) BUILD_BUG_ON(offsetof(struct sev_es_runtime_data, ghcb_page) % PAGE_SIZE); - if (!sev_es_active()) + if (!prot_guest_has(PATTR_SEV_ES)) return; if (!sev_es_check_cpu_features()) diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 83bc928f529e..38dfa84b77a1 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -383,8 +383,7 @@ static bool sme_active(void) return sme_me_mask && !sev_active(); } -/* Needs to be called from non-instrumentable code */ -bool noinstr sev_es_active(void) +static bool sev_es_active(void) { return sev_status & MSR_AMD64_SEV_ES_ENABLED; } @@ -482,7 +481,7 @@ static void print_mem_encrypt_feature_info(void) pr_cont(" SEV"); /* Encrypted Register State */ - if (sev_es_active()) + if (amd_prot_guest_has(PATTR_SEV_ES)) pr_cont(" SEV-ES"); pr_cont("\n"); @@ -501,7 +500,7 @@ void __init mem_encrypt_init(void) * With SEV, we need to unroll the rep string I/O instructions, * but SEV-ES supports them through the #VC handler. */ - if (amd_prot_guest_has(PATTR_SEV) && !sev_es_active()) + if (amd_prot_guest_has(PATTR_SEV) && !amd_prot_guest_has(PATTR_SEV_ES)) static_branch_enable(&sev_enable_key); print_mem_encrypt_feature_info(); diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index 2109ae569c67..7711d0071f41 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,7 @@ static void sme_sev_setup_real_mode(struct trampoline_header *th) if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) th->flags |= TH_FLAGS_SME_ACTIVE; - if (sev_es_active()) { + if (prot_guest_has(PATTR_GUEST_PROT_STATE)) { /* * Skip the call to verify_cpu() in secondary_startup_64 as it * will cause #VC exceptions when the AP can't handle them yet. From patchwork Fri Aug 13 16:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CAADC4338F for ; Fri, 13 Aug 2021 17:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23DBA61103 for ; Fri, 13 Aug 2021 17:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232772AbhHMRB4 (ORCPT ); Fri, 13 Aug 2021 13:01:56 -0400 Received: from mail-bn1nam07on2076.outbound.protection.outlook.com ([40.107.212.76]:51015 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232683AbhHMRBe (ORCPT ); Fri, 13 Aug 2021 13:01:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGRZJcPy6P5tF1JUO5XcwXANZ3wLbqu9Mzdwp3/jqNtMBnChgJHPUEmgXlRrw+rFryMrye9e0ItZuIFC1xw99+dkpWlMKx7+cx6ZFVRSLtG0roDeOhfjL2FJ3RiNaw/gu+jxRPzFAjyPS8LqXhFdL1CKedeX0zDR5fQP/wHQCDtTzp2yDTaZr5JEkhAAqzQqcGv2J0T1QWyRBkZmQ+qiHktML8FX6PonOB+eQjWpH29Jmm4Synms5aZryeR2khgFMXy15pKTqIML0NqbA8dF7IpOTaui491oqTN/37uILJs+oYlWUXRWXWPlVSePahiRl3cg6W7Xm3vGeMK1s8NySQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r4M8Xyn5Mawk/DMXQ+3RqHw1cVkBCe7o51wVYlspL74=; b=ad70PkG1HbketO00GR6OYsp0DlPRDnmCZBn7KuMBCuEdUe11elF4g49vC366ZR5/QnH85q8YMjYyYGdu1MNTsvQzoc/NX0ccJWCHdi3zntQEYvIv/Hi2qnWYHGQzz9gObYcNwk3gfbQLHxlZZPK8adGWlJ03liLxg7QL53DoPtPPO9p1UCdGLQXKkma8ilup166DbolurPrXR9BHBfEH7+ig/M+niktsmi62NofZDlOiAY9uhC0rpaTJXhU1z+cYucGSAG83dBzpJadU8aQmi94kXVt561h25sClHdyg9T5h44M6vNcrAPafrvHHRqovnPukUEKMzD+KUBfy0RKOEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r4M8Xyn5Mawk/DMXQ+3RqHw1cVkBCe7o51wVYlspL74=; b=OI3NOJ6xgsYOfRLc7GVIhAvYHLW3XHCCHbHCXBBVz2AUaKNrRqpSiMuXbc/ij5I/FJtRPEncMTCBvOjsZ23hTHLUYOTJXUdK/SMcUVcHfqeT6q8lsKque3MkUHjhQnfQChnq6XOnr3TVp5Kcrxu2RRdgys9r/Z0rBjWj4B36Hzk= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM4PR12MB5341.namprd12.prod.outlook.com (2603:10b6:5:39e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Fri, 13 Aug 2021 17:01:05 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 17:01:05 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Joerg Roedel Subject: [PATCH v2 09/12] mm: Remove the now unused mem_encrypt_active() function Date: Fri, 13 Aug 2021 11:59:28 -0500 Message-Id: <83e4a62108eec470ac0b3f2510b982794d2b7989.1628873970.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA9PR13CA0145.namprd13.prod.outlook.com (2603:10b6:806:27::30) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SA9PR13CA0145.namprd13.prod.outlook.com (2603:10b6:806:27::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Fri, 13 Aug 2021 17:01:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6fbfaa6-dda4-49a6-4d7b-08d95e7befe3 X-MS-TrafficTypeDiagnostic: DM4PR12MB5341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UsRZPUIl67uI750ilxgHe6DIXAmWRO5kypnhEq2k1RUnQErZB8nyHisrmBcnURRrT/j9z3I8G1crJXkGLzEj2TNLfcztYPRwuNk2IYgR9AeYoHlUAk5BTiEapp46hCzcnA1XUmzyUoYKLiDxjIcU7Y7dr2XZmSUXcyqxJMo8GPnc2ivqdlgVuWqw0H5THWO5JDBhj2KwWbQet/Ez+PozdqRR91D+6j4SUZ83wS6rb8G1fgxnaUomxMtdEsiUcHwx04sZYubT2NJKCWG3aAGndx+v2qLBO2/4izX8FMPRYSQXx/PckI1GeVaMzw4Qv0LSUm6x4pWnS92uwSA7AcSncm17Y1Upv+j+H1rMIs0z4s0OaFatH+Hzq96V4uC3grC/1CgHiIvH3EEqEK597YdRrWXG65yjKidyd1wifEMVapTywKfdaBCFfapONptAjPqz/tK8KecWzWSgMQR3tETvIA3xf++dOB+YBJeJfNnGDV8FCVgdRqd+m8TZIWZDGMeOEW3f5/qve5A0p9rGuKo+YsT/oVgP23H3MJaZDyAqhKp9bEXcVz/M3WEy2H51+5P3I2qFWCGxYAv0Vf4HWugT9NbifeqmU8/h5NhBho59pq5bFFVK11T9FwbDLXkg99h3t3xu3nqjDfQXC9adTgnN6MQafp03FYQzjAHg2EKlaxxojNUhJ40S+WhZuiPLSpRcMdaNGpO+gt2Geodp+tOxHfQ3A/gFpM6sIBlQPmy43EQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(86362001)(8676002)(2616005)(4744005)(5660300002)(6666004)(54906003)(36756003)(38100700002)(7696005)(38350700002)(921005)(52116002)(8936002)(2906002)(478600001)(83380400001)(4326008)(186003)(6486002)(7416002)(26005)(956004)(66476007)(66556008)(316002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B6ar5e+Ojeb3PldAJH8Q+kPp57d/P2Iu6+UENf89dF1v2YHuDyzkA7FgbzpWHtKaHYzMqK6x78PFUdnYMXtbiLbicJF2JQrmBu58mcSifzTGPBfCnAUvdtCDsO+cZ/WCSC1WK15KofMD3vTCxroYwIBX6gyTOiJjyhsZVcofr3JVdV+ZHElHbmzFhjVNozfYDlWbPgaSH8D1zErZuf7Tu7lHh1rn19GjBEtEWWoGw6+vmpbNmt7iFkRRrXR4zZ9MqG2LflZG1D/N7tHqkdFJOV85pyEFiOftztWLGR1b7HyQ/nYLNHkgOltSd8t1umzvfA2kxaN1PbWBHYTX6hPw/hpdmHStFZBZkG46lwdvJhKuu9fy72WSSR90noteT8WenrvaELFHFu6tmb7BoWsOnYxZ1aUiBM0I7scv4DIpPiOXhTQfnWK6cT0RBlWCNnPqcdN6Jt+QCCRMDSb1fyQNZS24SsVYisTfC1aSotjWE22U/ncrHiXZ7H6vE4WfEow1bFoQbkyXx42o7fMfelc8xi8qIg1M86sK7FVDV7WjApE8NPXwyXTTJsPEK996l4sxZhqP7Vqg7I/Z7NZ9M+735E9tdyp4O1G4sIyFmCrLuqLMjrlFZL1BSdv22ublL3NFYhTE1ruLNXGrTKpjsLDRHB+UOzwbxV2YJXfaubN9w0lQs+K+kpMlKX6x2c3rhf8Hgl59GfpcAjzc1LarQhe0p8VR8Ea47yG0RPmKa7TjJ2nGV0Hd3oj8nYruZN4LaQeGHDd7UdlxHDPZX56TvLOFFC/wov/i+zqFPLZ5RuqKg64ovyHGXB1M/iVyrHjch+1Avw60EYzno+Pa+efhzcueZrff1XSAcxSFaIKu6Yybvbbb9P8w0XikeuguU1waI4I/Tk05+aKhkVv3zGrpwk6bOo1yNKTtwhM4oa8fGXS3oJ3/2kJKo7bIm54BNv9+mpQULj1amIKxoCrx8nV+dFS+FcDSTbm9A8NSDrOaugMOOU6NE5vQLuF4wHPjN14d7NV2MnVgdm3/qKylDsvQfHm4EBa+UqVRvPCJUShE8N9aCF+ssswRub6aMLccfCTFNfHJr2CyCG9eA57yQYr7MgaWz1qY8Z6THhh44Fj37rT7bsPbKXXD/hxNIWuTU9lPYS7jynYAyJ8Nf8+0SCaiQmnh85fxd/arJfhQxP79X5Df1wVCI0LTat/Wc3qfE+UGxUd9Ss7xOz5pOOL+JQ9fgSyqnt8RO6KTXO05cuI7GAw3UmTdYnZjp7ZkrrrvRdDtRqilLZxsLDGkz670Z7hBrb0Qn2rWrYv9RgA4b6zmaj22qPMshIMOJqpEEfODG32Zi6Qn X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6fbfaa6-dda4-49a6-4d7b-08d95e7befe3 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 17:01:05.0107 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iNNo5l1Xy/99nFOfZ7LPRQ2GEYF/10iEoMuYmMWPDKhWsythOAaJWMFV7nInBuTIOfKdoEtdeQ9ttdZGyhncMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5341 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Reviewed-by: Joerg Roedel Signed-off-by: Tom Lendacky --- include/linux/mem_encrypt.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/linux/mem_encrypt.h b/include/linux/mem_encrypt.h index 5c4a18a91f89..ae4526389261 100644 --- a/include/linux/mem_encrypt.h +++ b/include/linux/mem_encrypt.h @@ -16,10 +16,6 @@ #include -#else /* !CONFIG_ARCH_HAS_MEM_ENCRYPT */ - -static inline bool mem_encrypt_active(void) { return false; } - #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ #ifdef CONFIG_AMD_MEM_ENCRYPT From patchwork Fri Aug 13 16:59:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 496797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F4CBC4320A for ; Fri, 13 Aug 2021 17:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B12961151 for ; Fri, 13 Aug 2021 17:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233364AbhHMRCS (ORCPT ); Fri, 13 Aug 2021 13:02:18 -0400 Received: from mail-bn1nam07on2089.outbound.protection.outlook.com ([40.107.212.89]:32130 "EHLO NAM02-BN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233775AbhHMRBy (ORCPT ); Fri, 13 Aug 2021 13:01:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QYFBFXyS7zBmFpLmwto6ua/cunvT2A+NJzpVt7003CpOGzSG9zrl9GHcldr9IIx0qFpSONuTWyPytYqESUkp7fdQ5+/hlkJGZya5u9TUZOHVlq3elJGW1TuJIm0vc+mJKWWXLiPP2S839mCBd4APhwIi/t4jKszBmeuu298KuPBK96wHkwGD2A8Dcm2IkoCWTF6XlLp+s/hzsSNy/8TZSKfb2EwXzz2D3/gh6xB8MBOnqul4JB9HrYqhmf6H8uMoqfB3Dk3JmBvN1iyMYKvEarWdh6mNgoQGNN57HyiiaeM9Be9Sxsw97NBm2BZP4B4Xxla9Ju7N6iORe1e2CXufPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D4naflCbBggOcnOdpK1E+FdYlswu1/63kE7BSki7t2w=; b=N0RzPTl6prooxb8HoYNPlJEpctuWwsJwclD9tDtBGUyspPVmAYuhaHCrfnxZRfZ/IYRZLFTyokP9W1l/WxSNME6gllm1h+iO9XMwC8l2/Nv/pltzSEet/cdMipuipYhIw1OPA7VuCbp3czWxtg9u55QfUy7i9IBK1Z+WL9WCDTOgv5tZFESfmeShD9tvhH/35KULiSHx+uH5cboB+RKR4EXnV1lMDBL15YGiAiK+aWy3zrs02QiYt+zKOCD/586a+Tx2iObpI6U87Fz/Fswhr9J+m5ODyKGZiklRl9I2cvl6Dhq7YCiP2lHvvCt3BgbA3pA9/0kl7l0eBlbrU5Vdxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D4naflCbBggOcnOdpK1E+FdYlswu1/63kE7BSki7t2w=; b=obzfaEnfL90ut9QeKBxl4jjiGcKEA398Y/CB0l5k1Hhu4KQ4xeO5KuQJW49x08K175wsTuc60dasHax3KfZFy0jRcHVv6j5RJofLotEWJySqTA/xCcwy6enmoo0AUx/KNg/e0u/ijuLNXaMOlQFV6piA/qiElouZJlKX/IIqKX4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM4PR12MB5341.namprd12.prod.outlook.com (2603:10b6:5:39e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16; Fri, 13 Aug 2021 17:01:22 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d560:d21:cd59:9418%6]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 17:01:22 +0000 From: Tom Lendacky To: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-graphics-maintainer@vmware.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org Cc: Borislav Petkov , Brijesh Singh , Joerg Roedel , Andi Kleen , Sathyanarayanan Kuppuswamy , Tianyu Lan , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Subject: [PATCH v2 11/12] powerpc/pseries/svm: Remove the now unused mem_encrypt_active() function Date: Fri, 13 Aug 2021 11:59:30 -0500 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SN2PR01CA0037.prod.exchangelabs.com (2603:10b6:804:2::47) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by SN2PR01CA0037.prod.exchangelabs.com (2603:10b6:804:2::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Fri, 13 Aug 2021 17:01:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b9bb524-aaee-4f58-5cdb-08d95e7bfa1d X-MS-TrafficTypeDiagnostic: DM4PR12MB5341: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JtQyQ2mfuMBiIzxbf3FgQJRHntRZCnylGgjdgQ6KtcbaKDSwXjUlMy6hOjR+8FFoUmjM7PHecycBJoklNU0SuK4tmlZZduNxFOfuzAiQvwQP+04306dY4Qb0+QSGA9akGd1DiwG+wdKS7NmWfRyy6Abh54TvVajc89X9TNTaabWBD+Xp26caSjJjA7+FQAp3mxgo4v9PZcWLWnWsSq0fvGZvegd2l8J53+zU+oKtCTOA826sb1DALEjPvmJJ/fWOYWU4OhOheoZdWtOGn9DWoVmAi6JhGQlgvtPScUArvjVQ7x7gc3EPPkLW8CWDIORFKCcaXZgc2LTQ6dWNqh2NweE+4RYPlJYzwL0AhCmcbKt42JJX1034Kwu3LU4NaxqV/o5qQHZxwVpieI6PK54EzZQdYzUdclHWXv/xcCVT0VzcWvVSLFnsUAxXY9GKUyljiNa0b/N5v3/iwnYmVM7JuFfZ6p+k0LXgGzuSWndBV2QOvyVw/AO43s2NyU58bhjPrWC4kevY4Sc0dnI4vzLoPHPzkt8Spci8sa5eyWy/SU9cdZQ22oAKA/gkS8NGkyo4T0COVL9inOdIRQ5mWp+PCtR3XDG4HjN6kwNViyBn65/HTpxUnEo7AiIei7H9OJEhNKBdHBENwJET53S+eUZmhW6z44fMsUI3f9KiLKjIFlQSyLMH1EnRtVsjqJFqBYuVe2v2Wi6jh1OYZ0RYzzy9JjPVooB5aWsGgl6lwbXQVPU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5229.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(86362001)(8676002)(2616005)(4744005)(5660300002)(6666004)(54906003)(36756003)(38100700002)(7696005)(38350700002)(921005)(52116002)(8936002)(2906002)(478600001)(83380400001)(4326008)(186003)(6486002)(7416002)(26005)(956004)(66476007)(66556008)(316002)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9KSpmt7KuqAqjBh6FIgEkPVMCXquJf/axsKW5Sg0lTVdmWMuz1mE/GXXxQEBPNgq0aWpySMhXB8PIFMt/W2ir0O7+yZzi+56gv8+uENqoja1328krfkIIJo1rCGO7Qbe69SQqFmb2cUI4ZvprplW9bvMqrnAw2rpf83u2plZvMad0oTe7x1gK1PFEvmhRoJA1iiSTZhn1gQzh6hlcZ9HYKG1wNSYYWf05SmZsUKDunea+iKhB0569e4fiyoe/qXfQTmTGMyizU3yK2H5v3BORqbftFGfV/UI/lne+m4vqs8Or/nAJTA74DywSNqW11kgKHL4cXSMeCuQSj0cAcbGwn95+jxRFpnJMGnVDVhqWNUX0luuia7EenEj+f3xsMBhUSyKQiQalhuT6ehyxId/o2zz2MGydn4+Ry34+PSjXQl7psbk75e4gsaU/8Ox9NNorTWscpg8fFAUJUPnOZc4GhsLZfdfo+2Th36Vost6K7puVy4QwHcaml7UAZKxvA2yww7Ur6xJ52HzXJ9kNqUY/L/+W38G5NmrbU7fbeK85uVULjvxsb1kEYc7AVg6UZrTnFqqBuNe3do+ftXOx2hoVftqX4QpTDX1btt1VygvGvtogeS6K+IOKCXbgrreho3oWoY8mNRptT8/HO1TtZtaX6l7nlEggs+phEXP42hCvJ27+8r53xdzGeeG/3hOWiuM9RRKRi9akqpx4kvizR3qMaX1hcW1aFw8Ry0FBJ3Aq/negCEV8N/ZWEyrcBXy2kZ43EWp2IkcOFfqE2ZLRQSwuJqNUfwLNiYAxVpXoG2IoSuz/SF4jQ15naKyBUaMOO8VIjrYpgEp3YxS4FX/l14tWrLJwmyPsiHlORg8AgjzVKYqxF5QlFNEC4cfn0FK7E17xLG7mFFCYprGKY0eouy9xq/xkQjF4OUAuzW/cbs14TyzqtqVM38fhTV3AM2R8SPAtIMjgbvKZ2BKJB8hc6MD+VvrFswpdzlstIuz8eppMT+d8DKBST7EgIWfIHNURFkIAzfqk7tLWrzFEIolFKdCEq/gAPAMyF1OFXBfG7wZKFH3hYgqERW/SYHSurXH4TGPPekDyJJlMOFvXpIkl0XieMwLbw0k/8MV7cwzIQR48SjHCUZ+wt8khTzV7wl+8A789wYQxQatp3S2hhOGJ8yYS9Sy5DSe+lfl/JUwsbaSTSP0NAnEx0OtLw+g2GJrEhAaMiVHJzuuOobpPF2qDLC3coBB92htkNbeC8PnE2acDxpDZLj+2Pn6MxKMRSfT//Me5h5ny+Yj5zfuBSJ8OWzG+wH9Shued3ngS4pHlIhiN/QgXH2Cfu/n6UhqDKjS+ORs X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b9bb524-aaee-4f58-5cdb-08d95e7bfa1d X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 17:01:22.1196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m+ogCzMTYNLgQ4o9KAbSyEHE8vZrzb7gCZwcuD0mjlH/WaB6UG8mIJeT61Kbtsf6ypxim47iVZrkUTV6eNqrWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5341 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Tom Lendacky --- arch/powerpc/include/asm/mem_encrypt.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/powerpc/include/asm/mem_encrypt.h b/arch/powerpc/include/asm/mem_encrypt.h index ba9dab07c1be..2f26b8fc8d29 100644 --- a/arch/powerpc/include/asm/mem_encrypt.h +++ b/arch/powerpc/include/asm/mem_encrypt.h @@ -10,11 +10,6 @@ #include -static inline bool mem_encrypt_active(void) -{ - return is_secure_guest(); -} - static inline bool force_dma_unencrypted(struct device *dev) { return is_secure_guest();