From patchwork Fri Jan 19 11:34:38 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: 763909 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a08:0:b0:337:62d3:c6d5 with SMTP id m8csp397269wrq; Fri, 19 Jan 2024 03:36:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLVxCbFasK85FQ3IDKvbbsoxrqvWIHu1IHUMxvDNupPMgXM0wPHY0CqirumAj54bQD8SlM X-Received: by 2002:a05:620a:4048:b0:781:9e55:b34f with SMTP id i8-20020a05620a404800b007819e55b34fmr1405057qko.4.1705664207340; Fri, 19 Jan 2024 03:36:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705664207; cv=none; d=google.com; s=arc-20160816; b=IDfKbrzTfFY6mA22lQmQGTAqcL9qa5jXjLf5f4uhk8DFgX4hQsrRip59/mckqIUH0D VloucCOiMXSXDnU/pTWX3Ol0dvhk/wUuYVP3UI25aqeJgjqH3rm0ApTJSiQImtP0ld58 wbEwKr1xe8tCxeoJ/S9v6YiO0BtMiuyDFM3h9ep7e6PiZppwKbcvWBpw7VLz5fEBGYfR QR8Z/XN5wtAQQgJe9W4TVaF5wtxTkWZ5kkgcPxIPEoqYsyqc2/zVIBnhxDEs31nboY3m iKIZp4AXPioEX4JaM5t/Vifp7qi2kEhI7QGOHHEhJc58SkkQf6PU96ZKLeOGoN/Cov0o IoLA== 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=7/u3zpIICoMRx+hk0gsj8/1K/WruFMiJJIe2/2+mB0M=; fh=6tP4L9XjCvdhkEFVfS9C+TY7ruUfmb06A1hD+CUqGXU=; b=HPuIyuioHhe5sd4bDpNg/4N/XMVu2T1+JVYaYyML/KKQ/DN4ntGTSbIrA8i/aP/lXc LsPIc2FD6UmBv2L3GTQdTnKWpgmhVyqZ5qhb6us/TaYvZY8Am/vQWY9oVM6bSJCOfGvQ /cYi/V261nlutK07+C3/uuy0MLvKuqzuImwV7o6oct/O73R1g7rWWLwwTgpPbqiWtRRY Ow2LdZ2sV2Y767KalPtHDZuzZ9135ka6Y4vG9tC4QLywdEfuWOo6KIbK5OOplBkm1xMe xbiviIuBss36xeopJxmZwU+iNHfZJIqYoADpHt8PVL32iUUoCTEKhaOOnMnXB0JQndLD hJuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QhwK7cP5; 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 z11-20020a05622a028b00b0042a150d628bsi4333126qtw.79.2024.01.19.03.36.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jan 2024 03:36:47 -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=QhwK7cP5; 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 1rQnAB-00028X-Sh; Fri, 19 Jan 2024 06:35:55 -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 1rQnAA-00025d-0Y for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:35:54 -0500 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 1rQnA7-0000f0-25 for qemu-devel@nongnu.org; Fri, 19 Jan 2024 06:35:53 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33921b95dddso201646f8f.1 for ; Fri, 19 Jan 2024 03:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705664149; x=1706268949; 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=7/u3zpIICoMRx+hk0gsj8/1K/WruFMiJJIe2/2+mB0M=; b=QhwK7cP5DoX1xzoqiuN9TK6m7HDpFJy6312Tmp8XlpxCNfM28jUO9G07cGF9UZr7jD +Sw/s+8zchXnrNeN+joMYVpaZjBht3yr46fM5BuC6/YF/gapLhGEKGwOmDBaVdRmZSBe Hthn3CndVy8Wzy6a6zivzA7dkS+ct04rjiR/3XIFfLq/CBtDdpxZ5zFoKJesA9HImcfV 9XnPXNWPn1gu25VfRsgQ1Ef0c82ybKNDin9PiuWXQyBNaJ1kEzJ28MbAFQnxuohj+J4o hWE3HEbZhEgc3NT80EXFRJiequu0iS/u1TgCHHpUN11fPjP1npe4iiUZ89aqe7AAAQRk D79g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705664149; x=1706268949; 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=7/u3zpIICoMRx+hk0gsj8/1K/WruFMiJJIe2/2+mB0M=; b=vq1wB7ONCAUjTcFAv8GXmzkYWTYqx7/+HGPJ2nbjCWPm8ZCXclxLNw9A9rm39xCd/l PC523TiDVdg7XyJlOInl6dVFYoiQ2WNewyD6mwlAjPJVKoMODs5Mqm5oGpC+894i4Ul1 PEYR/t2gLSfmLwOVIl/xYkMIU51JEJMIbc9H3/RxmAwXNrF5aTqZDvLZ9XyApAd+2Elb uQHhvEhKeJsUL+befwaA4X/BqzgWFKyVAhLv8lRPT1sVc4KgZVPnwC78mDbwxTATiyBI amP90QAGmsI3hoChHulzgnBZKL0BU9BzV5aBQW7ndZ7CDY914n0UeSP7fWQFqlXjWAQa kFVg== X-Gm-Message-State: AOJu0YxzHCvBBBfbte5bJZeI1Fn0LAbeK4LQmXDCSGQdIGo5RnWE1lcX HzxGyFdZciwcVZPKCzJ+VSQQMJNjEQbbA7yUjw4c1HRbUWxjzDpsoefI+JGlEca/mHaJDQM+Dp/ Q+ae1BQ== X-Received: by 2002:a05:600c:2291:b0:40e:937f:16d8 with SMTP id 17-20020a05600c229100b0040e937f16d8mr521040wmf.50.1705664149390; Fri, 19 Jan 2024 03:35:49 -0800 (PST) Received: from localhost.localdomain (91-163-26-170.subs.proxad.net. [91.163.26.170]) by smtp.gmail.com with ESMTPSA id r19-20020a05600c459300b0040e42391a12sm28532878wmo.13.2024.01.19.03.35.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 Jan 2024 03:35:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, qemu-block@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 09/36] target/alpha: Extract clk_helper.c from sys_helper.c Date: Fri, 19 Jan 2024 12:34:38 +0100 Message-ID: <20240119113507.31951-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240119113507.31951-1-philmd@linaro.org> References: <20240119113507.31951-1-philmd@linaro.org> MIME-Version: 1.0 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, 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 Except helper_load_pcc(), all helpers from sys_helper.c are system-emulation specific. In preparation of restricting sys_helper.c to system emulation, extract helper_load_pcc() to clk_helper.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231207105426.49339-2-philmd@linaro.org> --- target/alpha/clk_helper.c | 32 ++++++++++++++++++++++++++++++++ target/alpha/sys_helper.c | 15 --------------- target/alpha/meson.build | 1 + 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 target/alpha/clk_helper.c diff --git a/target/alpha/clk_helper.c b/target/alpha/clk_helper.c new file mode 100644 index 0000000000..26ffc231cd --- /dev/null +++ b/target/alpha/clk_helper.c @@ -0,0 +1,32 @@ +/* + * QEMU Alpha clock helpers. + * + * Copyright (c) 2007 Jocelyn Mayer + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/timer.h" +#include "exec/helper-proto.h" +#include "cpu.h" + +uint64_t helper_load_pcc(CPUAlphaState *env) +{ +#ifndef CONFIG_USER_ONLY + /* + * In system mode we have access to a decent high-resolution clock. + * In order to make OS-level time accounting work with the RPCC, + * present it with a well-timed clock fixed at 250MHz. + */ + return (((uint64_t)env->pcc_ofs << 32) + | (uint32_t)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) >> 2)); +#else + /* + * In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist. Just pass through + * the host cpu clock ticks. Also, don't bother taking PCC_OFS into + * account. + */ + return (uint32_t)cpu_get_host_ticks(); +#endif +} diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c index c83c92dd4c..98d9a0fff7 100644 --- a/target/alpha/sys_helper.c +++ b/target/alpha/sys_helper.c @@ -27,21 +27,6 @@ #include "qemu/timer.h" -uint64_t helper_load_pcc(CPUAlphaState *env) -{ -#ifndef CONFIG_USER_ONLY - /* In system mode we have access to a decent high-resolution clock. - In order to make OS-level time accounting work with the RPCC, - present it with a well-timed clock fixed at 250MHz. */ - return (((uint64_t)env->pcc_ofs << 32) - | (uint32_t)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) >> 2)); -#else - /* In user-mode, QEMU_CLOCK_VIRTUAL doesn't exist. Just pass through the host cpu - clock ticks. Also, don't bother taking PCC_OFS into account. */ - return (uint32_t)cpu_get_host_ticks(); -#endif -} - /* PALcode support special instructions */ #ifndef CONFIG_USER_ONLY void helper_tbia(CPUAlphaState *env) diff --git a/target/alpha/meson.build b/target/alpha/meson.build index d3502dd823..ea252c99a5 100644 --- a/target/alpha/meson.build +++ b/target/alpha/meson.build @@ -4,6 +4,7 @@ alpha_ss.add(files( 'fpu_helper.c', 'gdbstub.c', 'helper.c', + 'clk_helper.c', 'int_helper.c', 'mem_helper.c', 'sys_helper.c',