From nobody Fri Nov 14 19:42:49 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=1761753348; cv=none; d=zohomail.com; s=zohoarc; b=RqGom/cubfFNpthUsiS+0f5mvQHFhYtgy+ZGS3CO6pt3NewqNcCsAaBYJuHqsHspKWFcUMGzCon8xpGI0A8dhdDfV47+VnF+cUyqFMB5paIFAGx3Jnsa8tIAs5uNBL1uusJvdPo0DCKJTt9O5NGWrGBoWf2gMsq5pyt0o0H7lew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761753348; 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=4mvGSXD8bq+JsCFwOFVuxwpiCx0oCJyPaBH3O6zMDgo=; b=ksDISPzZYukNaQxl2Q4WUh9RCNMt1VKcoDl7gpE8XYzWd1XLLb9DeCUZJChr+MQUkbjRW1lEuWNAvdD+wIvHzAZEbtkkMN0gEP5DFOLuVj3t+JFo/Sv2l5dzJ7dDX1HBSEEh8qMgo+P9CWK5zVPqsJShX15zAzueHmAAlJkFDLQ= 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 176175334825424.577230071167378; Wed, 29 Oct 2025 08:55:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE8SO-0004Yi-UV; Wed, 29 Oct 2025 11:51:29 -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 1vE8SG-0004LG-AF for qemu-devel@nongnu.org; Wed, 29 Oct 2025 11:51:21 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vE8S0-0002tn-W0 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 11:51:19 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-63c09ff13aeso12914624a12.0 for ; Wed, 29 Oct 2025 08:51:02 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b6d854430dbsm1454545066b.63.2025.10.29.08.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Oct 2025 08:50:54 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6EE5560A94; 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=1761753058; x=1762357858; 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=4mvGSXD8bq+JsCFwOFVuxwpiCx0oCJyPaBH3O6zMDgo=; b=BRU7IlRwCv94jkwSdvkhzofLiKoO9TUbgetUMKO0Zi308XQ+vWw5oX1vCBLzLw9Dcv lft5z6MhnAV8+LftYmnpE2pHeUBN77Y9+4Ht+pfuBrSZWNffWd2u7y1I40pPAV0ETWti RXkmbw0IsBrbk/LxIO3L/to5dOavtyQVyUJ0s9ARM7DYVMNHJ4kHQr66kvNEyeVLNwFt SELAJ0YGawFVmLRUb05ruqbUMRVC2MgTFQpDwpkNMUGLmRJpW5gZW0pzpt7HSvv8+vC6 1t7UI1tBKKjmvFNjtPfvDj8aam+JNYkIaPu8E34UXRCmUlB15yDp00rq4sS0TUEim8cs Jlsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761753058; x=1762357858; 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=4mvGSXD8bq+JsCFwOFVuxwpiCx0oCJyPaBH3O6zMDgo=; b=stWnKX+d3foD9ZZeyaHIiomE9z4n3r+9F1dQVS57hRjQ6iOv9ZsUGqbLbqPOLJvBBM yoy9N5UozfbmZbuSPsqDXX2K5aAckhqXlIx3S7Tp6Iyq9dyX0MBSCX82+QxPUbhp2AaB 8aXsd8xhQuaqJlRuN3ifZNFp4gsFZXcqq9cKgBekPy/nGbFIJ7WkS/i1ij39i3iw0Ymo eVV6YJCJ43MqZER5oAeB6/S6VlTbKe1mUP3WBlA7y8NpQlH1Ow0/HCCfUSFRRSwHCSOQ hi0wwaIhiaDspWNPMysGeHfdE0AZr+i7VxwInNCjhkVEx93/PfgiglBv1ubs28WvQwOY msQg== X-Gm-Message-State: AOJu0YyZri15wgtBif+SaFORkVtt7TlY4X7DKvVboKvyK56fVQCsVVSe XKvt+DONqKZVjgF/yfKjb3lYHI2hcp05jI1LEUGBrSGaAJTzFKCoAKKOuw9LOxhbzFo= X-Gm-Gg: ASbGncv2/eIE+DzedrLSaAJqWBs9U3QAM2oKECFu4X6519yjwRiF9bB+VSAN0h1JTMo youYIRxQ9WbCN55s4tdixZlrvZErwuMSpMoKD6omprOGI4OLG5aoxqWLGieWYH0cxscPbUgEPJE Kxb+obKA3S6Nso/dAc1iZWMoyAYm4FuNxqyqKcMWMzMXFPqMnmlUCBpyT0SuNV9kkHWMyZ/10hm 2ydL6R+ymCAklcYFIzH7khh8BerXPUvy+XYxLBomzUXAk2uFT0upCZXejVDoJk6GhPh89m6E8FZ f+r8JbwN2f1NMO+tsOZouEm43v/QAm4PkM0U3CmUIi9m2hmqVILPL2K+YUnTAsmqc6r8M1UU324 8KfdbbKvHoWi1HGKJDCoqRZ7/qYAoqfO94sLqMbkLrnnlXvhSChW7EgOdapAIPOFhbW/hn8l/uN Qr X-Google-Smtp-Source: AGHT+IEVJ5MdooYOp5TOvHPq+ldR6VCsJqEyAY5pUcrR0/U7mZSSZuKPkBn8vTOO3Lp2bmhDwMu/Fg== X-Received: by 2002:a17:907:6d1f:b0:b44:fb0c:5c43 with SMTP id a640c23a62f3a-b703d57201dmr347158166b.57.1761753057830; Wed, 29 Oct 2025 08:50:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Julian Ganz , Richard Henderson , Song Gao , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 16/35] target/loongarch: call plugin trap callbacks Date: Wed, 29 Oct 2025 15:50:25 +0000 Message-ID: <20251029155045.257802-17-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::532; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x532.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, T_SPF_TEMPERROR=0.01 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: 1761753349650154100 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 loongarch targets. This architecture has one special "exception" for interrupts and no host calls. Reviewed-by: Richard Henderson Signed-off-by: Julian Ganz Reviewed-by: Song Gao Message-ID: <20251027110344.2289945-17-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/target/loongarch/tcg/tcg_cpu.c b/target/loongarch/tcg/tcg_cpu.c index 82b54e6dc3c..9d077c56d9d 100644 --- a/target/loongarch/tcg/tcg_cpu.c +++ b/target/loongarch/tcg/tcg_cpu.c @@ -8,6 +8,7 @@ #include "qemu/accel.h" #include "qemu/error-report.h" #include "qemu/log.h" +#include "qemu/plugin.h" #include "accel/accel-cpu-target.h" #include "accel/tcg/cpu-ldst.h" #include "accel/tcg/cpu-ops.h" @@ -80,6 +81,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) int cause =3D -1; bool tlbfill =3D FIELD_EX64(env->CSR_TLBRERA, CSR_TLBRERA, ISTLBR); uint32_t vec_size =3D FIELD_EX64(env->CSR_ECFG, CSR_ECFG, VS); + uint64_t last_pc =3D env->pc; =20 if (cs->exception_index !=3D EXCCODE_INT) { qemu_log_mask(CPU_LOG_INT, @@ -190,6 +192,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) __func__, env->pc, env->CSR_ERA, cause, env->CSR_BADV, env->CSR_DERA, vector, env->CSR_ECFG, env->CSR_ESTAT); + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); } else { if (tlbfill) { set_pc(env, env->CSR_TLBRENTRY); @@ -208,6 +211,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) tlbfill ? env->CSR_TLBRBADV : env->CSR_BADV, env->CSR_BADI, env->gpr[11], cs->cpu_index, env->CSR_ASID); + qemu_plugin_vcpu_exception_cb(cs, last_pc); } cs->exception_index =3D -1; } --=20 2.47.3