From nobody Wed Oct 23 01:21:10 2024 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=1729356122; cv=none; d=zohomail.com; s=zohoarc; b=FfrVrW8rpxZijICQO/1bXiDLnmZsxyusOYWGMykoBy5HFcilQ+4YwPxGW3a2XufS0je79AjtaQDV5E8Z5ncUMi0rP2s1f9TAzpJPryb++68sfLN1L5JCnKRueOmQ5S2STuowUU01ui/ZEonAogyXIjfPHUewPv42bThBt5+CuwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729356122; 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=K8LwL4AwsmRC5ZhKV0z0+73sn+zkdmH711mLNzoMSEU=; b=n/LpvuAA13icCfh8CduWXkqCmXQTwo5UidP6plqxCV3DQkvYziGksydzrXmeImMD8zyE45a9c2i/6nUf+lfds1Z34xOpkmNZC0t2q2it/Npj0sHlQ4XKg8WeTPYy2MJz8e8KK6se9jk1H3+/Lbi76cmqagps8WeXyoSwEKUltMk= 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 1729356122180796.2643275761047; Sat, 19 Oct 2024 09:42:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2CUx-0001zp-EB; Sat, 19 Oct 2024 12:40:15 -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 1t2CUv-0001yu-Dp for qemu-devel@nongnu.org; Sat, 19 Oct 2024 12:40:13 -0400 Received: from mailgate02.uberspace.is ([185.26.156.114]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2CUt-0003zY-Qr for qemu-devel@nongnu.org; Sat, 19 Oct 2024 12:40:13 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate02.uberspace.is (Postfix) with ESMTPS id 31DDF17F810 for ; Sat, 19 Oct 2024 18:40:00 +0200 (CEST) Received: (qmail 9824 invoked by uid 990); 19 Oct 2024 16:40:00 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sat, 19 Oct 2024 18:40:00 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , Mark Cave-Ayland , Artyom Tarasenko Subject: [RFC PATCH v2 7/7] target/sparc: call plugin trap callbacks Date: Sat, 19 Oct 2024 18:39:40 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: <20231021122502.26746-1-neither@nut.email> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.994807) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.594807 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=0DIXz22ZQVybjpDzj+NirHJXZfr6QSriqPOofdXhjlE=; b=lzCnfXIllGcULlYAEBS9aQbHYKtUBBQmsR6BkMlfr208O3+okvULCTX8gFPY1OawgtFs5EGfAQ XHsHCAMXkDrbe9OTL4IiCQL4Tbd9/apwL048msbHroiHHzlxr3997HSsgirZo1TXoXtqJbFU9SoB 3M2vxSoqDwTGmql4NyGwY5i1EdgGWpOnRHnYO8/cV6QQ0qXRyQO529FbsKEFZFsY1eo0Ai1eJMcf bPmJHoMjagBYqOMVxOrBYrA5iR6lv3kxBMIbKPb4hd3SPt7kQzPZPKFpgwxgQFTsHIBFrr/mFDQw HcM8gS84jLvja9Tx1+sY5DfB9d0UBR3fA9wh/HYUXAtgVhE0WtfiWWpwD6ehNa8HsjVhRWVcALuf 6RXboiSasx4t7pQqadXFzpEb7cKcDOP289QzWp9xzX12iThtTyspC0B+hQsoj4IXqURPWvI7pGzq 4vYF/QiczlD0gaLNIGFvTHB3Gyq2fP5gfF0pTqgzr0mS26oynbsQbSUx1m2cU9YmBkRRdPXHw5+X Zdl4CMIDQC3H1Hf9z1aJiLILsEgDfQOxdVc6YGiyNHAqT+LX9ZbNwD1Dd0j7JJbBy+pZIb3dVvqJ DgIQy5hcXkV4JM79PjAx31IvaSf18AcA2E9ObNu4ZZ3WCSt7dgMV4MAxx3JvPnQd12GxgyYBE+Kp s= 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=185.26.156.114; envelope-from=neither@nut.email; helo=mailgate02.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: 1729356123789116600 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 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. Also note that SPARC targets do not have semihosting events. 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 f2dd8bcb2e..4eb41694f7 100644 --- a/target/sparc/int32_helper.c +++ b/target/sparc/int32_helper.c @@ -24,6 +24,7 @@ #include "exec/cpu_ldst.h" #include "exec/log.h" #include "sysemu/runstate.h" +#include "qemu/plugin.h" =20 static const char * const excp_names[0x80] =3D { [TT_TFAULT] =3D "Instruction Access Fault", @@ -172,4 +173,10 @@ void sparc_cpu_do_interrupt(CPUState *cs) env->qemu_irq_ack(env, intno); } #endif + + if (intno =3D=3D TT_EXTINT) { + qemu_plugin_vcpu_interrupt_cb(cs); + } else { + qemu_plugin_vcpu_exception_cb(cs); + } } diff --git a/target/sparc/int64_helper.c b/target/sparc/int64_helper.c index bd14c7a0db..f4175ef912 100644 --- a/target/sparc/int64_helper.c +++ b/target/sparc/int64_helper.c @@ -23,6 +23,7 @@ #include "exec/helper-proto.h" #include "exec/log.h" #include "trace.h" +#include "qemu/plugin.h" =20 #define DEBUG_PCALL =20 @@ -253,6 +254,15 @@ void sparc_cpu_do_interrupt(CPUState *cs) } env->npc =3D env->pc + 4; cs->exception_index =3D -1; + + switch (intno) { + case TT_EXTINT: + case TT_IVEC: + qemu_plugin_vcpu_interrupt_cb(cs); + break; + default: + qemu_plugin_vcpu_exception_cb(cs); + } } =20 trap_state *cpu_tsptr(CPUSPARCState* env) --=20 2.45.2