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 E9E11D3B7F4 for ; Tue, 9 Dec 2025 09:25:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vStxz-0006mT-PF; Tue, 09 Dec 2025 04:25:07 -0500 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 1vStxx-0006jy-S5 for qemu-arm@nongnu.org; Tue, 09 Dec 2025 04:25:05 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vStxu-0002HO-Ti for qemu-arm@nongnu.org; Tue, 09 Dec 2025 04:25:05 -0500 Received: by mail-wm1-x344.google.com with SMTP id 5b1f17b1804b1-4775895d69cso26667375e9.0 for ; Tue, 09 Dec 2025 01:25:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765272301; x=1765877101; 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=D32U9cx+cTFgXu76SMf/O5vqmn3V0bDLwJQvk6aC9NQ=; b=RreA443tCYB5aB6CwdjVcKTJKc7E9kUnRJNhgoLDob17/UXlwS6AdGGLQ+TkQwPf65 hLvhXe1c75vR30R37gSvPmM9v4e7rYwri4++2EnSchqg4zLs1SVNTQ4gvstr3xjty2Pi Sl8s8OqNC7hw3pukbY384gwv8gDTw8fGioGA9cHThXyOTKm3+v8i2B7fnz7CX2oC1pzZ YezOmTkCut09fHDcs0J3x/QByd0UkaFB5CNLPA9tb58VX8ENyzVpRGE9oX1CTbWxbjXi jL/PRd6VZu/sg6m6f1A6uVL4gkjQdiUjYKD8o1b5ktqnFiNdfREDAzbMrrD2U1iO65I4 mhtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765272301; x=1765877101; 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=D32U9cx+cTFgXu76SMf/O5vqmn3V0bDLwJQvk6aC9NQ=; b=IsIRrxOA9TT8HB3JNoDuLYLNqHnJfd9UqdVMF5wx36yCxzG/i1BM/YjX5f5VlgjQ8q UbApQjKvSWLI0NmLtJZ7531Uad37YAG+qrKUrzMyX2Rh7Jxt7ygYtuzjO7bqdCGBk47z OcaDLI3e1e/XeUFi4oPv736tAQ2b6C53EjBs0aw0EsOlzdJZo+oOxuxiFCNfPvzGQ0gp hGrDwQmPLWNhQQliBzAOXz9H3VddxepfifoGi/I4YPiYGb/urxVpTwxC+BKu6RrIgDml HBbKQbB6zfG6i2s6T+h6zkWqzAlYKaGHdJGhB2JHrPaZku9KKpuBBLkSJC0u3h0QgY2s i7KA== X-Forwarded-Encrypted: i=1; AJvYcCXl++UcXHM+E0LYE/bbhOnmPL6WtV9ooWWpG1Jph+ekxZAoJ2FI0abJF5pG0tG5bQDVwCl/8s7e+A==@nongnu.org X-Gm-Message-State: AOJu0YwUS1duhmmLl1FM84/3hTXl6iFVuSeEixzoKh2yGLhJJJ4VPuT4 ZsYXxB1p/xORV1MojUEyoF6zmO6w9XhkJ2I1Q/WKKNQuCb8c6XdLbWnj+nssWVoIQmw= X-Gm-Gg: ASbGncuqI+JHYNdidrwnMDl/7zi2DIzjVNp4e1hbro/9/BN8f/N5lwJGWZNBfuPe5hS 5j6PDr3BzmadXLvF8aazPa4+/+kQfj8RwwbblaxwjfXI2NMUAmIXp2Od6WMD9/BYXxJRmswvlMw 40uqe3NpzcZhCuO5+DccoMdOWN1z51CbsyQ0CSEjncpBho9S/iM1+T6GeP5jh1Hf5a/tWKhzCD8 1wnn800oqNYaZjd+t2+OztSs+ynKE2iqF3TFmqqSKqrdo6pghQYentu3QvmO94WksrbGSjFRQ7A mExfHmofSSCzkb/ZL4TTR7YhaXBqVsL297E1hHH0ZAERYo1Uxu1Yz4sQeGDWxQPQjCHwzOtVuaD WkOKHrdZ/QKExvAUAnwrGuS/EGRXiQ1FkgbuULj/0pENDPLVb4pU1EHWodqsUslWflTITJQpaxN HTVqqDH8Jhny4= X-Google-Smtp-Source: AGHT+IGakU9p5jhlouHTot85tqzwsJzhkEblpwepO6Jpag6s+Rayam5b/FLx5WaYeV0IqSaV+lNGjw== X-Received: by 2002:a05:600c:458e:b0:477:73e9:dc17 with SMTP id 5b1f17b1804b1-47939e5dad4mr116714185e9.35.1765272301329; Tue, 09 Dec 2025 01:25:01 -0800 (PST) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a7da1dff5sm11913265e9.15.2025.12.09.01.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 01:25:00 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A3E035F87D; Tue, 09 Dec 2025 09:24:59 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christian Stussak Subject: [PATCH 2/4] target/arm: ensure PSCI register updates are flushed Date: Tue, 9 Dec 2025 09:24:57 +0000 Message-ID: <20251209092459.1058313-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251209092459.1058313-1-alex.bennee@linaro.org> References: <20251209092459.1058313-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::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.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=unavailable 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 When we handle a host call we report state back to the caller via registers. Set vcpu_dirty to indicate QEMU is currently the reference and hoist the flush_cpu_state() and make the call unconditional. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3228 Signed-off-by: Alex Bennée Tested-by: Christian Stussak --- v2 - Fixes->Resolves --- target/arm/hvf/hvf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 70d34063df8..8e2940217a6 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1942,6 +1942,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp) /* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */ env->xregs[0] = -1; } + cpu->vcpu_dirty = true; } else { trace_hvf_unknown_hvc(env->pc, env->xregs[0]); hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1); @@ -1958,6 +1959,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp) /* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */ env->xregs[0] = -1; } + cpu->vcpu_dirty = true; } else { trace_hvf_unknown_smc(env->xregs[0]); hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1); @@ -1980,10 +1982,12 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *excp) error_report("0x%llx: unhandled exception ec=0x%x", env->pc, ec); } + /* flush any changed cpu state back to HVF */ + flush_cpu_state(cpu); + if (advance_pc) { uint64_t pc; - flush_cpu_state(cpu); r = hv_vcpu_get_reg(cpu->accel->fd, HV_REG_PC, &pc); assert_hvf_ok(r); -- 2.47.3