Compare commits

...

3 Commits

Author SHA1 Message Date
Vladimir Serbinenko
3e89a76fee Add wbinvd around bios call.
Via C3 has problems with cache coherency when transitioning between the modes,
so flush it around bios calls.
2016-01-10 13:48:26 +01:00
Vladimir Serbinenko
2e1e6a2056 arm: Ignore qemu clock bug 2016-01-08 16:22:47 +01:00
Vladimir Serbinenko
b44ba603e3 i386-ieee1275: Increase maximum heap size to accomodate highres graphi tests 2016-01-08 16:22:19 +01:00
5 changed files with 56 additions and 1 deletions

View File

@@ -44,6 +44,13 @@ FUNCTION(grub_bios_interrupt)
movl 24(%edx), %esi
movl 28(%edx), %edx
/*
Via C3 CPUs have cache coherence problems, so we need to call
wbinvd at these 2 points. As wbinvd slows down boot, don't do
it on non-VIA. 9090 is nop nop. */
VARIABLE(grub_bios_via_workaround1)
.byte 0x90, 0x90
PROT_TO_REAL
.code16
pushf
@@ -92,6 +99,10 @@ intno:
movw %ax, LOCAL(bios_register_es)
popf
VARIABLE(grub_bios_via_workaround2)
.byte 0x90, 0x90
REAL_TO_PROT
.code32

View File

@@ -32,6 +32,7 @@
#include <grub/env.h>
#include <grub/cache.h>
#include <grub/time.h>
#include <grub/cpu/cpuid.h>
#include <grub/cpu/tsc.h>
#include <grub/machine/time.h>
@@ -184,6 +185,26 @@ mmap_iterate_hook (grub_uint64_t addr, grub_uint64_t size,
return 0;
}
extern grub_uint16_t grub_bios_via_workaround1, grub_bios_via_workaround2;
/* Via needs additional wbinvd. */
static void
grub_via_workaround_init (void)
{
grub_uint32_t manufacturer[3], max_cpuid;
if (! grub_cpu_is_cpuid_supported ())
return;
grub_cpuid (0, max_cpuid, manufacturer[0], manufacturer[2], manufacturer[1]);
if (grub_memcmp (manufacturer, "CentaurHauls", 12) != 0)
return;
grub_bios_via_workaround1 = 0x090f;
grub_bios_via_workaround2 = 0x090f;
asm volatile ("wbinvd");
}
void
grub_machine_init (void)
{
@@ -193,6 +214,9 @@ grub_machine_init (void)
#endif
grub_addr_t modend;
/* This has to happen before any BIOS calls. */
grub_via_workaround_init ();
grub_modbase = GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR + (_edata - _start);
/* Initialize the console as early as possible. */

View File

@@ -46,11 +46,19 @@
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
/* The maximum heap size we're going to claim */
#ifdef __i386__
#define HEAP_MAX_SIZE (unsigned long) (64 * 1024 * 1024)
#else
#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024)
#endif
/* If possible, we will avoid claiming heap above this address, because it
seems to cause relocation problems with OSes that link at 4 MiB */
#ifdef __i386__
#define HEAP_MAX_ADDR (unsigned long) (64 * 1024 * 1024)
#else
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
#endif
extern char _start[];
extern char _end[];

View File

@@ -33,12 +33,19 @@ sleep_test (void)
{
struct grub_datetime st, en;
grub_int32_t stu = 0, enu = 0;
int is_delayok;
grub_test_assert (!grub_get_datetime (&st), "Couldn't retrieve start time");
grub_millisleep (10000);
grub_test_assert (!grub_get_datetime (&en), "Couldn't retrieve end time");
grub_test_assert (grub_datetime2unixtime (&st, &stu), "Invalid date");
grub_test_assert (grub_datetime2unixtime (&en, &enu), "Invalid date");
grub_test_assert (enu - stu >= 9 && enu - stu <= 11, "Interval out of range: %d", enu-stu);
is_delayok = (enu - stu >= 9 && enu - stu <= 11);
#ifdef __arm__
/* Ignore QEMU bug */
if (enu - stu >= 15 && enu - stu <= 17)
is_delayok = 1;
#endif
grub_test_assert (is_delayok, "Interval out of range: %d", enu-stu);
}

View File

@@ -14,6 +14,11 @@ dt=`echo 'date; sleep 10; date' | @builddir@/grub-shell`
dt1="$(date -u -d "$(echo "$dt" | head -n 1)" +%s)"
dt2="$(date -u -d "$(echo "$dt" | tail -n 1)" +%s)"
# Ignore QEMU bug
if [ "${grub_modinfo_target_cpu}" = arm ] && [ $((dt2 - dt1)) -ge 15 ] && [ $((dt2 - dt1)) -le 17 ]; then
exit 0;
fi
if [ $((dt2 - dt1)) -gt 11 ] || [ $((dt2 - dt1)) -lt 9 ]; then
echo "Interval not in range $dt2-$dt1 != 10"
exit 1