Hi Stefano On Wed, 25 May 2011 09:17:46 +0200, Stefano Ceccherini wrote:
2011/5/24 Michael Lotz <mmlr@xxxxxxxx>:Since the APIC timer is calibrated using the TSC which in turn iscalibrated using the PIT it's not so surprising that both fail in thiscase.What you could try is to still use mode 0, but instead use a different channel, channel 2 (as channel one isn't usually implemented anymore)in the TSC calibration. That is the combination that Linux uses for their "fast TSC calibration using PIT" and I think also for thecorresponding "slow" version. The dmesg output of Linux should tell you if and how it calibrated the TSC which should indicate what method isusable.Bingo! Using PIT channel 2 (in the kernel) works, and haiku boots correctly on XenServer. Note that modifying the code in the boot loader didn't make a difference. I had instead to change line 55 of src/system/kernel/arch/x86/timer/x86_pit.cpp from out8(PIT_SELCH0 | PIT_RWBOTH | PIT_MD_INTON0, PIT_CTRL); to out8(PIT_SELCH2 | PIT_RWBOTH | PIT_MD_INTON0, PIT_CTRL); If applied, would close ticket #4500. Thanks for the tip!
That's not what I'm talking about...
Note that I still have to disable the apic in the virtual machine, otherwise I experience the symptoms described in ticket #7497.
I'm talking about the bootloader code in src/system/boot/platform/bios_ia32/cpu.cpp where the PIT is used to calibrate the TSC. This is where you're supposed to use channel 2 instead of 0 (and this is what the changes were to). If the calibration works correctly, then the APIC timer should work as well and you can disregard the non working PIT later in the kernel. You don't really want to use the PIT because it is far less flexible than the APIC timer.