From nobody Mon Mar 2 11:03:19 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 1772186593057172.72893588075715; Fri, 27 Feb 2026 02:03:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvugZ-0001RW-V8; Fri, 27 Feb 2026 05:03:03 -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 1vvugW-0001R9-6H; Fri, 27 Feb 2026 05:03:00 -0500 Received: from mxhk.zte.com.cn ([160.30.148.35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vvugT-0003oO-Ix; Fri, 27 Feb 2026 05:02:59 -0500 Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4fMkR04Wtnz8Xs7G; Fri, 27 Feb 2026 18:02:52 +0800 (CST) Received: from xaxapp04.zte.com.cn ([10.99.98.157]) by mse-fl2.zte.com.cn with SMTP id 61RA2eZP079405; Fri, 27 Feb 2026 18:02:40 +0800 (+08) (envelope-from liu.xuemei1@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid32; Fri, 27 Feb 2026 18:02:43 +0800 (CST) X-Zmail-TransId: 2afa69a16bc3011-63ac1 X-Mailer: Zmail v1.0 Message-ID: <20260227180243309RupzclQ90f5u2KZTabSn0@zte.com.cn> In-Reply-To: <20260227180104794YvW9Rb2I_kAGzUruZL11Q@zte.com.cn> References: 20260227180104794YvW9Rb2I_kAGzUruZL11Q@zte.com.cn Date: Fri, 27 Feb 2026 18:02:43 +0800 (CST) Mime-Version: 1.0 From: To: , , , , Cc: , , Subject: =?UTF-8?B?W1BBVENIIDEvM10gdGFyZ2V0L3Jpc2N2L2t2bTogY3JlYXRlIGt2bV9yaXNjdl9haWFfYWNjZXNzX3JlZw==?= X-MAIL: mse-fl2.zte.com.cn 61RA2eZP079405 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.133 unknown Fri, 27 Feb 2026 18:02:52 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 69A16BCC.001/4fMkR04Wtnz8Xs7G 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=160.30.148.35; envelope-from=liu.xuemei1@zte.com.cn; helo=mxhk.zte.com.cn X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.306, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.668, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no 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: 1772186596454158500 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 Reviewed-by: Chao Liu --- 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