From nobody Sun Feb 8 22:35:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576529402; cv=none; d=zohomail.com; s=zohoarc; b=TNSwiI0eTnoPgFD+KFWkA+G+56cKvIKCouik65jht7zRaqkZYFuwndhjPPKPmftBLbl2fYiu0pA4vKeZt59g306dR9e7FzdgFenyZw7r8yk2BATTx4VYJmVyVnOfpdCDdDX3vzij9x1VNH3z8ENfQY/jNPMpXPzZWUIFV2Rkm6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576529402; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5QgGQR5lmCzHdU2tw8u26Dp0LVz138MaKuXfv7AyzLc=; b=S4OU9CvXg0KEtrbQegCCJUdTqCLf7ek5vPUgQIeesWNCObEcEJprzyit4T+1LWqrWSzd9ZRthR/a3tH07EOwtLtWXHelQNN4Y4YJbq+EMI//17hvAS4Z4UQK1qiBRR+1Gt3ZlOg4U/lvs4AO4wxyUEp5aEadsx0igUKpwPEoPlQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576529402530127.76960322555954; Mon, 16 Dec 2019 12:50:02 -0800 (PST) Received: from localhost ([::1]:59762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igxJY-0000Tx-VH for importer@patchew.org; Mon, 16 Dec 2019 15:50:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36273) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igxHv-0006tf-Am for qemu-devel@nongnu.org; Mon, 16 Dec 2019 15:48:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igxHu-0006N7-Bm for qemu-devel@nongnu.org; Mon, 16 Dec 2019 15:48:19 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56716 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1igxHu-0006LK-7z for qemu-devel@nongnu.org; Mon, 16 Dec 2019 15:48:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-BnUFytWeO2mWLhhFFJvweA-1; Mon, 16 Dec 2019 15:48:12 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA7BC108EE8B; Mon, 16 Dec 2019 20:48:10 +0000 (UTC) Received: from laptop.redhat.com (ovpn-116-117.ams2.redhat.com [10.36.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id F38875D9C9; Mon, 16 Dec 2019 20:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576529294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5QgGQR5lmCzHdU2tw8u26Dp0LVz138MaKuXfv7AyzLc=; b=JuT3wKT0NUxnVUL8Gyg/dpTnyQoBym9nVOgh7O523VxgLg16wTTrR8XwacysfLy3N4Z3VT pxi4oGbx5gpTW6aOO6jv28TTY0FisaXEoQltAep1ztiMamCqhIvgZ3s0jEZoRVpnKQbU75 Im3JH9SwdXCDxTxbinBcqRvqPOntw8c= X-MC-Unique: BnUFytWeO2mWLhhFFJvweA-1 From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, maz@kernel.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [kvm-unit-tests PATCH 01/10] arm64: Provide read/write_sysreg_s Date: Mon, 16 Dec 2019 21:47:48 +0100 Message-Id: <20191216204757.4020-2-eric.auger@redhat.com> In-Reply-To: <20191216204757.4020-1-eric.auger@redhat.com> References: <20191216204757.4020-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, andrew.murray@arm.com, drjones@redhat.com, alexandru.elisei@arm.com, andre.przywara@arm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Andrew Jones Sometimes we need to test access to system registers which are missing assembler mnemonics. Signed-off-by: Andrew Jones Reviewed-by: Alexandru Elisei --- lib/arm64/asm/sysreg.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h index a03830b..a45eebd 100644 --- a/lib/arm64/asm/sysreg.h +++ b/lib/arm64/asm/sysreg.h @@ -38,6 +38,17 @@ asm volatile("msr " xstr(r) ", %x0" : : "rZ" (__val)); \ } while (0) =20 +#define read_sysreg_s(r) ({ \ + u64 __val; \ + asm volatile("mrs_s %0, " xstr(r) : "=3Dr" (__val)); \ + __val; \ +}) + +#define write_sysreg_s(v, r) do { \ + u64 __val =3D (u64)v; \ + asm volatile("msr_s " xstr(r) ", %x0" : : "rZ" (__val));\ +} while (0) + asm( " .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,2= 4,25,26,27,28,29,30\n" " .equ .L__reg_num_x\\num, \\num\n" --=20 2.20.1