From patchwork Wed Jul 5 18:12:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 116282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2052788vqx; Wed, 5 Jul 2023 11:19:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+gjKJ77HJWotHaCOtBLOk43RpKcTcbvnNLRDpLUy06R4rSazaS+z9ugfYpJMaCyA941Bv X-Received: by 2002:a17:902:e5c5:b0:1b8:1b84:93e5 with SMTP id u5-20020a170902e5c500b001b81b8493e5mr15857270plf.1.1688581187856; Wed, 05 Jul 2023 11:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688581187; cv=none; d=google.com; s=arc-20160816; b=u2WVGd3DQBnEvIjsdXATvQgFgoZZsln5tkIO48XdwlLYGC1VrNOQovmhw1m7nMBjP0 h6281x9XGql/g/j+FszJMP4xaWFKko6QKLPTU8UBCQnjgNYICGo1erEfF4Gk1heFeN9q gxZmFRl9Q/le+PX6zS5Xn3BDIyUxTPUxPj9mOwnM3K3M9H5gT55CEmBcK3fLWPgWokzI uc+/XSPqEnxAtxLZCQ98R//5VqYlvTgHCGhCZ1FTrPTeCz8GiZ8ijQg0qPRz1hm3K1wx te5hxqOiwfa56ULtiOI2M8rJfZ1/jw026vVTJXlyM4kO5lbASbxbZFaz38bm9CSzoQq6 ZVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QCdKg/xbfvFvfuEOm23BNeuog3oDcFdsQXIARij7I9Y=; fh=dVCMRuKhK2aqTEuWethYlqkP4G2sINJQEE+rq5xoO1c=; b=I+5wcmJAd5eLks/s/vv1P+NVv9ttj0SzkgEsUKs49A397ckLgRcq+ejqVytxTt5WCK TMGHQvEj4pi8DkUodfCg4kbqDANvvInw3gh0Ijfk17V5ekxpvIYY51qv6czwdYN97IHr OsBBI2svE+WA4AX6jvUU2IqIPYwX0AelZZXr8V/Gis2iIc+897uNNq+Bt5OihQmZaw9n 6BdLi0gA1nqswULBdjaOJhOaTOehI5Z+pyO2p9kixOW5zQoYpXlyf9IpeTPcpp62030W m4H/FsLHg9+r9j+wJ/dDlsBHSI9JP2TEu2zTP1RSOR+E8Afq7qnAI2xbDlQQPQlQnK/c YHjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="K9s9wXO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a170902d90200b001b86c54d963si11894643plz.543.2023.07.05.11.19.34; Wed, 05 Jul 2023 11:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="K9s9wXO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233467AbjGESSS (ORCPT + 99 others); Wed, 5 Jul 2023 14:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233466AbjGESSJ (ORCPT ); Wed, 5 Jul 2023 14:18:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19FFD1735 for ; Wed, 5 Jul 2023 11:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688581022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QCdKg/xbfvFvfuEOm23BNeuog3oDcFdsQXIARij7I9Y=; b=K9s9wXO/tpOk9RQuuO9ysZ+jlgrY6U7yt0MSwxSqQn7qvWBCxEMZkeBmZX89iA63PnUDMJ X0phXmReSW0CyjOZrgj/hAs7pyjkMihQN2aCn/scj9LV/ZCMal2q7Lyi3Pq627YlhrtvxD y1M9DbF08tSL/vVRMuVFENFsyVB53q8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-UhoNqooBN1GAazRibK82Gg-1; Wed, 05 Jul 2023 14:16:59 -0400 X-MC-Unique: UhoNqooBN1GAazRibK82Gg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E89FD3C108C9; Wed, 5 Jul 2023 18:16:57 +0000 (UTC) Received: from vschneid.remote.csb (unknown [10.42.28.164]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7BEE18EB4; Wed, 5 Jul 2023 18:16:52 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Josh Poimboeuf , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: [RFC PATCH 10/14] x86/sev-es: Make sev_es_enable_key __ro_after_init Date: Wed, 5 Jul 2023 19:12:52 +0100 Message-Id: <20230705181256.3539027-11-vschneid@redhat.com> In-Reply-To: <20230705181256.3539027-1-vschneid@redhat.com> References: <20230705181256.3539027-1-vschneid@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770605707727619828?= X-GMAIL-MSGID: =?utf-8?q?1770605707727619828?= objtool now warns about it: vmlinux.o: warning: objtool: exc_nmi+0xbf: Non __ro_after_init static key "sev_es_enable_key" in .noinstr section vmlinux.o: warning: objtool: exc_nmi+0x4d: Non __ro_after_init static key "sev_es_enable_key" in .noinstr section vmlinux.o: warning: objtool: exc_nmi+0xc: Non __ro_after_init static key "sev_es_enable_key" in .noinstr section The key can only be enabled (and not disabled) in the __init function sev_es_init_vc_handling(), so mark it as __ro_after_init. Signed-off-by: Valentin Schneider --- arch/x86/kernel/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index b031244d6d2df..4178e18383232 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -113,7 +113,7 @@ struct ghcb_state { }; static DEFINE_PER_CPU(struct sev_es_runtime_data*, runtime_data); -DEFINE_STATIC_KEY_FALSE(sev_es_enable_key); +DEFINE_STATIC_KEY_FALSE_RO(sev_es_enable_key); static DEFINE_PER_CPU(struct sev_es_save_area *, sev_vmsa);