x86: make sure we really have an hpet mapping before using it
PATCH 1/1 x86: make sure we really have an hpet mapping before using it
When booting in Xen dom0, the hpet isn't really accessible, so make sure the mapping is non-NULL before use.
---arch/x86/kernel/hpet.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
===================================================================
arch/x86/kernel/hpet.c +0 -0
@@ -818,9 +818,10 @@
hpet_address = force_hpet_address; hpet_enable(); - if (!hpet_virt_address) - return -ENODEV; }
+
+ if (!hpet_virt_address)
+ return -ENODEV;
hpet_reserve_platform_timers(hpet_readl(HPET_ID));
Quoted 12 lines · Jeremy Fitzhardinge
When booting in Xen dom0, the hpet isn't really accessible, so make sure the mapping is non-NULL before use.
Signed-off-by Jeremy Fitzhardinge <[email protected]>---
arch/x86/kernel/hpet.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)===================================================================
arch/x86/kernel/hpet.c line 824
Quoted 9 lines
arch/x86/kernel/hpet.c +3
-2@@ -818,9 +818,10 @@ hpet_address = force_hpet_address;hpet_enable (); -if (!hpet_virt_address) -return -ENODEV ; } + +if (!hpet_virt_address) +return -ENODEV ;
hm, how can hpet_virt_address become non-NULL if hpet_address is zero?
Ingo
Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Jeremy Fitzhardinge
When booting in Xen dom0, the hpet isn't really accessible, so make sure the mapping is non-NULL before use.
Signed-off-by Jeremy Fitzhardinge <[email protected]>---
arch/x86/kernel/hpet.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)===================================================================
arch/x86/kernel/hpet.c +0
-0@@ -818,9 +818,10 @@
Quoted 12 lines
arch/x86/kernel/hpet.c line 825
Quoted 9 lines
arch/x86/kernel/hpet.c +3
-2hpet_address = force_hpet_address;hpet_enable (); -if (!hpet_virt_address) -return -ENODEV ; } + +if (!hpet_virt_address) +return -ENODEV ;hm, how can
hpet_virt_addressbecome non-NULL ifhpet_addressis zero?
The mapping is normally created in (paravirt_ops.)time_init -> hpet_time_init -> hpet_enable -> hpet_set_mapping. However, under Xen, time_init points to the Xen time init function, and so hpet_time_init is never called.
hpet_time_late_init is always called because its an initfunc. In domU it doesn't matter because hpet_address is NULL and so it does nothing. In dom0, however, all the ACPI table parsing gets done as normal, so the hpet is discovered and its address found. But it is not available for the dom0 kernel's use, and it is never mapped.
J
Quoted 35 lines · Jeremy Fitzhardinge
Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Jeremy Fitzhardinge
When booting in Xen dom0, the hpet isn't really accessible, so make sure the mapping is non-NULL before use.
Signed-off-by Jeremy Fitzhardinge <[email protected]>---
arch/x86/kernel/hpet.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)===================================================================
arch/x86/kernel/hpet.c +0
-0@@ -818,9 +818,10 @@Quoted 12 lines
arch/x86/kernel/hpet.c line 825
Quoted 9 lines
arch/x86/kernel/hpet.c +3
-2hpet_address = force_hpet_address;hpet_enable (); -if (!hpet_virt_address) -return -ENODEV ; } + +if (!hpet_virt_address) +return -ENODEV ;hm, how can
hpet_virt_addressbecome non-NULL ifhpet_addressis zero?The mapping is normally created in (paravirt_ops.)time_init ->
hpet_time_init->hpet_enable->hpet_set_mapping. However, under Xen,time_initpoints to the Xen time init function, and sohpet_time_initis never called.
Quoted 5 lines
hpet_time_late_initis always called because its an initfunc. In domU it doesn't matter becausehpet_addressis NULL and so it does nothing. In dom0, however, all the ACPI table parsing gets done as normal, so the hpet is discovered and its address found. But it is not available for the dom0 kernel's use, and it is never mapped.
ok - applied it to tip/timers/hpet.
Ingo