From nobody Fri Nov 14 19:42:46 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1761753528; cv=none; d=zohomail.com; s=zohoarc; b=F/KipETdtOUAmhLTRJvfhbhklPFa3qD7YwPCkJmjt2bMaTYd9iADVt8iFRMwG4Nx4vMT4DwFnISxfq/DZxABtpbjPo+D3kS64Ldpbn96ovEyv0FkDbJQXpz6ym75igRXEEr6S10o3ZMGlINohFI0OsKbONckI9eLohLRGh1/0qk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761753528; h=Content-Type: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=TrDTvZiJG4yDG73wsRxB9Wak97hDmOb6p4nvdjA0DcY=; b=Ht+cxI3qP1THz4peIoEHamr9BzKdSrjv2jzMg8jlzcaNXaKWi7OUuyOdtA3YFJmcXSGQbbJNN/m+aEfHCpXjt0yxUfQ69+cB+tbO3oh11ckcZW1BhYPqiLLbGiAv7Pn0je19F4lASnKg2G0ioOLzqSrRutpwOmbd36WjANAX1rQ= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17617535285049.826611518062009; Wed, 29 Oct 2025 08:58:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE8Yj-0005Mk-4C; Wed, 29 Oct 2025 11:58:02 -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 1vE8Yc-0005GG-Cd for qemu-devel@nongnu.org; Wed, 29 Oct 2025 11:57:55 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vE8YR-0003Xr-05 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 11:57:53 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-63bdfd73e6eso2196628a12.0 for ; Wed, 29 Oct 2025 08:57:35 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-64043e05a5esm2528748a12.4.2025.10.29.08.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Oct 2025 08:57:30 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CF74860CB8; Wed, 29 Oct 2025 15:50:47 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761753452; x=1762358252; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TrDTvZiJG4yDG73wsRxB9Wak97hDmOb6p4nvdjA0DcY=; b=NbuT+Q92QdTOl1L2fZ9ey+HdK5kIziIxicX66L9Cno4kIjgGGtQnKCUnnqNv9isBCx 6H7Xptc6LAX4iCb9F1xWIhlq79f4Dua0AO2AxVmLRnR010ZiT4lTznpmoKuwM8PooQJY 85NXqcSpDkqZ3PQDIh95DBPbp7ikf6glywY1FiBUkw+V0pNOmFpIqm8jX7AIzVe8KB89 iHfR+gnZ/rZ4ISeLlju22Ml6/F0Q7YwhrGcQm/trqipIS+sg82c7c+JAirxe7N13O5I5 6q+dPrhlK/A4Lb+o3oobrPi7pBbP5iMcw9JPIMUV1KHkA6UJx5zXQo+CcMWh91LVBuW0 YbjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761753452; x=1762358252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TrDTvZiJG4yDG73wsRxB9Wak97hDmOb6p4nvdjA0DcY=; b=J2UW9vTsyTyepVus/5CCor9qVCfqtKQZwjCMKjF1RIvAuiRPtA4Dk5KcAkzFCt0IJv +PZygEjWdo9Z+6yugw4sRVxZu/iWCVQPLA/9SiZGdykzA9PxxAWdNWQHY3jBfGfktM06 CuaRbiV8sM1QD+F6V1WovvO98gZroWb9tpWLzHYhOwt6gCKAsih7z9HdmKbYVnOk8rKg d6KK82Pt3tCyCb0w/BCmXIgXvfoooNp/WXSA+b3PA3h3bG9HaAuJOzrHFUTf9PyG3KP0 VghN1vl4rME8xcGEics2AI+IaKc4avIU7t69uJWn3vERMv4VJV3kyhamM8CHSgOMNNVo 6dng== X-Gm-Message-State: AOJu0YzBkg2eg9IwcG1zzLymCh0OBBybYCg6VEdjUhlT7EiGb7Y6jR9+ vhY57esptbL8vhRrnUvVtPtiQKTV9j49+Pelv1Xs56lMp3z1Tyt0ZAMI+/5pwM8xP+c5EJC/PRl EvOCS2qs= X-Gm-Gg: ASbGncsNywzUulNg8KSb4DAaszpi5WY6li5BVaHE7v3A45MAEJiReBLnY5Zndnny0lE 2uFZn8AYnTNNvGODs+LZIaeAeKRpiyKGxUFPKBS0NHi/1WQQEk6ErjfZ9g+Ia9Er9K0zeXW41A8 CaoTGgDGI5h2h3w/L7uOnDoks1y1H+S3l4YI6iZA6w0Q3IKjh7GlMiN7FU+P5KJePyApI83gfTS glvpcKcSazDprDQFWQ/Uyj1kd9bJtWyoHuN+GDc2quNglZupT9yuq3DkCPXhz77faIH1pGKvYYv T8CRuxyOs15pCe/J1fC5s8YfFPWGliXLS0o/nR85Ml3kU2dKKqyVhfsfHwFcoflIpH7NxQwowDC PjWEnnWWvQom44qVq9fyu0MmCfQEpt6zNrjI7M12MNg+vKGB08PYrDYFKb5R5fToCN6VOra+Eeq yL X-Google-Smtp-Source: AGHT+IHg1BTnAUZG3sy2mU17DsFflxDrw/5NGVNoDUZS80xsCyFNi0XKXTSARZ8Ipw2OPWdnNzRNtw== X-Received: by 2002:a05:6402:5165:b0:62f:9091:ff30 with SMTP id 4fb4d7f45d1cf-6405e7cd523mr76185a12.3.1761753452610; Wed, 29 Oct 2025 08:57:32 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Julian Ganz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Stafford Horne Subject: [PULL 20/35] target/openrisc: call plugin trap callbacks Date: Wed, 29 Oct 2025 15:50:29 +0000 Message-ID: <20251029155045.257802-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251029155045.257802-1-alex.bennee@linaro.org> References: <20251029155045.257802-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x531.google.com 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_DNSWL_NONE=-0.0001, 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 @linaro.org) X-ZM-MESSAGEID: 1761753531589154100 From: Julian Ganz 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 Message-ID: <20251027110344.2289945-21-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index 486823094c8..d357aaa7da1 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.47.3