From: David Hildenbrand <david@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, qemu-s390x@nongnu.org, cohuck@redhat.com
Subject: Re: [PATCH 1/8] pc-bios: s390x: Consolidate timing functions into time.h
Date: Fri, 27 Mar 2020 11:21:13 +0100 [thread overview]
Message-ID: <f50723cb-0cb3-cd2a-bf6f-32afbf1bb975@redhat.com> (raw)
In-Reply-To: <20200324150847.10476-2-frankja@linux.ibm.com>
On 24.03.20 16:08, Janosch Frank wrote:
> Let's consolidate timing related functions into one header.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> pc-bios/s390-ccw/menu.c | 1 +
> pc-bios/s390-ccw/netmain.c | 15 +++----------
> pc-bios/s390-ccw/s390-ccw.h | 18 ----------------
> pc-bios/s390-ccw/time.h | 39 ++++++++++++++++++++++++++++++++++
> pc-bios/s390-ccw/virtio-net.c | 1 +
> pc-bios/s390-ccw/virtio-scsi.c | 1 +
> pc-bios/s390-ccw/virtio.c | 18 +++-------------
> 7 files changed, 48 insertions(+), 45 deletions(-)
> create mode 100644 pc-bios/s390-ccw/time.h
>
> diff --git a/pc-bios/s390-ccw/menu.c b/pc-bios/s390-ccw/menu.c
> index ce3815b2010d20cb..7925c33248836913 100644
> --- a/pc-bios/s390-ccw/menu.c
> +++ b/pc-bios/s390-ccw/menu.c
> @@ -12,6 +12,7 @@
> #include "libc.h"
> #include "s390-ccw.h"
> #include "sclp.h"
> +#include "time.h"
>
> #define KEYCODE_NO_INP '\0'
> #define KEYCODE_ESCAPE '\033'
> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> index 309ffa30d9922077..a8e2b1b6233735d8 100644
> --- a/pc-bios/s390-ccw/netmain.c
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -35,6 +35,7 @@
> #include "s390-ccw.h"
> #include "cio.h"
> #include "virtio.h"
> +#include "time.h"
>
> #define DEFAULT_BOOT_RETRIES 10
> #define DEFAULT_TFTP_RETRIES 20
> @@ -57,24 +58,14 @@ static SubChannelId net_schid = { .one = 1 };
> static uint8_t mac[6];
> static uint64_t dest_timer;
>
> -static uint64_t get_timer_ms(void)
> -{
> - uint64_t clk;
> -
> - asm volatile(" stck %0 " : : "Q"(clk) : "memory");
> -
> - /* Bit 51 is incremented each microsecond */
> - return (clk >> (63 - 51)) / 1000;
> -}
> -
> void set_timer(int val)
> {
> - dest_timer = get_timer_ms() + val;
> + dest_timer = get_time_milli() + val;
> }
>
> int get_timer(void)
> {
> - return dest_timer - get_timer_ms();
> + return dest_timer - get_time_milli();
> }
>
> int get_sec_ticks(void)
> diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
> index 21f27e79906ea297..c5820e43aed143d0 100644
> --- a/pc-bios/s390-ccw/s390-ccw.h
> +++ b/pc-bios/s390-ccw/s390-ccw.h
> @@ -74,8 +74,6 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
> bool virtio_is_supported(SubChannelId schid);
> void virtio_blk_setup_device(SubChannelId schid);
> int virtio_read(ulong sector, void *load_addr);
> -u64 get_clock(void);
> -ulong get_second(void);
>
> /* bootmap.c */
> void zipl_load(void);
> @@ -144,24 +142,8 @@ static inline void debug_print_addr(const char *desc, void *p)
> #define KVM_S390_VIRTIO_SET_STATUS 2
> #define KVM_S390_VIRTIO_CCW_NOTIFY 3
>
> -static inline void yield(void)
> -{
> - asm volatile ("diag 0,0,0x44"
> - : :
> - : "memory", "cc");
> -}
> -
> #define MAX_SECTOR_SIZE 4096
>
> -static inline void sleep(unsigned int seconds)
> -{
> - ulong target = get_second() + seconds;
> -
> - while (get_second() < target) {
> - yield();
> - }
> -}
> -
> static inline void IPL_assert(bool term, const char *message)
> {
> if (!term) {
> diff --git a/pc-bios/s390-ccw/time.h b/pc-bios/s390-ccw/time.h
> new file mode 100644
> index 0000000000000000..98f5acaa33b500bd
> --- /dev/null
> +++ b/pc-bios/s390-ccw/time.h
> @@ -0,0 +1,39 @@
> +#ifndef TIME_H
> +#define TIME_H
> +
> +static inline u64 get_clock(void)
> +{
> + u64 r;
> +
> + asm volatile("stck %0" : "=Q" (r) : : "cc");
> + return r;
> +}
> +
> +static inline u64 get_time_milli(void)
Milli Vanilli?
Please, just use common abbreviations. "ms" is certainly good enough.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2020-03-27 10:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 15:08 [PATCH 0/8] pc-bios: s390x: Cleanup part 1 Janosch Frank
2020-03-24 15:08 ` [PATCH 1/8] pc-bios: s390x: Consolidate timing functions into time.h Janosch Frank
2020-03-27 10:21 ` David Hildenbrand [this message]
2020-03-24 15:08 ` [PATCH 2/8] pc-bios: s390x: Get rid of magic offsets into the lowcore Janosch Frank
2020-03-27 10:25 ` David Hildenbrand
2020-03-27 10:33 ` Janosch Frank
2020-03-24 15:08 ` [PATCH 3/8] pc-bios: s390x: Rename and use PSW_MASK_ZMODE constant Janosch Frank
2020-04-30 15:29 ` David Hildenbrand
2020-03-24 15:08 ` [PATCH 4/8] pc-bios: s390x: Use PSW masks where possible Janosch Frank
2020-04-30 15:34 ` David Hildenbrand
2020-03-24 15:08 ` [PATCH 5/8] pc-bios: s390x: Move panic() into header and add infinite loop Janosch Frank
2020-04-07 7:25 ` Cornelia Huck
2020-05-14 11:27 ` Janosch Frank
2020-05-14 11:49 ` Cornelia Huck
2020-04-30 15:42 ` David Hildenbrand
2020-05-04 6:46 ` Janosch Frank
2020-05-04 7:37 ` David Hildenbrand
2020-03-24 15:08 ` [PATCH 6/8] pc-bios: s390x: Use ebcdic2ascii table Janosch Frank
2020-04-30 15:35 ` David Hildenbrand
2020-03-24 15:08 ` [PATCH 7/8] pc-bios: s390x: Replace 0x00 with 0x0 or 0 Janosch Frank
2020-04-30 15:36 ` David Hildenbrand
2020-05-14 11:32 ` Janosch Frank
2020-03-24 15:08 ` [PATCH 8/8] pc-bios: s390x: Make u32 ptr check explicit Janosch Frank
2020-04-30 15:37 ` David Hildenbrand
2020-03-24 17:02 ` [PATCH 0/8] pc-bios: s390x: Cleanup part 1 no-reply
2020-04-29 12:11 ` Janosch Frank
2020-04-30 14:50 ` David Hildenbrand
2020-05-14 10:59 ` Cornelia Huck
2020-05-14 11:20 ` Janosch Frank
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=f50723cb-0cb3-cd2a-bf6f-32afbf1bb975@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@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.