From patchwork Wed Feb 14 12:37:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556435 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0EB10C48BC3 for ; Wed, 14 Feb 2024 12:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=b3BjZjgHWyWHbV2ABaKxJK1ABzJRh6IjEOS9afteLho=; b=sB0TufAHHw3Nz+ BDBLpHafIkU80VH+Sq7K1npGNa+hW9WVI9HfPF3hLyyxFh3ID56TymRrKr9zNVTXRHVchUG9t+vC5 VOYz14xeghURSVBG0LAooQ+u1ZB3ZkqD+GaVmyCubaW0kcVbL9fc2hz5SYcVtzOaEpvDm4QAHywyE 31li8F1zXPClgqUziUCGabARy0jGjWnEanU7XZx2X6e7/Z7FGnzu6tZInNytVEyK/DDZ6IhkK3IbU ZNv57BVltW7emNE54VcEfhjybKRFgCo0UCKFQLZOogDP5CGBSfqZY0qXc+iSHq/HK5UAJsuPJrLT2 gW+fKLQOa3kxAeL6QHsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWk-0000000Cr6O-0gpf; Wed, 14 Feb 2024 12:38:14 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWh-0000000Cr3n-2Wku for linux-riscv@lists.infradead.org; Wed, 14 Feb 2024 12:38:12 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5d4d15ec7c5so4424276a12.1 for ; Wed, 14 Feb 2024 04:38:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707914290; x=1708519090; darn=lists.infradead.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=MnX8n4eslB3tatxrOtV2L4MVIcOQlO77yyiHCpmaDS0=; b=F0/SiqA7SEj8VSytBd6tOnkHup6LWWailIpjL5VMGsczxq7LFjajb8qKi3PYVReLCR 6+HUZHwPQk/f6gqFdw4TvLEAAhqAq3A36VArk6snaKeaOLkodkk4r1syLDs80w92fWLr xmGHlGGvRtwWBRpDT0ddarybBao+iIVCY1t6YBhQIksvI9lx4da6Y1ngOzdclZkV+zdY 0sCngvYL8AW8rmfqJ45wN+A6M7jODCn6J+CB6Vu/bklDHilnIhl//GlrmbBmW1yZ4P5h PnLXuRTw6pcdxBOrMNvLCU42pa1SK/GM3KjLVuhciUCFg8CENPh3Tz9EcKJECEOVr/or YrAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707914290; x=1708519090; 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=MnX8n4eslB3tatxrOtV2L4MVIcOQlO77yyiHCpmaDS0=; b=QiLrjZbVtVQ5z1oVrRDtrQzb4CX3K7b2nayF+TJlCtLT/XdJtvYi2CdHtf4UrYoBmi ndRX1McUjf5D/XEj2DlPpPL1TgP437dsCYE5w6kgHCponmBkv9F8eyYW6SiQQrZvxR8O nosboBk0Ih6OhHPjcTIO3Mq5YkDiC5+oi0xMP3qSuU0fX/kju36p0kVjIkfgUTW0puNt gtRrJCV5Z73IF0d1Sz9QU+WmgjhJE45UArGcSqNX+Tk+QhjNPFmcZmzOjCqF0T2upU17 bHGtdCevMW9qMh/z1I9GnEWxwWpIz4y0VaBwbczm8Ikruau1XTB12jNmaAId5VFETVEL INyg== X-Forwarded-Encrypted: i=1; AJvYcCVbUBKPCbQIjSsJYFY2klYkIrlnzr93N2QM6DPghgfL3CDCtat2BCJn7mJQQrCNVYCteHXJbFGGxhuWvva7P3Rwa8v/E+mp5ZBwnJqAuPxI X-Gm-Message-State: AOJu0YwKAvUWQ9hJN9c9Y1bDclXM153RX2k1leIqZX1jAk3uP0EWl3ys JlHGT/r+M7kZsIZIH5j8b46OeqZGv7cVvQ9CkmJ9zWLE2lPq6FlTM3+9elaL+qE= X-Google-Smtp-Source: AGHT+IE6uz5maWXsKH4t6Aoq6//Z/uwPwTljcM59c0ZygfRhwmy9JrCrRK0P+aMmGkUP38CMtl1oDQ== X-Received: by 2002:a05:6a20:d90a:b0:19e:cd5d:8903 with SMTP id jd10-20020a056a20d90a00b0019ecd5d8903mr2859932pzb.24.1707914289771; Wed, 14 Feb 2024 04:38:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUseRnh7ThDsfj5aeC1nn7XD1vuC0T+l4uR5+8EA2oeNaaY4beARLRbEc2A5dB3+gf69HhCmg95FNFrVqsL676h30byk8kTd9lYlLxs0hSgvQ8X5/etcT/DhcJY8x1psR7VHew9KbANffe3Cy1WV5dL6KB3sEeLM+e1Ggoznv+uXUAmeTpY+BHCYZ+k+q2ITM53/7M2rM/QM66hI4uepvz2r5n/RgCxqGIjSxTLyWZKFElRBSB9M1Eyognik4Z2r0UgSIMR3y93lLWpqJJ90Dc5/wjKMjvhSJsf6oFZNXoF8FTdUTdBAUpRfkelhR66EbOuZ2UQTbcsxdsyDQO6736aiHEUmDWyc6aZlgxg9YIaxd7odR3dbPTWOrxRnRN72wFkQyDH2Odm5MjV6E7fQl0JJwQp0hyrQ+wglwQXoIC3GobElHq8xRR5QOxNNw== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id o20-20020a170902e29400b001d9b749d281sm3041419plc.53.2024.02.14.04.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:38:09 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra , Shuah Khan Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , 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 Subject: [PATCH 1/5] RISC-V: KVM: Forward SEED CSR access to user space Date: Wed, 14 Feb 2024 18:07:53 +0530 Message-Id: <20240214123757.305347-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214123757.305347-1-apatel@ventanamicro.com> References: <20240214123757.305347-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043811_648917_2C391331 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The SEED CSR access from VS/VU mode (guest) will always trap to HS-mode (KVM) when Zkr extension is available to the Guest/VM. We must forward this CSR access to KVM user space so that it can be emulated based on the method chosen by VMM. Fixes: f370b4e668f0 ("RISC-V: KVM: Allow scalar crypto extensions for Guest/VM") Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/kvm/vcpu_insn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/kvm/vcpu_insn.c b/arch/riscv/kvm/vcpu_insn.c index 7a6abed41bc1..ee7215f4071f 100644 --- a/arch/riscv/kvm/vcpu_insn.c +++ b/arch/riscv/kvm/vcpu_insn.c @@ -7,6 +7,8 @@ #include #include +#include + #define INSN_OPCODE_MASK 0x007c #define INSN_OPCODE_SHIFT 2 #define INSN_OPCODE_SYSTEM 28 @@ -213,9 +215,20 @@ struct csr_func { unsigned long wr_mask); }; +static int seed_csr_rmw(struct kvm_vcpu *vcpu, unsigned int csr_num, + unsigned long *val, unsigned long new_val, + unsigned long wr_mask) +{ + if (!riscv_isa_extension_available(vcpu->arch.isa, ZKR)) + return KVM_INSN_ILLEGAL_TRAP; + + return KVM_INSN_EXIT_TO_USER_SPACE; +} + static const struct csr_func csr_funcs[] = { KVM_RISCV_VCPU_AIA_CSR_FUNCS KVM_RISCV_VCPU_HPMCOUNTER_CSR_FUNCS + { .base = CSR_SEED, .count = 1, .func = seed_csr_rmw }, }; /** From patchwork Wed Feb 14 12:37:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556436 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BB43C48BC3 for ; Wed, 14 Feb 2024 12:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qiaef5VeykVG1BCcjlroIvD41DmGwNe8HwAVR0qbLDI=; b=4jtuZ8p4BYRBbu zUKUULIOtanceY49vH86Cb9MhyhRoa/qN2XX3o6ZC58W5RYdKhpoqUBnzaVv7YNc5tFBodxDlzzua suoEhP1RTq2Y/ZRkOouHzAE8cTdJ1GjppgYokMiAaPTlaf4EsadzKPpm9JbMko1Y8ibR5XHKl065B 1gFZcP2Jm+TKI18mvK5aLdngfL2mULWNeramvflEcdNljsdjD0Ac6BUzVcfuOIzxf0UyBrCoMxmJb 1OYBZ5POUZ6x3sDEOa8OUKEHhJRu4jl3MI23vgDElLiQB+SAmT5FMJmNVLcES4MH+Y30Ht44wuqpE FwFz0XrkXVC6E/ot79aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWp-0000000Cr94-04M4; Wed, 14 Feb 2024 12:38:19 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWm-0000000Cr7F-2Kxw for linux-riscv@lists.infradead.org; Wed, 14 Feb 2024 12:38:17 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1db562438e0so5551845ad.3 for ; Wed, 14 Feb 2024 04:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707914295; x=1708519095; darn=lists.infradead.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=48Kvlzn+su9jY0Vm4vzOkE0bGPI59LwwBJsDVuHcE+Y=; b=cr8a0B3IK7Y7Gpqc8pRxwlLMwxE4INOVz8WJTq+To6nSg6EN+XQk9MY0w6mWgTHy7z uU647ChP+Dzbj6iJPRz+SbaXZN3T/ayRApzu+9/3LP08PBpBYkZOdrvRRy0+msbjWhIs V3ARiRWVyjAMC5EYyGM2iG8xSKv9N5RVdi9puesE82D1G2U0b+pSok5PMj+nxHfNNvJW hnlB4LYnRccvPbIpkNHDSnxjMdz43/iQp8Uk8vPckes/SNIYRZLFZ9jJD8W1/CjUf3ji XHkR7vHNQKbRBPv/1wU8HpP+dwFypAkuMaoPZuwTI3SGdNcAAMPI9Nr1YytUXI95pVOn C3xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707914295; x=1708519095; 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=48Kvlzn+su9jY0Vm4vzOkE0bGPI59LwwBJsDVuHcE+Y=; b=TlWhczkfgiCR4RmCqtM9Zepoqb4Mkt/QskUJzRj4LgpLHhTfcYH1Y80ZMeT3/+MJ0w diE+GYaF6Dpl2z7ASAKSDwbmSizFPYReo60Bky7lw3h0oi6HvZbqzDQ+aP7Orzm4VY6Z LT64Oz2mg9uFs2Bspg5YodjXv4GUXcBd0o9tY6X6gJNk04Nfu6L4RXyu/fr4SoxK2Ky5 xkA042BR/xYR1QSgCu61uK/rH7Yre10R3t16AvHd8Cbep6stVzKc4ps8aT7eRva/z/w5 Vt0KEo01lNSqfs5t0OT5yXw413ijlNCrBWnsy1guRudKMhUbhi2YaLYbFZR/4sQXd8CY J/aA== X-Forwarded-Encrypted: i=1; AJvYcCVbNvaSJSjETKvOS03chlUXKKnyKIdCyrYuZI9mz7lpSU90KqDNmvEu4wwGZvUtbyz0l5FxW29WCzpRIT0Orgzu9q3NTv4gUFpprvkGrgfy X-Gm-Message-State: AOJu0Yx2zUsRUm48w8PmaxNTe8g+QD45x7tyYRYZSdiqq2y8akzmGNns 9BuRKZtkOM6Yi1+3fBwiKZaBILysecbSxnbPCxI4WcPvjgu3W5PLM3Eh6vbLFcs= X-Google-Smtp-Source: AGHT+IHBBqpiWCuJIjRqRSpJp+W5dWbQ/msDnFRpAixpKjNS/H5nLpSvKlq1jB9lqsMLcmMLqvQUCA== X-Received: by 2002:a17:902:6945:b0:1da:1d3d:7937 with SMTP id k5-20020a170902694500b001da1d3d7937mr2048287plt.34.1707914294910; Wed, 14 Feb 2024 04:38:14 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVki2Z3WrTpY40NRvm8tEbiYTni2BOP+Vz/m0jnkq1LJ5nIO+BXlYi1+YpL55P6nAAeZ70tS6rcQ9FXBc3LngUk1k5rap6lkZDxjXcts6p25eXLJDfrYH7vS9egyGB4UHfdtL/1enUDxsGQhB+OI80ygbonY7xSQ64wveTP7NsHYgjG5ApUhwmP3Rhzv+qeKdHkfrgeOQHom7tgaE6ui7DbZayXPXniP3TFPS5Uu7E2sjC02J19Jd+MMwctwL9ae1I2h7DIr9BCekEbCMx/1AiUv4xIM/eYG2FTJJPp/HKszsYT8lcYdkaCYxNlCgP7Pq60zX306awYmLYC4LXuI6hvQ/LWXp4r16jEs6NgAfdlLjGPeotzI52MIwUqO5jWp1uTmrPuRVKHejbViJrghAPCZryiembfyb62EeNV7B5Z1eWNyeJDtBjasn0tww== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id o20-20020a170902e29400b001d9b749d281sm3041419plc.53.2024.02.14.04.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:38:14 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra , Shuah Khan Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , 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 Subject: [PATCH 2/5] RISC-V: KVM: Allow Ztso extension for Guest/VM Date: Wed, 14 Feb 2024 18:07:54 +0530 Message-Id: <20240214123757.305347-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214123757.305347-1-apatel@ventanamicro.com> References: <20240214123757.305347-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043816_669184_567AD706 X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Ztso extension for Guest/VM. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index 7499e88a947c..f8aa9f2ace95 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -166,6 +166,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZVFH, KVM_RISCV_ISA_EXT_ZVFHMIN, KVM_RISCV_ISA_EXT_ZFA, + KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 5f7355e96008..38f5cf286087 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -66,6 +66,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZKSED), KVM_ISA_EXT_ARR(ZKSH), KVM_ISA_EXT_ARR(ZKT), + KVM_ISA_EXT_ARR(ZTSO), KVM_ISA_EXT_ARR(ZVBB), KVM_ISA_EXT_ARR(ZVBC), KVM_ISA_EXT_ARR(ZVFH), @@ -141,6 +142,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZKSED: case KVM_RISCV_ISA_EXT_ZKSH: case KVM_RISCV_ISA_EXT_ZKT: + case KVM_RISCV_ISA_EXT_ZTSO: case KVM_RISCV_ISA_EXT_ZVBB: case KVM_RISCV_ISA_EXT_ZVBC: case KVM_RISCV_ISA_EXT_ZVFH: From patchwork Wed Feb 14 12:37:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556437 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2E0DC48BC3 for ; Wed, 14 Feb 2024 12:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WlKPbVe1Xnq6py6VTJQeH7pGqr8FCWrFTr/sAiJrYR8=; b=dDwbFs+l5RB5xo BmbvrrEe/4KiRMSi+tM10Ip3dVMRCfKYw5X5CSmCSvqWWA6UML665bb+tGPdqih4v8syCYZcM+DKg 4b2ML2HIDlC1HZlFtmcoZN9EXa7+qRB7tCxkXK0TF6uQTbslvEmpZNvcAyoo1wjjaHtxGccCyEQC3 uvylSpMrpc8qb5Y3w3cFEW0Wh7owNjBxxAjJROfbFdXTsplhHyio58x3BiCO+1miYSqw2Q2oeenAY CrTAfay4znBPJ3TUyL6mweXjRITvmDA7+82hKWeuUgE80oDnCaZkUA6wWmPzab3NazgYVwoK+pbDg x7DAGwEM/q9/GWlcvBMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWv-0000000CrDg-1ces; Wed, 14 Feb 2024 12:38:25 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWs-0000000Cr9k-0MhO for linux-riscv@lists.infradead.org; Wed, 14 Feb 2024 12:38:23 +0000 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6e0ac91e1e9so2605951b3a.3 for ; Wed, 14 Feb 2024 04:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707914299; x=1708519099; darn=lists.infradead.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=CtRzUtn5YlgGEqGNmE5oViuKGD26HTcJD0Q89ujSctY=; b=o9tlS4kj7cg/+VWE1YzPnzkRA5L3uQkoDFQs+HMBzGpFTehXpkVoDzauZlpvsYgAJ7 8RTSKhrsoytQHd4o1LmgqIq/InVaCsnWB4uCV9iRje/BSQ7+RPzsCwhNlBbI8iBbMgBB UhuuSlZI/gXf+bJIq71wRW3ofkg2uxRhM3UhKC61UvVWVCJigOUpz+1WVroOJCBOxqnR rlb7nxlZQL2+jq0H1vrkStqFgET7tsRCcY7Lq6JYhM7kSvcbS2mx7MaHECJUzFqWG4Zc hjWDu9E3bj88Lm+25tEAVnjHL/2O6c+gJPCT3qtKlcvIoWFBXpRIS5w+hROvbBT17prw 7IbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707914299; x=1708519099; 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=CtRzUtn5YlgGEqGNmE5oViuKGD26HTcJD0Q89ujSctY=; b=vLOr4JsHA0lYGcfhfl85rro6s4bRKD4raiIMCaPywZn+68dtiAFReDkm+y2PCkxzIM 3P0TclcmoJ+l6WIQBN5/zoILfCFF/2s1qlf1MToFjEKUWQCnXICrwgElbGv7slnMk7L7 iS3QzeOoGUS3DxEiF8Yy/BoHEPc2zryfu7IJdI9fQeH6ai24khjTntqMzVNahu9FWoeu Dsn/7/ChzvBguaQjk5Vdu+NHBTM7+DEIqKkZIz2MI0ZvGpkO3/D6ChdeiVqoP1sSqzZ3 VzltMBGVKGilN2duwZTrPKnFoR7Z+gZNeWjVr1tJRQl2A6AK0D4PLlnsh0Re4YmuHRDW SvXA== X-Forwarded-Encrypted: i=1; AJvYcCXn2KsU883vRgCNY7s3eAhCPGNP+jk91LCOr4uUXUZ0AcYbyA2/8xocwug9XxA5C1jO95oGfbV9blkBbR4KrG41DeD6TgISimJpAE8Q+NSg X-Gm-Message-State: AOJu0Yw3uOl2U7qLphDKUG+pRZlhEFpCCg/yAMxpvNFPkD36ENOmLY0k NpaYcF7y25JkzX27uK7iJXa3DoFpsDhAzs/uecppdSMp8qddR22MAzUkIRb6Q5g= X-Google-Smtp-Source: AGHT+IGCWZ5G/G3vbyNMBfek5NVGYdPpcnCAN0KmPun1zKGXih4KLFfWufmz/OYQLaOucpICouOPBA== X-Received: by 2002:a05:6a21:1644:b0:19e:cf31:6a04 with SMTP id no4-20020a056a21164400b0019ecf316a04mr2855300pzb.59.1707914299363; Wed, 14 Feb 2024 04:38:19 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXrXT4KToL9IgoHVlEatzhhCjqaY+aDf2dj3WXtREaMV4mVz7xD/BsynLgPAcDs1YDjmE60t4dut/SjiWkhbTvOevleB2YNKNZYIS19SAmNlE2hgyLgJhuLzf4qm1iogqAQxnKViApc+lYzuksXCv1knBeeRikj8YvcIXPoBUqJwAQzDYBhZwDXGkF5pQvyOMUj5qPsY2GGzZ81gTzJ6hteOMyADmeptjvymrVt6NED+ZuDq9a1Ks+rj8snJcamLctx8azbCwuMgKAr3SrDpJAGu1O411FkkvGCSFbB3bsz6Q6CTd8Oxqd4gaX7coarmV/Ix2htiWKpjx3EXVWnO3m+jbPNad0iid8txVbAZu/3P31wCiAi8REn65ISTwSDmI6/XM7mgZ/a3fDMXFQc8buJ4+f0iw4Z+H0YQ3JZ1IWCooM3JsOmzkeOv1Ny6A== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id o20-20020a170902e29400b001d9b749d281sm3041419plc.53.2024.02.14.04.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:38:18 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra , Shuah Khan Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , 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 Subject: [PATCH 3/5] KVM: riscv: selftests: Add Ztso extension to get-reg-list test Date: Wed, 14 Feb 2024 18:07:55 +0530 Message-Id: <20240214123757.305347-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214123757.305347-1-apatel@ventanamicro.com> References: <20240214123757.305347-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043822_165379_0019DA8C X-CRM114-Status: UNSURE ( 8.27 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The KVM RISC-V allows Ztso extension for Guest/VM so let us add this extension to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 9d9c50b68207..5429453561d7 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -73,6 +73,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKSED: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKSH: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKT: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZTSO: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVBB: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVBC: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVFH: @@ -436,6 +437,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZKSED), KVM_ISA_EXT_ARR(ZKSH), KVM_ISA_EXT_ARR(ZKT), + KVM_ISA_EXT_ARR(ZTSO), KVM_ISA_EXT_ARR(ZVBB), KVM_ISA_EXT_ARR(ZVBC), KVM_ISA_EXT_ARR(ZVFH), @@ -957,6 +959,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zkr, ZKR); KVM_ISA_EXT_SIMPLE_CONFIG(zksed, ZKSED); KVM_ISA_EXT_SIMPLE_CONFIG(zksh, ZKSH); KVM_ISA_EXT_SIMPLE_CONFIG(zkt, ZKT); +KVM_ISA_EXT_SIMPLE_CONFIG(ztso, ZTSO); KVM_ISA_EXT_SIMPLE_CONFIG(zvbb, ZVBB); KVM_ISA_EXT_SIMPLE_CONFIG(zvbc, ZVBC); KVM_ISA_EXT_SIMPLE_CONFIG(zvfh, ZVFH); @@ -1010,6 +1013,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zksed, &config_zksh, &config_zkt, + &config_ztso, &config_zvbb, &config_zvbc, &config_zvfh, From patchwork Wed Feb 14 12:37:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556438 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA111C48BC3 for ; Wed, 14 Feb 2024 12:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WLccWMjvFAwVz0S8iAlAU1WKfSvOSt7djJhchBpusYw=; b=tXRYftpiWugSon /TbFCAHHeo/hnGzavEadlpDQgN7aVw3O/8TAy2lT/4t5fOX92YqmaT2Y06Uc9Ur1XrKUsgtzAVLPk mtPE2mMuzGCfZEB5Ez4ySJRGubXXLNqXV7AypbTzR2hY1xbKh5z0I62vhrbFe3bRZmpBBDJc1VEdI AQKVqX8/YkQShg7BEW9pBz/XQ/FNFS82F4JUYCkxZddZ1GCwgsAveyAFCP5keTeM2noIUuAyVNl9C UOHo3wobt1fpT3JNpBxwvtxpX8yAcXb2QPd/W5SwluKXzc3ngJO6of7VoNZGpL7VhzmpLYLedq6rQ koKJiVAUXt0EqqQZ2DlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEX0-0000000CrHz-2jT1; Wed, 14 Feb 2024 12:38:30 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWv-0000000CrCz-1pHa for linux-riscv@lists.infradead.org; Wed, 14 Feb 2024 12:38:28 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1db640fc901so2705505ad.0 for ; Wed, 14 Feb 2024 04:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707914303; x=1708519103; darn=lists.infradead.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=hBSxSTn4SzFgJCLw2mwbPUiKLRcghcd12QFIpuWImtY=; b=op2XlWQBFTS9/VOfiqoCaNkyfRd65EJyIZTDMzXD3KERHiXt1HNQq6ZlXFN7Rx0cYR ws4jexdf5IAHl6UxyZPxcFg6H5IDsWb+ks04geX3BRKX6WHcaN/VtnK9uOld3DG3131u gMhfOjUJVwu30INVig1Zpssg4DevDGFIWGsaF/5Ic92l1tuhb986BmJHEBtMpa6az25Y GfCNy6tudVGXrsvNmZQzlmAY2IKmfCx/olBS9q6MtwYZFIhUl3AFDiKTIbUQl2ydGp/z djqRPAvrmwF0InmaCVo4NqdQhK8qkqApGTcfhHueePKrEVH0GGT/12KMbrCLFUeJnxQ9 HAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707914303; x=1708519103; 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=hBSxSTn4SzFgJCLw2mwbPUiKLRcghcd12QFIpuWImtY=; b=OJUck9P04gaG0iu0xYT6RPEJ0IlqeZePO0SXIqbpf1pWVnXoflOw0gVUBMeRZReE8E i69k3Qf7I+pTLhyzu/DUSlt9OgiV2EuaWd8QQManPqOTfSltcWi2I0CQIpJRnkA2h5ZB I0qn5g37SS/tGq5ZHogZ5NP76fNcNGAtlIbdRByrVusKZi/BIJqm9k10ypRbtbnKLQdG rEXN7wJlBC7LbDSew0I1dADpl1FxTWmiH6WEdWDskNkxvkYC0deKiBLqglGYd4/jGvCq guDcSxUoY8r9Xly3mTYlrzf6FrP3WovLY2QTZfX5Lduycd3G8yM252yT7sFXoS2Ub++s zPcw== X-Forwarded-Encrypted: i=1; AJvYcCX1I7tKo02uBDS1u1BZj/3uIbdIWF74i6T9l6xhMgqXrRfhW79rM/kvZ+DXSwIGOC+j4Bcdjx7X4JmkW3ztFTGCWo2wQDD5spyUaEKUCBr4 X-Gm-Message-State: AOJu0YzVK7vxPU7VIyTsKyrp6576yyrhod6wcJejmr+j3KCmAxCIa+rI 3SueRI6urzqWnLjdMRGpDbAvV185W3FYEfFk4jT6dp99AQd/HVangkAMxqKJX6s= X-Google-Smtp-Source: AGHT+IHZQFnNrVkrei4j4ZNoY7pCPgZUX5vwqHY83d+LoRS42msBSa4XSwOZVWRzwbeoKajJ1Adrfw== X-Received: by 2002:a17:903:32c5:b0:1d8:d5b0:aadb with SMTP id i5-20020a17090332c500b001d8d5b0aadbmr2210794plr.66.1707914303508; Wed, 14 Feb 2024 04:38:23 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUoXP00E/iqkcjEmAUlBHrFJKYJoKL4q0+QeKcB6TPtbNEYX7VWrlUX2Uu4YkbXuRUJQslzZEHFfn4RRvKWNaoR1WGgwBvKaBbLuwi1AJnOnuRbkIMSuR7avQ1052diCkJpSrupZ3VKHRgEDuNPXtIbEhll4ygTcHqYxOA/MP4rJGThf+wtAPVi3AFCynE9gkIKexohY7Vd7k4vqbCkAHGmHho00ydthMQHcwzX88GbrObaKy1fPto4j+hoMuCbWMJrPdoFd6zCAhMaSq3mikn72w6/DpzwMNRrJHMsGUiBmghCZoY3PSJ0HRwHl/aGY9OJ1J0rJviin0rxG5PtBlecyMLe7mNfEE+tC7TTqPTFsxyL+evcZjOYIWg/SgZWHHLZB2lm5nnkEvTFrvx8F0KGw0C1erIDuDyRozFYxsy2oK+85SskFZaKJr2sRw== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id o20-20020a170902e29400b001d9b749d281sm3041419plc.53.2024.02.14.04.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:38:23 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra , Shuah Khan Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , 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 Subject: [PATCH 4/5] RISC-V: KVM: Allow Zacas extension for Guest/VM Date: Wed, 14 Feb 2024 18:07:56 +0530 Message-Id: <20240214123757.305347-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214123757.305347-1-apatel@ventanamicro.com> References: <20240214123757.305347-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043825_614421_62FB7DDB X-CRM114-Status: UNSURE ( 8.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zacas extension for Guest/VM. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index f8aa9f2ace95..37fb0f70b3e5 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -167,6 +167,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZVFHMIN, KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_ZTSO, + KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 38f5cf286087..f4a6124d25c9 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -40,6 +40,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(SVINVAL), KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), + KVM_ISA_EXT_ARR(ZACAS), KVM_ISA_EXT_ARR(ZBA), KVM_ISA_EXT_ARR(ZBB), KVM_ISA_EXT_ARR(ZBC), @@ -118,6 +119,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_SSTC: case KVM_RISCV_ISA_EXT_SVINVAL: case KVM_RISCV_ISA_EXT_SVNAPOT: + case KVM_RISCV_ISA_EXT_ZACAS: case KVM_RISCV_ISA_EXT_ZBA: case KVM_RISCV_ISA_EXT_ZBB: case KVM_RISCV_ISA_EXT_ZBC: From patchwork Wed Feb 14 12:37:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13556439 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 598D3C48BC3 for ; Wed, 14 Feb 2024 12:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=89MIA3rHyUwkgKUClFtsLCtK0/m8vlXB7ZJOX/TOMeU=; b=oaQOMH58BJf2kG oUq5pklpXUGNg8gNk+52PwhRAKQBiegiqsQkhQMeuZm26v2aeKfsRL8+lh1hVSC09guP1HLSGw2pF /dlREY0DVZmJF6KQZU/uDxjGw2N3IAU3j6mFE1t1Np0Xx1nWeJZ2vz3n0h6hHXJEOVAD8FRkgPT3O oMAzX0R3g1edZ+JkiuMm1fgXNBuv37PbvR9vsp0fqVq6pcvt4AF0lTxjSsvF7QMnOvbgnOYQhdXQS A+qnV5KAoE71DRZpl6/nvHoP2dSt0BxV6d/1j6qvn++czJ0KeqSGgAQVInlTpF2X0a50EuEmUF58o NDDT9geOoEibDkGWMZPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEX2-0000000CrK1-37tp; Wed, 14 Feb 2024 12:38:32 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raEWy-0000000CrFv-0U0J for linux-riscv@lists.infradead.org; Wed, 14 Feb 2024 12:38:29 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1d8da50bffaso24695215ad.2 for ; Wed, 14 Feb 2024 04:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1707914307; x=1708519107; darn=lists.infradead.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=NHKjtl+TiQN3xkVjk4Gl68ZjMVAysMTJP3yyqxhX3IM=; b=GweRYfsIlbzbT68CzTI2ODVBgNdwPAUJNV1L5RGo9a/WbQQk/WE9bE3MffrHovVDNp sSXpg+E09H1v7aZyCswI5V7HIpy9SBn3OoXCEezsLmXXUxVqyAlEUP2pWafS+LFtCWEb boWq3PvSZ6h6s+xO+XLDxfOd4PYw8mAlLJY0RCF2Y0G3Vba+Smbi39ryrbVmkv2mWIiL A+cY66eVlNzU+vJ5D6krsUgSG4EhAIMjzI3mnz5z+XFPlFlhVpF5NNhigyE3hr1udlvp N3Y7bb0VIvgE0fsnBk7G665sMaBX6tiD+Wnfyhv7ZDM8gRiBIUgtSyWXPnEzaxHoOoFo sxbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707914307; x=1708519107; 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=NHKjtl+TiQN3xkVjk4Gl68ZjMVAysMTJP3yyqxhX3IM=; b=IU9NEGr/zhqD0sgZXZh/pVZALw4m2II2/0ulqCSMoIZ6BRuPLI/7NhKgTO7DqI4MCd Xg/XL0szPdV+o+/t/VRJRi2IJKKMaIqs9yevZxAvruJ9GVqmrEg+/UdUNiApIm9jDYvl +2kfYrThOoLmgIsX7TzeWsG0Y8L33cy358ClSGRgOvatmviu0eg1Dir4IsuxggFrm8QV 2akUe9qVN6u9RGPM8TImOQBBgtnOWSaOPiozABgkuS7qtJpzFK0NK9P4lA+gZHggAhr1 Azrfmmq7nSrZtfDGMOpPgVxgkuUVl8dYchgQL0VzmIdOjwdZTF331M92y/LA8gNHTAQo INnQ== X-Forwarded-Encrypted: i=1; AJvYcCVqHARj1WM2QfQgR57sqsXvSG1G/MEphXcBX2YxNEQB+m6CXoK/TqHD3+jgEaPgnYrPCVXqzpa/AqdrpwyGLMCGxqo5QtizsoUycu/D3pYR X-Gm-Message-State: AOJu0YzHtO/ElMIzj0v9nJ0iTOY57beD9BTBz/RHQhT4dOXYoOqD7xhC DlQ+UaA7pob7lyThaRoDiuRgAu0hr8Bh0FCFxD3se48XEWycebw/nhuCQYIPCjs= X-Google-Smtp-Source: AGHT+IE4eB6K18FO+NV+30jFVOFBt5sQrSmihTsDMjky3cQtyum08b1pUVZK7T/7CIdCYEPbGH9Wqw== X-Received: by 2002:a17:902:eb89:b0:1db:68d5:6281 with SMTP id q9-20020a170902eb8900b001db68d56281mr717883plg.35.1707914307513; Wed, 14 Feb 2024 04:38:27 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU6JYSlk0nXCb0cCSJmJVtMcA3/mi/wxVgTU49YydRY51DqTvVP0HOsuMu+uEiHFW5vdTQBkqUZY9o5tBwRP6TqnEv+nZnUhap2OH+nfGTbEt3lY/Ae/q4i9vdc/StMRf+9juoiTb/5jO4vlL/PqQK3OjSqQ5dh7uzMrrlFalyKWpy+t+tn0Fo0/V2Tp2w0HKwrTY7LYbYAtv4VlJgxcpzDN8v0xk6gU0lKQbcRYPrLUTNWXKMg7VyqN9gdLEg1/FaCxccjnyp/qaIA0HjWXBKEUDaA1hBUn+wc2bETB9VvFzfzckufJ8BKYSQzn3cTVYx9swbNbLAACI5d2s7kS1aF8ZwYTw3o9N7OZFInjwG0TMXNnyBL31t5GwmjElQXq09vk4owgaVGpVZDJGgc292s+M5meW0j8nnGCPfgm/rfrIQxUno++Ly0eMQ/Ng== Received: from anup-ubuntu-vm.localdomain ([171.76.87.178]) by smtp.gmail.com with ESMTPSA id o20-20020a170902e29400b001d9b749d281sm3041419plc.53.2024.02.14.04.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:38:27 -0800 (PST) From: Anup Patel To: Paolo Bonzini , Atish Patra , Shuah Khan Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , Anup Patel , 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 Subject: [PATCH 5/5] KVM: riscv: selftests: Add Zacas extension to get-reg-list test Date: Wed, 14 Feb 2024 18:07:57 +0530 Message-Id: <20240214123757.305347-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240214123757.305347-1-apatel@ventanamicro.com> References: <20240214123757.305347-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_043828_192082_D23A0581 X-CRM114-Status: UNSURE ( 8.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The KVM RISC-V allows Zacas extension for Guest/VM so let us add this extension to get-reg-list test. Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 5429453561d7..d334c4c9765f 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -47,6 +47,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVINVAL: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVNAPOT: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVPBMT: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZACAS: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBB: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBC: @@ -411,6 +412,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(SVINVAL), KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), + KVM_ISA_EXT_ARR(ZACAS), KVM_ISA_EXT_ARR(ZBA), KVM_ISA_EXT_ARR(ZBB), KVM_ISA_EXT_ARR(ZBC), @@ -933,6 +935,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(sstc, SSTC); KVM_ISA_EXT_SIMPLE_CONFIG(svinval, SVINVAL); KVM_ISA_EXT_SIMPLE_CONFIG(svnapot, SVNAPOT); KVM_ISA_EXT_SIMPLE_CONFIG(svpbmt, SVPBMT); +KVM_ISA_EXT_SIMPLE_CONFIG(zacas, ZACAS); KVM_ISA_EXT_SIMPLE_CONFIG(zba, ZBA); KVM_ISA_EXT_SIMPLE_CONFIG(zbb, ZBB); KVM_ISA_EXT_SIMPLE_CONFIG(zbc, ZBC); @@ -987,6 +990,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_svinval, &config_svnapot, &config_svpbmt, + &config_zacas, &config_zba, &config_zbb, &config_zbc,