From patchwork Thu Oct 19 06:20:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 155327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp190135vqb; Wed, 18 Oct 2023 23:22:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmBXN37pgp6aroOWbV9qFRxHO2G0YgsNV+vGT13bL4rFN7AYY2bZZ4DhJ8G59D2vtUWn/m X-Received: by 2002:a25:247:0:b0:d74:62df:e802 with SMTP id 68-20020a250247000000b00d7462dfe802mr1320854ybc.0.1697696541163; Wed, 18 Oct 2023 23:22:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697696541; cv=pass; d=google.com; s=arc-20160816; b=dvZGKay1d07IEF9WBjoif66LABsgHIrhIi6kKtZzuLYdPfHVIDorjvODqIbWl9XxMH W/wcCeUVqbPVkfi67G/peuIEujziR6MDbEWIdLtiIks5Z919WvYcnfsYiCcb3+bSG2NO pP7TX/X6hspYKkR666VdTihb4Fpvy/c4ch+G8tM9NFpDLlHys+Ee1aH5+xGFii2nmjyJ 0VuedCq6awmwXJYsGYSTIxOc69unKKD0Z2CopIys7BHTVYel8zF/ewCgPkERyXr7pirV +vLVrNqDrPwvgSOyBZVXm0cwKtPYItrv38HEmOQFhuw8CW0Plu5k93tPno+jkDk/gkwZ LouQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=FpzY42v5Gx1+WSR8S0vCPRCDKHw2V2lwiJ+WjgqhPnw=; fh=v8PEMm602hAKiwwsPF5/8wW3Dx37QxWUZ1L8Ra0amA4=; b=OIdLXgikAd7pZajfEwq/ndwiK/6Wb3it2o4BKfJc2ShwIvJ176m+m7u/YE5m3tqzHi m/YBN2AYY7QN6bl8Uvmrz2SgHwillydIFhF2zjuRDR1mIU7aKhzbmnGJyUaUq25UrEZn Wamc9AGrtNjctgGJND9bDUs+t1fN2TdZ3mqXC2ahZMLO4k6GcYH9v19FsaofnDo32Ozj NPt8cmJqr6ma3epZHD3oN3g/V04oACT8RaFVuQ17Opu+eOFTsAspeboUW1qziHWgpbXX fVZfx1o8/ZGi8Q7BGzIMvVNWM0XH/9piNYTMEkSw+6BaX/zsbbruNb8iaZ7pxclCTfwn W+Tg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=hMyh9KIs; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g17-20020aa796b1000000b006b7b42fe43asi5281501pfk.185.2023.10.18.23.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 23:22:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=hMyh9KIs; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E8366810AF72; Wed, 18 Oct 2023 23:22:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbjJSGVq (ORCPT + 24 others); Thu, 19 Oct 2023 02:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjJSGVo (ORCPT ); Thu, 19 Oct 2023 02:21:44 -0400 Received: from DM5PR00CU002.outbound.protection.outlook.com (mail-centralusazon11021023.outbound.protection.outlook.com [52.101.62.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0400BE; Wed, 18 Oct 2023 23:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nQRxoSVuoImzcCwcMByn/+lNnMYKmDFNImBotiCN4PNpYrXtjRmYrxG0pIW1qQt9e+rONjjWxbpWYfcqCcV//bUYzmxTjFBlefn2lmbsHyNYs+ysBJ/2A14su9UGeWYjaItQbdfDNBwyG1hcSbaAKzClEgfpl3rVgjVNSVoNMKz6752Gz2p6455nWEBa8udXP2Y/ifX3ajxBtcZZMQ36edLDt9wqWy6DU+GYff1TwC+CjBtH1zRiFGxU42PwuisBLxCLwlqfCqPq6qSjLVOyqL1BAiuEyWDyw9j0VJdsSeDU3Y9EVaoSa6iTfehzoFQz7oJsl7+sqWxGWDg/s1lUTw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FpzY42v5Gx1+WSR8S0vCPRCDKHw2V2lwiJ+WjgqhPnw=; b=iRSVH3LR8oQPTLUeStCX15QTNcstCoOC5fAQhNwEoN2d8CjWjpPPCdQIAS47975kNOPPMFd8C15nJjj7N7kf79RhtQA35YJMMnLOj9dEasZKQ0n+nb6PFD5443kds1+9B8BABOuDKU9j4y7/u9XNu529CkTi6j9551Lj3/Fbs6Hja/OF3aY9kq/Z7w+j4kab8OFHhdDPQNXdiJnVWz+QNji9kp+GFh/D12rSqH55R6kDqmXKJSeUPq15gJ1xy2ZupGKas4KrVWMGMJQF3DbMPL7S4eeMQYKGkXQkXvCprrrW1+vpv9QnEzI89OOC3P+25FFlCg5k9UTcPCmKhSMzzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FpzY42v5Gx1+WSR8S0vCPRCDKHw2V2lwiJ+WjgqhPnw=; b=hMyh9KIs3mGi7Sd5fVKnYACob08HfWZifbt9UY8QFBDs/XoGvH+fcCjwwGwyiITjP/2WQroPkH5+bxjW8XHEIRFCoIZNqXgRkzf4xmvWg8dDxCDHhA/zXJ3QVj9jGd6C6hMWLpsW2T1yAxFVDGJ9oQE9TuAQdZ8Asy5A50fTO6g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from SA3PR21MB3915.namprd21.prod.outlook.com (2603:10b6:806:300::22) by PH7PR21MB3118.namprd21.prod.outlook.com (2603:10b6:510:1d2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.4; Thu, 19 Oct 2023 06:21:39 +0000 Received: from SA3PR21MB3915.namprd21.prod.outlook.com ([fe80::f02:b965:d44e:40d]) by SA3PR21MB3915.namprd21.prod.outlook.com ([fe80::f02:b965:d44e:40d%6]) with mapi id 15.20.6933.003; Thu, 19 Oct 2023 06:21:39 +0000 From: Dexuan Cui To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, stefan.bader@canonical.com, tim.gardner@canonical.com, roxana.nicolescu@canonical.com, cascardo@canonical.com, mikelley@microsoft.com, jgross@suse.com, sathyanarayanan.kuppuswamy@linux.intel.com, kirill.shutemov@linux.intel.com, sashal@kernel.org, matija.glavinic-pecotic.ext@nokia.com, linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dexuan Cui Subject: [PATCH] x86/mm: Print the encryption features correctly when a paravisor is present Date: Wed, 18 Oct 2023 23:20:30 -0700 Message-Id: <20231019062030.3206-1-decui@microsoft.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: MW4PR03CA0099.namprd03.prod.outlook.com (2603:10b6:303:b7::14) To SA3PR21MB3915.namprd21.prod.outlook.com (2603:10b6:806:300::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA3PR21MB3915:EE_|PH7PR21MB3118:EE_ X-MS-Office365-Filtering-Correlation-Id: 09bfb691-0717-4ec6-22ec-08dbd06ba73b X-LD-Processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XoDJSNrIzBEFcDv9m8MoseEmr0xL067uj/l3pvLZWUfeniHUSQp2kxYtc60Yc5Uo/9AWP40WN/q19UJ9gFt1KOF8Z+TcBFjN/OaCbOfiOSQsD/7X9pt7LoxzhP1RY0qGqESjOHoI8ZbzJHq6Kt5DvZDfiqWYcsFHVtxwf4H/QeyLQJCbCG/7zZ4C7Gtm0O5/r9YVyE4IGpvoD87dkq/6b4zzNt3Q0Avttrzw8cPAyD1zFV3aUZ47894PmwbHCvppWKapFRg9uoO1CvrGufQREpRmWY9FBgQMXFU/lEGRrnAlNyc28359wTowUGade4Zd8Mt1EDg8+VKkhFgYLolLSpZOANHDVTHppIGCZ0qVHHFdA8Iq19l4cYL5IlKRBjN4NAmdtwFAMjjLriiAqO1zB4SsuXuzdM6Ed+GGtWT0RtS3JWhl7vV9CcbeMucw/VBnHl3UVc4BMvxPAQVSAaBtfkDCMs7vYob9nMQDYCfWXSEKZ0xVHREvp0ToiUHYGBcVn07IZxn3hMu2jYfFgiORqPfclFnAmEDp7DoAJBLvhFUocAZt0+7NOH6gD5quUcuu9ec6wIjSf40wu7Ik5YzRrZLdhy+l/Sk4UaAyP5HQ4Z1+uFhmmsDX9UMITQywkETMnZBhyTaTIxFr5xtLdjEHmw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA3PR21MB3915.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(39860400002)(396003)(136003)(346002)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(1700900044)(7416002)(6506007)(52116002)(2906002)(6666004)(10290500003)(6486002)(478600001)(4326008)(8676002)(5660300002)(8936002)(66556008)(316002)(66946007)(66476007)(41300700001)(36756003)(83380400001)(82950400001)(82960400001)(921005)(107886003)(2616005)(6512007)(86362001)(38100700002)(1076003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B9+DS0QLttk3OjBKgWMlO8gTh66WcYePKRq/H2lrslMRWI04zq4339IhbJsOY12jmf86hTPXpC/GinCh/3l+UshOlfWgxWiN/OM7CneCfIivNlbYv7M2qXXCXuPXzjMN1rbiSp0mP58ofETRkNNeUzvyowaqGpQpRQM5XJa156R3DOTGGoAt6pMzQ9QsdXJ2x0DwZw9wPKMTWDrFTl3LVTge+VtFISXF9OvSIdTJObdrNDqTVa927bvjjZrt/91e2eJLLLWcbrH7N+P54qSW/Qo8S3EVVDkyavHj9FKtnrzSxGmTFt7Dhp0xaUAKiddi8KIWoMiULKxOHoWnmGK93dEYFJAF95DbMrWIL8rPunvppeKpW/Bm5NCaE26Xy3Hv9GZ5Ttsg/PoVWnQXVuFs8V4H9QOup8dhwKevR0HfXcmChB3PknxRiEnTgl5ld44CSib/VqBCO2UXR7TXmw0Eiiq30YxygeIaPZI1ukIxfKiYQUHGj0e5iX5R7nicJMqvP/zDsLCa8jzOChHkfPOs/8pfYpMcMGTxgY9TzZI2tFac2xu7V5uaP/n24zLnFufxPs+ZxofmeM00pNVafx1/pw0EYwqOoa2yFd7IxmjqiEsfM4XwJh/ROd5Q7i8y4t4G7+Ys6OX1BZmVCCaoX61Xua9IQ0GDWvVZF6ssxePhqB2UE3wOzNh0QT62aOmdS5bdrxxN05Guycx2bX6sPVFuRIUob6b//mXStY1YYCjY96DBSrjRg943olTVTpP/XOGI8eyfXMKKV5x6juqjFqphTGxGz7iyDVzy4hUZ75WbpAfAQaYOwdcSLJmrPznrEBLGGOoyFJuhAA/bnGHaoVOR4wt1pho/PhKPJ0pSRqRJZI2Zi1I4dL5LGXfnJDT+VO2pGX7llD7BAMUsWI2bCOs0WXCMyOxIOJbpLpQjw5RH/aJ8vtQjrYl6foQv0JZBbW3ONLDzL+Z+b6tAdwCB2ynVBPmHkpn7OC2bRdvVfaCpFw2KGN9O7LFvQDe8/2zrIT6hYleFP2QUv/JfjVzYpM6eoyo5nIzoqVZEKZwVKIz3c1sDMscxnkQY8Uw2ktfhv61V3trByfyrRfQWNjKlzxbgfjuJIzY+UsNHGYpEWCO6qf+N2d3DS//a4FDbwAEf4sE33SOsCmjPuwRaftxrynyrP3IQhq+89VtGvYqe5Y+djXtZ4FuK7yntp223jw1WTHXogWgzYRkaIYoz/oHN+mgIMpCh+6x/Kvc/u7ZtWDLXQJcvdMmvkuqypXlgYL5H8NPvNVXym2NmKut8thh9/HkmTcecyJHLAzfGnflbT0nvRue3+CbB9H0Lj0HPdwafsQId9lhvdqexMkuYdluZVVBOHIXW0wnSO1SwA9gp4zOvZah9vzXJFLikCg4Ln9CVttwyEmceeMdKG4pMM4aNxZfFBhUlCObmtntXoevXHsroa2XIqm8sITteuv6gux9jGlzunRxBaYHDXd40cYEmcZyGa6WCk1MD5dqeF41FttWwfHst78UgHXGeutdSMvVQZ8JcMqaUhcD9MichnDlnykunM0Ux8vyax/l7KjscxiKgmRl67ex103m9jJHHnhkkXEDdQu9ZJmipD5RJbn4TT2VBJOBmTuUo3MjsoDFkLv8zB8KR1wOIJ9d/5rpJZ+7tH6k6 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09bfb691-0717-4ec6-22ec-08dbd06ba73b X-MS-Exchange-CrossTenant-AuthSource: SA3PR21MB3915.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 06:21:39.3851 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lPjYe38Wh8AhxCrjwA7VOUo5AWYf6J8qkH6ymGpYZO/yF4dN6u63kkfK+3Ij7TUQE1Lo5bhMohHq5ezZLFj5Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR21MB3118 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 23:22:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780163848297312617 X-GMAIL-MSGID: 1780163848297312617 Hyper-V provides two modes for running a TDX/SNP VM: 1) In TD Partitioning mode (TDX) or vTOM mode (SNP) with a paravisor; 2) In "fully enlightened" mode with the normal TDX shared bit or SNP C-bit control over page encryption, and no paravisor. In the first mode (i.e. paravisor mode), the native TDX/SNP CPUID capability is hidden from the VM, but cc_platform_has(CC_ATTR_MEM_ENCRYPT) and cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) are true; as a result, mem_encrypt_init() incorrectly prints the below message when an Intel TDX VM with a paravisor runs on Hyper-V: "Memory Encryption Features active: AMD SEV". Introduce x86_platform.print_mem_enc_feature_info and allow hv_vtom_init() to override the function pointer so that the correct message is printed. BTW, when a VBS (Virtualization-based Security) VM running on Hyper-V (the physical CPU can be an AMD CPU or an Intel CPU), the VM's memory is not encrypted, but mem_encrypt_init() also prints the same incorrect message. The introduction of x86_platform.print_mem_enc_feature_info can also fix the issue. Signed-off-by: Dexuan Cui --- Some open questions: 1. Should we refactor the existing print_memory_encrypt_feature_info() into a TDX-specific function and an SEV-specific function? The function pointer in x86_platform_ops would be initialized to a no-op function, and then early_tdx_init(), sme_enable() and hv_vtom_init() would fill it in accordingly. 2. Should we rename "print_mem_enc_feature_info()" to "print_coco_feature_info()"? CC_ATTR_GUEST_STATE_ENCRYPT (and CC_ATTR_GUEST_SEV_SNP?) may not look like *memory* encryption to me? arch/x86/hyperv/ivm.c | 11 +++++++++++ arch/x86/include/asm/mem_encrypt.h | 1 + arch/x86/include/asm/x86_init.h | 2 ++ arch/x86/kernel/x86_init.c | 1 + arch/x86/mm/mem_encrypt.c | 4 ++-- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index e68051eba25a..fdc2fab0415e 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -450,6 +450,16 @@ static bool hv_is_private_mmio(u64 addr) return false; } +static void hv_print_mem_enc_feature_info(void) +{ + enum hv_isolation_type type = hv_get_isolation_type(); + + if (type == HV_ISOLATION_TYPE_SNP) + pr_info("Memory Encryption Features active: AMD SEV\n"); + else if (type == HV_ISOLATION_TYPE_TDX) + pr_info("Memory Encryption Features active: Intel TDX\n"); +} + void __init hv_vtom_init(void) { enum hv_isolation_type type = hv_get_isolation_type(); @@ -479,6 +489,7 @@ void __init hv_vtom_init(void) cc_set_mask(ms_hyperv.shared_gpa_boundary); physical_mask &= ms_hyperv.shared_gpa_boundary - 1; + x86_platform.print_mem_enc_feature_info = hv_print_mem_enc_feature_info; x86_platform.hyper.is_private_mmio = hv_is_private_mmio; x86_platform.guest.enc_cache_flush_required = hv_vtom_cache_flush_required; x86_platform.guest.enc_tlb_flush_required = hv_vtom_tlb_flush_required; diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h index 7f97a8a97e24..6e8050a9138e 100644 --- a/arch/x86/include/asm/mem_encrypt.h +++ b/arch/x86/include/asm/mem_encrypt.h @@ -19,6 +19,7 @@ #ifdef CONFIG_X86_MEM_ENCRYPT void __init mem_encrypt_init(void); +void print_mem_encrypt_feature_info(void); #else static inline void mem_encrypt_init(void) { } #endif diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 14b0562c1d8b..7798174d4b8d 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -291,6 +291,7 @@ struct x86_hyper_runtime { * semantics. * @realmode_reserve: reserve memory for realmode trampoline * @realmode_init: initialize realmode trampoline + * @print_mem_enc_feature_info: print the supported memory encryption features * @hyper: x86 hypervisor specific runtime callbacks */ struct x86_platform_ops { @@ -309,6 +310,7 @@ struct x86_platform_ops { void (*set_legacy_features)(void); void (*realmode_reserve)(void); void (*realmode_init)(void); + void (*print_mem_enc_feature_info)(void); struct x86_hyper_runtime hyper; struct x86_guest guest; }; diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 6117662ae4e6..ccb53db1b51e 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c @@ -149,6 +149,7 @@ struct x86_platform_ops x86_platform __ro_after_init = { .restore_sched_clock_state = tsc_restore_sched_clock_state, .realmode_reserve = reserve_real_mode, .realmode_init = init_real_mode, + .print_mem_enc_feature_info = print_mem_encrypt_feature_info, .hyper.pin_vcpu = x86_op_int_noop, .hyper.is_private_mmio = is_private_mmio_noop, diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c index 9f27e14e185f..8d37048bc1df 100644 --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -39,7 +39,7 @@ bool force_dma_unencrypted(struct device *dev) return false; } -static void print_mem_encrypt_feature_info(void) +void print_mem_encrypt_feature_info(void) { pr_info("Memory Encryption Features active:"); @@ -84,5 +84,5 @@ void __init mem_encrypt_init(void) /* Call into SWIOTLB to update the SWIOTLB DMA buffers */ swiotlb_update_mem_attributes(); - print_mem_encrypt_feature_info(); + x86_platform.print_mem_enc_feature_info(); }