From nobody Fri Nov 14 19:45:21 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=1761935979; cv=none; d=zohomail.com; s=zohoarc; b=T5TeRYYe7PDfTO8JgL/4YKEpcsHeStG4johyDOHn1xaBEVHkr8gqxWt9lOgH9RWVzdZtL3wQthdEPjom3OhVsJkT9jv2qUer0Oz1mazl7J9lI7O/nhfUfHJwVlSVcPRQSGZjLGZJILw1XTxOZgOKwmGvZOEUs0Y5BnQnMrCNbao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761935979; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=hur19iUUYNUgD6AtJZs6/SDmdazLc6Uv6UNAGUuwO6E=; b=TnYjaXwCa52P7Vp/qtAcBgUp8k3l7wp7haJmuIB+YKdafxuoeJmtbgswC8lvBhCwZW0dZGZXIggvZ/q0MYv6QNJkS7MW3nEzAIDvvSsVAxtCTu3PYd2ENLTPJqPuvyO3iDkNOkcNr5A8SACiul0vFkfiQzJ8ZhwzUeG3PQYH2LQ= 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 1761935979533445.1406287884255; Fri, 31 Oct 2025 11:39:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vEtxM-00055I-3q; Fri, 31 Oct 2025 14:34:36 -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 1vEtxK-00054g-MY for qemu-devel@nongnu.org; Fri, 31 Oct 2025 14:34:34 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vEtwc-0006Fu-FT for qemu-devel@nongnu.org; Fri, 31 Oct 2025 14:34:34 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-429b7eecf7cso1756847f8f.0 for ; Fri, 31 Oct 2025 11:33:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429c114c944sm4859142f8f.20.2025.10.31.11.33.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Oct 2025 11:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761935619; x=1762540419; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hur19iUUYNUgD6AtJZs6/SDmdazLc6Uv6UNAGUuwO6E=; b=MoL1qEIBNtDh1p3bkjg6ITWelw+zU9D6wYM6XO19enlEeJOX1jIx8lWoe79YkUzw+h bGeKF/jjs5QK1FdJH34kT4ySdRIPjf+m/oJC7Ul2pCWzrfAoMpEDpSykVhzVIauRLSfJ ESfGcfYxcFgXk9S5q1+HzRs7fBZSL0CUbTXEZAQ15wJTMWnC6rWJmpUDMWR5sm59HiXH 5Hr1dp7nEYiWl60H2gljQFQOxp0rorFJbOC4+BVI9aFUxMzFkWRCj7TLUFxB5w3nf5ur IbRTyzdC24ml4LBgxwzihQa14nMbyN8w07x8CEEa17TT2DofnXcnA+TcnNhUBu1SYhnr a7Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761935619; x=1762540419; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hur19iUUYNUgD6AtJZs6/SDmdazLc6Uv6UNAGUuwO6E=; b=TtnAjWiJiuShZbQCuAij0TDa+53PwrB3szMGGKPxpZQZzGboANVKHrCvYLBdeqHLZx x03JyoAV0cxB3h3CzSJZWv35N+TisqQ7H0aG5qJWCeJI2nLMHC0eRCjOOWy2Kmnqi5Cs rYghCgVSpY2iQ59ZvTTkoJflpaOQfieMWapcniEXp96G1RrY4RznzrvDb1MMs2dDLwI5 /3dxLFsYQvoiKVdkUjD20+J+mKhuRUJoQNF2v6Smnh3lkTTUshU7A0jywPizFWvZdMjw 69LiwlfiJj/bgvlkbw2GebhHjT66vASNhA2QymeCq2VfOH/OwubLlAFRmCZerdB9iRfW e9CA== X-Gm-Message-State: AOJu0YxBZJe9CL1tppDN6pd6X9izU+s6Bii8KxvzD0L7Xq0Oeo475FS8 5uVd77H5OFzXLfiEcdQr+0Ju2nxbggd4pi/DHkYpaYdmQJlWpOpe/YSwIwDIu/Qc+OVx9JFVTtc KVsH4 X-Gm-Gg: ASbGnctt7NDgybiH3r3ibqbWbgZLXRgcE+70GlB0va84GJUCdQPmXmnFyt5srfywy7A hkTKp9AmzP95IGi2d/LozxZTD86UH8C2p6XXAL41qVmyjdIhqzQy/vd4vzbh2qBKXWkbOZKD4M6 +UkS8UmPu0dmcYjhL8OLwrG7jFjeCZqBN1BfR7l8eGtrG6CnUqQBTk4lrX23Cj3QXqTBOuZlXpa ntk+PBbAmKsmQYHa7049iZVT0WlcgDZ6wh8KGeUdu0qtW49VUmvkkp5qKwtv9nD6P0rK3Vn1tmd uExkdDhGlmmpW5f21w236fWyaEbn3TFrAdVRC5yxA5Ypd8A50U9mUMJQ3Bu6J3Al5nEdjZ+2Cnb n5UqQMQpxpUWjV0pv+rTu8gExQDYEjT8h0mYBKAUBODj3Ot0vppRVBprCBP6bE7RyeM0iR2JV0J UFVe5+dw== X-Google-Smtp-Source: AGHT+IFfzx3BdHDCAUWhUm4zPhzqiBrLAOChxXi6Iu2dpZyHUxvu4GEqQkyu0jsROwnMCYAiqlHp3w== X-Received: by 2002:a05:6000:2204:b0:3e7:6424:1b47 with SMTP id ffacd0b85a97d-429bcccf175mr4701743f8f.6.1761935618791; Fri, 31 Oct 2025 11:33:38 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/38] target/arm/hvf: Factor hvf_handle_vmexit() out Date: Fri, 31 Oct 2025 18:32:59 +0000 Message-ID: <20251031183310.3778349-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251031183310.3778349-1-peter.maydell@linaro.org> References: <20251031183310.3778349-1-peter.maydell@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::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: 1761935981085158500 From: Philippe Mathieu-Daud=C3=A9 Factor hvf_handle_vmexit() out of hvf_vcpu_exec(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal Signed-off-by: Peter Maydell --- target/arm/hvf/hvf.c | 50 ++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 8553ce6adc2..27c600148f9 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1984,10 +1984,33 @@ static int hvf_handle_exception(CPUState *cpu, hv_v= cpu_exit_exception_t *excp) return ret; } =20 +static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu_exit_t *exit) +{ + ARMCPU *arm_cpu =3D env_archcpu(cpu_env(cpu)); + int ret =3D 0; + + switch (exit->reason) { + case HV_EXIT_REASON_EXCEPTION: + hvf_sync_vtimer(cpu); + ret =3D hvf_handle_exception(cpu, &exit->exception); + break; + case HV_EXIT_REASON_VTIMER_ACTIVATED: + qemu_set_irq(arm_cpu->gt_timer_outputs[GTIMER_VIRT], 1); + cpu->accel->vtimer_masked =3D true; + break; + case HV_EXIT_REASON_CANCELED: + /* we got kicked, no exit to process */ + break; + default: + g_assert_not_reached(); + } + + return ret; +} + int hvf_arch_vcpu_exec(CPUState *cpu) { - ARMCPU *arm_cpu =3D ARM_CPU(cpu); - hv_vcpu_exit_t *hvf_exit =3D cpu->accel->exit; + int ret; hv_return_t r; =20 if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && @@ -2006,6 +2029,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu) bql_lock(); switch (r) { case HV_SUCCESS: + ret =3D hvf_handle_vmexit(cpu, cpu->accel->exit); break; case HV_ILLEGAL_GUEST_STATE: trace_hvf_illegal_guest_state(); @@ -2014,27 +2038,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu) g_assert_not_reached(); } =20 - /* handle VMEXIT */ - uint64_t exit_reason =3D hvf_exit->reason; - - switch (exit_reason) { - case HV_EXIT_REASON_EXCEPTION: - /* This is the main one, handle below. */ - break; - case HV_EXIT_REASON_VTIMER_ACTIVATED: - qemu_set_irq(arm_cpu->gt_timer_outputs[GTIMER_VIRT], 1); - cpu->accel->vtimer_masked =3D true; - return 0; - case HV_EXIT_REASON_CANCELED: - /* we got kicked, no exit to process */ - return 0; - default: - g_assert_not_reached(); - } - - hvf_sync_vtimer(cpu); - - return hvf_handle_exception(cpu, &hvf_exit->exception); + return ret; } =20 static const VMStateDescription vmstate_hvf_vtimer =3D { --=20 2.43.0