From nobody Sat Nov 15 09:22: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=1753279137; cv=none; d=zohomail.com; s=zohoarc; b=b86NGXZnWm4N1A80N/RksAdSGKotY0eE7NF2NGlXpsdXyMNlSDJiuZigWoJfUWMoTOhkRA8B0y4UfsX0lPsnDjgWSiGXBb9Ir4Kydn8UJvleLKsyroK+E2Y0HoKexEDK2B3cwN2oyNPQ+ecy0YQIM8BD9E/e1JQPO2OeXoPVOqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753279137; 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=sErIHNuJGiieHnnNTlL18cbjNP1n0Jf/eJ1sooLpLjw=; b=SFhs/QL8joFNdgs1dGFKFbv/9piGABZRDqFeixnaT6/e4apGiYpqy67u3TnrVzzEn2ZbdvC0DWgIVmwwFtpHfMY4SMh2QH8kDMq2nY7CRirG8U17xunYPdrkNiDqZpH83VeOJ0FzU6Qll+Li4/bgVx3TyBjr4xERaoS0Vjr5wAc= 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 1753279137267248.13684357679062; Wed, 23 Jul 2025 06:58:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ueZzY-00077x-Ec; Wed, 23 Jul 2025 09:58:44 -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 1ueZtB-0002qR-D0 for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:17 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ueZt8-0002p2-JA for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:09 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-451d7b50815so50960055e9.2 for ; Wed, 23 Jul 2025 06:52:05 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b61ca5c9edsm16632337f8f.88.2025.07.23.06.52.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Jul 2025 06:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753278724; x=1753883524; 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=sErIHNuJGiieHnnNTlL18cbjNP1n0Jf/eJ1sooLpLjw=; b=xm7z/JsADWjEQDpEBhuQpOUmA2SbWJeEa/gBol++/EowxFirh9Au6w0v247ifhqU9B RCB9afHVG6IGrd5e99JkuS67KbfBU/JKPvqw0YvGBLMjnqHFhRAKCtKqy/bq7AsCYx0k Uyq9LEznP7gYXN8x/mOBZIfhPn2KNLKG2V4USGQTOP3xfnDo6bod+f7tlX0v7mda2r8m gLbtAO9d3ipbxz4VNd634uOQcDx9XlAeYoHouRJ8rx/xt7o8YOHRFTMRp5zKWbmRCBsX lEFrfYBI+iNhP3tFGIB4gHrMYFBhpwXUUDtUjXqL4k6powwEOPI2yymytj0BZOgW2ztj /a1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753278724; x=1753883524; 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=sErIHNuJGiieHnnNTlL18cbjNP1n0Jf/eJ1sooLpLjw=; b=hOuu/ejV2CtTjF4TwQSCug7lQLFwlkMXKQSKjncwq0bE9KSafabtSYjbcFUsdxwBN7 GpVcQFU+h1mVWaXO6WKZzaXwkNfpfAHJKYySuec2inOQxPnztXyt1ylpd52m8r9uMVhe Aj77lLmkbUX2PKjdTdV4eMn7QqXTP+oonzrmiAF+7k6jTV0YXzGgeadjmEoIY1HLiWAw 9L7YIoPiyw5I2UJ1DdVZFlPEkwcfotmxC87wOK5+ItSOIyB59q8EteYmvKivXFOKGKyY T3D8gAER52p0WvLACLfiOqfnp3V7HHjqCY9MT1c5Zk1xPGxtKBKeS6iwMGohFziRJJb/ 0wIA== X-Gm-Message-State: AOJu0YwGY+HcyvpAgequPfBTWgTscYnoXRcSgeCgi6rNXGi3PZlwbaxF sjnuGV7LhpZKrGTuTptOC5cMRzAHVazlDxwDp1W2c6RLIV14sLTf1WHTFss87N6bVQTlmLF+0ib UMYwB X-Gm-Gg: ASbGncusQygdr6qPexaeOAejBgVfyibxvFvJJZQE0TP/8HIfaGQ7V2rRxvUj4MrU6rH 3nwaQ768b1iH5AxeGbMdUa3Til0iNO+WJasbmf5yAo98wqnAYELhzMX0YiqQP9Ay9gvFmFs4Qjv SXpoF2Qe982uvgZoU3HuiunwwAQENDUN5fGaox+Be+zPOO22jcQvjAkhG5SIevivX0xuPv5De+U GIjDtZGXwVeY3pc4Dgh9c7OxEk7/dFXKu6XJiwTP3Kix39+CW6PNyEQnU3TBxiI/dE8cAgHHpbA HTv+E95yE9jmr1N5tt/avo6oLh3KXLccfwa0vqDeL4EowzhzjvczGqSBUHUP/wYNuh9oPYPRCXs W5Qa14vFAEYXdRmyKMD096klGJT5ERfzrop2301qS7+J7QIVdhK/Wyh79HKMEodU/ZMwxSiwM X-Google-Smtp-Source: AGHT+IF2jLSlL/5bD5PGYKMnCSdo/K8e84jAX+hhADjVLT//YWG4YzDSSig2sL12YCHZyVOjxUOlSw== X-Received: by 2002:a05:600c:4509:b0:456:133f:a02d with SMTP id 5b1f17b1804b1-45868d2dd64mr27706105e9.17.1753278723806; Wed, 23 Jul 2025 06:52:03 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Phil Dennis-Jordan , Roman Bolshakov , Peter Maydell , Paolo Bonzini , Alexander Graf , Mads Ynddal , Cameron Esfahani , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v4 1/4] accel: Introduce AccelOpsClass::cpu_target_realize() hook Date: Wed, 23 Jul 2025 15:51:53 +0200 Message-ID: <20250723135156.85426-2-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250723135156.85426-1-philmd@linaro.org> References: <20250723135156.85426-1-philmd@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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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-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: 1753279139826116600 Allow accelerators to set vCPU properties before its realization. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/accel/accel-cpu-ops.h | 1 + accel/accel-common.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/accel/accel-cpu-ops.h b/include/accel/accel-cpu-ops.h index 0674764914f..9c07a903ea0 100644 --- a/include/accel/accel-cpu-ops.h +++ b/include/accel/accel-cpu-ops.h @@ -34,6 +34,7 @@ struct AccelOpsClass { /* initialization function called when accel is chosen */ void (*ops_init)(AccelClass *ac); =20 + bool (*cpu_target_realize)(CPUState *cpu, Error **errp); bool (*cpus_are_resettable)(void); void (*cpu_reset_hold)(CPUState *cpu); =20 diff --git a/accel/accel-common.c b/accel/accel-common.c index 850c5ab4b8e..eecb2a292af 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -106,6 +106,11 @@ bool accel_cpu_common_realize(CPUState *cpu, Error **e= rrp) if (acc->cpu_common_realize && !acc->cpu_common_realize(cpu, errp)) { return false; } + if (acc->ops + && acc->ops->cpu_target_realize + && !acc->ops->cpu_target_realize(cpu, errp)) { + return false; + } =20 return true; } --=20 2.49.0 From nobody Sat Nov 15 09:22: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=1753279073; cv=none; d=zohomail.com; s=zohoarc; b=Yr2UFEXpaJMYizc+5o02lZX5o9Cld2iO6Fw4Jn/h34320illfuXqGJT8msgid8Ljfz/hKUYHYFUOqXXi2m6Sq8cj+4vFMHplOrJ9ABejekVPPj/ix9lIaT2VJekUyk+U1MgJQkE4qwx/J+3R/TaiMXeqzfLqLtoAWtQ0Qua4MMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753279073; 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=jcdlEr/J4j1S/5PvsG83gT109zbXCmA4422HgOxRd8M=; b=oEpGUnyzYpWySSp9hqPMOIAY5es273MM8DYHJv0x04WJxW5VpZ/peCaTmu9xIODFbvwKycixjiptsGp4SItXFh2mIbIejHYQlQSCox8A2iG2o87Dkry1xYJrI312BcaQiYsTKgJaiwJakmJiwFRBxAj6bOQQ7opJpgb96LpQ7Yc= 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 175327907321781.94938506262622; Wed, 23 Jul 2025 06:57:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ueZxo-0004ow-OB; Wed, 23 Jul 2025 09:56:56 -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 1ueZtI-0002tU-RO for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:19 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ueZtF-0002pk-8l for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:14 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4561a4a8bf2so75462295e9.1 for ; Wed, 23 Jul 2025 06:52:11 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-458648f5ed9sm35552075e9.2.2025.07.23.06.52.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Jul 2025 06:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753278729; x=1753883529; 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=jcdlEr/J4j1S/5PvsG83gT109zbXCmA4422HgOxRd8M=; b=L0hQfltyUPbaUQUxvVtj7fFJPShEYvoMYx85+5DOoB1CN/GhdQ6tsjCKOYLVxKrVrY +vMdVQ4VNX/ViBPlo6yyDqD1WHaUNELDnAy1qjefhPBW7QLk39tdVM8pwC1C4imOySCs gQTSnk+DFuwd/QQ5MvMqwkWM3PwflAEqo2SgYRAPZVfzU8MlApMJF3wyU6F0U6VbzZZq h0AR4fULBfebO7vTJI+m5J7buVgod6/T69qderlzMwSQXn/EOlzcyZo8TSiFc3LEWPPT ioc0pw3vb83ndGoUBdGDtf/aFKNihVF4VP7LgMLi9Ffj7Y1LtjVBRIQQZ0TLgL+Xkb1F iaiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753278729; x=1753883529; 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=jcdlEr/J4j1S/5PvsG83gT109zbXCmA4422HgOxRd8M=; b=pH79AyH8EM58JuMUgw81Pk8DHY5mt2PGpCKHCIe0SenzCoAQA57Jx3NvMTdc/uS0iR rshFKKz7zSwJaKR0T3w7IKXwvYqKv2b3iOkLI96VZkCg8dzuWyHvq/cDl7f861oM3mMO OxnBcnZuTN36KQ9EEYNK3+CYfJOlPWtL3MuRPEVTOE78RXEoc6rDI75R0h/USK4FyGbY S8eVDPAfzR0dl2nuDPdfSNR7vfKGBRlvHA0+v1HKiCZQaRSghTEdRVCtLqiwTPqPHF32 DZvg0sRsZ5uncUqOlE4Ed39VsU/uOvZgnnm9vE5SSETDC8LaFg/HnxQEOj4u1eokcAha Fy/A== X-Gm-Message-State: AOJu0YzrfjP0jw7dHmtxXTcEB4NRW+1EqKy/u4rAbUE5GHGdHcjakMGN R+CGCz6tjoiOd+P4pUgPt+68M39SAqaPM9BmWBAQNU8sw3Hcqh4nnLMYsRoyjiWI6ogmAcFGwFo VcVEl X-Gm-Gg: ASbGncvr1LwtMa3lBLgq77wBxraPSoHc6s6s2r3353Ue2lTRYqjqbL+RHAjkEnkxHT8 jN3QzFJ6P/5Ss45br+lrNcwVSJ+W1/lG0x+MiybKkkGGcwncokNH5dXL8FepikFZbQ5izlvZeIi UTBqJsRx1Q2rp/SH0E8j+zDB0DcKMP5oTMTQzpCN6bTIQYdYfqKl7zkD3cOCGtwfX0X7e9huhif LXcjF5rPkG+VCcXmfUMST3txM9Ozhg0frEtrSVmyAkY2HOW9nK709wu9nHrL4Jrbhr4eyo7SWO4 lE53IUebTlad8UiFZTY1yO2fJaPErUIFteJpZhu40ovnO/A6QOhjVUiaWvmUs5ZZZ1RGEGeLBP0 MSagY2QQ+Ac2hAjKeIgLQ63WFn3WYl2CV/yL/2sb8zajwSqcUveI25gkFFKUMrjhSQ2UE0oR2 X-Google-Smtp-Source: AGHT+IGheCM8Hka0VAsDAn6qT6VCvHDh3/IFzV/hzpOM2LiYrILg94ruuTESUGTmXs8udTraYmIemw== X-Received: by 2002:a05:600c:35ca:b0:453:81a:2f3f with SMTP id 5b1f17b1804b1-45868d4f48bmr29607095e9.30.1753278728828; Wed, 23 Jul 2025 06:52:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Phil Dennis-Jordan , Roman Bolshakov , Peter Maydell , Paolo Bonzini , Alexander Graf , Mads Ynddal , Cameron Esfahani , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v4 2/4] accel/hvf: Add hvf_arch_cpu_realize() stubs Date: Wed, 23 Jul 2025 15:51:54 +0200 Message-ID: <20250723135156.85426-3-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250723135156.85426-1-philmd@linaro.org> References: <20250723135156.85426-1-philmd@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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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-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: 1753279075985116600 Implement HVF AccelOpsClass::cpu_target_realize() hook as empty stubs. Target implementations will come separately. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell --- include/system/hvf_int.h | 2 ++ accel/hvf/hvf-accel-ops.c | 2 ++ target/arm/hvf/hvf.c | 5 +++++ target/i386/hvf/hvf.c | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index a3b06a3e75b..cbd59525e87 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -111,4 +111,6 @@ void hvf_arch_update_guest_debug(CPUState *cpu); */ bool hvf_arch_supports_guest_debug(void); =20 +bool hvf_arch_cpu_realize(CPUState *cpu, Error **errp); + #endif diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index d488d6afbac..6c9369388b8 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -373,6 +373,8 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, c= onst void *data) { AccelOpsClass *ops =3D ACCEL_OPS_CLASS(oc); =20 + ops->cpu_target_realize =3D hvf_arch_cpu_realize; + ops->create_vcpu_thread =3D hvf_start_vcpu_thread; ops->kick_vcpu_thread =3D hvf_kick_vcpu_thread; ops->handle_interrupt =3D generic_handle_interrupt; diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index bd6b5d11de8..7de770da4f3 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1081,6 +1081,11 @@ int hvf_arch_init_vcpu(CPUState *cpu) return 0; } =20 +bool hvf_arch_cpu_realize(CPUState *cs, Error **errp) +{ + return true; +} + void hvf_kick_vcpu_thread(CPUState *cpu) { cpus_kick_thread(cpu); diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 818b50419f4..a24786c8c35 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -367,6 +367,11 @@ int hvf_arch_init_vcpu(CPUState *cpu) return 0; } =20 +bool hvf_arch_cpu_realize(CPUState *cs, Error **errp) +{ + return true; +} + static void hvf_store_events(CPUState *cpu, uint32_t ins_len, uint64_t idt= vec_info) { X86CPU *x86_cpu =3D X86_CPU(cpu); --=20 2.49.0 From nobody Sat Nov 15 09:22: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=1753279135; cv=none; d=zohomail.com; s=zohoarc; b=Qa8kRjGE1pUJdq0aY3/GyJ21C5KNlsikQ0NWdxg+5ib7U1EuikilhiM50gwSnJqErYloaj+gc6lHkSm6ex4QiUWJLVfpizRrpx1Ci/vOAFfQUZ0fHfv/ltXoJeXpEvJPi9/qQEmjALu6Ed2YxccRA0Su3oOzROEeXdQXL1Yl5Wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753279135; 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=WiARY+eRyGpj1UCxkCuj/Q44h4QzLd4Og99m8x5oSqA=; b=d2MsL3GcLs/jn938e4nUX6Yo0WaCzhxyDfhwEIHWn0PoSLQBn3X09XRdjecdkKhCoZ8d3NnS6OjQj6wRRryPr0/4vVGpIFdwm76z87nNJK/JhzCg7WwYhN9Xhhu3JosCBI8PzhjCvIVdcXbnG/VvmTGsgu4FMZd9wjk1cwD+qEE= 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 1753279135105774.3341652472596; Wed, 23 Jul 2025 06:58:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ueZza-0007DE-5m; Wed, 23 Jul 2025 09:58:46 -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 1ueZtL-0002u9-7m for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:19 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ueZtI-0002qc-KZ for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:18 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3b49ffbb31bso4393833f8f.3 for ; Wed, 23 Jul 2025 06:52:15 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b61ca2bf4bsm16292187f8f.31.2025.07.23.06.52.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Jul 2025 06:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753278734; x=1753883534; 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=WiARY+eRyGpj1UCxkCuj/Q44h4QzLd4Og99m8x5oSqA=; b=uGPGDRiJgJW1Ri8NI0SiF3R9RoFiekE5OxoYU/wvTCsLNPu2TPSq8bXYNdLGoX3sM/ WaX50YtTEP8NWdm54cSZ/jWPTJzJM5KjFAERwgMvH7S2+F25cgYofQgprOPYJH6OgxLl OevAsgmG85WiSvk80FRlzDgL3l9+hMcVYYFiG1RzQ2htGS2G0Lzld3p9OqBitaVgfE0w nXKQReRAdoc0mtypcABjdk7HkRrV7VvWy06iHZJMFtTUaWHnHUS7SE0RA055W8j7B+yK 3gxAO/9/erq4cbKEWxcJ+2sVPEmxE9WQO+pmX+TZHkpQ/HVjBIDQAwK9LjlM35ZFWNAJ N//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753278734; x=1753883534; 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=WiARY+eRyGpj1UCxkCuj/Q44h4QzLd4Og99m8x5oSqA=; b=FxXi19pRL71RU9pM18wIxVSCj6wzEPKDKr9RC2OTKxEDQhqewcv3lipk0yUz/6lEow m/NEAb9TJthS7eZYcrItyb9V9kZ2F4fVKKiRgE7RMQBgIx8RtIFdsgH+UIEqPs1xL2k+ QrWvBgC/rsmTikfCgLUWZjz0F6MzV+38A5DFanvNdUGD2q8Ov9UQDH5gfZQ1Wv+PoEpu l1n+M1JOUtWzAHSQcpRuRopXEdkMpfBYauLl2A3nSvWHj64iNuS3idPGSqgv6/yCV2pt JTH2RNvBk5rK83E+EOwfDKn266nOqb3YNICmywyGC1oXYjcms5zf7tZXUvMRTxgHadOS r++g== X-Gm-Message-State: AOJu0YzIiiBa0xpnCFOEsU1p/4qHmVjxIGH4yHmLtIN/VxV9kHD5b2tw GVwH/YvYm+XRuFgGAcXkRO2M6IxR4T5B3LpTeIrLJydWigOsnm0sijKavJE0RMOyIKhoBZXjGid r0Pdd X-Gm-Gg: ASbGncuDOKRyG/cNbQ4C4wfHKck1S5AABLjUtgnvczkgVpuQWYZrpVZoDYv/mF5lWJ7 ytOgmrechTa9qOcMMH+WiUvVxhu9O7IUiBxDHs2sTN25v6mVznzYbXJv/n9ew9iGzBWCFz+moRi 4LxFTSyQsLLvY53nMKDdrluJ/arIolpl/ancFctFn0TKNOw9Zz+5lBG45Ox8ySDJaHD9daRFVCq CuI8BtQIYHvgqiYFqvXZfG/Aj7e0EwyO4ORtmh007moAgBZS7vppSaXHy8nGaYz2imSVCVkxOXQ O2kePEgZhE4Zfw6dzIqzPLQY7AeTKo2vpUS1DpSKwCszqzuu8544zvWdGuxRqTf4hW/aZ6n5EfG cOihEOB2iypwCfFc/q9oyKevBHa4Dh9ptcaGQBn419jBwVQRRnIIzQQS8aIBuJl8IbtxSewVz X-Google-Smtp-Source: AGHT+IGOGeaNpp/3rjwqSfe7zdH2Up3/bgh9seutQ6iWn2IBT0XPLD6MPpsDf4oznKcs0iaK81+G4A== X-Received: by 2002:a05:6000:2c0c:b0:3b6:333:256f with SMTP id ffacd0b85a97d-3b768f27e15mr2455163f8f.58.1753278733653; Wed, 23 Jul 2025 06:52:13 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Phil Dennis-Jordan , Roman Bolshakov , Peter Maydell , Paolo Bonzini , Alexander Graf , Mads Ynddal , Cameron Esfahani , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v4 3/4] target/arm: Create GTimers *after* features finalized / accel realized Date: Wed, 23 Jul 2025 15:51:55 +0200 Message-ID: <20250723135156.85426-4-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250723135156.85426-1-philmd@linaro.org> References: <20250723135156.85426-1-philmd@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::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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: 1753279135974116600 Call generic (including accelerator) cpu_realize() handlers *before* setting @gt_cntfrq_hz default Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.c | 65 ++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index e2b2337399c..70755fc7e87 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1992,26 +1992,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Erro= r **errp) return; } =20 - if (!cpu->gt_cntfrq_hz) { - /* - * 0 means "the board didn't set a value, use the default". (We al= so - * get here for the CONFIG_USER_ONLY case.) - * ARMv8.6 and later CPUs architecturally must use a 1GHz timer; b= efore - * that it was an IMPDEF choice, and QEMU initially picked 62.5MHz, - * which gives a 16ns tick period. - * - * We will use the back-compat value: - * - for QEMU CPU types added before we standardized on 1GHz - * - for versioned machine types with a version of 9.0 or earlier - */ - if (arm_feature(env, ARM_FEATURE_BACKCOMPAT_CNTFRQ) || - cpu->backcompat_cntfrq) { - cpu->gt_cntfrq_hz =3D GTIMER_BACKCOMPAT_HZ; - } else { - cpu->gt_cntfrq_hz =3D GTIMER_DEFAULT_HZ; - } - } - #ifndef CONFIG_USER_ONLY /* The NVIC and M-profile CPU are two halves of a single piece of * hardware; trying to use one without the other is a command line @@ -2058,7 +2038,40 @@ static void arm_cpu_realizefn(DeviceState *dev, Erro= r **errp) return; } } +#endif =20 + cpu_exec_realizefn(cs, &local_err); + if (local_err !=3D NULL) { + error_propagate(errp, local_err); + return; + } + + arm_cpu_finalize_features(cpu, &local_err); + if (local_err !=3D NULL) { + error_propagate(errp, local_err); + return; + } + + if (!cpu->gt_cntfrq_hz) { + /* + * 0 means "the board didn't set a value, use the default". (We al= so + * get here for the CONFIG_USER_ONLY case.) + * ARMv8.6 and later CPUs architecturally must use a 1GHz timer; b= efore + * that it was an IMPDEF choice, and QEMU initially picked 62.5MHz, + * which gives a 16ns tick period. + * + * We will use the back-compat value: + * - for QEMU CPU types added before we standardized on 1GHz + * - for versioned machine types with a version of 9.0 or earlier + */ + if (arm_feature(env, ARM_FEATURE_BACKCOMPAT_CNTFRQ) || + cpu->backcompat_cntfrq) { + cpu->gt_cntfrq_hz =3D GTIMER_BACKCOMPAT_HZ; + } else { + cpu->gt_cntfrq_hz =3D GTIMER_DEFAULT_HZ; + } + } +#ifndef CONFIG_USER_ONLY { uint64_t scale =3D gt_cntfrq_period_ns(cpu); =20 @@ -2079,18 +2092,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Erro= r **errp) } #endif =20 - cpu_exec_realizefn(cs, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); - return; - } - - arm_cpu_finalize_features(cpu, &local_err); - if (local_err !=3D NULL) { - error_propagate(errp, local_err); - return; - } - #ifdef CONFIG_USER_ONLY /* * User mode relies on IC IVAU instructions to catch modification of --=20 2.49.0 From nobody Sat Nov 15 09:22: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=1753279083; cv=none; d=zohomail.com; s=zohoarc; b=jSvu77+Iy31X6BV0PAfQ5AvJLNoOJwXJZS5mXzSBFYnycGffCI+4eWNJed8ptVTfI3/7iurgnJ5LGO6RrFrExgM7fRh92Tj4fGBEZKoYRFFmjivYA7jDJyK8Cg5N/pRndPIMB8FOjpiwXjTZXQFU1WmmkWackzkd8Rn+KEXCbA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1753279083; 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=+HZCiXqJ6zZg/VWStToH24eJmWXqFdiiJ1PQISWWaS0=; b=T+8Nfc4MRS8QaGQpOyqMbUWRVVPwRWhQ71bcm0HOOvaAJA6ROm5HH/N/haMgeccN9FFG90tL9TDjwzNL4iCmJRVEw9TheCkil8IU6lNVIHMIy0iD8ZcFZTPruaf/Szc2dmezK3g9lguxYJ2RLkq2pi8C0SXeAk0WTlJz+eZSCUw= 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 1753279083340776.3117223533425; Wed, 23 Jul 2025 06:58:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ueZxq-0004pJ-O2; Wed, 23 Jul 2025 09:56:58 -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 1ueZtP-00030V-45 for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:23 -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 1ueZtN-0002to-6k for qemu-devel@nongnu.org; Wed, 23 Jul 2025 09:52:22 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3a528243636so4057915f8f.3 for ; Wed, 23 Jul 2025 06:52:20 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b61ca48719sm16582343f8f.47.2025.07.23.06.52.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Jul 2025 06:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753278739; x=1753883539; 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=+HZCiXqJ6zZg/VWStToH24eJmWXqFdiiJ1PQISWWaS0=; b=f4ZzV5dg1vtfb9264gnO7OcbEY9NbXksEpi+eTqoOt7TEVV+4jCMQzZ/PLOWBsLyuJ bDWQkEbjUFKagvWay9lvnV6iIO3A3eu9ir1PCVGiBaonM7kjjWHY0TLKYqyACHAfk8/m N/M4UeSMJLTCjf015QFFrhTuYQulXGutw7xD+ZiRPZJB9a0/VBQl3k7iYwHPMV7O9vqO 51AIHwZxYUlEbh7fbcyp6qP7Ghnfz/ENtI184G0SPOEf9lg6Zy4vyXRcpCkHxAdu0Ffy mBP6BLbY38FBPGS5ZPkZAtsVCOz5KE/HXGq5GpU1bZyo3yaUOeE51V1nH/W29iuhiEo+ UDEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753278739; x=1753883539; 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=+HZCiXqJ6zZg/VWStToH24eJmWXqFdiiJ1PQISWWaS0=; b=eHWY6UNbSfHwz8i3TJk4gZYcXY97IMruoXDyniK4ilGtQs8niOr5cph94fVpNGsjLZ hdXOgbeMwIAQ9/ueetFqnzccbIQwVwEkjWiQoqE6Hlbk74MM4dAIzrHuqUSKr28kor81 ueNBLtJLmORBvK8H0m5AcwUkNsdXlggVwpc44ooosqsFoUTiWxEl8VBeC8O/DcgCId2L uEa7iagWp4QDQu8HMEtMbyeJ10XmL/FEHqBWgYsEK2ASoRuQGBGrr4nYUXL3IWqC6YcX BPHyqupxgeoVUgId0Ahmyyt+t23F6lh2TZ1VmFXrodLu+4UeFTh45K68mJNHAGZBkV5/ Z3nw== X-Gm-Message-State: AOJu0YxQCG3mSBYtVXw8k57W1Qf76iRcMBgZj/0DCNA7+x429PjebATp gYy+WqDDndMXaeym/gbfWMtOdCfnK5QSVP1Ky/E4nh8FAVhadhRlTIoCskGkdVYtbIsFxg058CA wd5io X-Gm-Gg: ASbGnctyNh7hjeU04ky8cuLctPL7IsF688/kZe2VKURndSJK4WdNBJrPEc2q1eHwfpp qfbatVWkyo7Olu6BBmO8dYWZ4usN6KTZu7BinAe0D14HNFnrgvP0bE31u3nBXrTC5CU/oDzNUub LYAjeUa80Q8Z5Q+G42lq/9A75FnCsnp+PumQAzmgQ0WOz59M25wDjwFuCCEiq95cxcCtNHytjBq v/iH3QuL0Rypw2I13sy26O/bF/y95BEJsuIm3RdmgYOxT+QLyAUlE6QCHsqD8hUiA4QuWVuUycu YlYcY//txAk9kXg4ShGbH6HMTmNhw95udeok0nee8djYSG8BCC7aZQiqUfYg5N4pbFFurUX5EzA 9HvSEPVdD8L8A/VdcpFzmTLm3oN+Z05a7A4wrVwVz3DsnTXBf0MWZ6oC0fBNiP3AVnVyXZuWP X-Google-Smtp-Source: AGHT+IHDwvvKSwdTtXPkM65Zb4e5VGlOb0fOueXxV3lHOJmaYtgt5pDH+n2dlWWjSnAG8Oh/0ZWrUA== X-Received: by 2002:a5d:5f89:0:b0:3a4:e841:b236 with SMTP id ffacd0b85a97d-3b768f1ab75mr2724398f8f.33.1753278738629; Wed, 23 Jul 2025 06:52:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Mohamed Mediouni , Phil Dennis-Jordan , Roman Bolshakov , Peter Maydell , Paolo Bonzini , Alexander Graf , Mads Ynddal , Cameron Esfahani , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v4 4/4] target/arm/hvf: Really set Generic Timer counter frequency Date: Wed, 23 Jul 2025 15:51:56 +0200 Message-ID: <20250723135156.85426-5-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250723135156.85426-1-philmd@linaro.org> References: <20250723135156.85426-1-philmd@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=philmd@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, SPF_PASS=-0.001 autolearn=unavailable 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: 1753279085613116600 Setting ARMCPU::gt_cntfrq_hz in hvf_arch_init_vcpu() is not correct because the timers have already be initialized with the default frequency. Set it earlier in the AccelOpsClass::cpu_target_realize() handler instead, and assert the value is correct when reaching hvf_arch_init_vcpu(). Fixes: a1477da3dde ("hvf: Add Apple Silicon support") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 7de770da4f3..ea9e6b1c0c6 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1007,6 +1007,13 @@ cleanup: return ret; } =20 +static uint64_t get_cntfrq_el0(void) +{ + uint64_t freq_hz =3D 0; + asm volatile("mrs %0, cntfrq_el0" : "=3Dr"(freq_hz)); + return freq_hz; +} + int hvf_arch_init_vcpu(CPUState *cpu) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); @@ -1018,7 +1025,9 @@ int hvf_arch_init_vcpu(CPUState *cpu) int i; =20 env->aarch64 =3D true; - asm volatile("mrs %0, cntfrq_el0" : "=3Dr"(arm_cpu->gt_cntfrq_hz)); + + /* system count frequency sanity check */ + assert(arm_cpu->gt_cntfrq_hz =3D=3D get_cntfrq_el0()); =20 /* Allocate enough space for our sysreg sync */ arm_cpu->cpreg_indexes =3D g_renew(uint64_t, arm_cpu->cpreg_indexes, @@ -1083,6 +1092,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) =20 bool hvf_arch_cpu_realize(CPUState *cs, Error **errp) { + ARMCPU *cpu =3D ARM_CPU(cs); + + cpu->gt_cntfrq_hz =3D get_cntfrq_el0(); + return true; } =20 --=20 2.49.0