| Message ID | 20260120080013.2153519-20-anup.patel@oss.qualcomm.com |
|---|---|
| State | Changes Requested |
| Headers | show
Return-Path:
<kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=pass (2048-bit key;
secure) header.d=lists.infradead.org header.i=@lists.infradead.org
header.a=rsa-sha256 header.s=bombadil.20210309 header.b=O7bu8f/d;
dkim=fail reason="signature verification failed" (2048-bit key;
secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256
header.s=desiato.20200630 header.b=URiVdcQH;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256
header.s=qcppdkim1 header.b=GLEDVYdo;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=none (no SPF record) smtp.mailfrom=lists.infradead.org
(client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;
envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;
receiver=patchwork.ozlabs.org)
Received: from bombadil.infradead.org (bombadil.infradead.org
[IPv6:2607:7c80:54:3::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4dwKXD676Sz1xsW
for <incoming@patchwork.ozlabs.org>; Tue, 20 Jan 2026 19:01:16 +1100 (AEDT)
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=O1ELNigl1WWlQBInjSFHNuQpZ2FX6sc+8fu/bUfKnLQ=; b=O7bu8f/d+hQyW2
ovgHxXKbM7ZaCG6/Mm6Ft9dLHrCGDHu7b+wCmZXIeCNM7ZSIphphaOdBqQ5JFJGrMOn3qI53RL0nO
Wr5wmTmhvJ9YeLdTDXcYjvYHEuK6UDzq/E6m1/8RSu7F6W5kMM8565MZsaumi4KZQELRf2f+3Lyge
6npRztEtqZvMNpXCqbhGvZXuYHajQz3R9EWJb5vHXswARxeX5UXai5Ept/ArzWzfpev75jQLMs3lj
lFNMREX1hu2KSJz/szCGdCqRij4fMiXxCyDZJ4wlBTg2g/B5bJE1kn38BOKIR8RTES5xhYIAQlA/z
IFvNH27P8NEoy51ZjsJw==;
Received: from localhost ([::1] helo=bombadil.infradead.org)
by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))
id 1vi6fq-00000003OiY-3n89;
Tue, 20 Jan 2026 08:01:15 +0000
Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05])
by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))
id 1vi6fL-00000003O9J-1kRi;
Tue, 20 Jan 2026 08:00:47 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version
:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:
Content-Type:Content-ID:Content-Description;
bh=qI6wNHPUAM5kV1n4KodkogzZYXjOHHmvxwFuF+H/mNU=; b=URiVdcQHtzsc+xUy3je8fcry6g
K6X1yukbxfwriaH0PuHHLTtPFHZcshxhtopBGRdioX+hKlAw2b0ILCG5sqg50hKsJbYncR1vNrNrv
AT9NBtwFmn+jBMIw5yUUJOvIaWjOkrTvgqHHnOcqpPo+VY5rojxFDuM8Ss5yGFpw2ptFZLQqSCRmc
Y02Xyw1x64PRtff0W5xzTVSkR+Wmjuh5xDr/QuK5g+mIlbjA9wE002E2VPjU4eq+Ihp5NHPtAe0ug
KHp62U30sJ3q8L421MTMRdYpFRUB1UHiCiF4vzpNz8jL/8i5QPHowx6Nrp4zCj0yj36wh4r0bKhHH
qpI+YAZQ==;
Received: from mx0a-0031df01.pphosted.com ([205.220.168.131])
by desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))
id 1vi6fG-0000000DX1U-0LSv;
Tue, 20 Jan 2026 08:00:42 +0000
Received: from pps.filterd (m0279865.ppops.net [127.0.0.1])
by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id
60K18Uo53366428;
Tue, 20 Jan 2026 08:00:22 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
cc:content-transfer-encoding:date:from:in-reply-to:message-id
:mime-version:references:subject:to; s=qcppdkim1; bh=qI6wNHPUAM5
kV1n4KodkogzZYXjOHHmvxwFuF+H/mNU=; b=GLEDVYdopU+rHz9Qn55XEC0I0t7
EKianR2ONjjFuyLO2p/BGwvhpmS1UEaD7FOFGY2q8AEHABfoHoGcF8lOye7RC5ik
uop8SeYxSXUUdpF+n1ZSFivPsr/12wdcUeB0aVQR7fZTYbA2mRVc2ymwXG0cTs6U
tzbIS3rpez2LqUc9o+hRgNqetyo7XO5WfrrDON/vt7a8MIe2Fz+Xz6KnNUojibAx
qLGVut1HzOJoOreRbLjnWXSvI9aN9vauDTmOMiNGU1RpT2aFRMMVUt4jkaOxh94U
ih2nrW/nlIQgljbsaL5/fWuhHpefmwMheBCgVt5Ygo0xDTAQd0pEEFRzZYw==
Received: from apblrppmta02.qualcomm.com
(blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19])
by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bsysb11kr-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 20 Jan 2026 08:00:21 +0000 (GMT)
Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1])
by APBLRPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTP id
60K80Fms007858;
Tue, 20 Jan 2026 08:00:17 GMT
Received: from pps.reinject (localhost [127.0.0.1])
by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 4br3gm8q72-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 20 Jan 2026 08:00:17 +0000
Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com
[127.0.0.1])
by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 60K80FZc007832;
Tue, 20 Jan 2026 08:00:17 GMT
Received: from hu-devc-blr-u24-a.qualcomm.com (hu-anuppate-blr.qualcomm.com
[10.131.36.165])
by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 60K80HHU008007
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 20 Jan 2026 08:00:17 +0000
Received: by hu-devc-blr-u24-a.qualcomm.com (Postfix, from userid 486687)
id D3101255B8; Tue, 20 Jan 2026 13:30:14 +0530 (+0530)
From: Anup Patel <anup.patel@oss.qualcomm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Atish Patra <atish.patra@linux.dev>
Cc: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <pjw@kernel.org>,
Alexandre Ghiti <alex@ghiti.fr>, Shuah Khan <shuah@kernel.org>,
Anup Patel <anup@brainfault.org>,
Andrew Jones <andrew.jones@oss.qualcomm.com>,
kvm-riscv@lists.infradead.org, kvm@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Anup Patel <anup.patel@oss.qualcomm.com>
Subject: [PATCH 19/27] RISC-V: KVM: Redirect nested supervisor ecall and
breakpoint traps
Date: Tue, 20 Jan 2026 13:30:05 +0530
Message-ID: <20260120080013.2153519-20-anup.patel@oss.qualcomm.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20260120080013.2153519-1-anup.patel@oss.qualcomm.com>
References: <20260120080013.2153519-1-anup.patel@oss.qualcomm.com>
MIME-Version: 1.0
X-QCInternal: smtphost
X-QCInternal: smtphost
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800
signatures=585085
X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800
signatures=585085
X-Proofpoint-GUID: qAwbtOiHlOC7r_BIXwCYL-lBI9TlGOD0
X-Authority-Analysis: v=2.4 cv=XJ89iAhE c=1 sm=1 tr=0 ts=696f3615 cx=c_pps
a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17
a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8
a=e_FZhwwmXlOSAvXo2IMA:9
X-Proofpoint-ORIG-GUID: qAwbtOiHlOC7r_BIXwCYL-lBI9TlGOD0
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIwMDA2NSBTYWx0ZWRfX32zTKRgHLzXw
1Z05zNKr7gROMUr244TOpz6f74vJBbim2dgKY8+Nf+dd07q8H2jxx7CgnBEET0K3YzB1UHQfKz3
uVQv5Xe2ScLIGDb1irgCjJLsEZ8gMSYtKpH+vZNJkyPFg4WtXQu3N0NqFKXA7SqLiEOqDJu6fPw
7t/TNdjYVx/U4URTSJtnfrUtdW682jCWnV7nKKYkVlRJwbi5E5apGcQ8nYT0hsrMJAG5QiRAvu6
gQC2fumEBa4zQrUMDhU0QiR3+25OY6ZEBLrGi+LU9qIxEBLdcw3GTlgPF76P53KO80hps7v/w2A
xEJAourWMhwJkMQKOw/WnKdCXRz8ewN+nT2qTFIDOo9xYtr6FO31vitieYdZECkpwJ8e/6IjksY
P7oOMseahCKH/xgf0/naXKY0HN43Q8qtPikE2E7nLiO+4RbOIWGny4zHGDMLoPXNPdr8hkY7Z7i
4xLDVXORROufuhDngMA==
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49
definitions=2026-01-20_02,2026-01-19_03,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
priorityscore=1501 malwarescore=0 suspectscore=0 impostorscore=0 adultscore=0
bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0
classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0
reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601200065
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20260120_080038_518263_B17BEE42
X-CRM114-Status: GOOD ( 12.50 )
X-Spam-Score: -0.8 (/)
X-Spam-Report: Spam detection software,
running on the system "desiato.infradead.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: The supervisor ecall and breakpoint traps from Guest
VS/VU-mode
(aka L2/nested guest) should be redirected to Guest HS-mode (aka L1/guest
hypervisor). Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> ---
arch/riscv/kvm/vcpu_exit.c | 12 +++++++++--- 1 file changed,
9 insertions(+),
3 deletions(-)
Content analysis details: (-0.8 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The
query to Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[205.220.168.131 listed in
sa-trusted.bondedsender.org]
0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to
Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[205.220.168.131 listed in
sa-accredit.habeas.com]
0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to
Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[205.220.168.131 listed in
bl.score.senderscore.com]
-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low
trust
[205.220.168.131 listed in list.dnswl.org]
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
-0.0 SPF_PASS SPF: sender matches SPF record
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK
signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
X-BeenThere: kvm-riscv@lists.infradead.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: <kvm-riscv.lists.infradead.org>
List-Unsubscribe: <http://lists.infradead.org/mailman/options/kvm-riscv>,
<mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe>
List-Archive: <http://lists.infradead.org/pipermail/kvm-riscv/>
List-Post: <mailto:kvm-riscv@lists.infradead.org>
List-Help: <mailto:kvm-riscv-request@lists.infradead.org?subject=help>
List-Subscribe: <http://lists.infradead.org/mailman/listinfo/kvm-riscv>,
<mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "kvm-riscv" <kvm-riscv-bounces@lists.infradead.org>
Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org
|
| Series |
Nested virtualization for KVM RISC-V
|
expand
|
diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c index aeec4c4eee06..6627c2c25a71 100644 --- a/arch/riscv/kvm/vcpu_exit.c +++ b/arch/riscv/kvm/vcpu_exit.c @@ -274,12 +274,18 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, ret = gstage_page_fault(vcpu, run, trap); break; case EXC_SUPERVISOR_SYSCALL: - if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) + if (kvm_riscv_vcpu_nested_virt(vcpu)) + ret = vcpu_redirect(vcpu, trap); + else if (vcpu->arch.guest_context.hstatus & HSTATUS_SPV) ret = kvm_riscv_vcpu_sbi_ecall(vcpu, run); break; case EXC_BREAKPOINT: - run->exit_reason = KVM_EXIT_DEBUG; - ret = 0; + if (kvm_riscv_vcpu_nested_virt(vcpu)) { + ret = vcpu_redirect(vcpu, trap); + } else { + run->exit_reason = KVM_EXIT_DEBUG; + ret = 0; + } break; default: break;
The supervisor ecall and breakpoint traps from Guest VS/VU-mode (aka L2/nested guest) should be redirected to Guest HS-mode (aka L1/guest hypervisor). Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> --- arch/riscv/kvm/vcpu_exit.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)