Message ID | 20230920154608.1447057-3-apatel@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4711642vqi; Thu, 21 Sep 2023 02:16:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwjt/zRSFzCsUb5fQt1tcHoqXnVht9ktK1iD/oG65l/6FlPEKfnqsWewsjL9v6eCTv1QSf X-Received: by 2002:a17:90a:b118:b0:275:4103:6adc with SMTP id z24-20020a17090ab11800b0027541036adcmr5029233pjq.43.1695287766459; Thu, 21 Sep 2023 02:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695287766; cv=none; d=google.com; s=arc-20160816; b=bOnGDQVgxee4fqSpY97YdEBu81fkQ6m0JlfQOKrPgpwmgOsxgdTGN+yGLQH5sY1rd+ +c1MbAa9Qlv4sHK7FLts1Wh0oJzA4Oan4G8W0Cpd3VFPNZA7qy8OWzNVqzQDdGeuQDRZ piMH2dKQmLtgJ5oOuWiCsLE5o8I++XJWYc2K1uzFRxYccslCazasA4p+q8g9jwuyicjB AtBMgBB/wcBt4IpjH4S51D0LegLvRvb6x3gM072hZjxB9KhqH0o0QIqNcs08QKTK7mt/ K4EA8dYCKH2rm2L/Z8WiKNrYb+2MRLaTaY2M9Y1NtWBfsE7Yqov8QjlTjFn4cqJB8hLL IdUg== 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=0WW4VSH0fAhQvFEKg4libvP4KxfqhgcxX9zTpJuWWZQ=; fh=665Qm2DFjeImEVP2NCXef/1YQ8IF0QpHIEyBqpmie5I=; b=N7iHsTQgXJEXY60USlBZGg2Bg/zvOaAa6K7EH9I7BNvNrdK0mKpI+JnuE4dbUocvGU WrlAxyrnDhHqZHyIdR17fSS6iT2YDtFjg/mx3qyYLQKz311F1E76//ajX3t0IbNDqbD3 5xfS7Va3x2m/Bpdbnwmf9NRLRQjxupaAw73+kB5F8VNrW3+G/SuSJ0rqoYc7gE+6VinP nxYgWAGFt1IlLeTLw/ST8uU4jOH42+byhDzY0YiPxAhVfSslcTNXbnTNy5dmvH5D8BRs XjpgJOS7P5JOTmj3s5q+spYxgZUzhyFgDDbAZmHQgCiliwM1Yx6OkEELYBV/aTU/ey/i owwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=JTE3Q4KZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id nd10-20020a17090b4cca00b00274b4dfd6d3si3437214pjb.128.2023.09.21.02.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 02:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=JTE3Q4KZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 58C8281D0B4F; Wed, 20 Sep 2023 08:47:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236838AbjITPqm (ORCPT <rfc822;realc9580@gmail.com> + 27 others); Wed, 20 Sep 2023 11:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236813AbjITPqj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 20 Sep 2023 11:46:39 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E67FED9 for <linux-kernel@vger.kernel.org>; Wed, 20 Sep 2023 08:46:32 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c572c9c852so26719695ad.2 for <linux-kernel@vger.kernel.org>; Wed, 20 Sep 2023 08:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1695224792; x=1695829592; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0WW4VSH0fAhQvFEKg4libvP4KxfqhgcxX9zTpJuWWZQ=; b=JTE3Q4KZNmEdUfs+/qgEQ9QGU4qBiEoXXDvkuzh7Y12FlV2UT9u2VeRkPLvlLXBQRt cmL+MPPPRg0zZRNrj6oNwTLOkiT6+cHpFqErMXA0jrt0m5OeAsJ50DMoW6F0WBh8QYPY s+VuqRmdHOKmxFU+VaBJzZ2lD/1mru24rThiVBFdah+jxtOgMHHH/cSKBD5qSMnjlkdv F7kKZOul0ARaXEqqf+AFPu5BSQMu+wW2PG4sN4IgeXhOTLgKSBY31uilyP9gra+JZ3bs YLJuDAq6hbjjAWeFFRZBm35V3U77XzQAYfvPG3AO2moqG8HXcuBUg9j/5DMifXU3QiAV XkBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695224792; x=1695829592; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0WW4VSH0fAhQvFEKg4libvP4KxfqhgcxX9zTpJuWWZQ=; b=rgZLjRsGzEr64vir2XJWifyVTO4MGeGS2CiYyNXSGb2036tBa3dRXvopi0eRUyubxU rT0FV8C+QJK8Fm+INsIw0SX4179rVpmviLLtYMrVdmJIQ1RNrdXfAf85d6HREXLm5OUC vUWWKZHmr3WbepnBW88en9iXgxn6E+U5Sms99ydB2n7aHmYRlrGSZo/XC+zYTlLKtZyt PLrFa/mvDZ8PJjwdWVkgf5yPpVz9CfaNez/nZxlzXFLtPEVnnhSQO8EMohd2hlP3M+H1 ckMwPxhfK9/IeURC3TCa+Yzg/rxSPv+ufKVWEPFNiDd7VULlrKHmm8XmmUbLUyO+IGCG JbWg== X-Gm-Message-State: AOJu0Yxey0qUNujJIh4RourlbqW9Ab9EiZHKMy3WMMR0Pvf6dgCMShNa mmE2860FabL1ZCegrfTHGOL3Zg== X-Received: by 2002:a17:902:ed54:b0:1c3:9764:764f with SMTP id y20-20020a170902ed5400b001c39764764fmr2676177plb.48.1695224792293; Wed, 20 Sep 2023 08:46:32 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.85.109]) by smtp.gmail.com with ESMTPSA id m7-20020a170902db0700b001c0de73564dsm11995153plx.205.2023.09.20.08.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 08:46:31 -0700 (PDT) From: Anup Patel <apatel@ventanamicro.com> To: Paolo Bonzini <pbonzini@redhat.com>, Atish Patra <atishp@atishpatra.org>, Shuah Khan <shuah@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Andrew Jones <ajones@ventanamicro.com>, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Anup Patel <apatel@ventanamicro.com>, Atish Patra <atishp@rivosinc.com> Subject: [PATCH v2 2/4] RISC-V: KVM: Fix riscv_vcpu_get_isa_ext_single() for missing extensions Date: Wed, 20 Sep 2023 21:16:06 +0530 Message-Id: <20230920154608.1447057-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230920154608.1447057-1-apatel@ventanamicro.com> References: <20230920154608.1447057-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 08:47:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777638064629819591 X-GMAIL-MSGID: 1777638064629819591 |
Series |
KVM RISC-V fixes for ONE_REG interface
|
|
Commit Message
Anup Patel
Sept. 20, 2023, 3:46 p.m. UTC
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 <apatel@ventanamicro.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> --- 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 >= ARRAY_SIZE(kvm_isa_ext_arr)) return -ENOENT; - *reg_val = 0; host_isa_ext = kvm_isa_ext_arr[reg_num]; + if (!__riscv_isa_extension_available(NULL, host_isa_ext)) + return -ENOENT; + + *reg_val = 0; if (__riscv_isa_extension_available(vcpu->arch.isa, host_isa_ext)) *reg_val = 1; /* Mark the given extension as available */