Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE45E1098782 for ; Fri, 20 Mar 2026 13:12:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w3ZYm-000392-Gr; Fri, 20 Mar 2026 09:06:40 -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 1w3ZYb-000316-Iw for qemu-arm@nongnu.org; Fri, 20 Mar 2026 09:06:29 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w3ZYY-00066B-SE for qemu-arm@nongnu.org; Fri, 20 Mar 2026 09:06:29 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-66847de014aso3207031a12.2 for ; Fri, 20 Mar 2026 06:06:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774011985; x=1774616785; 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=JIk29T9DhqqlbPhNrWYQVA1tgjm08zB9Z2xOKW4fUVs=; b=zZwOG00pawGtJxtpb+yTXpaSJwnwY3MKoSnwzeCcgVgyd4bDo2UJlZUpcZDX1WpxIu ZxXcZ9OXxzxCt4SB8TRorkMCVPqnrUV3yq3TFpnTAciot+TPZf2uHNCnGy7NVIwva9i7 7gz9/jFkcgEUsqcCjhVuEdszDPuuBrnt281mcXlpB+V47xGpQqMjuQDydFMZfpCx/oM2 oCvzIe7Ocsrxx0rHaYarxZkY0Tpmscunt9qmYvbAyhtuowk3rqULsrBVsb8TG22WeSsL XjXSygGcdNFthkobhpoqAwg6AeoiZwrx7OtJGYBiJGS626JQe5rzOBxNITeRK1wR2++N fmlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774011985; x=1774616785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JIk29T9DhqqlbPhNrWYQVA1tgjm08zB9Z2xOKW4fUVs=; b=n3c4ZNmmp5caOvr0bGF5hJcQvJMlkPCBDL2lGedjeAq4JVh0ITlmh5wk+O9w0mVtgY eArCEP1fq3pu/Ggpm0uIRNDH8AKkUGhJHmVOUCArydzdbuKLUaw71UkaBCvfr5iitFBx nyRrX+oDfcAXZuuJVlBRx0qayTfpfozw1PUSdH2vfLArDml/31Fif1RHMA+BIpiAiVOc R4p0srEp/T/maDgKY3X10XDyz+NYIMNBCVjbEhzBRPvtbu5GJz7xiq7F9o381kAl45z7 HUhgC8nJdltKw9hlvTL8ZuBzmSkQFO4DDkDQllLFt3Sp5lJYgqUH7oHXjWofKndN6iJg Vu6g== X-Forwarded-Encrypted: i=1; AJvYcCU8+mXUPc7d7xRDxhGraZv+5wLbsuk7zjUA24uXMo+hIYGzmcLDuA7tyz3UWJUj5te0BIrVAY7vgg==@nongnu.org X-Gm-Message-State: AOJu0YwPUdlXtE6JVCdzk/+lxWgys3TAWjA46hlnvIBq960WlVwES0X4 aP5ofYXoe8AHN5PBYBgIcsD9zWXs4zbtoh486Cp/RgPQzykDEX9P7Ss7Xwk7OCE+OCf/8hQiAYu Looi2r3k= X-Gm-Gg: ATEYQzwmluncPThaHlbSWZG9RTuladqXqWziOC0nnR/suRBtZRhZ+EoZCbgEzmgImt/ 5ugAiXeeMtZlraN32eJ0Dy8AkexO6snJ3Nq9YpHnkK9TAtPhsyBrssY5YAdgHv3sdypSKm8PGBD kySG3vzcTLjvz88wv2uA7mX7JEzmq6xXsOR9fvvsW+5M++IAw38TqmJBATdDUyd2GXIaFjylL1M WxG1WgDb3q0AWkLmMY57PC9ViBgFq7/Nyym8TxcA3cW7UTS6vE/30yi6HY/a1rNwYErqs/9pBwP 62marft1NfSFNUUU8WVxKZLJRbH65Bxl5f+wDyMYJGuRVTHup/hNRJzPDCcYn3m+tyuTjfOr8/E POGS8kPEH4sA0xhpnvRPsKPsvSYmeDSzeCKP8cqHaL5v6yxWEP8HgfyhgNF7PzRspHe54+9bdEC ikzvq7aCiF5QT5d+1WpKWEq0A= X-Received: by 2002:a17:907:cb89:b0:b93:51df:dd23 with SMTP id a640c23a62f3a-b982f1ecb62mr218938766b.16.1774011985297; Fri, 20 Mar 2026 06:06:25 -0700 (PDT) Received: from draig.lan ([185.124.0.237]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b9832f42c8fsm152962266b.9.2026.03.20.06.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 06:06:19 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 573325FAE2; Fri, 20 Mar 2026 13:06:10 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Peter Maydell , qemu-arm@nongnu.org, Pedro Barbuda , Mohamed Mediouni , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [RFC PATCH 30/35] target/arm: implement global monitor events Date: Fri, 20 Mar 2026 13:06:01 +0000 Message-ID: <20260320130607.2071996-31-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260320130607.2071996-1-alex.bennee@linaro.org> References: <20260320130607.2071996-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.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-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Moving from Exclusive to Open Access should generate event stream events. Technically a non-exclusive store to any address range covered by the global monitor should also trigger such an event but we can only detect that after the event by seeing if memory doesn't match cpu_exclusive_val when processing the eventual store exclusive. The CLREX instruction has the same effect as do other operations clearing the exclusive state (such as eret). Signed-off-by: Alex Bennée --- target/arm/internals.h | 1 + target/arm/tcg/translate-a64.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/target/arm/internals.h b/target/arm/internals.h index 2296ac9cfb6..2e59d58f3d0 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -690,6 +690,7 @@ void arm_handle_psci_call(ARMCPU *cpu); static inline void arm_clear_exclusive(CPUARMState *env) { env->exclusive_addr = -1; + env->event_register.as_bool = true; } /** diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index c25ff9351b4..38a51eb3600 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2270,6 +2270,7 @@ static bool trans_CHKFEAT(DisasContext *s, arg_CHKFEAT *a) static bool trans_CLREX(DisasContext *s, arg_CLREX *a) { tcg_gen_movi_i64(cpu_exclusive_addr, -1); + gen_event_reg(); return true; } @@ -3336,6 +3337,13 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, TCGv_i64 tmp, clean_addr; MemOp memop; + /* + * All StoreExcl operations will transition the global monitor + * from Exclusive to Open Access and at that point generate an + * Event. + */ + gen_event_reg(); + /* * FIXME: We are out of spec here. We have recorded only the address * from load_exclusive, not the entire range, and we assume that the -- 2.47.3