From patchwork Sat Mar 9 19:21:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 779164 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp852333wrt; Sat, 9 Mar 2024 11:26:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUBdunXx7X1K1o65eeexyRAwmPORPFbsqQCDpj8mfGd+SFm8yGbgj5bsSq34+7dev0tBOZVQu9ib3eHn/YDH8w0 X-Google-Smtp-Source: AGHT+IHbiJevNcrXvBKrue2m9BoekQU4DfKtK2RiZcu0RbZFn5QoV+n3+eCxjZF/H0zs/cLE7oHg X-Received: by 2002:a0c:c24a:0:b0:68c:92ca:fec5 with SMTP id w10-20020a0cc24a000000b0068c92cafec5mr2597159qvh.51.1710012403856; Sat, 09 Mar 2024 11:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1710012403; cv=none; d=google.com; s=arc-20160816; b=odGxxipxblkP3og5tnlDUZ+Cj+6TJyl5oKxBgzVF2UvjVVFM2BDSsLBHGS3KS04nfl vjJnRB512D6rWtkmJ5GgUI72lpsKYB9WtDWuQ58829o5s3co6bCIaWFcZ0ABnHfhw7yS V88+KyRzPnobx+tD+gdw00XKDWZDDkbbvdHT8sZIJPSqLx8zVgDuTZIYkmEwY/LO0Ytk ml3Zamx2wiJbFR2BSeGgbj7HMx0+r8wsgmmw2Dxc2fraageFNbgvYh1qz0pWlBMSKzzV wefMJHaSO+1zmKvYdwZdJo5ASSKXY/7yIU5oVLUtCeGzdZjLcUjWPZKo7HXBmF+He0HY 1cRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sOxMDvWG7fYCMvOESgkL1lEMXJ1JQ08vQMhMIpxGM9I=; fh=5SqorCU4NjFi3WWDRAR9cvY3uyvURqWUsp1nT/zGHw4=; b=EPVyf0ZEYShHhiWrPG1vcdRh+U2F8IUKZqJXZVXOaARMZtGrEQGQOxWPgMmG2t/Nfi GFIUCqf8m/z5gvZaL26DPIigP3Qn76MmWTrQvFnvbjE7xrbBWvJHIQoPOuAzcnWTXClU GrbFsocqsTJUh8YfLkLI298DTRI5+gaw66pcPM9F6MDjweABTgLFIkc9+lVEShWURAA+ fp26VWoplnqGdOnnWLVW81LnjoCAcWzY9TxCd8/JD2vQWe3zEw0uOSXjMIIpkQxNZQv7 yNTqWcEVVhQ3gGwwwoHlxMF+k6+wdtpbe1tSuv6tg6CIRRviZlG5T6yaYujhBqVsqH1R 2SIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J38xq4PG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kc27-20020a056214411b00b0068fa9c997e8si2149198qvb.351.2024.03.09.11.26.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Mar 2024 11:26:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J38xq4PG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rj2Jb-0006n3-4E; Sat, 09 Mar 2024 14:25:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rj2JV-0006T4-9m for qemu-devel@nongnu.org; Sat, 09 Mar 2024 14:24:57 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rj2JS-00034W-4L for qemu-devel@nongnu.org; Sat, 09 Mar 2024 14:24:56 -0500 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2d269b2ff48so48618121fa.3 for ; Sat, 09 Mar 2024 11:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012292; x=1710617092; 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=sOxMDvWG7fYCMvOESgkL1lEMXJ1JQ08vQMhMIpxGM9I=; b=J38xq4PGGwtuqZGaJYM1qDPUggGtv+n5tzGS4pYERNsyVkqA7CDjhVHDXk31MW16bc hhHWlc90iduw8WwVaHM32aJEIMcPLDc6O9Rf80Uu/llk9p4QamSL8FWHc17uyQ3P28Ej OMNYvEfRbWivCBJ9bu8OEdfIZ5uG3vYlTsAaxqUw5LD2QS/nlcvRDDlzTJv4e3fsyY+5 KhVEBGQgZddbuwf2iD8L3jPXwPYgtB7sKt72wM/5lqcZhTvMmWBWVWe7nnc7ZDciE/cf JMi6fPQ8nMpSBq+SyEZQF6kgDd7w5KWK2pPp60Bd3Pg/Eeg/YyaD38bu0ax94ZqrfFd/ ZKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012292; x=1710617092; 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=sOxMDvWG7fYCMvOESgkL1lEMXJ1JQ08vQMhMIpxGM9I=; b=AnQH+jBjzRnaVfg9W5NU/8OP9wyR9iJQkBhHalxYRKiSCYqWVHzQ9xNJIDZhW/Asa+ 1m13kTr7zUlDjNh3n8ZeiTB100A/5AlmrZK/5q9yhnI/gX8wyjJn/vA/NzxQUzJ17K+F DlJrD/hwJqkst2vS91kNbjBUEd+Imw8HTuYN14zwQXAbw/6Jcs33DkJS04SdAxnhD2FK ROWj9mgOUTgKnHA1rI+EyfIVZZYWDybI1UmwvT3o/JNmzUfMXe7jvvY2x4rCQBY7H4ZF ctE08OtPPEpkVxL2o8Rc9WZZNfWM/GG8P0Yl0/5up3o30ZLKXVGzfWE2z9gMiur+z473 J4Ag== X-Gm-Message-State: AOJu0YxOo33x5k9ef4I3bEH5awjw0Z6AO3YCmUyuixfbpeevwjfIggR7 hKWH65Rzw6G2/nOylfaItFqBLw16q5QnX9w3DR/zcAOpO3xur2kXmR89YzgIpM6kLvVL+PvEeoG Z X-Received: by 2002:a2e:9b8e:0:b0:2d3:fa6b:9104 with SMTP id z14-20020a2e9b8e000000b002d3fa6b9104mr1393478lji.20.1710012292045; Sat, 09 Mar 2024 11:24:52 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id n10-20020aa7d04a000000b0056826248468sm1156009edo.89.2024.03.09.11.24.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:24:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 26/43] mac_newworld: change timebase frequency from 100MHz to 25MHz for mac99 machine Date: Sat, 9 Mar 2024 20:21:53 +0100 Message-ID: <20240309192213.23420-27-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=philmd@linaro.org; helo=mail-lj1-x22f.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Mark Cave-Ayland MacOS X uses multiple techniques for calibrating timers depending upon the detected hardware. One of these calibration routines compares the change in the timebase against the KeyLargo timer and uses this to recalculate the clock frequency, timebase frequency and bus frequency if the calibration exceeds certain limits. This recalibration occurs despite the correct values being passed via the device tree, and is likely due to buggy firmware on some hardware. The timebase frequency of 100MHz was set way back in 2005 by commit fa296b0fb4 ("PIC fix - changed back TB frequency to 100 MHz") and with this value on a mac99,via=pmu machine the OSX 10.2 timer calibration incorrectly calculates the bus frequency as 400MHz instead of 100MHz. The most noticeable side-effect is the UI appears sluggish and not very responsive for normal use. Change the timebase frequency from 100MHz to 25MHz which matches that of a real G4 AGP machine (the closest match to QEMU's mac99 machine) and allows OSX 10.2 to correctly detect all of the clock frequency, timebase frequency and bus frequency. Tested on various MacOS images from OS 9.2 through to OSX 10.4, along with Linux and NetBSD and I was unable to find any regressions from this change. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240304073548.2098806-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/mac_newworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 3e796d2f6d..ff9e490c4e 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -77,7 +77,7 @@ #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 -#define TBFREQ (100UL * 1000UL * 1000UL) +#define TBFREQ (25UL * 1000UL * 1000UL) #define CLOCKFREQ (900UL * 1000UL * 1000UL) #define BUSFREQ (100UL * 1000UL * 1000UL)