From nobody Sat Apr 11 23:07:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=zte.com.cn Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772702440223954.9575157908292; Thu, 5 Mar 2026 01:20:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vy4sb-0001cq-8a; Thu, 05 Mar 2026 04:20:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vy4sV-0001cM-0D; Thu, 05 Mar 2026 04:20:19 -0500 Received: from mxct.zte.com.cn ([183.62.165.209]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vy4sP-0001ZA-Pq; Thu, 05 Mar 2026 04:20:15 -0500 Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4fRPBs03fpz51Sdb; Thu, 05 Mar 2026 17:20:05 +0800 (CST) Received: from xaxapp02.zte.com.cn ([10.88.97.241]) by mse-fl1.zte.com.cn with SMTP id 6259JuP5047644; Thu, 5 Mar 2026 17:19:56 +0800 (+08) (envelope-from liu.xuemei1@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid32; Thu, 5 Mar 2026 17:19:58 +0800 (CST) X-Zmail-TransId: 2af969a94abe283-66952 X-Mailer: Zmail v1.0 Message-ID: <20260305171958533kl0ISsA1hGkh97tu5LUWy@zte.com.cn> In-Reply-To: <20260305171729291ZzfxmqZ48P2Tbz9TGCtST@zte.com.cn> References: 20260305171729291ZzfxmqZ48P2Tbz9TGCtST@zte.com.cn Date: Thu, 5 Mar 2026 17:19:58 +0800 (CST) Mime-Version: 1.0 From: To: , , , , , , , Cc: , , Subject: =?UTF-8?B?W1BBVENIIHYyIDEvM10gdGFyZ2V0L3Jpc2N2L2t2bTogY3JlYXRlIGt2bV9yaXNjdl9haWFfYWNjZXNzX3JlZw==?= X-MAIL: mse-fl1.zte.com.cn 6259JuP5047644 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: liu.xuemei1@zte.com.cn X-SPF: None X-SOURCE-IP: 10.5.228.132 unknown Thu, 05 Mar 2026 17:20:05 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 69A94AC4.002/4fRPBs03fpz51Sdb 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; Received-SPF: pass client-ip=183.62.165.209; envelope-from=liu.xuemei1@zte.com.cn; helo=mxct.zte.com.cn X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.703, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.386, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1772702441950154100 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xuemei Liu Create common function kvm_riscv_aia_access_reg to access APLIC and IMSIC regs Signed-off-by: Xuemei Liu Acked-by: Alistair Francis --- target/riscv/kvm/kvm-cpu.c | 7 ++++++- target/riscv/kvm/kvm_riscv.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index befcbb0a9a..2c29d8d07c 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -58,6 +58,7 @@ void riscv_kvm_aplic_request(void *opaque, int irq, int l= evel) } static bool cap_has_mp_state; +static int aia_fd =3D -1; #define KVM_RISCV_REG_ID_U32(type, idx) (KVM_REG_RISCV | KVM_REG_SIZE_U32 = | \ type | idx) @@ -1842,13 +1843,17 @@ void kvm_arch_accel_class_init(ObjectClass *oc) "auto"); } +void kvm_riscv_aia_access_reg(int group, uint64_t addr, void *val, bool wr= ite) +{ + kvm_device_access(aia_fd, group, addr, val, write, &error_abort); +} + void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, uint64_t guest_num) { int ret, i; - int aia_fd =3D -1; uint64_t default_aia_mode; uint64_t socket_count =3D riscv_socket_count(machine); uint64_t max_hart_per_socket =3D 0; diff --git a/target/riscv/kvm/kvm_riscv.h b/target/riscv/kvm/kvm_riscv.h index 953db94160..cec13d9f31 100644 --- a/target/riscv/kvm/kvm_riscv.h +++ b/target/riscv/kvm/kvm_riscv.h @@ -23,6 +23,7 @@ void kvm_riscv_reset_vcpu(RISCVCPU *cpu); void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level); +void kvm_riscv_aia_access_reg(int group, uint64_t addr, void *val, bool wr= ite); void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, uint64_t aia_irq_num, uint64_t aia_msi_num, uint64_t aplic_base, uint64_t imsic_base, --=20 2.27.0