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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 A933AC433EF for ; Thu, 9 Sep 2021 13:36:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FC72611F0 for ; Thu, 9 Sep 2021 13:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354503AbhIINhb (ORCPT ); Thu, 9 Sep 2021 09:37:31 -0400 Received: from 8bytes.org ([81.169.241.247]:53392 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351087AbhIINeD (ORCPT ); Thu, 9 Sep 2021 09:34:03 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 0D39DD35; Thu, 9 Sep 2021 15:32:50 +0200 (CEST) Date: Thu, 9 Sep 2021 15:32:21 +0200 From: Joerg Roedel To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Brijesh Singh , Tom Lendacky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, Joerg Roedel Subject: Re: [PATCH v2 1/4] KVM: SVM: Get rid of *ghcb_msr_bits() functions Message-ID: References: <20210722115245.16084-1-joro@8bytes.org> <20210722115245.16084-2-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Sep 01, 2021 at 09:12:10PM +0000, Sean Christopherson wrote: > On Thu, Jul 22, 2021, Joerg Roedel wrote: > > case GHCB_MSR_TERM_REQ: { > > u64 reason_set, reason_code; > > > > - reason_set = get_ghcb_msr_bits(svm, > > - GHCB_MSR_TERM_REASON_SET_MASK, > > - GHCB_MSR_TERM_REASON_SET_POS); > > - reason_code = get_ghcb_msr_bits(svm, > > - GHCB_MSR_TERM_REASON_MASK, > > - GHCB_MSR_TERM_REASON_POS); > > + reason_set = GHCB_MSR_TERM_REASON_SET(control->ghcb_gpa); > > + reason_code = GHCB_MSR_TERM_REASON(control->ghcb_gpa); > > + > > pr_info("SEV-ES guest requested termination: %#llx:%#llx\n", > > reason_set, reason_code); > > + > > fallthrough; > > Not related to this patch, but why use fallthrough and more importantly, why is > this an -EINVAL return? Why wouldn't KVM forward the request to userspace instead > of returning an opaque -EINVAL? I guess it is to signal an error condition up the call-chain to get the guest terminated, like requested. Regards, Joerg