All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel@nongnu.org, lvivier@redhat.com
Subject: [Qemu-devel] [PATCH 05/10] cuda: rename frequency property to tb_frequency
Date: Sat,  3 Feb 2018 10:37:22 +0000	[thread overview]
Message-ID: <20180203103727.26457-6-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20180203103727.26457-1-mark.cave-ayland@ilande.co.uk>

This allows us to more easily differentiate between the timebase frequency used
to calibrate the MacOS timers and the actual frequency of the hardware clock as
indicated by CUDA_TIMER_FREQ.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/misc/macio/cuda.c  | 10 +++++-----
 hw/misc/macio/macio.c |  2 +-
 hw/ppc/mac.h          |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index f036e8d7e1..a200320e7d 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -158,8 +158,8 @@ static unsigned int get_counter(CUDAState *s, CUDATimer *ti)
     uint64_t current_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
 
     /* Reverse of the tb calculation algorithm that Mac OS X uses on bootup. */
-    tb_diff = get_tb(current_time, ti->frequency) - ti->load_time;
-    d = (tb_diff * 0xBF401675E5DULL) / (ti->frequency << 24);
+    tb_diff = get_tb(current_time, ti->tb_frequency) - ti->load_time;
+    d = (tb_diff * 0xBF401675E5DULL) / (ti->tb_frequency << 24);
 
     if (ti->index == 0) {
         /* the timer goes down from latch to -1 (period of latch + 2) */
@@ -179,7 +179,7 @@ static void set_counter(CUDAState *s, CUDATimer *ti, unsigned int val)
 {
     CUDA_DPRINTF("T%d.counter=%d\n", 1 + ti->index, val);
     ti->load_time = get_tb(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL),
-                           s->frequency);
+                           s->tb_frequency);
     ti->counter_value = val;
     cuda_timer_update(s, ti, ti->load_time);
 }
@@ -878,7 +878,7 @@ static void cuda_realizefn(DeviceState *dev, Error **errp)
     struct tm tm;
 
     s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_timer1, s);
-    s->timers[0].frequency = s->frequency;
+    s->timers[0].frequency = s->tb_frequency;
     s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_timer2, s);
     s->timers[1].frequency = (SCALE_US * 6000) / 4700;
 
@@ -909,7 +909,7 @@ static void cuda_initfn(Object *obj)
 }
 
 static Property cuda_properties[] = {
-    DEFINE_PROP_UINT64("frequency", CUDAState, frequency, 0),
+    DEFINE_PROP_UINT64("timebase-frequency", CUDAState, tb_frequency, 0),
     DEFINE_PROP_END_OF_LIST()
 };
 
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 44f91d1e7f..a639b09e00 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -451,7 +451,7 @@ void macio_init(PCIDevice *d,
     macio_state->escc_mem = escc_mem;
     /* Note: this code is strongly inspirated from the corresponding code
        in PearPC */
-    qdev_prop_set_uint64(DEVICE(&macio_state->cuda), "frequency",
+    qdev_prop_set_uint64(DEVICE(&macio_state->cuda), "timebase-frequency",
                          macio_state->frequency);
 
     qdev_init_nofail(DEVICE(d));
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index b501af1653..fa78115c95 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -99,7 +99,7 @@ typedef struct CUDAState {
     CUDATimer timers[2];
 
     uint32_t tick_offset;
-    uint64_t frequency;
+    uint64_t tb_frequency;
 
     uint8_t last_b;
     uint8_t last_acr;
-- 
2.11.0

  parent reply	other threads:[~2018-02-03 10:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 10:37 [Qemu-devel] [PATCH 00/10] cuda: various fixes, and move 6522 to separate device Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 01/10] cuda: do not use old_mmio accesses Mark Cave-Ayland
2018-02-05 14:17   ` Laurent Vivier
2018-02-06 21:40     ` Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 02/10] cuda: don't allow writes to port output pins Mark Cave-Ayland
2018-02-05 14:27   ` Laurent Vivier
2018-02-05 19:53   ` Philippe Mathieu-Daudé
2018-02-03 10:37 ` [Qemu-devel] [PATCH 03/10] cuda: don't call cuda_update() when writing to ACR register Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 04/10] cuda: introduce CUDAState parameter to get_counter() Mark Cave-Ayland
2018-02-05 19:44   ` Philippe Mathieu-Daudé
2018-02-03 10:37 ` Mark Cave-Ayland [this message]
2018-02-05 19:45   ` [Qemu-devel] [PATCH 05/10] cuda: rename frequency property to tb_frequency Philippe Mathieu-Daudé
2018-02-03 10:37 ` [Qemu-devel] [PATCH 06/10] cuda: minor cosmetic tidy-ups to get_next_irq_time() Mark Cave-Ayland
2018-02-05 19:39   ` Philippe Mathieu-Daudé
2018-02-03 10:37 ` [Qemu-devel] [PATCH 07/10] cuda: set timer 1 frequency property to CUDA_TIMER_FREQ Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 08/10] cuda: factor out timebase-derived counter value and load time Mark Cave-Ayland
2018-02-05 19:44   ` Philippe Mathieu-Daudé
2018-02-06 21:44     ` Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 09/10] misc: introduce new mos6522 VIA device and enable it for ppc builds Mark Cave-Ayland
2018-02-03 10:37 ` [Qemu-devel] [PATCH 10/10] cuda: convert to use the shared mos6522 device Mark Cave-Ayland
2018-02-03 11:11 ` [Qemu-devel] [PATCH 00/10] cuda: various fixes, and move 6522 to separate device no-reply
2018-02-03 11:14   ` Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180203103727.26457-6-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.