From nobody Sat Nov 15 22:35:31 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=1747668240; cv=none; d=zohomail.com; s=zohoarc; b=B06K/gMa5QUbgwq89DdK4kUC7gcGQ1CiZRY9bqdhoR8iQjw4ChgUzma0pDXO78DfQu8KXQ2T2O34rHWuuN6E2/wTAOVsKEB86o+PBQbCGiBYdsRFcL/qqrONzZzIilqxxqPkgRUAuMX9296mspLbCQj1935mHe7RJorowuKfQ1Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747668240; 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=u0YYc+z2EMH01w1J4eH6zoPxzMCds735jIpzCftFfKA=; b=S8v7+dGSFFMECyX1XfJVFHxWc7q2u9szW8s2Prtuc2wyDQvy0HA1uzXopMwFD7XQP24YtUo2s6bdSPqYFqAIumz8S/XHfP94Bid+zCsDMFfjIoxlAnc5NVu0JSQcofV+Oh7fmJmNOyN0Vud8OH4BIUpBJf25rcmgnui3O/dOgvM= 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 1747668240698193.46151071591294; Mon, 19 May 2025 08:24:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH2IX-00070W-HS; Mon, 19 May 2025 11:21:01 -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 1uH2IP-0006zW-Cp for qemu-devel@nongnu.org; Mon, 19 May 2025 11:20:53 -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 1uH2IM-0005VD-Px for qemu-devel@nongnu.org; Mon, 19 May 2025 11:20:52 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate02.uberspace.is (Postfix) with ESMTPS id 835DB180E9E for ; Mon, 19 May 2025 17:20:27 +0200 (CEST) Received: (qmail 1602 invoked by uid 990); 19 May 2025 15:20:27 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Mon, 19 May 2025 17:20:27 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , David Hildenbrand , Richard Henderson , Ilya Leoshkevich , Thomas Huth , qemu-s390x@nongnu.org (open list:S390 TCG CPUs) Subject: [PATCH v5 18/25] target/s390x: call plugin trap callbacks Date: Mon, 19 May 2025 17:19:58 +0200 Message-ID: <71507814db65ebc5bbf8e5944728a106f51e3808.1747666625.git.neither@nut.email> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.996855) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.596855 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=xX6ychV8ZQnfsmmBU699XHy/DI6ddqD8g0NA6IFVV98=; b=NWXiTaPDEUcy2U/RUKb8ptKnNvYFZl4wucXjg/xzl4/kl4SkQkUCNefVSQO+ZCbrWr26C/w8hN gQm1V3UAgLZ2KuYHiUXHx4VfsiEwGVTYEDu1zC+08roz202+CJYaP/S2TX5kfj3Ho9krt3HWgxHG 4oV4MHfJBvMsawCqT3QB8ekv+ef6x4m3hZE4PeO610GIieF9eqEhmfQ2i7Y4mBL+ptQ0pZ5KRD6z LXU+6+0QoQdd+H1x+p45/m7gp3z/JHilhbarpMY/U4Rdx5/qnD+ubHsGJqZFBJJ/xND8BLfrUvu5 vMj7mhHghIY9SS5T8f0AEZiOM3OwcxOBLPdoAOHH6k4busiHyFUEHLkEPQHw3brEd9ervL535Qp6 JwwQBqCX6U9uPlP5C9ry+GBD+fygbsooY1evgXyXXKQzjMOZJoP1loAlaobpS/57Lca27WYB6t1J jFLS0pItglLzRDR+RC97CqSSZVT9fYOPC/QngvPi8NjDJEY6NS5H3968c5WyZZlOmss2urfMnA+e QZN3fpyYOC+e7s7Tp9Qdy11ktnudZmVxD+wOxFmMfISXhJonXGePdPvlOJvAx6xitGSIJGVdUmuo gC8WBdie48Eypo47wbwGVSuXIBxsWAopqkxnSk00XdPfMDjpq15c53kJg3IeYL6dBKQBzjrQpaVO c= 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_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: 1747668241412116600 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 IBM System/390 targets. We treat "program interrupts" and service calls as exceptions. We treat external and io "exceptions" as well as resets as interrupts. Acked-by: David Hildenbrand Signed-off-by: Julian Ganz Reviewed-by: Richard Henderson --- target/s390x/tcg/excp_helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c index e4c75d0ce0..b7e7a4deff 100644 --- a/target/s390x/tcg/excp_helper.c +++ b/target/s390x/tcg/excp_helper.c @@ -34,6 +34,7 @@ #include "hw/s390x/s390_flic.h" #include "hw/boards.h" #endif +#include "qemu/plugin.h" =20 G_NORETURN void tcg_s390_program_interrupt(CPUS390XState *env, uint32_t code, uintptr_t ra) @@ -499,6 +500,7 @@ void s390_cpu_do_interrupt(CPUState *cs) S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; bool stopped =3D false; + uint64_t last_pc =3D cpu->env.psw.addr; =20 qemu_log_mask(CPU_LOG_INT, "%s: %d at psw=3D%" PRIx64 ":%" PRIx64 "\n", __func__, cs->exception_index, env->psw.mask, env->psw.a= ddr); @@ -528,21 +530,27 @@ try_deliver: switch (cs->exception_index) { case EXCP_PGM: do_program_interrupt(env); + qemu_plugin_vcpu_exception_cb(cs, last_pc); break; case EXCP_SVC: do_svc_interrupt(env); + qemu_plugin_vcpu_exception_cb(cs, last_pc); break; case EXCP_EXT: do_ext_interrupt(env); + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); break; case EXCP_IO: do_io_interrupt(env); + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); break; case EXCP_MCHK: do_mchk_interrupt(env); + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); break; case EXCP_RESTART: do_restart_interrupt(env); + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); break; case EXCP_STOP: do_stop_interrupt(env); --=20 2.49.0