From patchwork Wed Nov 13 14:23:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Dennis-Jordan X-Patchwork-Id: 13873853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D30FD462AF for ; Wed, 13 Nov 2024 14:29:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBEI4-00040z-BK; Wed, 13 Nov 2024 09:24:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBEI2-0003zC-Ea for qemu-devel@nongnu.org; Wed, 13 Nov 2024 09:24:14 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBEI0-00004t-Vs for qemu-devel@nongnu.org; Wed, 13 Nov 2024 09:24:14 -0500 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5cf7298c7ccso262133a12.1 for ; Wed, 13 Nov 2024 06:24:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1731507851; x=1732112651; 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=IOlf/wzEJ+wM7g5BTurCACeEWddAq/2jF0kyAkwof9o=; b=qI4mnx5wt9zg0YPalM3JcQIkfwSjETWg3IZS62VQcAtf6xKLYOKLOPBliGoDq9iXQB ya5r5RkkQwpoaXe2wYk9I7Zf3b62muA6Bj2TD9+SHnh0zkc1xIgYEj3pS8kdWAXLnn2b al/0ezR03tN5V145yifgVtGvtQyjgP8lr35ddyDyUFJmyk/1tzvL4/nDgC2AwZETAYpR 9vvLMKP3gIYKF/FB2Ohap+zOSLVE3rh6s2ncSac4b+Y+VcviJrrR4P0jG6icCtNcqMif fm678amo4QguLD1RBzActNb0KQxHHsrY47t2E5qphcQPJnZAvXnRHpUw3yDS8VAnU1ZZ Ugng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731507851; x=1732112651; 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=IOlf/wzEJ+wM7g5BTurCACeEWddAq/2jF0kyAkwof9o=; b=JehGqve3ChMm5b1mTviqsHa0KfW4uoENqr2fbKnJQ6JBu173b1S6a1OxdEj7gU/tb/ 8guQKEhfuuUIDEv/87pthK5n8lX7/AMW9wrMvKYm5qWTbEZXKH/GXuuRURtsbXBRGtZB 3ZlFBuoSV+BSkeNJyxuobrTF5UVH+JUMlgsr2jlLZfWo8vB+/UN8hN/9wWlkjC0QzydF PIY0VAILjwCyfedTu40rOTCn+C2sHbryxfhbsBiM6A+i3d7dABW6vz7zTWdHBZARhPHG noj91NhpLPWu09jYX4LvTVO2w4XBvNkQ/r8t28X0phjB4jgxKbb0Y2m41L8d5O9bvwrF W9Eg== X-Gm-Message-State: AOJu0YzZjmXFYcPRzGlbvrJmIjaVyaoZQf/BvBxuXq6StF1Q26WVTc5V lS2ftJBWet14qIddX3IFVBjI/xMj0/4bc4Cz0qoHMwImt6mPErUVx9V+a2MLh/rnj+r+Vak0P6r EFQ== X-Google-Smtp-Source: AGHT+IFtaK8WKKef3suwzP3L5ElmzYG6o61H88aKzNPzdHWotOa1pF8pByVPREE1cU6slczAT7sM2w== X-Received: by 2002:a05:6402:35d6:b0:5c9:7dd9:3eda with SMTP id 4fb4d7f45d1cf-5cf630a7d06mr2811573a12.5.1731507851435; Wed, 13 Nov 2024 06:24:11 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03b5d76esm7134612a12.9.2024.11.13.06.24.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 13 Nov 2024 06:24:10 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: agraf@csgraf.de, phil@philjordan.eu, peter.maydell@linaro.org, pbonzini@redhat.com, rad@semihalf.com, quic_llindhol@quicinc.com, stefanha@redhat.com, mst@redhat.com, slp@redhat.com, richard.henderson@linaro.org, eduardo@habkost.net, marcel.apfelbaum@gmail.com, gaosong@loongson.cn, jiaxun.yang@flygoat.com, chenhuacai@kernel.org, kwolf@redhat.com, hreitz@redhat.com, philmd@linaro.org, shorne@gmail.com, palmer@dabbelt.com, alistair.francis@wdc.com, bmeng.cn@gmail.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, jcmvbkbc@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, akihiko.odaki@daynix.com, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-riscv@nongnu.org, balaton@eik.bme.hu, Alexander Graf Subject: [PATCH v10 08/15] hvf: arm: Ignore writes to CNTP_CTL_EL0 Date: Wed, 13 Nov 2024 15:23:36 +0100 Message-Id: <20241113142343.40832-9-phil@philjordan.eu> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20241113142343.40832-1-phil@philjordan.eu> References: <20241113142343.40832-1-phil@philjordan.eu> MIME-Version: 1.0 Received-SPF: neutral client-ip=2a00:1450:4864:20::52c; envelope-from=phil@philjordan.eu; helo=mail-ed1-x52c.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Alexander Graf MacOS unconditionally disables interrupts of the physical timer on boot and then continues to use the virtual one. We don't really want to support a full physical timer emulation, so let's just ignore those writes. Signed-off-by: Alexander Graf Signed-off-by: Phil Dennis-Jordan Reviewed-by: Akihiko Odaki --- target/arm/hvf/hvf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 6cea483d422..b45b764dfd0 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qemu/log.h" #include "sysemu/runstate.h" #include "sysemu/hvf.h" @@ -184,6 +185,7 @@ void hvf_arm_init_debug(void) #define SYSREG_OSLSR_EL1 SYSREG(2, 0, 1, 1, 4) #define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4) #define SYSREG_CNTPCT_EL0 SYSREG(3, 3, 14, 0, 1) +#define SYSREG_CNTP_CTL_EL0 SYSREG(3, 3, 14, 2, 1) #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) @@ -1620,6 +1622,13 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) case SYSREG_OSLAR_EL1: env->cp15.oslsr_el1 = 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;