From nobody Sat Sep 6 17:35:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1757019058; cv=none; d=zohomail.com; s=zohoarc; b=T78DtvM0/LcJiwuJx4mrCAf0raiFeQS4RBTOOivC+QF9nUcJO1IrDFTDN69cxTJyKJN7xeUcUF3Jxfb4XQsf/n9nlqLM2RZWRowk3tFK3ncPQIs+f4sOZlM3LRkoVd9Iug/2Nd0mr2n7de8x+eYPA7jh4xuyM60CDZNnnL2yJyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757019058; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GfWrLCChDIPGQtG441x7aq6NZsqG+VfGd9i82c/KPrU=; b=hZP8MIZC1F7n4Rlz66tDEJ2l5LQ2MGwFGr/Zh/mXUZiOMhmR5/m+lGt9m9QFQ38nP0F7VXuuai4t11gc4ZMfze14w5E8O0G1C1dqjYIsiQOAFL6yweSr2jlWoJixq/pjvB41tHYbTmx/j9anHACV4ugkwVPf6vPpHHzta5mCL8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757019058103674.4517062360576; Thu, 4 Sep 2025 13:50:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uuGsM-0003c7-Kq; Thu, 04 Sep 2025 16:48:10 -0400 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 1uuGsI-0003b2-Tx for qemu-devel@nongnu.org; Thu, 04 Sep 2025 16:48:07 -0400 Received: from mailgate01.uberspace.is ([95.143.172.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uuGs9-0000jm-56 for qemu-devel@nongnu.org; Thu, 04 Sep 2025 16:48:06 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate01.uberspace.is (Postfix) with ESMTPS id B963F60C21 for ; Thu, 4 Sep 2025 22:47:22 +0200 (CEST) Received: (qmail 32681 invoked by uid 990); 4 Sep 2025 20:47:22 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Thu, 04 Sep 2025 22:47:22 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , "Edgar E. Iglesias" Subject: [PATCH v6 12/25] target/microblaze: call plugin trap callbacks Date: Thu, 4 Sep 2025 22:46:49 +0200 Message-ID: <829dc282fcf037d44681ba88be4dd9e17c644376.1757018626.git.neither@nut.email> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.998444) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.598444 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=rM5JX9zlQ9WGxAYK3Aunbsrp/Za/oYwP9iC2VqK2Yd4=; b=msxdpSIb4Yu+2qhO55qz2NfIUnZ3CxlanAcRPoz7BPA/tG1uuW1lyYmU98KwDj6hnB0UZzz1x3 fQV4lG416C0zaq/anFAtfODdbca5+0d8xvsAf4l2n8ya5Z/5SJ/u7dJ4K1pf3PT6L8s0XY++x6Gd rrcph09Sm5/avtWShMAd3CEeUiQaWpz15qCfn8GKBUP3EdiGSWkJZQb9co7SvgKtzI65fV/4vPkv Hol1ZXdKhczd5Srp9jx5LgFdPKq9huUVHp6aX7WK2fgSQLlgtbtBM8H32oyvAd6ocMX9q//yWbsa MZpkT2YFPy76EcBiuiVZZw3gBIcWjE+4X4kRBXaW/rk3zFB8KBcWOuxwyDn4fWB6gVYpAwVplyUh e3aN1fqpC7h3gHcbDJqb31Z94n65xVoElqdfYpMfQH8kfSv7eKGdvHzRu01caUVzg3fEqPyGGzoC a454d531gJaGaew0IlSJwbytjxuG2Y4bcvn64oEZLawNNr+uOs5vM1blZvssAk7yRqO471vnbTUE Hj9gMVGF4li3gW//MPKNyxdBvbf0rh7BD2ti1Xw1/801XrRntMina+O75rnshlWXu2uPXnYEeIUw h+3cPlAdhXgHpJ2UuVOQUD8Bft/TPnaztSHLsVk0SwI8Fv4VInZdJaOVy8CZxMX6/i+gJ9EkgL+s 8= 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=95.143.172.20; envelope-from=neither@nut.email; helo=mailgate01.uberspace.is 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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: 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-ZohoMail-DKIM: pass (identity @nut.email) X-ZM-MESSAGEID: 1757019059303124100 Content-Type: text/plain; charset="utf-8" We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places the hook for MicroBlaze targets. This architecture has one special "exception" for interrupts and no host calls. Signed-off-by: Julian Ganz --- target/microblaze/helper.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index ef0e2f973f..d66eab6e4b 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -27,6 +27,7 @@ #include "qemu/host-utils.h" #include "exec/log.h" #include "exec/helper-proto.h" +#include "qemu/plugin.h" =20 =20 G_NORETURN @@ -35,6 +36,7 @@ static void mb_unaligned_access_internal(CPUState *cs, ui= nt64_t addr, { CPUMBState *env =3D cpu_env(cs); uint32_t esr, iflags; + uint64_t last_pc =3D env->pc; =20 /* Recover the pc and iflags from the corresponding insn_start. */ cpu_restore_state(cs, retaddr); @@ -54,6 +56,7 @@ static void mb_unaligned_access_internal(CPUState *cs, ui= nt64_t addr, env->ear =3D addr; env->esr =3D esr; cs->exception_index =3D EXCP_HW_EXCP; + qemu_plugin_vcpu_exception_cb(cs, last_pc); cpu_loop_exit(cs); } =20 @@ -152,6 +155,7 @@ void mb_cpu_do_interrupt(CPUState *cs) CPUMBState *env =3D &cpu->env; uint32_t t, msr =3D mb_cpu_read_msr(env); bool set_esr; + uint64_t last_pc =3D env->pc; =20 /* IMM flag cannot propagate across a branch and into the dslot. */ assert((env->iflags & (D_FLAG | IMM_FLAG)) !=3D (D_FLAG | IMM_FLAG)); @@ -256,6 +260,12 @@ void mb_cpu_do_interrupt(CPUState *cs) env->res_addr =3D RES_ADDR_NONE; env->iflags =3D 0; =20 + if (cs->exception_index =3D=3D EXCP_IRQ) { + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); + } else { + qemu_plugin_vcpu_exception_cb(cs, last_pc); + } + if (!set_esr) { qemu_log_mask(CPU_LOG_INT, " to pc=3D%08x msr=3D%08x\n", env->pc, msr); --=20 2.49.1