From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 447571AAE0B; Mon, 25 Nov 2024 17:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732554976; cv=none; b=jHMOh6tn1EuJZO4kDPP9sTE0O//pRWv3D9EWYWcE9S/r6Fau16cJfRZmi7bDcR3Rf9msO5SvlAMxR5zyIfVF0NcAQuCaDOP6r29purnSM2wkg2wZD9FhIDu+WyJHchf/vz3Y6AfOETL9R0YVJxsRHgAMWET89vOxV/5o54ob9Go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732554976; c=relaxed/simple; bh=xEF3uS740G2GZrrPT8qy4B7itCM1u7DlKJzqEyDF684=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=IrX4kk883uSdaAnIZFCQYZiT/yfJgbPdO8kvOrWAnCWdRP1zyO5wnJLhk/Imc9UMZA9eEOfvzZ5CjYRSHyuBeQn/sDHznNSsDoGRlY+ADMEAiHSKyhwWv/qu1inqUkQtv5P64nNhjAzbrtwobePj7BQBvNKipC/v/ZXFXFP+lPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L6IHlJge; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L6IHlJge" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6F8FC4CECE; Mon, 25 Nov 2024 17:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732554975; bh=xEF3uS740G2GZrrPT8qy4B7itCM1u7DlKJzqEyDF684=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L6IHlJge+qR0tE1Ih1IIN0gLnNGS5gSpqYFoa6CIBUwonfS0fz8C0f0wT6dzXRn3i yl9D/NpY8uytP7JnHK6T4RggrKhuR5XFSd1zhhtG/1uW3JUUJ+VFX8M503G4WUXXO0 ViyVczXf/8upMYvFrK51Q2aoJmWE6SgC0JmZexeQfID4lEw3cL3cguSQwaFNDZBMMl dmK6B4tH136w7lESym9fIUTngKS1l5EghsXUN+qnjrX+bEzrBADtajHcheo1zPKjnH /LYNfD7Szee90FiBXU8apaU3cm2CD5XdvYu3/I0IPtm+CY9dCq9SbRIeTdMPDdl1V2 b5vW1DLdwYK5w== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tFch3-00FlnF-It; Mon, 25 Nov 2024 17:16:13 +0000 Date: Mon, 25 Nov 2024 17:16:13 +0000 Message-ID: <86iksbutcy.wl-maz@kernel.org> From: Marc Zyngier To: =?UTF-8?B?6LWW5qCq6ZSL?= Cc: "kvm@vger.kernel.org" , kvmarm Subject: Re: Using the ldp instruction to access the I/O address space in KVM mode causes an exception In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: csumushu@gmail.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false + kvmarm On Mon, 25 Nov 2024 00:11:22 +0000, =E8=B5=96=E6=A0=AA=E9=94=8B wrote: >=20 > I am running ARM64 emulation using QEMU=E2=80=99s KVM mode on an ARM64 de= vice, but I encountered the following exception when booting the guest Linu= x kernel. > error: kvm run failed Function not implemented > PC=3Dffff800008e201e0 X00=3Dffff00208a63b000 X01=3D0000000000000000 > And the instruction pointed to by the PC register is > 0xffff800008e201e0: ldp q11, q12, [x22], where the address held by > the x22 register belongs to the address space of the nic. > After testing, it was found that using the ldp instruction to access > peripheral address spaces causes issues, but accessing RAM works > normally. What could be the cause of this issue, and are there any > solutions to resolve this problem? The cause of the issue is that such an instruction is not emulatable, because it uses more than a single register. In your case, it is even worse, as you are using FP registers to access emulated MMIO, something that is unlikely to work correctly on real HW (depending on the alignment of the address in x22). What QEMU *could* do is to implement enough instruction emulation (by reading the offending instruction from guest memory), and emulating it (see how KVM_CAP_ARM_NISV_TO_USER can be used for this purpose). But frankly, you are asking for trouble here, and you really should fix your code. Thanks, M. --=20 Without deviation from the norm, progress is not possible.