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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3358DC43458 for ; Wed, 1 Jul 2026 05:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Rrxw0zEy8zZMWEqkMIDa1FzZShUbfKRclWdKlq0ShMQ=; b=zPGqd0LqIyv0w7RdieESUMUBat T1ulhuPOQeGi/teLpc2ZVW5BWEXxJKRcJ7FAqcMK1d9LrRAr8/xZyals2a5OqvHJVO4hEkmBxTm5o I4ltmqit4dgfXEh7lwHF6MRNLxMzKUm59CCuabtiy6kc+zKGb4HFn6AKgVxQWYOwJb0QtyaRDGyuo IDzoGnRRd1AYUgWT7S+XybU9kMV45+fA2ZpcYI2B2WAREevBUDy8x1/QnVucgg9IQxNbPxy7Liq+Y DTfuLyiLZVj4VVwkdHI5fD/o+iCDaWTk8Ws68Q+qGBoUs2UusWVcJU1sBGgYVxxQytPjGtW1FJs6u tONq72jA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wenqW-00000000iH4-1Aet; Wed, 01 Jul 2026 05:50:52 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wenqU-00000000iFz-3P1D for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2026 05:50:50 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8E88E43DCE; Wed, 1 Jul 2026 05:50:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B406B1F00A3A; Wed, 1 Jul 2026 05:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782885050; bh=Rrxw0zEy8zZMWEqkMIDa1FzZShUbfKRclWdKlq0ShMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LAVOzFxKcoBDvcIA/cL8+8v7XY/9P5ba4CrqnsrbqlhfEZ5g4MK5OQ74GAghLavvj o+JLad1Wg9OinqXokjs/3hytR6AywooUcXw+wjcaN/F5Np2i2Yy+gvQI+kaGBm3VRK l/W42WUmQzsFbFYjHOJrYnQO9q33t4cB9Cl+BcgwhN05+UwImbPdZZkdY7FTk0gNXF FVAC/vZRvHTO3Dp+mcbdGNZrgKugW5uEdQ7bVByHuY2QanpiPo3CjFP1m/h98/9Q0i 1IiXs7eRvC4AhfagR2rw6tY1gFdou4tKw+G+PtNggm5tV9wna0xvQxKWFmudBnp/gW 1Rx06Eda1YzDw== From: "Aneesh Kumar K.V (Arm)" To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev Cc: "Aneesh Kumar K.V (Arm)" , Robin Murphy , Marek Szyprowski , Will Deacon , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Jason Gunthorpe , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org, Halil Pasic , Matthew Rosato , Jaehoon Kim Subject: [PATCH v7 06/22] s390: Expose protected virtualization through cc_platform_has() Date: Wed, 1 Jul 2026 11:19:10 +0530 Message-ID: <20260701054926.825925-7-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260701054926.825925-1-aneesh.kumar@kernel.org> References: <20260701054926.825925-1-aneesh.kumar@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Protected virtualization guests use memory encryption, so advertise that to the rest of the kernel through cc_platform_has(CC_ATTR_MEM_ENCRYPT). s390 already forces DMA mappings to be unencrypted for protected virtualization guests through force_dma_unencrypted(). Add ARCH_HAS_CC_PLATFORM and provide the matching cc_platform_has() implementation Cc: Halil Pasic Cc: Matthew Rosato Cc: Jaehoon Kim Tested-by: Jaehoon Kim Signed-off-by: Aneesh Kumar K.V (Arm) --- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 84404e6778d5..ab1bf55d197a 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -84,6 +84,7 @@ config S390 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_CC_CAN_LINK + select ARCH_HAS_CC_PLATFORM select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index f07168a0d3dd..c29326c44af0 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -50,6 +50,7 @@ #include #include #include +#include pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(".bss..swapper_pg_dir"); pgd_t invalid_pg_dir[PTRS_PER_PGD] __section(".bss..invalid_pg_dir"); @@ -142,6 +143,19 @@ bool force_dma_unencrypted(struct device *dev) return is_prot_virt_guest(); } + +bool cc_platform_has(enum cc_attr attr) +{ + switch (attr) { + case CC_ATTR_MEM_ENCRYPT: + return is_prot_virt_guest(); + + default: + return false; + } +} +EXPORT_SYMBOL_GPL(cc_platform_has); + /* protected virtualization */ static void __init pv_init(void) { -- 2.43.0