aboutsummaryrefslogtreecommitdiff
path: root/core/timebase.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-06-25 08:47:35 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-06 19:30:48 +1000
commit7e4d14b364956b6756b62fc5e6ae4b1487e1bc3c (patch)
tree822c2d8da19528bbb0ded69234cce0e4655b84dd /core/timebase.c
parentfb43f202ddd86131acf14542c34fbcb9adab45f2 (diff)
downloadskiboot-7e4d14b364956b6756b62fc5e6ae4b1487e1bc3c.zip
skiboot-7e4d14b364956b6756b62fc5e6ae4b1487e1bc3c.tar.gz
skiboot-7e4d14b364956b6756b62fc5e6ae4b1487e1bc3c.tar.bz2
Timebase quirk for slow simulators like AWAN and SIMICS
This will internally pretend the timebase is running 1000 times slower, which reduces some otherwise really terrible delays in some simulators. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: move cfam_chipid cleanup into own patch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/timebase.c')
-rw-r--r--core/timebase.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/timebase.c b/core/timebase.c
index 4fcfae5..0714f25 100644
--- a/core/timebase.c
+++ b/core/timebase.c
@@ -18,6 +18,9 @@
#include <timebase.h>
#include <opal.h>
#include <cpu.h>
+#include <chip.h>
+
+unsigned long tb_hz = 512000000;
static void time_wait_poll(unsigned long duration)
{
@@ -108,7 +111,10 @@ unsigned long timespec_to_tb(const struct timespec *ts)
* at the expense of capacity or do 128 bit math which
* I'm not eager to do :-)
*/
- return (ns * (tb_hz >> 24)) / (1000000000ul >> 24);
+ if (chip_quirk(QUIRK_SLOW_SIM))
+ return (ns * (tb_hz >> 16)) / (1000000000ul >> 16);
+ else
+ return (ns * (tb_hz >> 24)) / (1000000000ul >> 24);
}
int nanosleep(const struct timespec *req, struct timespec *rem)