Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp700252rwb; Thu, 12 Jan 2023 11:06:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtTb91LPZ5s5zvsgMR2y5Gh1c47kzaUrQGF/MrQn9oCvhgDsNmZtHkNVrjIBIYaChktJjQJ X-Received: by 2002:a17:907:216a:b0:84d:4b71:4ed3 with SMTP id rl10-20020a170907216a00b0084d4b714ed3mr448650ejb.66.1673550394323; Thu, 12 Jan 2023 11:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673550394; cv=none; d=google.com; s=arc-20160816; b=vV+KZDnM+6EczMby8F8+ff5fMBB6AJzpjU9+SRUDJSRL7QHZOm7SyyIUEh4GPTZP7E v0axcdw7UD3aD6oos4bUJ7Cxp4g+cjNqJ+uYuBST3GveVFbZ79h2DATjN/8rQ0DPplIr KKXsNJt3tD2WfMqTgZnVnFYwvvHPy4YRnZHMNZ/9D+WEBOCk5FIhtgvi1ZR/MS1sUYJU jbXHDnraCKQiKR6S46edyts6aWPleG+1oBzAtPtMAArwEuXmo6+l1Wfw1Zv41TXBff9i uuGP+h3qIGPQ3EU3U8qgXwOcV1Zd686E1WQjB5Eem1lgpGRT0eTIs8bjEkgukfaKVZl4 KeCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wdJjNMR8HoaXn9/oJmxLSyIdwmRRw8E6OKveZFE7S0o=; b=HK5qKAvq04ohM1O717bIQyups0S81PPzGtAxTUdONVTzdEE//EtUa2ylvaB78wJ0uw nNVCuzlugNs2CgdTnyggbxU4RGDzuzSvwzCZ6taRkv6kKKyHZa3AiysH4gjL0FpgKPQj ZS/+ZFy30zYH0iyGnjHej9Ls5kxQPupJw3bM/HZr66xnI7lHl2SD88ScVgF3hkND64bM aF64TrJb5HPEPhKTOzo1VbG2l8KJrCCr9eJcpBZ7YA8bjiUyjKJxleeYxnd6Y/R48ClR V7l5mnbf43b6W/p/0x8y4kKAPqhfyyz785KJXWvkdB3Rb5z7lEEssKjgFmJTGB/g2D24 iXhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=oF+dydPO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wg4-20020a17090705c400b007adf3ed5d20si19266932ejb.376.2023.01.12.11.06.22; Thu, 12 Jan 2023 11:06:34 -0800 (PST) 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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=oF+dydPO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232268AbjALSzz (ORCPT + 50 others); Thu, 12 Jan 2023 13:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231660AbjALSzX (ORCPT ); Thu, 12 Jan 2023 13:55:23 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2437F87906 for ; Thu, 12 Jan 2023 10:25:18 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id 200so8255896pfx.7 for ; Thu, 12 Jan 2023 10:25:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wdJjNMR8HoaXn9/oJmxLSyIdwmRRw8E6OKveZFE7S0o=; b=oF+dydPOzLUV6gm4IhZPy0ytIJCP75Hu4akx7+XbCZvo4om5HhS0f6mJ4n/K7276Un amkhxNx8AaLMjji0vPkssaD8xMJ58T2+hwuFVwOWnvCKRDqJo5f887je41pc1p3jd6sS /wALf4JB3cR96/2BEXXlBKLL3rid+e94peWAraxVVF1BrcrbgkHer2gutrf0Sp5py5o0 zV1oZ1GAvU6ICcKFXa7a2KInbBN/lNBmpoX+WkdL9/1ahzxMIXHXLY0UePgT5pTXpN0i tStu6VFSnY6yx6ikuU6Q1oW6/uuCDwnHo+09soFPALkFgJq9UZWDoxmm9nvQ03nG0bpM txtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wdJjNMR8HoaXn9/oJmxLSyIdwmRRw8E6OKveZFE7S0o=; b=kSuBma0yhfB8HtukFYZc8U4LwJspk8bS/EdBd9KazeWqAeKuNJbUaTYRe+wscdA7h8 kWDEodUv56NpLtGGWxh+gh0zi1UCMMReeT7z/Ensf7Imo6QzM7K27jtMc146oXX5LCcL wIMph6IEYyOp049r/i7ZtRrDxGgcAf7hyvfGAjFU3PcXa2/pJOXic8xjaSj9lEnI9Ssj BBNlRgFf5xtawfXsBa//JxcPHu+aBtD0gHA1r+8WQPKu5ryD1V4w+jik2ITR9yUgpwZl KteRkkm3ovMnie3jPDCN5nTmLhuyIaMRJzMqL6ECVn4Xv195sPHVa3H8l6T/PeJ6+rJq YsLQ== X-Gm-Message-State: AFqh2kr+uK8RbKpsb9U5nYn8KTDSQZckkTx/d4OafC+LgfruqhnTFQcC iY5m+vtACGqADM/VWiY9TCxa/PC9SHn0x6grlyk4yA== X-Received: by 2002:a63:d902:0:b0:490:597e:1c0a with SMTP id r2-20020a63d902000000b00490597e1c0amr3600920pgg.309.1673547917553; Thu, 12 Jan 2023 10:25:17 -0800 (PST) MIME-Version: 1.0 References: <20221215170046.2010255-1-atishp@rivosinc.com> <20221215170046.2010255-4-atishp@rivosinc.com> <20230112102839.rsabb2bah5lkkx4e@orel> In-Reply-To: <20230112102839.rsabb2bah5lkkx4e@orel> From: Atish Kumar Patra Date: Thu, 12 Jan 2023 10:25:06 -0800 Message-ID: Subject: Re: [PATCH v2 03/11] RISC-V: KVM: Return correct code for hsm stop function To: Andrew Jones Cc: linux-kernel@vger.kernel.org, Anup Patel , Atish Patra , Guo Ren , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paul Walmsley , Sergey Matyukevich , Eric Lin , Will Deacon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Thu, Jan 12, 2023 at 2:28 AM Andrew Jones wrote: > > On Thu, Dec 15, 2022 at 09:00:38AM -0800, Atish Patra wrote: > > According to the SBI specification, the stop function can only > > return error code SBI_ERR_FAILED. However, currently it returns > > -EINVAL which will be mapped SBI_ERR_INVALID_PARAM. > > I presume the mapping referred to here is kvm_linux_err_map_sbi(). > If so, then -EPERM isn't correct either. That maps to SBI_ERR_DENIED. > The only thing that will ensure we get SBI_ERR_FAILURE (-1) is > anything not handled by the kvm_linux_err_map_sbi switch, as we > need to use the default. > It returns SBI_ERR_FAILURE in the next patch when kvm_linux_err_map_sbi is removed. Maybe I should drop this patch. The next patch does the correct thing anyways. > Thanks, > drew > > > > > Return the appropriate linux error code. > > > > Signed-off-by: Atish Patra > > --- > > arch/riscv/kvm/vcpu_sbi_hsm.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c > > index 2e915ca..0f8d9fe 100644 > > --- a/arch/riscv/kvm/vcpu_sbi_hsm.c > > +++ b/arch/riscv/kvm/vcpu_sbi_hsm.c > > @@ -42,7 +42,7 @@ static int kvm_sbi_hsm_vcpu_start(struct kvm_vcpu *vcpu) > > static int kvm_sbi_hsm_vcpu_stop(struct kvm_vcpu *vcpu) > > { > > if (vcpu->arch.power_off) > > - return -EINVAL; > > + return -EPERM; > > > > kvm_riscv_vcpu_power_off(vcpu); > > > > -- > > 2.25.1 > >