Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp921754rwr; Wed, 19 Apr 2023 15:31:00 -0700 (PDT) X-Google-Smtp-Source: AKy350ZRxn6fQvUfLHLW9onKXqD2o1fQUUyNGBA/rKUMZZvLO0JomJpw6p1129mnG/h9MiZptHY1 X-Received: by 2002:a17:90a:2b87:b0:247:8b61:a41 with SMTP id u7-20020a17090a2b8700b002478b610a41mr3635923pjd.25.1681943460681; Wed, 19 Apr 2023 15:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681943460; cv=none; d=google.com; s=arc-20160816; b=lQYf/HwO0XyDVmSFLs4MYjqEI4iJwNM7dgMeLYy5n6mskVLQJinKjXuIE5ZEJVep7N Bjba8uq7VOnAPTwnMI+CokkBLgbNF7XBXxSClI+btohWb/yv7u8vZ7IYz9ukFPrhXS+s IbQP6bnoeQFZBbFwBq990wRkrBJ0n3U6FjoGP4U6GxJsQBYdabSASzS9UP7NS53mdX2G 14ZvPGd4RhB963nhWS6q4HacweUrh4mHOHLKyM+D4bIOePuWCbOREBl5i4S2GGL5fSy0 6MmgxBH1jL4ij0AJU9SAHTsPftYi8CNWeCjDAurFovICqpBHdtu4ftCsZr109zKys2/v 2ivQ== 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=ZTLerH+RJ52lhodOQfma/DJulVaHZ1rN37E2HPQ1gqk=; b=CoFdK5wONXe7DcjTRcDdW77dFBQ+VsMa0EQZ17UdlciFhVK14TFdVGwDVPjyublbjC N20R8xh0wjFsgA/NYa1zmUUTvx2sBtWbDywN/jFDwHYEi1Z88W+FD4s+lchK5mIFFmym R2qUMaap+pzUfzHJcBuOJceZfw7Cex6tPwN77ZNHBJhdHsCOk4D6pjuL7Jm4ZoKhXNck ek7ZYvjmIbFgcE1jTfIcBaTbfDnrPgzCkyE4thPXDB6+beYJhXoGuTZ8RyGUFzq6ecyD /P5vBPmkwjT1rTqbgTUHKCPjb5cp+PY9ywTg/yH0qB2RIEPd/NwW1uUNSbHUrE9IRm5K kUVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=a1bnzxGW; 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 me6-20020a17090b17c600b00247303bfcd6si2718194pjb.168.2023.04.19.15.30.20; Wed, 19 Apr 2023 15:31:00 -0700 (PDT) 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.20221208.gappssmtp.com header.s=20221208 header.b=a1bnzxGW; 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 S233378AbjDSW2e (ORCPT + 99 others); Wed, 19 Apr 2023 18:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233076AbjDSW2H (ORCPT ); Wed, 19 Apr 2023 18:28:07 -0400 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5657CC143 for ; Wed, 19 Apr 2023 15:26:34 -0700 (PDT) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-63b8b19901fso453982b3a.3 for ; Wed, 19 Apr 2023 15:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681943055; x=1684535055; 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=ZTLerH+RJ52lhodOQfma/DJulVaHZ1rN37E2HPQ1gqk=; b=a1bnzxGWwIOEAkq+19MIVfBP/ZCFCZqLmC1UeQSHZvEerwM1InrDlC+CNQjLasRYNY TG6B+BEbccXViq3GxUGM1S1bKt08GMbNh8cu2/7uvz8TADG5izCLZidY7kyXryOk8Cc+ amepc4YX9EhmwedHzdpQaI6iQRwH2jqt2DPucE98CEAfI6Pi8SQBLcJ1U0kFZji/jcS3 poVKHT9OeJbpVpJ3SjBehUYSR58tbT8ZMpTvtdSUCQHzPMMVlmcC1HTTyDhFywITeMq2 sEJhC6uIWIrcV3571Eqlwgn/Fm+q+fD6bbuTOkEai1g6rHX8oYaeAhJEcO5b4iPV/t6d oGlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681943055; x=1684535055; 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=ZTLerH+RJ52lhodOQfma/DJulVaHZ1rN37E2HPQ1gqk=; b=CeCP21L96sPWFFlm6v7s/7xViI6nL1f6/BVcOA/8Hqm/dXcKUbu21B5caFrTrqXzSg kdForErWmMxvK9wWQg4KrMVbzhCAGjlOF0grOxzPuGus9hgC3LlOst5FEO7Zk7xQ+2cq b/dGbOph9MGypu5n7RkMhWN4xxcKhPz8iDQxc3qwcssm7dT3Quawk2YLTJq0f9Pwfpxq 5aJkBuR80jhhbpmH1qJ+DfDf+d9qRYJX5CgtAf5lMv020BCKorB3MInLeuXWgkhXwkDx sVC9LnELgFxsT56i96b3gCC+TjIOIPlpRtETavXFiAutgc4vbfjbdtqxVrPOHxXredd3 pfXQ== X-Gm-Message-State: AAQBX9fvNwRGGvT5eDaaxA/ZLeovliQ6T8Jh5Alp4bjHrBtdA96Hqi/B 7unyQH3qCWkJ7tExnxTXZaVX8gJDHX4hD2X2X0A= X-Received: by 2002:a17:902:e5c7:b0:1a8:1436:c892 with SMTP id u7-20020a170902e5c700b001a81436c892mr5044406plf.14.1681943055547; Wed, 19 Apr 2023 15:24:15 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id e4-20020a170902744400b001a681fb3e77sm11867810plt.44.2023.04.19.15.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:24:15 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Andrew Morton , Anup Patel , Atish Patra , Suzuki K Poulose , Will Deacon , Marc Zyngier , Sean Christopherson , linux-coco@lists.linux.dev, Dylan Reid , abrestic@rivosinc.com, Samuel Ortiz , Jiri Slaby , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Paolo Bonzini , Rajnesh Kanwal , Uladzislau Rezki Subject: [RFC kvmtool 07/10] riscv: Define riscv specific vm_type function Date: Wed, 19 Apr 2023 15:23:47 -0700 Message-Id: <20230419222350.3604274-8-atishp@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419222350.3604274-1-atishp@rivosinc.com> References: <20230419222350.3604274-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 RISC-V supports CoVE VMs now. It needs to setup correct VM type if the user requests it. Signed-off-by: Atish Patra --- riscv/kvm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/riscv/kvm.c b/riscv/kvm.c index 5f9b0d5..e728790 100644 --- a/riscv/kvm.c +++ b/riscv/kvm.c @@ -39,6 +39,18 @@ u64 kvm__arch_default_ram_address(void) return RISCV_RAM; } +int kvm__get_vm_type(struct kvm *kvm) +{ + if (kvm->cfg.arch.cove_vm) { + if (__riscv_xlen == 64) + return KVM_VM_TYPE_RISCV_COVE; + else + die("CoVE VM is not supported in RV32\n"); + } else { + return KVM_VM_TYPE; + } +} + void kvm__arch_validate_cfg(struct kvm *kvm) { } -- 2.25.1