From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 BB19CC433F5 for ; Thu, 9 Sep 2021 07:33:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A5C2610C8 for ; Thu, 9 Sep 2021 07:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350650AbhIIHfA (ORCPT ); Thu, 9 Sep 2021 03:35:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43672 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232549AbhIIHe6 (ORCPT ); Thu, 9 Sep 2021 03:34:58 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 18974CZl190780; Thu, 9 Sep 2021 03:32:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=05W2cyFjefu3JhpkoDloIEueya93kf3C6iMwYd+Pjrg=; b=Y033sOeQWQIZWz3ggbj2qx+JdcjKD6Mx/7nD3GSlxzhVGSLbNYo8m4cYwiE65HV9Ftvt /6dBaDJMy1zRNjVFBRDBHKYdNaqZqjr+J4Re8nStjOJ6v36EKG9MgR239Dy+YNQ2n8lG jvtRMsFpEw2t0knPx7273OkyE6190dellweXi6mUM+w2pACjLl3vEeSqezG3kQUMYgNx 1um96CLRVQcxlaCOycGkiqUYtpkY3FyyJCdur3m125uUwPYmWaTl+6qyIVWDgWh/+xH3 u/Tkfs25tTQSKbgFclMODarS0yJLG7ZlnH/kFSm8nJbPnCgvpba0FLJbfbO/gJwGyeGB rQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ayadqmcgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 03:32:31 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1897HCUc047422; Thu, 9 Sep 2021 03:32:30 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ayadqmcg1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 03:32:30 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1897RJ3S030612; Thu, 9 Sep 2021 07:32:28 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3axcnnseh5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Sep 2021 07:32:28 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1897WL2955968228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Sep 2021 07:32:21 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BCD0EAE051; Thu, 9 Sep 2021 07:32:21 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 266A9AE065; Thu, 9 Sep 2021 07:32:20 +0000 (GMT) Received: from oc7455500831.ibm.com (unknown [9.145.58.163]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Sep 2021 07:32:20 +0000 (GMT) Subject: Re: [PATCH v3 0/8] Implement generic cc_platform_has() helper function To: Tom Lendacky , 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 , Christoph Hellwig , Andy Lutomirski , Ard Biesheuvel , Baoquan He , Benjamin Herrenschmidt , Daniel Vetter , Dave Hansen , Dave Young , David Airlie , Heiko Carstens , Ingo Molnar , Maarten Lankhorst , Maxime Ripard , Michael Ellerman , Paul Mackerras , Peter Zijlstra , Thomas Gleixner , Thomas Zimmermann , Vasily Gorbik , Will Deacon References: From: Christian Borntraeger Message-ID: Date: Thu, 9 Sep 2021 09:32:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ATlUatR2fktJOCdB0-ilt1wN9YQ-r2R0 X-Proofpoint-GUID: a02k0fbptsJli4-DdflCFM6FxaRwtywJ Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-09_02:2021-09-07,2021-09-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 clxscore=1011 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109090041 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 09.09.21 00:58, Tom Lendacky wrote: > This patch series provides a generic helper function, cc_platform_has(), > to replace the sme_active(), sev_active(), sev_es_active() and > mem_encrypt_active() functions. > > It is expected that as new confidential computing technologies are > added to the kernel, they can all be covered by a single function call > instead of a collection of specific function calls all called from the > same locations. > > The powerpc and s390 patches have been compile tested only. Can the > folks copied on this series verify that nothing breaks for them. Is there a tree somewhere? Also, > a new file, arch/powerpc/platforms/pseries/cc_platform.c, has been > created for powerpc to hold the out of line function. > > Cc: Andi Kleen > Cc: Andy Lutomirski > Cc: Ard Biesheuvel > Cc: Baoquan He > Cc: Benjamin Herrenschmidt > Cc: Borislav Petkov > Cc: Christian Borntraeger > Cc: Daniel Vetter > Cc: Dave Hansen > Cc: Dave Young > Cc: David Airlie > Cc: Heiko Carstens > Cc: Ingo Molnar > Cc: Joerg Roedel > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Michael Ellerman > Cc: Paul Mackerras > Cc: Peter Zijlstra > Cc: Thomas Gleixner > Cc: Thomas Zimmermann > Cc: Vasily Gorbik > Cc: VMware Graphics > Cc: Will Deacon > Cc: Christoph Hellwig > > --- > > Patches based on: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > 4b93c544e90e ("thunderbolt: test: split up test cases in tb_test_credit_alloc_all") > > Changes since v2: > - Changed the name from prot_guest_has() to cc_platform_has() > - Took the cc_platform_has() function out of line. Created two new files, > cc_platform.c, in both x86 and ppc to implment the function. As a > result, also changed the attribute defines into enums. > - Removed any received Reviewed-by's and Acked-by's given changes in this > version. > - Added removal of new instances of mem_encrypt_active() usage in powerpc > arch. > - Based on latest Linux tree to pick up powerpc changes related to the > mem_encrypt_active() function. > > Changes since v1: > - Moved some arch ioremap functions within #ifdef CONFIG_AMD_MEM_ENCRYPT > in prep for use of prot_guest_has() by TDX. > - Added type includes to the the protected_guest.h header file to prevent > build errors outside of x86. > - Made amd_prot_guest_has() EXPORT_SYMBOL_GPL > - Used amd_prot_guest_has() in place of checking sme_me_mask in the > arch/x86/mm/mem_encrypt.c file. > > Tom Lendacky (8): > x86/ioremap: Selectively build arch override encryption functions > mm: Introduce a function to check for confidential computing features > x86/sev: Add an x86 version of cc_platform_has() > powerpc/pseries/svm: Add a powerpc version of cc_platform_has() > x86/sme: Replace occurrences of sme_active() with cc_platform_has() > x86/sev: Replace occurrences of sev_active() with cc_platform_has() > x86/sev: Replace occurrences of sev_es_active() with cc_platform_has() > treewide: Replace the use of mem_encrypt_active() with > cc_platform_has() > > arch/Kconfig | 3 + > arch/powerpc/include/asm/mem_encrypt.h | 5 -- > arch/powerpc/platforms/pseries/Kconfig | 1 + > arch/powerpc/platforms/pseries/Makefile | 2 + > arch/powerpc/platforms/pseries/cc_platform.c | 26 ++++++ > arch/powerpc/platforms/pseries/svm.c | 5 +- > arch/s390/include/asm/mem_encrypt.h | 2 - > arch/x86/Kconfig | 1 + > arch/x86/include/asm/io.h | 8 ++ > arch/x86/include/asm/kexec.h | 2 +- > arch/x86/include/asm/mem_encrypt.h | 14 +--- > arch/x86/kernel/Makefile | 3 + > arch/x86/kernel/cc_platform.c | 21 +++++ > arch/x86/kernel/crash_dump_64.c | 4 +- > arch/x86/kernel/head64.c | 4 +- > arch/x86/kernel/kvm.c | 3 +- > arch/x86/kernel/kvmclock.c | 4 +- > arch/x86/kernel/machine_kexec_64.c | 19 +++-- > arch/x86/kernel/pci-swiotlb.c | 9 +- > arch/x86/kernel/relocate_kernel_64.S | 2 +- > arch/x86/kernel/sev.c | 6 +- > arch/x86/kvm/svm/svm.c | 3 +- > arch/x86/mm/ioremap.c | 18 ++-- > arch/x86/mm/mem_encrypt.c | 57 +++++++------ > arch/x86/mm/mem_encrypt_identity.c | 3 +- > arch/x86/mm/pat/set_memory.c | 3 +- > arch/x86/platform/efi/efi_64.c | 9 +- > arch/x86/realmode/init.c | 8 +- > 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/init.c | 7 +- > drivers/iommu/amd/iommu.c | 3 +- > drivers/iommu/amd/iommu_v2.c | 3 +- > drivers/iommu/iommu.c | 3 +- > fs/proc/vmcore.c | 6 +- > include/linux/cc_platform.h | 88 ++++++++++++++++++++ > include/linux/mem_encrypt.h | 4 - > kernel/dma/swiotlb.c | 4 +- > 40 files changed, 267 insertions(+), 114 deletions(-) > create mode 100644 arch/powerpc/platforms/pseries/cc_platform.c > create mode 100644 arch/x86/kernel/cc_platform.c > create mode 100644 include/linux/cc_platform.h > > > base-commit: 4b93c544e90e2b28326182d31ee008eb80e02074 >