Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp881281rdb; Tue, 19 Sep 2023 13:02:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJFO8UX41R7RmPRUGFykYjg1a321j28vcoBCoH3aRHvMLtuyifxS+HD4jNWNrJojKf/pbK X-Received: by 2002:a05:6a00:b90:b0:690:41a1:9b67 with SMTP id g16-20020a056a000b9000b0069041a19b67mr730836pfj.9.1695153762964; Tue, 19 Sep 2023 13:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695153762; cv=none; d=google.com; s=arc-20160816; b=zPwxI6Px73Y6rmxhB4bRkczeCtmASX8i7/ggBjL33dqRHsntzQHPMBdFzUpHQcbeze RG0izOyWomXOSWUpDNJ5+HUxmlw3vcgfOEKncHPaPJjy2coHL+hi6ajNppeDUmPZQMX8 Jz2vQukHxLTy5YcAEtt0qKLwKCSWFtNa2zMVDodkIGHogJfbt7My1AnHxPY25Xg63pw+ iaj0BzJzns12z8kJoVClsxN6OFwJAc9tR6MHbjO1jvb8b5qcZvtPCaO9FoSwjsKJYKbw JvJMCcgOy4jVjn4fl05v4BUVRtTNmk1BRYiyC2fnDbhpkFGVuKqT4oQzMHgyFf2px6sh OGJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1hy4ZWnzFPz+zDftN8eU6StekSEbNrmtd0J3JOw6fos=; fh=Q5KFsCqdtJ06CcCAgyB8mcohzWvqjFprTxYkwhTQtOU=; b=i/eWa2m3A1FsJt9rtJ2no9TyWISki1b+uNjYpUqlKPgb/iTlX37pLI7LXs3uqNkOy6 DExpsFbY6y7BkUeO2r+z7PpQF3Kq7jOGxpbsH78k2xmnYE/tMvsgPmSQyufLVMzujhAA WoOj3DGgvXjb7aK+ImraGYJ8u2Ywvv0yfnCto4T97W5PFF/7Xolwl7vB/cTn+bMsHiKe elwJd0Dwk9zgMf7KXgkH2w5EfdnFgOhG/23AT7rxuvTUMmsOFin6oeLqP5mL4ET8YZGM IhwPQh8zIy/ZTeq8UUX3eanGkRM3usTklXwh1EQialQdix2qzwNxUf20eJ4sZbScifSJ U2NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=jFX2IY1J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id fp7-20020a056a00608700b0068fce0c7193si10198382pfb.282.2023.09.19.13.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 13:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=jFX2IY1J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0964B80608CE; Tue, 19 Sep 2023 12:00:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbjISTAE (ORCPT + 99 others); Tue, 19 Sep 2023 15:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbjISTAD (ORCPT ); Tue, 19 Sep 2023 15:00:03 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E32A135 for ; Tue, 19 Sep 2023 11:59:56 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bf5bf33bcdso101042661fa.0 for ; Tue, 19 Sep 2023 11:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; t=1695149994; x=1695754794; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1hy4ZWnzFPz+zDftN8eU6StekSEbNrmtd0J3JOw6fos=; b=jFX2IY1JMzFYYliSBWShHdEHBMcUu04mHuaRDIyQ2gyLSVMjr1GhPGy5rWHNyGOFKi GAUr2CpE/HL+Z7ZuNuchZIpgwgsuR0lJJfRfn/9RwKH0sXdctGO6i8pYnef92u5+WUUy 7zfpIPRHBzYO5PJnMSxJmuy1wq3nAGZQShP/Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695149994; x=1695754794; h=content-transfer-encoding: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=1hy4ZWnzFPz+zDftN8eU6StekSEbNrmtd0J3JOw6fos=; b=ALGcbfYlYQPggQ+22AHaCT5VxdRDeQHruF3qH4X8SmDJpTfQfXd0r4A/B3+Rta88AR Y+Hw6Ap7W8nP9lcQayBhSM+UyLHxm7XgnI6njVbLnG//TcXqXatL+2S5ApcXHkkFfJie lIcaCLQX8h5lJUOAZJxwzVyM+NlD9/IlNl7PJuTICPMcYh3voW93TrtYRT+pb+r+WkAt gu6/xH6p/ghG+0ocR6pmg2RptooA0nNrC302tN8CIUmw2YkzWc5vNOc25ViM6rkyxvt6 3HZhqw3CelEQY2m3/WPbOKWWlfR/X0p49TDLnUt8q8B+RrlKDUb8ue6FeSkOaL/nUmre 25bw== X-Gm-Message-State: AOJu0YwacTkSlPYG9JuxR8SnVIY78/89i9Hzuv7qP2ZGtSsN2NBSeEER 5hKxcAFl8eo2ehlj5M98RK9R5lLrzC9OdN0I/s+Q X-Received: by 2002:a19:9111:0:b0:503:ed:8616 with SMTP id t17-20020a199111000000b0050300ed8616mr320596lfd.59.1695149994155; Tue, 19 Sep 2023 11:59:54 -0700 (PDT) MIME-Version: 1.0 References: <20230918180646.1398384-1-apatel@ventanamicro.com> <20230918180646.1398384-3-apatel@ventanamicro.com> In-Reply-To: <20230918180646.1398384-3-apatel@ventanamicro.com> From: Atish Patra Date: Tue, 19 Sep 2023 11:59:42 -0700 Message-ID: Subject: Re: [PATCH 2/4] RISC-V: KVM: Fix riscv_vcpu_get_isa_ext_single() for missing extensions To: Anup Patel Cc: Paolo Bonzini , Shuah Khan , Palmer Dabbelt , Paul Walmsley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 12:00:15 -0700 (PDT) On Mon, Sep 18, 2023 at 11:07=E2=80=AFAM Anup Patel wrote: > > The riscv_vcpu_get_isa_ext_single() should fail with -ENOENT error > when corresponding ISA extension is not available on the host. > > Fixes: e98b1085be79 ("RISC-V: KVM: Factor-out ONE_REG related code to its= own source file") > Signed-off-by: Anup Patel > --- > arch/riscv/kvm/vcpu_onereg.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c > index e7e833ced91b..b7e0e03c69b1 100644 > --- a/arch/riscv/kvm/vcpu_onereg.c > +++ b/arch/riscv/kvm/vcpu_onereg.c > @@ -460,8 +460,11 @@ static int riscv_vcpu_get_isa_ext_single(struct kvm_= vcpu *vcpu, > reg_num >=3D ARRAY_SIZE(kvm_isa_ext_arr)) > return -ENOENT; > > - *reg_val =3D 0; > host_isa_ext =3D kvm_isa_ext_arr[reg_num]; > + if (!__riscv_isa_extension_available(NULL, host_isa_ext)) > + return -ENOENT; > + > + *reg_val =3D 0; > if (__riscv_isa_extension_available(vcpu->arch.isa, host_isa_ext)= ) > *reg_val =3D 1; /* Mark the given extension as available = */ > > -- > 2.34.1 > Reviewed-by: Atish Patra --=20 Regards, Atish