• Using HPET from userspace

    From kishna yvkr@21:1/5 to Till Wollenberg on Tue Aug 18 22:50:48 2020
    On Wednesday, April 14, 2010 at 9:37:51 PM UTC+5:30, Till Wollenberg wrote:
    I try to use the HPET timer from userspace (Ubuntu Linux 9.10, Kernel 2.6.31, x86 desktop system) to get an interrupt every 10ms. I started with example code
    from Documentation/hpet.txt [1] and [2]. Unfortunately, both programs always fail when issuing the HPET_IE_ON ioctl.
    Here is the output of the second program:
    | $ sudo ./hpet_example 32 99
    | hi_ireqfreq: 0x20 hi_flags: 0x0 hi_hpet: 0x0 hi_timer: 0x4
    | ERROR: HPET_IE_ON failed
    When looking at the kernel's debug messages, it seems that my system has eight
    HPET channels, but only four of them get an IRQ assigned:
    | $ dmesg | grep -i hpet
    | ACPI: HPET 9feb0eb5 00038 (v01 PTLTD HPETTBL 00060000 LTP 00000001)
    | ACPI: HPET id: 0x8086a701 base: 0xfed00000
    | hpet clockevent registered
    | HPET: 8 timers in total, 2 timers will be used for per-cpu timer
    | hpet0: at MMIO 0xfed00000, IRQs 2, 8, 24, 25, 0, 0, 0, 0
    | hpet0: 8 comparators, 64-bit 14.318180 MHz counter
    | hpet: hpet2 irq 24 for MSI
    | hpet: hpet3 irq 25 for MSI
    | rtc0: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
    Now I'm a bit lost... I googled a lot to find other code examples or some general information about using HPET from Linux with little success. I came across a post on LKML [3] which may address my problem, but I'm not sure if the patch was already integrated by the main distros.
    Can you give me any hints to work around the IRQ problem? Maybe there are other
    possibilities to realise a 10ms timer on the x86 platform...
    [1] http://www.mjmwired.net/kernel/Documentation/hpet.txt
    [2] http://blog.fpmurphy.com/2009/07/linux-hpet-support.html
    [3] http://lkml.org/lkml/2008/1/12/128
    real e-mail: wollenberg <at> web <dot> de

    Hi, I am Krishna.
    I also have tried to assign the IRQ's dynamically for the Timer's 3 & 4 in non legacy replacement mode by changing the bit
    #define HPET_LEG_RT_CNF_MASK (2UL) to (0UL) in include/linux/hpet.h file. But when i tried to execute the user space application which opens "/dev/hpet" and use ioctl(fd,HPET_IE_ON,0) call "HPET_IE_ON failure message appearing. And also 8259 & RTC timer
    interrupts are not generating at user space.
    Can you help me to add more IRQ's for HPET to use it in from user space.

    If possible can you please provide your whatsapp number.

    Krishna Reddy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)