From patchwork Wed Apr 19 22:23:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Kumar Patra X-Patchwork-Id: 13217576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A7CCC77B73 for ; Wed, 19 Apr 2023 22:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbjDSW23 (ORCPT ); Wed, 19 Apr 2023 18:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233693AbjDSW2C (ORCPT ); Wed, 19 Apr 2023 18:28:02 -0400 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD06B9EE3 for ; Wed, 19 Apr 2023 15:26:27 -0700 (PDT) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-63b8b19901fso453977b3a.3 for ; Wed, 19 Apr 2023 15:26:27 -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=D6qvoefyDQxeGHq17EUyWNEdRZLmoPH8L/KR1IG3O/oWOQdSG6IpVfMP2T5QLQtcBp ZhjELFrvRaPihk/plfx1KTo6IfOeE8CseS/I3CLD9s1T7tGZorscO7WkP6R3zR0sFGud N3vc7+9EY80c8Dghsuv3HSGYI+c483gFUSUNKplVtLgUtuG2ys7b5PeJcKBkvQYP2NUP R4CjroCdRUogJQKUpJHRTF4IgI3C6VL7Rb7d4XTAGf5ji0z+VZXmkgNlGCkmLKJRItxP iQOqcA4IV/7b7sivxAkwS06FCPUciPVOMBKNm8eMUGiAfRDFZzjdhJGkhS6dRo0Km4/j egkQ== X-Gm-Message-State: AAQBX9ffIBTnhv1z898JIeYyarxB2plndcbdxbpugFIPtLWQkwKS2xQj wH+sIueqY80E80rLPz1Tx4xPmw== X-Google-Smtp-Source: AKy350biCI2sFr3cWCmld5tDykr7Z5GZPcCxF2zAi1qUg8p1jfhx7EqRslonbApZT3U9aoxz+Y7avQ== 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 Precedence: bulk List-ID: X-Mailing-List: kvm@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) { }