From patchwork Tue Jul 27 22:26:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 487047 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 1C725C4320A for ; Tue, 27 Jul 2021 22:27:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0466060F6E for ; Tue, 27 Jul 2021 22:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232634AbhG0W1H (ORCPT ); Tue, 27 Jul 2021 18:27:07 -0400 Received: from mail-mw2nam12on2052.outbound.protection.outlook.com ([40.107.244.52]:13632 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232750AbhG0W1D (ORCPT ); Tue, 27 Jul 2021 18:27:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gC0ZNrb2jRTDkxRej/GlYzG88GmGVZDivSNuU0698AMTV2hC2p4ojFPLGxIg6+rY8kLqpbDgfAqfH1PFDYFRMzxN60hBraWKVNTWF8VcAFKaFKEeh5ZL3wPEigKwIFU3X5lmVrI8Lhbqz78bIkpilRVn+Nw4T6EZhyQHGMLXrLsP52QDABtQL5+pkAc2G7ziEcVtwC6LNip1fUfsSD7ptKY7kRJc9BIEf24frnRK9pB+DYmVbetf+we4TYirVfoZBNbciatgAv9Oo7q8nUoxIVXnLE5OC41ee1SgWRLVNl+GtP1Pj/qQSVJtkPJZDUbUagDSRYDXQDK64fsCel//jg== 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=Bf1olkGlcKRwlvMXiHj5kceZynZjwhldQoJOEiq8a94=; b=D8m2yvF1f4rQ8y9o749hlwRP1HOu+A5XNUXh8qT8C4Ap1eT3Ud8dXQTTgdaG4/awmXL40mBcmLSK8+e83duA1yMPlBPniiR/6HUDLDql8DP/3LH4LAUzLfBmQqy80hYOL36asbWNEsvAglet9fb3Rte1chMkzS4ZieJJpwUf92N5cs+TiaOhRBMWT/aiIT4N7PY6PGScrNS/ZfuiCPI0qTv3DI1N96PpKSDCv91f3XO1f+gjBeH42YsnYMbbkECon9HtVqwRuA/PnE2RqtrfFMnZYN4CqAFYSylG10113QY+5nqP5M/Ls7ZYTU7ceEhfV4kWTPw8urqryMmirvdnMA== 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=Bf1olkGlcKRwlvMXiHj5kceZynZjwhldQoJOEiq8a94=; b=g1v77TfCtUkuCGnSXaOfW6OwSTgpsQ/V5NPpRGiTQhZIURlpgkqdM/NHoPuiDXWIyThKhOvu76+o5AuRv5UCHaTAnNylw9kLIW7F1YMYiRujHtBQRKzOsZPQZ2mRHTCVLiFcw7teNddFPGUrVNai9JPLazVREJ+u8KZqMsXLBBE= 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 DM8PR12MB5416.namprd12.prod.outlook.com (2603:10b6:8:28::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Tue, 27 Jul 2021 22:26:59 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 22:26:59 +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 02/11] x86/sev: Add an x86 version of prot_guest_has() Date: Tue, 27 Jul 2021 17:26:05 -0500 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0027.namprd03.prod.outlook.com (2603:10b6:806:20::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 SA9PR03CA0027.namprd03.prod.outlook.com (2603:10b6:806:20::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Tue, 27 Jul 2021 22:26:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9aba2817-c7a1-4d37-85cf-08d9514da650 X-MS-TrafficTypeDiagnostic: DM8PR12MB5416: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1002; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hRBaHi+gHT2WthBI+LejMaaSBGW4H0URuxPG5ADvh109ntJuCLHcw1aAECFqIFSrdgPZbO2frhncm9YxSKLbNLAEkmF5i7e+hgHrN4oij6cN+6gGEi0AK7YZHcxZoijCS4Hkc21Hxu6/WSOHhTicEbYpyXgh8vEHDbz+mT+bTPQDQldzCiVTe+1jAV8yyVghq9iDQvItLgtgwfJntZzcibcHY7ewXvIkR5XTV/KsVRK9SQiD09cq5MizqgZa0NGZ7chqVREYdxZuB8M6YW32IDsr3nKy0ARU7qcPOWN/vZ1My1Cu98liKlcpkG0xt6ont8MpJFLCXOrRzFf2gnrv91zeblGsxhaMqvqT0ItKxTosxrKLfXuNualkL8EISVxI2zMw9XSoRTzRRDoHo+1IulpZ7+e5bAgYvQNIptWgoVxU5bSme3Mc1UEBU2/OcOwnXuOdRL85jZoAK/rZwOU3jSkmx8MWf7+H4CxpQWG4xi++jwA4RcJtS0hSa4J0wIyJd9gZ+vuDJ7Hbn+14giRHMhuf50LE8k2j5zBUpxGEzv3vwD2cKxhKcSL+CuWU31+7UuD43ZK3LgsgrxWFTEOmY2GFDypGy1XauB65nDRbLtU555DKnJpBHTVT/atIUG3rXRfhIqjTjXRd0uotG2Mvil1CRBNgqzl8sz+Jg6gPHj066EETPqVAEZrTg+y2NYmW+2jcMxD7bsySFYzGEydw0WEz6uQNmNhHB2sGKv7AMOI= 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)(66476007)(66946007)(66556008)(508600001)(5660300002)(2906002)(6486002)(83380400001)(7416002)(316002)(54906003)(956004)(2616005)(26005)(7696005)(52116002)(8676002)(921005)(36756003)(186003)(86362001)(6666004)(38100700002)(38350700002)(4326008)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Itl0ACVwnZlfNjsEvbpnsL5N4uPkvGHtCEwiKSKVMUTT85ghSYraLXLHsdWaJlLli57vKh90wqWUPVqSo4KyQV2Pi15XeqWsSblydsfkcxtdyUwz13cXmnEXDP6oO7ZSagXJwS2X7qRKt5t68q4el10SV8uXvnmVvdketJRALmCtuhWsQnoIZDpdzXF3b+KpnFpqfeVdhXbcg4Zya6ii9tkfiXPtfbm5Z3rzQwKgVUu+CiEhlS/R+L3PVt7vaANNkoQuwfenuftItqoZDMmNI4GrCde0Ggs578eIIVS+7mvHN+3UzCC+9CVZN2vngkWFx4vrfe/3yFNABhYtRTOF6d8Flg0E/JImyB0+vycQKavQSS3/qKrygz2aPmBJUNk1qkOsbui1AfQFMuylSZQGeQy+uq7LM8HNoPe9+RQd/L/33BryNrJDHRnrf2HfF8VDG8N9MjsyS0h/x0p/JCQQJNtnOOGSfNfUq64JfhLWVyYuf+Rp9sxnqORu6bHG2o4ppAZmtd5vGyBp1TbGG4JIIbsrQtZlDhVOvNV2moCAoP7OrOSK+gKRz/J+xwVOVcghaiYiO+E+jcRzIu5EcZhjS+7bdnrtgqGDmeFtfl0+pavUMbw0IT8ZhYOxW9s7WUQNle/au1cbHkombJqUF5c6ahWKNQrohwPGmW7a7mzypPDK/P2PntnCXBvpu/tpL60eoJoL+00qnQJwUC7F+J5yqd7bp0j2eNAmTosXE5hvebmv7KHEKHRG50M7Z7Sb5nRbjmkr3NJE+2H8WKsDm+atPhkIj/SAh7bOvhou4ozA34OAL7n4JZsUcNaJrNO52HKkRvt0NPAGor1ZbmQ6zJcqhykiCC8rq8xNSsg5+c3x+E+B8HXgLr9w5H+ScNl4B8MAUKh6+SBsQQXXk4qRbwM5lbzvpDmv75fU5kXYmw6Yyu4VLdrn8tlM4eQvT3mJKer/dnZQ0fT0X5aBK8IEl8kpetGFKMbJc9aOXHidm5GlB341pqU/tUfuH1LfEazD7tzrhUPbl4peyoneAIXbYbK3HQDzeuNBhEOrWRxdUvyg/psZq/CjtDjmOEcIU4WYSlmDNtaFL+RAhY7SgnwoaDbjaljobVhoBQRp7MfOmZpouh6sJauHRbnR7XPLQCTppt3Mz4SZKvjQji3ghIo++JeyN/MRfthvejtX8UxT92GNR3tGqfPuETIH34w+nK07t1L064YeNplnLMNQ8VLoBgwB2qwPkRybc7Stqn9y//vhTi738V1Qod1q21+VzVM6GR/KQrqalZDUG/mmOb8aTzJiVTqM3Bq+zhAbAIAMMmrABYdaWr/8P+suSv1T2QCbCo/n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9aba2817-c7a1-4d37-85cf-08d9514da650 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 22:26:59.5984 (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: vjNjgKJHyJ+bu48aW6JzyGZJoNqbbs7iH1NNjXVAYABtQMOEmpXyMrS/5hzZ2DrBrba410jUbAC5Z0nKavXbfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5416 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(). The amd_prot_guest_has() function does not use EXPORT_SYMBOL_GPL for the same reasons previously stated when changing sme_active(), sev_active and sme_me_mask to EXPORT_SYBMOL: commit 87df26175e67 ("x86/mm: Unbreak modules that rely on external PAGE_KERNEL availability") commit 9d5f38ba6c82 ("x86/mm: Unbreak modules that use the DMA API") Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra 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 Reviewed-by: Joerg Roedel --- arch/x86/Kconfig | 1 + arch/x86/include/asm/mem_encrypt.h | 2 ++ arch/x86/include/asm/protected_guest.h | 27 ++++++++++++++++++++++++++ arch/x86/mm/mem_encrypt.c | 25 ++++++++++++++++++++++++ include/linux/protected_guest.h | 5 +++++ 5 files changed, 60 insertions(+) create mode 100644 arch/x86/include/asm/protected_guest.h diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 49270655e827..e47213cbfc55 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..b4a267dddf93 --- /dev/null +++ b/arch/x86/include/asm/protected_guest.h @@ -0,0 +1,27 @@ +/* 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) +{ + if (sme_me_mask) + return amd_prot_guest_has(attr); + + 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..7d3b2c6f5f88 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(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 f8ed7b72967b..7a7120abbb62 100644 --- a/include/linux/protected_guest.h +++ b/include/linux/protected_guest.h @@ -17,6 +17,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 Tue Jul 27 22:26:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 487046 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 8E665C4320A for ; Tue, 27 Jul 2021 22:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A29E60F4F for ; Tue, 27 Jul 2021 22:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233395AbhG0W1b (ORCPT ); Tue, 27 Jul 2021 18:27:31 -0400 Received: from mail-dm6nam11on2081.outbound.protection.outlook.com ([40.107.223.81]:35201 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233173AbhG0W1W (ORCPT ); Tue, 27 Jul 2021 18:27:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n1ZfklWMso68pQAEGO+R+ng0kwzSvjo4GYE1msxjHM9gi2E+4HOQ8a6DOZW9s6F+8f3Md6EU2+loIaJcKUZH6LkMT41rzY31lLCBuL00Eg2dgDo8qdMMVewrAkcqp7Ph4BntOPI7XSlEXGAZJOF/X8DxpahxLYv7dsdxtK6mLCRul+GrFfweAH3pIpZkTNe++4jwHaAeWzh9rVT42PIkiseKzzJjKNEKxAuRZYexNQgawr/HUrtQWuzsx/HK0d98+M9Qm6TaqjlcYQ+YyfgWalFyQlK/U0t1qPjclzHQG+eXlEvvZsvC80swsU8+iALxi7HxiIHctlytsRnZ3euIGQ== 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=Mp1ywvXrR0SvVXwM+PxiNC1HtAn9Msivi6X8gLkFCWg=; b=mT34yJrAvyFpA00JjWtxNYNyHJJtJDv54AZSxG6UHpIbH0tEQiZp83fLrmBqPiXC082hwp28+AMeYmfPQloyeg8Ec85V1gXsF2dFnDVQAmzko0vzjWEioc0BFxsi+i0Mxnr42lRjClCoL/HJ8GUiOBLqxUugpaf6jMq/2f5asYWGz6SZhGPrJmGV1oBHwBZIeBCTjVGfK19mFEk4EX/ILfQ2SnHP6BJuFqf8daGQ/9lMfnjhfGjOVetBHfjPYeApPqzM0+g03pnA6wyLL69hNohDGEyC6eOeL+w4PNqRMXzDL4Q0MUjdnoH+edpDAjzt4YGA2ERyQlIKJRshYQ8C0Q== 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=Mp1ywvXrR0SvVXwM+PxiNC1HtAn9Msivi6X8gLkFCWg=; b=k0E9khWwI8FLrqV2oyCKEOxFa9yGvyD2Ay2nTCQbm4LvX/6X585VIOLeV4iM9+/wDqVWpd3Jfiuhx34xUzOLO2O0LdoZZkMcG0H7Lj/H/4om394P7quVNoQttGEbMQmVAyU7W9pOjLxpzhB7ZupkMnsWeAr9xbIFgW6XXj76U1U= 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 DM4PR12MB5357.namprd12.prod.outlook.com (2603:10b6:5:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Tue, 27 Jul 2021 22:27:20 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 22:27:20 +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 , Will Deacon Subject: [PATCH 04/11] x86/sme: Replace occurrences of sme_active() with prot_guest_has() Date: Tue, 27 Jul 2021 17:26:07 -0500 Message-Id: <1a5604f8fb84702f4ae0787428356d7e3e1d3a99.1627424774.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA0PR13CA0029.namprd13.prod.outlook.com (2603:10b6:806:130::34) 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 SA0PR13CA0029.namprd13.prod.outlook.com (2603:10b6:806:130::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.14 via Frontend Transport; Tue, 27 Jul 2021 22:27:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c876891-08b6-416c-f597-08d9514db276 X-MS-TrafficTypeDiagnostic: DM4PR12MB5357: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lluPEDAoAwzwYFK+/GX2lFMqKhMBJqxAr9f2kKcoh61BRy7GqonDwYZ/K/uXwojmS5j7O+2kwFdUofQ+h/y3QVLQXYG6RApLpwZQUckhz07WAXAzHqm8DTtH0CxprCt3xw1AeZ67KqV2Db0XwjLwcYGkkpM3mGZivCdgDsqGu90BSSqtXudRAwOAZy9iJX3OZAYNYs4nxQgcEtbmIt6mHT4HcsHdip8Pv91Rf5CS0KLWjmKHPo//q3k5YJQFUxXGNZe8pt416L+h1BHXxCAp3BGT+KyjoHm4fkwZjTBg79N5LQh6wuNANx3VnBg7/QC7RsLJC45mD3wPOcrpa8jS0s35FRiTcb4JOaR0ih37sBZ/4Vq8T8fCj62c/WveokTRKd2dZzbYL4MkU+yxxGwsepqJHGrV14q22jydnykYKCE4N0x3xW4Q1h3fDusEgHMRLwmxOy1wKeb12rd+JyO1Ut7k2gH7I9FZN+vZrNj4J5vrSph0EeLrJgjLj03055X+RMe/5b9IysfAvEZcgBmqDUsQYzljE8NrY5W4RXF/iAuOsp5NgcT5bOm3/K5zToyoezqadmGZSF1b3eA1FGiuU9B0HBn9VijjUUgBFwb2XEMv0HPT3aqayZltY8UgXATjhfpgRVGoYCOvS55PwcexqNUFSMBUUdGnV86vaOCpUTJXR4YIy5eUYChb09suqcHIIdHKv7JV8uCPuzU9VkRTVrztdCSTg/dgoEjhaV+VDVE= 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)(396003)(39860400002)(366004)(346002)(376002)(136003)(5660300002)(36756003)(54906003)(83380400001)(956004)(66556008)(4326008)(316002)(86362001)(8676002)(921005)(2616005)(66946007)(38350700002)(38100700002)(66476007)(7696005)(2906002)(6486002)(7416002)(478600001)(26005)(6666004)(52116002)(8936002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pifZO7Buy5dvZM/7Yjt9FnS0e6PuLA3LAzHzk7tRlPQ/LnSlVzAmBqH0HlyyFvJhgpHtv7fgEvUrDH5vItMh2SZTDaQgIFQ0rg/rs+P8WRc69dIf1A95Sy7xag/A0PUtIP2UE4Agl2HROqXwgBMc9mHUUMb5Y5ym2pcTmEFwR/D5rrQ5tVgxG6gVVpa7iJsNJzXM6tV24PAkOed1cvE/8rCG0WYt2XIe79sN1e3pKPfGxX8nM4woMLveQ8e+8YQrQBd5lmuqYgypGuoBCL4IrDgBGvHlEA7AfTI6W2ELQK1VB8Z2cwsMLXox9nHUSZGq8uFBNM8wUNriJacbIS79ojVYE4TVm121ddOmy+zDAA25Q2zdNQjcOBtMmrYER/qYzDDYBJLxu7lvFZilGv+bN/MVB0eDoCrTew0EWyavjPfB+gbFh73z2D9GyI6Jlsxj7JYAJJzILxDnj4+wRtnQvdBECKos2jr3V0mHbk+EFkxORW8hTXR8ygemiOolBRijTYLEVQXT8+KLoh8TqanUbJCipDLP9LCAzETCPeDlnATzvLEPipSydIf/KTXU5yQxKv22LWtZzdc9A2c2Dj+8iWhO63TK4wEEg+pRV6J5avfJvHD3RG9Dm6IuRePburxwFHwnwjSeOAKMnUSaJ9lJrNaSIGjceW+IhpGntiKohuJ+b+Vx4TnRvhCJD/SW76NLz2JB5bEWQKRx9PttCazkLB5c/qWZyXb6MSWPG/2i7MyTneE0iYoTmeUT0ptLgh3tX4FxC5ejg7RV36KwGtqo2A+ebosS4/JLQ0NyR8pxP3G1F+WLjCl1GutsMR/bumuND+7NhQ+4+kZ0BfSrbaUCrnkYFg9pnFX4SAjFpX1jl+sWjLKISHWyqr3aaWFXN2RRLuEZrtngURLuzevJHOZCPuDZlyQPXnQfFXoHrAsGPzyVo7Ei6rdf1YQfmQ/q3tBPGoWikO5OYA2mx9dtbSCuA87VEplyaii2OzOxtfW/bLpJy0luQyDnOFhx9lvdY0DuclZ1eT49poXjfjM9oSzUShxnnDLo/T8eu0vZzyAJa5BHwXSLMd1mRCtkLRg6W5fDfIuxCLMHjwp4Z6F+OgAXQvzTi5yE+OwzN9wd7aHCj4pUCirsa6mmwq7gFFbnf6pmH/l6SYhN7TlLh4CiA2eU9eAlJqd5e38uuRaRqyMrnOtgpw3QhfP3KsbOTaZsAPhIPCkx+rMelvMb3Oa++hnCPhj6mREH/8qaDDYF/04Gse/cUdDhhixbZJjqJxH7yvVuDItwhFO7Tg7G73coFHaUsKkpTUB2ABciq710F5n8Mofu17hQKSeOstQ++3QVYBRF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c876891-08b6-416c-f597-08d9514db276 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 22:27:20.0527 (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: MhbKVcjf8PvM6dQsnZpCnMXmWcx9bUgfcFCng7ESD0wbJY14/IKqsuJOGkOcEmDrVgx/DhkJ9+AZj60TYtNZvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5357 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Replace occurrences of sme_active() with the more generic prot_guest_has() using PATTR_HOST_MEM_ENCRYPT, except for in arch/x86/mm/mem_encrypt*.c where PATTR_SME will be used. If future support is added for other memory encryption technologies, the use of PATTR_HOST_MEM_ENCRYPT can be updated, as required, to use PATTR_SME. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Joerg Roedel Cc: Will Deacon Signed-off-by: Tom Lendacky Reviewed-by: Joerg Roedel --- arch/x86/include/asm/kexec.h | 2 +- arch/x86/include/asm/mem_encrypt.h | 2 -- arch/x86/kernel/machine_kexec_64.c | 3 ++- arch/x86/kernel/pci-swiotlb.c | 9 ++++----- arch/x86/kernel/relocate_kernel_64.S | 2 +- arch/x86/mm/ioremap.c | 6 +++--- arch/x86/mm/mem_encrypt.c | 10 +++++----- arch/x86/mm/mem_encrypt_identity.c | 3 ++- arch/x86/realmode/init.c | 5 +++-- drivers/iommu/amd/init.c | 7 ++++--- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h index 0a6e34b07017..11b7c06e2828 100644 --- a/arch/x86/include/asm/kexec.h +++ b/arch/x86/include/asm/kexec.h @@ -129,7 +129,7 @@ relocate_kernel(unsigned long indirection_page, unsigned long page_list, unsigned long start_address, unsigned int preserve_context, - unsigned int sme_active); + unsigned int host_mem_enc_active); #endif #define ARCH_HAS_KIMAGE_ARCH diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index a46d47662772..956338406cec 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 sme_active(void); bool sev_active(void); bool sev_es_active(void); bool amd_prot_guest_has(unsigned int attr); @@ -76,7 +75,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 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; } diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 131f30fdcfbd..8e7b517ad738 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -358,7 +359,7 @@ void machine_kexec(struct kimage *image) (unsigned long)page_list, image->start, image->preserve_context, - sme_active()); + prot_guest_has(PATTR_HOST_MEM_ENCRYPT)); #ifdef CONFIG_KEXEC_JUMP if (image->preserve_context) diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index c2cfa5e7c152..bd9a9cfbc9a2 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include @@ -45,11 +45,10 @@ int __init pci_swiotlb_detect_4gb(void) swiotlb = 1; /* - * If SME is active then swiotlb will be set to 1 so that bounce - * buffers are allocated and used for devices that do not support - * the addressing range required for the encryption mask. + * Set swiotlb to 1 so that bounce buffers are allocated and used for + * devices that can't support DMA to encrypted memory. */ - if (sme_active()) + if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) swiotlb = 1; return swiotlb; diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S index c53271aebb64..c8fe74a28143 100644 --- a/arch/x86/kernel/relocate_kernel_64.S +++ b/arch/x86/kernel/relocate_kernel_64.S @@ -47,7 +47,7 @@ SYM_CODE_START_NOALIGN(relocate_kernel) * %rsi page_list * %rdx start address * %rcx preserve_context - * %r8 sme_active + * %r8 host_mem_enc_active */ /* Save the CPU context, used for jumping back */ diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 60ade7dd71bd..f899f02c0241 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include @@ -702,7 +702,7 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_addr, unsigned long size, if (flags & MEMREMAP_DEC) return false; - if (sme_active()) { + if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) { if (memremap_is_setup_data(phys_addr, size) || memremap_is_efi_data(phys_addr, size)) return false; @@ -728,7 +728,7 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, encrypted_prot = true; - if (sme_active()) { + if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) { if (early_memremap_is_setup_data(phys_addr, size) || memremap_is_efi_data(phys_addr, size)) encrypted_prot = false; diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 7d3b2c6f5f88..d246a630feb9 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -144,7 +144,7 @@ void __init sme_unmap_bootdata(char *real_mode_data) struct boot_params *boot_data; unsigned long cmdline_paddr; - if (!sme_active()) + if (!amd_prot_guest_has(PATTR_SME)) return; /* Get the command line address before unmapping the real_mode_data */ @@ -164,7 +164,7 @@ void __init sme_map_bootdata(char *real_mode_data) struct boot_params *boot_data; unsigned long cmdline_paddr; - if (!sme_active()) + if (!amd_prot_guest_has(PATTR_SME)) return; __sme_early_map_unmap_mem(real_mode_data, sizeof(boot_params), true); @@ -378,7 +378,7 @@ bool sev_active(void) return sev_status & MSR_AMD64_SEV_ENABLED; } -bool sme_active(void) +static bool sme_active(void) { return sme_me_mask && !sev_active(); } @@ -428,7 +428,7 @@ bool force_dma_unencrypted(struct device *dev) * device does not support DMA to addresses that include the * encryption mask. */ - if (sme_active()) { + if (amd_prot_guest_has(PATTR_SME)) { u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask)); u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit); @@ -469,7 +469,7 @@ static void print_mem_encrypt_feature_info(void) pr_info("AMD Memory Encryption Features active:"); /* Secure Memory Encryption */ - if (sme_active()) { + if (amd_prot_guest_has(PATTR_SME)) { /* * SME is mutually exclusive with any of the SEV * features below. diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c index 470b20208430..088c8ab7dcc1 100644 --- a/arch/x86/mm/mem_encrypt_identity.c +++ b/arch/x86/mm/mem_encrypt_identity.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -287,7 +288,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp) unsigned long pgtable_area_len; unsigned long decrypted_base; - if (!sme_active()) + if (!prot_guest_has(PATTR_SME)) return; /* diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index 6534c92d0f83..2109ae569c67 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,7 @@ void __init reserve_real_mode(void) static void sme_sev_setup_real_mode(struct trampoline_header *th) { #ifdef CONFIG_AMD_MEM_ENCRYPT - if (sme_active()) + if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) th->flags |= TH_FLAGS_SME_ACTIVE; if (sev_es_active()) { @@ -81,7 +82,7 @@ static void __init setup_real_mode(void) * decrypted memory in order to bring up other processors * successfully. This is not needed for SEV. */ - if (sme_active()) + if (prot_guest_has(PATTR_HOST_MEM_ENCRYPT)) set_memory_decrypted((unsigned long)base, size >> PAGE_SHIFT); memcpy(base, real_mode_blob, size); diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 46280e6e1535..05e770e3e631 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -965,7 +965,7 @@ static bool copy_device_table(void) pr_err("The address of old device table is above 4G, not trustworthy!\n"); return false; } - old_devtb = (sme_active() && is_kdump_kernel()) + old_devtb = (prot_guest_has(PATTR_HOST_MEM_ENCRYPT) && is_kdump_kernel()) ? (__force void *)ioremap_encrypted(old_devtb_phys, dev_table_size) : memremap(old_devtb_phys, dev_table_size, MEMREMAP_WB); @@ -3022,7 +3022,8 @@ static int __init amd_iommu_init(void) static bool amd_iommu_sme_check(void) { - if (!sme_active() || (boot_cpu_data.x86 != 0x17)) + if (!prot_guest_has(PATTR_HOST_MEM_ENCRYPT) || + (boot_cpu_data.x86 != 0x17)) return true; /* For Fam17h, a specific level of support is required */ From patchwork Tue Jul 27 22:26:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 487045 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 360E1C4338F for ; Tue, 27 Jul 2021 22:27:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DF4D60F4F for ; Tue, 27 Jul 2021 22:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbhG0W1y (ORCPT ); Tue, 27 Jul 2021 18:27:54 -0400 Received: from mail-dm6nam11on2083.outbound.protection.outlook.com ([40.107.223.83]:18473 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233452AbhG0W1x (ORCPT ); Tue, 27 Jul 2021 18:27:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxzWBhreMMwJPX9lE72++1lM3L7PG9RHGRHN03FMY8qX1fpkojVjf3LnHVA8ZF0fErxnpEbT7LxhNdfgBPV1tAhlQrmb8Nv882eaYg0Rpvv2+5KH81ZTDmr+N+hjGTTooyyaOuUO+ojnGE99Yo0WqXgjq3wwG1bR91Sxoi0A+t5JE9H6wwHcC5ptDQL5HThNIe2bC8XhcYxS8nyIjKDSiYVjYlr/IyPDNzKAvuMNaHsAiPcGaLYm8FK+ElcJjmwYqPLzFuGDa/Y+hKX2MqbsVWpwFW+l6ZlVfw86YF8lOWOD74pMWQQsmY16Q1e2Rjvn4IXHDn0FbRaBrMMSl5Vg/A== 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=yloAMUO+RwdsU4/084NnOlABsXs5acuME6BK0MxSSDU=; b=FrKoL7WbW6EuyDHC23LTVg+MrzAbxzXpEl32FgIfljvyKBH2Nl6mP16+SBO7VYbJTwmOB/84KhUJRhCcFaAZS3NXCmYpUSybF+fpwbqYstPorwH+cJPYJGgfR57tdhKeLrD52WmzT8ai7gNuYbjfI4ymm1V1W0f23QleLZcTrYJNcJMuNEkiN0PIHJStP97uc6tWI/CBvo8F/W2aZbQZgyFjt2YLr+3VNRbmzIgC3zpM9oUrPWBEvMNf8CqgOy8Vrh8pUGy6HDler96hylO2+zK64EABf2S7USdEcpRvKhe1lTdLvHMJmC8rZVDPi9DFmNog1GL6ubLivW12Q/bmIQ== 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=yloAMUO+RwdsU4/084NnOlABsXs5acuME6BK0MxSSDU=; b=lCVDf7uAbHz/pSg6ZO8hIW6ZBxvqhNvtjydpz9+agV30hdMcO9dKkpmDiKg3VI768thVVldBWga5PmMoRIFxqUa+RXP71iFH+cwKS6QbJC4YSmSQ0rgvygxBI+VIZIE9l6HeEJEbZa0mbh6A5/6dIBzcdiuxNSrMKYyhTSyx1sg= 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 DM4PR12MB5357.namprd12.prod.outlook.com (2603:10b6:5:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Tue, 27 Jul 2021 22:27:50 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 22:27:50 +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 , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Will Deacon , Dave Young , Baoquan He Subject: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has() Date: Tue, 27 Jul 2021 17:26:10 -0500 Message-Id: <029791b24c6412f9427cfe6ec598156c64395964.1627424774.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0067.namprd11.prod.outlook.com (2603:10b6:806:d2::12) 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 SA0PR11CA0067.namprd11.prod.outlook.com (2603:10b6:806:d2::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Tue, 27 Jul 2021 22:27:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0b4bccc-6e99-4649-744b-08d9514dc4cf X-MS-TrafficTypeDiagnostic: DM4PR12MB5357: 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: 9jyPEzYYetNfS/96tbOpz6UY2+9HOCXb15TwsckxIW6jaEHLtZrOLpPgVlrqFCvb3wZzh2F22PtWY7gZ+JlIg4EeCnRJ7BO8fLFOv9xtPYGtwTROzSG9ncGLqBt0D9TAiY0uGqzElvHJZiEl7CxIt9GSXPZEHdZWs/GBWmrUtupiILRWdNIoHwoZOSlDCH/9fpC93nDh12o/l8U8VPvENtUqhG3PirES7frPHW7aap12ovhjajfB+WLIceSUEl88HtF+638TuMWYbg0nGyFWy0jB8jfbruAgUD87S81nr4t1iojW3QBtvCTEjTPeFN2fos2mnpCyfX/RwJs3lHZ4pggGAcVFlD77CCtupw2bNUYtP/k2o+C6cjFyg/EK+6gU5JHKoc5C5FRRQcznC1LTspIphGEymFRQ+1qom9Y9SG381Jkl1G1PiPUKrlunesFJ78VDcCPPluhKgWGiVVs8z3j+rw1Twjz2WsCkMXXxEW9xiWSGjT7uw8Q1K5LQWhGRUvMFiRb3pQJLggV9OglGG5zHrSJKfEiwDJD9G9ZEM+88d6GajwpUKcXh10bv6fxdNQMPlJLVO35dpaRJeMaDY3I6sj6ahaBSJOt8p3xcYvTOheyrfW4b8wmtmcev8iYB1dX35rQX+WPSSWmHp3eXY3jT6iFbdfOvPC68rc8Pp4x3pSrG2eqyHTlCJi2I9cnJkAIFCwVXWG2DCztFPTAE5g== 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)(396003)(39860400002)(366004)(346002)(376002)(136003)(5660300002)(36756003)(54906003)(83380400001)(956004)(66556008)(4326008)(316002)(86362001)(8676002)(921005)(2616005)(66946007)(38350700002)(38100700002)(66476007)(30864003)(7696005)(2906002)(6486002)(7416002)(7406005)(478600001)(26005)(6666004)(52116002)(8936002)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nJISa5zeWLWfc4W3JhiFpSpziGzZXqgFFU+3GkQZuGEZLkaoWVtWZizk61TCKmApzYkGSSlORaeyxYskejU+UER5iQyP7peB92LwnLJNwa+GS//WLO5mgdz3IOmhR+ttpw6/7y0ubAZsGwPe0Tncp+vXVqiTuEuWb2nyAwCBOGRCKCSolG4vORhske6NuqKbMBCAYMkfWNg/OoWUMQZbTbbSK5oTSOGpIUD1HEzCGA4c4k95SA+NtBi0edmtqiQvmeBaGZ6hBrwyM9Wd3OiIR1BT+juJzV+re7GhzYetmoJWOYsP83KTDb1z4ab+1UCatLrMNkcs0X12qkhyapd0EveN2rEghim2xMNwsTfgk/AopH1ne24NWNspYrpg1mqKcOeAEvIEhBP43JUnzwwsANHcb2CjhZRmpKa2CRtvYjbo/fr6Wd5HNvcFU8ML2t6tXozyKGNI65otZKr6sLXB5MJbmtE8WK04rAFITD6jmulPq7J6as2D9rESbqg7uwkjYyhGluQj3f+ZZbA7c84x/svzVNvbM+LlLtXMHSGWfg5SKY7OWBasmshseO8gfS1563PDsVdXz46tsp7DvzYuj48FO6F19dDfKJTtMOPWkfQ+txrNLSue1aVPUcHuCgZ/aXmH/c8/Nd3YxTgnYkaGhlpGZnMyWOXfDgpQp8OjkuwpzmFOGK61Eaz4L+i2SbbAcaz8/Dgc7DM6qv7O160hpP8KMGgsQ1hHC1ZiljRH9xBoXSL17sAN1wM6xNp6cRCwxLtgvb2ViGrU1UzBTxyDpWzRhu4Js9aMXf6oOf42XukFZeZ3xUfEgHI3N39wlZbtQOwShWdqW2lC9t9WBBro7NqnUdWXx8DQ9T4RNImxduWp4uFqALOBEmc1RaSlCvMB0/NCFuscRG0BKeEXxxR5pBj0cHDY8OkpL9/C0VitBmkj9cXIZaDe5jqvl5J7xTR6DP55iZO1lhAdKNvJxhzV60Hygyr33HVX8yX7UxKEqe+6saJ/9gSy1iV+9qXyGj/mEVwcnteDxsH9p3ANAoy/QtY9XjVLvnMo88zr1C6wie6jlW9PvxyYkLUPs4uqyg2VhXFRsrzVZtsHC4mXObPMmrLztdU+MsX1XpM46jQl1g1gxJySmkv73lxIvWTrQKggtZ6D1pydkqEfMiKHeDvgVx9NEYjlhUUW9+2oj6BpG8diY9B40At2UjKrj285G/7bN/BysXSB000D9w0hWPlzT6xBuHUjIns+ylc7iZOoE9KsKx6yJ4kiQ+XlMzftX7UDKb5mB3kcgvhZdiIoBZ3BUHJT+kjADlgx78szqQTlDEf6q8haHys1MkffpMfUelLr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0b4bccc-6e99-4649-744b-08d9514dc4cf X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 22:27:50.8137 (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: ZT0JkKyc9yzPTtmXWr5koQhEZg/joSuXTk+YSF1SO1wjtu9zvHm24d98DLwy9GC+cDegCx9t3YwHFLLTN+KwvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5357 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Replace occurrences of mem_encrypt_active() with calls to prot_guest_has() with the PATTR_MEM_ENCRYPT attribute. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: VMware Graphics Cc: Joerg Roedel Cc: Will Deacon Cc: Dave Young Cc: Baoquan He Signed-off-by: Tom Lendacky --- arch/x86/kernel/head64.c | 4 ++-- arch/x86/mm/ioremap.c | 4 ++-- arch/x86/mm/mem_encrypt.c | 5 ++--- arch/x86/mm/pat/set_memory.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++- drivers/gpu/drm/drm_cache.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 6 +++--- drivers/iommu/amd/iommu.c | 3 ++- drivers/iommu/amd/iommu_v2.c | 3 ++- drivers/iommu/iommu.c | 3 ++- fs/proc/vmcore.c | 6 +++--- kernel/dma/swiotlb.c | 4 ++-- 13 files changed, 29 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index de01903c3735..cafed6456d45 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -285,7 +285,7 @@ unsigned long __head __startup_64(unsigned long physaddr, * there is no need to zero it after changing the memory encryption * attribute. */ - if (mem_encrypt_active()) { + if (prot_guest_has(PATTR_MEM_ENCRYPT)) { vaddr = (unsigned long)__start_bss_decrypted; vaddr_end = (unsigned long)__end_bss_decrypted; for (; vaddr < vaddr_end; vaddr += PMD_SIZE) { diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 0f2d5ace5986..5e1c1f5cbbe8 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -693,7 +693,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 (!mem_encrypt_active()) + if (!prot_guest_has(PATTR_MEM_ENCRYPT)) return true; if (flags & MEMREMAP_ENC) @@ -723,7 +723,7 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, { bool encrypted_prot; - if (!mem_encrypt_active()) + if (!prot_guest_has(PATTR_MEM_ENCRYPT)) return prot; encrypted_prot = true; diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 451de8e84fce..0f1533dbe81c 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -364,8 +364,7 @@ int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size) /* * SME and SEV are very similar but they are not the same, so there are * times that the kernel will need to distinguish between SME and SEV. The - * sme_active() and sev_active() functions are used for this. When a - * distinction isn't needed, the mem_encrypt_active() function can be used. + * sme_active() and sev_active() functions are used for this. * * The trampoline code is a good example for this requirement. Before * paging is activated, SME will access all memory as decrypted, but SEV @@ -451,7 +450,7 @@ void __init mem_encrypt_free_decrypted_mem(void) * The unused memory range was mapped decrypted, change the encryption * attribute from decrypted to encrypted before freeing it. */ - if (mem_encrypt_active()) { + if (sme_me_mask) { r = set_memory_encrypted(vaddr, npages); if (r) { pr_warn("failed to free unused decrypted pages\n"); diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index ad8a5c586a35..6925f2bb4be1 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1986,7 +1987,7 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc) int ret; /* Nothing to do if memory encryption is not active */ - if (!mem_encrypt_active()) + if (!prot_guest_has(PATTR_MEM_ENCRYPT)) return 0; /* Should not be working on unaligned addresses */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index abb928894eac..8407224717df 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "amdgpu.h" #include "amdgpu_irq.h" @@ -1239,7 +1240,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, * however, SME requires an indirect IOMMU mapping because the encryption * bit is beyond the DMA mask of the chip. */ - if (mem_encrypt_active() && ((flags & AMD_ASIC_MASK) == CHIP_RAVEN)) { + if (prot_guest_has(PATTR_MEM_ENCRYPT) && + ((flags & AMD_ASIC_MASK) == CHIP_RAVEN)) { dev_info(&pdev->dev, "SME is not compatible with RAVEN\n"); return -ENOTSUPP; diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 546599f19a93..4d01d44012fd 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -204,7 +204,7 @@ bool drm_need_swiotlb(int dma_bits) * Enforce dma_alloc_coherent when memory encryption is active as well * for the same reasons as for Xen paravirtual hosts. */ - if (mem_encrypt_active()) + if (prot_guest_has(PATTR_MEM_ENCRYPT)) return true; for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index dde8b35bb950..06ec95a650ba 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -634,7 +634,7 @@ static int vmw_dma_select_mode(struct vmw_private *dev_priv) [vmw_dma_map_bind] = "Giving up DMA mappings early."}; /* TTM currently doesn't fully support SEV encryption. */ - if (mem_encrypt_active()) + if (prot_guest_has(PATTR_MEM_ENCRYPT)) return -EINVAL; if (vmw_force_coherent) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index 3d08f5700bdb..0c70573d3dce 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include @@ -153,7 +153,7 @@ static unsigned long vmw_port_hb_out(struct rpc_channel *channel, unsigned long msg_len = strlen(msg); /* HB port can't access encrypted memory. */ - if (hb && !mem_encrypt_active()) { + if (hb && !prot_guest_has(PATTR_MEM_ENCRYPT)) { unsigned long bp = channel->cookie_high; si = (uintptr_t) msg; @@ -208,7 +208,7 @@ static unsigned long vmw_port_hb_in(struct rpc_channel *channel, char *reply, unsigned long si, di, eax, ebx, ecx, edx; /* HB port can't access encrypted memory */ - if (hb && !mem_encrypt_active()) { + if (hb && !prot_guest_has(PATTR_MEM_ENCRYPT)) { unsigned long bp = channel->cookie_low; si = channel->cookie_high; diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 811a49a95d04..def63a8deab4 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -2178,7 +2179,7 @@ static int amd_iommu_def_domain_type(struct device *dev) * active, because some of those devices (AMD GPUs) don't have the * encryption bit in their DMA-mask and require remapping. */ - if (!mem_encrypt_active() && dev_data->iommu_v2) + if (!prot_guest_has(PATTR_MEM_ENCRYPT) && dev_data->iommu_v2) return IOMMU_DOMAIN_IDENTITY; return 0; diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c index f8d4ad421e07..ac359bc98523 100644 --- a/drivers/iommu/amd/iommu_v2.c +++ b/drivers/iommu/amd/iommu_v2.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "amd_iommu.h" @@ -741,7 +742,7 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) * When memory encryption is active the device is likely not in a * direct-mapped domain. Forbid using IOMMUv2 functionality for now. */ - if (mem_encrypt_active()) + if (prot_guest_has(PATTR_MEM_ENCRYPT)) return -ENODEV; if (!amd_iommu_v2_supported()) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 5419c4b9f27a..ddbedb1b5b6b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -23,6 +23,7 @@ #include #include #include +#include #include static struct kset *iommu_group_kset; @@ -127,7 +128,7 @@ static int __init iommu_subsys_init(void) else iommu_set_default_translated(false); - if (iommu_default_passthrough() && mem_encrypt_active()) { + if (iommu_default_passthrough() && prot_guest_has(PATTR_MEM_ENCRYPT)) { pr_info("Memory encryption detected - Disabling default IOMMU Passthrough\n"); iommu_set_default_translated(false); } diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 9a15334da208..b466f543dc00 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "internal.h" @@ -177,7 +177,7 @@ ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos) */ ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos) { - return read_from_oldmem(buf, count, ppos, 0, mem_encrypt_active()); + return read_from_oldmem(buf, count, ppos, 0, prot_guest_has(PATTR_MEM_ENCRYPT)); } /* @@ -378,7 +378,7 @@ static ssize_t __read_vmcore(char *buffer, size_t buflen, loff_t *fpos, buflen); start = m->paddr + *fpos - m->offset; tmp = read_from_oldmem(buffer, tsz, &start, - userbuf, mem_encrypt_active()); + userbuf, prot_guest_has(PATTR_MEM_ENCRYPT)); if (tmp < 0) return tmp; buflen -= tsz; diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index e50df8d8f87e..2e8dee23a624 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #ifdef CONFIG_DEBUG_FS #include @@ -515,7 +515,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, if (!mem) panic("Can not allocate SWIOTLB buffer earlier and can't now provide you with the DMA bounce buffer"); - if (mem_encrypt_active()) + if (prot_guest_has(PATTR_MEM_ENCRYPT)) pr_warn_once("Memory encryption is active and system is using DMA bounce buffers\n"); if (mapping_size > alloc_size) { From patchwork Tue Jul 27 22:26:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 487044 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 AFDE4C4338F for ; Tue, 27 Jul 2021 22:28:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D6F60F9C for ; Tue, 27 Jul 2021 22:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232664AbhG0W2U (ORCPT ); Tue, 27 Jul 2021 18:28:20 -0400 Received: from mail-bn7nam10on2075.outbound.protection.outlook.com ([40.107.92.75]:51599 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233379AbhG0W2D (ORCPT ); Tue, 27 Jul 2021 18:28:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B/CyODtLAIKHPu4OZ5HkOG8fOXcidjGJjV302Mc73LEfK7hirYJDzCGrWegs9WokcTGxp+zQKhg++GLeBAKAOMalbkAV7QH9Fk88E/790JvjvX16e5WbVGH3abdNrTf7LrrHkksQZHz+cH1rckOUmBgSbzTwWLy9Hg6jZSdpus/jyGhcKSVROBNDLsNLaVzpg6hYyyR0ZX4gVsnM4pVlHh29VTH/nqXgmRgtD4Ap9YcHcZeN+MzfdiAD7e+lsnfpOR/ar55ftDqk2zxEecsIUsqkh3K7/WAEII+nUXyex6IqKzB19kNjcIFS/AOBG9uVnXyS7EdyrR8E0uLcPNtRvQ== 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=bXN4zJvX7fQnk2nAZcPyim1SCQt+IA2vttWwJbsOBZ4=; b=HHYwJtnnCHcspdicxprqO6148ZhcfHQkKaMqjzb/92vhhibaY/pBn+bb0NMBgRvQDIM05/VamV4j+I/JMLwxa3dsW73B23GaQsr7zUCnFNayQb42a8JwWFWQ3f05sjCPLXipXtVQIunRevCm11EJDlWH1Rno6ip5WgO+C5c3zUJQPVIT1iNzpVHdHGzu5IMBsBVvuqiOy5WJ6S0hOQ1Q7ss850Q02KKT1WwXAQ3nDzIPYc1Q2vRhn3Ugj7cm9QPw1K9z6hRldQlyOS7DvVthgyn8irrdDm945D0QzzOpCIgsDKATpBQM/LOmAq/XHpbPRNNv1a1V8v9A0N9LsfmKxg== 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=bXN4zJvX7fQnk2nAZcPyim1SCQt+IA2vttWwJbsOBZ4=; b=SyKasOPlEm3GGOCpRIDYFV3idTz2YvN34xQTuCO7HyiA82fD+Mt1SW32rRWFTq9QG+rM9WH/+td7XrFxts9kH9K9MGjo7ZyUR7gwMurMbtpvJEX0lPsdS5i638HKSZmIlVx+dXvnzr9NpzsdNZpwICVZd3dVoND10o3jCmof4Ok= 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 DM6PR12MB5520.namprd12.prod.outlook.com (2603:10b6:5:208::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Tue, 27 Jul 2021 22:28:00 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 22:28:00 +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 Subject: [PATCH 08/11] mm: Remove the now unused mem_encrypt_active() function Date: Tue, 27 Jul 2021 17:26:11 -0500 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SN6PR2101CA0019.namprd21.prod.outlook.com (2603:10b6:805:106::29) 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 SN6PR2101CA0019.namprd21.prod.outlook.com (2603:10b6:805:106::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.2 via Frontend Transport; Tue, 27 Jul 2021 22:27:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 440c7b55-25c3-4298-6cdb-08d9514dcab3 X-MS-TrafficTypeDiagnostic: DM6PR12MB5520: 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: WB6gDe2S35FRxPUP7RUdFzxC1YI+kVwsS2ex2pjWrBkj17JIl8PYfwmX7u2Yn589xPAWoDmsYmnLvlJK+hFaoDzEzt4b1QNobjkONp1CjgUmWb/B+OxnPtIF8z+VyoxBEBVjRQZ6VTvahVLh2F89rO/itJX11xM1AipQYrzR2lujhPJy1P7LziuT8o49gvHTG/QHNkf/a9u1kmOy8ean5GSVrYjtiZLXxMpxl6J4urcYbSo9UFY6xuZWdhvi6GwYjTPOnSVhaA9MFozJJyG5hyeUhMhoMK14X6qShv/OXc7WLQ6JvhLVwsuZacp1zMnIFpq1cL38TDmofmKWK5EcB8odvBXoxrvXbdvwvZyaUgk9OILGs9EudFSe22AmRaLHRWFvP8A/C7zSTn6Y0ZJHtJUiVMOeMyPbED4o2g/GquUvrIiJ8mT4KWqTV7ejovzGRNGMWn+UhaCdaA7amFhlW41RKBIZV5hVnTNaoTKAJqQ7Le1btIipiI2eyx7L9vFA3WN/3FuUr610+uuQM4tFM6Bg72HxZUmh+ub3YQxDONyB4/6+pbYst1MpQyMCcwDdgoK/zphKYiAhO9UV2PRaA204tHFJOlGP+BcHrjtWQWruRFQ7BtZzgl6GNb/NuH2jHbjYwd3C7nMcH14wm/on94t67mIoFBHBpc2ACnB49IY3WLFU44ZTINWqkH+7cmvo76lZHtdDHaQdz224+RWS87jUVUFJHrnCO5g3AWozjAQ= 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)(346002)(136003)(396003)(39860400002)(376002)(366004)(52116002)(186003)(478600001)(38350700002)(921005)(5660300002)(38100700002)(956004)(8676002)(6486002)(54906003)(4326008)(2616005)(7416002)(7696005)(86362001)(8936002)(316002)(66556008)(6666004)(66476007)(36756003)(66946007)(2906002)(83380400001)(26005)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3NbPnPP9I7JALLiYBRw1I6VwYZMsnOeGvhd3dHNamDc8Q128muqLW4AtRjRTs0u0hox8FU+K8vIjCiADtpTNBjdLMkFT/Fx176iOkmi4NYRMxJkoe2o3sbRP/0HWn8T4JtpJ73af9s4TJaz0fjVMqV/zoQ8UhVGxK4myd1RmU8y07bLfR+aCPyIvy81ufP8SK429pJwlQFp3dDnoxYKHw7Gln89vlmZLblh8n6wE/mPHX4g2F+GhoUNF0Lhnl61o8f9vXHdy3z5f9y6SkEYD2wbZeg+G1jgUfT1/FOMfW8XTL+N1flZaBi6epEy+Kd5D0Gc8mSXMXdhDCkp8i+gPThOtaU/YgA9QhQISLUe8gzbClFdcvou+TNq3yC3omtZMYn6u4f/0HLvJAMvtmO11rWDH0Ul0lkToVas0vOQkX+BJgtaPjs/wDwR6C+7Xt5KHX9OQd8MdDl/j8O8gyUb4Lw/sgi5V4FrWpvBud468/GU4J7hy1hL51R2YqRV51vWRrj/pQHUWPm+EWHwHVXEtBHC2sZLfkQ3gMeEb0UKg0iCgzi4c2N+J3KSpJAH7gt92MINz3iNRmZCstgxIe3lxwaUKO4jFRI/paFZNcEanJojZZ4QM6yiguf82XwFjnehC2FMmgJ1vcq8TQbzVJWkr2YNTOOAueOSTKYtCiVaz8ERHj9kFtP3148B1j0zmr+xw2x267rf2IDbWST9MUlQYwyJ4sxwBRwJyfXY1NXuNlIvGgjq01i1vHXo0LrWzlMVYWtu/LBKUwLqr1b6Ibvpa2u1lbEVXVLQn2zHqqn2hGyQ2evmVJpRxiRBw4+WeddmOWOf/+K7l8vXcR3PSvIJpItN5k6xB6wmMFFZUL6Sru9izXYuTyIiRxQM0pnFo3hNSkbrEYnvG+tIntVOHRrHv1+EKdnPi1u8oRb7ERD3t2aFPbVzxz9LmcSz5QAargMg6QZdb1QCu7ZxgY5NE9e3AEL+6mj304LXZ/7jFzu2Qd1qYJxVhd8XfhgZppqqgDHyvLl9HpId8GFZtPBVqYekUuP5ZADVpJWuMHBAjxrQs+sHjkpt8XyAL0VRPfClM4Da48RyRECLACfw/BNIVWfHJQFp133DJ06JRYXiuD5RC/jf3g16W7/DB7TUVBWHs5Pre55sgGijTt5E2Am+b9OAU5AztiUp879kFkGXCFN8IU2sP8MgBvUOGwNamfacv1tzadFc4NoHDsDUWJP0ffVrPrk/rCtYU70PVhlqgJMr/bQ40Qu5r4UXKCZ/HxTLkdiqCqIsopqkrhp5n1y6E3KAHNdktS8L31aops3p6st9IvsAh09dlQdt2IopxlnuPaYg8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 440c7b55-25c3-4298-6cdb-08d9514dcab3 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 22:28:00.6157 (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: QnbSSh5hLkL+L4otK3IGb1kwigDVAt3HlEhpSUKc4PZsjvryPBHKnkWfUfAnG50w0GbnFJ8QvAAho+XaiLF3eA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5520 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. Signed-off-by: Tom Lendacky Reviewed-by: Joerg Roedel --- 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 Tue Jul 27 22:26:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Lendacky X-Patchwork-Id: 487043 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 9600CC4338F for ; Tue, 27 Jul 2021 22:28:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8209860F9C for ; Tue, 27 Jul 2021 22:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232544AbhG0W2s (ORCPT ); Tue, 27 Jul 2021 18:28:48 -0400 Received: from mail-bn7nam10on2075.outbound.protection.outlook.com ([40.107.92.75]:51599 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233086AbhG0W2m (ORCPT ); Tue, 27 Jul 2021 18:28:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IODcJV8Kss3MMrfqAelTlOx5inSIuo7dqPJUVDg8K4rOUajwhBlaTG3zLEpvgm7D0O+XoCKpOTR5WkG7RQ6JMlcriBUvKGYOgIfNsykO5uRffZ7HVDML0Os73PXByQTZGq8/aVtYdCpIPWcBVcFCBHtWIbqnRz9YbOyKy6NxjROS/62lu365WSXEZ7sk6DamypJ78LaA6tEgxz2XkVy9x7Lk4g6W5f4uU284XQKjhqDwSq/r824+MXN0i0A22zakY2N1A1vCpPDPKKbEBKZAVPKR96w+62k8ryVbT2NCMNnCsJU8299XzN7dKXZ60dP2NkMUoK+5/fI8BFcrznUNLw== 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=iIPh2rEBT+oHALshyHjZn3rwn/TTc2cQQN/LLwpRQBR2D2iukoILlqoluHJQ3xqfVzG3iWMNXy3bKgu2SJi5rjbAe3aehchB2BHw354bhK4zdAuLsnCnZiJT//UVWBPlwY9ryKFhI+KjtfR0ErsA+jCMFqmNiSPaJnQjPXWe1RiPeMGhn+9vix0LZyFcs1G48msrLrPh9+SpSp7dvsWLiPLzrb0doaSTkIQ69o+mcYZ0yRgCtnQryXJaqpDqbcmvxchQv4LdpBy01AKBzn1RkBW7Lpl+S2FeDzqpHqGYAovZEgcm64PpcB5eFz8hgQbgFDEMDK4zxhbyMbn2nS/9xA== 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=OgYJAZmsOOfZF6ybEL9Bl3P5RcHc0GxOtXUOsmQcyYfFr5a+LDjnCxcKNEdSAOprochI+Iyfn9E4J9b0sJBw+fyd88NKGOk7yvZb/o07OH7n5Ne295WRr4CQqS+QMvAKsTidtMZNdnKgWTaeHuZCcDCRTegkPB0zi/Bo/uLQiRM= 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 DM6PR12MB5520.namprd12.prod.outlook.com (2603:10b6:5:208::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Tue, 27 Jul 2021 22:28:20 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::73:2581:970b:3208%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 22:28:20 +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 10/11] powerpc/pseries/svm: Remove the now unused mem_encrypt_active() function Date: Tue, 27 Jul 2021 17:26:13 -0500 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-ClientProxiedBy: SA9PR11CA0010.namprd11.prod.outlook.com (2603:10b6:806:6e::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 SA9PR11CA0010.namprd11.prod.outlook.com (2603:10b6:806:6e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.26 via Frontend Transport; Tue, 27 Jul 2021 22:28:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2ff93a6-8c75-4220-83a9-08d9514dd6b2 X-MS-TrafficTypeDiagnostic: DM6PR12MB5520: 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: 1TR3e+7vboeNn96OGJH/uyylPHctUUGnJSZMIA2ijuITPzdFvOVMYAoal/j8eVuJ5JAjiyYlmWv9cLppj7WmbocsicyjE0AVuA3XBqvfPf+GH71yIw4yW9J/TB7q/tfA13JpFcZMlEhow9TnXhra5pzdf+8xpUkm1LzKH0Jjq7VCGzHdlmELGbqXyMkQoDNZqSV1sJkyDSVbIGi20TzBFPMGaP2Z4od1HdaHaSln4SaDDQQQSxFGgh5CMAxk0q8WATYzsp4k0U/68Gu+N7pBcKz2CH08/0WhEko4bnTs3aqpnNy8VlGQqlEc3WI/1WlEZA7fx+jivCpp87fU9+eRdH3iFsBM2JS8meDv25I2kUyIRt+5oclbUDJb1LDNdiC88qIGyPzMgGtk1g04Q4gfPZcxdBXWynqV90TVIWpzozx/2louqjAAhL+THKHrJUYE05tujTR31VwcWMBW4gkBjmE3ABWnfO0ACoW/YB3LScJH1okjh4rxxLEQQN2yqk4WrZWQ/Yb3IN+7ENrkCa01g4q7XrEKiD8DUuFrk6PWxuQ2GYaulMcZ13R1lSnikE7FhxUA+5iveWRsfn2jy4DO/x7VrzejHuZUowbPjIAK42EbKxOpy2w2UVGcB24VFreA47IsIu4NkUdfg5bHjyIjQmZjcr3kNoKjaCGDDWuA0eXo1kQUvXqefOuZMGJ7mV0wB/R+VFWJWIyZ1Ng2SWzJDu9M4yS+5jsXEhJnS5iQJDU= 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)(346002)(136003)(396003)(39860400002)(376002)(366004)(52116002)(186003)(478600001)(38350700002)(921005)(5660300002)(38100700002)(956004)(8676002)(6486002)(54906003)(4326008)(2616005)(7416002)(7696005)(86362001)(8936002)(316002)(66556008)(6666004)(66476007)(36756003)(66946007)(2906002)(83380400001)(26005)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 33XF5xyV6fSMw3mBCWiOHJrlKtNzKeJ6/jRgmcl8RZYEr1Vi6JiElIyMpiOC9+zwKk2nCv/fQvEkn4PQsdV59SWL4lyHFU5QopsGnK0eh00aIpOkFKGWY2Fu8aXmURCD9kstB8NClzK3Rk2gjyQUbEdGjco6x3g3zuy8WMSDVSwL2xY/K+xt6XG74Jys1erg/n5OHktqH4mIetUzRpDp9/6VfJo214rBIA35S4WhOn5XmSfJjDIHNxja59sr1O2x16/gfH8vh5qqbz/+oXD5HEYKqaBhXxzn6ZlkQJ3Zq0RHdFJR4MB5Jn3c1mAa/D56lHvqzr7KvaLe4QFCjaUOx9cPzGRLts1lBQ9eb9Ak1zSh2aioycePqhFntOln3Kamhc1W+eBKk6+nI4BJXBbvuRr5eANOeA7C6SwZBAR4g5BpZiC5UZ9dx9+YLBSyVNM/FpxahsiRvrVfKViw9wQnonQEhWQAaFJBBQxUHB3Jmt/mCq57S20Z9a6tM/9e4UModS5iimgQx0SDYmv6RiZS0CHzM598B/D/ro0+S2kn/Tw6NRu1YfYbTi5sl+YpYU00362j9JVxM6XYDmkY0gRusWaZCcvSb3OqbJ7sUotrVhyvlVpTSgsDDWqlRN2NLtDUhp0L+XnLzerAxyP1bGFnwJdbHZza1l6u7s7XqMrnibPaGVJH9yuCUYRyezByek4A8hXZeNpv3d6aO3RzteIxHnnpVfWBcfEGWfMHyucA8Entxxx+uQrEuVho9ucBJCLywWZ4MXRU2LEngWZtdnc7FSraxU3HqTTgsM1mCLyZls4SimBB7udd+bX4jBtbDmV95K++ZjkDD6XHykJK04u/s1gtiMkSbvR473nC0jltyuQEx0LpKe3Am7bt87avHd2W8+td6djBJH5VP5x3W5+60NLgGPlwvKtm/0MAeY1hNse87F4HXXrA7Scj47I/5zZ1pn8gitU04mTXFyQ4sRGVEDMUZ71h5L6HUezkXig+OJN0ZnMmwalqI4i+qRatKDJq38cFj/dIPINUBWJhoN5SUi0srC3i5DaFKGNMPY9jdMmEperBEZBYpmxYXnLxmN0N3WxAWQhC7x10qRzyDskphfFkwWVGrHkV/IfG0IZy0P5sSaNfxKVQ+DRbQP8igDrWZCLvhqEN6x67EYVOpPFE6dXkCdHhBs8FXP4JK07Avj4QZc4ePzU/X8mn73iqAIQN5uur85oHQp8/HF88gRNK6jAotV1wrEz8wBdjid2U5O8YWY11jD/9JLM1FOl7FgrYgVDv5ysBItsvT/kTDdiotQ4l+27sx+YIdGXA8IGnaecQt1f94b714YykypFf8I3U X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2ff93a6-8c75-4220-83a9-08d9514dd6b2 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 22:28:20.7713 (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: sK+QPL1UQy1x9YBjf2wLCNl6K8ELA+qcyL1NCrg8TKafLNREDqaRZrt8bwe+VFZXfpQiQOVdt50NIH1p+iGXeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5520 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();