From nobody Fri Nov 14 18:17:30 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=1761220282; cv=none; d=zohomail.com; s=zohoarc; b=k3BP/6BDXHYemMJUBs0dL7d8N2RD6va1725eNLf7ZsIe15FQ8EZt8Oih2GRDepg+xaliSpwnRwrNXUmCvROf8x07lcWs8kGhbvnEN8HV6H0aobB4NhaT7nNgh8q6DPJcyUCA+ZPHFZybj8NkA9E5BAqG5Uh6Bt5NmxsZTHtOmFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220282; 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=cSq0w+2pMt9GZjD8Tq18/wVUPKd35IM8rk6GrG4O1u0=; b=jb1oCW+1J2ojqu+LQH6QH+2A6PGPFBVcdibPubbgw4Q3svgAiT6c3LH0Kb/DhC7Yt8yW6PhODodABBCxuOVdTmX2h7yx3ER9RnifEJ5jHnuvc1rNf4GDUaYpFf2pBtI86D1bX7jBm7Nv3XWqVF5IVCT9M9u7C4o03Ty2MDgXDgk= 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 1761220282694143.9669973036266; Thu, 23 Oct 2025 04:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtmc-0005ip-Tn; Thu, 23 Oct 2025 07:47:07 -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 1vBtmQ-0005Au-UO for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:46:58 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmL-00020F-0Q for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:46:52 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-427084a641aso515081f8f.1 for ; Thu, 23 Oct 2025 04:46:47 -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-429898ee8a9sm3509866f8f.46.2025.10.23.04.46.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220005; x=1761824805; 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=cSq0w+2pMt9GZjD8Tq18/wVUPKd35IM8rk6GrG4O1u0=; b=M5OrheG8bws6f1OSmtqkFBRYAsSQg46Q0OMpbBcUx560qeBaAIFiUR1KJBz8RdEE+t pNDVzhyoIQRZyXkcUlXRb71zdwaXs0H7jnvGDQSptXusjgkmuw8AZC8iJ068YTqQnFmV 88oMSYSKe0fD5BPYlqUpQHrJAhl93FcX2RmkBcsWkJzkqWwIm6KtFm6O9D4V4m3CTUxq sZfU6YqV+KaHFYOMKCGLSNXSriABATgaGmVWIWmnj98QgxGt6Rlm1Wd2vgBQd+Burq3h 5AdKdTt0Q4l0AyH6lcXRy+rh3kNwmSCkZsTDXmreUUQwQ81vUmWrZXz41B1VVh9YdT/j a/aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220005; x=1761824805; 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=cSq0w+2pMt9GZjD8Tq18/wVUPKd35IM8rk6GrG4O1u0=; b=ZPD/O023VQKUe9zmuO6uuq7/0+XETzHz18+pEfjY+DH47N9nObwLgn4IcqGvWyCGUi LMq072qynYoQVYcbTD6Znu9LnfyH7KTk65dglQgQDujJO+tr4bTYdmze9hKdOnOZS3C0 ziUuBb16KNE1t4fJKkvfFsi8oM9zO/oPE10lmD4UffzD75N/QtNDcSKYdRLkuWp+YiGV E/PVQ7Ge3fvU3+5wXNS6GEazadGLDHryG1r+A78A2R+zfK0iAwhLSaUS39nCup134V5n JOu8o+8WgP7+yM998RbWdI+aVMiSXNr3qjKz6sTx1hYjj63aAa1SfNYshJOVYgPZHGNH he2Q== X-Gm-Message-State: AOJu0Yzl+arke38KywOqLRU38TLe6mHKt02s6VaJVanQ5kPug1zVOr3z XsQxJ3mBCNutmJ/QjjinCMkg1hT2p+wC5hwnGxOQXLXPr2lryey3mSdRzVxER9MpVVx0c19U+Md CR0+VHUY= X-Gm-Gg: ASbGncv1PAiiHiSQ08Zsc6tVRtrVRDmxhFWGxRdFcknxiFDCNT/7zKYLETe82/jgGsV 9dDUK6wCED+4drg84cVcaorxF9mR7DBIOuV6wAPjh8f6uSt239I2fOmMKl/kxp8IsjargjBZ7Yt vnohPvBf8ka+a25Senhns6Jvu2wHT2V7Y6fwYGpC0YpoTDxeF6S/FJBbseeA2v735tfYxhxBEIw 9WU0uv6q1iP7lzSeWVZ9MNTzRk4isazWL6O68n9vyk7TIZupzCgsXCfBagW5iZ7PT0HjT5MA3iE jH1qLASt5mzMBttOxK+iqfiAeiVbCmMHHlpqCuX0kJPXoJTp+vgx9gxKVrHOTbMdmrwA71UACAD cwjW8IRN4mXtKMJXP8JY1U3/7JAU1uehk15mi1xEqHJU/tpCs6YqQMmEngWvbjFdk8epJWjj397 I6Voo+2zH1APtCegjCx5hxpdkHGUEuflPbudIFDoDhs3c2Jv8U4esCV3eoipaT X-Google-Smtp-Source: AGHT+IEZJyvFhuzGIGZJv++6f9eKF8rmESmx53xFLanbExoNENsrukszXTt5kxcX5eY4EbxwyP7o/g== X-Received: by 2002:a05:6000:4024:b0:3e9:a1cb:ea8f with SMTP id ffacd0b85a97d-42704da3924mr17359817f8f.52.1761220005491; Thu, 23 Oct 2025 04:46:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 01/58] target/arm/hvf: Release memory allocated by hv_vcpu_config_create() Date: Thu, 23 Oct 2025 13:45:38 +0200 Message-ID: <20251023114638.5667-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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: 1761220286683158500 hv_vcpu_config_create() is documented in as: /*! @abstract Creates a vcpu configuration object. @result A new vcpu configuration object. This should be released with os= _release when no longer used. */ OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT hv_vcpu_config_t hv_vcpu_config_create(void); Release the memory allocated by hv_vcpu_config_create() with os_release(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 0658a99a2d1..83db1088384 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -150,6 +150,8 @@ void hvf_arm_init_debug(void) max_hw_wps =3D hvf_arm_num_wrps(config); hw_watchpoints =3D g_array_sized_new(true, true, sizeof(HWWatchpoint), max_hw_wps); + + os_release(config); } =20 #define SYSREG_OP0_SHIFT 20 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220233; cv=none; d=zohomail.com; s=zohoarc; b=Tf//wLit9Z3+CCqaJoVCHNcXaALoYJitWy8sOqv53hOTfAgIU5XhyFF5zQNl/khJ0+z2ejfkRlNweI+crBpwJUGD0qB4wgleHu379PPc/GYjb2ExaQhH1371nYxndoMdM0O5mIsp4qcTr5DDsiQWMC8SSubzgUt9c2YqkzOPx0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220233; 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=JdN40+kSVkstc2XWFNd1L/Cor0bz7CuTliJrlZNlwww=; b=UfOgUHLkLLm1T+vDZj7jNZFBNHmfBxyIgO4w7Bsi+aUW7RllrnSD8a4RoqzBHiUek6N5yGganlTHb6DHkWHDdmMTzHSvSlf/dM9fmwQUU0+/3b6Y7xljXL2Lo5suaW6tPxZtqAkHcy2ViISTuST463mCwHGJ2XBQd4v9SSn6ck4= 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 1761220233739205.4429323309423; Thu, 23 Oct 2025 04:50:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtmi-000600-Pi; Thu, 23 Oct 2025 07:47:14 -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 1vBtmU-0005CE-FN for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:00 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmQ-00020h-M5 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:46:57 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3f2cf786abeso554193f8f.3 for ; Thu, 23 Oct 2025 04:46:52 -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-429898adc81sm3469526f8f.26.2025.10.23.04.46.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220010; x=1761824810; 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=JdN40+kSVkstc2XWFNd1L/Cor0bz7CuTliJrlZNlwww=; b=pOkw2yJmhBIxWs45jwvgm0eV7ZQPS7fCbWtBfLI1ymAzGf9wyaQE+3KDiyjYyPTSv9 chfoojAwLtQr3vNcDod9GaG2Vu4LkkLnDp0OGuc0CHaujBCefK7wCOgh9WKkApsjXayZ w850qNeZM8rOoEXdy/dnnz6RSPl5KsX1Uj5qDxXZDM3V11NgxWXSFsECmpnTsxlkEdsd 7pO/Qh97pICilGB3ELq0fYhOfKaZf7tIVeHiBg6jK67KnSDsLc1pGUWndVLPIby0BCk9 wEBQq1oBf1jfWFiT7xO2JVhnkOvafDIn9ARbP3EyKEU75eKR6EHe6K7kbqfyCsJqyoFX Z8Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220010; x=1761824810; 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=JdN40+kSVkstc2XWFNd1L/Cor0bz7CuTliJrlZNlwww=; b=pVtz6FkAJ00HpQ3cty6hmV+edr3PcqP5wDXrSR027CX7hoTHzN5Y0rggp3lHap94w2 0ACWazAK/EpKwxdFY2NH+oZDF4OleMeTPWTN5ESBAim0k6VUTcpaoqWJycyfHNZVOspd HftKhc/aGHgS+JtirxC2QKDYcO39IdvsAfkJFavRqoU8wQFEmKDV79/wr8KTs4YpGB8g Ed21gjzPVBeknMtTGwA6YN7lMy0hMr5UD0B2+sOPaLm9eImAZm5xMcvc82IQfgeMW5Js iqJQ+tI89XGLxZ85UahfBaAyY/uXus0q7SaWdUAG2Aglji+FbegyJ+tINayfv7zRrT1R 6jug== X-Gm-Message-State: AOJu0YxYwms35IHMPRZRgA0uRfRpZ4TlWFV7KMF85zDRjxsqEh2SMYNZ djbH8cksQ3zB5TuU4lMKZi58ta2ETqMML5j18pPpsxJRkX21JC5t0eQqzXApCS+ScZN5oRvV3qq w3ehTZIo= X-Gm-Gg: ASbGncu7ZKGISVfxKkiOpCxWNV40hcPkK6YjxkSJF9jkPWO8YAP3A9xUgT7ug3JtIgT 3Xp8Ai/UY+9+I/ey4WLcHlNA1AthVhybGvVaDNyu7UvqU/l3JP95zKm4aYxHL+LQQ8JmR70EGdP IJsoQi4gGiSnFAr0gvGx5d5LJTwBLjo9zs64svRCfP5bWCMk0FC7tPDZMp4xbJa7xCOx0k/kZyF y77FojWmobn8HOb+a9dBlvk8OI7+hlG9PlwIzxLaLoOGDHBYEU3ewLebSYdWkM6wWHBTqjwd2ws ZYIq+M0amSuE7wmv0x4UJV+P/cCyQZ6bFZTkQDkHFdKSwU2RweUebtVwLkby5HbJVPZ8g33Gm42 MWPaumYNjEuGo23GvVXyesCPFIJB5olLpYLARA966xTGcIny7vmwsVvY1kvgMLpmMBDO9BNEgup EzCdiueafZjOGA4zBBTSGSIZtThIXaBysJYufz8FXtlhqoB0DY2pet9EohwkYC X-Google-Smtp-Source: AGHT+IE5R/mZXUmIx8K/yYV3Zr0Thay0aTt+AVwPdgKSSZC6qzNAlISGjo4Zp8UFzA9Dk2KERu/fEA== X-Received: by 2002:a5d:5f94:0:b0:425:856f:70ff with SMTP id ffacd0b85a97d-42704d99cf6mr19031297f8f.45.1761220010399; Thu, 23 Oct 2025 04:46:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 02/58] target/arm/hvf: Trace vCPU KICK events Date: Thu, 23 Oct 2025 13:45:39 +0200 Message-ID: <20251023114638.5667-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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: 1761220235968154100 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 1 + target/arm/hvf/trace-events | 1 + 2 files changed, 2 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 83db1088384..91bbd3a6aae 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -963,6 +963,7 @@ int hvf_arch_init_vcpu(CPUState *cpu) =20 void hvf_kick_vcpu_thread(CPUState *cpu) { + trace_hvf_kick_vcpu_thread(cpu->cpu_index, cpu->stop); cpus_kick_thread(cpu); hv_vcpus_exit(&cpu->accel->fd, 1); } diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events index b29a995f3d3..538af6e0707 100644 --- a/target/arm/hvf/trace-events +++ b/target/arm/hvf/trace-events @@ -12,3 +12,4 @@ hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint= 64_t x3, uint32_t cpuid hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=3D0x= %016"PRIx64"]" hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=3D0x= %016"PRIx64"]" hvf_illegal_guest_state(void) "HV_ILLEGAL_GUEST_STATE" +hvf_kick_vcpu_thread(unsigned cpuidx, bool stop) "cpu:%u stop:%u" --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220363; cv=none; d=zohomail.com; s=zohoarc; b=U/YgDLJQoWXQWNBnlAp2iV02MfomRKXlwoOmV5pQiKCZ2KmteuAKNgi8V+DHJPVw+LnJe7VeUBFgUT4SbDwh72bi5IlpfGvcwLkAsglZkC4by4JyTq6JWvKgsQSGGZorXs4Csqmwx2Ag4TW/Xi2Do/oXDDDU2Phf8TG36rZWbvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220363; 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=Ywx1NTEVaZQkKaXvAYoeY9Xrt/iLLGXyjyipFG87mzI=; b=QDed8n1AbcQIbiLBIYA1Tih1a4Bksac0bW5SqkPZ8s39D4v4UrGLI9qvpFn+w1V7tfYrjlJ8Q4StQ1lYDKHfbNeUT+UwVrefBq2b33sX0DiKy2Yaq1HBCug8skuOoEMZyUvXin/5HnzZ27/J2hbwMkvMFM1heDPDQeOyMbY9CKI= 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 1761220363922817.937006862528; Thu, 23 Oct 2025 04:52:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtmc-0005fW-8A; Thu, 23 Oct 2025 07:47:06 -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 1vBtmW-0005CJ-0F for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:00 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmT-000213-Ca for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:46:59 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47106fc51faso10527865e9.0 for ; Thu, 23 Oct 2025 04:46:56 -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-475caea0468sm35327155e9.8.2025.10.23.04.46.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220015; x=1761824815; 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=Ywx1NTEVaZQkKaXvAYoeY9Xrt/iLLGXyjyipFG87mzI=; b=p+rGj4ev3/BLxl6GblkpoIDN5Dcm+0AtOKdp9C+MjOEYnABzElWgspt2brlxkzHDFJ CNR/SJQnfIJcTexjLPCzN2qYt+ycSL3vin3qju+FT0zdcaiBGRcdA0Jcl7YLcP97TeHn mrVCJZ3FMva8rJia4F91+tlsTHkJO4i1LGWAXB5w2JY3rxeTwUxY0NcE4W9f0lBEE2PY 53fNOpPymsBFEOKtdcxiZjA+Wejb1erhdByPFDH7Tf8tuQGtQrhIF9X5yr7KIMU7lAF9 O6pVQdg7MjpgaGY5XFfyMN4Aup+Luq/5D47Bsd5UAutb1wFu5Lykj7QQ7Ch9oEcU9/gV qUBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220015; x=1761824815; 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=Ywx1NTEVaZQkKaXvAYoeY9Xrt/iLLGXyjyipFG87mzI=; b=KZQ08d4PEN14AsfXtOur3g/Zu4YxhUmGxsHSlb7o9SfLRiZU3pu2HMF4RadNVsgXiH oo5M5C7apa/o6t/CVKAYT+J1KQgyVO/GyFmM65B7ZCfvVTKwngNVrHESQwVHhFyl+ntP GJuFpOmyK/FIXFPllg3pxWxqTM+9+hIpLiChG8aNcR+IwKo8e3vrbFQHLlp7zUKyyaH/ laU2R5OP8gSwE4inmbSsdo9qqzrl3W1pUfek52wmLIP6exalBX9O7a/7mC0AEoRC2RsW cCOkgT6g15VBI3NpoQk+S5eeT/BgSEo4/MUMrn/c1j5S1k8gTl5zr/JQATpsHFj2Ol69 TIpA== X-Gm-Message-State: AOJu0Yx5FI7ix3oxFqya+Hj96bOd3+uzLNeU3iyMAgFx6Qb5o6iBb0u5 Emjlc+D1ThB3XlT2MUblYzWDkGmmpTx6o32kbSwWM3i/v1fRHXRFrieGY3ifGvopyQKDOXJJWS8 BU7RdJAU= X-Gm-Gg: ASbGncuRYAq7JoqrNEodZA+W8NprtWFFAWzk0+MgZNdDAMMf+FTWAN0ijajzJz2CFSW UNyRevlXnM7xTYI1lMobMmfN5M7GMw2CjvrRpFxM+etK34KQXfOhbyOfqewFEFyeinbEei6NraV 4P9Si2OntJzZl7CuW58CNEg9E6G0ZWBMsysgmHGGW6x6Qvtt6RiTwdMMgQUrqyqKC4cLvbB/aOV ficH6l2fd/RTSLjPT8pcBzlWmbLNqnDrpMHHwyNT5utxQPrgXkVN8DnBIun3nIShx/A5V280zTa L6yhEmaGpz2VUSaruw5ao+TgzWJs5JgC6PxQlC6Qv3IV/m3HJT11vCHEl4kiDNCv1RQtOD7zwcu FCvRP0qSFqnDiPMEPl2G3ZuAegh6SqYFajfcmbMPtu/NmOQgHeTONiKiPugz5cdMpzav4Z9P8wn 6eN8HcWYHgr98tqgGuvlqbVrYqezQNnNhP0UiRs7mU56shJ/JZCe+rve0ERm/r X-Google-Smtp-Source: AGHT+IGw4gglu7O8489NpdACo5UWYvNq0w3S3tF8X+OJgaau/h3nWhaz0mON5L13y0rSiQoVefgHqg== X-Received: by 2002:a05:600c:548a:b0:46e:6d5f:f68 with SMTP id 5b1f17b1804b1-4711787a2cdmr168135995e9.12.1761220015353; Thu, 23 Oct 2025 04:46:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 03/58] target/arm/hvf: Check hv_vcpus_exit() returned value Date: Thu, 23 Oct 2025 13:45:40 +0200 Message-ID: <20251023114638.5667-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: 1761220369815158500 hv_vcpus_exit() returns a hv_return_t enum type (defined in ). Assert we succeeded, as we are not ready to handle any error path. Suggested-by: Alex Benn=C3=A9e Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 91bbd3a6aae..4c98faebbed 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -963,9 +963,11 @@ int hvf_arch_init_vcpu(CPUState *cpu) =20 void hvf_kick_vcpu_thread(CPUState *cpu) { + hv_return_t ret; trace_hvf_kick_vcpu_thread(cpu->cpu_index, cpu->stop); cpus_kick_thread(cpu); - hv_vcpus_exit(&cpu->accel->fd, 1); + ret =3D hv_vcpus_exit(&cpu->accel->fd, 1); + assert_hvf_ok(ret); } =20 static void hvf_raise_exception(CPUState *cpu, uint32_t excp, --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220084; cv=none; d=zohomail.com; s=zohoarc; b=ZqIf07V1OQQLgfG5DVpONNI5K0LHKAmIrUrfmlaJINXtKwS3PoBW9bkp5G8Nn7lqiACovrRBlUd4VXXJzkuW+D7hQXrBshLixEBb+ojBHDdpQKvrKcClXv/zf51NgTdRiQVQIcIX2HaP8IVB39KmjzavlYI/PDgFCTHhqqcE7rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220084; 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=WEm2BcJk3lcGKEr7IiOVTfv620coTuiYKu5tYc8rMA8=; b=lM76s+B6RH8T+lTENedlcR3Z/+APbVfWLLfgGqOWaO2UT3DpZax/ePC0yUBioXVgH7zQuEOQ8ceUbYXRPr75I1k65gHXFA+H5q42NeVCDquwi0SlxXc/L8cAUrx1hhfQqWiMaz7L2uVtjRD203VCnojCCkPe8z6BCMmR1MJZdqs= 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 1761220084716749.1218685035279; Thu, 23 Oct 2025 04:48:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtnJ-00077k-9w; Thu, 23 Oct 2025 07:47:49 -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 1vBtma-0005TS-HH for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:04 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmY-00021o-HK for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:04 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4711b95226dso7863555e9.0 for ; Thu, 23 Oct 2025 04:47:01 -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-475caf152absm39588465e9.9.2025.10.23.04.46.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:46:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220020; x=1761824820; 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=WEm2BcJk3lcGKEr7IiOVTfv620coTuiYKu5tYc8rMA8=; b=B/m8CyAvrL1dp9hwtQALXfgKWu3ecsnq3ec2stNixiGht3YR70iu3+T3LJ+f3g1XWG B7w4eMwyQmMO/P/9aIFFpbKUy4T9K42qsvvak9XmuHKMueWWS1SshsNuIDz/QL3/ve2b aAmYfkrvf6UAYc1D5NgI0sUB4ktngwknyT97RhR5bzi2YlsFpXcIUQ4HVDnvQsvH+puf KEdRjFlZ42ZYd7QDkNAlfQG1mPnGGniF61OzSkONzwe+j++9g4LiQCEclZdwWoyvJkDz w+0ziOOBTlu+9XNy8uPgUlfDdlwV8LR98dBhZRI+uC8kKPShTV74HYZogaYWtbh43TwH yF1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220020; x=1761824820; 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=WEm2BcJk3lcGKEr7IiOVTfv620coTuiYKu5tYc8rMA8=; b=bLCimKcN4I8Ab1+qAPd/Wi2BLk2YGRIr9Ze1auELIhVgh0YlzSETxEKFWYM6k4PvK/ fPtyD4osy6nq9+doQBhHZgNBi9zncvWxL2vFHHyWbeJsdreLs74GuVqpSWPIig2fGzdk yVgXID8eL/n/GAWYoNoGLsY9h3Vey6oJbwkQxcB+ZsA2HhLG983rCxkwQztKf5FUlHSA ERUc0pIAKOuRdY3r88CkURGqm/nXNDMUF+1M2afzgX76GhU6NsBW7yqRBnVLjtevtC6p WRpUS4bWm66ESn6OtMWj8L64WNbNtwTlGyrUtu7+T2kHGzEHza8BjmkUylSHGUG409Ye nR6Q== X-Gm-Message-State: AOJu0YyNn5L1f8dZ0/PDV3LjXi/QKTmeqwhjW80CFh/i3wwpk0nSWhWD 0zwBG0iNds4huNGrVTnDqSan8yN3aPTjZuaqVgyAJ6YdN96sEBXxNpz5DEgpN1ZXBqlT91mXM+x 7wnx9g8M= X-Gm-Gg: ASbGncsB3MYqTeWZooqyFrAVxjIxoWF0YZlmF8aRrHX9AUGSypDyT3Kx0djw8ZeuBdE FDMwM+EeB2LSSxiFuo6WD4XovwEALOyKUkgPCns2N1I2csIz2FpkKdn0nL5wt8KMhEj7nvvgQZi agaSytmSjJJIxyigC5YJZ6blUzutBuF1MrP9pkjY3FG0w3X3EATL0TwClA28Dd5x2i/FB+lKAWC L2zQQau5Ar5tc2wYBYskRNnFTmU/4a94/NiqkGeSicqJ/W76GFYcCbvytH5B4pjZ4o9YYJHdpet 0zIUweenSjoMCic2V9yPd69mZ7OrMhUo/+AytT+uCyQmPrOAXKmlMuKzkyeRKzaI0ywUjWHTS63 3eFOdCpKMPWg3/O/Pqa63DUZsINAHA4E/uLlhZNCgDbtTCVMWiITjIHSFwrPF2bolc6oOxiTHFK QARiJTkS1bl96eLk7Gr5vqWGxMc7ZVCu3oLHoSx9K4G3Avar4gOA== X-Google-Smtp-Source: AGHT+IFKE5roY/bkcaEQEOTqu3CjBRxYnQ/OO6PwAG+GdSng70O8BIBK0ua/LUwzRZbr5og1Ol1JaQ== X-Received: by 2002:a05:600c:870e:b0:46e:37a7:48d1 with SMTP id 5b1f17b1804b1-4711791f94dmr228790845e9.34.1761220020286; Thu, 23 Oct 2025 04:47:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 04/58] target/arm/hvf: Check hv_vcpu_set_vtimer_mask() returned value Date: Thu, 23 Oct 2025 13:45:41 +0200 Message-ID: <20251023114638.5667-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1761220089262158500 hv_vcpu_set_vtimer_mask() returns a hv_return_t enum type (defined in ). Assert we succeeded, as we are not ready to handle any error path. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 4c98faebbed..bbe0b24b821 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1782,7 +1782,8 @@ static void hvf_sync_vtimer(CPUState *cpu) =20 if (!irq_state) { /* Timer no longer asserting, we can unmask it */ - hv_vcpu_set_vtimer_mask(cpu->accel->fd, false); + r =3D hv_vcpu_set_vtimer_mask(cpu->accel->fd, false); + assert_hvf_ok(r); cpu->accel->vtimer_masked =3D false; } } --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220282; cv=none; d=zohomail.com; s=zohoarc; b=jJeifVgtUPSIdc3DOlbj1BeDCe3HUgICbmDFB3stbSlgzJsBk19aJZsbyAk7RnoAw/HWttLUeYjw57Tb2+MogFLw9+HfzQNtoV4AMhvnr+P/9LyCmowUU1qH9h3zTrW0agdna6HwQxLGSbQLepB/3H1EL6tFAVujhBsNUd++jgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220282; 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=NgDIx1+WcFxzjLnk5TEpP+lXGB26NdtGHoTw7EUXsBM=; b=LBq/AoBT3gYxIAkGdSP+SGE7NZX9KbBC2WbXGsr/VnmeNd3bHhNd3JMfZ5HU19iDZJ6SUZryKOnq5Ybhf3DPEDJ2w5rr7eoihXQxTRxO1Tub5fEjO6mnlJ/hBTV2Z6iWsXanB64QrcT4VQm6qFsPSzgRREDstrvb/7A+/SIF9fM= 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 1761220282507913.573019833047; Thu, 23 Oct 2025 04:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtn6-0006aF-9l; Thu, 23 Oct 2025 07:47:37 -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 1vBtmf-00060N-PJ for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:10 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmd-00022Y-Cr for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:09 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4710683a644so5866785e9.0 for ; Thu, 23 Oct 2025 04:47:06 -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-475cae92067sm34443695e9.4.2025.10.23.04.47.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220025; x=1761824825; 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=NgDIx1+WcFxzjLnk5TEpP+lXGB26NdtGHoTw7EUXsBM=; b=erwlYu3tgYA8w7VxSgXk++1155piI7lpUKHP3cSTNhOPfC4dUf3g5XZi7n8oEFSPy4 NEA/lDxgqMr3JXsRH5s81RAsF6bMr2/FxZm8yHeTXW8ydlwCxtYGVXTjBgDpPYR7W9g+ ywkvQVu2lCYHy9xT4coyFLEP2dqlTlP0IC/41Vs6Vw5iTr9XfN0xyKbPBaYGYMd3Xe4g 6Cdg1TR9manU4d8njmJkQ+WvQ+j99yaPZXGKcEnXoGplXqtjJPTA+shEg6kqf2E84gVt G7H0VU5HwZfSlFy7aH6LjaujkvATL/SHbLrm+1oCCbC/lXsCd11Rai7jINu/C3VqLAS9 n43g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220025; x=1761824825; 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=NgDIx1+WcFxzjLnk5TEpP+lXGB26NdtGHoTw7EUXsBM=; b=LlNa/kj3730HWNJiVC80bFXkqTx83eA2tJzhsDj4sMMRWr3TxXUKjzr4ZIzAFwxApw tssda0/nBxGyzQNeRUwSAZEAow+c190OtcuLlQMLhZ3MZnHE55mu9mYRyknXQh7ACQ4T SOrlJEwvhEXsEfjJifUu16AKLk48LRttrDPm6j7mcg+2RRQIWKm7Kjnbgv3ZG2aQQwkY Me6n438FUHmjTE52QEoRhb1wxT523VrALiQtIKRhB2x2BEWx0W2YVXHNN3VWNB9bSpKr 0cscq4UV9DUDI+HMNRKLFFjKSRqcqI3qkAF7mSWkekfli8bPmzDL3gUaBth59tjAETQf JYWw== X-Gm-Message-State: AOJu0YxxqRCl+GUW2WCuzEjyNBo7Q8YpPdbEe0iv54jUpWXq7lFzJrBm /IeevENmSMJTY75pvT513L6DabnVV5O5537DCS+wTKA0zHVwsItqMxPLD2bSXreJU8d1Vs+9GMg oNtH/32g= X-Gm-Gg: ASbGncutwfxP0VQHfZXlqVh7lGhI5Vr3+tD/VWSyrEwyqsI4+x047kXj48EIcqlyV7S iDt0DlzekgeBUxeU2M/xq1muI2lTgefq21j+kot+7eIcptUp+TcbwoyJhhjMT63gV0xTItC5YmQ /L+bb13oEaJ/vPg1XnLXzpaKmc6089TCQubSYQTzhZWf5jBSytn9li6k6ERapMOaWBItDh7+G6A zQZ1zU1RlDzpaIxFNaxA7TU8qjVNRnEMMlYvRKS0DASkCOA7jp1cxdpWeMgaFdit20361DzTrJB sH/aa9vlBg7q1eGUpA5X6z+cm1sqaTwqy1SMeI3ejrpJ2IUTHQ/SEsBBNl1Wzp4r5A0G/sm7lJC fB79UD2GsWha6+asnQpYwyWWOB1lh+1dQmNI9v1LrV8FgqndQmFgT8MkqSI1CX1MIoBe4dR3Ird kflue0ASaqCOnkdjWZqyta4DQEaUcbtHyeVGun+wOp4hyAPrtlWw== X-Google-Smtp-Source: AGHT+IG7rmXOetjM/ycGc0DJG82ofEII35FjxrdyJN4zQyhDrYycLGkbcna1c9Y47mRGRSy+XMQN9A== X-Received: by 2002:a05:600c:620a:b0:46e:5302:7751 with SMTP id 5b1f17b1804b1-475c3fc0f5cmr49089985e9.9.1761220025396; Thu, 23 Oct 2025 04:47:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 05/58] accel/hvf: Rename hvf_vcpu_exec() -> hvf_arch_vcpu_exec() Date: Thu, 23 Oct 2025 13:45:42 +0200 Message-ID: <20251023114638.5667-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: 1761220284669154100 hvf_vcpu_exec() is implemented per target, rename it as hvf_arch_vcpu_exec(), following the per target pattern. Since it calls hv_vcpu_run(), mention it must be called on the vCPU. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- include/system/hvf_int.h | 4 +++- accel/hvf/hvf-accel-ops.c | 2 +- target/arm/hvf/hvf.c | 2 +- target/i386/hvf/hvf.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index a3b06a3e75b..32b32e1d024 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -73,12 +73,14 @@ int hvf_arch_init(void); hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); int hvf_arch_init_vcpu(CPUState *cpu); void hvf_arch_vcpu_destroy(CPUState *cpu); -int hvf_vcpu_exec(CPUState *); hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); int hvf_put_registers(CPUState *); int hvf_get_registers(CPUState *); void hvf_kick_vcpu_thread(CPUState *cpu); =20 +/* Must be called by the owning thread */ +int hvf_arch_vcpu_exec(CPUState *); + struct hvf_sw_breakpoint { vaddr pc; vaddr saved_insn; diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 8b794c2d418..005e2bd891a 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -194,7 +194,7 @@ static void *hvf_cpu_thread_fn(void *arg) do { qemu_process_cpu_events(cpu); if (cpu_can_run(cpu)) { - r =3D hvf_vcpu_exec(cpu); + r =3D hvf_arch_vcpu_exec(cpu); if (r =3D=3D EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index bbe0b24b821..9111c1d717b 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1788,7 +1788,7 @@ static void hvf_sync_vtimer(CPUState *cpu) } } =20 -int hvf_vcpu_exec(CPUState *cpu) +int hvf_arch_vcpu_exec(CPUState *cpu) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 33f723a76a7..b2bf59cb483 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -721,7 +721,7 @@ void hvf_simulate_wrmsr(CPUState *cs) printf("write msr %llx\n", RCX(cs));*/ } =20 -int hvf_vcpu_exec(CPUState *cpu) +int hvf_arch_vcpu_exec(CPUState *cpu) { X86CPU *x86_cpu =3D X86_CPU(cpu); CPUX86State *env =3D &x86_cpu->env; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220234; cv=none; d=zohomail.com; s=zohoarc; b=UqFWU3ZX2xwyU0GH4J6zM7bpDmQbXQWGSraony3TjtWYgQWz8xEvqFQeqKQnG5q0f1Twzs3DpRtaWuOtWCEXCtZFDI7eVUKIcf9DF7QyrgebvW0/8kmDqT1P4J2qhuP88MARvZ4YEMDIKsURXxLXgWb/J/8Cet3ExLn1WJgugtI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220234; 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=KkbYxHoIb89CcjxtDzTwkp8toB1u3wHDHZNoatR4q6A=; b=daNhDlpcdI2qo9kD+A7OJXWd1U7OkJ0JggCTEP33PhNauuhl3pP/Mr88sXik/V4sRht7cC23henSjFHoiq44/LSSilyisyLTC+NCsMEgiVROw41S7INdUVh8qqM3e3o80+pvMtofT5QwWhtCVOgQo2MX9jTNCpeemNzOzALwyno= 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 1761220234585774.9702969790802; Thu, 23 Oct 2025 04:50:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtn6-0006bA-AI; Thu, 23 Oct 2025 07:47: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 1vBtmk-0006AE-G0 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:15 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmi-00022v-Ig for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:14 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4711825a02bso5902505e9.2 for ; Thu, 23 Oct 2025 04:47:12 -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-475c4342946sm93131315e9.10.2025.10.23.04.47.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220030; x=1761824830; 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=KkbYxHoIb89CcjxtDzTwkp8toB1u3wHDHZNoatR4q6A=; b=tQ2FD4x7hjWKRq/wvTJV24b1bhtPm9U0aYGy1lDEOAVPQ5Tl1pHZoA3GZJl+uanAjm IJLum+6edCBJ4UFsYrnMWyRt032YQIQV1jRS+/wKh5DEGxmt2XaMy7YJLmKaQ3qy9OPp L7Fyr72P8WqLsqs9ME69RR12t9/D9ZMsm+IMoB1d9jmw2NzL8fxuKFtWWcqcNru78U8U t9X7d0412o8F6qd3gHg9miW54LOxl7XsZj4LTJzjdkxwNZYL5Lw/ymP2mtjZXXS1I+3n T3aM8WieBPv3IETrv2SnWulKzUyYVRSbGbDFECPzOOPxKpZWs5a7jJobm4BDtVQc8vhZ W0OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220030; x=1761824830; 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=KkbYxHoIb89CcjxtDzTwkp8toB1u3wHDHZNoatR4q6A=; b=D/p/lii9LvWnRj/ii06nJiGOtbL4sSyTsvmkEN6/6umBuU5c6He2l5KtVGiVCRmuCs WhUoKp6MjYXHo6lBPOlbcKwEO98SGdefvu//dFp7FRm8U66QUvpHb/G4E/pB2YimV9Xk lZI5sN1V/nXTVl/UYbVVYEhL8TyWqbHymVOlSVrKNTHRoeNEUHQfmlllEmPtiCnXQRGZ Xtl5KzPqQSR0lAVqDEWqyGvDnZe5uMKnALUmEgVDjQaKfhc/QacWlle0YHSJcD04XJxo nA4Eox0DJ6y+rqa/PqMGSIukSO0BDXiRqtWeciXmp4Dn+Wumd+8Hq+cnzPPBgD7Q0h1W 7DfQ== X-Gm-Message-State: AOJu0YyNVG/3Ru5tPEgjulJISE+C3ivHuAikYIXqq+vJ109E+seaVyDl SjpPilWDxkLkD4wZNhWrrXeEyYdzDvgoz2t/CZI6jyC+sUCX/cPIxVRx//DWEz2strwCa4044PT ZdzyR8n4= X-Gm-Gg: ASbGncsMaSl9n1eiEWpbwNHqpl0wEbGZdjmDglKQdkKkd3J1m5eOD2RbgT4fRh5hdBS pgRKaPwiFYU1dNKwqI5uUdjOW7oGOo4JMT5b/PRLW8J891+IcG1b56/DnFhlIsfnzxtHy4JnuXc khihVnj+mlXrWIkkcvI/ssrl2wmIWFOPqPlSuoPU5rIgMQp6JT6NB1Mjcr/kYcEwRjMvDD7DPV7 zM5RW+oaCggL/0Kf9zOe+SoZxAeAXyG0DBiq7YfeD3HiTtr5VOi09+/IXcHIJmaBHpdAkZiRfy4 ZD0hb/CND7i243ibTCWC3M5yxJ8dbvDkjHWR1oNKEY8c8ebqOaJGeSdI/gzQuikPdlQ86GM5aM3 AVq685XAkGUK1WRDVxUOkyYzmxHl+nUPul1KVETiP4j+aXaf8wd1LQKgMrKQS80uzh4dwJyCSQo f7rOgiW24YIp98HdUvGUWYPAw/Ejcz2I/W+Kv7fmcATdK+PDYyi1WXFvayFq4j X-Google-Smtp-Source: AGHT+IEqdT6ZWlTexgzs/QHM9TkoBB+5Z18vsHyBCjD8vD9/1grdDB4Dlk+S91jyQocD4B90fUZwIw== X-Received: by 2002:a05:600c:548c:b0:46e:45ff:5bdb with SMTP id 5b1f17b1804b1-4711787060fmr193393455e9.8.1761220030338; Thu, 23 Oct 2025 04:47:10 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 06/58] accel/hvf: Rename hvf_put|get_registers -> hvf_arch_put|get_registers Date: Thu, 23 Oct 2025 13:45:43 +0200 Message-ID: <20251023114638.5667-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1761220235951154100 hvf_put_registers() and hvf_get_registers() are implemented per target, rename them using the 'hvf_arch_' prefix following the per target pattern. Since they call hv_vcpu_set_reg() / hv_vcpu_get_reg(), mention they must be called on the vCPU. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- include/system/hvf_int.h | 6 ++++-- accel/hvf/hvf-accel-ops.c | 2 +- target/arm/hvf/hvf.c | 8 +++++--- target/i386/hvf/hvf.c | 2 +- target/i386/hvf/x86hvf.c | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 32b32e1d024..8fce627b08c 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -74,12 +74,14 @@ hv_return_t hvf_arch_vm_create(MachineState *ms, uint32= _t pa_range); int hvf_arch_init_vcpu(CPUState *cpu); void hvf_arch_vcpu_destroy(CPUState *cpu); hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); -int hvf_put_registers(CPUState *); -int hvf_get_registers(CPUState *); void hvf_kick_vcpu_thread(CPUState *cpu); =20 /* Must be called by the owning thread */ int hvf_arch_vcpu_exec(CPUState *); +/* Must be called by the owning thread */ +int hvf_arch_put_registers(CPUState *); +/* Must be called by the owning thread */ +int hvf_arch_get_registers(CPUState *); =20 struct hvf_sw_breakpoint { vaddr pc; diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 005e2bd891a..3e5feecd8a7 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -81,7 +81,7 @@ hvf_slot *hvf_find_overlap_slot(uint64_t start, uint64_t = size) static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data ar= g) { if (!cpu->vcpu_dirty) { - hvf_get_registers(cpu); + hvf_arch_get_registers(cpu); cpu->vcpu_dirty =3D true; } } diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 9111c1d717b..f0a0e5d1a75 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -424,7 +424,7 @@ static const hv_sys_reg_t hvf_sreg_list[] =3D { =20 #undef DEF_SYSREG =20 -int hvf_get_registers(CPUState *cpu) +int hvf_arch_get_registers(CPUState *cpu) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; @@ -564,7 +564,7 @@ int hvf_get_registers(CPUState *cpu) return 0; } =20 -int hvf_put_registers(CPUState *cpu) +int hvf_arch_put_registers(CPUState *cpu) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; @@ -692,11 +692,12 @@ int hvf_put_registers(CPUState *cpu) static void flush_cpu_state(CPUState *cpu) { if (cpu->vcpu_dirty) { - hvf_put_registers(cpu); + hvf_arch_put_registers(cpu); cpu->vcpu_dirty =3D false; } } =20 +/* Must be called by the owning thread */ static void hvf_set_reg(CPUState *cpu, int rt, uint64_t val) { hv_return_t r; @@ -709,6 +710,7 @@ static void hvf_set_reg(CPUState *cpu, int rt, uint64_t= val) } } =20 +/* Must be called by the owning thread */ static uint64_t hvf_get_reg(CPUState *cpu, int rt) { uint64_t val =3D 0; diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index b2bf59cb483..76a58cb0350 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -734,7 +734,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu) =20 do { if (cpu->vcpu_dirty) { - hvf_put_registers(cpu); + hvf_arch_put_registers(cpu); cpu->vcpu_dirty =3D false; } =20 diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c index a502437c303..afcf737759b 100644 --- a/target/i386/hvf/x86hvf.c +++ b/target/i386/hvf/x86hvf.c @@ -236,7 +236,7 @@ void hvf_get_msrs(CPUState *cs) env->tsc =3D rdtscp() + rvmcs(cs->accel->fd, VMCS_TSC_OFFSET); } =20 -int hvf_put_registers(CPUState *cs) +int hvf_arch_put_registers(CPUState *cs) { X86CPU *x86cpu =3D X86_CPU(cs); CPUX86State *env =3D &x86cpu->env; @@ -280,7 +280,7 @@ int hvf_put_registers(CPUState *cs) return 0; } =20 -int hvf_get_registers(CPUState *cs) +int hvf_arch_get_registers(CPUState *cs) { X86CPU *x86cpu =3D X86_CPU(cs); CPUX86State *env =3D &x86cpu->env; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220148; cv=none; d=zohomail.com; s=zohoarc; b=TQUbNZvn+yHBmlXBay6zaENdauyw61QPu96TuWNpHm377LMC087a1qr4bSPz8RAS6k5PPVzOwt7rCsRRGML06ncmeeY/fn3umsT7FFWbpBT/QTRcuuLuZUw0xKjSUKHMr/zFQTHFB2QiFBgatPawowdJ/tD8PQQ5B2u+7gFWTV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220148; 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=PXz77BrZW3QUmlVNh5gnW4lPNFdnFM/IGe1E/YtD1U0=; b=mjwjM9oZWxsPbBBlRsbtdpNmi9QMZvCzwidwP4eNuAZtEeZO5I4jJgZBO2h572RR83S+F8dOemxDu4qUxvUOjabvnkFwn6vp98JyLBSC9r7t8KJnwBseE3VcDQy+muW5cJUmCwa8FoCEiFdyN4cznRKQ5eB2vNtFFm7B98GHbFs= 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 1761220148966761.9337821932052; Thu, 23 Oct 2025 04:49:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtnN-0007fY-W8; Thu, 23 Oct 2025 07:47:54 -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 1vBtmq-0006HH-KO for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:21 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmo-00023H-Qy for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:20 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-475c1f433d8so5914545e9.3 for ; Thu, 23 Oct 2025 04:47:16 -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-475c428e9b2sm93063075e9.5.2025.10.23.04.47.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220035; x=1761824835; 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=PXz77BrZW3QUmlVNh5gnW4lPNFdnFM/IGe1E/YtD1U0=; b=AP4s2tyk888yIHsq5rxJaiHBNivDELc8peSJie6uyHaAHJCvnD1//4lwfg0GdeQ3FZ 2Xe89JvaYBlSZCAqFuV2evtfcXFY/uObrgHSFfoM421ZumxBuDFVO3LGtQvoUvpOWrT2 8apisztDBH2CosZLYhirCO2hEfQwzJQuh7JVUgyu+3X+kSAtlH3AEjqBZ4kjHAgQMrGk jM9OKQ9B0mgYoL2IB2ANYflRt13fETJ0CUSXyoVEuMABEPVtVmOXt+qyNSrE5PW36EN4 pdhRjfo7NrWvkg+v9LMIimGTHVMC443QlH/3BxJiZQ4dIdjiSiuJfW+9TSqPlL2l41JS 4yYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220035; x=1761824835; 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=PXz77BrZW3QUmlVNh5gnW4lPNFdnFM/IGe1E/YtD1U0=; b=bC8QF9TlcNNqHXPTCMzE0DlYTDuRNnbErroi6uBKkszC5Ky5xCCZs+TgLbsrFhBQar p1FNs3TLoWKVeAcR6klPSbgITRxRXf5O1gPZ/ZaB8DJBeGP7eBwpwAsStFbPHq6f3P3D nv8d4wM55qIV9hQKQ2qPLkjpy4nVKFeE0J5/DDV0tNEI305XtPIw5XoKgpThJrJEbL/i U2GRWUDqZpkFO7Ii3rSxDzw3j93U7KcEOo+ruolT6EDxHCUGFNNibcjAumPh7F1TK0M2 RE61zfMBFeJv+pP96EdxkoWM2+om6ZLR2h+iftZeIVLreI9+mSTTyV0n/wRz+aZsHG66 Ykdg== X-Gm-Message-State: AOJu0Yx98vEPl/pnmeEocu2To4I7n/Pl/QVenDCtSVhjewpGj/iWZVYi Wbm96va0PftHwbvzRImAV+vwEB1LgA5i7jJGfdQGDIhIIiI5CEjZ3kWvYZ85gzzdyEXETOUjP0H 3xV6iwDo= X-Gm-Gg: ASbGncv5tFl+WUaENIlBZQ3j4JZmIsQzABQC+Gtb32H2iqS2iTXG2/jBJItene443PR kBCCjr54e0L/4m1kG6SOGX75pLWBu95wU0OFIwY0ObuE/gOIjM45dCkx7p+jkpDpCHr5NLDhXO/ rwgA7+HWMVjsRk8dCH7tax4VPANVzZIQVx0I8fwSqJlt4CPtzpDR0UwzTifvcJpYPZ6H0xVNhG0 Nd97PKklY08MUNCt/evQ4PVBi3VYMXxO9HTtvPT/ufS/1YgMrecG49F0nAfg9yDO0O6P1n2JByD u0fCQj/ykTeOGcw0RtoS5Wl5vCBmObfoKEwIyR1V7ueBnFM4Rogp4qDIRG6+odenqUQBxQTBwKF pou42kn03T7ZkbUNDyKWJ75ztLgzIV9NYt+GWj5aPqdL+2Aoqlbk+Oy07HdYVhPrd+9EGfhP16W jRcol+Yq5pXFnl3tqaFByYLUfpanxN2r32L8AY58mUD3zpuhp5L312NhTv+0rR5+VQKJi//6A= X-Google-Smtp-Source: AGHT+IG40mtVqCovXd+9LEpjM/bYQFuHSQCHhYNWE4+XKKPR2r/SITrZ2eIfuna2/wOrb33dtGCIdQ== X-Received: by 2002:a05:600c:1396:b0:46c:adf8:c845 with SMTP id 5b1f17b1804b1-471178aba5bmr160769465e9.16.1761220035456; Thu, 23 Oct 2025 04:47:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 07/58] target/arm/hvf: Mention flush_cpu_state() must run on vCPU thread Date: Thu, 23 Oct 2025 13:45:44 +0200 Message-ID: <20251023114638.5667-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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: 1761220150691154100 Since flush_cpu_state() calls hvf_arch_put_registers(), which must run on a vCPU, it also must. Mention it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index f0a0e5d1a75..fdf8df09d4b 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -689,6 +689,7 @@ int hvf_arch_put_registers(CPUState *cpu) return 0; } =20 +/* Must be called by the owning thread */ static void flush_cpu_state(CPUState *cpu) { if (cpu->vcpu_dirty) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220176; cv=none; d=zohomail.com; s=zohoarc; b=DY/BEIx94dCt+bFPVrjn1UftIoKQ94tjChhvXcD73ngQnSQrSqlBjefHLxAaWGUNHw2f+7YZT0Saxv7pxladwfAnGbCKlNEICSfcUep22Ys4/NmTS3SP1c8J4k+QWdXxwVgSoBMkxT6Vln6jQFZ6+pn4RtCyarH8hOGkR6WVV20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220176; 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=rYEkDKuUtDiIDypQqJeptd+MMxIUvh06oL1URWY/YY4=; b=JmijRJmgszBPrDweSj4l+tj+OrdCeurcmtYt2h98GlsF5FRgSwhP5SPP9fHxAtXlDpwM9hxKRZ84xJAw8W9HZa3ww50raFrTquJ9vOffLuReOz8NRVd8TuzR9bXIAFOeLZBAece3WLdMxP/io6CtWaoy8t6VLYq0eJYr+0wCDqo= 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 1761220176407499.0373796296484; Thu, 23 Oct 2025 04:49:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtnT-00086U-6u; Thu, 23 Oct 2025 07:47:59 -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 1vBtmu-0006Ha-Kb for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:25 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtms-00023Z-QW for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:24 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-47495477241so5785305e9.3 for ; Thu, 23 Oct 2025 04:47:22 -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-429898cceebsm3538175f8f.37.2025.10.23.04.47.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220040; x=1761824840; 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=rYEkDKuUtDiIDypQqJeptd+MMxIUvh06oL1URWY/YY4=; b=a/fIixeeUnJxEJPzxeF4R84t8pTZg6iWrUWP5acbqxvBKJ6/JxsiWpq1HJQIvVmSOX Q2ws39zRUq9O4cG4kEGbiHTptPk4Bz91TgaSJVvL/aCxLdS3BTy0E035qumDTI6BcS7h IM7cOFuvaE8lFLfLp+rN+zHZ39mNGfCe192wiIigqU4yDr4jWndcB/l4jWuByGgrmIb0 fegPav8wK/8VuV+3uKuRPGi+0sUxeNZywIwz8CjBu0DtTLLyrkV/ywD1rygUqTIwrbHi X8370bj40fczUhk6MWuzaak0Q1LopNTvDy2H2XchUsOtYFCBEQCi8+aT1spxmOkh49s0 MIhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220040; x=1761824840; 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=rYEkDKuUtDiIDypQqJeptd+MMxIUvh06oL1URWY/YY4=; b=ohoTL43XNzVgqzozCy72EQJkyYS91xRK+etaIwHmsoYSpikbosZmdzikNBee12IMkQ S2OQ+hpMVETVRzyzIcV2rG/voIQ2s243SOGcJNnf27Mhhf8cs9iMhTbptFRKICrOQqX8 gww3NtJ1/af0ThxKENey0fqcEnjoxbhIFL/ql7h9x3zAYOPo3UinmXlzl81Jt9mjQeJ4 +U7J/HgEx6sc7BsQDBmuZqPcN0I6bNwygYDMzVNmVQ91oN3MlVfHykeY6SXWoNiffBsr F5EN6cL9MZ/9D2LyataFe+Fe/fEYq+x3dFe6DGRjxeSTwsHYwGE+WGYIgZfizG0gqCcf g7Kw== X-Gm-Message-State: AOJu0Yx741T7Fo2mvFsyP1la0HP+x6h/47j17UE8Iz+Fd6/UJEiTt+aC LnCd8LVpVxp7aS4xf6L+ucEs6UqnD07peXzneiFTI7pj8moJdQzUVfwL/yrInJPGWQgCIdfBmSs katHE9Rs= X-Gm-Gg: ASbGncsXsRFk+vNoVcTqxrXuTB6LtyTiwWj5S+M6UHLU3fH3aS4Hle4Hi89FL8H7OY0 7NCgv4sA3QX6wo+9KM2x7JFfUJ9lQ9IIzsgV7UTpgUdBkRsOAQUDaXdDsgZBwNEV1nPD81EI1t5 NiBOmcJWGzkGv5rZpmlAnIWChzwxh8qEVV+RxBpe/anbZZ/lQi27Mid6s/TNDKVOBK6YFeEXs8v aNMIY4skCUxI6Nbb7X4mQsNb3vH/l2xpvRF5GX80lNNG1qqAJlov17RFbbcjhrUYPR7RPnGo1/d 0YQMDMTrJ1frE6y9EHgg3Fe+28NcFeephn7sOOCETnIlPLUwL+wYm2jTZo1d+LGOL41cXg8erzh IdTttsZCvwxcj/bqVZmAU0bk05MDFkz/geQtVgMZjrfPU5SKYRkYCLjt/NzIdsV0LnGgt1FORTK Mzc+8+/QN38JykVkWrIEbeZPi5g0wvHFtssHUpr4UZ5B3fHcmliw== X-Google-Smtp-Source: AGHT+IEhCa8nWJvZxaZjBO+0dwM9Zo+hrjKGJMN8shQIydDxpRkwClXOwpsN6LKP9DFFgH5B0VHDPw== X-Received: by 2002:a05:600c:1d15:b0:46d:d949:daba with SMTP id 5b1f17b1804b1-475caf93244mr15127945e9.4.1761220040426; Thu, 23 Oct 2025 04:47:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 08/58] accel/hvf: Mention hvf_arch_init_vcpu() must run on vCPU thread Date: Thu, 23 Oct 2025 13:45:45 +0200 Message-ID: <20251023114638.5667-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: 1761220180338158500 hvf_arch_init_vcpu(), along with hvf_put_guest_debug_registers() and hvf_put_gdbstub_debug_registers(), calls hv_vcpu_set_sys_reg(), which must run on a vCPU. Mention they also must. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- include/system/hvf_int.h | 3 ++- target/arm/hvf/hvf.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 8fce627b08c..0c335facc3b 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -71,11 +71,12 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *fi= le, unsigned int line, const char *hvf_return_string(hv_return_t ret); int hvf_arch_init(void); hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); -int hvf_arch_init_vcpu(CPUState *cpu); void hvf_arch_vcpu_destroy(CPUState *cpu); hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); void hvf_kick_vcpu_thread(CPUState *cpu); =20 +/* Must be called by the owning thread */ +int hvf_arch_init_vcpu(CPUState *cpu); /* Must be called by the owning thread */ int hvf_arch_vcpu_exec(CPUState *); /* Must be called by the owning thread */ diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index fdf8df09d4b..8095cb0805a 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2119,6 +2119,7 @@ void hvf_arch_remove_all_hw_breakpoints(void) * Update the vCPU with the gdbstub's view of debug registers. This view * consists of all hardware breakpoints and watchpoints inserted so far wh= ile * debugging the guest. + * Must be called by the owning thread. */ static void hvf_put_gdbstub_debug_registers(CPUState *cpu) { @@ -2157,6 +2158,7 @@ static void hvf_put_gdbstub_debug_registers(CPUState = *cpu) /* * Update the vCPU with the guest's view of debug registers. This view is = kept * in the environment at all times. + * Must be called by the owning thread. */ static void hvf_put_guest_debug_registers(CPUState *cpu) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220176; cv=none; d=zohomail.com; s=zohoarc; b=B4TEmLD1YntoCDtWdtutHYpiTFRQIIwOF4/m5GFClPToMBAsLy+jLHg53VFnF4O6epQdMo2riHHszHycrnQP6fJdLAKe/dSHM74yA6yT72F/wpd4pfuIdGjhoLfyangkMRF6UPdXsQO41HEV++vIVYT4nUJX/N7hRfcKmWJqvE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220176; 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=h63K7KJw7fL2qe3qT9jwFp5KsLmsyTaO/eJCwYKGslM=; b=G0V5J1U1QFn0ym6/SvJDjxJJJgmBlXVINqqDpbPxlTZXN4/tumFYni25w4bI0k/xxk/KT4j/HjfQ42EAS+UxYO1/XoowOXQqr7AKycjg/K7Oft5DrK1SrvV/prl94Ars9mc96iLLyYx14K9qD8eGU55SVru3OhrbkBpI8tuEOgE= 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 176122017639242.52867381229976; Thu, 23 Oct 2025 04:49:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtns-0000Sc-P5; Thu, 23 Oct 2025 07:48:25 -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 1vBtn0-0006Yg-3V for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:34 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtmx-000241-Ky for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:47:29 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3ee15b5435bso482635f8f.0 for ; Thu, 23 Oct 2025 04:47:27 -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-429898eb549sm3504059f8f.41.2025.10.23.04.47.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220045; x=1761824845; 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=h63K7KJw7fL2qe3qT9jwFp5KsLmsyTaO/eJCwYKGslM=; b=wHcW0hHyPxQOfE1uS8EoAiOzB70GBDFhtjp55TCqSYmyW+bOO1216e3jY48cR3hk9S pOmKvObeCdAwGA2WlrPIbooFa4hGaOAZkFbkAvWIlYjMXj39iOIF/yLRm7F3HA1oHJ5y CJT4B7rQgo3W557dohw20PY7fKEB8E8zSzlRdXw2PfHEzDJQ2iqDKfGDAFPoN+eGSZsJ Va6b4vDqEHvVD8GzUSRBLxmYAncTbBuZJ18y35g1HkhRDED/hbUVWv82kRofNsG+CP2u QfkBlHkabKLCO3tJ/1WrJ5/fbgAC+vyvH3BeWDynzH/H9+5V8AKmbUl1NvJ5tSeXAiIL A23Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220045; x=1761824845; 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=h63K7KJw7fL2qe3qT9jwFp5KsLmsyTaO/eJCwYKGslM=; b=jN5EX3VLufngjcC3RX1TOHx7T9m+6wd/WAh2ZlMwXXVQZIUtAc65yYxz50ztT5AfU3 2xaWi4FF4Bf4WNipKMtfKwSdQ+V4LU/YS+ZjTeWbbwjMVOrw1GLTO2PPm4X3y+hGMYzX eSAnPpYiQ85JCXv48J4lNUIhZaVCJj/gbH3AxnnhL0nxi04zkilmVQvvTgxLfrzd0LPT j6Say/04JYjCAfO+2lSpB9+ZvsZ+000HJwAlA1azkYYSI6KvvTjH0OLy/r7NFRMNObFF XvJ8Qb1RXOS2K/c7YTkW3n2JcVaP8BWp+dRxQUtC2RLTO+WEaDXrnBth4df2tzjwT7Qc SdHQ== X-Gm-Message-State: AOJu0YwolUwYt1hoUitJNFT57+CglOYtWGHsVrvEUgo0OjojLGYBGY/6 r67XQLEfepGQ1YWsIpDLEfkTNQfM0vQJg9fE5WeUSrd0uLDRCFeI6aj7lqTETdcGO68gDtThPTh DAlSMlVA= X-Gm-Gg: ASbGnctJGZhq7U34vfgS1h+bKEM5r8Pwg/LLAVhmd/pdWdloGakopiQvGhqpQ+1OJgG ZkJgLTjPMmMbf/Wh9hfXtW3l0EcZ5HY0Wi5lTuY0C7v9d/KZVS8/K3K1PvNHDBSc5uEIecZ61PA g+JwykTXx+ZBovwGJTYDKOoAXWmJjxeOVQ60dTWzNvbyb2tLDkuSRToxVLlC1lo6X2v7+JmY/nU oIj8Yqx1mG6mBsc8Ucvhj3HABYl3NGehA1iGGiqhVSFIoNhQq0lzUP3KxDqU0xKOzQq7sLOfHC7 3rz5ayFEQlkLNH2DjVRq2bwvOROcBU8GlFDDPrEm1RFJTmru6vVlZnmk8Qr//903BGB0ljjOpjC GF6LkD7YNTMObG0NgoELP4L6aAPdH7rdi/+vQntXdWQ5Y6cVACe88GUIOp7vOQyV1UIFD4ueLLg LmgFB0kcNx5c56c9rtQk8ZPF8NrzpezbwPPg90v4hdpyq+eGgmCnZEd0Rf6XDQ X-Google-Smtp-Source: AGHT+IH0JlxvZ9Ihmy0v6t2EA57oaNt6DUR1PpvSghdctPnkjO4L4AcRnlPzRxr4t9cbHTlxQ0VS2A== X-Received: by 2002:a05:6000:2409:b0:428:5673:11c5 with SMTP id ffacd0b85a97d-4298a0e94b0mr1607432f8f.61.1761220045357; Thu, 23 Oct 2025 04:47:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Cameron Esfahani , Peter Maydell , Stefan Hajnoczi , Richard Henderson , Roman Bolshakov , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexander Graf , Paolo Bonzini , Mads Ynddal , qemu-arm@nongnu.org, Peter Collingbourne , Phil Dennis-Jordan Subject: [PATCH v2 09/58] target/arm/hvf: Mention hvf_sync_vtimer() must run on vCPU thread Date: Thu, 23 Oct 2025 13:45:46 +0200 Message-ID: <20251023114638.5667-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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: 1761220180315158500 Since hvf_sync_vtimer() calls hv_vcpu_get_sys_reg(), which must run on a vCPU, it also must. Mention it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 8095cb0805a..bfccf5e9a2a 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1764,6 +1764,7 @@ static void hvf_wfi(CPUState *cpu) hvf_wait_for_ipi(cpu, &ts); } =20 +/* Must be called by the owning thread */ static void hvf_sync_vtimer(CPUState *cpu) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228835; cv=none; d=zohomail.com; s=zohoarc; b=S0uFXsJzkhYkyvM6mUeECZdyBpc5B2fbgilNjtOu1i0DM1WUSvtL9XNacjN/UjykpZ/nZwsmswLWqPGvg68wJPL53VeoRn6TZkVck+/WM2aGyUhqHvxp7tGBmA98NZLWoqsiowj4gY1ew9gW47iFXFAVCY11YQsbcw+fGuErOUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228835; 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=/Jp6xdYt7Qm+0J/pdgQITMBLjBSEIftoO6mxQrB4mn0=; b=ihUPqtblgXtH9TlllCHquMlMl6IpdAn6DBLFR3WF9BuglxeBNgKUp3MgwsvugMZKf0FA1+80XspM8Hgl8DJ2Ar4frWI+bzxjrcoB2XXwOgdR5RCiiScwxa8qZJLY8rYdG3M1HCPKhlp72SELbqAf7ATqv0/qcpKhViA89juLcKo= 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 1761228835854716.9891478299701; Thu, 23 Oct 2025 07:13:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw4c-0005gY-6h; Thu, 23 Oct 2025 10:13:50 -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 1vBw4a-0005fb-2L for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:48 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4W-0007MH-3v for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:46 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47100eae3e5so8893975e9.1 for ; Thu, 23 Oct 2025 07:13:43 -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-475c43900e1sm117463675e9.17.2025.10.23.07.13.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228821; x=1761833621; 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=/Jp6xdYt7Qm+0J/pdgQITMBLjBSEIftoO6mxQrB4mn0=; b=PF2YNPXE5IopRNiFkc6/P9emOjXL6OKSX7iB0gGpKth3a1trGs8kOPPyxEXDwL+xOp 71LjStc5ajpdCxBPfK6vj9l3oxA89MnWuXdsrfeqCQ9q063jt9YQBjq7qvYV3qVd7LFn Xowdg4OWESu3QQja5w/QCzHpcx/A5SIT+PNTiqVH8bvGk4WLvQW+38NdVf6NxJ3VD0OM hu/8z9IUZMbK3XJP4kMt+mQvoF30IrYGTId3M21Ibz2BjY6jN9LfMOesY988Jr+MTeub LfTIdbw6UqFLLQoc6M21+X439LmIMODOJ2uHl4TbEfBfUzbqlu1StvYTDR65VqGg1G2T O9hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228821; x=1761833621; 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=/Jp6xdYt7Qm+0J/pdgQITMBLjBSEIftoO6mxQrB4mn0=; b=h18rgmYMRMDBGd+skHvHkK1SDgy68iTLQTc9ngjyl9SoAsz9bg8r2b5dIO6VhJws0A r+ezCw55UuJug0UuxHO8VDpHJjoeC3WtPssc1/BNQdl3yI79J6vT+RukLOG1SbPVSmLJ aqeCnkUMgnP3jYvBt8096v3SqmGm6jij08kBXpTpquyKgqq5WbwNdr+L+vjxls7NeOvX XtnsCFOBs3mjUwO6AtgcObPqnWcOFA9GaB9zVPhXXF3v158nT8AHzyWvQfrxOOZCJLiF 9Jm7MnO2+sThUMcIu0IdMPUMl+AD+Fx/s7FanpeAzgdRJW8VGwyFxKIYUuIB++SjzGx9 EcgA== X-Gm-Message-State: AOJu0Yz1Fm8jFzzoORAyWSgDZ3BIs5TxpeKV86IB6og10lnQJT7EOP52 3Syrf6PGwpJmZt7FdDZLomXG8vXixNQAnIiZmnPVcc+W3xTTTqUcIp2Ssm2/VealSYZyxZFO6dd uwvnG1XY= X-Gm-Gg: ASbGncvoPyNO9Iy2Wd394erWSQ6C0zlL33iI/4nCVDTOyQfr3XQ3NN5fBL94Ftg8HCr b/217caDA3XdWa3DjWsMc4864C3TEdL38p3fvpfNFbPInbHHS0EEvASWKthib/lSU080emFXhoW I7yh8lhjs9iST+Vp04e9q+GRGsqh/l/hb0QtfTs0lbn/cE/Ok1L79yEJo//eV1XSgdfh35KiDUk EbES3FxNHts1AmNn0BZ0EyhC8iSxUVcLGDLBD9ITTJPbvpoZgDBe03jfMHw0O+oZmAKswkDLWrw jncy9q1lNuvPI/4HiLrkiVmusK1rJHtm9TiyixAmfCHgB3kmbahqew12R7AxO4G3JRA9mrwJ8Xs B15ksTs+0Lq+/IujgrHvmbX6egj86S/X7C62jmYaD1yzFlZ5SEtteZwaOoPzpl47phPN/S8nN6p 1QBluhXY69n3wllBGjQ6oTKQzZpah4F7QXJxXu42+fVX50zaaCGhL2HYNqYfej X-Google-Smtp-Source: AGHT+IEnnTwsXVBYIuBp3v9AGSUlhgGakvZU4O00YAw+251OY8sxd7ngtnxckQj0WYUB6nVCavx1QA== X-Received: by 2002:a05:600c:5009:b0:46e:50ce:a353 with SMTP id 5b1f17b1804b1-471178788f0mr173644175e9.14.1761228821121; Thu, 23 Oct 2025 07:13:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 10/58] target/arm/hvf: Mention hvf_arch_set_traps() must run on vCPU thread Date: Thu, 23 Oct 2025 16:13:29 +0200 Message-ID: <20251023141339.10143-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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: 1761228839479154100 Since hvf_arch_set_traps() calls hv_vcpu_set_trap_debug_exceptions() and hv_vcpu_set_trap_debug_reg_accesses(), which must run on a vCPU, it also must. Mention it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index bfccf5e9a2a..ee04943b0f8 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2192,6 +2192,7 @@ static inline bool hvf_arm_hw_debug_active(CPUState *= cpu) return ((cur_hw_wps > 0) || (cur_hw_bps > 0)); } =20 +/* Must be called by the owning thread */ static void hvf_arch_set_traps(CPUState *cpu) { bool should_enable_traps =3D false; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228907; cv=none; d=zohomail.com; s=zohoarc; b=h9u4EdEQs6qUOIbKlgrXbhUdDsV0VytueK6yk9N7Xr9N3Lw+XazY9P6xvJViVJMfb+Uvf62g056jKYF52iOBeJz9KcFmViilDrm8qW+IjSO6vtIGXH21kQUVX6FLRan247sKs2tm1sDf2jHtJTa67Mw3rY3pwxByyjipk3ghCyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228907; 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=bn2C92Ox23h5s0IuScw63a4Ihrbd//B4afSM1bgktqo=; b=ldEAajVNok2zkQRlX7/cqAemsKl2mSlE0WuGQKKn00ihTqrskhsSshMMSWQv9iGuJqaqpynF4LNBiXY08TGN3FF82NZJ5YlB6+BqxCe6rP49dEFvHVYUAcm/a30lzH5dCG/1ubmsB/BgHy6X/qDlcFfmN0l+XGgpQVXCMRvT2XQ= 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 176122890763111.78279592048034; Thu, 23 Oct 2025 07:15:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw4f-0005hx-Ad; Thu, 23 Oct 2025 10:13:53 -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 1vBw4e-0005hD-11 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:52 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4a-0007MZ-Gi for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:50 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-4298b49f103so214635f8f.2 for ; Thu, 23 Oct 2025 07:13:48 -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-429897ff3f5sm4349458f8f.22.2025.10.23.07.13.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228826; x=1761833626; 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=bn2C92Ox23h5s0IuScw63a4Ihrbd//B4afSM1bgktqo=; b=zCut6CCnlIr/hJcruYMVtZg71sK+5Uh5Kt2OVLSn3yHPnIu5e/kkSb8HMwVNKOZQof en/ue5ACG0sv4DDSe/DrysYnT1enfSszzE8QpfxR006zCtcRpVMg5gdkZfK6jmbEFY0I sERYil58MJSPZyuSf3ltpFFNHAaxX88TK0BmumuWx370on3GBMGK9MKceIpwdMuC6qov MoR9c9/NUAz50Zc7h+WMapQ1UdGdaXWdpMMAPD24vdcfP8GkBzfUnQkNbF3X3ZlZ5Syl hVLJRhpjI8HMaAebltvRT5kqZjhvjOFkJoNT941My6bqfzB+yyD2/1/6ebk2fdh6CpKW 5JZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228826; x=1761833626; 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=bn2C92Ox23h5s0IuScw63a4Ihrbd//B4afSM1bgktqo=; b=VMrzcpYZzgwN3tYM9+VkZtgitFCfMcaPOzkmt+LysCE6DfkxtnBG5+/t1AWBWKzCjU sYQnHNZA26SC4slHnMdqMJnEOkS2JqdPW+vXnBArrb+XWDrsaNbWkkvSXwp8TOQ9Nm10 h96Co3AEUgy9s5p+DO+IfGvozbl/NiSnHrajTdk7THTW+tiz2ljrdWL350b+LVxAVkpQ rql+kyrDBdBaS302wvpFZq3Coy9QpJT2qt5wOstfHhgzBz7GZqz2JG3md1Z7LnT7iG3Q W1OfiKjGm8RJXGawGeIf+7KMs/qb05gS96dCGwXj1LU1JOapw+v90ozSwsNCkMNiecOZ bm+Q== X-Gm-Message-State: AOJu0YwgvK3YABlaWFKQ3Y+Wft6XReMuPLS34rP7C57pldE4Z9VlM+d8 E+bmd7wkZEbuI0zYaaY/Qxa6XfIY4ozbQIWPBUBfeLGQZ1lBT709MTsxdIDR390brmcmPnNWq7V AUPPwxJg= X-Gm-Gg: ASbGncs5nA/KtI4sQ+x10nMUD8aKqGZRS5tP60EiCb8/33LQStSqEia9UcAOx78tUAN C5HzSMlzoftCGeoBWSp9V2XKkt1mCQ35d5KZS3timvkrw7xBhV0/pMdDI1QJT0aVChoPbddR8J6 +wqr1ZivpMWMKqpnyFtg61SfngFLc4262n7B7x4DmaOW59vqtrL3EqbUkUthxFJ5f3asFAgivXT lB1inPXehpeGSz4PS6JYj8OdS/6M4SgmoDmc9yoIrpnhZJYT9Rh58ifSwFrokxnn/t+f8UnrEdt c9Pd07VNilAoy+WBR3tlapeulqZOFA16U9HbJMxW7y/UuOfJX0gH0jjgChyo2L4ZBFHaGQSEEpx lqXAEOEojkkaOPbwHlBt/H4xuQ+3FY2hn2Fez+XV2mrG269CfWLkj2HW8I4EaG/DWLBRVPzqHDF 9qYQ7cjAdOi644tF4ylYumizYVDhC7SdwxWTWwDaL5G6kpaYGDCCnWPokPjtRx X-Google-Smtp-Source: AGHT+IFOObY4FZQI60HAKVyYFMcVdLy2QIR00SAsee7dM4Kc4Y6LZN9jVb7S4ynbEXe1Qt2RZDCCiw== X-Received: by 2002:a05:6000:2884:b0:429:8d0f:eb4 with SMTP id ffacd0b85a97d-4298d0f1116mr410025f8f.28.1761228826243; Thu, 23 Oct 2025 07:13:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 11/58] accel/hvf: Mention hvf_arch_update_guest_debug() must run on vCPU Date: Thu, 23 Oct 2025 16:13:30 +0200 Message-ID: <20251023141339.10143-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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: 1761228913966158500 Since hvf_arch_update_guest_debug() calls hvf_arch_set_traps() and hvf_arch_update_guest_debug(), which must run on a vCPU, it also must. Mention it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal --- include/system/hvf_int.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 0c335facc3b..241c668795e 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -83,6 +83,8 @@ int hvf_arch_vcpu_exec(CPUState *); int hvf_arch_put_registers(CPUState *); /* Must be called by the owning thread */ int hvf_arch_get_registers(CPUState *); +/* Must be called by the owning thread */ +void hvf_arch_update_guest_debug(CPUState *cpu); =20 struct hvf_sw_breakpoint { vaddr pc; @@ -109,7 +111,6 @@ void hvf_arch_remove_all_hw_breakpoints(void); * handled by calling down to hvf_arch_update_guest_debug. */ int hvf_update_guest_debug(CPUState *cpu); -void hvf_arch_update_guest_debug(CPUState *cpu); =20 /* * Return whether the guest supports debugging. --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228989; cv=none; d=zohomail.com; s=zohoarc; b=I/X8lPnZp4tXx2ApMqEDaTQZ+aqTUOND4Dhub09r14qPnAJ/mShTF+QkdawjkB/9u7jR5GB19Dun1hSLlUueiPwObO7nkxtP56IcL78/5CUP3ie8jkV6GrWPZvzklP7dkJae4ID3yV0puiy7omxoYvXKBjuCgKNRc3nQociATqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228989; 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=zY05lUWL5hjS7DHXCd+KmMwND4lCTa4Rhsa0suClLwM=; b=bdu5XJCsyCg0rEQwOwaiOZYbIqpzDpGRnwlgyFK1PW/QT1VCPKanWJ+nqWP9l7y3epYiJmaC6vOVtA0LM3+4MIP3eaXubJg5nEo6974/V5QFxoA+D6wIZcUXba/bW0W9yRcH7gGm99nGprx3hCWiTzlYs6SroQuLpYROpIVdrGE= 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 176122898916954.78376430579101; Thu, 23 Oct 2025 07:16:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw4j-0005lk-AN; Thu, 23 Oct 2025 10:13:57 -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 1vBw4i-0005kC-6h for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:56 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4f-0007N3-Mm for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:13:55 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-42420c7de22so437066f8f.1 for ; Thu, 23 Oct 2025 07:13:53 -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-429897f57cesm4405567f8f.17.2025.10.23.07.13.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228831; x=1761833631; 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=zY05lUWL5hjS7DHXCd+KmMwND4lCTa4Rhsa0suClLwM=; b=rp0XvCetBO0tu0kraSVYqj+hjeIjs4TP1eqhEOH9Jw2OXuQXAGw46CX3U7xm2sNYua KEknV3Fm5uZobVibxQ+4un9OVXC56KYMh7papS/FrSufnSWHYx3Uj5I1kGem3lqe8T9/ hE0wfaUjpXDRMb5fFtUkn70dfYb7FikkwJ+sSf1qIQtlpiKiXnQrhCtLKIt2sFp7K4nz bv9KBYfIkQfpZOxG5GNOu8xk9ZRCddSvQmOl0BCzxYKg8ZklREkWRaPjJT6aP3qChB22 7RCtSjlnkfcFln8tqI1g/4roxXWgSQUIlSxNd1j7USNkDvdWAsM8VPu8dg/aeZa5pozR hqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228831; x=1761833631; 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=zY05lUWL5hjS7DHXCd+KmMwND4lCTa4Rhsa0suClLwM=; b=K68CxL5fjkKPhlEkOeshDbiI+K4ZramhmIdKI9kblMDiO2GBRYgHrvyuebQn+Y0A6a eh9zz2x0MgLq29nvz5i6IbBMMhCd40SlGcrJMXtThG3e5NQrPNROkKl51Vv6FNd2cZmZ dmFdG0JvEtZu5GKQBIOspH/LOmxqAhy7YQFK4C42b1agYmn90lZJpgUXtRYeJGjkyOpl pxfWRLlmH88uZle+Wg50cn6jJ0pXTLC2TiynWD37x1oKnjgZwUs3M0T1PgcVOu7tWKlf kZKvvrwUOs4/Oc5xaBeUOD5O5fLmvt8Z7y7HQZonCu4OLLPhaAeebPEfgthoqb2+TjEK EeDg== X-Gm-Message-State: AOJu0Yz4YpQufefCXwvtOMGvwSG0RLNKGNZaM94GPYldpRuWbyfVCBHh loByBGtrN0luTo1kcPbFYx9PFTBm6CO+T5eB/Y1KZ/GpUvBhkB4qhcSfGpfoTFrXMXku9jz95hl UCWeW4Ik= X-Gm-Gg: ASbGnctDPxUmgrqYn/JJ0WALFHXgKGW3DxBvKPRQU8LR9z8k7MCF+y0psXZpVDtFvJJ +i5+A8MN8v9e8NbsKTqeNrmPKPOQ/zsUcLbqh9J9+4U4xydFFO3vzpuw9esH8w1L8YcA/z4itss pNvmjFXF3pIUIbRDlTHNgebvI8USMAb79SkO9haOvn6AGM7vNsK/doMttbkZZgRKt9FPCetisIe /L0gzzqk7aMZx9BDH9tumstM5KkYp+6wNwnHvzBlfbujwLdk83bzSGwRDrgfcgUo8U+0i8H66QT 9p2C+RC5GAJiLOJwblyeE6hND+Y1LZidSIOBikuaRB6Hm1Cf/wojCHG5WpiZqoXX+2KZEOnMevk jTkzD6vSeQFCAGfz7IxmZMPegWE8GQoDgqkA1qu8aIlU+K97wAR1ECOWBInr6HQxu40D03SsZTa w0qvRWEqObv5aV6BMTmiMv72I9aPcQ8AYnwMmDCEvufjbheWo/hA== X-Google-Smtp-Source: AGHT+IHKALC50pEh/jaA/fWPXts/42PDw4MAyTPilvL5xMm7aMDasliC8OltecvOzQmm8C4mc4pS/A== X-Received: by 2002:a05:6000:184e:b0:427:e1bf:13db with SMTP id ffacd0b85a97d-427e1bf1a8emr11593709f8f.54.1761228831549; Thu, 23 Oct 2025 07:13:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 12/58] target/arm/hvf: Mention hvf_inject_interrupts() must run on vCPU thread Date: Thu, 23 Oct 2025 16:13:31 +0200 Message-ID: <20251023141339.10143-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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: 1761228989994158500 Since hvf_inject_interrupts() calls hv_vcpu_set_pending_interrupt(), which must run on a vCPU, it also must. Mention it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index ee04943b0f8..0d8ff49ae15 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1664,6 +1664,7 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t r= eg, uint64_t val) return 1; } =20 +/* Must be called by the owning thread */ static int hvf_inject_interrupts(CPUState *cpu) { if (cpu_test_interrupt(cpu, CPU_INTERRUPT_FIQ)) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228955; cv=none; d=zohomail.com; s=zohoarc; b=NPl1FVaQv9zEqVU6ME4EcpR2jeaxi04j1/j3BU+6fihn80S//PSpQVm/z5D7R7vfmG/B6XMzecxmHNFzjZnuim2acnfv/m9b5UJklQVRQv+b0MqaBOlsROKOBQ9W5eTpxXr4tEIbFq/rFrTsAUB/N4qEbKvV2m+uCz9fI1sJfYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228955; 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=jq0durEu5s44u22O42W1RyuWwO721rs5WZGhnt3B+SU=; b=KDnAgmQOACNicnK66r8XHCBepke6nRh/tVHOPcMjTB1i4SMFS8oY+AZeybHzBUMdOqud/C+Qha8xYWAGgY0R03m/Q7pirufBuIrFy2iCQ0W04PwMuMR3xKlR43eot12izlhEcFO12WfKMdgYDlM75z9Vew2Zqa6J5yOicu8WhGg= 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 1761228955090648.9065784696439; Thu, 23 Oct 2025 07:15:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw4v-0005po-Fm; Thu, 23 Oct 2025 10:14:09 -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 1vBw4q-0005oh-Pw for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:05 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4k-0007Na-JK for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:01 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-4270a3464bcso684008f8f.2 for ; Thu, 23 Oct 2025 07:13:58 -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-429898eac60sm4121873f8f.39.2025.10.23.07.13.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228836; x=1761833636; 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=jq0durEu5s44u22O42W1RyuWwO721rs5WZGhnt3B+SU=; b=d4BZtO+HsqMkhWpabsJloHcSh7f7RNK+M9tWIdfdyVATk2xYet8yKuEu53a1hTONEz RXMFQ/SDCxgPkE2ZLkdb+I6lwxOneYbLmEswQrvmBSeeaoCJscBKY8o+aulDPAl+3B/j V/su+x/r1nDEMNHSGjEQjWSKgBXrzilrvqT4XqobULotg4Lk0iomNuaoLTNX2pPKzP6w pBWdTX6NRgR40hL/cuQXvY63w7p5d71EPb5Jq4aMb1JV9PEgBbqy8TLxChgxNCXXUS6l fm4sSAJFSklo+MwmvI9Ft0JS2CG0oXWE0duoTG1BgUx2IY+fojt7T7iAFqMhoCiu/WC0 XH2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228836; x=1761833636; 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=jq0durEu5s44u22O42W1RyuWwO721rs5WZGhnt3B+SU=; b=kCddpP4Ouemyuh/2YmnvupeOnUCdkKhwoOUhgMUQ1DSFOYbo/1+uRvuPmpQ/3CDmvc kCLgajtrfIaEGYFtxvchODb7UxipLThDe8q4bIZkUoNymTcuj1Rh0o4a6UZQGq5V4cjd h5/vPPQlotJD8EFxz+zc3J5/qQRIii4S8IqRJCTU82UrBT0+2hegU5W9T5vNCqBeefPa gQ4ibmqpjgzAxxuUj3PCrXvS/67PHi0L8kE030n5XjfPZE4ZfY2kylT01YWxJclOoX3l kjMILOBlBAa+elwqGYhfBhvKfqa5Ox8/m261v8NWP1RTw/TMyMS7sNuvr+gsY9KhaocJ nDLg== X-Gm-Message-State: AOJu0YzqufxM6n65y9I1ikHdBU+jP2TUDsDSMgUygnUb9x6m2kKF9kkV LTGzkG6uazZj9suj/PBrVsdMmu5edf1E3d7niRZzVStw77+G+wGzf4JMyyugEa35T8V7dCT0TgA EVBn0mzY= X-Gm-Gg: ASbGncvSXBzvsO8wwZRpQadFZrA6Tiy84c2t2z8IUU5BUcKPOdPNT8KeuHzCOO7Tg5p kkAZLzdnC4qmIQoCscNpY+oAQwLHlE7DQ6w1PmWLvxuymvuUxRjXU9dWBmElZM2oHHfU7fIA43R KiJIJBCYF2kmC1PmAgYfeMJwrQDafAZPL+H99Iz5BJfaCOHMLD8zgKjWKyKt8SF4Oj4iTZcgFez GmkrLloPeYEKxa2xrxR1O+0tioTC8A5fggbf8MDjvypOAajnq9Y93yrz7nAFOrFqa7zpZ2ZYbyW q5CYlvia5wxJ9FyVVsw4eExoUz34Ndlus9XCQ8dmCdWOonOyCCiN2C0W7Vp7GrakJhKUpKs2jcl boct9Vb29OQO7IdUdnai9e9MFHoXef1Yn6syIsgrVqcMzxXmVG+wxoNgijWYfr8EPeD9HjUFIyG vinWsK2wWD+94+Hi5lLpY53KThAZUmcte03e1fk6Pbve7YMwGZBDIXkYmvKGcD X-Google-Smtp-Source: AGHT+IFd5QpIfAz1QuuANrs1jEzRB66EFhYBVTdort4wT4SE9A4CJ36I4Dp4JRxBv8X+cyfFmMLM2w== X-Received: by 2002:a05:6000:420c:b0:429:8a71:d57 with SMTP id ffacd0b85a97d-4298a711154mr2198314f8f.27.1761228836427; Thu, 23 Oct 2025 07:13:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 13/58] accel/hvf: Implement hvf_arch_vcpu_destroy() Date: Thu, 23 Oct 2025 16:13:32 +0200 Message-ID: <20251023141339.10143-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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: 1761228955765158500 Call hv_vcpu_destroy() to destroy our vCPU context. As hv_vcpu_destroy() must be called by the owning thread, document hvf_arch_vcpu_destroy() also does. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- include/system/hvf_int.h | 3 ++- target/arm/hvf/hvf.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 241c668795e..195d64dcf18 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -71,13 +71,14 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *fi= le, unsigned int line, const char *hvf_return_string(hv_return_t ret); int hvf_arch_init(void); hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); -void hvf_arch_vcpu_destroy(CPUState *cpu); hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); void hvf_kick_vcpu_thread(CPUState *cpu); =20 /* Must be called by the owning thread */ int hvf_arch_init_vcpu(CPUState *cpu); /* Must be called by the owning thread */ +void hvf_arch_vcpu_destroy(CPUState *cpu); +/* Must be called by the owning thread */ int hvf_arch_vcpu_exec(CPUState *); /* Must be called by the owning thread */ int hvf_arch_put_registers(CPUState *); diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 0d8ff49ae15..d13ccf5508c 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -868,6 +868,10 @@ void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu) =20 void hvf_arch_vcpu_destroy(CPUState *cpu) { + hv_return_t ret; + + ret =3D hv_vcpu_destroy(cpu->accel->fd); + assert_hvf_ok(ret); } =20 hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range) --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228967; cv=none; d=zohomail.com; s=zohoarc; b=PzaRBlpH8ghCu0VSAoLzexjtF6zIaPvYxISyJ0WhXailMMJ1FT2YCwtX6oHDXmzyAC21GcSrq2DhjYnwPJtkN9r+ZDCdZ+Kd3wcdXT41pjD88bN7cBAPfPRczNqi8zFfj8YAbebQdTaN0vJ7wohYjnqy3AuD63Pp9djIwqtD1yA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228967; 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=8YWr4zExFLVkS/USY8dnF7Z2qM9YsNMJfD7DIjDOS2k=; b=FIPeD2PxCgRzPjuYjiMjDmcGOzvT3orfKCExqiNFVc7l60Iy7xVEt9L4BSNZzluDB2XUDlUNa24n7W2rc6QgtIifNqSmq7uu4cIKaUd/3+u+MQbnkCITcBAGAsiByD09IzBYkU8OzwIgJAjZ0ug/+dahGM/dPtNsAI0Jz5eWYO0= 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 17612289672461007.0176324259571; Thu, 23 Oct 2025 07:16:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw4y-0005qZ-Pk; Thu, 23 Oct 2025 10:14:12 -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 1vBw4t-0005pQ-Jv for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:07 -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 1vBw4q-0007O5-8K for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:06 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3ed20bdfdffso857092f8f.2 for ; Thu, 23 Oct 2025 07:14:02 -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-429897f57cesm4406320f8f.17.2025.10.23.07.14.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228841; x=1761833641; 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=8YWr4zExFLVkS/USY8dnF7Z2qM9YsNMJfD7DIjDOS2k=; b=Re+VSc/4URZQ/dH+o8iJwGvAfA5CEgfcExw7kZi7D1XFLfj+RSgItN8hJxnvo70S+7 wHEI0BdI7oqnYOYIAGjJks5+61hy2qInyQPWelFmvdMxK+gdrT8tzyjPI2kB8mBkhtQj Jns0hByKyrkWkGBeKIn3MU5onwOsmItoMWDvHqtrFCCacJcb7UJ93XOrD+YJlG9Vqpvo J/b0RAAlU+bXYCgoDC3h1zraYCL4eKxR8vIOjZ+YDHyyDr0ysfrngQkSgSoYfP6ZGa1H UmALz7YoGz2sfC7z7rA3dLUgEVBP2sWIoTrg6dS4MM51p8yRqZOlJekijGPk7j/aUY93 hsaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228841; x=1761833641; 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=8YWr4zExFLVkS/USY8dnF7Z2qM9YsNMJfD7DIjDOS2k=; b=tYKQDKT7Ygvbur2qbkbis0uNibkPN/scUxTCHFoFZIwkoKYrkqmejy7btH2H8NDvsi czDceeo1OWgxJuPp3PEtGfl36ZwN3GmrYPbYeUMREgQ27Wqb0Sv+/sdp7/U8O7wLqR+e +P9te/EWfpvNf1fSgVILIFPBQVqbxZClTi3rvL4K+iW8QdRtGmH1LVnEM2A4rndSoAAe XUXOpzVOxlV2PtCJDPm8v/WsMBwyBwOR3DuKyDlS8x6qHB46E6FgOcztpdK1VBs/nkGt uOkxTKW1QqjGFEfhbZ/DnKqTUs1lpGUvO644rtP0X1YGdmCIsxBuXwsI9zzIAsNcOyxW p9iA== X-Gm-Message-State: AOJu0Yy9QT0KMnWm7d5Hp0I7SyZJLdoKRqY+Crwmfs9uCnsI17A+4pC0 4Z1eWHbsFglJMTi9tMZiGcaaTwvNmVpO3cyihd2AK462U0ltYJjewS+gkYDNFP6ZryamS6pUwak cCKU58qo= X-Gm-Gg: ASbGncsBLsIl0C4nh3h6oCY4E8KhhxN+1mTxWFQFRyBXJl02kKDnIzxd2/0eGfuHtl0 YpTAU84QHpA9DACjNeo6Lgvueb8XdJ0fwadPuf1RQXjOZe13mZYkJy1szkXWAIPe501XiyYmU2+ zRwa4Gb8yRSobASfnPzRn8hzXfomz7Ye9aYKTSff2SUxx4ko0jx/1/L68H7EOMdMsP2HyYu1WgP epEpDXTp55oHRDOYZlgt3u3zNhDR/7FxUknE0DPM+nNZb5tm3TJKoc31pGnLlpX4w2lMnhgU1D9 4iK7f1MyDTgDDc9NRDxwe6QX1lwG7GyCPX+O8N2ggHRyFOOxc/pyEHqK+lG8ZBJLRxjMaRKvDp/ a5wwBTkYxrqXX+UY3+vqJyaWCDYWNoPhpKd3JDLzAzDZH760J7oaD5Kh7mGg+u4syVAEOc8zUKv TWeSttnEnOfT4cRbsHsGMOj/QC1z/bFe80dpv5u2UR93dS3pMuhg== X-Google-Smtp-Source: AGHT+IE5kJMbKIloHuIF+iO0x/rjaYysicQVlzEsz/rTTGf5wI8KNHrB+CP6oynYwyhQy10+JtgltQ== X-Received: by 2002:a5d:5f82:0:b0:425:86c8:c4ff with SMTP id ffacd0b85a97d-42704d90011mr18488871f8f.22.1761228841290; Thu, 23 Oct 2025 07:14:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 14/58] target/arm/hvf: Hardcode Apple MIDR Date: Thu, 23 Oct 2025 16:13:33 +0200 Message-ID: <20251023141339.10143-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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=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: 1761228970422154100 From: Mohamed Mediouni Hardcode MIDR because Apple deliberately doesn't expose a divergent MIDR across systems. Signed-off-by: Mohamed Mediouni Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index d13ccf5508c..890e9266f93 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -763,6 +763,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFea= tures *ahcf) hv_vcpu_t fd; hv_return_t r =3D HV_SUCCESS; hv_vcpu_exit_t *exit; + uint64_t t; int i; =20 ahcf->dtb_compatible =3D "arm,armv8"; @@ -781,9 +782,19 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFe= atures *ahcf) for (i =3D 0; i < ARRAY_SIZE(regs); i++) { r |=3D hv_vcpu_get_sys_reg(fd, regs[i].reg, regs[i].val); } - r |=3D hv_vcpu_get_sys_reg(fd, HV_SYS_REG_MIDR_EL1, &ahcf->midr); r |=3D hv_vcpu_destroy(fd); =20 + /* + * Hardcode MIDR because Apple deliberately doesn't expose a divergent + * MIDR across systems. + */ + t =3D FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0x61); /* Apple */ + t =3D FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); /* v7 or later */ + t =3D FIELD_DP64(t, MIDR_EL1, PARTNUM, 0); + t =3D FIELD_DP64(t, MIDR_EL1, VARIANT, 0); + t =3D FIELD_DP64(t, MIDR_EL1, REVISION, 0); + ahcf->midr =3D t; + clamp_id_aa64mmfr0_parange_to_ipa_size(&host_isar); =20 /* --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228960; cv=none; d=zohomail.com; s=zohoarc; b=nrfErviVxUTaWvpxbUriteWeqtNGWEcj/2rYFWgiigTnMxOWCCx6/yZbFVqYL5wQMQEFL89g0LefuQxXKbGgL4ni9Tt8Aost2mHQMLHb69X8afJvbW3rAg5s2S9FjF4el3d0EWZ+4pE2Ejol+yVKKvWQoBfQ21tWKY+Mmc2C6UA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228960; 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=YPRRwLj76IcDwxiEgjfHUMq405RINil88LOEgkCDg4g=; b=gGaMkJF5wAffM9jwUPjSvEmOACizVsTSE3nw3FzteV3HsdjWcgleP7MjAqsma5e63mtVz+bCfshlt3wKLyPIyNkLPUjMbGUqZu9q+Pv+xqG/BCWjy3zqXFEWfVfpC6BQ4MdDGtod287VlLqKBQygCru766z+3SyKARTO4IdkKIo= 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 1761228960299172.9870602910446; Thu, 23 Oct 2025 07:16:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw54-0005tn-Ol; Thu, 23 Oct 2025 10:14:18 -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 1vBw4z-0005rz-2Z for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:13 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4w-0007On-1V for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:12 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-46e6a689bd0so8881595e9.1 for ; Thu, 23 Oct 2025 07:14:09 -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-475c4342946sm99794275e9.10.2025.10.23.07.14.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228846; x=1761833646; 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=YPRRwLj76IcDwxiEgjfHUMq405RINil88LOEgkCDg4g=; b=KR/fBf+T8dykxTclQ88yXi28gAIRTfhlWhnuujmfkhobKW2o6sDUKUkxyeuJioFaHE J5AMDHBRqXmvcWpI+U//Q8sJI5+DQoTlijGLySH3WFukjHN2oOvaCnIlHpNOo/gfc/xW TZDamOhWMTockWsG4Si1HnIQYHVwxBEyXPVX3G1JqaUdCQckT5RXiz4XqREj95tO7pIR lGCr7M4JyEKHpSJZv+D00AUbfgE9vEtxurExQXNZeFIgbEVqAWQGK7eDZN1bivg9h4a8 quLgEQxws7HsyaxlqV67KnybP0aOHFNO9y6CiqAuVaqMi8idn9yjsGeVQ63UUgVngjrR ADBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228846; x=1761833646; 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=YPRRwLj76IcDwxiEgjfHUMq405RINil88LOEgkCDg4g=; b=fc+R7+qZyMJlHGgmIRsvBKfiAQEi5oPb6KFAxy17JEIDkgvjKcIN00K8AWZXSHBqI7 DgiCYjaTbpHUJduZU+/T+ryEFe88W4jkoeNaOYKpnWRTSpiP/l1ZWMlfBlf7eRMLlrKt vlwjcTSDxulyP3UXz6xFG4bPOBiT4FAXPWZRG2wuQoa7z2nNB16UCEA0W4zXp/unUt2a DNctWrCYVgi1zu1MOmuarqIgDqD1rFoVt4imQ+PmRvwOdRMSbybktI8vG04grwjbZUL8 JVo2+lp4vnXrQuo/qIj0hxbOcy0gji5zeNAeXp4/qFcIkOxIVidVun3yp5gGlWp5hD49 pLkg== X-Gm-Message-State: AOJu0YzCgo0G4X1SzpouSAYCGGZQt9FqY6c7c15aCnDgLoF6/2HqpyqT /uwKysOAzKsDthEWw/U7X+S+J/VcbaDJqL6FIAueWOo1KeWTpnGWeH6DzHQYIbh3+qbLqRVwOgV sF6esXhI= X-Gm-Gg: ASbGncuyt/ZD+beyaiHRJ2yIws+zRKbqhXHK7HQgsrZBGlpibLZkEruNBBX/q6TQ36L n0w90But3uK7ClFZj2aJG6QkHCP8J6dK4g1KFFCYkClhm5GzFtfa0YJu5P0p7h54+PueC7K08CB bUyhj+MidmMge9/FAU/z/duuTK8s7uvu5aS8eyIkysdd2ocPtn0JNL3EVclYB0LTh7OiOsbbUd5 onzgX1R+ClHSp32hkrg5V9LeIHU4n0uHrrCskyqrFsQKwNRzjAeNC+v2koTmpEXsXQ3l9863ljn p8HY/DIEzYZ53qkB2a1eNeesQ+vRap52IHkzTJtZuEZj0fqAj2NQ3LyjWlZi4l2WESPop1y+tcg HSUkwyrKlnROTsb9thqTdqOlTzCNz3mK4oVC7bFwYOsWy8g81M394jyu8UrU4LrB5GUAPAkhtSC utqx6NkgF/p0UkCOLzjZuB63ghEmBL+NJ3mHKrlGrS4n5rxQDUQaCKD38THbG1 X-Google-Smtp-Source: AGHT+IFMdQ58xrMRUX6dzUgY79SmJ1MkX80IjdKXk4TetdhTTz3dppUk37vr8z/z4eOnZE4KqCL3+w== X-Received: by 2002:a05:600c:3b83:b0:46e:3d41:6001 with SMTP id 5b1f17b1804b1-47117925171mr251202815e9.34.1761228846452; Thu, 23 Oct 2025 07:14:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 15/58] target/arm/hvf: Simplify hvf_arm_get_host_cpu_features() Date: Thu, 23 Oct 2025 16:13:34 +0200 Message-ID: <20251023141339.10143-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: 1761228964006158500 Use index in the structure, dereference &host_isar.idregs[] once. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 890e9266f93..dea1cb37d1f 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -743,21 +743,21 @@ static void clamp_id_aa64mmfr0_parange_to_ipa_size(AR= MISARegisters *isar) static bool hvf_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) { ARMISARegisters host_isar =3D {}; - const struct isar_regs { + static const struct isar_regs { int reg; - uint64_t *val; + ARMIDRegisterIdx index; } regs[] =3D { - { HV_SYS_REG_ID_AA64PFR0_EL1, &host_isar.idregs[ID_AA64PFR0_EL1_ID= X] }, - { HV_SYS_REG_ID_AA64PFR1_EL1, &host_isar.idregs[ID_AA64PFR1_EL1_ID= X] }, + { HV_SYS_REG_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_IDX }, + { HV_SYS_REG_ID_AA64PFR1_EL1, ID_AA64PFR1_EL1_IDX }, /* Add ID_AA64PFR2_EL1 here when HVF supports it */ - { HV_SYS_REG_ID_AA64DFR0_EL1, &host_isar.idregs[ID_AA64DFR0_EL1_ID= X] }, - { HV_SYS_REG_ID_AA64DFR1_EL1, &host_isar.idregs[ID_AA64DFR1_EL1_ID= X] }, - { HV_SYS_REG_ID_AA64ISAR0_EL1, &host_isar.idregs[ID_AA64ISAR0_EL1_= IDX] }, - { HV_SYS_REG_ID_AA64ISAR1_EL1, &host_isar.idregs[ID_AA64ISAR1_EL1_= IDX] }, + { HV_SYS_REG_ID_AA64DFR0_EL1, ID_AA64DFR0_EL1_IDX }, + { HV_SYS_REG_ID_AA64DFR1_EL1, ID_AA64DFR1_EL1_IDX }, + { HV_SYS_REG_ID_AA64ISAR0_EL1, ID_AA64ISAR0_EL1_IDX }, + { HV_SYS_REG_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_IDX }, /* Add ID_AA64ISAR2_EL1 here when HVF supports it */ - { HV_SYS_REG_ID_AA64MMFR0_EL1, &host_isar.idregs[ID_AA64MMFR0_EL1_= IDX] }, - { HV_SYS_REG_ID_AA64MMFR1_EL1, &host_isar.idregs[ID_AA64MMFR1_EL1_= IDX] }, - { HV_SYS_REG_ID_AA64MMFR2_EL1, &host_isar.idregs[ID_AA64MMFR2_EL1_= IDX] }, + { HV_SYS_REG_ID_AA64MMFR0_EL1, ID_AA64MMFR0_EL1_IDX }, + { HV_SYS_REG_ID_AA64MMFR1_EL1, ID_AA64MMFR1_EL1_IDX }, + { HV_SYS_REG_ID_AA64MMFR2_EL1, ID_AA64MMFR2_EL1_IDX }, /* Add ID_AA64MMFR3_EL1 here when HVF supports it */ }; hv_vcpu_t fd; @@ -780,7 +780,8 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFea= tures *ahcf) } =20 for (i =3D 0; i < ARRAY_SIZE(regs); i++) { - r |=3D hv_vcpu_get_sys_reg(fd, regs[i].reg, regs[i].val); + r |=3D hv_vcpu_get_sys_reg(fd, regs[i].reg, + &host_isar.idregs[regs[i].index]); } r |=3D hv_vcpu_destroy(fd); =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228990; cv=none; d=zohomail.com; s=zohoarc; b=nUo3x909LeO1l4PP6p+N4dKfV/Uea7vGL0ANR6Y8p69E97XQjEdWbnU7f2s+YxQUEyErOnCnPNLHpW389mvFr9c7INvFK+siawfIsgmnzVG6j9yTJo1WVGX0cC1Ywq0nwQ9Z6SgesRDZFLd4k8ogOmmREGF/dHC0QmeFRsk+w1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228990; 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=D/iyIMlpli6FTCe5zjpzm5x3w0vLSEGAxerjR++HIGs=; b=XjTJ7F/Eufgq/65CMO05rpna2PmwF/Y1qE6L1LvyyrnGdmJbuAAZ6GaQAiZFUd9xRB1voKX9uZ35jUlSU8/DeNghU+ZGcMuk8gfQysEUv7TBFarIKogAisQh5+bHW4eRUmuCYSZX6mBifda49w5FZNFLThC4nIQ6lQJZqQOq6AM= 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 1761228990370301.31775400988647; Thu, 23 Oct 2025 07:16:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw57-0005vi-1a; Thu, 23 Oct 2025 10:14:21 -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 1vBw52-0005tg-PX for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:16 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw4z-0007PP-Lh for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:16 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-46e6a6a5e42so5098955e9.0 for ; Thu, 23 Oct 2025 07:14:13 -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-47496bf7137sm62054175e9.3.2025.10.23.07.14.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228851; x=1761833651; 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=D/iyIMlpli6FTCe5zjpzm5x3w0vLSEGAxerjR++HIGs=; b=Gm9qmD45sM5Wv2izY9MurTyOJygnzcg3KnUwrqxXUYVnRBWIg9ATxa8tE0tUCwVSx1 Tb4No9ZHYotqX6fRdsFzbwJ3uvQaNIiE8MCrEY5S5n/M69g1aKAynYyBcJId6ywDfAGO kk9cY66GBIxHZ8EKzXtgpEBgJCWtG202mAtNjqIVylrgEzrEn1RtBG++MIn8sabVLyPO KSonYKNUQO0+rlYVdAoxEoQDz9p/LU3PuoW4SZ9zylmvXQ+88dmJYq3Q9N/FiEn3H4rk hq9vSLgotMAVvy5s7jN4o/N0SKX+kRquUGObUuz1ve9Y2b1U9YSV8+pEIJb06VaBL+wr oPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228851; x=1761833651; 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=D/iyIMlpli6FTCe5zjpzm5x3w0vLSEGAxerjR++HIGs=; b=CzyBbzwYZHerHxB4ck5OTi6v74XlUo/ut2hNZVIMOe8JthR5Nbqva3QyDS7mh2oYl1 1MDhoO/EQM5ceim3E7NUvW7ymJCVkkYm/ki2N0Iu+XaaIM/RY+3zeonOSojP+POhxz+n kCkGMdfRP24F3P5ALnzU81xF7cyMwy3dSrwZLaWwUL4Ip5WKNcxgteovC8BN/fu6sDiY s/MhxvQamZ+BQcmOb+YckBZrB6z1If9OQdga9Ax3dxbvrCEoqmyarfaUMu5ehw9Lbu/5 gynOj+PM3gPThtklwh+1OJuVuMVS6RqIpPdXykjkXy+Y5Wt2oWI5d9vyE7/77JIpIZ1m NHUw== X-Gm-Message-State: AOJu0YxQtT7ddMxWKxnOXEoJfz6KGRdj52yi4bUSSfHuxFypmLsD5buS HijeS0EVP98bv3iKgYC2Q6RBZACgqlzriBn7mzFEJhBm4O2OFf7e3NIA+OMM7xw+WPSmItQhUYR BpnGrMII= X-Gm-Gg: ASbGnct0bfWYrqrrCWygVK2JSUSzv3nJsUCCy/xFsU9KqKwwGN7/XSVHa0YTj0s4aC7 fOo1Px1H6rARL7OfqQdv4YO+gXx8VFLlZN4+BwJG590zU3STxzykwEy98QynnCvokfSa1RvDaS6 5ZZZ0uDwFbd0CiJNZi4zZ1dvGOz1qMOSF7CuCewRlvBbPqqR/LaTija75d3KBosSG6/qzySYT/t Y0DjLrtDu6TiqI0UU7jPnnjsYPPyLeAZ+1o3hYH9DhH/ZZ23aZFf75U6c0VZD5SJylqSZ2xO5R4 QeGDcYoEcz1mAihhb/tn4mlhPtlg+NnX69wpTYgAHomq/h0crQDpJHoIo1qxQXJ0b+mTOgJAZjz WrIBuWsYOtpegVsfskFFW6EVQo8Kzh6fsqV02WUhQrKD5SQN3+C1+1ylBi0sHdBNkZQ1SlEC+DF v2JtZb80+wXi1wUs/KkPBTnkxhwxDB2Wc5DPB4+vHoBm9BsDqjxMaZKHQKL6XO X-Google-Smtp-Source: AGHT+IHXpB3MzhtN00eUBw9o2qYBPxiuTR1FU2KSZ3PJiuEJZapYSBV6tWavzCkIKpkyCUDoeZ2B5g== X-Received: by 2002:a05:600c:a4a:b0:471:145b:dd0d with SMTP id 5b1f17b1804b1-4711790c334mr147062075e9.24.1761228851448; Thu, 23 Oct 2025 07:14:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 16/58] target/arm/hvf: switch hvf_arm_get_host_cpu_features to not create a vCPU Date: Thu, 23 Oct 2025 16:13:35 +0200 Message-ID: <20251023141339.10143-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1761228993882158500 From: Mohamed Mediouni Creating a vCPU locks out APIs such as hv_gic_create(). As a result, switch to using the hv_vcpu_config_get_feature_reg interface. Besides, all the following methods must be run on a vCPU thread: - hv_vcpu_create() - hv_vcpu_get_sys_reg() - hv_vcpu_destroy() Signed-off-by: Mohamed Mediouni Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal Message-ID: <20250808070137.48716-3-mohamed@unpredictable.fr> [PMD: Release config calling os_release()] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index dea1cb37d1f..fcb6950692b 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -744,25 +744,24 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUF= eatures *ahcf) { ARMISARegisters host_isar =3D {}; static const struct isar_regs { - int reg; + hv_feature_reg_t reg; ARMIDRegisterIdx index; } regs[] =3D { - { HV_SYS_REG_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_IDX }, - { HV_SYS_REG_ID_AA64PFR1_EL1, ID_AA64PFR1_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64PFR1_EL1, ID_AA64PFR1_EL1_IDX }, /* Add ID_AA64PFR2_EL1 here when HVF supports it */ - { HV_SYS_REG_ID_AA64DFR0_EL1, ID_AA64DFR0_EL1_IDX }, - { HV_SYS_REG_ID_AA64DFR1_EL1, ID_AA64DFR1_EL1_IDX }, - { HV_SYS_REG_ID_AA64ISAR0_EL1, ID_AA64ISAR0_EL1_IDX }, - { HV_SYS_REG_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64DFR0_EL1, ID_AA64DFR0_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64DFR1_EL1, ID_AA64DFR1_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64ISAR0_EL1, ID_AA64ISAR0_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_IDX }, /* Add ID_AA64ISAR2_EL1 here when HVF supports it */ - { HV_SYS_REG_ID_AA64MMFR0_EL1, ID_AA64MMFR0_EL1_IDX }, - { HV_SYS_REG_ID_AA64MMFR1_EL1, ID_AA64MMFR1_EL1_IDX }, - { HV_SYS_REG_ID_AA64MMFR2_EL1, ID_AA64MMFR2_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64MMFR0_EL1, ID_AA64MMFR0_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64MMFR1_EL1, ID_AA64MMFR1_EL1_IDX }, + { HV_FEATURE_REG_ID_AA64MMFR2_EL1, ID_AA64MMFR2_EL1_IDX }, /* Add ID_AA64MMFR3_EL1 here when HVF supports it */ }; - hv_vcpu_t fd; hv_return_t r =3D HV_SUCCESS; - hv_vcpu_exit_t *exit; + hv_vcpu_config_t config =3D hv_vcpu_config_create(); uint64_t t; int i; =20 @@ -773,17 +772,11 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUF= eatures *ahcf) (1ULL << ARM_FEATURE_PMU) | (1ULL << ARM_FEATURE_GENERIC_TIMER); =20 - /* We set up a small vcpu to extract host registers */ - - if (hv_vcpu_create(&fd, &exit, NULL) !=3D HV_SUCCESS) { - return false; - } - for (i =3D 0; i < ARRAY_SIZE(regs); i++) { - r |=3D hv_vcpu_get_sys_reg(fd, regs[i].reg, - &host_isar.idregs[regs[i].index]); + r |=3D hv_vcpu_config_get_feature_reg(config, regs[i].reg, + &host_isar.idregs[regs[i].inde= x]); } - r |=3D hv_vcpu_destroy(fd); + os_release(config); =20 /* * Hardcode MIDR because Apple deliberately doesn't expose a divergent --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228972; cv=none; d=zohomail.com; s=zohoarc; b=Hukc1R7KS+AmRuMczCVSzn8V6vxzYRDWhiWKFT6u1ql8BT+mhCsTP1ZvHxgGxZ/ifJ3W/twig4fsPAmylbB7TvmKBEG06Yg7GLENn1tlzKIRqrI+301Q2HRU8NfvDL5Kedthc1vI5QS9E5nvRQkEO3qdZYiV+62uOhApXiKZVrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228972; 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=xgErgOnMx4s5YU2iFG4R59NbVSZsMjKyT1ZEI6z6Tkc=; b=XhbPp5+DrK3Pwdex1UiPOmNmMGbIXtCyTy+AOYp0zZKECoD5HAzwnGt94JBmm91VAdQKYS5s81Bx9NPYmPQYmAIWLoQJL/BpmOUltxasJNO3VspwxnF9UZT0jSNBqYHuVnFpt+KAE1cA5hdsX/VZHblGMTr+QpLWLVP8gc0+OMc= 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 1761228972679418.2801656502536; Thu, 23 Oct 2025 07:16:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw5C-0005zh-Um; Thu, 23 Oct 2025 10:14:27 -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 1vBw59-0005xF-SG for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:23 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw55-0007QX-5I for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:23 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-427091cd4fdso562523f8f.1 for ; Thu, 23 Oct 2025 07:14:18 -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-429897f53bcsm4272553f8f.11.2025.10.23.07.14.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228857; x=1761833657; 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=xgErgOnMx4s5YU2iFG4R59NbVSZsMjKyT1ZEI6z6Tkc=; b=bNpr4qYAay/9DubdRd0YTDUo6DOeeCX8781bzLcc00U/cm6WatD/Ru8jeg/mRXwHqd L49iVrc4+LbamnOLajQKaLOjrTCQ4JxQ1BI6IBYvvvpXdZg7HEMZSIPU3ETt19S41Rcd SVOYzZv55DYWnW2SHY5xhedoTAeuYze9TN0Ja87D+1dtjuKN6kZ3Cbfmbo+hhs3nUwqv QyWhaOd/LEjjF1u3/ZJGbIK7Uvxbm4cSrTZ1bbBMEHtwuQlVmYXPn1ggp9GRyIf6IKYf SmL4NDxOp2ygvU/8y52nbU/PRR7xo/a28WChPH/jj41MiqkT8i76sTydFWzyUENSvNuq agVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228857; x=1761833657; 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=xgErgOnMx4s5YU2iFG4R59NbVSZsMjKyT1ZEI6z6Tkc=; b=IPebcVaNsMFATfDJS2ai3TZqoQZBC3tckMOi4BL6iFh5OWH1vGunahMkOGA7odEJNF Pq7LlPpqJSZHVSPrJFXXRRG6QO88h6zudZIQu6Lhz7BWGJKUWhjKfRjc+PfUyPUKoskp Q60YA+5PqMBG+ujnw9D+leJz9jO/5pWQQ7uz2Mzwyylv+cCYdBJvaMy26LPvdTBfylNb WpcWfnF/tOjV7vpNOuPi5xF/yyx3IF4S8zzsCHvIuOAWyMgY8beQXOfOWdvDrPzTlgO1 kzcIdD5r96OuZhcwD3XpBV8eKnwyIS6GBaG9tV6Y48N3g6icf2kOjZTUmZEFdqhLlMv/ 8IXg== X-Gm-Message-State: AOJu0YxPGHPeuBrymrHteRAyscC8u5eL0XFosTzaje4+4KWXJdkk4+V9 uZxezUytjwKe4bIZig2I9DFSxpzL4EVWgKI956BKxktx+aSC3sqXV+LmsFy7hOvGAndA0v09xfM 8osUg1M4= X-Gm-Gg: ASbGncuMpRruFT4MvLu9n8/rAzat+U8lz5U0Cx0dQow/O1WTJqE5EjVCVlTVjSc4grg 9fi/S1KeJsl5Y0+Vp3FbBxo9AWb0eXFTn3546Jca0IPAlsWNiZAiqxjl+2ee9Gb7U3auTyc4JqJ nwFGbABVAP/bJ1ww/Cv/oD1fEUX0d1Q7cpyBxwGLmMF8hvZIB+g/nRPl3fXHKUELswxAa0rDUVw 5rt7DsGSRiZcZpaLN76NxGb07s6TUxv+sf+LbcOsE7cPbe+EECwwgjYOLtmQIY37Td5HERHDovv Km3yeC9lSlTrdZJZHQNP7OudXq1lgrq+HCuquERtQMojiBXQN881fr5uWThCIn+JacbsohfQxvz VqEXrbP3nLNKqAECx0g41ib5vhshvoxcG55wx5dHA2KDA673CTCeq20LwWFoqa1EtmUrOKkCOdI wVodu9E04Bdxpzd5lwuGngWoCo/tUpLj7R5LgKiiYv0YWTZQcHHw== X-Google-Smtp-Source: AGHT+IFYkyq1X8eXbyXkDCQdNSLrDoS4J4Uoi4L4ULVb0t4OtBAflKybfpOydN2uOI4v0/1ko63L5Q== X-Received: by 2002:a05:6000:428a:b0:425:8559:5d17 with SMTP id ffacd0b85a97d-42704d9457amr15218026f8f.30.1761228856561; Thu, 23 Oct 2025 07:14:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 17/58] target/arm/hvf: Factor hvf_handle_exception() out Date: Thu, 23 Oct 2025 16:13:36 +0200 Message-ID: <20251023141339.10143-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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: 1761228975861154101 Factor hvf_handle_exception() out of hvf_vcpu_exec(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 123 +++++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 58 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index fcb6950692b..8553ce6adc2 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1802,61 +1802,15 @@ static void hvf_sync_vtimer(CPUState *cpu) } } =20 -int hvf_arch_vcpu_exec(CPUState *cpu) +static int hvf_handle_exception(CPUState *cpu, hv_vcpu_exit_exception_t *e= xcp) { - ARMCPU *arm_cpu =3D ARM_CPU(cpu); - CPUARMState *env =3D &arm_cpu->env; - int ret; - hv_vcpu_exit_t *hvf_exit =3D cpu->accel->exit; - hv_return_t r; - bool advance_pc =3D false; - - if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && - hvf_inject_interrupts(cpu)) { - return EXCP_INTERRUPT; - } - - if (cpu->halted) { - return EXCP_HLT; - } - - flush_cpu_state(cpu); - - bql_unlock(); - r =3D hv_vcpu_run(cpu->accel->fd); - bql_lock(); - switch (r) { - case HV_SUCCESS: - break; - case HV_ILLEGAL_GUEST_STATE: - trace_hvf_illegal_guest_state(); - /* fall through */ - default: - g_assert_not_reached(); - } - - /* handle VMEXIT */ - uint64_t exit_reason =3D hvf_exit->reason; - uint64_t syndrome =3D hvf_exit->exception.syndrome; + CPUARMState *env =3D cpu_env(cpu); + ARMCPU *arm_cpu =3D env_archcpu(env); + uint64_t syndrome =3D excp->syndrome; uint32_t ec =3D syn_get_ec(syndrome); - - ret =3D 0; - 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); + bool advance_pc =3D false; + hv_return_t r; + int ret =3D 0; =20 switch (ec) { case EC_SOFTWARESTEP: { @@ -1895,7 +1849,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu) cpu_synchronize_state(cpu); =20 CPUWatchpoint *wp =3D - find_hw_watchpoint(cpu, hvf_exit->exception.virtual_address); + find_hw_watchpoint(cpu, excp->virtual_address); if (!wp) { error_report("EXCP_DEBUG but unknown hw watchpoint"); } @@ -1913,8 +1867,8 @@ int hvf_arch_vcpu_exec(CPUState *cpu) uint32_t cm =3D (syndrome >> 8) & 0x1; uint64_t val =3D 0; =20 - trace_hvf_data_abort(hvf_exit->exception.virtual_address, - hvf_exit->exception.physical_address, isv, + trace_hvf_data_abort(excp->virtual_address, + excp->physical_address, isv, iswrite, s1ptw, len, srt); =20 if (cm) { @@ -1928,11 +1882,11 @@ int hvf_arch_vcpu_exec(CPUState *cpu) if (iswrite) { val =3D hvf_get_reg(cpu, srt); address_space_write(&address_space_memory, - hvf_exit->exception.physical_address, + excp->physical_address, MEMTXATTRS_UNSPECIFIED, &val, len); } else { address_space_read(&address_space_memory, - hvf_exit->exception.physical_address, + excp->physical_address, MEMTXATTRS_UNSPECIFIED, &val, len); if (sse) { val =3D sextract64(val, 0, len * 8); @@ -2030,6 +1984,59 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return ret; } =20 +int hvf_arch_vcpu_exec(CPUState *cpu) +{ + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + hv_vcpu_exit_t *hvf_exit =3D cpu->accel->exit; + hv_return_t r; + + if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && + hvf_inject_interrupts(cpu)) { + return EXCP_INTERRUPT; + } + + if (cpu->halted) { + return EXCP_HLT; + } + + flush_cpu_state(cpu); + + bql_unlock(); + r =3D hv_vcpu_run(cpu->accel->fd); + bql_lock(); + switch (r) { + case HV_SUCCESS: + break; + case HV_ILLEGAL_GUEST_STATE: + trace_hvf_illegal_guest_state(); + /* fall through */ + default: + g_assert_not_reached(); + } + + /* 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); +} + static const VMStateDescription vmstate_hvf_vtimer =3D { .name =3D "hvf-vtimer", .version_id =3D 1, --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228904; cv=none; d=zohomail.com; s=zohoarc; b=Y1sj9DlGmUvkZyulekw54toN6GF9Gl7ULHmyG5djzKdLvmrrhTZCvp9A7gsLto4y1afh810FvtWtqcy1IJ+0kVt6AYQ1zcKQzCmS3OCG1qExYh3AdUIq02QffPECtNxwnMbp30jx+vd40RGhLZFjRWG0AQe9nLhPeZNceU+djRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228904; 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=0e3/oLz91m0M4PKqzD0FMNzJKdz5qkqdZGotGocB/sY=; b=eWmHarDU87RdFd5yyG6ISEThTD/Qr8PP2gd6hfzBYlUwyDllj3XJKLxBt+W+5ymO/s3GNmRQPXp0v1kQsWGCgnhBvwTal1WpFxzBBxWjkJwdNbx90Z35LcacZPx+kgeFY3v5L1hTb0HrysenaItBm6/3S5HJv7JH+0eB+pgSDVU= 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 1761228904097553.3610292479602; Thu, 23 Oct 2025 07:15:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw5S-0006Kd-Eg; Thu, 23 Oct 2025 10:14:43 -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 1vBw5F-00063O-AO for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:32 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw5B-0007RG-DG for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:28 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3ece1102998so620621f8f.2 for ; Thu, 23 Oct 2025 07:14:23 -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-429898eac60sm4123656f8f.39.2025.10.23.07.14.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228862; x=1761833662; 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=0e3/oLz91m0M4PKqzD0FMNzJKdz5qkqdZGotGocB/sY=; b=tRQSx7uUmE4TuTs8DNKMnM9tEdAyvOgv0r55fudns25AykH1/2LFMRkJmmX21yhxq/ Sc/HhxObE5T3tfO+cCYQ92M4YJOTe1ItL33i4Ni1g0I6/xsFpDVrDq2ezi6Zw0xXS2v5 Aq7zqN4LBKfdbEHWaUOPbI2I1eZZXiSYYmE0Yst/7kOkivX5RO8koniExcAYDqe/OFBr tbFbzzjuNkuUSV7mBwYigK1XVmUrwlROx0izqXZmO/R4JNvBpS0EFVEmWYOLATXmvWog MEPCr3idYIP2IAlLe/Z5ms/ZmkyM1cudA9/r7XBNV1NDGfRDcPiFsl0xuSdUNNpl9gKI PqLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228862; x=1761833662; 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=0e3/oLz91m0M4PKqzD0FMNzJKdz5qkqdZGotGocB/sY=; b=d0cAvu5VwDdknM61oK9nNMOuAqhZpPbD2RKPaszo4YuADXLtVd4WE0Ro7Z4yM8q+Dm ADG70f41nN/vlV1oUsRD2psa7+sMsKC/z5iwI11tHUmQNaBR7kgIzHWcF0A777LOl4OH 9Wx3WMRmY/l1ZHoNcRFVjvHBHmNfec0rkxR3IjnQvbQg9QReD+A+GkXdI1xTBxjDGc4p goTqEHtx5Kssaobar/y3hlt+Xd99K+sl6ulnVq2RQILGQR5kJhcC1IRStYKtr/LYP382 Jwcq4BTot6QeiqrKveAoNUaWSLRIa+ohc/fitcHm6veOUXsBTxJzqnO1RFnwRNCP+qzo wW6Q== X-Gm-Message-State: AOJu0Ywh+jLoY7ioZtSXDfdq8WodMtarWCMKhuc8uJaOxlG9uxiSAMHB E0swiqWHxhtgpYgwrK9vuSNwmkelE4+8IG1sOuF+W813ln/qw32o1W50/WEAX32Wbr7k/AkvkWc IPRGDPuE= X-Gm-Gg: ASbGncsANJP9JFIrZfTN0Y1f5xuliD1mfYFZknfLtZF4P1bn76snd2yY4qRprnbR1uO S/KD+32n+Nq2ce6Nr80/UM+o8pwYfRcVNfjn/XEvcwqFjE3N4jg34N+Q6YBioOcIWwNFOJO0KJ8 u6rfS5+QSDdKvnRvuEJ6MkVBwi9OlDU7aHXGcowS5AmSnYFxKJgM0rjgxUuQEDimAQ8C08kad59 WYPm4nQHM1vcKcFZ43OrWMcti1y1OH/1DPqhfYI87YBEXpHkXF7aeJw9i5s4d5Mc8Wa3O88dHQO Vvs0QK95+piDBnPIydoQ7c9O4KHYPJ5oaBDDN4aT8bQTM+j4Zt2xP0n89TCm0SMOCbi9tDfbxnl MPKd+8mL2W3sfthANU1CSYYI6ryh7+X3QeHI7tQIDJB2CARECk5lyB3vx0nYm6Fknro3HwR/JJc /OZJBbC1r1n7/ZkI1kWIvOsbq6RZUoWmod2+6b4YLMPp1HtCXdxw== X-Google-Smtp-Source: AGHT+IFKiy+g0Qp3DW9IbB4fDmn9/sBjcbm6QTJeX8mOOw5VZa/yKCHvwlkueSeSC8ims1kgraG/IQ== X-Received: by 2002:a05:6000:2f83:b0:427:880:9538 with SMTP id ffacd0b85a97d-4298a0bd253mr1981490f8f.45.1761228861765; Thu, 23 Oct 2025 07:14:21 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 18/58] target/i386/hvf: Factor hvf_handle_vmexit() out Date: Thu, 23 Oct 2025 16:13:37 +0200 Message-ID: <20251023141339.10143-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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: 1761228905684154100 Factor hvf_handle_vmexit() out of hvf_arch_vcpu_exec(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/hvf/hvf.c | 477 +++++++++++++++++++++--------------------- 1 file changed, 244 insertions(+), 233 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 76a58cb0350..2929a92defe 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -721,6 +721,249 @@ void hvf_simulate_wrmsr(CPUState *cs) printf("write msr %llx\n", RCX(cs));*/ } =20 +static int hvf_handle_vmexit(CPUState *cpu) +{ + X86CPU *x86_cpu =3D env_archcpu(cpu_env(cpu)); + uint64_t exit_reason =3D rvmcs(cpu->accel->fd, VMCS_EXIT_REASON); + uint64_t exit_qual =3D rvmcs(cpu->accel->fd, VMCS_EXIT_QUALIFICATION); + uint32_t ins_len =3D (uint32_t)rvmcs(cpu->accel->fd, + VMCS_EXIT_INSTRUCTION_LENGTH); + + uint64_t idtvec_info =3D rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_INFO= ); + int ret =3D 0; + + hvf_store_events(cpu, ins_len, idtvec_info); + rip =3D rreg(cpu->accel->fd, HV_X86_RIP); + env->eflags =3D rreg(cpu->accel->fd, HV_X86_RFLAGS); + + bql_lock(); + + update_apic_tpr(cpu); + current_cpu =3D cpu; + + switch (exit_reason) { + case EXIT_REASON_HLT: { + macvm_set_rip(cpu, rip + ins_len); + if (!(cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD) + && (env->eflags & IF_MASK)) + && !cpu_test_interrupt(cpu, CPU_INTERRUPT_NMI) + && !(idtvec_info & VMCS_IDT_VEC_VALID)) { + cpu->halted =3D 1; + ret =3D EXCP_HLT; + break; + } + ret =3D EXCP_INTERRUPT; + break; + } + case EXIT_REASON_MWAIT: { + ret =3D EXCP_INTERRUPT; + break; + } + /* Need to check if MMIO or unmapped fault */ + case EXIT_REASON_EPT_FAULT: + { + hvf_slot *slot; + uint64_t gpa =3D rvmcs(cpu->accel->fd, VMCS_GUEST_PHYSICAL_ADDRESS= ); + + if (((idtvec_info & VMCS_IDT_VEC_VALID) =3D=3D 0) && + ((exit_qual & EXIT_QUAL_NMIUDTI) !=3D 0)) { + vmx_set_nmi_blocking(cpu); + } + + slot =3D hvf_find_overlap_slot(gpa, 1); + /* mmio */ + if (ept_emulation_fault(slot, gpa, exit_qual)) { + struct x86_decode decode; + + hvf_load_regs(cpu); + decode_instruction(env, &decode); + exec_instruction(env, &decode); + hvf_store_regs(cpu); + break; + } + break; + } + case EXIT_REASON_INOUT: + { + uint32_t in =3D (exit_qual & 8) !=3D 0; + uint32_t size =3D (exit_qual & 7) + 1; + uint32_t string =3D (exit_qual & 16) !=3D 0; + uint32_t port =3D exit_qual >> 16; + /*uint32_t rep =3D (exit_qual & 0x20) !=3D 0;*/ + struct x86_decode decode; + + if (!string && in) { + uint64_t val =3D 0; + + hvf_load_regs(cpu); + hvf_handle_io(env_cpu(env), port, &val, 0, size, 1); + if (size =3D=3D 1) { + AL(env) =3D val; + } else if (size =3D=3D 2) { + AX(env) =3D val; + } else if (size =3D=3D 4) { + RAX(env) =3D (uint32_t)val; + } else { + RAX(env) =3D (uint64_t)val; + } + env->eip +=3D ins_len; + hvf_store_regs(cpu); + break; + } else if (!string && !in) { + RAX(env) =3D rreg(cpu->accel->fd, HV_X86_RAX); + hvf_handle_io(env_cpu(env), port, &RAX(env), 1, size, 1); + macvm_set_rip(cpu, rip + ins_len); + break; + } + + hvf_load_regs(cpu); + decode_instruction(env, &decode); + assert(ins_len =3D=3D decode.len); + exec_instruction(env, &decode); + hvf_store_regs(cpu); + + break; + } + case EXIT_REASON_CPUID: { + uint32_t rax =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RAX); + uint32_t rbx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RBX); + uint32_t rcx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RCX); + uint32_t rdx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RDX); + + if (rax =3D=3D 1) { + /* CPUID1.ecx.OSXSAVE needs to know CR4 */ + env->cr[4] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR4); + } + hvf_cpu_x86_cpuid(env, rax, rcx, &rax, &rbx, &rcx, &rdx); + + wreg(cpu->accel->fd, HV_X86_RAX, rax); + wreg(cpu->accel->fd, HV_X86_RBX, rbx); + wreg(cpu->accel->fd, HV_X86_RCX, rcx); + wreg(cpu->accel->fd, HV_X86_RDX, rdx); + + macvm_set_rip(cpu, rip + ins_len); + break; + } + case EXIT_REASON_XSETBV: { + uint32_t eax =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RAX); + uint32_t ecx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RCX); + uint32_t edx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RDX); + + if (ecx) { + macvm_set_rip(cpu, rip + ins_len); + break; + } + env->xcr0 =3D ((uint64_t)edx << 32) | eax; + wreg(cpu->accel->fd, HV_X86_XCR0, env->xcr0 | 1); + macvm_set_rip(cpu, rip + ins_len); + break; + } + case EXIT_REASON_INTR_WINDOW: + vmx_clear_int_window_exiting(cpu); + ret =3D EXCP_INTERRUPT; + break; + case EXIT_REASON_NMI_WINDOW: + vmx_clear_nmi_window_exiting(cpu); + ret =3D EXCP_INTERRUPT; + break; + case EXIT_REASON_EXT_INTR: + /* force exit and allow io handling */ + ret =3D EXCP_INTERRUPT; + break; + case EXIT_REASON_RDMSR: + case EXIT_REASON_WRMSR: + { + hvf_load_regs(cpu); + if (exit_reason =3D=3D EXIT_REASON_RDMSR) { + hvf_simulate_rdmsr(cpu); + } else { + hvf_simulate_wrmsr(cpu); + } + env->eip +=3D ins_len; + hvf_store_regs(cpu); + break; + } + case EXIT_REASON_CR_ACCESS: { + int cr; + int reg; + + hvf_load_regs(cpu); + cr =3D exit_qual & 15; + reg =3D (exit_qual >> 8) & 15; + + switch (cr) { + case 0x0: { + macvm_set_cr0(cpu->accel->fd, RRX(env, reg)); + break; + } + case 4: { + macvm_set_cr4(cpu->accel->fd, RRX(env, reg)); + break; + } + case 8: { + if (exit_qual & 0x10) { + RRX(env, reg) =3D cpu_get_apic_tpr(x86_cpu->apic_state); + } else { + int tpr =3D RRX(env, reg); + cpu_set_apic_tpr(x86_cpu->apic_state, tpr); + ret =3D EXCP_INTERRUPT; + } + break; + } + default: + error_report("Unrecognized CR %d", cr); + abort(); + } + env->eip +=3D ins_len; + hvf_store_regs(cpu); + break; + } + case EXIT_REASON_APIC_ACCESS: { /* TODO */ + struct x86_decode decode; + + hvf_load_regs(cpu); + decode_instruction(env, &decode); + exec_instruction(env, &decode); + hvf_store_regs(cpu); + break; + } + case EXIT_REASON_TPR: { + ret =3D 1; + break; + } + case EXIT_REASON_TASK_SWITCH: { + uint64_t vinfo =3D rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_INFO); + x86_segment_selector sel =3D {.sel =3D exit_qual & 0xffff}; + + vmx_handle_task_switch(cpu, sel, (exit_qual >> 30) & 0x3, + vinfo & VMCS_INTR_VALID, + vinfo & VECTORING_INFO_VECTOR_MASK, + vinfo & VMCS_INTR_T_MASK); + break; + } + case EXIT_REASON_TRIPLE_FAULT: { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + ret =3D EXCP_INTERRUPT; + break; + } + case EXIT_REASON_RDPMC: + wreg(cpu->accel->fd, HV_X86_RAX, 0); + wreg(cpu->accel->fd, HV_X86_RDX, 0); + macvm_set_rip(cpu, rip + ins_len); + break; + case VMX_REASON_VMCALL: + env->exception_nr =3D EXCP0D_GPF; + env->exception_injected =3D 1; + env->has_error_code =3D true; + env->error_code =3D 0; + break; + default: + error_report("%llx: unhandled exit %llx", rip, exit_reason); + } + + return ret; +} + int hvf_arch_vcpu_exec(CPUState *cpu) { X86CPU *x86_cpu =3D X86_CPU(cpu); @@ -753,239 +996,7 @@ int hvf_arch_vcpu_exec(CPUState *cpu) assert_hvf_ok(r); =20 /* handle VMEXIT */ - uint64_t exit_reason =3D rvmcs(cpu->accel->fd, VMCS_EXIT_REASON); - uint64_t exit_qual =3D rvmcs(cpu->accel->fd, VMCS_EXIT_QUALIFICATI= ON); - uint32_t ins_len =3D (uint32_t)rvmcs(cpu->accel->fd, - VMCS_EXIT_INSTRUCTION_LENGTH); - - uint64_t idtvec_info =3D rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_= INFO); - - hvf_store_events(cpu, ins_len, idtvec_info); - rip =3D rreg(cpu->accel->fd, HV_X86_RIP); - env->eflags =3D rreg(cpu->accel->fd, HV_X86_RFLAGS); - - bql_lock(); - - update_apic_tpr(cpu); - current_cpu =3D cpu; - - ret =3D 0; - switch (exit_reason) { - case EXIT_REASON_HLT: { - macvm_set_rip(cpu, rip + ins_len); - if (!(cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD) && - (env->eflags & IF_MASK)) - && !cpu_test_interrupt(cpu, CPU_INTERRUPT_NMI) && - !(idtvec_info & VMCS_IDT_VEC_VALID)) { - cpu->halted =3D 1; - ret =3D EXCP_HLT; - break; - } - ret =3D EXCP_INTERRUPT; - break; - } - case EXIT_REASON_MWAIT: { - ret =3D EXCP_INTERRUPT; - break; - } - /* Need to check if MMIO or unmapped fault */ - case EXIT_REASON_EPT_FAULT: - { - hvf_slot *slot; - uint64_t gpa =3D rvmcs(cpu->accel->fd, VMCS_GUEST_PHYSICAL_ADD= RESS); - - if (((idtvec_info & VMCS_IDT_VEC_VALID) =3D=3D 0) && - ((exit_qual & EXIT_QUAL_NMIUDTI) !=3D 0)) { - vmx_set_nmi_blocking(cpu); - } - - slot =3D hvf_find_overlap_slot(gpa, 1); - /* mmio */ - if (ept_emulation_fault(slot, gpa, exit_qual)) { - struct x86_decode decode; - - hvf_load_regs(cpu); - decode_instruction(env, &decode); - exec_instruction(env, &decode); - hvf_store_regs(cpu); - break; - } - break; - } - case EXIT_REASON_INOUT: - { - uint32_t in =3D (exit_qual & 8) !=3D 0; - uint32_t size =3D (exit_qual & 7) + 1; - uint32_t string =3D (exit_qual & 16) !=3D 0; - uint32_t port =3D exit_qual >> 16; - /*uint32_t rep =3D (exit_qual & 0x20) !=3D 0;*/ - - if (!string && in) { - uint64_t val =3D 0; - hvf_load_regs(cpu); - hvf_handle_io(env_cpu(env), port, &val, 0, size, 1); - if (size =3D=3D 1) { - AL(env) =3D val; - } else if (size =3D=3D 2) { - AX(env) =3D val; - } else if (size =3D=3D 4) { - RAX(env) =3D (uint32_t)val; - } else { - RAX(env) =3D (uint64_t)val; - } - env->eip +=3D ins_len; - hvf_store_regs(cpu); - break; - } else if (!string && !in) { - RAX(env) =3D rreg(cpu->accel->fd, HV_X86_RAX); - hvf_handle_io(env_cpu(env), port, &RAX(env), 1, size, 1); - macvm_set_rip(cpu, rip + ins_len); - break; - } - struct x86_decode decode; - - hvf_load_regs(cpu); - decode_instruction(env, &decode); - assert(ins_len =3D=3D decode.len); - exec_instruction(env, &decode); - hvf_store_regs(cpu); - - break; - } - case EXIT_REASON_CPUID: { - uint32_t rax =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RAX); - uint32_t rbx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RBX); - uint32_t rcx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RCX); - uint32_t rdx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RDX); - - if (rax =3D=3D 1) { - /* CPUID1.ecx.OSXSAVE needs to know CR4 */ - env->cr[4] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR4); - } - hvf_cpu_x86_cpuid(env, rax, rcx, &rax, &rbx, &rcx, &rdx); - - wreg(cpu->accel->fd, HV_X86_RAX, rax); - wreg(cpu->accel->fd, HV_X86_RBX, rbx); - wreg(cpu->accel->fd, HV_X86_RCX, rcx); - wreg(cpu->accel->fd, HV_X86_RDX, rdx); - - macvm_set_rip(cpu, rip + ins_len); - break; - } - case EXIT_REASON_XSETBV: { - uint32_t eax =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RAX); - uint32_t ecx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RCX); - uint32_t edx =3D (uint32_t)rreg(cpu->accel->fd, HV_X86_RDX); - - if (ecx) { - macvm_set_rip(cpu, rip + ins_len); - break; - } - env->xcr0 =3D ((uint64_t)edx << 32) | eax; - wreg(cpu->accel->fd, HV_X86_XCR0, env->xcr0 | 1); - macvm_set_rip(cpu, rip + ins_len); - break; - } - case EXIT_REASON_INTR_WINDOW: - vmx_clear_int_window_exiting(cpu); - ret =3D EXCP_INTERRUPT; - break; - case EXIT_REASON_NMI_WINDOW: - vmx_clear_nmi_window_exiting(cpu); - ret =3D EXCP_INTERRUPT; - break; - case EXIT_REASON_EXT_INTR: - /* force exit and allow io handling */ - ret =3D EXCP_INTERRUPT; - break; - case EXIT_REASON_RDMSR: - case EXIT_REASON_WRMSR: - { - hvf_load_regs(cpu); - if (exit_reason =3D=3D EXIT_REASON_RDMSR) { - hvf_simulate_rdmsr(cpu); - } else { - hvf_simulate_wrmsr(cpu); - } - env->eip +=3D ins_len; - hvf_store_regs(cpu); - break; - } - case EXIT_REASON_CR_ACCESS: { - int cr; - int reg; - - hvf_load_regs(cpu); - cr =3D exit_qual & 15; - reg =3D (exit_qual >> 8) & 15; - - switch (cr) { - case 0x0: { - macvm_set_cr0(cpu->accel->fd, RRX(env, reg)); - break; - } - case 4: { - macvm_set_cr4(cpu->accel->fd, RRX(env, reg)); - break; - } - case 8: { - if (exit_qual & 0x10) { - RRX(env, reg) =3D cpu_get_apic_tpr(x86_cpu->apic_state= ); - } else { - int tpr =3D RRX(env, reg); - cpu_set_apic_tpr(x86_cpu->apic_state, tpr); - ret =3D EXCP_INTERRUPT; - } - break; - } - default: - error_report("Unrecognized CR %d", cr); - abort(); - } - env->eip +=3D ins_len; - hvf_store_regs(cpu); - break; - } - case EXIT_REASON_APIC_ACCESS: { /* TODO */ - struct x86_decode decode; - - hvf_load_regs(cpu); - decode_instruction(env, &decode); - exec_instruction(env, &decode); - hvf_store_regs(cpu); - break; - } - case EXIT_REASON_TPR: { - ret =3D 1; - break; - } - case EXIT_REASON_TASK_SWITCH: { - uint64_t vinfo =3D rvmcs(cpu->accel->fd, VMCS_IDT_VECTORING_IN= FO); - x86_segment_selector sel =3D {.sel =3D exit_qual & 0xffff}; - vmx_handle_task_switch(cpu, sel, (exit_qual >> 30) & 0x3, - vinfo & VMCS_INTR_VALID, vinfo & VECTORING_INFO_VECTOR_MASK, = vinfo - & VMCS_INTR_T_MASK); - break; - } - case EXIT_REASON_TRIPLE_FAULT: { - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - ret =3D EXCP_INTERRUPT; - break; - } - case EXIT_REASON_RDPMC: - wreg(cpu->accel->fd, HV_X86_RAX, 0); - wreg(cpu->accel->fd, HV_X86_RDX, 0); - macvm_set_rip(cpu, rip + ins_len); - break; - case VMX_REASON_VMCALL: - env->exception_nr =3D EXCP0D_GPF; - env->exception_injected =3D 1; - env->has_error_code =3D true; - env->error_code =3D 0; - break; - default: - error_report("%llx: unhandled exit %llx", rip, exit_reason); - } + ret =3D hvf_handle_vmexit(cpu); } while (ret =3D=3D 0); =20 return ret; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761228975; cv=none; d=zohomail.com; s=zohoarc; b=Osfhhp6qRNjUhWENdAnq8sR7vYKjdMSybk0K7S9DQMcojv5lYKgghOR+fhNORC+aH+KO1oGfswmgRTw/HlSVEiK9Pk0FW69nCRzGILN1gdGzfAh0g7ymcGtINSEBm12SbqgKl97FNa+szUuUGJcqpq8SwYj3F3Ck9jpJjBPGrHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761228975; 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=LgKVVP81quRHZdasM9p0tFwKU7dqmMROiJUy9ix33mI=; b=iO69JjJDRvCFZ106dDY6s0mWpRbyOO7sfq0PFkWJ7n2Q1x0Ng0e7/qeIrzN7yZWC/vlaPY3x3F1OnQIRcnY+M6KBy+WM+evNJ2XApWVlUVc79gLNuBSAte5EqXUcOgqsTjqgtzzKH9lzmq4G6io05CqGcx3kU9+hNSFaGmXRRKw= 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 1761228975239681.0951022133461; Thu, 23 Oct 2025 07:16:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBw5X-0006WH-AV; Thu, 23 Oct 2025 10:14:47 -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 1vBw5K-0006EF-Vs for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:35 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBw5H-0007Rz-3N for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:14:32 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-47117e75258so6851105e9.2 for ; Thu, 23 Oct 2025 07:14:30 -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-475c43900e1sm117498495e9.17.2025.10.23.07.14.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761228869; x=1761833669; 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=LgKVVP81quRHZdasM9p0tFwKU7dqmMROiJUy9ix33mI=; b=zmK9+yZIO5dGyv75q3mKda+HdEIhyvyyoTO6/zjxX3qsVobXb55siLrzvoc5jfC1zH FeHDJS8JYHM1leajc3QbuKsZPIzshx4ZsCUTg+B/bXqPft3bjibC1v0q/M6dKVIBTbTj 3ACylSrJtzM9cmAOT9ZlCnh/AWibTROWc7qHNnUBsFAyCiQP7DqjKbbR97ED2vFL/Gnb 1H16CpcXjqIlM/5AjzDjSlo0GhKZ3ivSUMX3U5JgKghGhSS0ib9ip1wtT24QLIhj+MRb 1s5/vRNjScWc3UAV8MtATsr2mGnAfKB3LJfD+XoWnILVmQKlByFqCayA/kia6y8K9wUX PV8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761228869; x=1761833669; 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=LgKVVP81quRHZdasM9p0tFwKU7dqmMROiJUy9ix33mI=; b=IsMh0gg4uqBW9DIBGLwRgymwXYc5NKxdLkAEBF3HQ7GC50sIf5qPy02Oaf0JFi4iAx SxBBHWN5kMfSw+860LzhkAV10ZCN5HHayghMTPmNCH/QfBowUSm+auTFvel7EhQpYPco 6bkzf1+7GLXoioqbmlCCmk4uRTt1tucVlmx4ERToIvCnvb8+KgSAtA5yNUIkVm3uTmU4 7UWXC4vVR1lvXYFXQUVC5erTGrK3UhHLZ9iyE9LqWn6UtENDvAY863QawJsrzXrpnqJF wHbbR8bSC7wH4hvnHZEY2b3P/XRh2FFXb0RJ33KIZ2lSQMG5DKEl5ZC3JK4frre3lrVa ofZQ== X-Gm-Message-State: AOJu0YyXox2hbEhXy1FC+jQQ6hUN8F5ruPg5qZe1SkT+xCQUOnaDG5K8 dlyaEgwwXkFSssTssGtKRIHbQtU4TbLMRRShu3bAbpgYgQcac5Ye9vjnaEMjknKd6JLM3dm9sDA D6xQWe98= X-Gm-Gg: ASbGncvo2qBMCq3mvkhb7lm8YgW2cnS9XZUCkKs2ZZq0rrlsa3J2heyo0i8EMak/AJr beXBhPavvgSHowdqNmFCZvv4fu6BQtbdgK3P+26pPF6ImbIQgMBcLM62QWaXXnqIS3Pe4zzUNvy QhhXZ7TA/spNd9ItONt2U9sOK9Rww21nxmhDZlGdcHh/dMrzsyJFl137wmEFgTwVF7XJn6pku/m gvp34fFYhjwKTW6QODAwkZbVv4FTIDPcP4HNKdH5y+JLJOJ6HJyE5DscLlQVcrwRdzazr27wlzx g6IhVrX6QCqkJbBgTMvXupxfBuYD//2TJzgvO2PybMu4sTI8G4GuxntUXQTLaqYfLIIemlkul/v BDvG3uZjRc7OLbiIj3QVwXmG2wQnC6n8cduVQPJPREb5Ix5KDjLvmcbY3UgMXc7nC0pNaNhFDoP lI+Kha2wNXqYCH2AG+9t4Q8izWnv8QItbuQqX+7KULgmlK5IyBXJUPIXyD6ukX X-Google-Smtp-Source: AGHT+IFb/XSWqKHanfFo0JpGugOKs3B2G/i5axTSdAeolnzGHJFkkiz6qvyxK3ppW72qVwNLeyHDww== X-Received: by 2002:a05:600c:8b74:b0:456:1a69:94fa with SMTP id 5b1f17b1804b1-475cafae81emr16050175e9.13.1761228868811; Thu, 23 Oct 2025 07:14:28 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Peter Maydell , Richard Henderson , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Stefan Hajnoczi , Peter Collingbourne , qemu-arm@nongnu.org, Paolo Bonzini , Phil Dennis-Jordan , Mads Ynddal , Roman Bolshakov Subject: [PATCH v2 19/58] target/arm/hvf: Factor hvf_handle_vmexit() out Date: Thu, 23 Oct 2025 16:13:38 +0200 Message-ID: <20251023141339.10143-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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: 1761228978478158500 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 --- 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.51.0 From nobody Fri Nov 14 18:17:30 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=1761229890; cv=none; d=zohomail.com; s=zohoarc; b=eV7q/M3fs6aqWBFGEfyRCbV+K1zCcPMG6MZxwvVO9BrYr/MtSV/dWwc9med1YbR/AaOCC/Qolb0wtwaNsNBhDmshV0mBfvETtKpsdmQgNQb7PSut9h4XFGsiXh9tghyuOf3sois6j910rtPbSMicJ9LJF/1c/X6Y2BsxtDBvCWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229890; 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=T0MAWX3PF+zlZmdiNXq5RCA26mpljCPV09k/qwEJKNk=; b=c9aQaepLvLC619vsztPFPRNMPTxA4Pl3tQPjgc4oxwXM5uaSDZuNDgyKBf+UCqkOO7jE/xI6OE7UJUFlwryjiO/EINS/O0SuW3+ixmTtWgZ1FxhY4moXhTJ3QwnPAKfgDtsOk7dufT80w0Xt35DVJa0x+wRCfiZQdltjsdylY0U= 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 1761229890743915.9032782936114; Thu, 23 Oct 2025 07:31:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwLF-0001vM-94; Thu, 23 Oct 2025 10:31:01 -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 1vBwLC-0001qT-Hw for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:30:58 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwL9-0001o7-Mz for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:30:58 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-4298bada5bdso577226f8f.2 for ; Thu, 23 Oct 2025 07:30:55 -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-429897f57d9sm4337292f8f.20.2025.10.23.07.30.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229853; x=1761834653; 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=T0MAWX3PF+zlZmdiNXq5RCA26mpljCPV09k/qwEJKNk=; b=bl6deGFKeu9YvkdRPVRZcnsM2BM77hiVvjBkz+8Rc5YM+LaaIgWO0kppd+yP70Azfz NnzMrzpOv3elZ9GPspJWVYMTlxHrODrrWz2x+zOl6Gt/5B40E6s2t+AqwCCL3V7046TH bmQr9b+MBRmvalhyya3Tof7VgdazWMKzEJoRfukLhgV+xWLBzhX2nQSN7iv4JLJgLfWS qn32gvOrYo6EAydQAhQhCTDE7FxJdmFbyKA28l4TtHmJ4eXbAmXmw6H8wyfre4YkoARt V9qS2xVgzKgKUDWZ0UtHgHTzxZ2KDH8dLD/38gNVvzgpspz6V8aNKdhSqkzYkchlD/H5 do0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229853; x=1761834653; 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=T0MAWX3PF+zlZmdiNXq5RCA26mpljCPV09k/qwEJKNk=; b=SkV+ltdhxSaVCMQcFC9PN6laXia2sIG7p8nkjcg8HkZ5kfJpE8dB5q84QPjDpMIHcR 1tmvNysWsBspLsMJftXo4Awpqk+22h3NYhANMCSwpdfexQV0vlfJXM7F8RUmIrnccmnC R9Goi3uY2iLrmSKyoUMpCyLvCV++C8u+tuwJXGpJGVgfWL1HllNN3baBjcGH4WvUetEa C4SR/9QxdP/pmrWRkI3muP4VW6WUGxQRsbL0ZQpJNuIwzHMYFO6uVOhTxvAVHEy3VxjY zzAwZ0lp2k6JWgLCE4p0N7Nh/2LR2wdKT/UqL9MuBQmOzS97K0pPudJwOSRlixI3Jxpz qxGw== X-Gm-Message-State: AOJu0Yxrgvn9Mc3AFjlsFxJmZ7Anftvlim0du2bWJgfhe8KIUUx6DbgP eu5tcEW5xJe8NjQwqajOd5fV7ByxwJ1kPKwT2XeiHelVu2rN8lU/3LThHajNccfCTFyIEc4TdqK Aj9+qRBs= X-Gm-Gg: ASbGncuUXsR8YZRAw/5MT45dSFZGUzFi0/FlQj8ygJb9m+G6sQddm0QpB6OYe1kDULx NrVrN3olGYFk9Yse1EN6NldCIVz8xKQ8vHyodX6BNfcexvltQokd3r+wvkNXntZswoqwHlrW7/3 iOrfpO2kVghyCEKWceCraK7KxTMS7M3fl+oa9K5idzFHxuer5FxEG6yzq8xJgVsDg1IqUKPOuX0 59qwYBAsy+WEJV05jNJR9fsqsR52UhPAa/qaWrJlq0klAbCAxqoxLQmDj5LY5rjgFBgshWko6zX EiPV7I1FfebojW38qNmzbBZUJ3A7Jcs7UUK0CFEoM2+ulxlQTn3bnGd2Rh/UhUKbbgBLcFm2+Ss bOo5zFKsmROXV9MOM/VQ9isPPDOz9/cgRlFv1uzWGpKMy9GWgvXW0CbP/yVpelrsXohY7QLJaiE RfOo748ZzlWljBu3mqjlHuDIeS5D2dqyOzL7JbGjDcTe5mlHrPR6YAJgR45Q2K X-Google-Smtp-Source: AGHT+IFCOAMqiZnDqEZh67V77IycAuiZ5c73+EWw0KcxV1hMftPod+iLrhtZSp1Ej7xvfFANsgZOnA== X-Received: by 2002:a05:6000:41c7:b0:427:652:8e6b with SMTP id ffacd0b85a97d-42706528e8cmr17357051f8f.31.1761229853257; Thu, 23 Oct 2025 07:30:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 20/58] target/arm/hvf: Keep calling hv_vcpu_run() in loop Date: Thu, 23 Oct 2025 16:30:41 +0200 Message-ID: <20251023143051.11195-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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: 1761229896367158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Mads Ynddal --- target/arm/hvf/hvf.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 27c600148f9..79861dcacf9 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2013,30 +2013,32 @@ int hvf_arch_vcpu_exec(CPUState *cpu) int ret; hv_return_t r; =20 - if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && - hvf_inject_interrupts(cpu)) { - return EXCP_INTERRUPT; - } - if (cpu->halted) { return EXCP_HLT; } =20 flush_cpu_state(cpu); =20 - bql_unlock(); - r =3D hv_vcpu_run(cpu->accel->fd); - 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(); - /* fall through */ - default: - g_assert_not_reached(); - } + do { + if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && + hvf_inject_interrupts(cpu)) { + return EXCP_INTERRUPT; + } + + bql_unlock(); + r =3D hv_vcpu_run(cpu->accel->fd); + 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(); + /* fall through */ + default: + g_assert_not_reached(); + } + } while (ret =3D=3D 0); =20 return ret; } --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229992; cv=none; d=zohomail.com; s=zohoarc; b=YYOjl9EXXq1BtJvKjPsmTxw1JxUe0P0on24WMD4oPvUFESinYLjzUMkwnGGJ1rV68/q6bEsH0f6nwxiynmOcIkHojxgtgSIDTKRalCUaL3id1FZyaj44ZuGL/wq2D50QS/qYJ1RreORj5n4PFpJFT0gd5AHIlEFv4kBdhMFoR4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229992; 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=V3asS+wXSq9uXqx9Uo0sg1PGthTH+0LCho3xSIRojV0=; b=bJNp6KhJ9vJoulSJitax17wdtONecI0BucI+3N+8IsTFBLE8qAfT/wftltjOC+3057CYC5UJTZrna19Ohpp3No6h5KBmy/hB69nnuUpXN67bElOm7vYTElNw/IH1TtWrybdwD7XvIzZ0yEYGQbp22YNz7z2mZJxrKgiXmmqXQf8= 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 1761229992479296.5046932895551; Thu, 23 Oct 2025 07:33:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwLI-00023V-B0; Thu, 23 Oct 2025 10:31:04 -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 1vBwLG-0001yu-Pn for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:02 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLE-0001pF-QR for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:02 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-427015003eeso871554f8f.0 for ; Thu, 23 Oct 2025 07:31:00 -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-429897ff371sm4293487f8f.21.2025.10.23.07.30.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229858; x=1761834658; 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=V3asS+wXSq9uXqx9Uo0sg1PGthTH+0LCho3xSIRojV0=; b=sCSsVL88yvXQg3Rb+fraQGP96heFco3YXo2KWh8in54YgGs4eHkRO1TlbYlJKEnok5 ZDi+g7Yb8Hrrs3MLg4sWkSGs66r+8gQPGFcdPWeFKwC7cxpBI25FpIBGQk06N3IFGLgb iJX7MsRmVEigvH3iEMyG3Hy979dDnVky9Fo8Tleiq9iEx1YcJKyy5cIG7dEueJP4phb/ mdiYBN051FuRgv3veDz6bLOcRzu+sUXYeIg0nQh6c0SyfEjBZCQI7Kj2/s2tDjkgZStw JUwIkvdhxGyWKcT8sFJb8Up8xmr7l0jagOKvkWDnq4aFyc/MFO/24zujMPipaOpf9V+9 SuqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229858; x=1761834658; 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=V3asS+wXSq9uXqx9Uo0sg1PGthTH+0LCho3xSIRojV0=; b=sCAF0O/z5WnqtzHNIQRA/nOOVbJhrx1gJaJB25lgahX0IzFReWB1ocgJdpbSpW8TXO UQhzq2vU4b5t983gHWeLdUSRMfaHQH12JgXzl+cad1TvWTahopcoCq0zhR9eeBNob1gk neDzlWq1bntrSrhNLNe8/FEQu2YX/q7IdBWaTvO0eTxk15kGV/oRQEEEzlGF3/BfYv5Z UGQC4yvdCmSidpPf5e9jxw7pR2aKBLoJsB2tw1fc0N2eJW6avik5TlPyRSOICBOnIz+y nHXCAKXszsPauIGyKNCCKLS8REKl/dlktJScSAURPJkGl+BCgrNxXl8st+LJVCjGH9pZ gkNg== X-Gm-Message-State: AOJu0Yw21/AhIUZR1fuTxR58TcSXOdiRvZz3vykgA9rQMTzsJJxQrwox PuofMRQqOcjyFXXaU0EP5dPrV+cwqSIZjYTbxZU+a4ZcQIF6z8knC0//HhDLLSB5Moj7DfXOGnW KEZK+cjo= X-Gm-Gg: ASbGncuYG2pOyDFzdjPwU+Dj531XODOqcaPns+VsrdHhsLxi81Hzp9rLxaOlewcL9mF eanQrHT9+Hg88Mu9ENxpC6ft47vYcVaINqeLyH3AZ7nuCjTG12814R/umgk7jUrD3pI3HKCMQQQ 9n3z1AZ7NIakBlIER+IJfmXsuwvO4RKYHvasIFWeC2DRskbfL4Me68Spbr3lQXnmfa/AtTYq3QG J7cABwZw1QBEgAUgBuIO3oszTsebwsMMwoZdVKFjnFp6hwwxz/9My11+JZJzmkNHlxBOEHBfO2k rVcpHSSOzUeX4xYXmQ0k91HSwlDhEYQoyS8zdQaYqwtp3tcHHCyK/vO2IixOPzavkR59GZmZzNB lxiL45ruW4ZqREA3vwLuWuaIme9KXjx5YnaUOckXDaDmjETY98oxCouieRHCjZs4ijGIqGzqhhv lzP0/Wni+8ElfWE9jOfRQ2++dB8pjIX4PZBmVXmC0O7Pu/QZ8mAA== X-Google-Smtp-Source: AGHT+IGoiG1ypgp6u0o2eygJfvnSdOL16Gmj8TSbis2d0fZH1lLt6/otLz3iJWWC4wjzu4wj9fwj7w== X-Received: by 2002:a05:6000:2884:b0:428:3f70:4b3 with SMTP id ffacd0b85a97d-4283f7007b9mr13762176f8f.59.1761229858242; Thu, 23 Oct 2025 07:30:58 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 21/58] cpus: Trace cpu_exec_start() and cpu_exec_end() calls Date: Thu, 23 Oct 2025 16:30:42 +0200 Message-ID: <20251023143051.11195-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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: 1761229997213158501 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- cpu-common.c | 3 +++ trace-events | 2 ++ 2 files changed, 5 insertions(+) diff --git a/cpu-common.c b/cpu-common.c index 0eb5c7b8f24..988d057d844 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -249,6 +249,8 @@ void end_exclusive(void) /* Wait for exclusive ops to finish, and begin cpu execution. */ void cpu_exec_start(CPUState *cpu) { + trace_cpu_exec_start(cpu->cpu_index); + qatomic_set(&cpu->running, true); =20 /* Write cpu->running before reading pending_cpus. */ @@ -319,6 +321,7 @@ void cpu_exec_end(CPUState *cpu) } } } + trace_cpu_exec_end(cpu->cpu_index); } =20 void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, diff --git a/trace-events b/trace-events index 3ec8a6c7202..faeba6242fa 100644 --- a/trace-events +++ b/trace-events @@ -29,6 +29,8 @@ breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=3D%d pc=3D0x= %" PRIx64 " flags=3D0x%x" breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=3D%d pc=3D0x= %" PRIx64 " flags=3D0x%x" breakpoint_singlestep(int cpu_index, int enabled) "cpu=3D%d enable=3D%d" +cpu_exec_start(int cpu_index) "cpu=3D%d" +cpu_exec_end(int cpu_index) "cpu=3D%d" =20 # job.c job_state_transition(void *job, int ret, const char *legal, const char *s= 0, const char *s1) "job %p (ret: %d) attempting %s transition (%s-->%s)" --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229960; cv=none; d=zohomail.com; s=zohoarc; b=hHvWxOQpja0bUQsbECM1U2nbFWlswDGjDj7Lx0iwNFL5KP25jTPhzjs2vwPEgeIrloCAlYN+/bMTefGXodQOoKarvMCnbSxHGqBLmCEqCgSyai03R2fv+DJl4D67TUkAmiDw8Brz5bRe8qHX0FymURcLi4x03oFF7xAScr/EZRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229960; 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=T/5WvYcYJ8yp0ccFt2pcnpeZY9JJpwnARpW25qBUYws=; b=dnv0cpUT+2LdOp1Vh6978Xo1GqTAe/NxufhWXRxBMITWyNgl/lUvC8HBWQDAdaIluuZPv6oqtLDsaieHebSl0g/xyjtFeVfFQ50i1ojN9nuNfDLRMyt+6dmuMjhCzpwZolUhn0X40Y+gVZ6BHFxKFJrBw42KgHAxHh0z1jrTyyM= 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 1761229960513792.2184296276712; Thu, 23 Oct 2025 07:32:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwLQ-0002VM-5G; Thu, 23 Oct 2025 10:31:12 -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 1vBwLN-0002MV-Fe for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:09 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLK-0001qa-Tn for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:08 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-47103b6058fso7004825e9.1 for ; Thu, 23 Oct 2025 07:31:06 -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-475c4342373sm119172675e9.12.2025.10.23.07.31.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229863; x=1761834663; 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=T/5WvYcYJ8yp0ccFt2pcnpeZY9JJpwnARpW25qBUYws=; b=RWXF7h3YTI7xEfZYCMyLx7/YS+gdwv+VjIC2WiRCtBgKEfc2UEercQwxCvwiXBIH8K 8gujDFK/M9LINUld/Dk61sTd6nY2jhpHmN39KeXCc1yp0ZdK0p1SR48FlzIKeXLXn1Hw fmlpAR+xsmBrc+fCCby//8wnxJaypGolbOroHAs/sThykHk9VbcTPrFthWiEqDXxb7vi VeIuxJhvawKZADYJB7FP7swfUexO7VafzFPRL4ZxTFQo062RTnRtQyIN6fhffOh+zMPw C1PHGYLbUKTIj5rPCLbnCwRCJ+l8aloXlQr1MjHxahFH5jGolQW2C1DPxe8GQ9/x8wGo Bf1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229863; x=1761834663; 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=T/5WvYcYJ8yp0ccFt2pcnpeZY9JJpwnARpW25qBUYws=; b=cZBSTMRLCcTtUclt4kMvEx6s1/5DWUetiSvnwCuplbcBssktuJkzkA3wYWaME26cYW iZ8g2YkKi5WsPnBS3bFEn7DkLXUVUgBuVIsDNwtDfMIntI9ot+6l+m+5koCSX+jQgcx0 dR0YG4PRoBGOohz4Eaq07EDkDv4VPsrGJosWoADrqiXq/roEFhAT7jqifmowknIyQ5tj U3hKpayPywOxXzSU0oQL7yGhPz5Usw59dDD/GTVRHGryoldny6pmACtl34N8FYneL7+Q PRaWB8joAGigDNMMy1N+s/oBcDROgSw05CVaKnJGt+zjb8kqejksEIimx/A+uXWojiTe Bdbg== X-Gm-Message-State: AOJu0Yx7lai78PSHhRn8DPc2UCRTCBGZUy2aalSw4pFWFj5/xN7vuIvN /q2plWzrQE6t4lOpOQfVvWXMYvuWrZZNYQWBXGcSOgRAtq/aKxP1JNBq8LD2GLMjtn164/Mbqtw GiA5vIPE= X-Gm-Gg: ASbGncvxHMvlaGK79/3HspQ10PVeKK0czmJSJyWey8tDoJxDpH+sCvd5477MPbxbfnM m0WGMZ93Iv0SsOyb8sLokQsxgdb6NMq7w0tWGnG/8iQTWeRxs5PHz6WMMGU9Gggyvw370NqoTB7 ffIEX0s4RjOKloocJEF3aHHhKaMpOcL2jhkd7bsMuEP0mn5Wc62wG1rS3bYO1G3I8TUs3xAzybv H6DycecZtTsohjX0Pol/e9P4H8n/fr4sogoRl/eirycyqSQ7H8D7ES35NvJmErfhAiVhT2Vld0R P5RakU1ynlbnCaBrEGr0Ge1/+riKY3QqX0PrGm8ePBLIXCby0KWn2rQFi+moTenaCU77Po7loGl lgRX/Npyjq/x6XmpeDiMyx2NPOCkOqxY5rOLYTYmxycs6R/ZeDEzgMqwOxe9eg3/5ReVtRF7dDF UTI6CinEqUl+RYSwW+rS4S2Zvb4kVh7l7QmpdHW/zycqD8mn5PsXkg8ui4nqYr X-Google-Smtp-Source: AGHT+IEqpoi13AH0kldXC38uycff9piRT4TNbZHtmzsemW55pwWAXcaSN0OAkWJHRuwpkfCzmkGtoA== X-Received: by 2002:a05:600c:a4a:b0:471:665:e688 with SMTP id 5b1f17b1804b1-475c40013b7mr53414085e9.17.1761229863263; Thu, 23 Oct 2025 07:31:03 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 22/58] accel/hvf: Guard hv_vcpu_run() between cpu_exec_start/end() calls Date: Thu, 23 Oct 2025 16:30:43 +0200 Message-ID: <20251023143051.11195-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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: 1761229960839158500 Similarly to 1d78a3c3ab8 for KVM, wrap hv_vcpu_run() with cpu_exec_start/end(), so that the accelerator can perform pending operations while all vCPUs are quiescent. See also explanation in commit c265e976f46 ("cpus-common: lock-free fast path for cpu_exec_start/end"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 2 ++ target/i386/hvf/hvf.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 79861dcacf9..c882f4c89cf 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2026,7 +2026,9 @@ int hvf_arch_vcpu_exec(CPUState *cpu) } =20 bql_unlock(); + cpu_exec_start(cpu); r =3D hv_vcpu_run(cpu->accel->fd); + cpu_exec_end(cpu); bql_lock(); switch (r) { case HV_SUCCESS: diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 2929a92defe..ab59381b500 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -992,9 +992,13 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return EXCP_HLT; } =20 + cpu_exec_start(cpu); + hv_return_t r =3D hv_vcpu_run_until(cpu->accel->fd, HV_DEADLINE_FO= REVER); assert_hvf_ok(r); =20 + cpu_exec_end(cpu); + /* handle VMEXIT */ ret =3D hvf_handle_vmexit(cpu); } while (ret =3D=3D 0); --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229961; cv=none; d=zohomail.com; s=zohoarc; b=DeViX2fTcVxENLmqkurheB+33yK56gY1M9yGdcaUlgzAqqfWToAR7gssMxwJsRU5RqqokUHBLLUcodI3x2zcZA7+K5yn6wHmekfZoDcAkHam9DqhdOz6gnYVl1DefJvV7v2Lc3JW+OO2ZBsFItpj5nRH2pD97Ho7MqXCSVXxtyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229961; 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=B7QBs13fwIjO7kuSvhwOAAtMaY6vnhC/TwMzIPPo1l8=; b=RqT7Eew94q5tDlwKGjEN9Q6dKmzRQ7B4HuWPxaLn4SpVTqARDBV/PI9BrIwh5lmqCGtuSIwuu/EXS9X2cHcUdQYXccfupdMjzhZtAMkQ+l6UM1Qh+esOIhhhPaY9Shm4xTsIPFxvpTj4vssnSEuv5ugTB/1jKRo17TDaTsSasN8= 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 1761229961608320.71344390648653; Thu, 23 Oct 2025 07:32:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwLT-0002fm-CN; Thu, 23 Oct 2025 10:31:15 -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 1vBwLQ-0002Xk-Rv for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:13 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLO-0001ro-8o for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:12 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-42421b1514fso644949f8f.2 for ; Thu, 23 Oct 2025 07:31:09 -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-429897f57b7sm4275050f8f.16.2025.10.23.07.31.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229868; x=1761834668; 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=B7QBs13fwIjO7kuSvhwOAAtMaY6vnhC/TwMzIPPo1l8=; b=dwdCWWQwB0bHFH56hsc12nBeTLhZyKn3KnnWxv0QlWBno0cha/u7IrW5eOwHAPrxkr MGZZSORFv8dwMDpPUSR69pwt8L+H7ePdbtWn3yH7ioPEbE8jhCUF9ZlpERLQz0VDS7Hy Tsy5iYEFQSizeIj8hNE4MI91A/bI0jj2pVQ/F9Fnb2e2e5q4/jlmWtjWDKFDGJ/ll9Qw Re6bpFR6QvaRzD58u8OBvb5hLO6a/I+h5cxoWd2lsaJjZ9m+5syaEyVvADZD4KAvwPLP xZ1yi1NuQRWxV6jn3rOD60T5Ik6mT1Gk6THyrRT9Kufe862TqRvxbwYCXVKTJR0+nAlj Y8Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229868; x=1761834668; 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=B7QBs13fwIjO7kuSvhwOAAtMaY6vnhC/TwMzIPPo1l8=; b=QdBh4LqB9h/ThK2qFZOD4+yg0GKIUkhh/5ZlnZFkzQLJ9NOSPBtOjfQQpC0ePe+aLc 2u+YCcgrGnVZ878jOShfl5AScqjHWfZtjxKJhSBhuDsur279qEWGDux1FKP4gu7DNQOe ZKvMAm+tNuSnMZ+Ie3Ss1m2Z2y82BNQZD9CXjh3j5DthCiDQ+Jg5Jbwv5cdEBE3tZia7 S4gf/XGv2XQ+mHbBmBm1ipPi/UBXbWt+v+UQadZR68hChI6EGIgPDYYRQELsjA5i+bHL GGGJ99hvQUcmOrK7T105QJFJRHXxs+r55gsH8ulGlKb6CMzjSeXGhzV8IqHjzoCdMEMH K8rQ== X-Gm-Message-State: AOJu0YxRxmHKg5Dpn/DPt8lYPcg0NC4IDC7jv4sbgBXmaL1Y7cREuWtb vfQcnwglRnc1VO+s74k3959v3o19tcPE5ekOpEfpxwOtJndWuGcgFDaJllAyd1eVezBnNlUBLbJ i0RPQ4cw= X-Gm-Gg: ASbGncvyVgJuLD463RDs1zRFBhwBtIKrtHacUaSdGe7gjZ5ZGG1/Ge7e+iWJ7HrTQtF jmC0Yeb6qMf7y9GPF33pDy53ywB2+5UYz99DDOpJDVu5TxRsrnlpR6Tk8pueiKFRovizVLrUm0C SfVX6tcbRyUchS6xcV/ACtuDi/rk2rEbv+u1iOyr9gTmG82qwmXf55lpeIZ2ZEQMzO4c51WF6dQ UxsLLJJfvrooZOPt8ET3ogslq5PzWQbBPgSgPkS5DCd22LtaPjmkOFhVZK6Z2o3AHOnikMJFWUb Uh/Tn3cF0nQUKyISSZHKOIUawWNWoJlw5oOU+fCtzrtS6NeaJeMGjkpwfXUTOtXRK0Jct7gANgE HWvw4khQGSYQ3l3oDqXuq2HgjFccKYC/51tMY74KWBv5LEsDOBGmOkfT8OBXn6Hbxsks6kdnWUt ViUHVDKOSBf/QWZsH6FdCeyt0eUTWLyBszsjzNnxm4i8bAY1lZ5FaqNhBlQRA+onvYmnXLqDc= X-Google-Smtp-Source: AGHT+IEFBH2UqisSvsEaSXVNhvjBovLf6eF+c90xGmup8Zdbp61fnyasxTGb0uW7yN5vp2DgZR0yiw== X-Received: by 2002:a05:6000:2383:b0:3df:c5e3:55f8 with SMTP id ffacd0b85a97d-42704e0ee2fmr18050724f8f.54.1761229868143; Thu, 23 Oct 2025 07:31:08 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 23/58] target/arm: Call aarch64_add_pauth_properties() once in host_initfn() Date: Thu, 23 Oct 2025 16:30:44 +0200 Message-ID: <20251023143051.11195-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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: 1761229963016154100 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/cpu64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 26cf7e6dfa2..f81cfd0113c 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -762,20 +762,20 @@ static void aarch64_a53_initfn(Object *obj) =20 static void aarch64_host_initfn(Object *obj) { -#if defined(CONFIG_KVM) ARMCPU *cpu =3D ARM_CPU(obj); +#if defined(CONFIG_KVM) kvm_arm_set_cpu_features_from_host(cpu); if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { aarch64_add_sve_properties(obj); - aarch64_add_pauth_properties(obj); } #elif defined(CONFIG_HVF) - ARMCPU *cpu =3D ARM_CPU(obj); hvf_arm_set_cpu_features_from_host(cpu); - aarch64_add_pauth_properties(obj); #else g_assert_not_reached(); #endif + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { + aarch64_add_pauth_properties(obj); + } } =20 static void aarch64_max_initfn(Object *obj) --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229944; cv=none; d=zohomail.com; s=zohoarc; b=foSL25ed7UGZSBq9weRuzLZXi3Mbu63vMb23F5ba3bb1bRDPuIiB1cGE8SuOiiiYPXtIVSRcvP5SywjUBkOzCzYsuGufGsN/g+gUUhby3QsQblunmLDoQvV2GQznpp05DKA9+bS782XAFCn4xusRW6wvRryzMt0wGC0xPTCot14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229944; 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=Y/pnrcoc7cYS7GwGVqSI0sbh32hz5/hHl5ailiW8kns=; b=iYgXTDyMHtpMMxtGNYFNJ5a5gtH1qHZ1c5zjtoyHVRRpYM75Mgb7cNFxtJGNoZ06oFWmlrf9hSQeHplazjhZN6pjaoO/C3eD3hxFTU4OHEf28g9pY/P7wiwXkUjTqjLqt4Yk+jvU2PHx8fH1b3XuLCbqfBwMNQ8QmWrvkGCNUWc= 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 1761229944707761.7480901383828; Thu, 23 Oct 2025 07:32:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwLb-00033H-2n; Thu, 23 Oct 2025 10:31:23 -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 1vBwLV-0002pR-O7 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:17 -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 1vBwLT-0001sz-Hm for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:17 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-4298a028de6so568450f8f.0 for ; Thu, 23 Oct 2025 07:31:14 -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-429898cc930sm5145512f8f.33.2025.10.23.07.31.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229873; x=1761834673; 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=Y/pnrcoc7cYS7GwGVqSI0sbh32hz5/hHl5ailiW8kns=; b=EsDjM/dYUM45rokp2gdyIcESbPlvuJPcqXQ62wMX1k/BMvH2Ek8BuQluFpAEddeJXM qKQpXFqf/ijupwVMmzQUYRMfTtYRaxhriVkimHeJZqTY45PzVdYJVB4Win01RiOnteBm Dvs9YcKn/bqDjwNXJqD+7o6+Og53huTNKLsVMxA+sEfDc+KMzJeUKV/1Mo7Nhe89L/jN Xt+seVhPT6bBCGd4VOF3i2RHgd4v6PPX3jXGrSilczzGNjmxvdKzvrHMmfLGnhDLJJ+I nres1bNI+ciWXUhHLLGt0vVOuoJWGjyDiOXVypCdxfuCxMKix7qKbW3F95WVtSQE5wcT Xwbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229873; x=1761834673; 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=Y/pnrcoc7cYS7GwGVqSI0sbh32hz5/hHl5ailiW8kns=; b=MbINdYiicHpvW/Rd4g1/SUiS5qXEfv27e3VYI/ukN9CU5Siimg0AC8XLYkiasWOvf6 BSJmv/SVXT7VtzMreIKTSqlBE3ifrAgbHQ17wW03t7LaUTSGRYjmoMnLaD5c+G73GGY0 ixul8P9tEQCxGnsuz8l9ZJaxmAA56oGJiADKwoyEqJvZATV8o92zL8CmtC2rbiaE4g11 00FLQ/V+WqDGyMyGduwSIJG1mofSJ8Y7B2G966bvrCC5fKbezABqHBkawXnBVE0IESDY 01qxtoYAVXhl2kvOYkYxMAu0auvE99/3kkXQck0ltq6WQTEUEv/AAPOPRiPHyCjPwJzJ IiiA== X-Gm-Message-State: AOJu0Yxszfiu08cZhr98T9PdQ0pVEaJw5x26Jn/FLPDbIxH5YTakGYEm dDAy4rq5wRtjCYTgdcr4Zr43/TFjCKgE5tnpT6m79+R9ptqVHCK5zTm1YLQL1KL3Mid7zkkz60r XSU4xahY= X-Gm-Gg: ASbGncsOjA9W1o/GpDnlswqCfbY4UMRd2cGcv1lV6UHjVuiA5XfoD78VxLvvMd/ulNB IFPY1GCgfa7QYqI9uKSGuvWnkVivsOP0/KuQp7Qo/BQ9fvtTGGzGPRWSCrwpK7iZwC/lBFIJW00 k4ZQS0kF2lxC2OGCnb91j4UEjL+YLkMNjJ1W3qlpFTruJ67CEw2m0ij1aMzEPl+AJLWuORkDzEZ h2eUNUgmCeCNPcElqDsYRR23PCvrCc4bOTC01Vuc7YNH1Hzrh4BD+9BdCgJMltg4YZq1EXgL9cQ 6JS1njzTRMcj9VCaOb1UFC3+V5i3MN42AlGwf1GeBKLUZbbuKe14sdcFOYg81cCE7BuhLZATZIx 7cR+gnT07sCbQZar0Umk7t5Q1dMRl5y7nGUm5Pt4vG7DYrE+XlDiVeNmKNhtqWv6ylBj4bCVJUu tJArs3hF/5UGDSZvOVIqTm5z7eWIjA2FmA632MNOMSnXw7s9BKpA== X-Google-Smtp-Source: AGHT+IHkR8W1MvRpp609Gf74Z1yewPmxQUUgOJcQ3VVKK1u2vq1dtS5BzGk9WOf6s75DONZ03Q6q1A== X-Received: by 2002:a05:6000:2c0f:b0:3ec:db87:ff53 with SMTP id ffacd0b85a97d-42853255d50mr6053232f8f.12.1761229873078; Thu, 23 Oct 2025 07:31:13 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 24/58] accel/hvf: Restrict ARM specific fields of AccelCPUState Date: Thu, 23 Oct 2025 16:30:45 +0200 Message-ID: <20251023143051.11195-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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: 1761229946900154100 Do not expose ARM specific fields to X86 implementation, allowing to use the proper 'hv_vcpu_exit_t' type. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/system/hvf_int.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 195d64dcf18..3d2be4092ef 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -59,10 +59,12 @@ extern HVFState *hvf_state; =20 struct AccelCPUState { hvf_vcpuid fd; - void *exit; +#ifdef __aarch64__ + hv_vcpu_exit_t *exit; bool vtimer_masked; sigset_t unblock_ipi_mask; bool guest_debug_enabled; +#endif }; =20 void assert_hvf_ok_impl(hv_return_t ret, const char *file, unsigned int li= ne, --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229944; cv=none; d=zohomail.com; s=zohoarc; b=JeP+BAZ1PGh5fLKn+LpEGP7rIHpJKhzjAI2wUfcNua9Shwt72AtIVBCGsdf9Lwstigr+P2vX4XoOQ/BFEGoufn2FXKDJAYw9aIaELhAV7nVLCmL0x/JDzmaGi6O0qoWvq1EQWY8eyTcvjYeIhedI1tXOxG8WaXmyJxowup4F4Mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229944; 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=DslsWZRISh7psS9m/3Vcm25WGBA0WCzWSpcN8EjiiSM=; b=mD2dslIPQ7w4hQc68scYTKvcPaI4aHH9K/P5Q3k2CH66r2Bna/Bvc9RRN6aQiDZlzW9F9hcge/a12dQkHsm9n6LwLCAatWtzmwpe8TdloaWxFbGIHJgH7SYuqFKw6O3XVJm2omdm05MV2VaeJrzH0Ud55S5Q5aj3fFURKJbzd3A= 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 1761229944124351.88732773725087; Thu, 23 Oct 2025 07:32:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwM6-0003ky-BA; Thu, 23 Oct 2025 10:31:54 -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 1vBwLi-0003Nk-JQ for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:32 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLa-0001vH-EL for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:28 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-475ca9237c2so5212105e9.3 for ; Thu, 23 Oct 2025 07:31: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 5b1f17b1804b1-475caf2ef9fsm40582415e9.13.2025.10.23.07.31.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229878; x=1761834678; 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=DslsWZRISh7psS9m/3Vcm25WGBA0WCzWSpcN8EjiiSM=; b=DM86/v/Ssz+U2lZjZX5gPDDtMVmJ2dI+OdMbSDBP+vOYPxIULXBr7ANt2IeZl28nZp MPEy2wZqcRBw8mRGynY6Nh0Z9AnWdSOcQlPb/mN3HLu1mFYVgRwEiYeJNMWLSmadDXst wtoaUgkSay+KGRvRu4b+iiiNRMvggETMAda4BPBfHsJ8i068/3hZrkCb72Z7gecH3Q8V d2SZfP6yV6qAj7UpUYYXdplff1HcODHfe/voppBfwzx1JEuzEcQVyAi+L95w/9rgJ8GC hkZ6ViNuhGh+4l0nSJxCFdMMfR5B8VIJxbCHEA9aT0Gmo3y1R8UyCB5v/AeYIwSpgNnl q8oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229878; x=1761834678; 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=DslsWZRISh7psS9m/3Vcm25WGBA0WCzWSpcN8EjiiSM=; b=QvS8qrnLNBjbp2/PmE6zvH4oVM7Cy8fC2kl85jEf1fEI5RcJrX8f1zQ15hhuPsYH8d iSbVSGMGpO/1kDnFjDGR49/TQtmZLwCBskEpirKTF3HhwU0PARpduVgqiNtFYcTz02Zp WmEm3m2P6xvQmuCG82nPzQbqMt7BsmCztKDuCtSs2IEAY3RnkX9lLElhh6uk176Wjrtj qES6Ya0ckTDQxZpNMF33kQtOuqGNVTnt508HUFhWHI5+OsmukWK1fVFWMk/U6ZXtDGVA Nw6yYRUcye586oa6Ju76e5MCRWhSUHPaebtrHA+PiJ0wWukDzicfQUOUKOzxlgRz9wid 4YTg== X-Gm-Message-State: AOJu0YxVw8ckDpEcGIY+BREECM1/zWKBIdS5nUxm2PKSK4y16C8ni+VA MU8oYkE709jGkec+PKEIZeV7eftgDOph4MrrOId3IUIdXxIUQSjMFBnpxsTAZGCYcOHh7WQcWiQ MmdLzZ+4= X-Gm-Gg: ASbGncuDtk8JsFOLCXVWNln9wWqJnxfavEBqAAN688k2LcTuFUSe51gLOmzGjzsZMRY KzKrNk9wMgshQNHEPUdpg3Gkn2YNqsudZpsaWKNRzu2Il/BlayZNiNHZGdsf6TT1GRrdjQKyK5D asB+HtJHpoymtPkL186k7liVSfF+ZWHI73b1v0wJEq9Yo/APnsEcnLArn025RJvdcj3G7Oef3ZS cKxCErchs4yL9pZ0DJB5o+QiVJWju2wX6XYogxOI0DBXfGbTHXuHMkP+i5qbPhL6ZahE9wdBRH9 iul0Wn2VxDs+KN/+1NrQ5tp/z70ciaALJCR2u2rkZsR3doXFHt7snvBy0bhpAqTc84YFS140tSR w1MkT6D4IzA7S1UKiJFBHnONQKSqfx49dty/g+WxWAoAWx4xyglNByJ2nKfof/T7u2HqBLZACkr vp/d1V7V5JgXFyouRs9i+bRdM5y0zGznmaPooEtmmELHL04qARPArCazRjS2Mq X-Google-Smtp-Source: AGHT+IHnqCO3OclczupLRt+ToLRSlrB4ZN0DpT4EbwOFTjy88cSPESepugjR271vr7x5UyTpD3KtGQ== X-Received: by 2002:a05:600c:548a:b0:471:669:e95d with SMTP id 5b1f17b1804b1-4711787dcc8mr164752235e9.12.1761229877945; Thu, 23 Oct 2025 07:31:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 25/58] target/arm: Rename init_cpreg_list() -> arm_init_cpreg_list() Date: Thu, 23 Oct 2025 16:30:46 +0200 Message-ID: <20251023143051.11195-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: 1761229944620158500 Prefix init_cpreg_list() with 'arm_'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell --- target/arm/internals.h | 2 +- target/arm/cpu.c | 2 +- target/arm/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index f539bbe58e1..972b8bc50da 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -376,7 +376,7 @@ static inline int r14_bank_number(int mode) void arm_cpu_register(const ARMCPUInfo *info); =20 void register_cp_regs_for_features(ARMCPU *cpu); -void init_cpreg_list(ARMCPU *cpu); +void arm_init_cpreg_list(ARMCPU *cpu); =20 void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu); void arm_translate_init(void); diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 3b556f1404e..bfc031c70c1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2138,7 +2138,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error= **errp) arm_cpu_register_gdb_regs_for_features(cpu); arm_cpu_register_gdb_commands(cpu); =20 - init_cpreg_list(cpu); + arm_init_cpreg_list(cpu); =20 #ifndef CONFIG_USER_ONLY MachineState *ms =3D MACHINE(qdev_get_machine()); diff --git a/target/arm/helper.c b/target/arm/helper.c index 167f2909b3f..9e26edf4dd0 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -252,7 +252,7 @@ static void count_cpreg(gpointer key, gpointer value, g= pointer opaque) } } =20 -void init_cpreg_list(ARMCPU *cpu) +void arm_init_cpreg_list(ARMCPU *cpu) { /* * Initialise the cpreg_tuples[] array based on the cp_regs hash. --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229963; cv=none; d=zohomail.com; s=zohoarc; b=XJxWfTtf5QdZV3dPB+D111wvRovv3DJm00a/aus8eelZFNIXO3fqd7ULh2UfVY4P5GjrMHVcYJMi17jl9wqPfHiEHDhErTs8bmLohXxW87qAMWaWu2w+HGJnLdONq6MXjlprUhPxbKvU6aI8IoJJZQivMsmOo1jay8pqO2E6YOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229963; 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=90cDyXk36PbB+Z+4P2CZHLVT0KSWEWac6BpArMyrQdc=; b=iKziOl9Yapn4gmKmh2gHFeyl/GV2kU2s2sIRjiisUdNctHXp/Ng1zw31WkS0VIbS6EdyOO4/vXZbiIpukP/3Eb9gDOcjtov33dcm94HT7Xlicy+Yb4AIxIk2Qk2TTSaypv3Ik0rFzlca18mgflOJaZb05rG2e/Jzys7hjeFMNi4= 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 1761229962997342.51503281734415; Thu, 23 Oct 2025 07:32:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwML-0004Ij-0a; Thu, 23 Oct 2025 10:32:09 -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 1vBwLi-0003Ni-Hw for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:32 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLd-0001vk-BA for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:27 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3ee64bc6b90so760157f8f.0 for ; Thu, 23 Oct 2025 07:31:24 -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-429897e7622sm4293052f8f.8.2025.10.23.07.31.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229883; x=1761834683; 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=90cDyXk36PbB+Z+4P2CZHLVT0KSWEWac6BpArMyrQdc=; b=J3qGE6vso1Mufw2W9wXgbq2OdZ+0EPR3EGdgcMXtnSgaUismy/z42bZBmSoe1RXubu fxo0JYg/0ViYJ6IxU44W07Nr6UWPNV5LS7egc00RHzbxdIuIRkG4H+1hfBikXLn4BJr1 rjGHhLNLtlV5EruuZkEX1d9Ft4Rga07dB5htzEcQLn4TOn1NDrAbvDZdUEN2RfFrgveE n9iQQ6uBYXK83thNb40SAfu8SStK2tW9qL4XUlfFXpY5qnRyOaLA46jRXRryqzH1l9Kc pvQcHXc9KcfnPC0BV2WHp5QRzhIPBZIkIbRPQkgHj7iAmHey6aF9vXLFJCRCPqCvds/D IwJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229883; x=1761834683; 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=90cDyXk36PbB+Z+4P2CZHLVT0KSWEWac6BpArMyrQdc=; b=KmOWeZf01wR9sBcrsCf3eWgdqJN+vEGBl/XaPTdI1BrPlD05MKzItJA1bg8dkoRaEg frMTFLHgYyCnrbHta3k7CUgkk/db7iK6JIuaMWv3I88Ncja0dPgHmuuCFRTV1F3AqaLy DPjsit+Cctl9oSMF+PtU7npxjxOrzvX4jdIo24akzetXVkL0EUFcREwgbhoAaac5izXz 6odIBhEgBlmV5DQJZ0SSYZLr0dQBKPPxfxVXTkecPkrriDAEBPARNx0ppX68J++WMRrX UBGcBC6tbRzx974XUvPuVHnh2GeZwLTyGweTvQphmO6NqLzTLSLS0RfilGzejbKXKAkV Kjug== X-Gm-Message-State: AOJu0YwnLCCd6XL5MNVRAScoFOau+gYsDZ6+3zhxXsMZCG8nQPXULFHH 85FjdnueWi57paMu2fR1bT54HFBvFNgB2OOkZLjzXQH44oO0oBqrfn8WUm/uwXPRcFEN+7X6jZF uqSStQOA= X-Gm-Gg: ASbGncuRv/oYxtqK2Pu/pnFA71kyLqs8ye2qvyNbJW1bvq57vA5k0b9qPrrCZgjRHbq mQHK/P7geuOT3Kn0aQebQbFAxFFeYnQ0lx/VwNx1PR4Mzj/5GSugQAlfib4DskcGvtJYBgTPjs4 +KgSKth6357dNq6Zlt7SXF+vGT2bWyVUwCmcrEzgmOjPvAVOVGFuJeHq1XR0/j6/oVsDPI9o2Op PVJx2L4oUgFx9PSbkCHjU+TjNzK17kP6+XzFpEEpb+zAbl5f4LRd1xZFklh7T35br1prVz0p8/2 5McEIne/0xNqt1YUDuJGHwnT3CVWZPiIf2/Y8g8Hoi6W7GBKRpYlGREhzzdLxoBlWVbEQmCqG0i 3qC4aDsYxlVh48MC7wZz59rsKhJqJ5l3IxU6TaI1mlAVVovSHI4txVpULojBH/KVcD15LQ2Soyh KDklVthKWYd/FjRJwaCR5GNemeFDdWvCXjPuopSmOBhv5iufzHzEkV3Z5lW9r2 X-Google-Smtp-Source: AGHT+IF2G+Jn19LGPJz5WjlBCa38F/+cE4n9hNbGzw3H1Tq+BEsZ7L38cAByKTMZemuhe0i3/lWSHg== X-Received: by 2002:a05:6000:4606:b0:427:5ae:eb28 with SMTP id ffacd0b85a97d-42705aeeb32mr14720032f8f.30.1761229882956; Thu, 23 Oct 2025 07:31:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 26/58] target/arm: Better describe PMU depends on TCG or HVF Date: Thu, 23 Oct 2025 16:30:47 +0200 Message-ID: <20251023143051.11195-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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: 1761229968859158500 Simplify PMU logic by rewriting '!KVM' as 'TCG || HVF' (ignoring QTest, because vCPUs are not available there). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/cpu.c | 2 +- target/arm/machine.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index bfc031c70c1..5eaf950b969 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1975,7 +1975,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error= **errp) if (arm_feature(env, ARM_FEATURE_PMU)) { pmu_init(cpu); =20 - if (!kvm_enabled()) { + if (tcg_enabled() || hvf_enabled()) { arm_register_pre_el_change_hook(cpu, &pmu_pre_el_change, 0); arm_register_el_change_hook(cpu, &pmu_post_el_change, 0); } diff --git a/target/arm/machine.c b/target/arm/machine.c index 44a0cf844b0..80aa2e34b4b 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "qemu/error-report.h" -#include "system/kvm.h" +#include "system/hvf.h" #include "system/tcg.h" #include "kvm_arm.h" #include "internals.h" @@ -943,7 +943,7 @@ static int cpu_pre_save(void *opaque) { ARMCPU *cpu =3D opaque; =20 - if (!kvm_enabled()) { + if (tcg_enabled() || hvf_enabled()) { pmu_op_start(&cpu->env); } =20 @@ -978,7 +978,7 @@ static int cpu_post_save(void *opaque) { ARMCPU *cpu =3D opaque; =20 - if (!kvm_enabled()) { + if (tcg_enabled() || hvf_enabled()) { pmu_op_finish(&cpu->env); } =20 @@ -1011,7 +1011,7 @@ static int cpu_pre_load(void *opaque) */ env->irq_line_state =3D UINT32_MAX; =20 - if (!kvm_enabled()) { + if (tcg_enabled() || hvf_enabled()) { pmu_op_start(env); } =20 @@ -1103,7 +1103,7 @@ static int cpu_post_load(void *opaque, int version_id) } } =20 - if (!kvm_enabled()) { + if (tcg_enabled() || hvf_enabled()) { pmu_op_finish(env); } =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229944; cv=none; d=zohomail.com; s=zohoarc; b=lEi7SyMVP8GSeBdPAT1E/IYtw7s9TXaULzyHx2zonbBXX4Nf+DxLFdo9p4tzS3p1/CbBbfqqvgM4u1OTsv4aKEaCYHObI9VvVVHDpBMn352XrL1UzGBcrWOCA4qu7gh28Kv0PrpwZ8jsoavDLJkqpYhMRGeaN0saPxcW7LpBZfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229944; 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=iFhev+ViAFFSzJ1smEp5sPV4YLk7YFAUxT1dvo2z6os=; b=XV2mI1YDIRBmITBXIyVDa8EqQ54OCOHRqHY13qOx9jENtN5sd46WwBcvlJfR8P0TxTuBvsCZqqfip67H7cqtEXON0A6tOhmDo57ys3iylC9sDa32HpZPM9t2z2ZV/n36qL8tYaTs6eirCoB7Pj7ktJQdgvwou/D+W2fvp6zL/tU= 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 176122994460317.06853723982249; Thu, 23 Oct 2025 07:32:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwM6-0003kc-Ar; Thu, 23 Oct 2025 10:31:54 -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 1vBwLm-0003U8-K4 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:38 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLj-0001wa-UE for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:33 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-471191ac79dso9838385e9.3 for ; Thu, 23 Oct 2025 07:31:30 -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-475caea0468sm42531815e9.8.2025.10.23.07.31.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229888; x=1761834688; 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=iFhev+ViAFFSzJ1smEp5sPV4YLk7YFAUxT1dvo2z6os=; b=Vc8fux/DnvK2CVBEkrofYfoYRjPXrCUfrqGMvjTmjmfAFL36JL2k8EN6AMQy+qPSKJ 6Rcl0+vkfV+fJz/LAbD+bX9te78CgTvf7p/h4uMLlS9MpdmmhjOSkCO7IkcxqRwla3AF 7WCKrB/90TU6FJ9Q83VuRVAxCwukjaZXU3kFM2W3Cv9vAFbIkLCWY0x/BA+0J3koRKD8 jL+gX+8MvQF1cvGfB5xUgonhJpjmpg+d9HTx0DCIxCSVRhRCVD7GX5EwJ+oCCz8zXE/R fCsLry832hszI+HZIRkfDo6fB6H+qc4jC1rPZLY6gE3k2zuFXHNpgf3B292zQ9LsGlQj DCTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229888; x=1761834688; 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=iFhev+ViAFFSzJ1smEp5sPV4YLk7YFAUxT1dvo2z6os=; b=S+6ZUsReSUl37T5cEClgVpmZPrPhWriJE1GN88KsgwVp9/uBtIRn3IgVW1rnJ+CkZx ogEsJw0aVs8bjuHPvd88cs8E9gOJcQd+z0s+4NBvtE53j56mh8GD5RRysnTqheiz47Uk 9wOMgC/0HZJWK03a0YbabiDEWUJbAvpWuxgawQWE/73ryj4b0CMwbYplDkolB+t0aqmp Pho9s2SdJx0DBVmSj05hzs/JhBMM8Jo618kIGfF0dqBX/S7U6lxUk+bSVfzDJ6ZARiGt tCxZUn43PrtYf3mmBTV04XM7N/zlD7HCYjlhhT6tca1hEpPYQiAjNX53u+qvQz42T7Ko cmgA== X-Gm-Message-State: AOJu0Yyc+xcsKnhwnM38fjqGxl0DlfOk1CmuInaw3hXToYqDzmkkqL8i SOtL+38uJw4Hr00vvAoltdPN3jvLQOORvCAqG6R7zoZtoyJTcpHyDLvZc7k53E1vbVUllCtZT7j AZ1gliTs= X-Gm-Gg: ASbGncsA7na5adjbp0XnYaQhRPGCdfiZLUsOSyf63rb12p1Of3TqrqZPP8PkmFBSPRc PDfYXcK+U4ec5U3UccZ+iCrMcpAWC+4uzMVxHcKFk2c/cnn8I4WDFsvN1/6yEuasBon0FkRfCbk F5bmfEIGiakiWtOjQqMOxzHPIYylOYoAhGuhChQ75wKguiMSLQ+Cfogr1csUl7L1IMIE8LciT9Y EpzeFU0lvVn3DccnfRi3BiVbOlekG+S7RPo8wVLrs95URkQYx9iKn/YF23rgcJ249nG1wjcQ31M a6FoUwp5rYet1svRlw+iUhcyxxZvyo0aZJ+0g2h5Lyf0LKrG1RCPffheE5jx50ctF4IZC1PgyJr f0HjEkRq/jchhgfQLIXgM8TCyz0QVF4vRgv+uo4yBUL1EaQLf8o5Ynx/KXVuVeNC724BNeyqX4F 3roncj8Pqd8gWTMjEPJmhbJhV/qFKRRS1b81NZAP0tcErzTN0JmqMWaEYcDqF5 X-Google-Smtp-Source: AGHT+IHLCbPhLK0OETPXNsA0ERP9FAWdgE/yyVv0Ft8DsIb6D6FvGIBsUSqzKt1hfp9wAe9yAHmt0w== X-Received: by 2002:a05:600c:871a:b0:46e:4882:94c7 with SMTP id 5b1f17b1804b1-471179177camr197047985e9.28.1761229887851; Thu, 23 Oct 2025 07:31:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 27/58] target/arm/hvf: Rename 'vgic' -> 'emu_reginfo' in trace events Date: Thu, 23 Oct 2025 16:30:48 +0200 Message-ID: <20251023143051.11195-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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: 1761229946678158500 In order to extend the trace events to other registers, rename and pass the register group as argument. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 14 ++++++++------ target/arm/hvf/trace-events | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index c882f4c89cf..26bafee259e 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1149,7 +1149,8 @@ static uint32_t hvf_reg2cp_reg(uint32_t reg) (reg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK); } =20 -static bool hvf_sysreg_read_cp(CPUState *cpu, uint32_t reg, uint64_t *val) +static bool hvf_sysreg_read_cp(CPUState *cpu, const char *cpname, + uint32_t reg, uint64_t *val) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; @@ -1172,7 +1173,7 @@ static bool hvf_sysreg_read_cp(CPUState *cpu, uint32_= t reg, uint64_t *val) } else { *val =3D raw_read(env, ri); } - trace_hvf_vgic_read(ri->name, *val); + trace_hvf_emu_reginfo_read(cpname, ri->name, *val); return true; } =20 @@ -1261,7 +1262,7 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t re= g, uint64_t *val) case SYSREG_ICC_SRE_EL1: case SYSREG_ICC_CTLR_EL1: /* Call the TCG sysreg handler. This is only safe for GICv3 regs. = */ - if (hvf_sysreg_read_cp(cpu, reg, val)) { + if (hvf_sysreg_read_cp(cpu, "GICv3", reg, val)) { return 0; } break; @@ -1432,7 +1433,8 @@ static void pmswinc_write(CPUARMState *env, uint64_t = value) } } =20 -static bool hvf_sysreg_write_cp(CPUState *cpu, uint32_t reg, uint64_t val) +static bool hvf_sysreg_write_cp(CPUState *cpu, const char *cpname, + uint32_t reg, uint64_t val) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; @@ -1455,7 +1457,7 @@ static bool hvf_sysreg_write_cp(CPUState *cpu, uint32= _t reg, uint64_t val) raw_write(env, ri, val); } =20 - trace_hvf_vgic_write(ri->name, val); + trace_hvf_emu_reginfo_write(cpname, ri->name, val); return true; } =20 @@ -1581,7 +1583,7 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t r= eg, uint64_t val) case SYSREG_ICC_SGI1R_EL1: case SYSREG_ICC_SRE_EL1: /* Call the TCG sysreg handler. This is only safe for GICv3 regs. = */ - if (hvf_sysreg_write_cp(cpu, reg, val)) { + if (hvf_sysreg_write_cp(cpu, "GICv3", reg, val)) { return 0; } break; diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events index 538af6e0707..29387780e3f 100644 --- a/target/arm/hvf/trace-events +++ b/target/arm/hvf/trace-events @@ -9,7 +9,7 @@ hvf_unknown_hvc(uint64_t pc, uint64_t x0) "pc=3D0x%"PRIx64"= unknown HVC! 0x%016"PR hvf_unknown_smc(uint64_t x0) "unknown SMC! 0x%016"PRIx64 hvf_exit(uint64_t syndrome, uint32_t ec, uint64_t pc) "exit: 0x%"PRIx64" [= ec=3D0x%x pc=3D0x%"PRIx64"]" hvf_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t= cpuid) "PSCI Call x0=3D0x%016"PRIx64" x1=3D0x%016"PRIx64" x2=3D0x%016"PRIx= 64" x3=3D0x%016"PRIx64" cpuid=3D0x%x" -hvf_vgic_write(const char *name, uint64_t val) "vgic write to %s [val=3D0x= %016"PRIx64"]" -hvf_vgic_read(const char *name, uint64_t val) "vgic read from %s [val=3D0x= %016"PRIx64"]" +hvf_emu_reginfo_write(const char *cpname, const char *regname, uint64_t va= l) "[%s] write to %s [val=3D0x%016"PRIx64"]" +hvf_emu_reginfo_read(const char *cpname, const char *regname, uint64_t val= ) "[%s] read from %s [val=3D0x%016"PRIx64"]" hvf_illegal_guest_state(void) "HV_ILLEGAL_GUEST_STATE" hvf_kick_vcpu_thread(unsigned cpuidx, bool stop) "cpu:%u stop:%u" --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761230003; cv=none; d=zohomail.com; s=zohoarc; b=eNeT1wJNzClTJP1SJNrgHuZcvtA0b2UEMeaPtHyrnHoQY4/UZB9/gFoSJGzQgaEPGlcf0b1rtiMJEpToO1cDubOUdWw5wI2B4aCHq/VQNM669BVEfiuZsPpKlUTy0C+N4NeXJ8mApuJWPopDnwT2gxfeHWMrT3BBM79d/9xu9Qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761230003; 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=uJPhtmNHwD4RyfSudQB2lB4+tgVTD2bBz5E4KUs98F4=; b=Uer2qRkckjj3LsGZrg9Md87q8BdExBQnh6WerNzgomSkqhmzoUpxS2bYEFhKjSw13poyiKFy6GyWaz/pKwE9SYpx76V/3GL4FMRN99InzaRBUL4CPnBkYMrnXfezIJUpu+x/k6S58z3QEvxOqiBYnzqDBYLQENhLQheS+0aJHCg= 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 176123000315663.997268954034894; Thu, 23 Oct 2025 07:33:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwMO-0004Wq-18; Thu, 23 Oct 2025 10:32:12 -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 1vBwLp-0003V8-Db for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:40 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLn-0001xY-Ce for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:36 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4710665e7deso4590435e9.1 for ; Thu, 23 Oct 2025 07:31:34 -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-475c4369b33sm99643335e9.14.2025.10.23.07.31.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229893; x=1761834693; 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=uJPhtmNHwD4RyfSudQB2lB4+tgVTD2bBz5E4KUs98F4=; b=vhgwCS5kRVWfvpD2WCxrp9a9+z7CxkNFj3z9jDKiKxuAkbDJN5tsGjFfM0NIGdX5t6 6tlL5lpWstMJ6ki1yFMFPrDXsiVjZjAwDGlyQW609O2XDjtDrI+ifcTvaDGkJevj8LR2 x9K32ZtfG2a4o+0MXa5v4HjZ3qNDWalUPwco44s+ZW5cNHSfIxWllZz8J6d2R5MEUR0i HxFYyN80jm3cCc9GGAsT4BWvk9JQRaZAACLtxXaYuo9G92ofrboqod0OGj0lSX/ZTSiG 8CTHC4jS7fmhK6yii3Llji9rV6xEYXizXKmbnwVDU7DqkI+7BDvgNo4uWLB4McD1lZCh zGtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229893; x=1761834693; 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=uJPhtmNHwD4RyfSudQB2lB4+tgVTD2bBz5E4KUs98F4=; b=Lz/ANlTgqYTX5Iy6yupGrbvpzt8dU0Y5SlHhZUvYu7JMJdLY8kzbTkQwvJ9KQMn/Sp zR5EYvODhGoWNE7y00AkKE6hSE9sAsEyqvruNIxYylw0FCwwrEwjjuR6SmuYGDpSKlVq YxBGwHsZeSeZAL0WLfZKtzQFLvZic7T7mnHuvE8jhfrpiIoRAwRKyGc31YxG/a9dEa4G MxcGrEptxPH4LojAs5UMOJk12fwB7ZKv05g1LedmXGcX5HjP2SGmc/lIpFIguygsx/OI BWHTBo5pEedpQz5pzM8VPnrJZ40eVEryPkdjqqjN3B9Vt2KzP9fyi0DcrVuAnhzHyK6O AGxw== X-Gm-Message-State: AOJu0YzBcXqhQAEhUv5tK15vpz3xt+spYBIvRa0ICfwvsYIs72pZGDbj VoBfu42v7PagNDOobr3E+dnDHv8a1EvScH5egF+dk75HqVjk/OtAQHAp1lDI/V8LEo/pFcn7jAo pedz/BSs= X-Gm-Gg: ASbGncsxn+V0h7dIqKuAQyryV7IORtTl7XFGn97SH1xbJuNpnnPOZVmWYHxyXgoIXpe VMyFSO6X7olzYA7vAAZC87aLgankKV76KiRAm50mFL+k/LZvoIRQaDiMiU5XeR3VjF5KSKPqaox 28BcftiwxHZBqwZ06Zooa2wdcG15/eF9vaRoXvjScvNhkuneBlrJhkLYc1D+q8v2tZXE68EwShD GKlqIepnpvi3cUY/gw7D30KeGMGCHjUk30J53o0EjFHCzTKq8RVmq4cWYY2eKEfMRqZYMw82QjH 3ari96S6c2NzAqLGAMQXbQ3NyhCNmJcR344P+IN9dCdlTWUKq5O0+WE384IT2/gaRiLGchoDXuo +2SHCsG7I1aqEhACd2clDWyrZy4cXylYIVfCSShBCyA8aq/XmUYiTX1vovIY9U42wBxN0KDHbGd ZQwoKQxFxN5NLiyoRPJs2SbA8RzlcFJIC0io2eEPwNbg26oR9thl/FcOu8WFk+ X-Google-Smtp-Source: AGHT+IGTLm24JLDGYoibU7m+mWfY+5u1JheArmeOiHx2uyp7Ijs4kwHqOpR+EEUQxFTEbrfFp4iQ4Q== X-Received: by 2002:a05:600c:4695:b0:46e:32dd:1b1a with SMTP id 5b1f17b1804b1-475caf92922mr19038425e9.7.1761229892652; Thu, 23 Oct 2025 07:31:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 28/58] target/arm/hvf: Emulate PMU registers Date: Thu, 23 Oct 2025 16:30:49 +0200 Message-ID: <20251023143051.11195-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1761230005505154101 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- TODO: audit it is safe --- target/arm/hvf/hvf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 26bafee259e..4fc92760934 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1214,6 +1214,10 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t r= eg, uint64_t *val) *val =3D env->cp15.c9_pmcnten; return 0; case SYSREG_PMUSERENR_EL0: + /* Call the TCG sysreg handler. This is only safe for PMU regs= . */ + if (hvf_sysreg_read_cp(cpu, "PMU", reg, val)) { + return 0; + } *val =3D env->cp15.c9_pmuserenr; return 0; case SYSREG_PMCEID0_EL0: @@ -1505,6 +1509,10 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t = reg, uint64_t val) pmu_op_finish(env); return 0; case SYSREG_PMUSERENR_EL0: + /* Call the TCG sysreg handler. This is only safe for PMU regs= . */ + if (hvf_sysreg_write_cp(cpu, "PMU", reg, val)) { + return 0; + } env->cp15.c9_pmuserenr =3D val & 0xf; return 0; case SYSREG_PMCNTENSET_EL0: --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761229985; cv=none; d=zohomail.com; s=zohoarc; b=irjypJjTB3pj+rwvq0Qvq3L0ezE7T+Mb9uVPDGTPkasR6s7DkpUfSGQqS0wsweBvHfQvpQmBAw23ATsdz7z9MiF7zn2XZgNdglLmjj1Ctnx9AF+dvuZM/J1oHTLdw//LCT/cxzI/NcMAjeOA8SYwh4hBeFSMMrz+/NgvF/htOmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761229985; 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=Y25iYUJ6/iyXKTCTBsNk+6avJFehWayKoJUbzLs9o+M=; b=YIH86+6CpdumFqSFbHvj3oUB5yRC5dD/Ef7Xfe+qMneKphMR5DKg5tDMsaKROusMKh1S6J+h1jtcbcHhIfh6Y+I1cUZESG8Z/LIk8G4Ed+crMY61GwtjTsOjyrvHraY8c40R5qB6pVA4wy7PYErsaSC/qJLX8iJrrqKI8FVTRwU= 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 1761229985328698.6339872783383; Thu, 23 Oct 2025 07:33:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBwMM-0004Jl-3N; Thu, 23 Oct 2025 10:32:10 -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 1vBwLu-0003XJ-PL for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:47 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBwLs-0001yN-IS for qemu-devel@nongnu.org; Thu, 23 Oct 2025 10:31:42 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-427084a641aso655962f8f.1 for ; Thu, 23 Oct 2025 07:31:39 -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-429897f5696sm4542822f8f.14.2025.10.23.07.31.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 07:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761229898; x=1761834698; 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=Y25iYUJ6/iyXKTCTBsNk+6avJFehWayKoJUbzLs9o+M=; b=EfWX83uJquqDhJRr5SrQO47izZ76X5ek5wspiMBZxnQnv/y77MfRbKSPvTFmscUcTo qR6ANg5d8/MMYukMed9OBf/D4vN+Z7fDX+mujDimlanWoOaHeW+9Y5fZaldVAgIGFUXQ 604o25xKUn1WfREIfjZ0nZ3d3Gbm5atOwiwxMM6IDNAQkurb+RjSCbLom4XrZHWYb/d6 nGeZLwEMUqrSTh83mmbzi2C13yPa+VENZe9HkhkQFyOWiziR2USUxLZSdhM06vuxaQdC mU+dCssqGN21/ODdNi0QN/1Tu1nNb1ShSLKh0QWxYcCCTS5Nc5R2KlCPefAb+vATk81a kd7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761229898; x=1761834698; 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=Y25iYUJ6/iyXKTCTBsNk+6avJFehWayKoJUbzLs9o+M=; b=fG1SYfE10cSzObhKOfQFUA2A9zcmrb5kerQkcBB5SpqZ3WhDnWWiONIP8fsJ59cXZB oejwe/m+3osBjKNR9xm9yMTmvWQy6Ur1BoW4V5ptz5q8sCGHYyeHBlzeX1lCZxwRG4Dr t+dJVD5KLIVJBqHfMSO1TM4z1ud9NTB058mqsp5Nr+JuJMClGJAAi1dVybMCgPywxAwX ZBZLdH3oHZmV+RwAyhJY+DaRyPksgcOvn9qi80QU9M+EDE5q7UVIQbjlgDyBjubA1c5z e093B7wnn7KQ3Zx8ULHAkZv1MhFJDOrA8HTZwXT6ZEXeNYz6az9SfDMqfyZS6J9Q/0Ud 8gKg== X-Gm-Message-State: AOJu0YzjMI9PDE1sCC5Y0RzJw8OS3GbX60+vnZIN3gc15K8cTTZSHmjo D/GnCAnls2cj9NO06O/M6qjyQYhTi/Ry01+PqZustZHXJjbuD5CpWuNI2bgA1wLE7jDGuGNW2N8 UpBrBiIY= X-Gm-Gg: ASbGncvtd+gMs2BlD+WmxNe+t+OOyq4ovIFtL/Stxh7ToMzIkD2k+XiEY+SQVdIqsrF F1364WfxBXfJTgCZf2RI+SPtra4NQOhZIXOaIIdzj3AcIBN8HggqXqsmuzHByk4ZisDx/O7dbvr xND0hgA3atrNPCrYaRd5KAFDg1efaAvUrOtqCGZNdCvXLV76jQXA2b0zNBAaSzaotRy70uTX65e QoVIIydr+7xXcnSaygUU/njecqUkv5fZJNPEzqUbG6YvJTvAK2un0KLWq6sutMT4TNxuYHpdq/Y tW7oVFXxlgJs9UNVYrF3O2Cqps50z9EU1Y3dia+PrXQUqx8RKjCIP7xF68gbtp2Pni3Os/4OZ5Q qKjUpaJj0x4G8KS+td+TFvE3mpMrHRBEFTgtQLZkATOzvaU9+q1pq1wDwtW/LBMzjIFAL0Hv8b4 4imjLF0wFi6pTSpVntdE4X2tMJbPzbZOBgZca9LoA4ZWGb+9Wnbk1Yhh2+SgdL X-Google-Smtp-Source: AGHT+IEqqBDXThZqURPuuI0fB68PXXmmwPJNSvl6KtIlYTuzwmIFWn7M+haWwaLGYiiJZsnpUFFlmQ== X-Received: by 2002:a05:6000:4285:b0:3ea:80ec:855d with SMTP id ffacd0b85a97d-42704d6c57amr16021787f8f.19.1761229897491; Thu, 23 Oct 2025 07:31:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mads Ynddal , Alexander Graf , Stefan Hajnoczi , Richard Henderson , Phil Dennis-Jordan , qemu-arm@nongnu.org, Peter Maydell , Roman Bolshakov , Peter Collingbourne , Paolo Bonzini , Mohamed Mediouni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani Subject: [PATCH v2 29/58] target/arm/hvf: Emulate Monitor Debug registers Date: Thu, 23 Oct 2025 16:30:50 +0200 Message-ID: <20251023143051.11195-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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: 1761229987298154101 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- TODO: audit it is safe --- target/arm/hvf/hvf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 4fc92760934..67130ce27d2 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1596,6 +1596,9 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t r= eg, uint64_t val) } break; case SYSREG_MDSCR_EL1: + if (hvf_sysreg_write_cp(cpu, "Monitor Debug", reg, val)) { + return 0; + } env->cp15.mdscr_el1 =3D val; return 0; case SYSREG_DBGBVR0_EL1: --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220420; cv=none; d=zohomail.com; s=zohoarc; b=ceuGqY6P7K6+QS0gWTR8fI9SnaZWStkPX06/2lkav8JeBDaZCi7cimK+94K/pfMigWjFnjRUOXycK0NouO3iIY5sFWe9nsSdazHXCmZm4m33sgtH+B9A3AA+cANxMN9DdnrOmkGFfMQoLVusMNE9MPgUZkWhQYpxCNNdMPrn8r4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220420; 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=tcuUhmYfuiOMUA6fkhcSZ2utpWByLaxsadmUM1Ytmjw=; b=HFjT9VRIvkgwff/PyF0XX06Tnkky63UOy7P/1epyfH/P9J4F5H+K8f8dj4Fs2Z+Zn/TPDjjS20XbY9IEpUEZ74eKg+8mHVU/3Pc93dWt680YwOHUFhODEZjRr7Z8KhVgPbKk0x71O7NFXGXk3IpPB8o9PCe64NGt29RFjfyYmhA= 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 176122042015598.65695089503754; Thu, 23 Oct 2025 04:53:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtse-0005TJ-SQ; Thu, 23 Oct 2025 07:53:21 -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 1vBtsc-0005N7-Ny for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:18 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtsa-0002aE-KU for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:18 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4711b95226dso7941005e9.0 for ; Thu, 23 Oct 2025 04:53:16 -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-47496bf7137sm59345735e9.3.2025.10.23.04.53.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220393; x=1761825193; 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=tcuUhmYfuiOMUA6fkhcSZ2utpWByLaxsadmUM1Ytmjw=; b=mIrZO1EkK5++0T97kde2qev8sr0mJL7l/rD3l25HsbHbyh06myu9CSzjLkYNk37wAA ei14u73yR16DCLqq9IRrvVdyyc507CUMVNWHfhOnbQVmGDQULhmI5jMoHU46HWPwN//E oEfjjTP3RYNZmHO80Gth07a1Z6xrD/2EBSp3CRBTSnlLF70FdBC9Is+fQidQn2kdcQSb D/zPhANoENlUh3axUcAFYTJ2ncz6DViQ2+rFztiJb+1H+h0Ol2rSku2OBODYMO0HlVUf hl4dDlvYdJm7wutBZQNYbD1VFhGSnExVVai3r2jda655aNzi/DSwirtF49Sa54pQXkal 7r8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220393; x=1761825193; 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=tcuUhmYfuiOMUA6fkhcSZ2utpWByLaxsadmUM1Ytmjw=; b=XfcTKXfDFPqON+VL/U2R0h4MQlGwKIuEoalQAX+dZY63LARcdUArWkFP8Iah0SqizZ C5tqmzcXfnfRCHfQh34EWUtayZJYxH8BrAs8OCkcJGkIkF1A7VxwfIVJUHwSUO9IBv5w 2hsIqElFsF/oxcZdiJr9Lt/nr3SRG8vEKk852VMq6uKsXQUF4jnfg/aHxNKvG7WoHK9C 1QkZv8E/Tq8P/EpSKwOhC6aX6Rd65zPLMip30fBpZG1bYIce/ZOWsCLr4HfRWhO56yRi T4yR8IfZXMi4+A4zzb/Hzt63tkKQdqrPtow1Clhtgh6Z+SB9uR4mD7nAyuIAqNcY7Nrj VjyQ== X-Gm-Message-State: AOJu0YxnjQrCYO/zLeQyG26OHpZtC2LCHxK42XGUEmnfmlt8YF2IvDHL j3SeKVNelNP/iI5rrlqp0f6cnURfLLavF7+D2bk+FShTCIcbJ5508AeT2pA+V1NKsX3EkZZzp02 vTtWWj8Y= X-Gm-Gg: ASbGncsS2VtfmSrx1fk9e6qdblek9b4Gcdda30iFVn8TN6Czse06KRbotIrwQWuSOdC Sr/v8WLp6aATr0H8eT8lyQO5royWghn83OGohvnXJG2B+Gral8aoKjyEIRLjECb6qyBAL87hmKt 1CLGTFzbPSybsatKDiwwplI9omz0qYk5YCwWALQDNtL5f099QooSlZMkW7v8WuKcDMx1fJpKlKn wqWnU/Ka9w7K4kYmwuvWUYwZIPal/WmXd8KHMWAq2zAGvRnQOJWVDUHQRwlgvx76KT15m9Y8fAo sP6+lBo+75eaISxqVHmxuGRj88I+B/EhWYV3J1Jsc3UU3PT2mL8NXiGfmoy9+DgkVWp7ROti/9F vtKXKgaEXOGIpQBlP54akxe4RZ8kGUPdy6vAdLL04uy2tUTerKd7trnLfcwn3zE9u3PeIbmWWyX VztdR+ZcQzV9v4Ital/YpU/QaPrjiSAJKZjnH5TXY04Y4OcZ1SGQ== X-Google-Smtp-Source: AGHT+IEXZEZsRuDE4uGNeWOqPatKxg3anrumOc/RC6nTgP06JMi9bVb0uqT8L9tZDj0jRZA34AMf8A== X-Received: by 2002:a05:600c:3b8d:b0:45d:f81d:eae7 with SMTP id 5b1f17b1804b1-471179176b9mr206081475e9.28.1761220393079; Thu, 23 Oct 2025 04:53:13 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 30/58] target/arm: Re-use arm_is_psci_call() in HVF Date: Thu, 23 Oct 2025 13:52:41 +0200 Message-ID: <20251023115311.6944-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: 1761220421824154100 Re-use arm_is_psci_call() instead of open-coding it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 67130ce27d2..e913662dee5 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1945,7 +1945,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) break; case EC_AA64_HVC: cpu_synchronize_state(cpu); - if (arm_cpu->psci_conduit =3D=3D QEMU_PSCI_CONDUIT_HVC) { + if (arm_is_psci_call(arm_cpu, EXCP_HVC)) { if (!hvf_handle_psci_call(cpu)) { trace_hvf_unknown_hvc(env->pc, env->xregs[0]); /* SMCCC 1.3 section 5.2 says every unknown SMCCC call ret= urns -1 */ @@ -1958,7 +1958,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) break; case EC_AA64_SMC: cpu_synchronize_state(cpu); - if (arm_cpu->psci_conduit =3D=3D QEMU_PSCI_CONDUIT_SMC) { + if (arm_is_psci_call(arm_cpu, EXCP_SMC)) { advance_pc =3D true; =20 if (!hvf_handle_psci_call(cpu)) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220422; cv=none; d=zohomail.com; s=zohoarc; b=iUq3gPZx7ArCXWb9eKqppCNnKaxeFuRlRSSYU5Py8bq9ZbDwGB6FfKjrEZumpbn97rh6+9msIUorf0dHiB3ebzP3qq8AP2spvxmxkbz2FRgZ7QqVaGaQ/dUh8pKU2bRMcSa4j8lRCkl5sxNlorixWy4za7WFZwSGAhjO55C2yVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220422; 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=6mwK2RlutoiLQus/3WuL3gr35HC8KpbSN1PagABh+6k=; b=nDyeVgIeFqlnbYEF+fQfAafvQHln0J9lmy0QcBBIn6CtijAzk9HQYIia2E+lgHLHqmgp1RA1a6P31LDcaKbzXd/qNaWTCmpCLLxfxWQEK4G3wtmAtpcKYtup8/xaQkzWQaC+Yib3aQwt32LuklC1aO6RV4cOEBD1XBUmJ/NN/Rs= 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 1761220422124516.183310075752; Thu, 23 Oct 2025 04:53:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtsi-0005ZR-Ez; Thu, 23 Oct 2025 07:53:24 -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 1vBtsg-0005We-BJ for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:22 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtse-0002au-5f for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:22 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-47114a40161so7109255e9.3 for ; Thu, 23 Oct 2025 04:53:19 -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-475cae9f8eesm33677065e9.6.2025.10.23.04.53.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220398; x=1761825198; 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=6mwK2RlutoiLQus/3WuL3gr35HC8KpbSN1PagABh+6k=; b=aFmJUZnrxAcJx1GFlaLBpMh7fOeZmWLWNOuNSKKQmt6H8sp08qkeiDk7q65eQbRdGm 3MX6ybSrJ8IJZvNGVBN5E+sm4jCVtJ2zip6GpniFfpsAHfGBSKjRMB3eFnRrr/pf1epY CuM17mrR0XGwyZjQrRMirnKkIlp1XzN86wCMAOQZdtpS0j2ZYpqqiRMeAv9vcND9ajNS vTE+Pe8G9guo9/H3E3GRkucDOd6UMky7nkA4zycS5kr7LFWbcOv02zvnR9JUK+CBkkoE d5sAnIp/iCfd4BiV6V+wBqdNgdmNGcCWGihYiAGqbKCac+sNELDXfD3NQplHWlQaHKeL EbhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220398; x=1761825198; 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=6mwK2RlutoiLQus/3WuL3gr35HC8KpbSN1PagABh+6k=; b=vzrdlAHkbHmJPpUT0IM8XKWJOqNmCG0vDVqE0h9Tv13NvwsQwNoEOUaNRaMgc1gUF+ qnRjwKjxp0H/qu09gTW4x2xxGjtLdAp1+GVUPupzy2zfhGRjsDOae12UTcns749okE5E 82NVhKCjeMBMf+SLua8N2Nd/rnhnnuVQJE3zydn+xwa/Ow3yxckqeO5VVP1cZAXAv/FO ZggHJgmG8gKmtXn/8ii4dJJYzKSOGWKDSskSWTs1tSRHsmXPRVM58nDeoThmv9lNxwOf x/HDyB/RVV5jE9yP/37qQhEAg3wTE9GL0AGSSCh2vApGNLASvMz0DXanQkS6kIOu6Vo2 PDpg== X-Gm-Message-State: AOJu0Yz35x/UtKPGc9mI3S/pGaskyNpQVBEe67GoY65ztZhZ0wnd39Km oSjji3XHpMEm9x49jmv89r1USyqPn8nxhUtHinqOrGTh5QQA3irWk3vh312sjQCuPnN0TT9ws0t YPmcLnHI= X-Gm-Gg: ASbGncvk9q7GOGLHKjFhuYXgSJL/eXpW2QwXc2zXvnKEkMG86Ge+r48lKoIeAcK/EIK 31+6lfwtX4GXe5D3OXcCYPhqr3mSsYNu1jWbrE6mYlRmBel2g/iTpIP2wPigZpuLrmaFmdOBbqT hENRVvu0WBS882MWA3VpTabo/KDJslB3/LMLCNs6I90qbs9mmeIPAnUvexI/hIoD4SnTDHLyaqd CD2WYN1QmdbQ+zma85uXEu6mwzf0WiObO3paVphN4DT8wwBXJJYoiY7ZbyoBJr43qfQboerXp/y cuCeAFPq6dTqC4d7rFmBihL/ERZCaof6xABFLjpTRsFa4JFub62j4tTxVX1gK6XQXHIRBl1o23s Akj0qGWG2Ld9Ge14eS6XZvae7nDYZvX2ZzgaAMIGnQjQ4gUUBWf2yuQH14lUQz4+AoSx+3ir6T5 sK3IQXGfxDW1oBrNhvTH/DBLBky9krLfF2QMnQJsjEmPSzbAkveA== X-Google-Smtp-Source: AGHT+IGgTMOb7rRfRfNIvaiZD6PMMPXFIlJTXRaDnyMGNRwIfiJFMZdPBdvgOqIqdf+1SU/C+yjxRw== X-Received: by 2002:a05:600c:6085:b0:471:133c:4b9a with SMTP id 5b1f17b1804b1-4711786c79emr206187585e9.6.1761220398051; Thu, 23 Oct 2025 04:53:18 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 31/58] target/arm: Share ARM_PSCI_CALL trace event between TCG and HVF Date: Thu, 23 Oct 2025 13:52:42 +0200 Message-ID: <20251023115311.6944-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1761220424835158500 It is useful to compare PSCI calls of the same guest running under TCG or HVF. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 3 ++- target/arm/tcg/psci.c | 3 +++ target/arm/trace-events | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index e913662dee5..b5fdd86837e 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -34,6 +34,7 @@ #include "target/arm/internals.h" #include "target/arm/multiprocessing.h" #include "target/arm/gtimer.h" +#include "target/arm/trace.h" #include "trace.h" #include "migration/vmstate.h" =20 @@ -1025,7 +1026,7 @@ static bool hvf_handle_psci_call(CPUState *cpu) int target_el =3D 1; int32_t ret =3D 0; =20 - trace_hvf_psci_call(param[0], param[1], param[2], param[3], + trace_arm_psci_call(param[0], param[1], param[2], param[3], arm_cpu_mp_affinity(arm_cpu)); =20 switch (param[0]) { diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c index cabed43e8a8..2d409301578 100644 --- a/target/arm/tcg/psci.c +++ b/target/arm/tcg/psci.c @@ -25,6 +25,7 @@ #include "internals.h" #include "arm-powerctl.h" #include "target/arm/multiprocessing.h" +#include "target/arm/trace.h" =20 bool arm_is_psci_call(ARMCPU *cpu, int excp_type) { @@ -79,6 +80,8 @@ void arm_handle_psci_call(ARMCPU *cpu) */ param[i] =3D is_a64(env) ? env->xregs[i] : env->regs[i]; } + trace_arm_psci_call(param[0], param[1], param[2], param[3], + arm_cpu_mp_affinity(cpu)); =20 if ((param[0] & QEMU_PSCI_0_2_64BIT) && !is_a64(env)) { ret =3D QEMU_PSCI_RET_NOT_SUPPORTED; diff --git a/target/arm/trace-events b/target/arm/trace-events index 72a2c7d0969..676d29fe516 100644 --- a/target/arm/trace-events +++ b/target/arm/trace-events @@ -23,3 +23,6 @@ arm_powerctl_set_cpu_on(uint64_t mp_aff, unsigned target_= el, const char *mode, u arm_powerctl_set_cpu_on_and_reset(uint64_t mp_aff) "cpu %" PRIu64 arm_powerctl_set_cpu_off(uint64_t mp_aff) "cpu %" PRIu64 arm_powerctl_reset_cpu(uint64_t mp_aff) "cpu %" PRIu64 + +# tcg/psci.c and hvf/hvf.c +arm_psci_call(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, uint32_t= cpuid) "PSCI Call x0=3D0x%016"PRIx64" x1=3D0x%016"PRIx64" x2=3D0x%016"PRIx= 64" x3=3D0x%016"PRIx64" cpuid=3D0x%x" --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220446; cv=none; d=zohomail.com; s=zohoarc; b=lpJwIcSpLgD/8b1W1v4PA6BoxQM55vXWhUQo3l6BTuwFwtfOJE333CeOvdNWJpjJJDJMR4uEeC4FlrBzk8MEpBNPsJfQVBzLw8Q91qIt3toSx95XCR4NhCQgtJkegZ01nXVLOdR1Vq2UiD2a3gjSK8GMuA2uA6AShZIhKvkOCp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220446; 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=ey61OrLvwLgnrKRgCqt5Z0UyJzU3RSf7zDcJOKSwrWY=; b=XQBuDskinLZiYNgkRDTD/ddqkBByuuypTLALZ3my1Cn0is1O2IThKYZQVzGJCjtFczzKroHnq61U9tvSFj8r9974GWuHLzW1vIeNhG/mqefjuZ/iS5A+Lc1u09hWn5JG4L8CabzJO3N6Q1CoIUwiRiOblSedXBQ8NRGf+hOvmAk= 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 1761220446747425.99421901429537; Thu, 23 Oct 2025 04:54:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtsm-0005cJ-SB; Thu, 23 Oct 2025 07:53:28 -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 1vBtsl-0005bb-4z for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:27 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtsj-0002be-EL for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:26 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-427091cd4fdso451253f8f.1 for ; Thu, 23 Oct 2025 04:53:24 -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-429897e77dasm3714229f8f.2.2025.10.23.04.53.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220403; x=1761825203; 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=ey61OrLvwLgnrKRgCqt5Z0UyJzU3RSf7zDcJOKSwrWY=; b=HizzWmxyd8zVg1kBGL7aF3Udm5DJ2VOKPVC5hDdQu+N5rp/gaedVxBeZtQSR7DXwG4 4rt7qZ2cEzICskbkVOP4JaY3shtW27R2UScmQcQjMJgr1yxewpLUIGD34KCEZDxpIOq6 LqmaRzRb5e6ftN+DgPJSLhT+OL03JFof934N6uRKkiPUpQTzC1HWDZY0SXrf0xr6YhoZ Fgzeow0HsWB1q3yREMpUtSzz8/4HuHgzwgrE0dJE5CeS3mHwS/iL6UMyIOuQI8SDM1D3 I4NYf0GLYKYig2A698ohKQG4zEV1e8r9toUHrGXJ6uUvaMxiUM4KkE/IEiAo0LYDQRcX XgTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220403; x=1761825203; 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=ey61OrLvwLgnrKRgCqt5Z0UyJzU3RSf7zDcJOKSwrWY=; b=jIbTBC12LUuCV2y1NKCKEevI5GwmLn8glPY01I5euw5USy41N9LT8TIhHh1pElJq9M 7pmrfPy4Nv/reiikdW3u8lrXQQSscE9JABE/KUlwAW8lJW6P1LMHFpzbHClHB/PZMppm 7Itz71CRyk049s5RFL0iPiFeU4vi8tFQegCC5zgYRoyY5CtrflUNG1A4KTlc6+f0qiZK XD6UA7BDM6QCLsukSU0w24wCjzMIayR9b23QUPfaPmnGzBiRvI58jgI66MTNAzUEm/ky 0gtNxrymvr02ITSEdnZhhWkheBF/c8xWQjccueKen3q09g6vnXvej7LQvb3HVLpyz4lG d4Kg== X-Gm-Message-State: AOJu0Yw18o6UIIjVO3ZbOjq8cIeYRxwLAOKT0XU+pN1R+6av8HQYmHBe AJseLm10vFSNKyV00f0JrpvcZVcuy8s5+6ZDzCN7FJ6ttgSp721eXUtB76IeUQyLrlj1EK6Qwnf maCyqjkY= X-Gm-Gg: ASbGncvdjMaZbuqQeDsbYaMuAzEBvWRXXMjRhPhbGB+8/LgXr3iwp3cYcSUpHMTv4NL DGK/lWObe5ivFnrDwGiDU2TSDeqmsoMGSYP00qgQaUpJv+ImlhmHOil/hcjJTXV8w7iTupv2U6z 8pxE2zbcKu5L+j8Rer4Kln+TiqVboXxvVWV5HR3e01jMnuDIuc2KqIWHp+TyGOqvSVfg6wFgJ1u 5hfu0oyYW5Jy4jIT1LFRZZEAFkGCJQbu1yOPou/1fc3QkYR2k7ifyYTkKCl6OMhth80D9Jl4mSy fLWWFelJaqVntIeWuhESwJh+O+0xmwdjBrJ6daNgK0+BrxkB3rHDCribvFRSPPbUu2FmQxQTxZI nAEHAPVKa8GmVAGEPHrLVxsoyEYZCP1OdntB84vMRPwqdye9HE5KH0fKhQAu1e2nC1YW3dC+3yb rbChUVHhR3g+Fdjo+4cWpdDugc89pEmgU24yTxh5XwOHeDG6OF4LZ8jFF83UOf X-Google-Smtp-Source: AGHT+IGepPyahdwiLXa+hTChQvpqNqdtLaWlsgrnW2kLoUmHQ1ZOt/OezF+sVZ8Hdx9fv3fKFLxugw== X-Received: by 2002:a05:6000:2407:b0:428:5659:8205 with SMTP id ffacd0b85a97d-428565a7124mr3721719f8f.56.1761220402904; Thu, 23 Oct 2025 04:53:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 32/58] target/arm/hvf/hvf: Document $pc adjustment in HVF & SMC Date: Thu, 23 Oct 2025 13:52:43 +0200 Message-ID: <20251023115311.6944-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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: 1761220450542158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index b5fdd86837e..a045f83c9e2 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1947,6 +1947,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) case EC_AA64_HVC: cpu_synchronize_state(cpu); if (arm_is_psci_call(arm_cpu, EXCP_HVC)) { + /* Do NOT advance $pc for HVC */ if (!hvf_handle_psci_call(cpu)) { trace_hvf_unknown_hvc(env->pc, env->xregs[0]); /* SMCCC 1.3 section 5.2 says every unknown SMCCC call ret= urns -1 */ @@ -1960,6 +1961,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) case EC_AA64_SMC: cpu_synchronize_state(cpu); if (arm_is_psci_call(arm_cpu, EXCP_SMC)) { + /* Secure Monitor Call exception, we need to advance $pc */ advance_pc =3D true; =20 if (!hvf_handle_psci_call(cpu)) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220559; cv=none; d=zohomail.com; s=zohoarc; b=l8/og6hAWQQHJANK6QozLYmLOrsafQOMN0gmInb7guuYacG6gTllLYhChsfMUtdqtoYoaMz8nXa2u1hbeoV8er+c47gSGNUsqU5dZcigcgNTb0yRNq21rmdsq4f+Pm7bNZ+qHxzw3D9fp1y7bnt+Ly+AnhE5zoGQfvEh49Uv9Zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220559; 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=beoY+BW3TD49vXs4CyggfoeGS9sL7sPb+rvUv38igys=; b=XknOiQHfmzldquFK5nyJa6fR+jbcuLkWrJAmni2VmS90jPYx6b2Gd1se/MsiMDK9mUULWSn4x0c/x9tIvjEPO9JppWVq4GMp7OM0zfvF8ddezAfhVVodbA1F1qj3Vi2n0HbuVlGWEZOuDbT3vs8vZtS8D7TzzqNB4mGNp2cF7PY= 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 1761220559076592.8785387823991; Thu, 23 Oct 2025 04:55:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtss-0005h0-66; Thu, 23 Oct 2025 07:53:34 -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 1vBtsp-0005dK-He for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:31 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtsn-0002cQ-Ov for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:31 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4710683a644so5929715e9.0 for ; Thu, 23 Oct 2025 04:53:29 -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-429898cceebsm3564815f8f.37.2025.10.23.04.53.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220408; x=1761825208; 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=beoY+BW3TD49vXs4CyggfoeGS9sL7sPb+rvUv38igys=; b=BwwRQGb29KJuD++PEy7/deVWWWk5EO6kxboBtncE54ANcyTvsBslqV4DKy26lZOdSK GX9qkioOpGGT62giYYOV0Ezr9PlH09tzmhEV7RTObljsEAcgrPdqS2prGyJ6vHEY6iyB PhM6Tl5oYSoKV6o/YZlieYpPntwBQ+TZzD0aUM/Z8RdNxrFh03ULLAi2gmBq4o/73s9/ TRklmxINFacdnE/p8AJCSBhXqQzerSxf+Jf0yQUljnAFqv39VFg5w7gL1ZKgE7Bngixv 1GxVDCQ3zkS23TK/fkGNiQ3gaEK2p1WlT+nrvNuEMHU2EXRoGqktzJy5aG2JSQz2TavU BF2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220408; x=1761825208; 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=beoY+BW3TD49vXs4CyggfoeGS9sL7sPb+rvUv38igys=; b=dK28XRAoq7iAB7rqzdtqO8j2mYmSU9RI8/2jrQyGMDy0JJ7cv+rCNKqECWsj2iMPjM vX7OxdVvFwEdMyKHw/d60GXeNNRqWjKfrp+IdCG8eMt7DMoG5a9PJxoHwtFHxcRB7kcK WP4k/8AnlrO0t0AvF71h5A19vB+36sqwNpjnv+QHaYPAN+hmGLGfrj+PXkyj/CQja1hZ YeRR7exmVvA9zciLzd8RbAzRr4PXbOizR1kFew0PzYFJ76OEZSXAgV70jschGVMT9Gn9 DFSML5kv5qsuY3ahyOkDIiltUZZx2/k5BJq/Y8IrkYCdPVd0lcZr/Poe7UVQ/z8V43Kc 39/g== X-Gm-Message-State: AOJu0YxuG0+AWyuFg6LTKQA58kC5UUoTKhGCZUCI5YpZm0T7i7CJQzpz gwkPaR9psUN9tFe+L7dQlSYFd+iNa7/u6Bc73Zg6snKcj9AIQcoqBiQllWZZ/EyiBdOZ2u3iJOJ 1kc6aVTg= X-Gm-Gg: ASbGncvanxbnw/WamJQ+JUBfFewLIP5/Od5pSJzfy3IyGE41Fd6EWzn8SlKVT3QoOk0 z9PvMcz9QYMiL4hXX5eGawtmC90wtiZ1HVEafqswmOzoOJd3a1S6w6Z1K9W/k4/KwiUtwH/b52Y fWR4lP1wuVGZRR4zU01y0g8b79zXyPgUcqBEvw7/SkwaC6cx5SWuND7+NI21CNeCfpOYYiymx0L gFEB4y72RdbD03pOAk1RpGzJL1OfsJ2s7sWxu2TxvANFNh6Bv0uqYJGX2u8zaD4IOteYGuiLye4 UQ7p4cmTnPvsnuk3gzNIx4IrkydH+b3/A1rqK8VmH0Bm+G0jg2dhkg7oNUyhu7OUKxm4pwpbzbY 1WTv4SF9pNlsUXoTWuOTHQYQ0mbW/Q2VXTMDekW1WB3F6jrMauD1M+8AUZYiddAc9Kn11eqEQ2C SaFT3hqN5bbumiZGKAgTELiHTutG5Qymz40iReMuI+i4T36oEPNQ== X-Google-Smtp-Source: AGHT+IEvrVaFv23S/qiOlmTwaYFJc6krdyAxyqLA1qGzJQlG+jSjZWWZtjx+Z/sBE4y0MI3EH2Jb6g== X-Received: by 2002:a05:600c:6553:b0:45d:e775:d8b8 with SMTP id 5b1f17b1804b1-475c6f18746mr27739195e9.1.1761220407858; Thu, 23 Oct 2025 04:53:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 33/58] accel/hvf: Trace prefetch abort Date: Thu, 23 Oct 2025 13:52:44 +0200 Message-ID: <20251023115311.6944-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1761220559827158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 11 +++++++++++ target/arm/hvf/trace-events | 1 + 2 files changed, 12 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index a045f83c9e2..77998ab90a6 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1974,6 +1974,17 @@ static int hvf_handle_exception(CPUState *cpu, hv_vc= pu_exit_exception_t *excp) hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1); } break; + case EC_INSNABORT: { + uint32_t set =3D (syndrome >> 12) & 3; + bool fnv =3D (syndrome >> 10) & 1; + bool ea =3D (syndrome >> 9) & 1; + bool s1ptw =3D (syndrome >> 7) & 1; + uint32_t ifsc =3D (syndrome >> 0) & 0x3f; + + trace_hvf_insn_abort(env->pc, set, fnv, ea, s1ptw, ifsc); + + /* fall through */ + } default: cpu_synchronize_state(cpu); trace_hvf_exit(syndrome, ec, env->pc); diff --git a/target/arm/hvf/trace-events b/target/arm/hvf/trace-events index 29387780e3f..b0d3d7bd322 100644 --- a/target/arm/hvf/trace-events +++ b/target/arm/hvf/trace-events @@ -3,6 +3,7 @@ hvf_unhandled_sysreg_write(uint64_t pc, uint32_t reg, uint3= 2_t op0, uint32_t op1 hvf_inject_fiq(void) "injecting FIQ" hvf_inject_irq(void) "injecting IRQ" hvf_data_abort(uint64_t va, uint64_t pa, bool isv, bool iswrite, bool s1pt= w, uint32_t len, uint32_t srt) "data abort: [va=3D0x%016"PRIx64" pa=3D0x%01= 6"PRIx64" isv=3D%d iswrite=3D%d s1ptw=3D%d len=3D%d srt=3D%d]" +hvf_insn_abort(uint64_t pc, uint32_t set, bool fnv, bool ea, bool s1ptw, u= int32_t ifsc) "insn abort: [pc=3D0x%"PRIx64" set=3D%d fnv=3D%d ea=3D%d s1pt= w=3D%d ifsc=3D%d]" hvf_sysreg_read(uint32_t reg, uint32_t op0, uint32_t op1, uint32_t crn, ui= nt32_t crm, uint32_t op2, uint64_t val) "sysreg read 0x%08x (op0=3D%d op1= =3D%d crn=3D%d crm=3D%d op2=3D%d) =3D 0x%016"PRIx64 hvf_sysreg_write(uint32_t reg, uint32_t op0, uint32_t op1, uint32_t crn, u= int32_t crm, uint32_t op2, uint64_t val) "sysreg write 0x%08x (op0=3D%d op1= =3D%d crn=3D%d crm=3D%d op2=3D%d, val=3D0x%016"PRIx64")" hvf_unknown_hvc(uint64_t pc, uint64_t x0) "pc=3D0x%"PRIx64" unknown HVC! 0= x%016"PRIx64 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220428; cv=none; d=zohomail.com; s=zohoarc; b=cirVI1Fecm9Zey9QQ0EMCwA9q64bM/w49aescQr+Y1q7Lfn0z2QP4H+kwJ3cTmvIdl5HcZIIBSkJmVnFvR/lRTUu3fcXFDixwuRi+bO/DwJ+CKpdoekx+7os1sbYV5QRhZmAO4CZBlRE2aAeyyPz/pBHOiJH9ahjh9NDpMK4EdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220428; 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=TTm87lVVxROZNlFfDmq1tJ6XtWX537djOuc6Uhcrzng=; b=YDfr9c5Im6hB3pJNVslAhfRwpMihtFGLObzr49hVLCe/rEu9yFvxonB+dbSDpJkldEvvgTvpajPoRlhIJIdPIaQ7QN9HLlvN+LA9K2GEoeBOuHdO4nNL832YiwcEwNpR6gQgcikAQ5d0Pm65PkPBmWJyI+VJuOBncW9s8Z8Ulus= 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 1761220428611291.50394467334; Thu, 23 Oct 2025 04:53:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtsx-0005tl-09; Thu, 23 Oct 2025 07:53:39 -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 1vBtsv-0005pW-31 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:37 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtst-0002d4-42 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:36 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-46e6a6a5e42so4044725e9.0 for ; Thu, 23 Oct 2025 04:53:34 -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-475c4378cbesm89767375e9.16.2025.10.23.04.53.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220413; x=1761825213; 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=TTm87lVVxROZNlFfDmq1tJ6XtWX537djOuc6Uhcrzng=; b=qM4eZbtnv6HoM/UA+ZUG4eOTxj8v2n3q5s5jVIOHymmONtMXQiGkP6HENkvPEqBNbX xy6872Wd2SpiCF0rOp6xJJM1nkIGg/wv/3Cb/sQnQSgC7HKsAy/4T4jV1K8evCiNaO1U VWeQP4XDJEPQBXTgxv28EWz5sTw8azxSyD8Knzm7fLrGIvxG7HoRr1DM7YHPjDxexy6c 9jq3JZzbo3ZfW731R69kZagE6M0wOjp8Hmhzp+zJXW6IGzgghSDJhVT3lGHWEM1dIMBV FpaYxccPtvLeNGxzxExvThERswigecL3ZwPN0zSxIEaeoGDx7AREfDzeJgZvoqFU/0eX ewqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220413; x=1761825213; 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=TTm87lVVxROZNlFfDmq1tJ6XtWX537djOuc6Uhcrzng=; b=xKa8oNc1/4gwnstsm/La5WGVoEzVlcBNXEiZ6cvnVD/bkf3ZWCB8Xj1BT/L6B1b02b JiafQLI/TVwEKl82DooNuSjiIgvXNpAu2foH+4XHEhuvb1fVohADnridq7IqDPPnKkCR vjskVCCjBgRytHqbKumrJTfTG0Dv7x2h4cWnEmcPz5neGk+4iFybv9lIwlCfuriCaPh1 lcivFWuoRkWy/PfeLWgYuBhfltZ7D/keICga1lBAekSETo4tHLRrsn3wxmz2LOHdj8Xt 9ef1wNBVPAk/O/RZzpnGoXV9E0uz8UDosgU4Hq9JiLu1UYNgSvTSkUY95VRZSARFn84D Krag== X-Gm-Message-State: AOJu0YwrXM0en2qnjdghSCeGtsvSrtZ4omf7vMlYOmQEhm1vbHl6T9tY +dDsJjvp6ClZKkhvn+t67kxqF750hD0uKjwnNUvvlSajWb2tylcjHpn8SBNXg+AWVdMfxmTB/g8 /tpUx6tE= X-Gm-Gg: ASbGncuPC/qxkezEiYZEGqbsFm8pfMwQ1OeU3lYZyX3gtSNgQPHS935aIQyQDUJy23H OXXTWsOobPqvq9584X8qFHgXNv/a+bbODiveEZcNrezn/Gtdk6JBC8X/lA2hRmyGJJCT9y/6OGR oiYaX7+rSJOqx5YXEKvgMraw5Gs74Ptj5kTS56AwRYnwZ4X6GO7Hd5La0dr43uwyP3z0bKgkY8j ND8oWlxYeThRAPVSWk+S9tIjnrNj7+Y+6a8SQgwVO73lDFjbZ3IbHaPFsDgyD3NHSrJckJnVmmV zA+SvWgq8NL+8PTVdyEvTHXW1fVr34UxMPxG8Uejm3gdd0Nrx6IBoBPOeU6/s6IUweQ4K1sG/oC iacMS+6XeYPMJz6FhiQZQJHkDxmIhMBQRzMVNmgx8YQyqLu2Cw8rk+0Q0D90eBWn9wxJ4NAGJDm g71XPuUVz2YlMQMLwcszL3rHF3kthDMomoVhgvSpIj7CcZRQZvfqkPRy1/KVs+ X-Google-Smtp-Source: AGHT+IHOxbkqRSG1vuLJQbVlCrQUtDR7pfJcRsrvZ77YgeE8tCkRscDEYZuPOexE06C8p98VkX27Qg== X-Received: by 2002:a05:600c:3581:b0:45d:d5df:ab2d with SMTP id 5b1f17b1804b1-4711790bf23mr164792475e9.26.1761220412775; Thu, 23 Oct 2025 04:53:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 34/58] accel/hvf: Create hvf_protect_clean_range, hvf_unprotect_dirty_range Date: Thu, 23 Oct 2025 13:52:45 +0200 Message-ID: <20251023115311.6944-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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: 1761220429948154100 From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/system/hvf_int.h | 3 +++ accel/hvf/hvf-all.c | 25 +++++++++++++++++++++++++ accel/hvf/trace-events | 1 + 3 files changed, 29 insertions(+) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 3d2be4092ef..5a57691885f 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -89,6 +89,9 @@ int hvf_arch_get_registers(CPUState *); /* Must be called by the owning thread */ void hvf_arch_update_guest_debug(CPUState *cpu); =20 +void hvf_protect_clean_range(hwaddr addr, size_t size); +void hvf_unprotect_dirty_range(hwaddr addr, size_t size); + struct hvf_sw_breakpoint { vaddr pc; vaddr saved_insn; diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 0a4b498e836..e13abddbd9c 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -58,6 +58,31 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *fil= e, unsigned int line, abort(); } =20 +static void do_hv_vm_protect(hwaddr start, size_t size, + hv_memory_flags_t flags) +{ + hv_return_t ret; + + trace_hvf_vm_protect(start, size, flags, + flags & HV_MEMORY_READ ? 'R' : '-', + flags & HV_MEMORY_WRITE ? 'W' : '-', + flags & HV_MEMORY_EXEC ? 'X' : '-'); + + ret =3D hv_vm_protect(start, size, flags); + assert_hvf_ok(ret); +} + +void hvf_protect_clean_range(hwaddr addr, size_t size) +{ + do_hv_vm_protect(addr, size, HV_MEMORY_READ | HV_MEMORY_EXEC); +} + +void hvf_unprotect_dirty_range(hwaddr addr, size_t size) +{ + do_hv_vm_protect(addr, size, + HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC); +} + static int do_hvf_set_memory(hvf_slot *slot, hv_memory_flags_t flags) { struct mac_slot *macslot; diff --git a/accel/hvf/trace-events b/accel/hvf/trace-events index 2fd3e127c74..f989da59492 100644 --- a/accel/hvf/trace-events +++ b/accel/hvf/trace-events @@ -5,3 +5,4 @@ # hvf-accel-ops.c hvf_vm_map(uint64_t paddr, uint64_t size, void *vaddr, uint8_t flags, cons= t char r, const char w, const char e) "paddr:0x%016"PRIx64" size:0x%08"PRIx= 64" vaddr:%p flags:0x%02x/%c%c%c" hvf_vm_unmap(uint64_t paddr, uint64_t size) "paddr:0x%016"PRIx64" size:0x%= 08"PRIx64 +hvf_vm_protect(uint64_t paddr, size_t size, uint8_t flags, const char r, c= onst char w, const char e) "paddr:0x%016"PRIx64" size:0x%08zx flags:0x%02x/= %c%c%c" --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220442; cv=none; d=zohomail.com; s=zohoarc; b=cNjTIWBsdCZ/h8mDkDzx0ktfKc0/hcliAc+LlCVNmX7YeolQCTMEtPfI+y132P3KPD2bgJ5l4KRxY5ZoNhUPKXxiChW1/yDR1v3Z0nAi5H40uzG5F+asG7JkkFDBYnKHgVHWhqYQJ9SPQOOBV4Yf6ofbETNvKp5jhxcTR7r70mY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220442; 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=jshA5o7CtEOKbvk7d/DMpS50wl/NlFslnNDFO+dEz7Q=; b=GmO5MPGOHFR4/sDDigEt7k9AQn6TMOeepsgoJeaLmao42FYNKzraENEd7uMzcytlIWgYIymBOEQcWWFbtB//eVXOXGiuNxRstTzWdgX7VmowJWec31mui5w/ZzEZEHDSaCwVIa0kew+yTJ4oklh5++Skjz1EgKDyMBaoPiPAD4g= 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 1761220442509790.2128717621273; Thu, 23 Oct 2025 04:54:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtt0-00063g-Pb; Thu, 23 Oct 2025 07:53:42 -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 1vBtsz-00061l-EF for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:41 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtsx-0002dp-LD for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:41 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4711810948aso5403135e9.2 for ; Thu, 23 Oct 2025 04:53:39 -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-475c4369b5esm108570225e9.15.2025.10.23.04.53.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220418; x=1761825218; 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=jshA5o7CtEOKbvk7d/DMpS50wl/NlFslnNDFO+dEz7Q=; b=keBuBCSAcZLGjZltJ+oIDoEBHmlaN98PIzt0Ij63t2GId3fFebCyLEziPeDwVqOMaK Wop0+zonish848SuTFudpbH77FHsnfooKqV0NJuI88yDMN356hnGJM9rViShZDIquXv0 yuqFUxdzJNa0QikPAj9CMTAM1RKE8Z7RiuAJvfnrPmyVRH4CaiN5Ky/DCoOg1CPlzpdg CmYngSajrc6d19knlJOTAJHP5jVLxEApZNxZuxLnWlQ+20SrO4Bz0wyNGUr595ZjRMjT 877j67qCLWTKLD+/y44+JUToF2O0InzgOPAFLZYBal34QrQ4HcI9cFN9LhczONEzxuLh e9rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220418; x=1761825218; 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=jshA5o7CtEOKbvk7d/DMpS50wl/NlFslnNDFO+dEz7Q=; b=sPgvkuN22sG1oxDUnTVGKpqgyqQwJlSDF7BMR52UT6+KC0US15i/8JIhpomEvDoTAr dOWLDZGktHJL6v6YshaJlv63FkBuACUiSo+4s5TZsoOmNJb3z/k7gCJ/4kemjb7j2Tl0 qd7uyJg7A9NePbjbxiy/J/Rcq8w67olhByiANDqR3E2OrVqgavDam5CK5G9PL+JbrjTO 3hTR2KBrZi0UioFtkxqT4Sl2GF1WBHZrEkkYm72rxGIBoLDE/gkzKKHHg5sreCXxsmSJ UK+viWGqEoDwCodg2sXbYkZfpGbpawkGTRwk1b7f2w0I/NfDVCZqMcEKPTHUWHHHPDeu dJbA== X-Gm-Message-State: AOJu0YzqmTo7aBBsFoCRRDhtv2TfKYPy7UzplwvNiNPlVK+qzfw/5Lhf jTFv69d+UfGS8FX+jk/T9z1iOSAiO5sRZ8+MS6GD4eOkZk7zZfyzrAEMjmy67kSMJ/YgfSH6yiG 8rVcyOMQ= X-Gm-Gg: ASbGncvRP20FxfPtC6HOeBsUwPvmpmGrgpKMEniRu2V50+U58AqOO/tYvynAUdpL4by 7IMFYhVM5a9oGFmBSjM4i0NvakWE5+ICx3rfluRgRqopMDaddy9+xseS/ZyfHNUWMzg+dbLFxo3 XAtCdxO+j186gWw2vWky2DBwL2PzJFN98LFyoplCHpIIHNmjhjuRh14NKy95V4anrrv25xaNa5Y 0hO0bp/E6XNHmmooyR7a1DBerpNgR3xz1+39EdSqJSoFTrPYBnylunngy5k+jxu6/Aa3zRnkaF1 ZRaZ5vMsk6mUK+Nro/xcvJhYT+L5UpOmPU0iRXLQ0zk9xPU8yijHEIX+GJ+SFIrLBR2QjLv6mHS nGZc76BrdHV5eA3W8LOsDV/LCwFkJlWC/hylaWTernpg7ScKb+KeHYSKLASt6377jUK03w3Woc4 OakBU9SVbE4BrZz0sGwN+QYKC4F9WOiaXXaQzgk0ZGfA6RT/pjvLTmEPRMdKaf X-Google-Smtp-Source: AGHT+IHaU2J2Y0fXpHPGiSVNyAuA3Nwz8U1ThUfeJSbttC2L5bqChf8gIbR39Q+Up+sN8xKSD+FpWg== X-Received: by 2002:a05:600c:3b05:b0:471:d13:5762 with SMTP id 5b1f17b1804b1-471178761bemr170274825e9.4.1761220417696; Thu, 23 Oct 2025 04:53:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 35/58] target/i386/hvf: Use hvf_unprotect_page Date: Thu, 23 Oct 2025 13:52:46 +0200 Message-ID: <20251023115311.6944-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1761220444492158500 From: Richard Henderson Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/hvf/hvf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index ab59381b500..aae4877d568 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -139,8 +139,7 @@ static bool ept_emulation_fault(hvf_slot *slot, uint64_= t gpa, uint64_t ept_qual) if (slot->flags & HVF_SLOT_LOG) { uint64_t dirty_page_start =3D gpa & ~(TARGET_PAGE_SIZE - 1u); memory_region_set_dirty(slot->region, gpa - slot->start, 1); - hv_vm_protect(dirty_page_start, TARGET_PAGE_SIZE, - HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXE= C); + hvf_unprotect_dirty_range(dirty_page_start, TARGET_PAGE_SIZE); } } =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220469; cv=none; d=zohomail.com; s=zohoarc; b=XR1hP7lsPPG4x5q2N5cz9rMdb9X737vLvr6k9kkVh1ebHCEvaIY+MBCsXTbRQlUVO5m3eze2XUHkxcoXnqpgPO0psEkIge5E8bOYe19QIXDsc0owfa6lklXsjVLKvYcMWE1DoMuQmaiSWMV4JR2QFrcxitVSmAqUb6Yj8qoUxSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220469; 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=eAxR7mUpNjwjSajsZFGtwQMzgIfAC9EBDPwVN/5kdzk=; b=VLnuEGyKgD6X/NZMbXrFvZkpxbLerTEs+uzy2c1sBAZIWE5XR7/gQ/QVhyNEnQltciRv0fL1rsRO42RVwpF+lHCmaAGXSCgPKJn7zSlKnivQsQFFMvLmvV09hloQDV2+1KvpeEGzWUj2U0Fe/rQoWr0Tkw7g9/KtfxC4oYhaRB8= 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 1761220469838533.687693878336; Thu, 23 Oct 2025 04:54:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBtt6-00067P-Hi; Thu, 23 Oct 2025 07:53:48 -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 1vBtt4-00065P-MC for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:46 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtt2-0002eG-Q8 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:46 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-47112edf9f7so4411005e9.0 for ; Thu, 23 Oct 2025 04:53:44 -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-475c428f709sm94694775e9.8.2025.10.23.04.53.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220422; x=1761825222; 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=eAxR7mUpNjwjSajsZFGtwQMzgIfAC9EBDPwVN/5kdzk=; b=hP9VwXjL5QtSLAipke4qPnB8OIKei5FgSAYp7B8rlH/aCZe88RsRFqu7r1hCyBPJYa Bp83oLgjP7tYRBuBhRsbxqjNQ2RYg/CxWsyYQmUD18VJy/Zu+sL89PGlLgYi3oC434JC 1qyDMbFlIve9BpFa2VPPNl1ntqc5qF1l2THOeQFOrS3UHpnIEoFSExBoxgJ6emyjlcuz 7k8HSFy0U/xV1ZlYT1il9acpOlt67SxA0ggqdRl0c52bEUZGAE7fJRBvhucXdEK5vBPZ jyLdGULeZ1xLCno8KzPl7PGnVlt4hlnJ+0zDlX8tCeLjYFz0fxY09h0sXqAFppkQHMd2 Nwmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220422; x=1761825222; 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=eAxR7mUpNjwjSajsZFGtwQMzgIfAC9EBDPwVN/5kdzk=; b=byQjIselowCxrG4xZ27dfzWj5NBfZfMerrhSM+Hcm1/e8uC6V3GiBAegih6mCBLsav Xlt5bA9qJ10fW/xE2jxykoyKSyAtM10CnrMIasuLnfhnOarIV1WJvO5ci6Dyw45Asotk 3MjJII43PL1rg0EyABxTFyjJC08+Qh3yYtt4/DO7ujhkoCh82XsZR1/hLSyOOZBxZcoq kMN3qsuJoY1VF3qFE0/+GuKPCFkMZDFCvWLAcgcYCetBFYa4tija04itYvhfji8EthdP Bm7f/yoAI1DN3bAq8AAgxCxJ2S+6ehV/09NBNXWGloWSv0QAGvToaqKXva962k+6PiZc PFFQ== X-Gm-Message-State: AOJu0YzksIIfmJuDPPcopsvbMltb9Qrq883116uSIuPtASp2rWUKGwyS sqY6IdopjhjNkCCKRX+UEN8v3m5tjLdttD4HNCCoUCn/YIb+pRMYBLuliCvvDTC4QCeAnBLzloc adMFkN6Y= X-Gm-Gg: ASbGnctDLuqagukQkb9Zp1Q8h4kWbZtCMPsNJQ39T5J69v5y7eoqmNyKCUk+oxxJC59 f4HrRNdV+oEZHwIWRf6q9oiIpf43HY/lBb1RCsC5TELNgNZkzVUtJK+o/9UyS95mT8+fWhZfVkc mE3jXZncHQBPrGREHAjDVUqmW/iqDov+QGDVDcSHTnrC5/0m7frztMw0hgg9D8+LZ0CvyIKrMEn knJTjwKr5PPYeTPxJZZCjT4AXyeOKXcI2IMzwCtybkSg6HrMo/6Xkjze4XPTJdLlgqgVh4XtRY/ Y3o/7r4y/NFAbYPWI3hm+nvXwv04AokQyqFNSUJH6cd2VDa3dZebJN6fT9gEWJmJPTxvJz+yTjm VfxY4UNj3PHthgxhlaD+eg7K3V7BuwlP2/gycjsoeU2CHg9KbpX5ov/u2zaUy5A+C+7Dx2q+PwN aPVc5K6u/HvKDtksNnesBPDSJzm9AoEiOwbJGtKQlPsfVUMoA+KQ== X-Google-Smtp-Source: AGHT+IE2qeF/JXnAb8/QMIGST/cg5fHI5kD1OiBmI18xcMweO45BIvrynKS+h0d7N0RRheTfHzR33w== X-Received: by 2002:a05:600c:a4e:b0:46e:711c:efeb with SMTP id 5b1f17b1804b1-475cb02f5b9mr14221605e9.25.1761220422542; Thu, 23 Oct 2025 04:53:42 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 36/58] target/i386/hvf: Use address_space_translate in ept_emulation_fault Date: Thu, 23 Oct 2025 13:52:47 +0200 Message-ID: <20251023115311.6944-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1761220472400154100 From: Richard Henderson The hvf_slot structure is a poor replacement for properly looking up a memory region in the address space. Use memory_region_get_dirty_log_mask instead of HVF_SLOT_LOG. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/hvf/hvf.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index aae4877d568..4597d191f9d 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -119,9 +119,12 @@ void hvf_handle_io(CPUState *env, uint16_t port, void = *buffer, } } =20 -static bool ept_emulation_fault(hvf_slot *slot, uint64_t gpa, uint64_t ept= _qual) +static bool ept_emulation_fault(CPUState *cs, uint64_t gpa, uint64_t ept_q= ual) { - int read, write; + bool read, write; + MemoryRegion *mr; + hwaddr gpa_page =3D gpa & TARGET_PAGE_MASK; + hwaddr xlat; =20 /* EPT fault on an instruction fetch doesn't make sense here */ if (ept_qual & EPT_VIOLATION_INST_FETCH) { @@ -129,18 +132,20 @@ static bool ept_emulation_fault(hvf_slot *slot, uint6= 4_t gpa, uint64_t ept_qual) } =20 /* EPT fault must be a read fault or a write fault */ - read =3D ept_qual & EPT_VIOLATION_DATA_READ ? 1 : 0; - write =3D ept_qual & EPT_VIOLATION_DATA_WRITE ? 1 : 0; - if ((read | write) =3D=3D 0) { + read =3D ept_qual & EPT_VIOLATION_DATA_READ; + write =3D ept_qual & EPT_VIOLATION_DATA_WRITE; + if (!read && !write) { return false; } =20 - if (write && slot) { - if (slot->flags & HVF_SLOT_LOG) { - uint64_t dirty_page_start =3D gpa & ~(TARGET_PAGE_SIZE - 1u); - memory_region_set_dirty(slot->region, gpa - slot->start, 1); - hvf_unprotect_dirty_range(dirty_page_start, TARGET_PAGE_SIZE); - } + mr =3D address_space_translate(cpu_get_address_space(cs, X86ASIdx_MEM), + gpa_page, &xlat, NULL, write, + MEMTXATTRS_UNSPECIFIED); + + /* Handle dirty page logging for ram. */ + if (write && memory_region_get_dirty_log_mask(mr)) { + memory_region_set_dirty(mr, gpa_page + xlat, TARGET_PAGE_SIZE); + hvf_unprotect_dirty_range(gpa_page, TARGET_PAGE_SIZE); } =20 /* @@ -153,9 +158,6 @@ static bool ept_emulation_fault(hvf_slot *slot, uint64_= t gpa, uint64_t ept_qual) return false; } =20 - if (!slot) { - return true; - } if (!memory_region_is_ram(slot->region) && !(read && memory_region_is_romd(slot->region))) { return true; @@ -761,7 +763,6 @@ static int hvf_handle_vmexit(CPUState *cpu) /* Need to check if MMIO or unmapped fault */ case EXIT_REASON_EPT_FAULT: { - hvf_slot *slot; uint64_t gpa =3D rvmcs(cpu->accel->fd, VMCS_GUEST_PHYSICAL_ADDRESS= ); =20 if (((idtvec_info & VMCS_IDT_VEC_VALID) =3D=3D 0) && @@ -769,9 +770,8 @@ static int hvf_handle_vmexit(CPUState *cpu) vmx_set_nmi_blocking(cpu); } =20 - slot =3D hvf_find_overlap_slot(gpa, 1); /* mmio */ - if (ept_emulation_fault(slot, gpa, exit_qual)) { + if (ept_emulation_fault(cpu, gpa, exit_qual)) { struct x86_decode decode; =20 hvf_load_regs(cpu); --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220452; cv=none; d=zohomail.com; s=zohoarc; b=mUbjCRFM2I/5duxFyWDfQglm2AswcFeJ2/hgCsg6JhXJiO/CY2ZHyL05AMoleBjuqQvV8MeDZOv8Uf6VX6ai4DPZE3/ElTwmzpCEj9H+1vULKw2axosrTL9gz6PBisaMSoThTPBTx1MROknKiLP///02ZOGPX/go9sk11lG31z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220452; 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=ksRzEOXsw7/qT6nxPgIci4xbN2jOFu95y2T7RO0BwU4=; b=S9Tu7TfJAuwa//Yu5YfD01QA/VIZ2RcArgxXB4MlB9Ff2zdw+vyZWKB59pXT8UeNLWyml1yYGimD1xQAZikKLuHGQsmECIbH/BWUzVat/MhE8DwASfZ/xaGMsZ2EQhpSUBIdU8M2jiSCBbL0sspN6ZAQq3ZUMJJni2JfrmwaXdY= 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 1761220452665605.7898317036286; Thu, 23 Oct 2025 04:54:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBttC-0006No-0l; Thu, 23 Oct 2025 07:53:54 -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 1vBtt9-0006JH-Jd for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:51 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBtt7-0002ek-I6 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:51 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-471193a9d9eso7909205e9.2 for ; Thu, 23 Oct 2025 04:53:48 -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-475caf15498sm40025825e9.12.2025.10.23.04.53.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220427; x=1761825227; 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=ksRzEOXsw7/qT6nxPgIci4xbN2jOFu95y2T7RO0BwU4=; b=WpF15k2SyaVgSbx2/ESlRjKNToVzvaAANQhE8d/iqBCV5uWcwMHai97Mu1dt6gtnw+ U6NqhSwQemwJlr5Gfs4SMWrBs4vPASyXzNQny6NgyN/hhfbjq8Uzlls4OoKB5n7IHh+4 Le7swcFnx6+MExOfNMs7yFgTg2w28ayv41B7n9KnHPCFcn7iBxBoR6Lf48Bn7Oain6wH kLds+cBJ17Da8NKfG8QYqYx38BPRqtHDZG+QSEE3OFG/Ok6AnxSapbCmfw/2H/cwr4lj 1hm9job3dPAo9lRaHEu9z1wAjqHts1p+9y627GDlnYmnTeBOMWWEOFiZZDSZGWcv6jKz K2xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220427; x=1761825227; 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=ksRzEOXsw7/qT6nxPgIci4xbN2jOFu95y2T7RO0BwU4=; b=BLP5/RqDiBZiUBZ1pBagCmeLy2TQbHrgtdc4Ar7Ddbt5qUjeBSyGPYo6QE9KYxwQco wizv1FhDXTD95Tbqb/Wc2v8Q6LpPWYZnMXjQWN5HvvRBPAzYKmKanQizRyrgbwUmAnF3 jrq3cfWpoP7pmLnVjnN+/KtcEkKeCpRxpNPBwBy/9otEOF6QsbxGtvDL+elYHGT0QKp9 VgIKFW70BsHTqquMH0bIpaXMhCExnxvsVNjU4Bfs64+hEw3UNJ2Vh0jMAoaE0S6qlT8k Vv/rYcHBswq4Sjnp1xyh9FoxHROEbH5tmEJ1pJqECkM6H07uduRGsdJUu2xOc7Gj7Ip7 lwqg== X-Gm-Message-State: AOJu0YwTSBCkAsnkNzpNPx1yzXSu3rgiNaJM/S7Ljvq5eCVQJPPhowd0 5ZylWc1XRFtThA5H6q4bohZDBukx2BsUceePUeoLDHNLc6KwzprQSieMisdRUGTraRVJuEw9eJV KzWpkbWs= X-Gm-Gg: ASbGncvEJcDR9THu+8kFXwxbv8Yo/K98/CCZ2bbABFkN3WCq+VLE85VoK5SOWfr8w4d MBwFFbrR+ADaAmBnRTFXprmcstNj0sZDhSViWoViSAFMiDUoxxf01wnUJ+0b6HACQ7EvQkQwNb/ r6ssT6jlrQpecx9V3Xv+x1OkOXeikZSGLwmIYRhX8G0P7jizDp44QSnhPYkilFNP1nrQYa/NeU9 C1vpUqZlxHEiza/m0/KB00DDUbCJaL0JyMmJIvfHCMmVdqsgM659CZCX7RxzhHyfgn9nicsylYU +SWdBF4ATQxK/Dx/PZmqIAuUhUq5yJdrzwdIz0tQL/H83ZxuSm6Trz1X/G1YxdM+016CrNYGM8A neIAgi2h08nT2jTS36ArZC/EeyJDA/R1Ogik+PBFE7+wKd5ykgEbUv6XhO3zspMw8rrJAE1aWTE +t6aJ3FLxHrD7lB7PaGi7v0EIY1s/1F1ClbxjPVOnAPGaVDsQbW8KKBpfBI+l3 X-Google-Smtp-Source: AGHT+IHnaCVjtUWUAaXIHvDzg+vAp/gJUckpHD+CDTGKlI34zNdNqoNOsIx7k+eYph5Os6YS7RSHZg== X-Received: by 2002:a05:600c:608a:b0:46f:b42e:e397 with SMTP id 5b1f17b1804b1-4711792cd70mr162423305e9.40.1761220427410; Thu, 23 Oct 2025 04:53:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 37/58] accel/hvf: Simplify hvf_log_* Date: Thu, 23 Oct 2025 13:52:48 +0200 Message-ID: <20251023115311.6944-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1761220454551158500 From: Richard Henderson Rely on the AddressSpace and MemoryRegion structures rather than hvf_slot. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/system/hvf_int.h | 3 --- accel/hvf/hvf-all.c | 40 ++++++++++------------------------------ 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 5a57691885f..ee7ab689f45 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -24,9 +24,6 @@ typedef hv_vcpu_t hvf_vcpuid; typedef hv_vcpuid_t hvf_vcpuid; #endif =20 -/* hvf_slot flags */ -#define HVF_SLOT_LOG (1 << 0) - typedef struct hvf_slot { uint64_t start; uint64_t size; diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index e13abddbd9c..1be419652e0 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -200,45 +200,24 @@ static void hvf_set_phys_mem(MemoryRegionSection *sec= tion, bool add) } } =20 -static void hvf_set_dirty_tracking(MemoryRegionSection *section, bool on) -{ - hvf_slot *slot; - - slot =3D hvf_find_overlap_slot( - section->offset_within_address_space, - int128_get64(section->size)); - - /* protect region against writes; begin tracking it */ - if (on) { - slot->flags |=3D HVF_SLOT_LOG; - hv_vm_protect((uintptr_t)slot->start, (size_t)slot->size, - HV_MEMORY_READ | HV_MEMORY_EXEC); - /* stop tracking region*/ - } else { - slot->flags &=3D ~HVF_SLOT_LOG; - hv_vm_protect((uintptr_t)slot->start, (size_t)slot->size, - HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC); - } -} - static void hvf_log_start(MemoryListener *listener, MemoryRegionSection *section, int old, int new) { - if (old !=3D 0) { - return; + assert(new !=3D 0); + if (old =3D=3D 0) { + hvf_protect_clean_range(section->offset_within_address_space, + int128_get64(section->size)); } - - hvf_set_dirty_tracking(section, 1); } =20 static void hvf_log_stop(MemoryListener *listener, MemoryRegionSection *section, int old, int new) { - if (new !=3D 0) { - return; + assert(old !=3D 0); + if (new =3D=3D 0) { + hvf_unprotect_dirty_range(section->offset_within_address_space, + int128_get64(section->size)); } - - hvf_set_dirty_tracking(section, 0); } =20 static void hvf_log_sync(MemoryListener *listener, @@ -248,7 +227,8 @@ static void hvf_log_sync(MemoryListener *listener, * sync of dirty pages is handled elsewhere; just make sure we keep * tracking the region. */ - hvf_set_dirty_tracking(section, 1); + hvf_protect_clean_range(section->offset_within_address_space, + int128_get64(section->size)); } =20 static void hvf_region_add(MemoryListener *listener, --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220478; cv=none; d=zohomail.com; s=zohoarc; b=bf1npGe35OlkfjUHFC+C+trZWJYhLuiGmT/mAZbtF6v4DkrzYTLrS9E6maJbh8j5GwbY5AlxjsniarzDBixTWVfYCEphc/Qt2lVWS9Hh5Ke1Tzft1o0Kqdk3xcF87K4vvKm0JBN48NKnRNxOTs/6PkZmQz1CAPbl2psr/MDX7v4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220478; 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=zJbOfgCSRJVEsgKWpcu4Ftzf4/H1829jkVWLENUxHOU=; b=V30B/si0VObj4itOI2jIN34OqcnHIVQMMrgmUFJUTet+2tOLUnjA13CsosoMWGSZvm9mfHffJTY+NaTgqY1aPe4xXez/OMY0WN3Qq1vYx1e1pEiwW30H40JuUHqrG81lLFzaY5lDd1Ne8ZtEtgYmo6SS9AFB1KCDygYHWgSHIF8= 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 176122047819867.58926001038321; Thu, 23 Oct 2025 04:54:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBttH-0006ZL-9P; Thu, 23 Oct 2025 07:53:59 -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 1vBttE-0006U3-5L for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:56 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBttC-0002fF-9u for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:53:55 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-475c1f433d8so5978895e9.3 for ; Thu, 23 Oct 2025 04:53:53 -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-475caf4642fsm31945115e9.17.2025.10.23.04.53.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220432; x=1761825232; 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=zJbOfgCSRJVEsgKWpcu4Ftzf4/H1829jkVWLENUxHOU=; b=GNSfhNlWI0lCWdm0Kvn36isA5hTPyNrQvdY2JHa6/mRuNja+VJsll4TL68zD6vRp0Z +76KApIFYl0ScvCkFdumLsJD7GQL1Kytk4Hdkzzxf6o8BoVw9VRkUoxKN7To4F2n2BDc x4YDSQjLTsrDb8vxAHo9/BCLP82JjCNHh6bWiGZyeiXYosmOrq5Mch5/dCTcqD34Xato eqHsqGbQGci1xWhvG5nmKWOMZ32Hkur0ee7eJgCswNgq40GG3kxWvx47QWFvn/a96650 yfv0hHPQA68ESSOpV/Q/Wdy8Y8q30U0naKFgScUtFSpGV7dvmo2IQFJJLuN81DM9unQt SWyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220432; x=1761825232; 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=zJbOfgCSRJVEsgKWpcu4Ftzf4/H1829jkVWLENUxHOU=; b=TLys/vDEkKovG37YHOBAN1xNjzCfng5kifebzUP99WgQ+JWj4+HnMVHqd+rCR3o9qc 2n3lhVX96e8eEflT+LtC9XqWsHC7wCpbRkupbsg9o1lwmHC9YIlaA4qtPQJa+/cnMAHi gIkEgmNvWEw2JL03JZcOrQQFwS9+Ptil61vGaq52izTY/SttdgxRsjaJTdqKAE9tzE4O yyhpk69DpbRNAqZZqJXd95Ur2Q47mjpehmBrujYyzYJ+E8ZTA4e7RpKTVPnRzxYKRxBW SHrT7R0vrEUgM1J8AWgHMZuCrfm9HiH2nKfT7Adoyx36f9+Fh7kbxn6mbz4FrOEw5WNZ TmmQ== X-Gm-Message-State: AOJu0Yy+CgR+YENe6woXDPVXpQ1gh+mlLT0QOuHQdW03edgCFSxK3XM+ T0tyJfPBQfDWSBd+s1UOF4x3A95YR5R0abp3S1Ye+F4ok/QVwWB3i46Zp6fvKtskQvkkYumMFEp QShTfngw= X-Gm-Gg: ASbGnctK2YjpbSoBJ+BxTENHCllOm44oZbZpP3z98Kt+tMeTPeAPj3n/aDqqPW7Ip8u Rm7PLNFy2HM2fMabhg85b6NSqezy6Pz3FIMV65S5ceX2HD23KZ+vB3qbM+jxB/ehuNgfKn67ojt 9yv1pj6yitYQAoU9S/7Ps31xPy9lO6veUi/1O/N7qOAqyil1ModfPC4Qz0MG4Z83Ici2wN+cQmD u2F6pZ2IejI0Iy7bsgUsunYlQedaq8t62I9Eo16E/yXAKOvyRHRXVqlvrd3XQQsJJQLN5NWzS6O FQuz4kbh4a+5aM3ffR0jmk5fQcdiGorQgH4lnDn3yv+iVI+arPMhdgf/5EZiv82qkJuY9/M589t geiTprPgBtJ5jErSr6LB7l6plMPMRiP+sSuptrpgIlgFZpdyWpEuz7ONn4qY9/Quf9vn42K7Ojd 3oQj6TdxmAz7tiOk8AhnJFsOb6gcBToMGJ8xVzjHmgItn6CkHyMRpesb7A1/wBASPBQG/y9v0= X-Google-Smtp-Source: AGHT+IEnkL0yRDryjcuiYy7eTbFDJ4a2Y9x9j9B9l8A0D8M9wF229UnFNNLEbNkSJ68l94/JSNIiTA== X-Received: by 2002:a05:600c:3b8d:b0:45d:f81d:eae7 with SMTP id 5b1f17b1804b1-471179176b9mr206095785e9.28.1761220432357; Thu, 23 Oct 2025 04:53:52 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 38/58] accel/hvf: Move hvf_log_sync to hvf_log_clear Date: Thu, 23 Oct 2025 13:52:49 +0200 Message-ID: <20251023115311.6944-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1761220480477154100 From: Richard Henderson Right idea, wrong hook. log_sync is called before using dirty bit data (which for hvf is already up-to-date), whereas log_clear is called before cleaning the range. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- accel/hvf/hvf-all.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 1be419652e0..844cc179de2 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -220,12 +220,13 @@ static void hvf_log_stop(MemoryListener *listener, } } =20 -static void hvf_log_sync(MemoryListener *listener, - MemoryRegionSection *section) +static void hvf_log_clear(MemoryListener *listener, + MemoryRegionSection *section) { /* - * sync of dirty pages is handled elsewhere; just make sure we keep - * tracking the region. + * The dirty page bits within section are being cleared. + * Some number of those pages may have been dirtied and + * the write permission enabled. Reset the range read-only. */ hvf_protect_clean_range(section->offset_within_address_space, int128_get64(section->size)); @@ -250,7 +251,7 @@ static MemoryListener hvf_memory_listener =3D { .region_del =3D hvf_region_del, .log_start =3D hvf_log_start, .log_stop =3D hvf_log_stop, - .log_sync =3D hvf_log_sync, + .log_clear =3D hvf_log_clear, }; =20 static int hvf_accel_init(AccelState *as, MachineState *ms) --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220553; cv=none; d=zohomail.com; s=zohoarc; b=dx8pAlw+/tuYyDBM2iYMd2pKGTD69R/3lCGZmDVTfH74+7qSWIyck80xBnNsoU2djZI2Q4atxTwAD7na57tpqNf4e5zEzLjuQLWMSK7M7wwgxklQLhpFSVix4aJ/szy18sHWrBYfpXy2FlJSCMTssTpOt9DsQIyBRmOyFicW11I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220553; 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=dNYppjdbbTX0VMSysfUsuhVWdSTiLr/N0jxDYIR1lVM=; b=bcv4TgpVrr66R+XURLTTrGWkayaTZ0WFQjbPnixHquwi9K9ysfUtK6xURlMFoBPukdnlzlf6Y6YEOKckwF2vHFfKW+eUDhccDHn/TWVCjhszD7+zSbaHJ11Lu0IW4i0YF0Y8Oz3mxSrD3mQVP0jNCcxKk9Il5sTryye20DzXPKE= 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 1761220553952923.1626141806067; Thu, 23 Oct 2025 04:55:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBttP-0006gB-Ec; Thu, 23 Oct 2025 07:54:09 -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 1vBttJ-0006cQ-LJ for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:01 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBttH-0002fz-Dz for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:01 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-471191ac79dso7852925e9.3 for ; Thu, 23 Oct 2025 04:53:58 -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-475caf4642fsm31950115e9.17.2025.10.23.04.53.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220437; x=1761825237; 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=dNYppjdbbTX0VMSysfUsuhVWdSTiLr/N0jxDYIR1lVM=; b=lP/Rsy5sT4Ij6KMrktu9CppsUL039o0T0XUt79CqPpLsdqcci4S1kgFPCE9KxqstCH pPWqXjqjHPVT+sVA86lZqgJXAsomnMJouE8DufnnbHCS0raYCjhmt48zyS7x8jnGk3hd Q5tLxdTQk9FAhcHtUl3qgYznmpk36M1wTWeTiTXFmrQSffgNerfCfEsEs/glwekMvEIx dX4Rac956dAoygkFhfgNMkR9kcVcTlST7e10Grcfvlixc1U7QIPmOHdeCheeL6fuOD3q LynA3nXg/dfrYKcTJwSIx59SZD7tYw9TMZrQPM2jprCUAuzzXhlS+uABCBB3uqADoniM ulcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220437; x=1761825237; 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=dNYppjdbbTX0VMSysfUsuhVWdSTiLr/N0jxDYIR1lVM=; b=ByZkHVeuoutYjZUYDaFU94OC0NQFD9ZB/H3YSQK4wLAU7I7PCpGCvRDxebkFd8q7b8 cZVgL7r+ZTzQ0zk8eBKOXChWy4l3fwtI2cb6Nlx1+4deZAPmrKFGVjrsuf5p9GG7OZlZ CC4RYdMkakpb+eDDnLrGIR6aIiZcesvFZR8TkXuUfM9UvM3lwgngRjpqQoKjm64mTnWw Pn8XQll24tzLfKCBaKWUPG15fY3Uqgd8HCHZkClQQOj4kPeudt9VtzvkFSi9xkY7s0V4 chxmCanXeM9Il/45vv+g+je2LRG3SdJMFCzRyVpTWHQiKL+7Nwgm+87pLv5taQRJY3OT Unhg== X-Gm-Message-State: AOJu0YzG1v+7545dEANRAE8dF649+gmHN2NMisCitV2vYfLmQu594V4R haA2eR2BRjOdIiesZ33eJq0ZK8NXf3gpbD8FFjRA2ZZWB0oQ9hKaPO/y/pxoVavDUNEr5utGUe5 4DqA/edc= X-Gm-Gg: ASbGnctTNqhg+MdbnWOHFZe3S/lCJXjxA0vj4T39Dnr/EeJS0DHO/i+ELR879OAXE2v VBpF5jREcnjE/f4FBrFWwGmBFfi1IMmEzf4okne+Fv2X9cPj+a5lxuKix5bPNv8icGtJbcFAVzL 4Mj0ROkmpNQmaDkI69iv/9LH493r1UvXvtEzkkBckS+Hk+8aRTS7DswgLGBoBtlJt3mQseGZFMB QXIqh1Lp9Ef5IBfS58l5dal4uCrgifRu6KH8Ypv7VyI2SoMzKz7uwLa7FQnKVU14yJQKtpPuyAW siQW1OJcKDOJlKgflYsSm91+bQu4CsYU8IRcKzV5FPgJeYtFwVeNOYVbnnZ9yGss34ExItf/k13 Tc/GOuoQFvl78VE7fL7FsuPqSZK/sNGDD2FeQVCGirXMfe1jncm1ksoRwb2WvOlb5+8yrSTE8qV HPEE6caGDMAZac+lQYbRHygOipY22zdGJEt6FdWSzU6lIVQmnN2A== X-Google-Smtp-Source: AGHT+IH/kpJO8nzyovomjrNYbFFdYdRsPywphvLn5SYgs8H7Arbk2/7NElts22pkl2Gq+X6Wop0eDA== X-Received: by 2002:a05:600c:8b2f:b0:471:56:6f79 with SMTP id 5b1f17b1804b1-4711793149emr168139665e9.41.1761220437437; Thu, 23 Oct 2025 04:53:57 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 39/58] accel/hvf: Simplify hvf_set_phys_mem Date: Thu, 23 Oct 2025 13:52:50 +0200 Message-ID: <20251023115311.6944-10-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1761220555856158500 From: Richard Henderson All of the complicated parts of updating the address space are handled by address_space_update_topology_pass. Do not create or use hvf_slot structures. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- accel/hvf/hvf-all.c | 111 +++++++------------------------------------- 1 file changed, 17 insertions(+), 94 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 844cc179de2..21386acd143 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -83,45 +83,16 @@ void hvf_unprotect_dirty_range(hwaddr addr, size_t size) HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC); } =20 -static int do_hvf_set_memory(hvf_slot *slot, hv_memory_flags_t flags) -{ - struct mac_slot *macslot; - hv_return_t ret; - - macslot =3D &mac_slots[slot->slot_id]; - - if (macslot->present) { - if (macslot->size !=3D slot->size) { - macslot->present =3D 0; - trace_hvf_vm_unmap(macslot->gpa_start, macslot->size); - ret =3D hv_vm_unmap(macslot->gpa_start, macslot->size); - assert_hvf_ok(ret); - } - } - - if (!slot->size) { - return 0; - } - - macslot->present =3D 1; - macslot->gpa_start =3D slot->start; - macslot->size =3D slot->size; - trace_hvf_vm_map(slot->start, slot->size, slot->mem, flags, - flags & HV_MEMORY_READ ? 'R' : '-', - flags & HV_MEMORY_WRITE ? 'W' : '-', - flags & HV_MEMORY_EXEC ? 'X' : '-'); - ret =3D hv_vm_map(slot->mem, slot->start, slot->size, flags); - assert_hvf_ok(ret); - return 0; -} - static void hvf_set_phys_mem(MemoryRegionSection *section, bool add) { - hvf_slot *mem; MemoryRegion *area =3D section->mr; bool writable =3D !area->readonly && !area->rom_device; hv_memory_flags_t flags; uint64_t page_size =3D qemu_real_host_page_size(); + uint64_t gva =3D section->offset_within_address_space; + uint64_t size =3D int128_get64(section->size); + hv_return_t ret; + void *mem; =20 if (!memory_region_is_ram(area)) { if (writable) { @@ -135,69 +106,28 @@ static void hvf_set_phys_mem(MemoryRegionSection *sec= tion, bool add) } } =20 - if (!QEMU_IS_ALIGNED(int128_get64(section->size), page_size) || - !QEMU_IS_ALIGNED(section->offset_within_address_space, page_size))= { + if (!QEMU_IS_ALIGNED(size, page_size) || + !QEMU_IS_ALIGNED(gva, page_size)) { /* Not page aligned, so we can not map as RAM */ add =3D false; } =20 - mem =3D hvf_find_overlap_slot( - section->offset_within_address_space, - int128_get64(section->size)); - - if (mem && add) { - if (mem->size =3D=3D int128_get64(section->size) && - mem->start =3D=3D section->offset_within_address_space && - mem->mem =3D=3D (memory_region_get_ram_ptr(area) + - section->offset_within_region)) { - return; /* Same region was attempted to register, go away. */ - } - } - - /* Region needs to be reset. set the size to 0 and remap it. */ - if (mem) { - mem->size =3D 0; - if (do_hvf_set_memory(mem, 0)) { - error_report("Failed to reset overlapping slot"); - abort(); - } - } - if (!add) { + trace_hvf_vm_unmap(gva, size); + ret =3D hv_vm_unmap(gva, size); + assert_hvf_ok(ret); return; } =20 - if (area->readonly || - (!memory_region_is_ram(area) && memory_region_is_romd(area))) { - flags =3D HV_MEMORY_READ | HV_MEMORY_EXEC; - } else { - flags =3D HV_MEMORY_READ | HV_MEMORY_WRITE | HV_MEMORY_EXEC; - } + flags =3D HV_MEMORY_READ | HV_MEMORY_EXEC | (writable ? HV_MEMORY_WRIT= E : 0); + mem =3D memory_region_get_ram_ptr(area) + section->offset_within_regio= n; =20 - /* Now make a new slot. */ - int x; - - for (x =3D 0; x < hvf_state->num_slots; ++x) { - mem =3D &hvf_state->slots[x]; - if (!mem->size) { - break; - } - } - - if (x =3D=3D hvf_state->num_slots) { - error_report("No free slots"); - abort(); - } - - mem->size =3D int128_get64(section->size); - mem->mem =3D memory_region_get_ram_ptr(area) + section->offset_within_= region; - mem->start =3D section->offset_within_address_space; - mem->region =3D area; - - if (do_hvf_set_memory(mem, flags)) { - error_report("Error registering new memory slot"); - abort(); - } + trace_hvf_vm_map(gva, size, mem, flags, + flags & HV_MEMORY_READ ? 'R' : '-', + flags & HV_MEMORY_WRITE ? 'W' : '-', + flags & HV_MEMORY_EXEC ? 'X' : '-'); + ret =3D hv_vm_map(mem, gva, size, flags); + assert_hvf_ok(ret); } =20 static void hvf_log_start(MemoryListener *listener, @@ -256,7 +186,6 @@ static MemoryListener hvf_memory_listener =3D { =20 static int hvf_accel_init(AccelState *as, MachineState *ms) { - int x; hv_return_t ret; HVFState *s =3D HVF_STATE(as); int pa_range =3D 36; @@ -277,12 +206,6 @@ static int hvf_accel_init(AccelState *as, MachineState= *ms) } assert_hvf_ok(ret); =20 - s->num_slots =3D ARRAY_SIZE(s->slots); - for (x =3D 0; x < s->num_slots; ++x) { - s->slots[x].size =3D 0; - s->slots[x].slot_id =3D x; - } - QTAILQ_INIT(&s->hvf_sw_breakpoints); =20 hvf_state =3D s; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220479; cv=none; d=zohomail.com; s=zohoarc; b=jBnZ/C/D4XL14QzvebOjtjiC7UTHFFxv2Z7SNgzb7ZHr2CgE4X1+/qLbsHovUAkcWgHEXWpyaY8EiqhwV8woJwd8xIBSlWjK2YFmOtSb9RSHD91+efuC0XeoHiIj4ROeiZeCh+ZgSCWbrMG41XbimrOyGpTGUpO7/pI2GPfXOaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220479; 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=vLxjW3kGnAkcgz1GaQCATP0ZMz267FP3u+/JVs3d3vU=; b=XDz9OoHoEBOum5oIImD1k3dG5y184Wjh4IAuEp13wgMg/jgXcKUz2tJl14egexT4MDIuE+vBNJSwpX8aQ27wJrfUcgad/GArLFsW/eV1FbhrHRkjhH8ick6HIyMt6JCixc3xNL/snwMj08eFHUmVVoWIe5/eOz48X+OwTKzFWs8= 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 1761220479972583.0784786549852; Thu, 23 Oct 2025 04:54:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBttb-0006r6-0J; Thu, 23 Oct 2025 07:54:21 -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 1vBttO-0006gF-EW for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:07 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBttM-0002gW-G1 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:06 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-47100eae3e5so7287145e9.1 for ; Thu, 23 Oct 2025 04:54:04 -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-47494ae5510sm58251365e9.3.2025.10.23.04.54.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220442; x=1761825242; 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=vLxjW3kGnAkcgz1GaQCATP0ZMz267FP3u+/JVs3d3vU=; b=xdVCJNAeI7WAKLJpuZ4vJadz8jAGNT6KBRd2BYeCV3w8EMtSLgVla7isw+vEvDJ7gt pf+Q/lDDsdW5DJsfbNgbeCBXpwFeOqWOtNDutMKRkrOnFVzfLsmf3ySVCLeXf3uV2cEC AWurrB6Cxk1K6zixqGNDGPxQJj+dFAquhVqXGkKcJ5d3GYx03sPibGW+AbPruGQLnUwd VDsOZLkKUYIiWmiowkEy0BqZQv0gIm14PojG0QkPUEsABMTYHEpf+fpR+9G0Vm1dF+j7 Uvk+Cc6PxkhMnkahdpiJO9w5Nf0mcGWhy9cYZlYmlwC0SxekaTXTjDQ5YTyV9zemHOJB lC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220442; x=1761825242; 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=vLxjW3kGnAkcgz1GaQCATP0ZMz267FP3u+/JVs3d3vU=; b=e13kpFOqL15Hnl3CVA+0TYBBBw5ys3NKmvSII7OO2fAC/YRu38ARliIeoqt+ggXdGx S0mcyANEiC+WrE3NIq7OjhQu+E3lPxbw7StlB83rLdyFgAafYQInc1J464Zj+hwSURj2 IuLnN7rtDPLSc9eZazyX+wiBPIjwrF0FsxPkRryM1ffaI/3A7Te6xGULG+R2cVXcsivK pvy6/0URKQxcGpFQ1DDxoAUsnAC1A3atKm/+wG3aIPe6om5kCozhGQGMuBdQmNvoT6fM h3MDcOGsL31IB/au74Ixi8Gr8eidPo4tWu70Whsq271pIHMbqgASXEODiw8GlRuADK7w HYyQ== X-Gm-Message-State: AOJu0Ywa6U/locuhiAZL4urQ1g6RtbbuOlsbRLnZ8CpFe3VnmpNtyixB L0yphLNp/IXTTMhbCynKGsvpjqY/64BIue7uniV0v9gbgOAMJTBLdK7bPnQNijwG/5eh6mtWX6D uBLecbF4= X-Gm-Gg: ASbGncvnYDxZF6TPjmzbFiwxrJhKtN4ZrL5MQSI+nOLog1Bt1Cv839uOvvmawahECL9 levQv8V7e5JkJXwX3DdRF/7HQwoD7nMWA8aZ+tpE7ug/C8NCDe1+0BYzAtK71rqPcZSsaQGc8k/ pjncp+vBKkE8sH1CX3+e0yo263nSEW/0ilUcVB6V1z75y0fnjoAmSsX9CWCUXQSWkmkmAkMOWtK qXeG0s1unoLguH63vNEQ+zjHJQq3NwmyGJjDK6DYrLIHeVY+dRZNfUL3r53zol6YxLG3E42sr3t sUL/NmrxBWF5in2sRAS8keWCVC72fg3FP/TwFq9ISXeK2DXIg3PaNXHdtCBrsl2SqWO34FB+FvB /Na6Q4zTD0Jd879dpGvUzjum3nCRetDStIlkm6HjrCoUVkzkxpQTO3ysNN4YJI/k30MIJ25WuU4 qHv/CrOUnRG1WHHRLcI0CPz1WVtxONVKwB+35e0IWkJRBGX1KKDSe2guA8i00B X-Google-Smtp-Source: AGHT+IGY16BhHQsHiZOVCn3Tj+DCOd/FlYhKEtMNlajydXKGb3mFmPJVbPfE23y/uVEYjLK3mU+zjw== X-Received: by 2002:a05:600c:354a:b0:46e:59bd:f7d3 with SMTP id 5b1f17b1804b1-47117903f24mr160650345e9.20.1761220442544; Thu, 23 Oct 2025 04:54:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 40/58] accel/hvf: Drop hvf_slot and hvf_find_overlap_slot Date: Thu, 23 Oct 2025 13:52:51 +0200 Message-ID: <20251023115311.6944-11-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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: 1761220482425154100 From: Richard Henderson These are now unused. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/system/hvf_int.h | 13 ------------- accel/hvf/hvf-accel-ops.c | 14 -------------- 2 files changed, 27 deletions(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index ee7ab689f45..d842d4b2b99 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -24,15 +24,6 @@ typedef hv_vcpu_t hvf_vcpuid; typedef hv_vcpuid_t hvf_vcpuid; #endif =20 -typedef struct hvf_slot { - uint64_t start; - uint64_t size; - uint8_t *mem; - int slot_id; - uint32_t flags; - MemoryRegion *region; -} hvf_slot; - typedef struct hvf_vcpu_caps { uint64_t vmx_cap_pinbased; uint64_t vmx_cap_procbased; @@ -45,9 +36,6 @@ typedef struct hvf_vcpu_caps { struct HVFState { AccelState parent_obj; =20 - hvf_slot slots[32]; - int num_slots; - hvf_vcpu_caps *hvf_caps; uint64_t vtimer_offset; QTAILQ_HEAD(, hvf_sw_breakpoint) hvf_sw_breakpoints; @@ -70,7 +58,6 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *file= , unsigned int line, const char *hvf_return_string(hv_return_t ret); int hvf_arch_init(void); hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); -hvf_slot *hvf_find_overlap_slot(uint64_t, uint64_t); void hvf_kick_vcpu_thread(CPUState *cpu); =20 /* Must be called by the owning thread */ diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 3e5feecd8a7..bbb0b385fe9 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -64,20 +64,6 @@ HVFState *hvf_state; =20 /* Memory slots */ =20 -hvf_slot *hvf_find_overlap_slot(uint64_t start, uint64_t size) -{ - hvf_slot *slot; - int x; - for (x =3D 0; x < hvf_state->num_slots; ++x) { - slot =3D &hvf_state->slots[x]; - if (slot->size && start < (slot->start + slot->size) && - (start + size) > slot->start) { - return slot; - } - } - return NULL; -} - static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data ar= g) { if (!cpu->vcpu_dirty) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761220486; cv=none; d=zohomail.com; s=zohoarc; b=mdoI2SzAnCCvqWgcl/oojy+VX3DlRNdcw7nd2wNJv5AB1168atisCXoorglvIguQWyAovoJ/fs3s/lIMp6Y9SduwR8cA/+KnqIT3BvSl+8mmJCcgWaWRKOp37GZA9B7tqZf6VYbv0yyKCVH41Q6gW1V3KOAWMLJHToTRd7mxMoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761220486; 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=mwdGU+8Ecc8JQqbY944iaIzcFK2N7jYfLXWaVKyTPPg=; b=R6t0mxLg6PTAjekeSokmCJYmppbmQtwhI7nrZZ+R/EuV22EgIYRjfqs2PoZVH4aIVg4YCBeyT9HpYY3JSeUljgScEWCKrBBoGWW6uXKMAtLqaOhlFcrfRaQLbpEcB9L6Rh+BSRrCTbrghmgvGUFt5CCvHsUgWGAss+nQTQ7PGwk= 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 1761220486326341.37543017134965; Thu, 23 Oct 2025 04:54:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBttq-00079C-4H; Thu, 23 Oct 2025 07:54:35 -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 1vBttV-0006qz-2b for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:16 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBttS-0002h3-M7 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 07:54:12 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-4298b865f84so286816f8f.3 for ; Thu, 23 Oct 2025 04:54:09 -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-429897f57cesm3728842f8f.17.2025.10.23.04.54.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 04:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761220447; x=1761825247; 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=mwdGU+8Ecc8JQqbY944iaIzcFK2N7jYfLXWaVKyTPPg=; b=XkuuBFxUFFNqSc9997pD9XCiCmTOfJxVpcuxXyAOWFbMjDI7dmj17pj9QkYv09nFQI HgwFNB9jNTl1skYCFWmR4xUDRUO3DHvVwfzezMxgl/xlw0kPQRkLK8HVX48sFlez6JsW 5NCPZiyAo5nW3HveG3Godx6gQpvUSXvxO3vG51T5O3ATWxZVm6fEydg0TDgyhCkzsvqr iAuYB8ZHixbLnelc5YOdj7Dx1K2Ga9jzKQJqAv1DRDt26a9z4mQZhPrXiJ5yoFc4872r ZFcgUqqCTLyK+YAr0ZcrC+pSnX3FzTutDE0UID3fHjDc9eQHv6U1HZAD+/+HGCnFWtO8 mp/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761220447; x=1761825247; 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=mwdGU+8Ecc8JQqbY944iaIzcFK2N7jYfLXWaVKyTPPg=; b=GKUa0FVsNqFTyf0/kKt5lKM5SdTReqoOJJ63X4qvh7hWFF3plfgcSRTvqKCVjDk2QW 9zvxQmWGU18UDU0dmdg+I//lDi29DR+vS3DB3Dr7T9+Rzdb/iO+XCYVK4GVvkOEFpY86 zJe1plt2xyCL/OJDnNF/r+Y0mnTudkXUtodPME+OXZHEkkoJ6R0jlcGnC02kyOkWswi8 NgeYrGU9Kcu+DddQA+RLX753XxVdyFOCTW+gMAFT7h2Dme8nPDzTNuVuKmybq3qZiKe6 tRJDdgWTyYKaOgLxmovUdKKH3anWNnnCKHuzOk1RAoquEtFl3NakluGMOSGlp0yRo8Ob GXww== X-Gm-Message-State: AOJu0YzHBI1xD/oQchhDW2rxtnCJ04eUfcGinO6d6z/3z97h/I8LbQds PFlcA+YiMaxF3CwWn3+tXIw7uzTTiOQVlsaMRIC93SGF3XqlHxtXbylsopEjgNQPwVdAjR+oeRj QRrS31L0= X-Gm-Gg: ASbGncuIXL1Esn+fPx36AYdG3ahBFor4zLT3jqQYmei8esZVy8inEuvrjUimIf+UbTA cz40An/mtAJ8286CyElg0MfudXj828qIdAgGgxotu57PkZy3DSiKon7dnXnqDiPoG5IMBzmP/oW aQXyPplTprNITftjLM8bKEockvovpulOAGU9Mh+MKoRURlKOU46vpLm1f0Vw0Ex8etNADo6o9CM 5X/xBj0Y0rGx8o/b5anm/bNpOzDn36XxvWDHjH9FnXoFQ7syaAMe95iwQERnO+dFRfL0W/meD+7 g9CTQ8jALv2JAVyv1swI1e36GNnxfoN31cun9pyUnmCDVNxIS87ugzyePR/E857562qLCjiTgRm AfPfHpog2TSRIQ/rt+3InJ6rMkKYRBeIA0cKeKAeyN/a0qwa3yWfS3WBC61hRm8z/ra6Q5vfM/d 9cZH5hfelEYEDa+HN8LHSVUfU6/1FOc34HGTwKmTNXo+0QvXAYS7IBmb9jty72BLsydLtTQQM= X-Google-Smtp-Source: AGHT+IEyg+aUPhFKlAw/V/LNeN7y+v4DAkNAXRKcFvZ2PKm0nj6AUPECgMCz96ad5W1JYZM9aIcQqA== X-Received: by 2002:a05:6000:1445:b0:429:8d0f:e91 with SMTP id ffacd0b85a97d-4298d0f101fmr95347f8f.3.1761220447443; Thu, 23 Oct 2025 04:54:07 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mohamed Mediouni , Phil Dennis-Jordan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Richard Henderson , qemu-arm@nongnu.org, Peter Maydell , Peter Collingbourne , Mads Ynddal , Roman Bolshakov , Alexander Graf , Stefan Hajnoczi , Paolo Bonzini Subject: [PATCH v2 41/58] accel/hvf: Remove mac_slots Date: Thu, 23 Oct 2025 13:52:52 +0200 Message-ID: <20251023115311.6944-12-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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: 1761220488592154100 From: Richard Henderson This data structure is no longer used. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- accel/hvf/hvf-all.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 21386acd143..c767e13c212 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -21,15 +21,6 @@ =20 bool hvf_allowed; =20 -struct mac_slot { - int present; - uint64_t size; - uint64_t gpa_start; - uint64_t gva; -}; - -struct mac_slot mac_slots[32]; - const char *hvf_return_string(hv_return_t ret) { switch (ret) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224852; cv=none; d=zohomail.com; s=zohoarc; b=kpqsPq6wZi+pZPlxkbfZ+on/ufv6g2tyPfBDeLABrDchOVxWHid6Cm/wE8lHh/2weCBaiVCUyVlI2TTv0u0xmPZ+84guyulaH9dqHxraJwJXC7mE0rgN7WLTLRqsVgrfKCyIQ7FIbjWi86Cb59R4K/2AUd5hehGNG0USO4DBJWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224852; 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=Ylvuf688MxbDh+xWuVO8cCat37R7AD8jYlsTF5cm0AQ=; b=gbj4hsRijzLKZiVrPiB7OCs9+iFg4fkHJjfzFtyoqfL8It7BgqfFxbZzXR817rRzQZQxRxgrDP2s8kAN1WS0Q+5LO0fF7CfilW7vMDQOqp4OzaGJ6xAmQCqkFDslw08q91c/wTLh7rifLQni1Dun4hm/FXzkdjPwkI5XwaUEZlk= 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 1761224852579928.5613829569813; Thu, 23 Oct 2025 06:07:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1X-0001LY-FQ; Thu, 23 Oct 2025 09:06:35 -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 1vBv1W-0001Kp-4I for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:34 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1S-0006Fa-SO for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:33 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3f99ac9acc4so793976f8f.3 for ; Thu, 23 Oct 2025 06:06:30 -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-429898add96sm3872005f8f.30.2025.10.23.06.06.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224788; x=1761829588; 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=Ylvuf688MxbDh+xWuVO8cCat37R7AD8jYlsTF5cm0AQ=; b=T8MnXXWVmPSfAi7e9OrE53jLfT9R3mYypMSt+/LQfIk3W1Hqj1JKw6+E5PqjMCndSq SSuhiSFhBYKzRI5IUEZwK4wAF/4pMz75TexpZangnbwNXeiBdo+t1RRGZoSO5lwSaDXy tnibppcXdshD8/7BnzNsgiHoUIkr7B7zW52kWzdv0a0S/rV1TKVBGFD0r8rAIYbIWj+u 8m/bOpkxgz0x6rgF8h96iInOyu+qtZNUqh4EzorlROXqlnXHhnPXgRtIplAjIAWQhi+y Qh8eDmBj2o9EbTHH/u0bBQ+/sfa5cxQP48Fg/n5k+K5xjDzn4HJjVDGBBPWbBJXzv1+j 696A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224788; x=1761829588; 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=Ylvuf688MxbDh+xWuVO8cCat37R7AD8jYlsTF5cm0AQ=; b=u69papRAi50GGGGU/gBU7e2WM2O0xeXcpdfpmIWriDsUauMh9dliph7l0MLIwC9C/5 TKStIDt8Od2Mhkz5HoCU4N9KfPu1OH7VEx+YGmKEoYDx2redn4EBxsNmxZzXxlqNihKh 8inkXsXY6oM/HTgycvSHsxNVYAAPQjUi0EmA1EXQ3XXxUVGE+uABw7u/k8m9vu1x7E13 tqemN73CprZX65IDIrz89QTT+fxMhtfT3O+6fSp2419qFNgWpBz15Ef1ks6BeDeHvhiD fic/Vs0BgoBFXs7vNIZLap87LxWu0+IiA5D5eAZOxVXRHHP9ELyhPFdBWO7/UTXbVjxq 0Znw== X-Gm-Message-State: AOJu0YwKjzAojBzQ34PJrlsT3RKXe+cpw8ZZ2E7o+yU47+cyUnktOwRQ fEjrgGgmIYULMPfjKN18Bv6DWzcYoZe+cs2kl7emG85DAvehIJRiLwSbSFVh0cuJjuPYGGWAE2y 1SAXvmJw= X-Gm-Gg: ASbGncsgdJTuEsGNWeHArD/68VyyJGYj7MtWD6S8WX72KrhVzsmtG+RH2HNSGAIPnGw Q9n5MaeoBaNdOyASHB/3UnAx4kaE0xuAvauqRzuWSqTQqG7oO4xfqYbx5tmNIw0t6+zEVhXqfYZ 1rPWVZyymwlS5nT72ZdBqeYfNdlE59meGONTFqeMLVNurJYET61ijbgj+i9nlw/xmi9Utls/H5i zK+FcxtyBX8XMle9VR86a6i07Oa2XVU8GDcpnRY3QVQlLIcgGaz1KlbhATY/GOy5CIGWLakVWfp wVUe//p0IaRXxDNKn/lSp0kZAK8a1nu4W0Va9GD9z4D/iH2ZQ5U8qiPk9ZzegzAp2up6swGy4jy dHskb+ZzfDuFTnb+Zc9RCKQQxqkvwx8XKhrtqiEU1GRCvzH6rQgldCHJ9ElaDdJy9vljhehDh3S sQj70r6pwyDZIPC2D2AgcaumNRawm+7CVsygbmNSZfjBuN+8XDXOyJZgCkGbXk5clqk7BMxOw= X-Google-Smtp-Source: AGHT+IFlIHkStDkPc+/dZCWHm/OnHFDELZm4R4I2b6OVBpuibq1q4sm+mLYgBd7V+O5lu8LVm7rhPA== X-Received: by 2002:a5d:5848:0:b0:3e9:f852:491 with SMTP id ffacd0b85a97d-42704dcefa6mr18029303f8f.56.1761224787635; Thu, 23 Oct 2025 06:06:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 42/58] target/arm/hvf: Implement dirty page tracking Date: Thu, 23 Oct 2025 15:06:18 +0200 Message-ID: <20251023130625.9157-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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: 1761224856215154100 From: Richard Henderson Notice writes to pages which are being monitored. Mark the page dirty, re-enable writes, and retry the instruction without emulation. Assert the fault is not from a stage1 page table walk. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 52 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 77998ab90a6..cf4746c344a 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -37,6 +37,7 @@ #include "target/arm/trace.h" #include "trace.h" #include "migration/vmstate.h" +#include "exec/target_page.h" =20 #include "gdbstub/enums.h" =20 @@ -1880,9 +1881,10 @@ static int hvf_handle_exception(CPUState *cpu, hv_vc= pu_exit_exception_t *excp) uint32_t srt =3D (syndrome >> 16) & 0x1f; uint32_t cm =3D (syndrome >> 8) & 0x1; uint64_t val =3D 0; + uint64_t ipa =3D excp->physical_address; + AddressSpace *as =3D cpu_get_address_space(cpu, ARMASIdx_NS); =20 - trace_hvf_data_abort(excp->virtual_address, - excp->physical_address, isv, + trace_hvf_data_abort(excp->virtual_address, ipa, isv, iswrite, s1ptw, len, srt); =20 if (cm) { @@ -1891,23 +1893,55 @@ static int hvf_handle_exception(CPUState *cpu, hv_v= cpu_exit_exception_t *excp) break; } =20 + /* Handle dirty page logging for ram. */ + if (iswrite) { + hwaddr xlat; + MemoryRegion *mr =3D address_space_translate(as, ipa, &xlat, + NULL, true, + MEMTXATTRS_UNSPECIF= IED); + if (memory_region_is_ram(mr)) { + uint64_t ipa_page =3D ipa & TARGET_PAGE_MASK; + + /* TODO: Inject exception to the guest. */ + assert(!mr->readonly); + + if (memory_region_get_dirty_log_mask(mr)) { + memory_region_set_dirty(mr, ipa_page + xlat, + TARGET_PAGE_SIZE); + hvf_unprotect_dirty_range(ipa_page, TARGET_PAGE_SIZE); + } + + /* Retry with page writes enabled. */ + break; + } + } + + /* + * TODO: If s1ptw, this is an error in the guest os page tables. + * Inject the exception into the guest. + */ + assert(!s1ptw); + + /* + * TODO: ISV will be 0 for SIMD or SVE accesses. + * Inject the exception into the guest. + */ assert(isv); =20 + /* + * Emulate MMIO. + * TODO: Inject faults for errors. + */ if (iswrite) { val =3D hvf_get_reg(cpu, srt); - address_space_write(&address_space_memory, - excp->physical_address, - MEMTXATTRS_UNSPECIFIED, &val, len); + address_space_write(as, ipa, MEMTXATTRS_UNSPECIFIED, &val, len= ); } else { - address_space_read(&address_space_memory, - excp->physical_address, - MEMTXATTRS_UNSPECIFIED, &val, len); + address_space_read(as, ipa, MEMTXATTRS_UNSPECIFIED, &val, len); if (sse) { val =3D sextract64(val, 0, len * 8); } hvf_set_reg(cpu, srt, val); } - advance_pc =3D true; break; } --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224861; cv=none; d=zohomail.com; s=zohoarc; b=GayzCfQX1BxcicSAhxLul41P0wEqzQfh8W/aJFR3IhqmEWjPJvTntCqwxhUBUyEFBE4fwXy3kmWCdFk90EAqj11sLJouZX3fMqZaKncdJe0h6ITbCHGkPoV6qFdwHbfbdROlIh3F0BP+kB6r3eYzTTYkgueKz9b4QvSA0QbP864= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224861; 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=lt1tGyvXAe3pncZc7T8tBRzYECxTVkwBPwQzr5iNL9s=; b=QjS8ZsnvAYAVHrXqZt7GCWTx0QTPXXEF4f6jvWgdqltyeI3MF8udPhYM5xgS38e3YstXy8ZjAyZJ+VY2c2aQVAqNW233A/G1m//XdbdIRAeUba6zpIrEZ27RdUAMlOUYYdj5YOZWhOHNvlFEU8SBliyN2Bmmgykzpjy7txEtjbs= 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 176122486100421.355836211311157; Thu, 23 Oct 2025 06:07:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1e-0001Nv-NT; Thu, 23 Oct 2025 09:06:42 -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 1vBv1b-0001MT-D7 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:39 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1X-0006Gw-SK for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:39 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-4285169c005so358647f8f.0 for ; Thu, 23 Oct 2025 06:06:35 -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-429897f5696sm4158517f8f.14.2025.10.23.06.06.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224793; x=1761829593; 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=lt1tGyvXAe3pncZc7T8tBRzYECxTVkwBPwQzr5iNL9s=; b=I4JmDjmTSp41sDFVobrdSriiz7mN39yH2C4Uza2xqBdn9uhce0SiJOM4DcSa38mJd2 QG0HmWWue3uJIlED5AAf93AZ3FgSO8S6uQIdS/CbBdOn5MTobtmXgcDlPWGhVjfwRb1K z3SMHqQCTLpE9M+I1ZLQkaicXn1qkA3iz9+cliu8Z7t8cIcLTZYJP4Us4Z7QExdbYk+j 4pyuuP4wg1sXcrocXdD4vjALlbdd0yuDsGUoyms13bH+XgUlGC1NvvvCi/IjQ0JeRzB7 bSxisShTJ1bBOE+w60cJjwo17tg9tJ5kphObHCzyiRHslvuKxuMgW7ogcl3KxeMtzqTj oP0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224793; x=1761829593; 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=lt1tGyvXAe3pncZc7T8tBRzYECxTVkwBPwQzr5iNL9s=; b=EsVa0WlwW+zmf9uomWnDoKjzFt2SwOWmeXg+/BuBPAxLrX8WmgN2Wuwc6KO4Esr4HC rj7TcOZQQT7udJVCa5C9h45NY3oLYmjwEOWlzfhiX/ICpjWHi+JR/bgXy4ZBWeQUwYOB 4NmpmPY1z8XumSDPe7x4oUxI5RC8T1rP1JWrtK7s6aKRX/qw/3vyotCor+XB23i5NHmo bhgUdtqd09Js3MY+7NsXIWngBm/ZK++c2EYkhDnCA55xEvCX0ERSDxjRatr5/lzPqSOD IoOU0go4neKK+wmUsEeWZnJzDN6s0vUOtahnC2pSiK4fAd5hq2pbeR2oXZ0/aoov3Xo3 xpyw== X-Gm-Message-State: AOJu0YxToAD43IpGBLXCeD2qkXDNKFGXTNV6xsE59IF+bsHosjcK+Ksn CTkxZBVIIZWrh0eU/RQDC4cQaZYhFjnVw+5AIIg4RhNCU9EnRa1v/oGn55DrVreWQ8W5IWzNaSS P+E1H5B0= X-Gm-Gg: ASbGncur89zbc2CNjsaOO2k5gcN62Z3SzqpuDnQwSks7jp7HjPkz/RHe7u3/4/XMMbg t4s3trBuCkGnYkr2sL0FD1lZq69tN3d17gzdJKDxFc/hcyeqIdNMQ80Ic+hykdWA5KHqmPW3KXK Hr2jlqroXUjM3mn1ZbFBgnoUPN/ntvhtT2RyCwK8acsZcgIgaCBa7NjgWhGlFu52ZUXL7seyTYV DSQ/NAHGF5+tKc70Ukzoi/ZXPRwnvYStJtxZP/sheh1Ijjhs6yuDA+rEA3HChxW2GkG6ybv4imq LMZByGYiyGn0tgRFmx1+PDqefTm9EKL58YX3ay8MEd89G0BIKYestJ97UlZUpVnx+8rfkPoEKVP zMxAiPwyb7zaw3RZ+fO82Nv/OjEVCT/+9enh0ux/X01JkkRtrAnmR0nU+y5p2X6ozK04X6XOAhO mvaIUlD8C3yHPIEQWpXMDqORNE09vyrD8/kmAaDXZcRPh9ww4G3w== X-Google-Smtp-Source: AGHT+IG3SGLmBIRYdpStkHWWKWGd0dlDvTjaELIhLgLfqXb7SQvfHuwh7YKKUfOy8oJupSVu5zl+ow== X-Received: by 2002:a5d:5c89:0:b0:3ed:a43d:8eba with SMTP id ffacd0b85a97d-42704dab119mr16849419f8f.52.1761224792922; Thu, 23 Oct 2025 06:06:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 43/58] accel/hvf: Enforce host alignment when calling hv_vm_protect() Date: Thu, 23 Oct 2025 15:06:19 +0200 Message-ID: <20251023130625.9157-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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: 1761224861772158500 Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- accel/hvf/hvf-all.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index c767e13c212..7e54cf202f0 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -54,6 +54,8 @@ static void do_hv_vm_protect(hwaddr start, size_t size, { hv_return_t ret; =20 + start &=3D qemu_real_host_page_mask(); + size =3D REAL_HOST_PAGE_ALIGN(size); trace_hvf_vm_protect(start, size, flags, flags & HV_MEMORY_READ ? 'R' : '-', flags & HV_MEMORY_WRITE ? 'W' : '-', --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224877; cv=none; d=zohomail.com; s=zohoarc; b=VnRFGtMJiyWMQc3T6JR+pQcGcJ1lAQx0ZEZSDoOYJAwi38+Wf8WL9BzbGFQIth2ElNxxFG0HlRo/H57T6z6fYjqWnx19ChnufMbb6bCbq8U/Jec6lIslR4EtV8SRGdmAfSVTZ8R5pZvhMSVT5fzAJmsIQEcxUyCxQlxRlYIAox0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224877; 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=+iYI+9qPb4lKcaT8r0cUl4054QjPkgSdWroSx2d2l+g=; b=JVl9dc+5gtmwaggLPX4F+agc/vQIDgUkkXY7OvQw5muno0YLXr6QF7e8GMwiirJk1g20k7RmANvm5YzpMujNrIsPASUDZJWrZDuPiPdQ3ze35BlPQxN7hXQF+Z9/yJdVbBcNGBBg7F/Hi9qMErZjh70byQqDs/VuQkvO4ak9xmg= 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 1761224877534153.59555558946022; Thu, 23 Oct 2025 06:07:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1g-0001PL-Pp; Thu, 23 Oct 2025 09:06: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 1vBv1f-0001Ob-75 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:43 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1d-0006Hn-FI for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:42 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-47118259fd8so5287455e9.3 for ; Thu, 23 Oct 2025 06:06:40 -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-429897e763csm3983570f8f.6.2025.10.23.06.06.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224798; x=1761829598; 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=+iYI+9qPb4lKcaT8r0cUl4054QjPkgSdWroSx2d2l+g=; b=vi6urhRuRJ7x9CKKrI9emrE4cpLqDGb7BODv/TScb63wRPOXidclzBPRZrmTobG6jI wGMf8UogLCiDRfi/X3MTpyIcyUeYTzQviSwADo7If1E+Yare81zkTFwll8sBTQErZ0UO UFX8TFPc/CA5eKMtvdLgtJyOa+/l6JVYxPXQEpli0ccDmgqsM4HFhqdlVwO3JccMoXye U1q/p2gSkjqhYF6gXKPkunfjxfjPFM5nzysGcFfoCN2UXnmCrY9UMjhQckQZJ53F/3vN qN/Bxm9UBUULFX7G0cT4hdq7Sb+1qGoCdyc+bUB2wc2FCsPEdru0N6YjG1mHREwtjJrE 2C6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224798; x=1761829598; 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=+iYI+9qPb4lKcaT8r0cUl4054QjPkgSdWroSx2d2l+g=; b=Jad4qODJOmm72nC/SET1Rxsp+ET4BM5zDqA4F0SeF2p3xlaDCeKEdrNjXyKxwvqQsn fjowx4/uB73YmfGBnS2JJ5U8erxYNJe/J0QIJcjPE9fTS/6hZKQYSmAvTnIuqx8pWLk4 z/0Wmia5swPsEgKldzOusF98jRLb2wehiir3jlLDR8RUN4wAnJ/1EiipJA0FkrcSnhAN oYwmz6Wqkq9xzA8K8ESTZ9Cru8bsSul2WZEd+b5b9Ng198gq2KtvBGrr6yuB4yTcPfRQ R5yZEvR4AMZUjwn4JQm3azmIflQrCkwPsU/o8bSRCcdSzjAo3g6+jZGY9u1x7NuH/dhC oQJg== X-Gm-Message-State: AOJu0YwlVxILtH3KlP4pLoo6HAgipa0KWRwrHQ2VIuIL1gCaXhQjt3he pqxqgO6dvrBWgs4yP3DjVsqPONIXTlC+1ontM/SZF6p7Tdkmt7End7kwVLAkszwzlOaP8iXJ/ax 9VEtCPEo= X-Gm-Gg: ASbGncvn64XTdPbDgk/S3nl3KKTHzLRUh+8kWBW4Rfc5VvGKUGqaMvR0D4DfMM9wmhA RiOpv7QfCsdPKmBjUSP/2+DUtbYOTZ/58Cf6IA799H2QTZLO2OLk/6fnInELNsuCnyTMsa/L8fv 1Jq/xEiYAco0ddUn61fbZuZPTvWudnA1vtWfOfdxncfX3GjFbndEsb7WuKZvynZqb3b0JucCRYX oQycxgUeL+9QtC1RoC1OuxzUohtWfWWEkQZXrAoiVWLLxog6rxsIYyh68Epr8fy45S0C2vS1fHZ UzH7jRbIfhAsW6it9S9174j73Q5DnrsMZAlNQUvWgx7WUNOF4kT0k/yBXeqOfH7nrjRd0okuHBa xJ9bo3P4D3aleoDxvEvM25pVCUNQKOjqTcCNbS+OGQ6AOMpFt7vaYwdLk0KKHUCf2zWziyBOdI2 aiJfKJVMEXgorYc/IyM+X7JfTywCctUGNjFfH76jqEmyfHTUg5vw== X-Google-Smtp-Source: AGHT+IFO3tiqOSZiOxEn9gdYKzQwGcXYvLK0iWLousrE5gOvGzkWzXB9U2Eq8xGhqGRDgV6DwxlSYw== X-Received: by 2002:a05:600c:458b:b0:46e:4246:c90d with SMTP id 5b1f17b1804b1-471178774bfmr167520355e9.11.1761224797894; Thu, 23 Oct 2025 06:06:37 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 44/58] accel/hvf: Have WFI returns if !cpu_has_work Date: Thu, 23 Oct 2025 15:06:20 +0200 Message-ID: <20251023130625.9157-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1761224882236158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index cf4746c344a..8c2eac6738f 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1749,6 +1749,13 @@ static void hvf_wfi(CPUState *cpu) uint64_t nanos; uint32_t cntfrq; =20 + if (cpu_has_work(cpu)) { + /* Don't bother to go into our "low power state" if + * we would just wake up immediately. + */ + return; + } + if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ)) { /* Interrupt pending, no need to wait */ return; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224886; cv=none; d=zohomail.com; s=zohoarc; b=QfBjtL6OMFH6vH/df8daFWGigLVp7WZz4cXNANoWE448HL9/cmkMuUKoD8Qwv4ZCXwBACy6KfAegplz8byw3aUdLmvMOlB8BtGQCOidx7KGMX+nSv1PN07gDxOjnq7TW43FK614gnMI6BXltWZxQIUxrbxr40VeVAZBdI3X9B6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224886; 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=POy1R+so3EVlSCdkiJjnl33gOSzhKoIaueGiZB1q9Rk=; b=ajKvdbPIi3Swp6TuPcnMpOFl7pDOwrPy5Plpn6GasL3DDa8Z+AHm065JYqLU5Xy/ktFlMqaNgO8G5xChbYPj2nqwTravUsAh/s8lJBNIJywqzudyKnZ7Y/niiAUhDqk1o+xrVteXa3EdgzjuXedchYOq6xyQSO5KAmSEYrUHZew= 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 176122488668422.38679255592251; Thu, 23 Oct 2025 06:08:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1o-0001RJ-Hc; Thu, 23 Oct 2025 09:06:53 -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 1vBv1k-0001QN-JS for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:48 -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 1vBv1h-0006Ie-MK for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:47 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3f2cf786abeso634652f8f.3 for ; Thu, 23 Oct 2025 06:06:45 -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-429897f546asm3854191f8f.15.2025.10.23.06.06.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224803; x=1761829603; 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=POy1R+so3EVlSCdkiJjnl33gOSzhKoIaueGiZB1q9Rk=; b=o7JlLGFNtwKF9aAqUU75hRp4LgMMAu4epbaiQfDKSivwbxYmZWTlL2gJylknDcyYoT mIfwpbL3jcbjvE/6cYAltnyG/nEfwrhtzsJDVCBUX+L0HQNAzuhhfAHwjYpZJREWkpjv 9V+Mj0ZjpTjMm4oyvD/hzGkFPptL2ngWYFC67vuQOKhktB2hSEnwVIWJZHKWe73RLz0+ ziuTDBRc12ULmP7cR6xuFuhs0Fw18v1mp9m0/S0YcUv1lvg6wfu9xha+0Uj7xpYqGHg3 uCyBgQAZwPy3icRgzpxA+dfAjEura8TEfosmBR2YSGQ3lTD4GLpG6JnlnBSrHl+xYqpY tffg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224803; x=1761829603; 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=POy1R+so3EVlSCdkiJjnl33gOSzhKoIaueGiZB1q9Rk=; b=tiEZ2dn7YhlZsvvFau0QvqwDTorbhWZ6m3whsTq1a36Poygs+3uRCwDtpEFnS2MDds 4D/xXhohOIzCl6yoysWNGCK2iZPL1j35Dz9A6DciRiVB+OK/SKb7dlvdNYNiyMlPYD0U QPOiANaKpE/DAzyrBcs02I0zETVJX1N6IorSTPYVaChcm5aepTOvRk0xodZglefsE4y9 NHr1NMlogbLfqfZIY9qyKOfHuFF1TZVt2R1K+XnYS5zt0DRx6rYfppbwN1O8DCIk7gYz 0QIGs2p0dY2KiEThh5pkdAApmEE7vjy+VFs7F7rRODyBa12gdJjEH/GrIFVxA9PTurG4 yPkg== X-Gm-Message-State: AOJu0Yx6OSdZLZ3r5Is3zhM3KeL/jn1dyCHH8AFnDTdXgtIiHg4w31JP 8FFyPZPUoZqZoRluUNQcIbfLOxenzCX45++Md8dQw9KktrNfR0tVAEe+WFdc2sCpSZqGFsAMNW/ fTnmpwVw= X-Gm-Gg: ASbGnctSdiXtvffyPzeY5DyWW8Kw1xdbSWmFaqLqhyL+hWaGSVQZKDocA1yt1IBw12e ZfomnCAz7fk+aM1k01vK9p5L3Y278epAhFId/n9akbnVVv5YH/W7pLblwu4YsPP0/9osS/eoTky tWxZmdnILDh3WXZaA9lqJ8bKeTx3L3+UktZDFOOsjdUD9lLlAvdsmqtflX0ZH5mh6FKBxxxeQ1y nfYcTlDxcXrMxAZAO0g7xEMHRFZLIeVQHmjnh2duPzumL0FAh7trDNwCcKd88xoD8OAHjxxK98k sZV8OatJEE2S6E9Rj16vn2K++EZb9yXK+UBl6c6o/RQbbsfmzDJ5YvM1qTo6UIDuZpSuGVTZaFT 60lUHh08Yt8DchwPeTdOMaYsCL/3gRpI0A+UjQiVG6wSmQ+BePBp2fLjUONAbXDii7X0QvpvwF0 poUkF97ZcPKOgkczv9rrM88ylG8qgTvmBvcL2oeN348kbYmYRKk0TaXOP4DOze X-Google-Smtp-Source: AGHT+IGwcgvDAlOJgBsVjkItwcjVZEn6dZgi4Cx++mTBncBTEJ6K72xgApGncveQ2KKXRQO6+GOShA== X-Received: by 2002:a05:6000:609:b0:429:8d21:5729 with SMTP id ffacd0b85a97d-4298d2157cemr187432f8f.49.1761224803035; Thu, 23 Oct 2025 06:06:43 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 45/58] accel/hvf: Implement WFI without using pselect() Date: Thu, 23 Oct 2025 15:06:21 +0200 Message-ID: <20251023130625.9157-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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=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: 1761224889663154100 Return to the main loop where we'll be waken again. This avoid a tricky race with signals introduced in commit 219c101fa7f ("Add HVF WFI handler"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/system/hvf_int.h | 1 - accel/hvf/hvf-accel-ops.c | 5 +-- target/arm/hvf/hvf.c | 76 ++++----------------------------------- 3 files changed, 9 insertions(+), 73 deletions(-) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index d842d4b2b99..c8e407a1463 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -47,7 +47,6 @@ struct AccelCPUState { #ifdef __aarch64__ hv_vcpu_exit_t *exit; bool vtimer_masked; - sigset_t unblock_ipi_mask; bool guest_debug_enabled; #endif }; diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index bbb0b385fe9..e9dd2d24745 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -128,14 +128,15 @@ static int hvf_init_vcpu(CPUState *cpu) cpu->accel =3D g_new0(AccelCPUState, 1); =20 /* init cpu signals */ + sigset_t unblock_ipi_mask; struct sigaction sigact; =20 memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler =3D dummy_signal; sigaction(SIG_IPI, &sigact, NULL); =20 - pthread_sigmask(SIG_BLOCK, NULL, &cpu->accel->unblock_ipi_mask); - sigdelset(&cpu->accel->unblock_ipi_mask, SIG_IPI); + pthread_sigmask(SIG_BLOCK, NULL, &unblock_ipi_mask); + sigdelset(&unblock_ipi_mask, SIG_IPI); =20 #ifdef __aarch64__ r =3D hv_vcpu_create(&cpu->accel->fd, diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 8c2eac6738f..d3d05b0ccba 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -302,7 +302,7 @@ void hvf_arm_init_debug(void) #define TMR_CTL_IMASK (1 << 1) #define TMR_CTL_ISTATUS (1 << 2) =20 -static void hvf_wfi(CPUState *cpu); +static int hvf_wfi(CPUState *cpu); =20 static uint32_t chosen_ipa_bit_size; =20 @@ -1715,85 +1715,21 @@ static uint64_t hvf_vtimer_val_raw(void) return mach_absolute_time() - hvf_state->vtimer_offset; } =20 -static uint64_t hvf_vtimer_val(void) +static int hvf_wfi(CPUState *cpu) { - if (!runstate_is_running()) { - /* VM is paused, the vtimer value is in vtimer.vtimer_val */ - return vtimer.vtimer_val; - } - - return hvf_vtimer_val_raw(); -} - -static void hvf_wait_for_ipi(CPUState *cpu, struct timespec *ts) -{ - /* - * Use pselect to sleep so that other threads can IPI us while we're - * sleeping. - */ - qatomic_set_mb(&cpu->thread_kicked, false); - bql_unlock(); - pselect(0, 0, 0, 0, ts, &cpu->accel->unblock_ipi_mask); - bql_lock(); -} - -static void hvf_wfi(CPUState *cpu) -{ - ARMCPU *arm_cpu =3D ARM_CPU(cpu); - struct timespec ts; - hv_return_t r; - uint64_t ctl; - uint64_t cval; - int64_t ticks_to_sleep; - uint64_t seconds; - uint64_t nanos; - uint32_t cntfrq; - if (cpu_has_work(cpu)) { /* Don't bother to go into our "low power state" if * we would just wake up immediately. */ - return; + return 0; } =20 if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIQ)) { /* Interrupt pending, no need to wait */ - return; + return EXCP_INTERRUPT; } =20 - r =3D hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, &ct= l); - assert_hvf_ok(r); - - if (!(ctl & 1) || (ctl & 2)) { - /* Timer disabled or masked, just wait for an IPI. */ - hvf_wait_for_ipi(cpu, NULL); - return; - } - - r =3D hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, &c= val); - assert_hvf_ok(r); - - ticks_to_sleep =3D cval - hvf_vtimer_val(); - if (ticks_to_sleep < 0) { - return; - } - - cntfrq =3D gt_cntfrq_period_ns(arm_cpu); - seconds =3D muldiv64(ticks_to_sleep, cntfrq, NANOSECONDS_PER_SECOND); - ticks_to_sleep -=3D muldiv64(seconds, NANOSECONDS_PER_SECOND, cntfrq); - nanos =3D ticks_to_sleep * cntfrq; - - /* - * Don't sleep for less than the time a context switch would take, - * so that we can satisfy fast timer requests on the same CPU. - * Measurements on M1 show the sweet spot to be ~2ms. - */ - if (!seconds && nanos < (2 * SCALE_MS)) { - return; - } - - ts =3D (struct timespec) { seconds, nanos }; - hvf_wait_for_ipi(cpu, &ts); + return EXCP_HLT; } =20 /* Must be called by the owning thread */ @@ -1982,7 +1918,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) case EC_WFX_TRAP: advance_pc =3D true; if (!(syndrome & WFX_IS_WFE)) { - hvf_wfi(cpu); + ret =3D hvf_wfi(cpu); } break; case EC_AA64_HVC: --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224857; cv=none; d=zohomail.com; s=zohoarc; b=Ep0aSQAEetSD66lGyoKFBnBViK5AQoTU9eAql0ndJMssXBV7g9N6zRlcb9DVKPGtD+GPd4qw2n2BQAuFl+7nCQEg9y5BQeV1+nQMseqOYpopceq8bYGpcwC/oCs3QR3YxNy4K/MY9Frf6yGJixFUVj136KxjjvZGolQ04fGWCZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224857; 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=kvnDiGB/ScoEzWWOO6VF5KOR9EI5aejneEWS4HSU6NA=; b=RKXEUEkPIbk6d4NXl5rn08fM+2sraySBLKmAnZtovVzE2UKkn2OATLwG4SpatLdioRBV3Qot1IWXrEnv44jlROSqFF7rmeOZAXxIuNXDWJ0dbCxm2Xv3Os1UGZOFLRPg89fZYd3C5F+rVtGSRuLvbsVwFwwSwQDdG7QjGtxcAsU= 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 176122485724746.72740771409963; Thu, 23 Oct 2025 06:07:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv1x-0001Z2-B7; Thu, 23 Oct 2025 09:07:02 -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 1vBv1o-0001Rp-I9 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:53 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1m-0006Jh-O2 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:52 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4711b95226dso8976735e9.0 for ; Thu, 23 Oct 2025 06:06:50 -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-475c4369b33sm95619935e9.14.2025.10.23.06.06.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224808; x=1761829608; 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=kvnDiGB/ScoEzWWOO6VF5KOR9EI5aejneEWS4HSU6NA=; b=vj30sYqjKlvn7J8J84v2U0E2XuGiqAmt5m+dDmGGmSA2J+2RsDyGZq6XYPocucSz35 WVc/Wz+3xTmnBw7szoNARLKu/3IM5m+qxYcLWpG1XoSZ67SGthJ1FTVohwz/zTG0iP32 G07nES6U0tv755j/ftOpbM5Icudqg3SnO89jWotOMhzqES4jrxYO2KChbWt1j1lzNyY+ IfwbPE+mEywNP9xVSWTsHJ+IWoCWn9yM/8j5pbHU8zMp7wSQxbZtbNLXbbXbQepaa3cf KQzzhlvojDyKXomCk7EDEmbe+QjL5yevsbTqpzvn21pvoHMjwkSV0jVKmqoqsjxCHw2x hULA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224808; x=1761829608; 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=kvnDiGB/ScoEzWWOO6VF5KOR9EI5aejneEWS4HSU6NA=; b=P+uHyCCNki3KS03rPl8rDwCYzqzctFcoBTZWG2X5kMLu1SEIz+f2dL5lagmYepMbq9 T3QYoBX3RJNlZDD4SPpJe53alzTg8NOACr+6PnQGJX5yPu5PNYkxQdpOqco/0D4a5uiV /7Mv3nZnoT8MvNMVQsI4fBG9U153RZcY3j/MlfZDEkvz4o6hv4MeCiG4eJXzP8fbEyiP h5CrHOTN5+Om0QuSr5w/AY/gN5Q47O2zJwdAKjmmTC6FC64h55uhuCcqeBmCQy5l3aq8 h5cT+ijdi6byIinjWiVet9VIZp1/EiFG5YWnKEJh6U6zCCjNKgK0EEpCwuEgBgyvfJAv L+Yg== X-Gm-Message-State: AOJu0Yxcl6bgGve6ycaBq0iwQ+K1E5L+ueMcivil/CCfYt9cF7gzqFSQ JyU4w5Ymd0cCGO3UBpGSAylPeUWjQjoWuUza048vaJo/LaP9NLRv+DeTezAMHZfjp7ZL7sLyksR 22fy/cvc= X-Gm-Gg: ASbGncuvXiKmDHFMoE9XqPC6AbI6WsK9atlZ3Y0wJdHJwk8KIXt20mUlzA0619K1Kpx WjkDGMwYUdjLLG3Dcd4/Bjpwvt9nYHLIsVmokbKWETuyfhjPYSl1Xl0f1ECysIsQyRH2plGjKQ8 2FD0Y19SqyNWk1KFGdWfKOKfoofW3+dyjFv6xGN1OVdeP03nxJP/vBLsPLHy5WSbx4n1XS6fNb8 J9ZgSj5lRUilSAIuLjHAO+02RlrotrRhK2aR1+668CoQZgpKem5fmuoERJUQRHMe3k2ys6gnhYp Mnmd4mEClBCsX+SmcgX94ogWNKbF70eBI9VlLxAjuEfxK3Stbiv2289c8mAKTunCoMOIO+gZeIx sx9wV7u0DLA+WBAC8PSUYtTO34iCgIZJ+t7T2Dhb3EZWBWin5+k3cU9AzMVJ16Mfo7D2KHIVzGy Mx7XqqvegfCY2GFsA/1vP0d2zUf0qGvUCk5z7pJApaKtDO8cEv4imlXeJ+39g/3TggXAD4Ng8= X-Google-Smtp-Source: AGHT+IG2XyxY5paEm73our2Qgpsle8ksGIFwPN9bx48OT2DZ2LZFl5eC3PZdw138qznEak6DQrA7/w== X-Received: by 2002:a05:600c:3b04:b0:45b:7b54:881 with SMTP id 5b1f17b1804b1-471178767ffmr161304575e9.1.1761224808519; Thu, 23 Oct 2025 06:06:48 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 46/58] accel/hvf: Have PSCI CPU_SUSPEND halt the vCPU Date: Thu, 23 Oct 2025 15:06:22 +0200 Message-ID: <20251023130625.9157-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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: 1761224858140158500 Return EXCP_HLT to the main loop. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/hvf/hvf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index d3d05b0ccba..b0918de5f92 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -302,8 +302,6 @@ void hvf_arm_init_debug(void) #define TMR_CTL_IMASK (1 << 1) #define TMR_CTL_ISTATUS (1 << 2) =20 -static int hvf_wfi(CPUState *cpu); - static uint32_t chosen_ipa_bit_size; =20 typedef struct HVFVTimer { @@ -1009,7 +1007,7 @@ static void hvf_psci_cpu_off(ARMCPU *arm_cpu) * Returns 0 on success * -1 when the PSCI call is unknown, */ -static bool hvf_handle_psci_call(CPUState *cpu) +static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); CPUARMState *env =3D &arm_cpu->env; @@ -1092,9 +1090,8 @@ static bool hvf_handle_psci_call(CPUState *cpu) ret =3D QEMU_PSCI_RET_INVALID_PARAMS; break; } - /* Powerdown is not supported, we always go into WFI */ env->xregs[0] =3D 0; - hvf_wfi(cpu); + *excp_ret =3D EXCP_HLT; break; case QEMU_PSCI_0_1_FN_MIGRATE: case QEMU_PSCI_0_2_FN_MIGRATE: @@ -1925,7 +1922,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) cpu_synchronize_state(cpu); if (arm_is_psci_call(arm_cpu, EXCP_HVC)) { /* Do NOT advance $pc for HVC */ - if (!hvf_handle_psci_call(cpu)) { + if (!hvf_handle_psci_call(cpu, &ret)) { trace_hvf_unknown_hvc(env->pc, env->xregs[0]); /* SMCCC 1.3 section 5.2 says every unknown SMCCC call ret= urns -1 */ env->xregs[0] =3D -1; @@ -1941,7 +1938,7 @@ static int hvf_handle_exception(CPUState *cpu, hv_vcp= u_exit_exception_t *excp) /* Secure Monitor Call exception, we need to advance $pc */ advance_pc =3D true; =20 - if (!hvf_handle_psci_call(cpu)) { + if (!hvf_handle_psci_call(cpu, &ret)) { trace_hvf_unknown_smc(env->xregs[0]); /* SMCCC 1.3 section 5.2 says every unknown SMCCC call ret= urns -1 */ env->xregs[0] =3D -1; --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224941; cv=none; d=zohomail.com; s=zohoarc; b=OTmdDPcRTymNMVZsJFbEAMYSkWm8p4+zQch/jz398hTSzD9lALaQE6d/AJwWKGOJXCJjpDnofYFV58sMYVRhUFEtdpU1dNkj4F3CDqcylL57RSnOP89KjuwqV2WqGK/dS6yjWHvhBlzfyLKMYXJg4cXttlCj5mTgynPJZ4SxrCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224941; 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=VvTtMqMAFWvn5LLkR/vIY7avxcTn9pA4YCh2pIIZxqY=; b=eFS+eszHcl5IlW1xzvM2Nndld0B/qXjc+0KL9M0fLbJ7cEGmhbrJ6hRfQjW/MNpcq7wTHGOU5IlCgV8F96P/jrb6LOqySZlttTBnilbDEQAV624fAV+i6KIU69PWSMdk5QNlat5edHZBFWnGpdFGx3CD5OgrPnvxBZZY7iwYEWw= 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 17612249413335.178659373313849; Thu, 23 Oct 2025 06:09:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv22-0001dy-0d; Thu, 23 Oct 2025 09:07:06 -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 1vBv1u-0001Xq-AL for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:58 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv1s-0006KW-4P for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:06:58 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-475ca9237c2so4520935e9.3 for ; Thu, 23 Oct 2025 06:06:55 -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-475cae9253bsm35607955e9.1.2025.10.23.06.06.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224814; x=1761829614; 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=VvTtMqMAFWvn5LLkR/vIY7avxcTn9pA4YCh2pIIZxqY=; b=bTHH3u9w4Pht+fB6DzdM3ntHPn5OCsJQU795TYP+XVr3cOPooZpUvvp8zY9TsXCpH8 Pug1BxStbNmYz7V4HSpHNqUTeiCHOsfBvdAQ7i41X2SYuonDWZcgy5skpHU8NLxaZwzj FdKti6zvU8lJWozlUHQUyTXFtoQxmgG0gG9TslkHmPidXUoc+E7t0o8k35dMp1EAW4X1 sBvsm5RD8X6cuIpmjc+/7VNaNp8plXF31veGS3HkAGRLTYjACf+o6M24hOBGEOcxtE2n 4qXIIj6wxd9QMAyMvbhLMQT6clO9yvioi1d+ph+4FYesuOacw9Mje000d3xTkrb0r2Wp v3wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224814; x=1761829614; 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=VvTtMqMAFWvn5LLkR/vIY7avxcTn9pA4YCh2pIIZxqY=; b=iEgthfwzEOCFiVA/e0BCatgJTVgNlYIm602yJW64ESoO83OIP9xkRhaA5ZJ3tfMLGK ZGD60OA3Aac2SN+F20YE9FdHgRQz9k7oAulSVAXYkfXUIUY6mVrdNcwfvRDXvGVpp7uT uW2jGJ1Ph2xR7CnZU2gMkY3O2atkKqJwaFpXqPLOWQ19mdwXgN/OaXHphn9skigFmBh3 KpXxXo6YL/OWqziI58MACdqmgyWfOvfNlqVs2tdmo5gzSmEd6kOePrH39QdXSE6sBvZl Wp44ePSvXwQqwp6V2GnA0YjzeFI3PUmS38DfHsb51C+bhtCPEQcEmkEV5A9z8XdhCXyf uELg== X-Gm-Message-State: AOJu0YzWPoXWsj7x5NztCgeQqu6WAhRYsuHnFvDbfj3CUiBZYWys9YWG C3lMII8FEjzDklcpCPhJ6IQa49DQprMKCWpxJlcTr4lHT4tJeH8gmEDdxiYMX6dPfsgRdnP1t11 i5N2/nV4= X-Gm-Gg: ASbGncvKmBS1ClLyx7UmC33c29pYBStsGPpAs638MD1xyOwP2eUJlSD4OZx8nvJiNor ORrx+4LMrSzOsGxpfDn2LagKtFCHNbKqZUdwVWbvUGNyJdadPIyGCyyfO+moJWJUOh/D3VDlmEh 6LXGcuLSv+mrbj5uh0StvmEHF6K/V5GcMnKaHPh7WapahdoMiZJb6ZvxNwBrKNPsSZqKNOeBYW3 k/jiy1llK0RaHLjVgjbHZ27VrvUetXAosNjLfs01cnGtw3spyNqwYu4lzcoXm0TtbxJiG8n6MpW QNmxWn5xjVS5foUQZ8I6ZS6GtOHT7OkiRGEleZ5ksaZuq+wKlAUDzNfLBueEpbvEva0ndiyelFW TjwqeyKKbs2MEJ2bGyffCcYFPYk3bAIAu8hrWR5slz6CozXECYzs/r6CAvUcIlQuj0soSg4xkWb 3sQFGxJIY70boe0pYP0viLSnfjIBkkO/zMsMMazTPBFsH7BnosmA== X-Google-Smtp-Source: AGHT+IESrMJglDcfDuyTU5fVqNkF2Joo3L8KXHN5lQ0+HPu1mF9z8qte+JgkSyruDKu3pENu8N7C4Q== X-Received: by 2002:a05:600c:8284:b0:45d:d505:a1c3 with SMTP id 5b1f17b1804b1-47117920935mr192868025e9.37.1761224813604; Thu, 23 Oct 2025 06:06:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 47/58] accel/hvf: Introduce hvf_arch_cpu_synchronize_[pre/post]exec() hooks Date: Thu, 23 Oct 2025 15:06:23 +0200 Message-ID: <20251023130625.9157-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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: 1761224944779158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/system/hvf_int.h | 4 ++++ accel/hvf/hvf-accel-ops.c | 3 +++ target/arm/hvf/hvf.c | 8 ++++++++ target/i386/hvf/hvf.c | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index c8e407a1463..eab443aa91f 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -71,6 +71,10 @@ int hvf_arch_put_registers(CPUState *); int hvf_arch_get_registers(CPUState *); /* Must be called by the owning thread */ void hvf_arch_update_guest_debug(CPUState *cpu); +/* Must be called by the owning thread */ +void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu); +/* Must be called by the owning thread */ +void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu); =20 void hvf_protect_clean_range(hwaddr addr, size_t size); void hvf_unprotect_dirty_range(hwaddr addr, size_t size); diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index e9dd2d24745..744a5288298 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -181,10 +181,13 @@ static void *hvf_cpu_thread_fn(void *arg) do { qemu_process_cpu_events(cpu); if (cpu_can_run(cpu)) { + + hvf_arch_cpu_synchronize_pre_exec(cpu); r =3D hvf_arch_vcpu_exec(cpu); if (r =3D=3D EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } + hvf_arch_cpu_synchronize_post_exec(cpu); } } while (!cpu->unplug || cpu_can_run(cpu)); =20 diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index b0918de5f92..c83bffe46ad 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2009,6 +2009,14 @@ static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu_= exit_t *exit) return ret; } =20 +void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu) +{ +} + +void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu) +{ +} + int hvf_arch_vcpu_exec(CPUState *cpu) { int ret; diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 4597d191f9d..de5e8b45d19 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -722,6 +722,14 @@ void hvf_simulate_wrmsr(CPUState *cs) printf("write msr %llx\n", RCX(cs));*/ } =20 +void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu) +{ +} + +void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu) +{ +} + static int hvf_handle_vmexit(CPUState *cpu) { X86CPU *x86_cpu =3D env_archcpu(cpu_env(cpu)); --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224942; cv=none; d=zohomail.com; s=zohoarc; b=Dj+tOyovnkNDcyJc69o19JOZ/iwmr5Y7W2968/WE5q15FXM/GtGfIfco9etrGSMtl5hLcBrdkpV4yuKmBrymlHI5ohipwhrcDxu2wztxUq/JZwJpdJvJXpnJ+8aBX63ifuJyg62Ait7Bjx9ssmQfwOHHowrhmsKPikxjcdiZ8H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224942; 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=4+rsabIigu6ZJnpLHCrRrLyKuMoQRw52Umv/dM+Zp30=; b=JEdWcovbmEX/2hEEviaJ1W0G1GabXUrDeCrqEkTCWkUFCc0k+LOSw5dGzgYxQxgpmOVRLUfDZsOGmlVx/6T1HkMalpEA84wr5ixp1IjbUOOwnjFk3wH20vca81bQ5PSJWRusP/QZPIRhYPic9aYcyBj9FfPgKQrtpepfRTvWCVg= 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 1761224942270954.431423051135; Thu, 23 Oct 2025 06:09:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv22-0001ed-Kg; Thu, 23 Oct 2025 09:07:06 -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 1vBv1z-0001ag-8S for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:07:03 -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 1vBv1x-0006Li-Cu for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:07:02 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-426fd62bfeaso398924f8f.2 for ; Thu, 23 Oct 2025 06:07:00 -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-429897e75a0sm3907266f8f.5.2025.10.23.06.06.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224819; x=1761829619; 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=4+rsabIigu6ZJnpLHCrRrLyKuMoQRw52Umv/dM+Zp30=; b=jUopyDBkRSqhs0VxKr4t7L1mvxivATRgJIeaMjtIecllx1/4Ptf5yLvj1wgoWL1t4Y GUm7rDpxBKmaSTvNCmIKYj2fcH8ZunGnffKiErqqsfwEsfg0va2a4Eu7otSIThDrWcCT 12qrs1JKDyXTHYfVWyLKq5beyRDuMT6LnRnW5XxpIq68srXcDx3A71y6opG0mvE8Rby1 xY4klzBXyxkwVQFOtjqAAzcBKag+YPq3icWDL3GWhvWW0x0DPa7OLnEp3YmRdV7TreCt ALPicvRKMJMU5ORDvumjJl26i5qk7UgH+XRj1805uJZ+kbJoQy58nmf0ufM89WQtVrQE abLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224819; x=1761829619; 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=4+rsabIigu6ZJnpLHCrRrLyKuMoQRw52Umv/dM+Zp30=; b=fZ+QIB0CcaTQ2BfRe4pVadEnXMOQ20O38XtXIeNy4io474GLQYjXFE2OLweSRXET8r oG5RsHnqm5mm7kOF0P2/IQw1yBIDSO3k36zhQV4+/KR2suIP3TgtHExnVzPvYIMdGI5d Z3G8cLfYYoUCN1tdWO1nb9p/8kEigQUvgs9LKx20TlAU+KxtrJ9vW1I3e6hAsrBb+dTb cE1cZm96Wgyp4h28PpwtBik3EvV79h+J4cSPblxM5OE0XVMJQHmgD1ARQh/83Cd8ZYOr ApEHv4Ov34jsitXBcl2l4oIGobInTW03TZ9TnGfFB+2+ha85/Oj4mGoK1oOudNOk4EXH eCRg== X-Gm-Message-State: AOJu0YxRY7usD7EVVQmKHuE5DR4Oz5eQ/8YX0sJ2g+Tg8uxzmiU8CVIv fzvtDT8NsYkxF0YyZGL57vsLSXJbM4v+6HJxMayymvkulg5IcKz/+qhem6jTVm1eJsJBBcTP04z rQ2vefUo= X-Gm-Gg: ASbGncvrlb860DpI/1VGB5YkJeTyW3fpDHCL+D+jTQLSZDucRop5H2PaWsmVj1dLb1c lDaImCYDnLhSH9MFHD44lDEgBFsaNk0u3Ns8mA40QcUawQsoQgavALo5wkonXM+VNs9ace4SWcX Nrg6OB6dKRcYtz7DOZ8FsDvhfl6peiBhS7nBRc3WU1NwlzP04sZQajIrhaRazBQi68fFWpD5mED yr/bv4KIB5bo5U+PDUxSIYIpWWrQRO495CNQWI50uj0IDp+MLev0CXR4J0N2jNLgC0hL6k+h0Jo pAk66oT7edYRY4AfRRsFr+Smkfn6n1da9KlhsutdEuEsTz6GnuhzXPNa0/I+iqh/7GEzam5RZ0Z Rb6D41p1nMjdobQ73S8bR+A5vUESQ3pzx5q09eiW8bEUMePkDrFRddCwoa1aauT1fgqds9M72Zn FHXmvjY5J4VFGurbl7cvmXwUzJs8rsKiaBNoT5UxdYgY5ocx1wBw== X-Google-Smtp-Source: AGHT+IGujqbM2RjXJVAlLc70jZzuclKeSYJAFCyTf0DJOu/4srF0T9E+27x0dv/yqZGAmaStfXL5uA== X-Received: by 2002:a5d:5c89:0:b0:426:ee84:259e with SMTP id ffacd0b85a97d-42704d558a5mr17702757f8f.24.1761224819006; Thu, 23 Oct 2025 06:06:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 48/58] target/i386/hvf: Flush vCPU registers once before vcpu_exec() loop Date: Thu, 23 Oct 2025 15:06:24 +0200 Message-ID: <20251023130625.9157-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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: 1761224943220158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/hvf/hvf.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index de5e8b45d19..8acdfa952c1 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -724,6 +724,10 @@ void hvf_simulate_wrmsr(CPUState *cs) =20 void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu) { + if (cpu->vcpu_dirty) { + hvf_arch_put_registers(cpu); + cpu->vcpu_dirty =3D false; + } } =20 void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu) @@ -983,11 +987,6 @@ int hvf_arch_vcpu_exec(CPUState *cpu) } =20 do { - if (cpu->vcpu_dirty) { - hvf_arch_put_registers(cpu); - cpu->vcpu_dirty =3D false; - } - if (hvf_inject_interrupts(cpu)) { return EXCP_INTERRUPT; } --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761224857; cv=none; d=zohomail.com; s=zohoarc; b=Z4O438IBIiH4YIuYpWfZDB+uorQFzeGZFD9TwW6H8Prx1WXSo2JPX/0Cv4eNUKUQrGIiDEHX/j09o2e9hcrcf+WAeJt4Hn6PFnYumXuRpixhgzFKCBpt4LRQRf8Lp2wS8QGttI5moi7Gk+jsSX9rIoLMtCpU6JcZExlCeLfvLwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761224857; 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=cUD9VjEjc/+uf3h+hW1mjHVxk+h9JxXhL/sKrTHkMf0=; b=euQPCIUXtv8VIsxGjS5fMTJqE0EF4/yuq8f2R3V8qGRico6CMsphPNklKj4d7PdUZIgml+T+hcfAyv5dZfSdHIe9bx23KY8t8+HxJ6wFqieEWVDtcM9Pva5BRPzMvacGMBx4IoNCR1nNF5ZtL+3Pt0oZp3ZVwwyXfIDMPlnuYDI= 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 1761224857247911.065374821756; Thu, 23 Oct 2025 06:07:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBv25-0001hb-Hr; Thu, 23 Oct 2025 09:07:09 -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 1vBv24-0001gf-6T for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:07:08 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBv22-0006Mg-7t for qemu-devel@nongnu.org; Thu, 23 Oct 2025 09:07:07 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4711825a02bso6620705e9.2 for ; Thu, 23 Oct 2025 06:07: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 5b1f17b1804b1-475c4281314sm96584315e9.4.2025.10.23.06.07.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 06:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761224824; x=1761829624; 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=cUD9VjEjc/+uf3h+hW1mjHVxk+h9JxXhL/sKrTHkMf0=; b=GCJ/GRgpDsjh9xA1uIy9R2HzW0BAItUg2P+I8ZzOWPrJbOT+IuL1oVtiSQT/jcpt+Q bUICuH52fiAmpraKMYM/7pijKgmgDophvU09eHqQCQ9rH2HgA3fEYPG/5lSI6V+EiBQf IGMvNZj1xsXqFkDi47MlEqbEwDoihom510rl/iUrUktANqyBkM0ThHt/ovMNe/Jq7DG1 MrRRDQCIoRJek+aAxRNBPxeaBN/2AyzjCGL/IyVFU0RE82VW75YNMnFuv3tEduDT1ric QzCBI8eBmBYk3xXO1CvijZ8pUOe3WBPr8bgWcoHzcEqDKBVIYjaWQHdPTMx57n5UTSZW 5nDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761224824; x=1761829624; 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=cUD9VjEjc/+uf3h+hW1mjHVxk+h9JxXhL/sKrTHkMf0=; b=m8PRA3N8aOIC/QxfKhML7WvMwa5KPztONAK8iA/v5y2zNh1ZTcE6edw17ulCSCcp3+ 4dFlFXKI/VguZXRfPt88CMuJGavy2Psrs1oYLSARAL16IvY+e/J9WJxhiIDDFqenfj3a U+l3DL8Cj9fqiff2m+VMVWKjF7ULQ/4HdyaRDiXcWDO3F32/XyEME1OQV5O4Dfu1n1ID KNxi3EunjCl08MzIx0SnifLh//Igtv2+h+70EbXwWByrDjnYP5FH+63VZIKaRj8RxdQw 65xKKnJhAXEdSUrdIvZ1Jc3PO3l+I9S2od0gbLekls3xHGKQ1j54izTHe+NS+6NblQ60 O/Hw== X-Gm-Message-State: AOJu0Yys9jJ+LI3+WntvpSKzoHQezrQF1FjPqsXllPElvX2Qsp1eTk9X jCnWbK8poDcGa5iQRNY3WKOpAKzm7PoUeZxTo/iLnm2QvKeDlHDmZWgy8bpRDXRRSqJPVysartf 2Wlyf67M= X-Gm-Gg: ASbGnctkQGwrRvhjEwmTsn3Qf0lZ3s4VAGaC3v1QuckPVbdizQzz6ouIu4MyMusqM11 WqBTC4/GAQY7nCRpw/+x7/1MepnUqaAdtXypOI2x0rcSaPIfNbdXhuMWxZdshwNHhDxt19NQ1mX YvXweYVWo5w/aUyYuCd40O/zxNNKo3xZmtR4HIvUA9kf+r0HOlIOm2aWIT3z3GmtL7GhnA0Zf5p kg3CLTtqQVqBQfND6kEguOYK/Rlhsw5n5Aa6YCy9BJFrLnuGOXtIMk3rJy6vLTjDMZocbCJr368 2zZGer6vQM8EN4kmNSpHA6l+PIMJxBdbpqKPgD3udCJlGtaQC8vn43vJmt8mRhmFgJiOA85Mhye 2j4/9ZdXh5MYOyVzolEwcfCNHPdOJU3JjfeGYTq1gqy7qgmuDv/frT2NjB4TJtlrKufH1X5Bv7C R8c9AwP+DdokAoAIpdn9jC08Azev/of9zH+QDTQDBgvyxSGLFDTRcfnNVkFVSP X-Google-Smtp-Source: AGHT+IENDPQ5lhOGTVg85xuMpTGQAYdvenEYRDfQGhyjdalAp0NV2em7ZAGR2Wy79H4xgqIFNeHX7w== X-Received: by 2002:a05:600c:818f:b0:46f:b42e:ed86 with SMTP id 5b1f17b1804b1-4711791fbdemr173502435e9.39.1761224824197; Thu, 23 Oct 2025 06:07:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Mohamed Mediouni , Stefan Hajnoczi , Alexander Graf , Peter Collingbourne , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , qemu-arm@nongnu.org, Mads Ynddal , Phil Dennis-Jordan , Peter Maydell , Roman Bolshakov Subject: [PATCH v2 49/58] target/arm/hvf: Flush vCPU registers once before vcpu_exec() loop Date: Thu, 23 Oct 2025 15:06:25 +0200 Message-ID: <20251023130625.9157-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: 1761224860823158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index c83bffe46ad..36fa67caf62 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2011,6 +2011,7 @@ static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu_e= xit_t *exit) =20 void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu) { + flush_cpu_state(cpu); } =20 void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu) @@ -2026,8 +2027,6 @@ int hvf_arch_vcpu_exec(CPUState *cpu) return EXCP_HLT; } =20 - flush_cpu_state(cpu); - do { if (!(cpu->singlestep_enabled & SSTEP_NOIRQ) && hvf_inject_interrupts(cpu)) { --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223286; cv=none; d=zohomail.com; s=zohoarc; b=czvAFyqvDEbxVxBUPl+lJZHkcx2Zu6ZuvgDfWLLNH+YiohK2NMigpjZbiBBQfqN3V7MZE0PAWY/z71CJoIEwrewbTZcmxZoesnllvQjNDr+34xwFBj6OpE7+N17nsTkXvOa3wJ6e6pqRI6iePpADrQna7o6Y+eN6GClKqzXTy6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223286; 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=P9xBVWd6FRt+OGCLZ6nEzr4EP/14LH00UlqrogCUybs=; b=N6uf+TvY5sPqa6lk5qcNoqBqG4CMhAJBwYXjYj/qcAlzjTb4ijUb/MtPo4gt8X1xCkWeug7gg7O3X1cqkAeJkiqdPoh+hc/qEbhBU2oIAB+5ZZHPGjBzW/k5nba86+xaVWQLiCTjL7cNxZrFhIV2mGHQ3ZQnewLf27FOgeZWPdo= 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 1761223286122170.91431661776494; Thu, 23 Oct 2025 05:41:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXF-00016M-8T; Thu, 23 Oct 2025 08:35:17 -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 1vBuTz-0005HN-Qr for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:00 -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 1vBuTt-0008O9-EF for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:31:55 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-4270491e9easo529109f8f.2 for ; Thu, 23 Oct 2025 05:31:48 -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-429897ff371sm3744166f8f.21.2025.10.23.05.31.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222705; x=1761827505; 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=P9xBVWd6FRt+OGCLZ6nEzr4EP/14LH00UlqrogCUybs=; b=szpLmfg2FC2G7G+igeW45fL7idbOcuRAt1Pc3SO7bF6x7DShjORFITgZgnBX16E2nR UihLWS9qucJ+p+vKF0BeRPVk6hj4B/DpuUNsmhqlczO7kNV1J1bOYxzEILLJB+CheXLs vBrjIMByAmyOt3QV4ScXBdGaeF5tO6+3boD7VfFh/VKUF1MW8BlehrQ1ui7GSdlc97fR QF1aKMRrr0nhRgF9Tiu7J1BzGjI1yCcbijC4xlibIUdDoh9dWGv5XKVABgETOAYUkhVo XV3pzdf9zq0fFL5fc5+Z+t1zSqWupgR8B2MMygkG0ic7mc2UuUrVUjUEOl3j+Mb8x4y+ mImA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222705; x=1761827505; 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=P9xBVWd6FRt+OGCLZ6nEzr4EP/14LH00UlqrogCUybs=; b=JGPAD3dDR1j/Skw+xg/YoHOQ9Yiq9S8/nltgxqZS9tTRZOSO1tvam9pfEVvzdiiD6s 5ZqlJmfjYTVTiGWM4/XEjqnBX1Oa3UNy1ULhM3aup7m6vGYDkmOC6q9Mg83NnJsmzfiX 5/4PMzsYlPBI6ESp21z8EZLnZxEb4tfXz4XMMwcqjVXZ+0WwfFeO0DeQJhDpRfH+JI7y YY5+FtRuXdjKoWHSrDRqx86mRNrYbQ8itD7bWgWGgEmNRxrXqff/xyr5SaCV5Hhe9KAU 7Cl1e886TONWZYXPPTXD+eBscUMCflSZj1yrT80M099hw6dKbaIDI7ECX+4jWyJFDHXu XzpQ== X-Gm-Message-State: AOJu0YzGYNnIwS/Z9PWlRxMuoL9s4t1gtLoXhB2dCnYdjv8sV6HCih40 +lVFAogs+51dhTQt4UQwubB+IIOFh8PuXS3iy76qQpkYrPOBQX0z6CjTuJC2gZbPqieWFh7vtIW IIkXNaSI= X-Gm-Gg: ASbGncus+aWK+vOebWOvP7gjY7SN9jSz8aalVLgyMh6V3KWFdwGm7AOhhfdn4hkhC9F p1dneWPGgYdxHVfZGND5O3nle9VxIVyOmtf5U8/NT1oixsoZ8ktfh4t25eTyaWkaPTuaT6IpXjd oj2LMrWooOUDizPMWXSNHIUydLNdUaiTtQVcQmwHnwoVBVVe76fN4AUFHHQkwvY6oKWJ09gZQdW m04+S7UrXhvIAh4ScEF7mlcr1B5MzRdxiR0fhhlFln1Gt8cncfUWzwrUGXkoTaM7/62D+dj05PL H/6DPQ5BeJbMeaWkCzRgotcQRwrAwhTLZzwiQZhMLrYVkVtQ5EuZLC4BNtkYf/f6c416QBxDtr5 Hd4w5wABapehSCZZ+N2CsNiYSPMJez4YcTZ05HmyWDS7oR5DqmiAcp+Tehts4K64gJKpBagicaK mpwED4GPVqU6cvYnU9FYRLJbfasCGAlVWVg0T7ph0cbT0P+AC+9g== X-Google-Smtp-Source: AGHT+IFepACm3K4zjIZUTmac3W2rSbj15b968A/27aOp77LvhZzzmOLCvTNXq2XWyWm8tmCnMF9LEg== X-Received: by 2002:a05:6000:428a:b0:428:3cd7:a336 with SMTP id ffacd0b85a97d-4283cd7a3a7mr14311255f8f.63.1761222705120; Thu, 23 Oct 2025 05:31:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 50/58] accel/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0 Date: Thu, 23 Oct 2025 14:31:34 +0200 Message-ID: <20251023123142.8062-1-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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=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: 1761223288018158500 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf/hvf.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 36fa67caf62..dbf6b83532d 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -201,6 +201,9 @@ void hvf_arm_init_debug(void) #define SYSREG_PMCEID0_EL0 SYSREG(3, 3, 9, 12, 6) #define SYSREG_PMCEID1_EL0 SYSREG(3, 3, 9, 12, 7) #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) + +#define SYSREG_CNTV_CTL_EL0 SYSREG(3, 3, 14, 3, 1) +#define SYSREG_CNTV_CVAL_EL0 SYSREG(3, 3, 14, 3, 2) #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7) =20 #define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4) @@ -2009,13 +2012,49 @@ static int hvf_handle_vmexit(CPUState *cpu, hv_vcpu= _exit_t *exit) return ret; } =20 +static void hvf_sync_vtimer_pre_exec(CPUState *cpu) +{ + hv_return_t r; + uint64_t val; + bool b; + + b =3D hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, &val); + assert(b); + r =3D hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, va= l); + assert_hvf_ok(r); + + b =3D hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, &val); + assert(b); + r =3D hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, val= ); + assert_hvf_ok(r); +} + +static void hvf_sync_vtimer_post_exec(CPUState *cpu) +{ + hv_return_t r; + uint64_t val; + bool b; + + r =3D hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, &v= al); + assert_hvf_ok(r); + b =3D hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, val); + assert(b); + + r =3D hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, &va= l); + assert_hvf_ok(r); + b =3D hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, val); + assert(b); +} + void hvf_arch_cpu_synchronize_pre_exec(CPUState *cpu) { + hvf_sync_vtimer_pre_exec(cpu); flush_cpu_state(cpu); } =20 void hvf_arch_cpu_synchronize_post_exec(CPUState *cpu) { + hvf_sync_vtimer_post_exec(cpu); } =20 int hvf_arch_vcpu_exec(CPUState *cpu) --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223032; cv=none; d=zohomail.com; s=zohoarc; b=Qj5UBN6Az3Y4m4gjtqggzwbdpVC8j0eBN9fv+zvJUjpnmNysZi1FuHGPs9fWcsFDMT65ox4oNGAgfdLLZQ+70UIPq3r5VVzVXfwXQh4+ontkIg2Fs9kAUD2oYbsaHKb3TT8EKAQHa358MEXGlOQaiO+rUL867don9dJM3KdBXvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223032; 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=YDmYw54TK5jSiAes/7YC6P5tTS/ucyoXkoDxXUlAez4=; b=LlyZMfmJ0US4/BpKziCVKbOpTvLert5vHK0A0PfIKNeBzeEThxxpRGgXiwG9VYk+5fEahdJNtxIEsBobyF8tIqBnINWMaRPRVyNhaIAgCURelJFfgB8ZZyBHZF2Rc+n7kIRXZ9ODYstyi58tgnZbAF53Unxa20VJvYzqCDN9714= 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 1761223032579854.534572055474; Thu, 23 Oct 2025 05:37:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXL-0001Oe-7J; Thu, 23 Oct 2025 08:35:23 -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 1vBuU1-0005Hk-9T for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:00 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuTz-0008OU-2i for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:31:57 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3ece1102998so525985f8f.2 for ; Thu, 23 Oct 2025 05:31:52 -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-429898add96sm3716004f8f.30.2025.10.23.05.31.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222710; x=1761827510; 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=YDmYw54TK5jSiAes/7YC6P5tTS/ucyoXkoDxXUlAez4=; b=LjDZbiHpXzLv/ChTLfGlxK5q1aRkPphrtnrA//qkZ7hgWjzP2l8aIKxFkc4DTQ/AWM /D4nEpkXg6tAM6+Ty7X1hHZZu373Pm+sTgPvDgoEX7OBLpKnoBR1TPw2t5ru+kMJqt6R n/EgpXxgGZDkkWYhRObObYCAkeD04qjLKNtOdlozRK2SK4Abgd19NdbEA2i4QDB9731n /Ghrabu2OGnQp15FyvLqgQhkM2tZN8VR4UoZW0lFHdH2LrGTFhEVk5lafbO6hGFYrux+ f+MisFnDijSb0GXytbQUDpTGcvtev3poqrXUxb/gCit6C7t5EMA1WBhVkAORiY/GaISd 4pyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222710; x=1761827510; 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=YDmYw54TK5jSiAes/7YC6P5tTS/ucyoXkoDxXUlAez4=; b=KeiOcRdhuXcd0nDosBnKRzo45QROrPmvpHJ/rZ8o3UwiWgr++SAA39iNLsfWH9Nz5I uTafyU7zetSRaRbdvK+w2+6DHk8vVFJFYU+9PyzIM2V7+n8GqJdet2oU/fgeiekUmbAx DtLGCjdgnMfr18wUO4QtZs2vk8pGemdfMhnvo1hZ50YCfnDlbRplNWd0IG0LqsZ1xDag AG8mfk/hG8esB8+a1LcRoj/THnv0GRxrTjZwidKKK+OaCuxdtpeKsbRI9kmM9SZeqV11 jhLYZfca4ip1cpYEljU7x2UmKZQILhCUtLLXbRxpbzUvkVqT/Y2c33DZEfcotFE0hW/C 5zrQ== X-Gm-Message-State: AOJu0YzgQkP8iLMzmK2dzkFltg7fP2p1df6Rhv4eDXr66+IS8BmXhpKo hRn+6MnBY4bop2lEKr9JugQqq/fjaSPrcVXJ4suu3OfrXMK4Gc0j1hyQ7wOW215HDP7OslwfOid 5mrwPHvo= X-Gm-Gg: ASbGncugSapoC/23FX4FTpFqkXpwI2dwZmQkPmxgMDAShEODxt3J1DuQB8YXx3qFifh +KMNqTbtdYyTMmhgWCsdtg136t+40r/S4iBGctEOlhLdtf2YfqycqPVSbPEVVx8W99oKC8qLNtO 0Pt707DEmg2WWtoo6T8u/5s45qf9FE4bHu+iQMRjJsUd+wzSJfBC1pSBPv47HG3hRGrBLzOcveV LFL1TFsCvo7K9w+k0fYao/59pIkI/t17azQB4/QTeZIjLnBsDuBL7NXSCsI+0UCHcjO9VyY0y6I /0SoV3UNFDSh5X5Lkk+LmPhutLYeDbihmLUveiALF5qzQfpKcQM0xwnVYOzgzUBEI3CQ2BfjSku Iwoh06myy8FOiNJNCbbUz6c4+NpyBnj++/6KIq4uqdaEJ90j4IX4/5FHXo85KnE2Cm/ikvSpPBN s+ha4SzDyLtxdINyW3IPNX6w39yCMpwwqi8N7Q5agIW/Ic8PLsgw== X-Google-Smtp-Source: AGHT+IGGIR/0SPECtQT4Jff1V+N/nTa9ysFMFejsJuRkzH7znWUcHtDVIOGN32PvjaO4+QCmua0g5A== X-Received: by 2002:a05:6000:2510:b0:3ee:15c6:9a6b with SMTP id ffacd0b85a97d-4298a0c60e7mr1426429f8f.48.1761222710233; Thu, 23 Oct 2025 05:31:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 51/58] accel/hvf: Model PhysTimer register Date: Thu, 23 Oct 2025 14:31:35 +0200 Message-ID: <20251023123142.8062-2-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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: 1761223034337154100 Emulate PhysTimer dispatching to TCG, like we do with GIC registers. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- TODO: audit it is safe --- target/arm/hvf/hvf.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index dbf6b83532d..cc3f22ac542 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -190,6 +190,7 @@ void hvf_arm_init_debug(void) #define SYSREG_LORC_EL1 SYSREG(3, 0, 10, 4, 3) #define SYSREG_CNTPCT_EL0 SYSREG(3, 3, 14, 0, 1) #define SYSREG_CNTP_CTL_EL0 SYSREG(3, 3, 14, 2, 1) +#define SYSREG_CNTP_CVAL_EL0 SYSREG(3, 3, 14, 2, 2) #define SYSREG_PMCR_EL0 SYSREG(3, 3, 9, 12, 0) #define SYSREG_PMUSERENR_EL0 SYSREG(3, 3, 9, 14, 0) #define SYSREG_PMCNTENSET_EL0 SYSREG(3, 3, 9, 12, 1) @@ -202,6 +203,8 @@ void hvf_arm_init_debug(void) #define SYSREG_PMCEID1_EL0 SYSREG(3, 3, 9, 12, 7) #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0) =20 +#define SYSREG_CNTP_TVAL_EL0 SYSREG(3, 3, 14, 2, 0) +#define SYSREG_CNTP_CVAL_EL0 SYSREG(3, 3, 14, 2, 2) #define SYSREG_CNTV_CTL_EL0 SYSREG(3, 3, 14, 3, 1) #define SYSREG_CNTV_CVAL_EL0 SYSREG(3, 3, 14, 3, 2) #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7) @@ -1231,16 +1234,20 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t = reg, uint64_t *val) } =20 switch (reg) { - case SYSREG_CNTPCT_EL0: - *val =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / - gt_cntfrq_period_ns(arm_cpu); - return 0; case SYSREG_OSLSR_EL1: *val =3D env->cp15.oslsr_el1; return 0; case SYSREG_OSDLR_EL1: /* Dummy register */ return 0; + case SYSREG_CNTP_CTL_EL0: + case SYSREG_CNTP_TVAL_EL0: + case SYSREG_CNTPCT_EL0: + /* Call the TCG sysreg handler. This is only safe for VTimer regs.= */ + if (hvf_sysreg_read_cp(cpu, "VTimer", reg, val)) { + return 0; + } + break; case SYSREG_ICC_AP0R0_EL1: case SYSREG_ICC_AP0R1_EL1: case SYSREG_ICC_AP0R2_EL1: @@ -1553,19 +1560,20 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t= reg, uint64_t val) case SYSREG_OSLAR_EL1: env->cp15.oslsr_el1 =3D val & 1; return 0; - case SYSREG_CNTP_CTL_EL0: - /* - * Guests should not rely on the physical counter, but macOS emits - * disable writes to it. Let it do so, but ignore the requests. - */ - qemu_log_mask(LOG_UNIMP, "Unsupported write to CNTP_CTL_EL0\n"); - return 0; case SYSREG_OSDLR_EL1: /* Dummy register */ return 0; case SYSREG_LORC_EL1: /* Dummy register */ return 0; + case SYSREG_CNTP_CTL_EL0: + case SYSREG_CNTP_CVAL_EL0: + case SYSREG_CNTP_TVAL_EL0: + /* Call the TCG sysreg handler. This is only safe for VTimer regs.= */ + if (hvf_sysreg_write_cp(cpu, "VTimer", reg, val)) { + return 0; + } + break; case SYSREG_ICC_AP0R0_EL1: case SYSREG_ICC_AP0R1_EL1: case SYSREG_ICC_AP0R2_EL1: --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223032; cv=none; d=zohomail.com; s=zohoarc; b=c2kwNfZl0MyYW2i0lps+RvzFgc9FvAprjILPx3OjUN5+l59LwPHroejU9vmvOX5rkynvE/pH6eKDZxuZ5b0AKLIRBFcB1mcGn4Xig8NYAkDFbSb/rYGi/4oguXCIpXX1OOlbIpElk1DlMD+2nEh1UT9qv35rz3lvwdSL5PfHzEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223032; 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=xopSbsh+IkB5STrBQ4YQZEElngQLIdle4gTE7izg1DA=; b=XojYPUNhxe+G+4MHTHTbFxdSGPwVsBhfVqPlK8zPHXrZO9yEVZxFTEOqQR8ZH5hoSjt5ysMQNly7i56HQhC1I4n+dzNEmKPCvNTnonAo02WmDWgdTDHG86+N+fVyXeeer9VRUPGNVH4QxzAbM8MzW/yalDlsafT7KM2bP1443ss= 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 1761223032758307.57887319057204; Thu, 23 Oct 2025 05:37:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXR-0001qA-T9; Thu, 23 Oct 2025 08:35:30 -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 1vBuU7-0005Ri-DA for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:14 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuU3-0008P2-OD for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:02 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-46e6ba26c50so6241115e9.2 for ; Thu, 23 Oct 2025 05:31:57 -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-47496d269dbsm56778895e9.11.2025.10.23.05.31.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222715; x=1761827515; 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=xopSbsh+IkB5STrBQ4YQZEElngQLIdle4gTE7izg1DA=; b=BmbGeO2gu+UBZ5BTM2htp/wFotQ2ogN7kzNY8us92/jTqlG3sjxlwgtibhUw7J1ud1 XZamgrTyZGENrZn8mVzClD1nWFONdZ6VbuzxC6vf86KVWnzqzeuNWsTWQkr5D+eCRuS8 3eGc4pWE4Ldn86Ez4WuzrytSEqmQRloIL9+bk1CfMnyQvgqsTG0wnFvq66u7BGlZS8GS BjDdbkcvyXn4VrMBO/P4QESvfsXCJkoS5Odrbj1GtsF09+8kZ8La7xKxtX4zah5hUMgb xQHM5cp5pKOeDj3WanXD9QyygelMoNM3FQseu4CQgG3BT3azZ8t0jE+U3mE9UeAGdbpN 5m5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222715; x=1761827515; 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=xopSbsh+IkB5STrBQ4YQZEElngQLIdle4gTE7izg1DA=; b=paRWkIyWraqWjxCm3NgQtC1pppZblve6CYMHXnaDOVMgK2v4Q3wLYWbjC25dGuZHge VAZXFzMe6BV+j1NjIgqdHRZYNWRIxCssbEkT/wSJL9ARJG89FMS7SJpYU8UBQBHqckFe Zzcip+EHyt4EV1C590/XAKIjq/vUfcWPhzQoVrQNqGlSSgqQoIXzcdcT4VyrLfpQ/NZ0 iZJTKXHIm/xyctkjHSP/XbHi1WaJJzhZvLjXInIqtX5FPxN+tBflqDV7bdaKW7ihH3mf hQD3NTKXEtXrjVIYWzfD5QM/1oeIdQUGhly2Q7Karl4mDt+We2VuqTLLr2EDsQc4Mbf0 AzAQ== X-Gm-Message-State: AOJu0Yzs3hre17UZNjbpxMT6G8C5Anjv0Au7coJRj6bFA++F+KxrSLjB Cte12FqlQykUkmMyskaRCod85v/PiPOPK06JBaxTXXF/rM4uA/UIyLJ9qVUNpAIoyFGV3hmdYQ5 W1wOIAp0= X-Gm-Gg: ASbGnct3n0kLbXiPI1A4Yuhy9EFtvCSmY1r9ye3TKHzuPayuLbbb1q9/R2k2mA/EDt6 p7PHKHRldddgpjcb2EbimNwxTOB5O9P80+ih3HlU2TWQneYi25xUGADz59YBKITdidcZgyqL1MB +aMZfcBJlekUMPSpchcKejN5tqQstteqQ1qg+phX+YGXJxzr9aq7vDvuX4Zqn5pK2Y8y2Adw9Yh eXKu2Trw88GSa3mzbz5oV6HUzKpQYUaDfdMXLj92u4k7VfcPnzSmO1pN4y9HB7AuvCY+zWb/QBC z929ewzTtyWE6dP6ekqmmSvgrp/OZu6pwm/j8p3o1JkG8jw1YNRpuNZVjfEeyS9lPZMhHRUuwZO C9u7UEGkVD9Asb/9X0wByilreHv+e2oxFRaCtQYKMzLn/wJEmo08bYRGIrUwH3tjz4dtzYnI1ef vm2aRtN35hToQNilwqT4ZqctqMjxPdmRfIIZ0kca6lAxG2v4B+aY15E/Zwu3xr X-Google-Smtp-Source: AGHT+IGEU2IBoSQZLt4Ab58guPQIpf8DWmjNyHuvhqmIqNJDdMprKnJOlr8YAHvFe4ycMS1p8kAe8A== X-Received: by 2002:a05:600c:3b8d:b0:471:60c:1501 with SMTP id 5b1f17b1804b1-47117918c0cmr204928115e9.28.1761222715556; Thu, 23 Oct 2025 05:31:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 52/58] accel: Introduce AccelOpsClass::cpu_target_realize() hook Date: Thu, 23 Oct 2025 14:31:36 +0200 Message-ID: <20251023123142.8062-3-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: 1761223035208158500 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.51.0 From nobody Fri Nov 14 18:17:30 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=1761223416; cv=none; d=zohomail.com; s=zohoarc; b=Jy6rA3+lFYJpigq6ejqfeDBohZpq3ZqLUYmJNfnIr4R1hLc/vaSU445U7MieUBBPWuWYf30d1qQvYkRXX+Lf5kAegHm1FHoX4HLJ1v3AvoOPg9VVniT8WyAjRQujypWkDht0p/EMy2bR7ge+dCKoZLQpa91KxO6bfxPzuDY3ubQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223416; 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=9l+w1nsfj7eb94kduqVoiuDLPZOsjod/2Pr03h3L08Q=; b=QaWRde6nFrOg1kSwJ+CzqkkXr0DDK+mitfn+JowYAvyKSQ17RWUCDPaxoA/HdCHTa7AyaYa/LRd/pcwLqd14FYnB4AUYPx0Y4bhh199/yg+FWTYiMMJzbkzpgYtB2dqt5XAPj9M5RJBcDqEU5w4OPf++dFlYi2fmQ9aS7Dr5kZA= 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 1761223416557796.2486787646197; Thu, 23 Oct 2025 05:43:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuWr-0000BR-MW; Thu, 23 Oct 2025 08:34:55 -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 1vBuU9-0005S7-Vq for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:30 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuU7-0008PP-MB for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:05 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-47114a40161so7543085e9.3 for ; Thu, 23 Oct 2025 05:32:02 -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-475caf2f3bbsm33631015e9.16.2025.10.23.05.31.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222721; x=1761827521; 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=9l+w1nsfj7eb94kduqVoiuDLPZOsjod/2Pr03h3L08Q=; b=nx9AS5teKEqtcmenqZmF2xAq0T28aFKE6tSTB4Os++/syJhpCov9vwuJa9HTunSSiY 6BPytLYGidq5v1IQfdpRdgVVfrSnpXfDiW7r/HNB7vZHcO32K4PxNkNWnvystOTR2iYe hDxroJeE/GG2adcDUM0lVSP3lBnyHsd5kGcXfmS+5cLWe5Gbtqe4XB3WUwbiC90aWZbc Sm7GYM7ZcFD5kEpyYcSSax8aqbFhUVmR1mPET8i7ONbxTcMC5IBp6lRUx5PcrXB7Ldd5 p97pPD4H/VNzM3WeaFdSet2aKmyxBpm1eqJx/sciCJam6Dosg7jZBDiGKUdgdCDr4rf8 DGcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222721; x=1761827521; 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=9l+w1nsfj7eb94kduqVoiuDLPZOsjod/2Pr03h3L08Q=; b=Mfcyt3dUwQSiNzvroDfy/xUTKOFhJHVR4xu4INmA9XpnpLaEV5q94/iKLv6c8kKYa9 sCFNLTs4fhf9ae5oe3LQxY8ht+LoXMeKR2mgrma/UZkly68fWH0eY+3gCvLp9u0oSQKb Q+JgPUVk64skZjJ3gI7MrqXcpEia2aupxQGtsMb7VPP/q4MPIrJlN3nltQK8+lNIs47Q 5git/Rgxh+gWjOkoVORybKhbwmV1s7bgLqvmUygHC2hNUKFoaWgxGisO0Hu8B9P8Evud sjjuaT0/9QiLV9FqmjUY61x8Sqm7iVxvoVRBmEqFtR4onZ/OnbzuH1UmyZYet7Q38usw Uqvg== X-Gm-Message-State: AOJu0YyEu/IbP3V8if+7zdVCxtrcoaUVZtn73W7XgnMk5VNPXvHnpHDD W0JPqhuCkd3btr2BvEgxqth48NtJf/s758cW72qAtKPWeiqCIYuDExdLRncZB6oMXWQobT8wIpq lRoQIbx4= X-Gm-Gg: ASbGncvvn4lHWFmza+wmne0h2W0+qa8Kt2VOMJ6iGNf+ndaEpHb1MEOy8Lkk/YKsgmt JFm0lqxAtq8yTlmLNxTbX6H1UFCpfIyGDU6UV2WSvdhDWl4/Xo7IP2N4BK0Gnlfzwq5N1JrQfaP UQu+cVqhCtw5rLrvrvYa7NhbcvsCHP3zs05NUkwQPmjxPM/kenLrScJbrqChS+7/AVkNZ6SQkZQ G5W6aeKuoLjAvFjbaw+y5OusgVCYQhvgXobt82absJzZyf10Zp3K8juOQIBFlT70Ww0j8wmGaCM CCOG0xWzr1rld1X0eVJTs8wYAynEeem02O6On7VRrTl8A+aVUl7moif2dSAIKsO/yDw+EfZmT34 SdJP7SX7vnxW4rC7NOE3nJlzyFNTD57qf/zZBXrx8BLkfQvV95viZ7X/sZltahTNsEHjOBN/eQo 19rZHdLf8ZhdLe9r0tDGMBoboOJHGnMYjEcGQxC+avcgJwXd23NK4py+Xx2e+z X-Google-Smtp-Source: AGHT+IETxxUJfbx3hoR0IcW9MNoW4fy7+zlHuvFHzgttNLdDRW6lfdagCJbsdlxIesvp+Mpzsbii0A== X-Received: by 2002:a05:600c:190b:b0:46e:3b1a:20d7 with SMTP id 5b1f17b1804b1-47117903f8bmr186588785e9.19.1761222720620; Thu, 23 Oct 2025 05:32:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 53/58] accel/hvf: Add hvf_arch_cpu_realize() stubs Date: Thu, 23 Oct 2025 14:31:37 +0200 Message-ID: <20251023123142.8062-4-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: 1761223419589158500 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 eab443aa91f..3120a4593a4 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -110,4 +110,6 @@ int hvf_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 744a5288298..6fb1fda424c 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -363,6 +363,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 cc3f22ac542..759fa2e4d7d 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -979,6 +979,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) { hv_return_t ret; diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 8acdfa952c1..168227af631 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -368,6 +368,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.51.0 From nobody Fri Nov 14 18:17:30 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=1761223123; cv=none; d=zohomail.com; s=zohoarc; b=aQIlYnoJSb2ZFuRT1Z2i+AqerQoujvBRkaF5L9lkinTac7FooCtL9krhlQv5Fw0698eBflcdZf8723CBdy3lgbVJgtcdBMQRGiPlFqKWvVYYTjWFFl760SxJgGw8ovnzucok9zO1AzyDTOBJZiViMKscisg9hy4+B5MgP98ybP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223123; 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=gN1osrlqCHe3ITjIVkkUSvPg9WZ0qLTjP22f3wzHwCA=; b=aggcg8URjwQF1K/SKhwcktt/Bu8A0XjRnRPZfp2Kx6vfMDiCAf7SXyZsJJwVTmuaS2NiGvL+i1Z1tWsbBP3gMmw/g+xLWiM0WjF0/xE+gZU0oMXrZUItJgaK+NsDcmr7ZmFgIipdT9VExTR+QegJlW2ofAZp8u/+lwFq0SneoRM= 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 1761223123161504.93390266337974; Thu, 23 Oct 2025 05:38:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXO-0001Xo-5J; Thu, 23 Oct 2025 08:35:26 -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 1vBuUG-0005TJ-HG for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:33 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuUD-0008Q1-Mh for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:11 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4711f156326so7378495e9.1 for ; Thu, 23 Oct 2025 05:32:08 -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-47494ac30b4sm58772695e9.2.2025.10.23.05.32.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222726; x=1761827526; 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=gN1osrlqCHe3ITjIVkkUSvPg9WZ0qLTjP22f3wzHwCA=; b=Acm7o5oWfvhlJCxJYU4h4fh8gSgaVVEZTUCpH2Ep+bMD+1dHpBbjwp4VVWgFUcwU7N Im29G7DZUpSXY/k8u5veQZMGkKd8ysFqFSkgDIvFPImfbHBWefpxUrIaNha8+ezgdk20 w2EBGIaTphPqeoIXE8CsmeiiOdL0mIoOcAZkEP6oZqkyI1ygSXeg1sk7qTyF6/WBYHTq Ykka8FHhKI4o9x76uVoFBm3p05TBgNuYXRZwqAHesSpNcnSvaLjMaQTkJ1MrjWyNLeXB qF4PIBMn3uLNwkIvFCoM/nZ0Dp+S0QsgPWYVZi64CLBArj39gCPpbKuXSb65rtMzCnoC TxQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222726; x=1761827526; 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=gN1osrlqCHe3ITjIVkkUSvPg9WZ0qLTjP22f3wzHwCA=; b=sDkvlqP3sud8xeAIVGEu4IrvIs/3KO5VT2AH2vBmHv/W7dgTSeSpYS6jjpc+3JzYBU KrH8WE30xR7CrJKtc0Jh6c9XbAMykXXCabmS8A6jOd29hG4EYzDkX1Kymec0ysphQQyT rrJNrgztFEKVQUHehdPeVTZYZfUehtt6DcWze6sK52BBDwzdY63lEDGb3rjC6hir0SXf 2w+t+1Bjgj2WbS5eb2xi747Oao5dRbdzg22gHSPAnVHGItU5gdKQ4pvX/ddh8ina3pji CTeZWQHPxrrJ7tpuK13dUPMNOloHQZLBINzPTX1XVWl6qoBKZ5iYYlgde7TIp3J/RJuu rFgA== X-Gm-Message-State: AOJu0YwRhicgQnBko2U0xDC3yBuBWrt53JQKtVW/KcdTydqnGsaEjkW0 37H9Bla0rM0TBNtTcXUnWPHPAmhd8b8mueMgL6NiCEJF+7sLGJU8fHjyQBaMYzZCRHHMlyZjCPR azMo/pEw= X-Gm-Gg: ASbGncuAglju3d5jDPBhJ1FT2b9eMafPhW8W6BCJ4InW3AcTXmwLB/H/AudXK7u/Tst Q6Va5r41WrWeei0+4c7Y/IyuwpLJc0yiwsbjzAxi7bsB82bUFrJtIX9r0/xlVI8VXltVxGV5bN3 aa4qzcLK1S2HGW7ot4zL7hr83Nn1VDrLPk4rlyudvJUXLepiABA8vKpWUPVnEYS0s8jwiVP7/N2 QyOU9T5G5Pu4j7Q8+Otpdn7Yieu6cQH0baxuPBC5Ho7ln9W+KumpmAVCA57+7yKcZkbZpNz7h15 RA6QuOF9/rS7MCJWhxn+rEQXWzliH59dIUD/sb/RxRHxlbx9Ui/a+CpQ/bdhrCtc+dToydQ8/GN c14a1YfOHZyuNlwsleEp7HkRbeEG3+DrDTVot11yzbM7853o8g8L+O83AZ2KLA4OdgR8hm2AhU1 c2d2POO+Krfa2aX9aBJBnAYks+KOQjMtYFrFJ0vh4KFRfVWope5A== X-Google-Smtp-Source: AGHT+IEA+9W2M45XHIFb9R2q9gxni/aW5W+cd9QjPDqEpoMk3fHP9S1A3K2X2uR6QJLqBxry4nprIw== X-Received: by 2002:a05:600c:3e86:b0:46e:36f8:1eb7 with SMTP id 5b1f17b1804b1-471178a3a94mr169464805e9.10.1761222726052; Thu, 23 Oct 2025 05:32:06 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 54/58] target/arm: Create GTimers *after* features finalized / accel realized Date: Thu, 23 Oct 2025 14:31:38 +0200 Message-ID: <20251023123142.8062-5-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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: 1761223126181158500 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 5eaf950b969..bfd3b57e8a8 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1633,26 +1633,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 @@ -1699,7 +1679,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 @@ -1720,18 +1733,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.51.0 From nobody Fri Nov 14 18:17:30 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=1761223318; cv=none; d=zohomail.com; s=zohoarc; b=L5sTuQqqLkJ+90y+ENY5kCYz7OJUruL1mjUCAJWeV30MeSxMWAx8Z93ZliCFqy82p452fSvgKi00B7G9AQwq2EaovG4pj7B+JrMD692RqaAHlwN6ByAjQReo+YJ5AQB1/X3hyZ91hKr5h8DK+aHgUV6BRiM3ECdHi3gJacHwtU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223318; 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=LQ2Eh2V7b9Wp5VhIUqDSe6OaTHE71wRbrMgAmX2CIig=; b=bi3hsg+e1yRQpzy+khnl4M6Fh+MvdwMTjEM0ABG49G0qJYwPFYaGhXF4PXYff8mAQ9yjk3H1TdVMoXTikMs9E7sBxZRh3qqN6VqCMUQon9qtBUiGPucW4X+/JcDJmblGmmsXFqEw9WzzNUFYb0WE+MW3XlMl315LdZ5f3koHrUw= 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 1761223318161833.0290129433281; Thu, 23 Oct 2025 05:41:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXD-00012f-Kb; Thu, 23 Oct 2025 08:35:16 -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 1vBuUK-0005Wp-93 for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:33 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuUI-0008QX-4D for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:16 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-47117f92e32so7083395e9.1 for ; Thu, 23 Oct 2025 05:32:13 -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-475cae924a1sm44072925e9.2.2025.10.23.05.32.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222731; x=1761827531; 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=LQ2Eh2V7b9Wp5VhIUqDSe6OaTHE71wRbrMgAmX2CIig=; b=om0RGH/GFlFkxbAGm1QtrhhvpiL79nFtbVlyBD0pt2M7S3W7LDH9xWl3rPytpgBFCi SnMNakYgpmgbA67M3xshUeJr2mktLeG/ZwjCo96aowyRcaK4uF2a52GrEJ+hlh5WgbZZ A6oi8USAkAgi8ioCE01v3ybOkukixR5aE8rQMVLL5Sx+r3pfWXG0bzTaw3zxrapLyfRc pvAQ7M80TbnNG9XJNK7Bj65O2P7In4nNh/RcEoIqYbCIp6RdZ96AtTtxKvh8EjM7nsjj gGhQM6iP0iZs8kX91dZcrY7j7kU9uX8Tu2tBqIhAblX4HHcCi7+/gWsuZoqc6q9vyGf4 UOPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222731; x=1761827531; 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=LQ2Eh2V7b9Wp5VhIUqDSe6OaTHE71wRbrMgAmX2CIig=; b=hNruF7E6vPJf33t3QRJ5WH0+puZXKe9YrhH4bSsVd3Y/z+5UFoI3y+qsHhUfKK/YCq ib7lc+StoD0fNEOW/sy5bWnXi6dvKeGw66wR3ClSLOsM2CorIrjV9ukj5PLp6zXmyx6T 09kotUQBBefpf9V2kRLY7nGidZpjrwXfc48W33YSYlgvSTR0BiCbsNorzz7TBrKYu7ZN bdo2OQv1V3xy2l0nFggZFa57U2uvzlVeC7yBXqERv06o7DoCtnXSaj1uZJtKO77i+Zeb XLy816sWfaPCLyN4V+vAMB4S24a0YDxR4wOkON9XUy6GHZndvy4sf2UAQ4gbgsDuOvoo UkuQ== X-Gm-Message-State: AOJu0Yx4ujVcuJsotdnTjUFj/8u+7KM90L2WmqDg7ZAlESFy/hpNdTqH SZkpRKL/CI0yb+xBhnwv1TPiGohGj6fsCrHOpb+eAgW22YU4WxPaJyYTyxgMfNIDB2sPPczoxHs RC9Liyos= X-Gm-Gg: ASbGncsDNCxrKkj48K9UsUv0iI3eYKA7zJbHRAwnwH6OXiO0e1/4rRw8u1MvzTZb1eC zcIcI+ImSXpmp/r/cvhihqlYajdDwD+6RWNhF1u602V2jGOTyl5qaoKbusJgVFFeWYlQFqnz9i3 jDkH5rHaSjCk0Cf7YwMg3QsRfcmiq9jfBu6sCra70k0YI0bVFDTWxpOobTKJ+Rtg0GILi4RQHx5 U8z60imIUH/COSjqOnwPCmdDLU6hdt1AqMGqk6Tfsmp4OXyY4/UFLlIaQlgdFDXPf4FvFAGOrzS slSzT5mmdeKkDhREgXtz2hFoHNjmHAP6BYF2UH0MqHptYVz1bcrVaYc425XgKC1UkLqq30iKAZM +zlxCvsP/jRaPmxFsHwPdzn1XjdtPMMR4PgB4hizGzM2LNJ9k7zCDain1mFEJJ6RAfbwgIeLx3s zVofMPt5puEJvSo5X/4JEVD/lzwZBP9g8o/8ICvKAq4KEUM4pYZIsri+wmnD9x X-Google-Smtp-Source: AGHT+IHdLIabaXeqHr9Ts4VbsGbGYrlcJVb829CWbLCMNsHjme7sJzZscGlOyqbJYpq2gUpVBbCLyw== X-Received: by 2002:a05:600c:4fc2:b0:471:1765:839c with SMTP id 5b1f17b1804b1-4711791299amr163823875e9.20.1761222731365; Thu, 23 Oct 2025 05:32:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 55/58] target/arm/hvf: Really set Generic Timer counter frequency Date: Thu, 23 Oct 2025 14:31:39 +0200 Message-ID: <20251023123142.8062-6-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: 1761223319492154100 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 | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 759fa2e4d7d..f3cf5793ba5 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -904,6 +904,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); @@ -915,7 +922,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, @@ -981,6 +990,15 @@ int hvf_arch_init_vcpu(CPUState *cpu) =20 bool hvf_arch_cpu_realize(CPUState *cs, Error **errp) { + ARMCPU *cpu =3D ARM_CPU(cs); + + /* + * We must set the counter frequency HVF will be using + * early, before arm_cpu_realizefn initializes the timers + * with it. + */ + cpu->gt_cntfrq_hz =3D get_cntfrq_el0(); + return true; } =20 --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223224; cv=none; d=zohomail.com; s=zohoarc; b=iAfyAs4NwaKPkAWGOe0gKksquLCEde5ZSBawaPwTBUgh7yyfFPBnJ2/Rs8EE6+sTc6CFnu4PU7a44WneoT0+m93Le5VPteRuF4iWVckk1H/GTpS8BzzBpTLKI3/LfJYVhZ4W1Lo+dcA+eJAYpjPA0QbgreHq+O7OKfsLD+goddA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223224; 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=2PQ5wLHIh1tilthViqEPnFwykJP2NvAn5yEKkrPw89I=; b=DWROc3dq1Wr37kmqosBvshMoFIDkmFKBbe9yEQ3GwCrgB94rxJangUteTQmKn0eXDKRNUZstkf8fp9+AkUIklQ8S98vE4uoCZB0+ENZNgVRWqPWSCFAsB75vJMs+yRmoCrhLqad2kauyRkuYLWWm1/lj/U8oagTKegDf8Ds4/dk= 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 176122322409377.77804733188839; Thu, 23 Oct 2025 05:40:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuX7-0000iQ-72; Thu, 23 Oct 2025 08:35:09 -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 1vBuUT-0005Y9-EW for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:33 -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 1vBuUN-0008R3-KC for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:23 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-471131d6121so5843095e9.1 for ; Thu, 23 Oct 2025 05:32:18 -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-475cae924a1sm44078055e9.2.2025.10.23.05.32.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222736; x=1761827536; 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=2PQ5wLHIh1tilthViqEPnFwykJP2NvAn5yEKkrPw89I=; b=mVWQp41g2+HPwhIIkaoE6kkE78F+06Q6dmIE1kHDllOa8+Tqwnx+a80+NKXdpQvjRI diADLQJVAqxZL8AobxsCocP9d/JuBDpOXOYxhUp4FK83FLlzFr5jgl5uGfXjiftiCZEM uVtV/1mbM7w8O3ARdWad6PA0TUDV6Ktz/wNmXTPmJ0pIG2fZFkwzLS32kFNDTbHExqi+ NKpty7HTsoOiF3cPBXMBy5fpOAFafnUrmReQ+GS0BpWA5x++/OVI7T56PrEQJ96vETcR jGr384KAh0z7VsrWY7ITMfa4gbWXa7vFVk6Soa3BM1qJRKrx8mznfxqsYGlI7AAq9gx9 8C+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222736; x=1761827536; 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=2PQ5wLHIh1tilthViqEPnFwykJP2NvAn5yEKkrPw89I=; b=m+c5CWosXr8MtHVsxdCqrUISeoo7z8hjXo0v4DxVdTIKXcMBrIOzuacCeM65zK0mjz uU+OIA806qeFqkrEo1JWozsSzikNCl74lfzncyOArL4Vj6GuZs2ox222k0CaQJf7qKax czObh5hZNHeBfR47nNUrh8+M2ur5R1mCWxbUFFs8wK5LpJH/h7MOTpJ8YZdK2zN32yXe yS9r/XHDG72GDvBCWPJy4L8wRSl8ebprpc354uXyX52wfiIIxf7tRyEgUvFod/CWbXzD heH3yveoDkBB9gn8+9kS1zb0D7fbXfv0PrlNcV4yfW72DoGmnv9aqCwu566strncXbGb eMaQ== X-Gm-Message-State: AOJu0YywzB8+dvW55LWta/R5PLyje1xihJDu4hVBhpSkqYQKP4INDQ+j d1qbL8nSTs23kKKUaKI9UA1HC+JFZQ1k9dW39P/J55DzeecJYjOGOx68PTDzHgxkK6Nf36BTXMz cboVzUmc= X-Gm-Gg: ASbGncu/vuekSTUllZGSxT1DIfxwBBCws59jJFHCMOfiPwKwJT8cZyWcwqk825w66Op qBNG4h4zAZAVWd+32orJvwusXCIMz7v5sFryvjMiDqj2CL6WRh37dk4hBiqf9a6uc6xkzz3cXEm 1xF/gQT02LhzPI+PQz5B36ULs2Gds6jjdB8lFffQ8j9jzRz7uLUU0AN6uQIz7PiezQNUy0fvvgI 2GMcQTFiChMsaZtUZgagyCciSLrCajrbCybd9icEmSenx1zWiafArQkP2mpePDF1kFjLh6vK0or ke1P+8vAp4lUtq+YY8zNzY4d0O2oGaiYOv4nh3Jb93Mmvo6FqLNKEp228EciVkzjHKSlY3qGuOz q/+5EO788WVz4gd4t74D5PhjWjh41nTQf89Dn/RdJEe12QrfnoTts4I8gR8kda7SSC55KyC17w5 tUsjBBY2QU7qLYOd8ia+C4dzsyyBG8rOAjsbBf0qRrejpAwATRGdZQkdpIK9eb X-Google-Smtp-Source: AGHT+IFEyjCGcHz5ogQJOffPwyTrAvi0xgweJM4wuXRqjjfXq5xT+HZfjRhvvsABr1422rmtVjG41g== X-Received: by 2002:a05:600c:3555:b0:470:fe3c:a3b7 with SMTP id 5b1f17b1804b1-4711786d42dmr179273425e9.5.1761222736474; Thu, 23 Oct 2025 05:32:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 56/58] accel/hvf: Do not abort in hvf_arm_get_*_ipa_bit_size() Date: Thu, 23 Oct 2025 14:31:40 +0200 Message-ID: <20251023123142.8062-7-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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=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: 1761223226475154100 Do not abort in hvf_arm_get_default_ipa_bit_size() and hvf_arm_get_max_ipa_bit_size() when the IPA can not be fetched. Return 0 (and document it). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/hvf_arm.h | 11 +++++++++++ target/arm/hvf/hvf.c | 8 ++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/target/arm/hvf_arm.h b/target/arm/hvf_arm.h index ea82f2691df..21a69e7d105 100644 --- a/target/arm/hvf_arm.h +++ b/target/arm/hvf_arm.h @@ -22,7 +22,18 @@ void hvf_arm_init_debug(void); =20 void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu); =20 +/** + * hvf_arm_get_default_ipa_bit_size: + * + * Returns the default intermediate physical address bit length or 0 on er= ror. + */ uint32_t hvf_arm_get_default_ipa_bit_size(void); + +/** + * hvf_arm_get_max_ipa_bit_size: + * + * Returns the maximum intermediate physical address bit length or 0 on er= ror. + */ uint32_t hvf_arm_get_max_ipa_bit_size(void); =20 #endif diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index f3cf5793ba5..12f7d09a697 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -836,24 +836,20 @@ uint32_t hvf_arm_get_default_ipa_bit_size(void) { uint32_t default_ipa_size; hv_return_t ret =3D hv_vm_config_get_default_ipa_size(&default_ipa_siz= e); - assert_hvf_ok(ret); - - return default_ipa_size; + return ret =3D=3D HV_SUCCESS ? default_ipa_size : 0; } =20 uint32_t hvf_arm_get_max_ipa_bit_size(void) { uint32_t max_ipa_size; hv_return_t ret =3D hv_vm_config_get_max_ipa_size(&max_ipa_size); - assert_hvf_ok(ret); - /* * We clamp any IPA size we want to back the VM with to a valid PARange * value so the guest doesn't try and map memory outside of the valid = range. * This logic just clamps the passed in IPA bit size to the first valid * PARange value <=3D to it. */ - return round_down_to_parange_bit_size(max_ipa_size); + return ret =3D=3D HV_SUCCESS ? round_down_to_parange_bit_size(max_ipa_= size) : 0; } =20 void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu) --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223384; cv=none; d=zohomail.com; s=zohoarc; b=J3+qkF/CbwKv5UtO+p3gAlHY52E23m40W3fg0bdJ/E7x8aXWG9bRYy2XKjs9qSwYMgklpkTp28WQ5Vcn9r/ZkhYCbz+wQIv7WbL95ddJiEHU+8ylJ12b90RkjaGDytSzYiJ+YUokaTvCCqDzFkaCuXd3bG1gCeXBXDRH5lnKzVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223384; 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=9Kvjs75qZYXzJtgjOCgCUdq6Pu4BO5ORL4SkTS1d+ok=; b=NJ4wJX/JkKStwhuKrA11DLvxEOTYdiuYyrRfFxOReG8LQS0CjKUadNfefqUyiR/k2ki7c1+RsXfz5JeV1+vri+PyiF4ZEU1Hxc8t1bbBC4mlaf38cLqoGLfaErME5yN00zYJaJ36ecqkLN71PUvTeqpSX93dOJ/lowFtVXFnnrw= 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 1761223384033567.6957819431467; Thu, 23 Oct 2025 05:43:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXp-0002Pe-4c; Thu, 23 Oct 2025 08:35:54 -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 1vBuUV-0005YW-BV for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:33 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuUT-0008RU-4U for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:27 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4710665e7deso3818695e9.1 for ; Thu, 23 Oct 2025 05:32:24 -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-475c4281314sm95056335e9.4.2025.10.23.05.32.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222742; x=1761827542; 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=9Kvjs75qZYXzJtgjOCgCUdq6Pu4BO5ORL4SkTS1d+ok=; b=cZS76eJoTIiiJJNW8TTQmvmI+z9czLAYye6vBDkx4XRAHFOOlGatyZQ9DUNR98KUiY fHE4swXS64Mz2DXvpRyKIhA3LwHtI+7MoRl7sIw49/saWBZ1gYHz7atxWWgGZpLtV37a ts8aN0GXocIokV8PhnRKfX3a10//NA8fQkiR2Qcfen2xH3fvg4zihd+mImHzl5FUIgDO AdrAfnN13VjmZSTG7+SpAo96VOvE5FMrPBDu3WXZWJnjDzibi4WWOhOrOtwt8bVaFK21 ntd1VdC8um0bcfr6yZ0qURgCGJUpGHUMo2SRE3ZvSnDZHMPIYbRdel3hKuNjNLBgHek6 hKZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222742; x=1761827542; 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=9Kvjs75qZYXzJtgjOCgCUdq6Pu4BO5ORL4SkTS1d+ok=; b=QEfgr3YJUlTSElFgZLJ462EhV5BT23DFp7z9qn0buBCpAUPfMSAie3rnyJ5sZCwF4d G5INURnIKaVN2Y6ikoTVLwBzSMsSGlqgzMf7NH2HCNFoVaZSOeRq4TEvCgT0QcGAEsUv 4ypvOuyfHlLZ0SsFPvic3TqoLwMypN2kUzm9Unj3qN7QQuNJIYjMfo0297CBrw2VY98l dqbGK3A5lW0KV3MBRCtgQZ2dQh50inZd40nvZq5Ypkl3FoNJYM6KIg1d2PqIJkCLOT4d VnA39G/BOW4cuwwifBY2MbNUqM+JfdwCOOs+ZDW/2gGQ5b2QrFDfwCOs/GZjA3avnj0J luuQ== X-Gm-Message-State: AOJu0Yzc9Eg6242wWdYOo18XxG5Ji7yq4LfFjKdsm3H08WLJr9DluM0/ J3B1itWj270aYtO9X7GwYEhqPVLCCmTMUjUdM7KYX1xDKaTtLBuf0Wvm908bnViGChl5uhuFL8b OINr882E= X-Gm-Gg: ASbGncsf/JmbDE9Zl0RvFEClBQfw2yrMw9jTj/urEv7HlDvXXdY8N5cRyiiMlrJed2Q IzqrTNhmlZ/PJmkXROBHiACAtpDDa0cRf4r1G5E8T3KVlPD2eEtxCMsfYCzbGmQkPl+LinTE+vi 017ZjQX1dejY9/Wu1TnCXxgqkjU4oY0yZs9rssp45sp/rZVmp0BvsATkYA8yS8jvmfsEfjfirlq UOAULkw0Hk0Z0tb/V7i4hsxeposqJEUi3lEHj9wWBDGGGJm5rtZeo+yaQp6pxhjsZPP5BnZjy41 WpwSM44phO1rH1yGv9nxIVG2YFGSqVOHwhGCfxN2yFzRgQlV4oW9RJfSCHz1PMrEZtj6bY/Q0YL CTHZhD9P1oiMKSnZtgYXAYPnLuWXLEHhwnYEUL+RS+FbM3cikJeB+jlvAG0qLmAdQJjLNDXvaRS JgnTxoWykTyFprvNFj2vehkZ3hllHrMw1njJR72Gfo/eS2KieIzPw12AApIxWK X-Google-Smtp-Source: AGHT+IEx8BFpjNXhusxQrpqpHoXCU7z+MXPRfMepaQ3/Co4IjjhB0iiMYA7kTEFc7OtLYixtJcW5wQ== X-Received: by 2002:a05:600c:8714:b0:471:b5d:2db9 with SMTP id 5b1f17b1804b1-475cb03016cmr15327865e9.21.1761222742547; Thu, 23 Oct 2025 05:32:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 57/58] hw/arm/virt: Warn when HVF doesn't report IPA bit length Date: Thu, 23 Oct 2025 14:31:41 +0200 Message-ID: <20251023123142.8062-8-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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: 1761223385357158500 Emit a warning when HVF doesn't return the IPA bit length and return -1 as "this accelerator is not usable", allowing QEMU to try with the next one (when using '-accel hvf:tcg'). Reported-by: Ivan Krasilnikov Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2981 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 175023897a7..1d65fa471dc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3225,8 +3225,12 @@ static int virt_hvf_get_physical_address_range(Machi= neState *ms) { VirtMachineState *vms =3D VIRT_MACHINE(ms); =20 - int default_ipa_size =3D hvf_arm_get_default_ipa_bit_size(); - int max_ipa_size =3D hvf_arm_get_max_ipa_bit_size(); + uint32_t default_ipa_size =3D hvf_arm_get_default_ipa_bit_size(); + uint32_t max_ipa_size =3D hvf_arm_get_max_ipa_bit_size(); + if (!default_ipa_size || !max_ipa_size) { + warn_report("HVF didn't report IPA bit length"); + return -1; + } =20 /* We freeze the memory map to compute the highest gpa */ virt_set_memmap(vms, max_ipa_size); --=20 2.51.0 From nobody Fri Nov 14 18:17:30 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=1761223174; cv=none; d=zohomail.com; s=zohoarc; b=csbPQ+hse2YShMVOQP/+V+WsDzoWnViRDVLEu0gYI7PTJBhxGCcHBC702gwrzy/Ud+/1APpjDlH4kqA4P70qr15QQMVyoodg1c64Iim/Vudf14DQN02JxanlDJK2Z2ngAni9NDrq3NoWjdFgZLVsQoncJnXP0cDkGjOIZwURCas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761223174; 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=2a4PoXZUReoA7VfVNmy1fiLzr59C5J9k1wUFYONVrhA=; b=bqtvq7U4/CqPMARNOSX52b3/EvAJDvTpC1tQLbkoMHwkE03uCCbeJSFjmb6ocd1dAdnZgvZwCFuqauCAaze76FFBzrNYIesM7teX6+cFEG1L189Dmm2nrYe/N6AuZX35v0OeCvZJDComH4SLze+H139+zA90sftS5u1u9oqcCUM= 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 1761223173993312.8374989448946; Thu, 23 Oct 2025 05:39:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vBuXZ-00022i-RR; Thu, 23 Oct 2025 08:35:42 -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 1vBuUc-0005fS-JV for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:37 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vBuUZ-0008SL-Ar for qemu-devel@nongnu.org; Thu, 23 Oct 2025 08:32:33 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-47103b6058fso5980285e9.1 for ; Thu, 23 Oct 2025 05:32:29 -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-47496d4b923sm56754855e9.14.2025.10.23.05.32.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Oct 2025 05:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761222748; x=1761827548; 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=2a4PoXZUReoA7VfVNmy1fiLzr59C5J9k1wUFYONVrhA=; b=kPJiKj2cbJKGdhb/RU9bLUahmVkd9PRuC9zqRcIEOoAUS5ElVG+XIY3+RVzLgBC5kv DUB8JaKRZew3sk2PVJsiage8DfBcEDd+lE9PMUzxMI7RwZlKasw8CiWm5dt+9JtshL8R yVb7jQItet0oWcQ+x2ERm9vunnrFxGa1F674HkCpoVEEy/V1apwAkatKECVUZdiij4sG 3nIFt9s+Xp5W9aS/qFSxEz1TCDMUPgK/3WL3qu3uf+SAZmpYrGoWUXRGFQs1zvFZzdec SiXt1qvbApTsSuqHFXSAOApnLtM8ZyH1NdSfWUX3Gef7Mk0CW0SOvq3sEKHC/Eg1I0Vn LJdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761222748; x=1761827548; 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=2a4PoXZUReoA7VfVNmy1fiLzr59C5J9k1wUFYONVrhA=; b=VetM4yz3WeG3mKbeHu/PJ5ijYcYdM+zR50pmUWQC/vU2P+L+XhK5HjQDcZAsKgqjnd U6bTNQFcEGb9DxEHZzcG9JpuOWAfN9Wr8/vG+QryODPN3qPQ79OzmlLUDup5C6Y1bygT WYulUeBLsrd+DoZGbwyV9XUiJ7HcBonDv9SSLOL94qm+1Fshh+cs5yKu6lb+YIHH+ruP e8tbSUkUYioXXheO+Rx6H0DttNIn6Hgo4XKJeyEzj7g7kLnW4J4JsrOMN/TOWo9SirxW zj+6GYzH5uXjqxEYnvMVquOvrjdjHJoeTeqwg6uSYGQBp4gDxUYVciJw5j4lGr4MYtEf RDlg== X-Gm-Message-State: AOJu0Yy/1Mk6B7dpwjbFpOHJRSTDCWa5AmYBHQfnycG07uoxy+xxn2z1 xAkI9+Gfc7PmUIfpSuPys6Gvyg4JCvS0geZXaXlbWinxMPk35GPMmXFVDS0XDzwCHShboN1Qa5/ o/kzUn68= X-Gm-Gg: ASbGncuvKa+ro9GZZZzsftjKPhXXAme7Jghmf2PJiR9mniY93QdwafRQhAf9PH/D3lu V5wbEzb3JwSpjfocMArQynowP8XUbJbhzmVj3K4TZHO0cmBnUfIvpbgubaI+zr28PbquVpFBajw P043XfsoCnAhYAEfIe3OF7BwF+6UPhCDb5Emf34k0bMTUfTPTFJaNW+t4eWrbBqrLyal3I22GQm vgdh8OIoBGkvIfHc3vv71cUUBZiNHb084dEWezfk+OQFl/QS0RDdPHvLpgvMmqBE+bxZ6Q3NnBt iDl6HwFh/crNmsxKCF0VfMrelCpKjSvCJwwbbvYVDiRfNTXbxXsoplCHeh7LL8asXGswg3I3bV0 cAJC+sg3/6+Mz+8w1asawD3CpOGCcBTULzoSvxQrhr4v9PUu6Auh3FcZW50nApd8/7cfkPr5b5j WYGudqKWWYfdRfhbn6jGANuNLMuSfPlTFodNpeZui/0DUOERBw6hqBUGJwBx5r X-Google-Smtp-Source: AGHT+IHXSw/fevYz6MyC72SPBobc67WK2XNzTHBsMH/1mqhupLtvi+rVRmQeKXVOKH10Ct5cjU3tmQ== X-Received: by 2002:a05:600c:8b66:b0:46f:a995:55f8 with SMTP id 5b1f17b1804b1-475c6f5df70mr37661025e9.13.1761222747787; Thu, 23 Oct 2025 05:32:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Mohamed Mediouni , Peter Collingbourne , Alexander Graf , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Stefan Hajnoczi , Mads Ynddal , Phil Dennis-Jordan , Richard Henderson , Roman Bolshakov , Cameron Esfahani Subject: [PATCH v2 58/58] target/arm: Only allow disabling NEON when using TCG Date: Thu, 23 Oct 2025 14:31:42 +0200 Message-ID: <20251023123142.8062-9-philmd@linaro.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251023114638.5667-1-philmd@linaro.org> References: <20251023114638.5667-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::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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: 1761223175970154100 Only allow disabling NEON when using TCG. This avoids confusing user experience: $ qemu-system-aarch64 -M virt -accel hvf \ -cpu host,neon=3Doff,vfp=3Doff,vfp-d32=3Doff qemu-system-aarch64: AArch64 CPUs must have both VFP and Neon or neither $ qemu-system-aarch64 -M virt -accel hvf \ -cpu host,neon=3Doff,vfp=3Doff,vfp-d32=3Doff qemu-system-aarch64: ARM CPUs must have both VFP-D32 and Neon or neither $ qemu-system-aarch64 -M virt -accel hvf \ -cpu host,neon=3Doff,vfp=3Doff,vfp-d32=3Doff qemu-system-aarch64: can't apply global host-arm-cpu.vfp-d32=3Doff: Prope= rty 'host-arm-cpu.vfp-d32' not found Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- target/arm/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index bfd3b57e8a8..9343c6093b9 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1457,7 +1457,7 @@ static void arm_cpu_post_init(Object *obj) =20 if (arm_feature(&cpu->env, ARM_FEATURE_NEON)) { cpu->has_neon =3D true; - if (!kvm_enabled()) { + if (tcg_enabled() || qtest_enabled()) { qdev_property_add_static(DEVICE(obj), &arm_cpu_has_neon_proper= ty); } } --=20 2.51.0