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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579D9CE79AD for ; Wed, 20 Sep 2023 08:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbjITISX (ORCPT ); Wed, 20 Sep 2023 04:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbjITISW (ORCPT ); Wed, 20 Sep 2023 04:18:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B29C4C6; Wed, 20 Sep 2023 01:18:16 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695197895; 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: in-reply-to:in-reply-to:references:references; bh=q8uz0fUswbzg4UfjUJDAWIyPtio4hXNctFhBDoWkw/I=; b=kE/H84Nol6C9LIOlDt6z28xGW+kuawtQTv4FXD6iVW+kmib/dyQry2HI8I77EmhgQxDLZN qEgTzgAv1sc4W8HrHuYKBXOEmd8iy0FrKPG0MFuz1/fda8E0rqXYkyIrrou5ubORAkaYRw p/nmM4quiOpVL9qhS6zLuMV3cIchMR6hkqbICxaE2zL+k7xlPk9j6ykjGGBeLVRZLYxq9d 0yAWuJ54kFHbV4NDCNTZcx3eiPlzoAXMv/tX0K20Ws4eVdY8naRzGbrZMxHDQrwNOmAl0h eNDf8z882Z8cKy1r7YZcGyfp0iUOwDRibsCZp79oHbYnnohNl6oaYDjetCot7g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695197895; 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: in-reply-to:in-reply-to:references:references; bh=q8uz0fUswbzg4UfjUJDAWIyPtio4hXNctFhBDoWkw/I=; b=mIUwG0wXtMRC39Lg+Y7W8a/xQn0/l7mkpzZwYbL3zGlQ4h/qPTWoa7xXLmtN9Dgsu0o4pK pbN9cV12I/qCJfAw== To: "Li, Xin3" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-edac@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "kvm@vger.kernel.org" , "xen-devel@lists.xenproject.org" Cc: "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "Lutomirski, Andy" , "pbonzini@redhat.com" , "Christopherson,, Sean" , "peterz@infradead.org" , "Gross, Jurgen" , "Shankar, Ravi V" , "mhiramat@kernel.org" , "andrew.cooper3@citrix.com" , "jiangshanlai@gmail.com" Subject: RE: [PATCH v10 36/38] x86/fred: Add fred_syscall_init() In-Reply-To: References: <20230914044805.301390-1-xin3.li@intel.com> <20230914044805.301390-37-xin3.li@intel.com> <87v8c6woqo.ffs@tglx> Date: Wed, 20 Sep 2023 10:18:14 +0200 Message-ID: <87h6npuuk9.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Wed, Sep 20 2023 at 04:33, Li, Xin3 wrote: >> > +static inline void fred_syscall_init(void) { >> > + /* >> > + * Per FRED spec 5.0, FRED uses the ring 3 FRED entrypoint for SYSCALL >> > + * and SYSENTER, and ERETU is the only legit instruction to return to >> > + * ring 3, as a result there is _no_ need to setup the SYSCALL and >> > + * SYSENTER MSRs. >> > + * >> > + * Note, both sysexit and sysret cause #UD when FRED is enabled. >> > + */ >> > + wrmsrl(MSR_LSTAR, 0ULL); >> > + wrmsrl_cstar(0ULL); >> >> That write is pointless. See the comment in wrmsrl_cstar(). > > What I heard is that AMD is going to support FRED. > > Both LSTAR and CSTAR have no function when FRED is enabled, so maybe > just do NOT write to them? Right. If AMD needs to clear it then it's trivial enough to add a wrmsrl_cstar(0) to it.