From nobody Fri Nov 14 19:47:07 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=1760887103; cv=none; d=zohomail.com; s=zohoarc; b=OJFzl2iwkuMEQHCf8OstlKyQNYs5X+etHmmjjpnmPt+Pojp87zPl9bZbsIgtfi96U+OwWztWu8ckMVgi6Ny7QcPcAN+pscU2b53fUmDKgHe8pJWqzVuFN3SKq8NqgXBWPB7fBUjtndNHxKDLEVI52rkIhLbaRzVPvCoA237jThU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760887103; 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=+ER/MqjaWJVEABzSQpRm+HQU+L1QnRyBXkRMNclVuFY=; b=a9MjyYgoNWGcMwa2ZPSfYYuHlER3nwMfR6vBFaK8QE91NaD0+fX/bw2GDg5RTggyo1Ut/OU29BAuVGXvkAZ/71nHWhBPRKpD/7WLJwHUjALRjv2VHwjniYTNY/rrliCY+k0MwRQ0HmuLhZ3r175J3BGtqcW8rtKr2Il3V8eOgUc= 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 1760887103715833.4473133464477; Sun, 19 Oct 2025 08:18:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vAV9L-00020a-Qy; Sun, 19 Oct 2025 11:16:47 -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 1vAV9K-00020C-D1 for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:16:46 -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 1vAV9I-0003D1-PZ for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:16:46 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate01.uberspace.is (Postfix) with ESMTPS id B8AB760AA8 for ; Sun, 19 Oct 2025 17:16:43 +0200 (CEST) Received: (qmail 23331 invoked by uid 990); 19 Oct 2025 15:16:43 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sun, 19 Oct 2025 17:16:43 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , Stafford Horne Subject: [PATCH v8 14/25] target/openrisc: call plugin trap callbacks Date: Sun, 19 Oct 2025 17:15:03 +0200 Message-ID: <7525e266c45664ce58a2c6c7f92318cad8e6caf7.1760884672.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.999965) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.599965 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=6By6W6p63fDAcZVupcavoMH8cQUKrNcCRvR5J3edyUo=; b=cKQImoW6i5GZkGR4Foqe/35EEAb7uprl7y/77gqlo3U7jSIS1IfAMpAE/3TdWqAEixBmUM0xn/ homBxCmjtVxTyKPVQAU7gZuCE26Zviga4RfVjGGiajaXlBwZIvGG3VHreF7z2Jmm7azYBjXQWr5F kYKL4Qow2e0qMaCLnochYWX4Wpf6tJnFUR1DSAH/9J/qB56K5mO1r8oBWoN67cZn6fqRdnGa0cgK gFsy7BYloGYXiHMfSN8G5dFd7tGIzjrn/0nw1utx2cBrkOmxPD3kCUjqPyP9q6T4kw/oXoyx/LHi OImX+7KgZzJh8dEQLeL9N4pKDkoN9YSGPNBTT4cugd6MknhBZlnbB5IJup9tqSawixeOUGSFdxgR 6AN0WPZV6wMfKRRdFezwVRX8gocvyPlN6L4uzPdVJvpbMAdpJpzR53QZqWnjeE5DwDLzQWUas/A8 KtXIHHFXaS+TiMircbcCdVDzZDIAko764MNgjhJM8s8K7KUT+XVKDKZgGO3j6Nezzo8hLZML5XFp IA4V24BPg9rbBikl5VwbLgJr/cGjWpVU+UziaGQP0Y/N5TjFVCHoY+rabn+d6r7myaLUbmvsms3X loFjYbjHJTKjI+zuyIxv01xLylZEQ70qMonc50Cbp0YryTGw+j9KM1dTKcLPoomeW3nJUbOYMLUU 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @nut.email) X-ZM-MESSAGEID: 1760887103981158500 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 OpenRISC targets. We treat anything other than resets, timer and device interrupts as exceptions. Signed-off-by: Julian Ganz Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/openrisc/interrupt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index 486823094c..d357aaa7da 100644 --- a/target/openrisc/interrupt.c +++ b/target/openrisc/interrupt.c @@ -25,11 +25,13 @@ #ifndef CONFIG_USER_ONLY #include "hw/loader.h" #endif +#include "qemu/plugin.h" =20 void openrisc_cpu_do_interrupt(CPUState *cs) { CPUOpenRISCState *env =3D cpu_env(cs); int exception =3D cs->exception_index; + uint64_t last_pc =3D env->pc; =20 env->epcr =3D env->pc; =20 @@ -98,6 +100,19 @@ void openrisc_cpu_do_interrupt(CPUState *cs) cpu_abort(cs, "Unhandled exception 0x%x\n", exception); } =20 + switch (exception) { + case EXCP_RESET: + /* Resets are already exposed to plugins through a dedicated callb= ack */ + break; + case EXCP_TICK: + case EXCP_INT: + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); + break; + default: + qemu_plugin_vcpu_exception_cb(cs, last_pc); + break; + } + cs->exception_index =3D -1; } =20 --=20 2.49.1