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: 200938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1181643dyb; Wed, 14 Feb 2024 04:40:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUtAPtuP0azTL4/1ldqMyvikD6g5S/Lufz0y0l1a42zhM+wrSFqvJuydJ+40w9cFrqMZ2vgu+Nj9s9yoTD6Z3+5pq75rA== X-Google-Smtp-Source: AGHT+IFQBDOKQKDf0VP4gL8CX9CqL3qnSrXujeo5LpOECELcK1n27fFNfnwrjqE+5okvcGsplhgW X-Received: by 2002:a05:6402:1254:b0:562:1819:bbc4 with SMTP id l20-20020a056402125400b005621819bbc4mr1955297edw.6.1707914415860; Wed, 14 Feb 2024 04:40:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707914415; cv=pass; d=google.com; s=arc-20160816; b=kybMIoOpXnvGlaRgU0v+E5r/dIK7RBZar/dfIAZQ0ZTJyeWLrCBWZKxtPTflB1QCir w13hg3YUjukhcvi7C0VKdUBCFYill5zpH/1TzteBf8Ft9DK43i4VGp8LprPQYYwCgrDo CfzPxT924MelnyNxogRkgybbLaif/b9HEdZ/ZG8/0VKpiTLn/c9KCvwswvSgHXPEiyan ZLWYewBiZFmssXlHnqJbkp+bQLZdROatPpKTmQekEpjTMJm33ekSnP4XwZEX7aTmrfiq oORu6QY+0WSUeGoBzsc9cAIgkMSdsH7cyO7nVugYb4eoWKB3s38CdAw1dZPG9fGCq+Hc AJqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hBSxSTn4SzFgJCLw2mwbPUiKLRcghcd12QFIpuWImtY=; fh=vs2+gYGjquX9cgxEr/Qi2FCzZJID9HrfnSXG6y65qs8=; b=aosQ8BRVDF6+ke7esE70OIwW6XtgUhh7RB543NuuUcuY6vqsPstYAZ+HCf2hZ0ORy0 DFBizdts23YuqT9l+zakw+RHutG7lwUc3T3M5HN/NgbzpJ8HmWnvip9/9pTS5vP08bqb Q0hJ3urQkaNKNwab38sJQVw/IcC+t4OXCd7VqF1jQjdV66NItltq6dXre3qNZ+2aDWFt TaG7Bu6AfU6mw4VLRz+/jTheT4elvTGSeFm3kgFc5HjmWZrhgRZyFKd3fDLsAFcFv34r xfUkzAoiXWUnRCSITtL5L9duvbvEv3iGsiHVhNA9bDRprnKdBOwms3AfIVPn5LVsBOtf ELYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=aBEmgJoR; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-65205-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65205-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVgD/CPdo5dDFauSxKTeKRjOo220Yyk0JEHjoT3V7YlqJfUd40ef4dHYyDaWUYiYqbSnIMh9tbxNe9j8uGYMfxs+7BdCQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t7-20020a056402524700b00561ed2c5ee8si1851536edd.58.2024.02.14.04.40.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:40:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65205-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=aBEmgJoR; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-65205-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65205-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7A2401F237B7 for ; Wed, 14 Feb 2024 12:40:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5157754BD5; Wed, 14 Feb 2024 12:38:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="aBEmgJoR" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44CA9537FC for ; Wed, 14 Feb 2024 12:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707914306; cv=none; b=pgVlSewg1b6gUOEkSvyV6vy/Byke1vw/l26NMswoaYURIa94cpDPRa2iAomXl5dVU/sWcpPmIH/T/LoS29Jn0TKW3EJBZTFHn9FSyQdUCXgiBdVEOdzr/M9PypKYo9ZiWv/YpX7zIMBd7hFyHP+pBSUWxmlq0eVN80Fyn0njre4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707914306; c=relaxed/simple; bh=cex5yCjawX5RILzSoRTQj5o40v+xzFY8ga4zlgODdvM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Npi4AMZEW5B5Atua3susKN0Fy+iLHcg4aBg/8ZMZvEWDzydaEjKg4jhY8D9HsfNHnpnDtRdQbX8ZLYFKeB6BoXco82/zo1sauwcBWhSPWs0EC/ReNk8wec1X5Y4YUjs5aToabC/zU/u9B/DCpeXSbyAZQRSAIDa8w1wSckCJLnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=aBEmgJoR; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d7354ba334so45507215ad.1 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=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=hBSxSTn4SzFgJCLw2mwbPUiKLRcghcd12QFIpuWImtY=; b=aBEmgJoRS6SLKU2l0Q9BAGWB0zodE2P2zJWD4EUST677LOW33zQ6GIrpbx9RhcpcRA lyTyr9/BVYDTyYzrv0ubbDb1GcnGUvR+eI00tWH/10eCf2gACaKkN4DHzCCSgKIEUj+y 7NOqgrBKYDbkJxTeJ9o0Z1ddv2yvfIw+ijCssM+MiGXSEq1tQREcicm0MNEt/jIb/tNo CGlXobf/hBob63n1Mw6HSaCvLY9Uo3/rFPd63rAA+4FdctCLiDLaaKdXdqxj8EMq43L3 EZp358EM/Uft6M0+DB+0bazDn41S0Kq7w/ko0VhjXxGvyzQlNdGyTazEsM+Zl2uB0nfI +Q7w== 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=Xq2ot1eobFMlWBjYF//zM22jRZnnv2+GgDiXsRAwDISXYk5IBNAcuuNFUXdKUZcOr5 G4OruEBnVsKbABVYIBawRDkUHMRHeSb1C9Qid8Zv15r12lw16ZVT5tGMiXNzLzSv3jSp uRrmYt1a3Q1tqtsUvp6P/RFH3uU1uiJVsnr476nX5re0qoJhRXtrtYxtWjZCThfReGyJ 1Oibiff9WW6KPUg/uYcUKTb0+4pnmJgRHEUr4yqAYYY7+5ELZfz/VYza/vux2P3zSdOI 8Nae6AIBqDaudHjXzESowz41jGTFq1sON/MrHkk0QgcQ7wR2iy/UE/gaNomlUuI2JSWW 0i3w== X-Forwarded-Encrypted: i=1; AJvYcCV3D2gznpmdj7SsWVY8pd13nyYvQozGJVOkTWZ44/1Zsfr7Icljy5To+eEIkIvfWWetcYt/XH6bkHFiD9Itx1+7D1B474JcSgKfMpdu X-Gm-Message-State: AOJu0YxaiDGbhXqhrju9esggPIYDgCnmoC8pBg4UqdiPk6LRwLIguzLO f8486etO5aDpR92aUTwgXKCeFsVGjnE6OhYk29jEoqu1JgkPZj5AIJXiLU231Q8= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790878066734812914 X-GMAIL-MSGID: 1790878066734812914 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: