Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp475311ybg; Thu, 19 Mar 2020 03:17:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuvgIe88HEs+vKnD61rp8cRyr+yh38YSppkcpL/VZN+XH6F8BwP/yJrEwkUcaFt+ueiOwCF X-Received: by 2002:aca:5208:: with SMTP id g8mr1653333oib.169.1584613042785; Thu, 19 Mar 2020 03:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584613042; cv=none; d=google.com; s=arc-20160816; b=df16xvO32OtrGhK0Jxu7utS2kZVO/6eUTks6hgW2lTflWK3C4zDIPwNcqdInxHtFRf ZwimigU5zFtLBe/ew0exfEeGrwNpEHjbUnUIoD4c/F2Ck1UrqUqY1m8I4iOydS74pmuV 9S0Y+S7CzJJd8vN08xe3OYwRikKU2LTf8Hrq1J/Jfgs1aHkyRC+0i+S1JB0X8pw2Jgyg 041jhJNcpx1R96/qB/lZEs4frOsuMfGnD0TriFJa9Amaj7CYhbNSUE1lEFn2gf+B421u kbV7CWUizHDFuKrI4E/GMv+dNc9Xpp3hSVtpLStDyoYJ7v7g7zidcH0UTItR86foyv75 PEag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kyXB3LhXMlYk05dewzUxEywSSYigUP22lYt3Q49KHmI=; b=lo0nIYlrbm9VexaKQqG6FQoEVE3YyDcMkTMVpDcdlwb7JqWVa7k6aZnvsWT53xQUna zhs4boB0PVOfRUygxLkPINA5psCoiEOkSMrCCIlKWWP4o65Zt2p20mIvPRky8k2P2dYo nryty+8brf4AS032LtvkrsXNOtBvss/CCVjRpsoubV48p7YELXfyaWzYaQO1qgUPEIU7 8VE0P9petkfPUZlUH4hLw0VEkJ2ezsCl00Pb7oFl6P26cbv/qB73UyijPBO7hlvIPCEw 73Xy9NYMCRntvukkXUN/zQspXbE0w++XqDSlcg1W8HABNsTPERmCyAL4JNI6GSUBRYmw G/Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OdJZDRE3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si1002124oti.165.2020.03.19.03.17.09; Thu, 19 Mar 2020 03:17:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=OdJZDRE3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726879AbgCSKQy (ORCPT + 99 others); Thu, 19 Mar 2020 06:16:54 -0400 Received: from mail.skyhub.de ([5.9.137.197]:55732 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgCSKQy (ORCPT ); Thu, 19 Mar 2020 06:16:54 -0400 Received: from zn.tnic (p200300EC2F0A850035180F69CBC86220.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:8500:3518:f69:cbc8:6220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 57D8D1EC0CF9; Thu, 19 Mar 2020 11:16:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1584613012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=kyXB3LhXMlYk05dewzUxEywSSYigUP22lYt3Q49KHmI=; b=OdJZDRE3k65QjZ/LHJJwYG2FZVA1/4CS3YUasQdlMaNOaQxumloXOafvMddSta9Lmp9mYT vOHhz35eEaodYgWkBSGWw9zSLIay3NIjKQV0Ktorq9kwlDXEOdBM9dV+vFpCkOr++q0LUJ TjuwZ8g+LaouH+iQR0GtJkZ76x8bYfA= Date: Thu, 19 Mar 2020 11:16:57 +0100 From: Borislav Petkov To: Borislav Petkov Cc: lkml , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Christoph Hellwig , Marek Szyprowski , Robin Murphy , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, iommu@lists.linux-foundation.org, Tom Lendacky Subject: [PATCH -v2] treewide: Rename "unencrypted" to "decrypted" Message-ID: <20200319101657.GB13073@zn.tnic> References: <20200317111822.GA15609@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200317111822.GA15609@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, here's v2 with build breakage fixed on ppc and s390 (obviously I can't grep :-\) and commit message extended to explain more why. Thx. --- From: Borislav Petkov Date: Tue, 17 Mar 2020 12:03:05 +0100 Back then when the whole SME machinery started getting mainlined, it was agreed that for simplicity, clarity and sanity's sake, the terms denoting encrypted and not-encrypted memory should be "encrypted" and "decrypted". And the majority of the code sticks to that convention except those two. So rename them. The intent of "encrypted" and "decrypted" is to represent the binary concept of memory which is encrypted and of memory which is not. The further differentiation between decrypted and unencrypted memory is not needed in the code (for now) and therefore keep things simple by using solely the two terms. No functional changes. [ Convert forgotten s390 and ppc function variants. ] Reported-by: kbuild test robot Signed-off-by: Borislav Petkov --- arch/powerpc/include/asm/mem_encrypt.h | 2 +- arch/powerpc/platforms/pseries/Kconfig | 2 +- arch/s390/Kconfig | 2 +- arch/s390/mm/init.c | 2 +- arch/x86/Kconfig | 2 +- arch/x86/mm/mem_encrypt.c | 4 ++-- include/linux/dma-direct.h | 8 ++++---- kernel/dma/Kconfig | 2 +- kernel/dma/direct.c | 14 +++++++------- kernel/dma/mapping.c | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/include/asm/mem_encrypt.h b/arch/powerpc/include/asm/mem_encrypt.h index ba9dab07c1be..f0705cd3b079 100644 --- a/arch/powerpc/include/asm/mem_encrypt.h +++ b/arch/powerpc/include/asm/mem_encrypt.h @@ -15,7 +15,7 @@ static inline bool mem_encrypt_active(void) return is_secure_guest(); } -static inline bool force_dma_unencrypted(struct device *dev) +static inline bool force_dma_decrypted(struct device *dev) { return is_secure_guest(); } diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 24c18362e5ea..a78e2c3e1d92 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig @@ -151,7 +151,7 @@ config PPC_SVM depends on PPC_PSERIES select SWIOTLB select ARCH_HAS_MEM_ENCRYPT - select ARCH_HAS_FORCE_DMA_UNENCRYPTED + select ARCH_HAS_FORCE_DMA_DECRYPTED help There are certain POWER platforms which support secure guests using the Protected Execution Facility, with the help of an Ultravisor diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 8abe77536d9d..ab1dbb7415b4 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -192,7 +192,7 @@ config S390 select VIRT_CPU_ACCOUNTING select ARCH_HAS_SCALED_CPUTIME select HAVE_NMI - select ARCH_HAS_FORCE_DMA_UNENCRYPTED + select ARCH_HAS_FORCE_DMA_DECRYPTED select SWIOTLB select GENERIC_ALLOCATOR diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index ac44bd76db4b..5fed85f9fea6 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -157,7 +157,7 @@ int set_memory_decrypted(unsigned long addr, int numpages) } /* are we a protected virtualization guest? */ -bool force_dma_unencrypted(struct device *dev) +bool force_dma_decrypted(struct device *dev) { return is_prot_virt_guest(); } diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index beea77046f9b..2ae904f505e1 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1525,7 +1525,7 @@ config AMD_MEM_ENCRYPT depends on X86_64 && CPU_SUP_AMD select DYNAMIC_PHYSICAL_MASK select ARCH_USE_MEMREMAP_PROT - select ARCH_HAS_FORCE_DMA_UNENCRYPTED + select ARCH_HAS_FORCE_DMA_DECRYPTED ---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/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index a03614bd3e1a..66d09f269e6d 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -350,8 +350,8 @@ bool sev_active(void) return sme_me_mask && sev_enabled; } -/* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */ -bool force_dma_unencrypted(struct device *dev) +/* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_DECRYPTED */ +bool force_dma_decrypted(struct device *dev) { /* * For SEV, all DMA must be to unencrypted addresses. diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h index 24b8684aa21d..9f955844e9c7 100644 --- a/include/linux/dma-direct.h +++ b/include/linux/dma-direct.h @@ -26,14 +26,14 @@ static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dev_addr) } #endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */ -#ifdef CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED -bool force_dma_unencrypted(struct device *dev); +#ifdef CONFIG_ARCH_HAS_FORCE_DMA_DECRYPTED +bool force_dma_decrypted(struct device *dev); #else -static inline bool force_dma_unencrypted(struct device *dev) +static inline bool force_dma_decrypted(struct device *dev) { return false; } -#endif /* CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED */ +#endif /* CONFIG_ARCH_HAS_FORCE_DMA_DECRYPTED */ /* * If memory encryption is supported, phys_to_dma will set the memory encryption diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 4c103a24e380..55c4147bb2b1 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -51,7 +51,7 @@ config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL config ARCH_HAS_DMA_PREP_COHERENT bool -config ARCH_HAS_FORCE_DMA_UNENCRYPTED +config ARCH_HAS_FORCE_DMA_DECRYPTED bool config DMA_NONCOHERENT_CACHE_SYNC diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index ac7956c38f69..a0576c0ccacd 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -26,7 +26,7 @@ unsigned int zone_dma_bits __ro_after_init = 24; static inline dma_addr_t phys_to_dma_direct(struct device *dev, phys_addr_t phys) { - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) return __phys_to_dma(dev, phys); return phys_to_dma(dev, phys); } @@ -49,7 +49,7 @@ static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, { u64 dma_limit = min_not_zero(dma_mask, dev->bus_dma_limit); - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) *phys_limit = __dma_to_phys(dev, dma_limit); else *phys_limit = dma_to_phys(dev, dma_limit); @@ -138,7 +138,7 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, return NULL; if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) && - !force_dma_unencrypted(dev)) { + !force_dma_decrypted(dev)) { /* remove any dirty cache lines on the kernel alias */ if (!PageHighMem(page)) arch_dma_prep_coherent(page, size); @@ -179,7 +179,7 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, } ret = page_address(page); - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) set_memory_decrypted((unsigned long)ret, 1 << get_order(size)); memset(ret, 0, size); @@ -190,7 +190,7 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size, ret = uncached_kernel_address(ret); } done: - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) *dma_handle = __phys_to_dma(dev, page_to_phys(page)); else *dma_handle = phys_to_dma(dev, page_to_phys(page)); @@ -203,7 +203,7 @@ void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, unsigned int page_order = get_order(size); if ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) && - !force_dma_unencrypted(dev)) { + !force_dma_decrypted(dev)) { /* cpu_addr is a struct page cookie, not a kernel address */ dma_free_contiguous(dev, cpu_addr, size); return; @@ -213,7 +213,7 @@ void dma_direct_free_pages(struct device *dev, size_t size, void *cpu_addr, dma_free_from_pool(cpu_addr, PAGE_ALIGN(size))) return; - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) set_memory_encrypted((unsigned long)cpu_addr, 1 << page_order); if (IS_ENABLED(CONFIG_DMA_REMAP) && is_vmalloc_addr(cpu_addr)) diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index 98e3d873792e..dbd0605a39c5 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -154,7 +154,7 @@ EXPORT_SYMBOL(dma_get_sgtable_attrs); */ pgprot_t dma_pgprot(struct device *dev, pgprot_t prot, unsigned long attrs) { - if (force_dma_unencrypted(dev)) + if (force_dma_decrypted(dev)) prot = pgprot_decrypted(prot); if (dev_is_dma_coherent(dev) || (IS_ENABLED(CONFIG_DMA_NONCOHERENT_CACHE_SYNC) && -- 2.21.0 -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette