qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation
@ 2023-12-07 10:54 Philippe Mathieu-Daudé
  2023-12-07 10:54 ` [PATCH 1/2] target/alpha: Extract clk_helper.c from sys_helper.c Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-07 10:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

Extract helper_load_pcc() to clk_helper.c so we can
restrict sys_helper.c to system emulation.

Philippe Mathieu-Daudé (2):
  target/alpha: Extract clk_helper.c from sys_helper.c
  target/alpha: Only build sys_helper.c on system emulation

 target/alpha/clk_helper.c | 32 ++++++++++++++++++++++++++++++++
 target/alpha/sys_helper.c | 18 ------------------
 target/alpha/meson.build  |  7 +++++--
 3 files changed, 37 insertions(+), 20 deletions(-)
 create mode 100644 target/alpha/clk_helper.c

-- 
2.41.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] target/alpha: Extract clk_helper.c from sys_helper.c
  2023-12-07 10:54 [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
@ 2023-12-07 10:54 ` Philippe Mathieu-Daudé
  2023-12-07 10:54 ` [PATCH 2/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-07 10:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

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é <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',
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] target/alpha: Only build sys_helper.c on system emulation
  2023-12-07 10:54 [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
  2023-12-07 10:54 ` [PATCH 1/2] target/alpha: Extract clk_helper.c from sys_helper.c Philippe Mathieu-Daudé
@ 2023-12-07 10:54 ` Philippe Mathieu-Daudé
  2023-12-26 11:17 ` [PATCH 0/2] " Philippe Mathieu-Daudé
  2023-12-27 20:52 ` Richard Henderson
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-07 10:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/alpha/sys_helper.c | 3 ---
 target/alpha/meson.build  | 6 ++++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/target/alpha/sys_helper.c b/target/alpha/sys_helper.c
index 98d9a0fff7..768116ef32 100644
--- a/target/alpha/sys_helper.c
+++ b/target/alpha/sys_helper.c
@@ -28,7 +28,6 @@
 
 
 /* PALcode support special instructions */
-#ifndef CONFIG_USER_ONLY
 void helper_tbia(CPUAlphaState *env)
 {
     tlb_flush(env_cpu(env));
@@ -74,5 +73,3 @@ void helper_set_alarm(CPUAlphaState *env, uint64_t expire)
         timer_del(cpu->alarm_timer);
     }
 }
-
-#endif /* CONFIG_USER_ONLY */
diff --git a/target/alpha/meson.build b/target/alpha/meson.build
index ea252c99a5..7dbbd55717 100644
--- a/target/alpha/meson.build
+++ b/target/alpha/meson.build
@@ -7,13 +7,15 @@ alpha_ss.add(files(
   'clk_helper.c',
   'int_helper.c',
   'mem_helper.c',
-  'sys_helper.c',
   'translate.c',
   'vax_helper.c',
 ))
 
 alpha_system_ss = ss.source_set()
-alpha_system_ss.add(files('machine.c'))
+alpha_system_ss.add(files(
+  'machine.c',
+  'sys_helper.c',
+))
 
 target_arch += {'alpha': alpha_ss}
 target_system_arch += {'alpha': alpha_system_ss}
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation
  2023-12-07 10:54 [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
  2023-12-07 10:54 ` [PATCH 1/2] target/alpha: Extract clk_helper.c from sys_helper.c Philippe Mathieu-Daudé
  2023-12-07 10:54 ` [PATCH 2/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
@ 2023-12-26 11:17 ` Philippe Mathieu-Daudé
  2024-01-17  8:22   ` Philippe Mathieu-Daudé
  2023-12-27 20:52 ` Richard Henderson
  3 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-26 11:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

On 7/12/23 11:54, Philippe Mathieu-Daudé wrote:
> Extract helper_load_pcc() to clk_helper.c so we can
> restrict sys_helper.c to system emulation.
> 
> Philippe Mathieu-Daudé (2):
>    target/alpha: Extract clk_helper.c from sys_helper.c
>    target/alpha: Only build sys_helper.c on system emulation
> 
>   target/alpha/clk_helper.c | 32 ++++++++++++++++++++++++++++++++
>   target/alpha/sys_helper.c | 18 ------------------
>   target/alpha/meson.build  |  7 +++++--
>   3 files changed, 37 insertions(+), 20 deletions(-)
>   create mode 100644 target/alpha/clk_helper.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation
  2023-12-07 10:54 [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2023-12-26 11:17 ` [PATCH 0/2] " Philippe Mathieu-Daudé
@ 2023-12-27 20:52 ` Richard Henderson
  3 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2023-12-27 20:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel

On 12/7/23 21:54, Philippe Mathieu-Daudé wrote:
> Extract helper_load_pcc() to clk_helper.c so we can
> restrict sys_helper.c to system emulation.
> 
> Philippe Mathieu-Daudé (2):
>    target/alpha: Extract clk_helper.c from sys_helper.c
>    target/alpha: Only build sys_helper.c on system emulation

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation
  2023-12-26 11:17 ` [PATCH 0/2] " Philippe Mathieu-Daudé
@ 2024-01-17  8:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-01-17  8:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

On 26/12/23 12:17, Philippe Mathieu-Daudé wrote:
> On 7/12/23 11:54, Philippe Mathieu-Daudé wrote:
>> Extract helper_load_pcc() to clk_helper.c so we can
>> restrict sys_helper.c to system emulation.
>>
>> Philippe Mathieu-Daudé (2):
>>    target/alpha: Extract clk_helper.c from sys_helper.c
>>    target/alpha: Only build sys_helper.c on system emulation
>>
>>   target/alpha/clk_helper.c | 32 ++++++++++++++++++++++++++++++++
>>   target/alpha/sys_helper.c | 18 ------------------
>>   target/alpha/meson.build  |  7 +++++--
>>   3 files changed, 37 insertions(+), 20 deletions(-)
>>   create mode 100644 target/alpha/clk_helper.c
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Eh I meant "series queued" :)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-17  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07 10:54 [PATCH 0/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
2023-12-07 10:54 ` [PATCH 1/2] target/alpha: Extract clk_helper.c from sys_helper.c Philippe Mathieu-Daudé
2023-12-07 10:54 ` [PATCH 2/2] target/alpha: Only build sys_helper.c on system emulation Philippe Mathieu-Daudé
2023-12-26 11:17 ` [PATCH 0/2] " Philippe Mathieu-Daudé
2024-01-17  8:22   ` Philippe Mathieu-Daudé
2023-12-27 20:52 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).