From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31AA7CCD184 for ; Sun, 19 Oct 2025 15:17:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vAV9i-0002FY-Ov; Sun, 19 Oct 2025 11:17: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 1vAV9f-0002F4-Jp for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:17:07 -0400 Received: from mailgate01.uberspace.is ([2001:1a50:11:0:c83f:a8ff:fea6:c8da]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vAV9d-0003Fb-7E for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:17:07 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate01.uberspace.is (Postfix) with ESMTPS id 0B41460A7F for ; Sun, 19 Oct 2025 17:17:04 +0200 (CEST) Received: (qmail 23926 invoked by uid 990); 19 Oct 2025 15:17:03 -0000 Authentication-Results: skiff.uberspace.de; auth=pass (plain) Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sun, 19 Oct 2025 17:16:59 +0200 From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , Richard Henderson , Mark Cave-Ayland , Artyom Tarasenko Subject: [PATCH v8 20/25] target/sparc: call plugin trap callbacks Date: Sun, 19 Oct 2025 17:15:09 +0200 Message-ID: X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.999996) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.599996 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=bDx+90yCB776gfOKaTfPut3XrCuPFgmm569DSUJF6Ic=; b=annyLzFpt/EjnY415ouuO+OA6+B3kAVpGSovGw+mcLhnM60fCsgGX/heHvJTCnOk+xFI+A28li RzNu49PljCPIRdE4MfVAskumUIQFKsdgpDsBbRfaIwVecmafw/AYJSU4tG2AtviRoDWdnZ7ynVZU lIVRID5JeltqTB4VAXz667htbsm6UXwqFIFSv+ljiINX+b6fTaUISfYfXKnbpJS8ltaOSPBRYNF/ ffwF3QZ96zDEkcoyRQVJ8f0frv2zCRTwbqrp503ARKqgDOQJsN+p2V0xGHId8jxtDg6cXwwgSiTU V0G+kqXyA6tTymqqi95B+u8gDj8YcdvbshlRzT+BC9SEJiZjPN/r0WZtdtwmIbcOGB1XhTVjR7dN fvdyq4BwstoLnkjwm6ty3Bp8IxQgMlBwnZKt4VpPQvuYitHmbIYLMJ112VQK6f1KpF0A8QHUAfyd icsL8uaUW/JWmubBM9AL2DZPfcsfGMOIRX0XPU6NRCtlFUZwMoTr+H/Dlvk4Nv7MnhhzmjPeji+B McIYDqjMhvIHdcOGPpIrFSOZTba708b0bJV9WKyUcC77NQpFJjO+e5fq6tTY4+I2btpAkChw6hdk qVYjoWeLhxwN0WHDWlwtOnbdNDf3yzYJLU5e9i4FfDZiL1IQUBnCNgboOb4dGefwAO9GKxWptZnH M= Received-SPF: pass client-ip=2001:1a50:11:0:c83f:a8ff:fea6:c8da; 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, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 hooks for SPARC (32bit and 64bit) targets. We treat any interrupt other than EXTINT and IVEC as exceptions as they appear to be synchroneous events. Reviewed-by: Richard Henderson Signed-off-by: Julian Ganz --- target/sparc/int32_helper.c | 7 +++++++ target/sparc/int64_helper.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/target/sparc/int32_helper.c b/target/sparc/int32_helper.c index fdcaa0a578..b29f693a6b 100644 --- a/target/sparc/int32_helper.c +++ b/target/sparc/int32_helper.c @@ -24,6 +24,7 @@ #include "accel/tcg/cpu-ldst.h" #include "exec/log.h" #include "system/runstate.h" +#include "qemu/plugin.h" static const char * const excp_names[0x80] = { [TT_TFAULT] = "Instruction Access Fault", @@ -174,4 +175,10 @@ void sparc_cpu_do_interrupt(CPUState *cs) env->qemu_irq_ack(env, intno); } #endif + + if (intno == TT_EXTINT) { + qemu_plugin_vcpu_interrupt_cb(cs, env->regwptr[9]); + } else { + qemu_plugin_vcpu_exception_cb(cs, env->regwptr[9]); + } } diff --git a/target/sparc/int64_helper.c b/target/sparc/int64_helper.c index 96ef81c26c..60ab0478fc 100644 --- a/target/sparc/int64_helper.c +++ b/target/sparc/int64_helper.c @@ -24,6 +24,7 @@ #include "exec/helper-proto.h" #include "exec/log.h" #include "trace.h" +#include "qemu/plugin.h" #define DEBUG_PCALL @@ -256,6 +257,15 @@ void sparc_cpu_do_interrupt(CPUState *cs) } env->npc = env->pc + 4; cs->exception_index = -1; + + switch (intno) { + case TT_EXTINT: + case TT_IVEC: + qemu_plugin_vcpu_interrupt_cb(cs, tsptr->tpc); + break; + default: + qemu_plugin_vcpu_exception_cb(cs, tsptr->tpc); + } } trap_state *cpu_tsptr(CPUSPARCState* env) -- 2.49.1