From nobody Fri Nov 14 23:30:19 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=1759744771; cv=none; d=zohomail.com; s=zohoarc; b=VcP00bV4r1/ZonvwKJNdYXlMcxSnwUApx0CX0LGUO1/67UDPSygXbCUUZHSZ6iW0UQJ67XV+r4uSTJ/Jr0IzQfFVxuV408c4NjYpU+Er5Uypr8GQj9++sHqwRRI1pJAWTt6dwjSDAyv2fBsdI+v6AFZySvCfkETY9YFuGbtq+I0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1759744771; 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=OqVhOjCUV+Ix2ZzxVYY8v0CaUII/djqKW2yXvYxdVIcsTAhPKQGlfukBNIA9BokMkVYS0JstKwe1fwhuvtOnOSa81eCZR+m/ybYPMYG/Dqi1enIL5pdmHbP5MzfeurFf1RSi6PApf0FZWQl5ezzfjAzGFuaUPUij9wk91pKjiFs= 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 1759744771389437.0162089440547; Mon, 6 Oct 2025 02:59:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v5hyl-0006Qf-3q; Mon, 06 Oct 2025 05:58:03 -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 1v5hyc-0006N0-Tv for qemu-devel@nongnu.org; Mon, 06 Oct 2025 05:57:54 -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 1v5hyZ-0003pb-VZ for qemu-devel@nongnu.org; Mon, 06 Oct 2025 05:57:54 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate01.uberspace.is (Postfix) with ESMTPS id 018B560BAE for ; Mon, 6 Oct 2025 11:57:41 +0200 (CEST) Received: (qmail 18790 invoked by uid 990); 6 Oct 2025 09:57:40 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Mon, 06 Oct 2025 11:57:40 +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 v7 12/25] target/microblaze: call plugin trap callbacks Date: Mon, 6 Oct 2025 11:57:07 +0200 Message-ID: <4c5496cbe92eb59503352e26968d183ee6272581.1759744337.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.997498) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.597498 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=AoTi29uvqH5RlKyI7bmlGRGxOCUyPypkqZFbp9923HNaiPN/1bTBniKmdh4+CRZl8k1jF/Nhzr 3bCYwVxBqEC5ErfV1cYr0KrxLaRHgRkf44dxqq9ARUFVMV/KidKdi95cDtk95ytetAhUCw0i3K2d Cmvl3rGSUptCNScNZAmXi0F5DV1b85NiMcxdWw7Kw2/0XebLK9l9Rq/T/SIs14+APSBnfM+jzqRW dDJeZuSPtjPlPQDdq1o0zzh0SPAF/fA7YZRwE+/b4aRnsE28n4YpXKZtfxiD6W+BAK/FwJuTtS6W ReJGlQfZ1juOmdpC9MyfK7XbOb2IaZzpuB3y+UV9gJyaHoke1/7QlF9fdqC5AAAAx5LA8iapY5mU /i93muEhsi9hpbhjFUPlhzpTlsca0Sf6iQgS8aqo90+IH+QxEUUOlugeAsSJHVK64SKBMTH0dq+W Vic1bdjvhMbObK00MKagjR3c4g+L0nsro3pv0VYquLL6v9E3hbuFznKXNf7PuyVNgkvLzHb/ViUt RuW7z8wA2/6fH4WEk5c7Z1XkI/9s6gQgjP3VpWVKThTlK2jYAas0QIUTxlcFQOKLfXEDwxFbqd0o oLh+he8tuCJ8acjMsBL5SdhPubi6WHcVSoLXrD8ewsqweQdgJ9K27barxPzf6KCPVEemEF+corZ3 E= 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1759744774223116600 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