Bug 112544 - [acpi] [patch] Add High Precision Event Timer Driver for userland timer facility
Summary: [acpi] [patch] Add High Precision Event Timer Driver for userland timer facility
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 7.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-acpi (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-09 12:20 UTC by takeharu1219
Modified: 2018-05-29 09:19 UTC (History)
0 users

See Also:


Attachments
hpet-timer-20070509.patch.gz (11.71 KB, text/plain)
2007-05-09 12:20 UTC, takeharu1219
no flags Details
hpet-tp.tar.bz2 (3.99 KB, text/plain)
2007-05-09 12:20 UTC, takeharu1219
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description takeharu1219 2007-05-09 12:20:02 UTC
This patch add following facilities to acpi_hpet timer driver.

	1) Periodic timer facility
	    This driver provides periodic timer facility for userland applications to 
	   use for appication specific process scheduling.

	2) Global time stamp for SMP machines.
	    This driver provides a common time-base on N-Way MP system via mmap system call.
	   It is not affected by clock freq. drifts.
	    
The following issues remain in the range that I notice:

(a) HPET timer facility can not share the interrupt with other devices:

   This constraint comes from design of HPET timer device, ISR register in HPET
  does not reports ISR state when the HPET interrupts are configured as edge interrupt.

   So we can not determine whether the interrupt should be handled by HPET driver or not.

   If we configure HPET timer interrupts as level interrupt when driver initialization phase,
  it may be able to determine the owner of interrupts. 

(b) Timer0 is not available:
   Due to issue (a), HPET timer interrupts are routed with legacy routing way 
  which is mentioned in HPET/ICH-N manuals. 

   In this way, timer0's interrupt is routed to IRQ2.

   However, as far as I see, bus_setup_interrupt can not setup the interrupt handler of IRQ2. 

   To solve this problem, we can use I/O APIC routing in stead of legacy routing.
   
   But this solution raises issue(a).  So, I can not figure out how to solve this issue.

Fix: This is not a bug.
How-To-Repeat: 	Attached test programs(they are included in hpet-tp.tar.bz2.uu) can be used to test this driver.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2007-05-09 12:27:19 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-acpi

Over to maintainer(s).
Comment 2 Marius Nuennerich 2007-05-21 14:25:32 UTC
Hi,

I haven't read the whole patch yet.
To me line 164 (of the first patch file) seems bogus. It tries to do
the right thing (read-modify-write) but actually does not.
HPET_OFFSET_ENABLE is the offset in the hpet datastructure. 

Should be like this:
val = bus_read_4(sc->mem_res, HPET_OFFSET_ENABLE);
bus_write_4(sc->mem_res, HPET_OFFSET_ENABLE, val | 1);

And 1 should better HPET_ENABLE_ENABLE.

Line 133 of the same patch does not even try to do a read-modify-write.
However the documentation is clear that it should.

This all applies to the driver in -current (1.8) as well.

regards
Marius
Comment 3 takeharu1219 2008-01-16 14:38:08 UTC
This PR can be closed.
Comment 4 dfilter service freebsd_committer freebsd_triage 2008-01-16 18:47:15 UTC
jhb         2008-01-16 18:47:07 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/acpica       acpi_hpet.c 
  Added files:
    sys/dev/acpica       acpi_hpet.h 
  Log:
  Add a header containing constants for the various HPET registers and their
  fields and update the code to match.  The PR served more as an inspiration
  than providing the actual diffs.
  
  MFC after:      1 week
  PR:             kern/112544
  
  Revision  Changes    Path
  1.14      +19 -23    src/sys/dev/acpica/acpi_hpet.c
  1.1       +65 -0     src/sys/dev/acpica/acpi_hpet.h (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Gavin Atkinson freebsd_committer freebsd_triage 2008-01-29 18:05:51 UTC
State Changed
From-To: open->patched

Was committed to -HEAD a couple of weeks ago.
Comment 6 Gavin Atkinson freebsd_committer freebsd_triage 2008-01-30 15:45:21 UTC
State Changed
From-To: patched->open

Change state back to open as per jhb's request.
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2008-02-29 01:57:50 UTC
State Changed
From-To: open->feedback

To jhb: there seems to have been a commit, then an MFC to RELENG_6 via 
1.1.4.1 on Jan 23 2008.  Is there some reason this one needs to remain 
open? 


Comment 8 Mark Linimon freebsd_committer freebsd_triage 2008-02-29 01:57:50 UTC
Responsible Changed
From-To: freebsd-acpi->jhb
Comment 9 Mark Linimon 2008-03-01 01:41:46 UTC
----- Forwarded message from John Baldwin <jhb@freebsd.org> -----

The HPET contains multiple bits.  One is a general count down timer that we 
use for timekeeping.  In addition it contains a variable number of comparator 
registers each of which can be used to generate interrupts at varying 
frequencies (or one-shot interrupts, etc.).  The current in-kernel HPET 
support only handles the count down timer.  We do not have any support for 
the comparators.  The code in the PR does include support for the 
comparators.  However, it's aim is to export them for use by userland 
drivers.  FreeBSD will probably end up using the HPET comparators to back 
deadline-style clock interrupts in place of the RTC or lapic timer at some 
point in which case certain pieces of this code may be useful.

The commit I made just extracted a few of the changes in the original patch, 
it did not contain all of the changes in the patch.  It is probably best to 
mark this as suspended and leave it as freebsd-acpi@ for now as I'm not 
currently planning on doing the deadline clock stuff.

-- 
John Baldwin

----- End forwarded message -----
Comment 10 Mark Linimon freebsd_committer freebsd_triage 2008-03-01 01:41:52 UTC
State Changed
From-To: feedback->suspended

See note from jhb in Audit-Trail. 


Comment 11 Mark Linimon freebsd_committer freebsd_triage 2008-03-01 01:41:52 UTC
Responsible Changed
From-To: jhb->freebsd-acpi
Comment 12 Andriy Gapon freebsd_committer freebsd_triage 2010-12-05 15:05:16 UTC
We still do not provide a userland interface to HPET.
But do we really want to?
What kind of applications would use it and why existing userland timer
facilities are not adequate for them?

In any case, HPET and event timer code has been substantially re-organized in
head, so the patch would have to be rebased if the submitter still want that
kind of functionality.

Thanks for helping FreeBSD!
-- 
Andriy Gapon
Comment 13 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:41:52 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 14 Andriy Gapon freebsd_committer freebsd_triage 2018-05-29 09:19:53 UTC
HPET driver has been substantially changed.
We've got userland timecounters for things like gettimeofday.
HPET has long been supported as a kernel event timer.