Skip to contentSkip to conversation

device driver for the SGI system clock, mmtimer

DISCUSSION Bjorn Helgaas 7 participants 20 messages Sep 16, 2004 – Sep 20, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

I think you should look at adding your functionality to hpet.c rather than adding a new driver.

#1 lore raw
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

No, it's different hardware.

Quoted 2 lines

I think you should look at adding your functionality to hpet.c rather than adding a new driver.

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

Jesse

#2 lore raw
Quoted 3 lines · Jesse Barnes

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

drivers/char/Kconfig:

config HPET_MMAP
bool "Allow mmap of HPET"
default y
depends on HPET
help
If you say Y here, user applications will be able to mmap the HPET registers.

In some hardware implementations, the page containing HPET registers may also contain other things that shouldn't be exposed to the user. If this applies to your hardware, say N here.

Signature · 3 lines
Marcello Barnaba - SoftMedia S.c.r.l.    ::    Mobile: +39 (340) 3698342
Via Mauro Amoruso, 11 - 70124 Bari       ::    Phone:  +39 (080) 5046314
pub 1024D/F04476A2 :: 6807 EEA5 7F97 AC9A D8EF  AE73 64CD 71A2 F044 76A2
#3 lore raw
In reply to Jesse Barnes
Quoted 11 lines · Jesse Barnes
Quoted 2 lines

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

No, it's different hardware.

Quoted 2 lines

I think you should look at adding your functionality to hpet.c rather than adding a new driver.

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

HPET also allows mmaping to userspace.

#4 lore raw
In reply to Jesse Barnes
Quoted 3 lines · Jesse Barnes

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

It can do but that assumes nothing else is mapped into the same page that would be harmful or reveal information that should not be revealed etc..

#5 lore raw
Quoted 8 lines · Alan Cox
Quoted 3 lines · Jesse Barnes

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

It can do but that assumes nothing else is mapped into the same page that would be harmful or reveal information that should not be revealed etc..

And what about the register layout? mmtimer makes sure that the register is on a page by itself before it allows the mmap, and only exports the counter register itself. Can hpet do that?

Jesse

#6 lore raw
Quoted 17 lines · Jesse Barnes
Quoted 13 lines · Alan Cox
Quoted 5 lines · Jesse Barnes

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

It can do but that assumes nothing else is mapped into the same page that would be harmful or reveal information that should not be revealed etc..

Quoted 6 lines

And what about the register layout? mmtimer makes sure that the register is on a page by itself before it allows the mmap, and only exports the counter register itself. Can hpet do that?

Jesse

The hpet driver checks that the mapping is page aligned. It's up to the platform to provide this alignment. It's also dependent on the platform for what resides in the page. Also the configured page size could impact what is within the page.

#7 lore raw
Quoted 4 lines · Robert Picco

The hpet driver checks that the mapping is page aligned. It's up to the platform to provide this alignment. It's also dependent on the platform for what resides in the page. Also the configured page size could impact what is within the page.

Right, mmtimer has the same checks. I'll leave it up to Christoph. I haven't looked at the hpet driver at all, so I'm not sure if it's appropriate.

Jesse

#8 lore raw
In reply to Alan Cox
Quoted 13 lines · Alan Cox
Quoted 3 lines · Jesse Barnes

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

It can do but that assumes nothing else is mapped into the same page that would be harmful or reveal information that should not be revealed etc..

HPET driver does provide mmap for user programs.

I agree with caution of other device registers in the same page.

#9 lore raw
In reply to Jesse Barnes
Quoted 10 lines · Jesse Barnes
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

No, it's different hardware.

mmtimer and hpet are the same hardware actually, just a different specification revision, hpet being the newer one.

Quoted 6 lines
Quoted 2 lines

I think you should look at adding your functionality to hpet.c rather than adding a new driver.

I think Christoph already looked at that. And HPET doesn't provide mmap functionality, does it? I.e. allow a userspace program to dereference the counter register directly?

HPET registers are MMIO so it's in theory possible, while not really useful if you're using it as your system timer as well.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#10 lore raw
Quoted 7 lines · Vojtech Pavlik
Quoted 6 lines · Jesse Barnes
Quoted 5 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

No, it's different hardware.

mmtimer and hpet are the same hardware actually, just a different specification revision, hpet being the newer one.

Well, the SHub RTC hardware (which mmtimer accesses) isn't really HPET or mmtimer hardware, but I tried to make the mmtimer *API* useful for HPET style hardware. The idea was to have several drivers supporting the mmtimer API with different hardware underneath.

Quoted 2 lines

HPET registers are MMIO so it's in theory possible, while not really useful if you're using it as your system timer as well.

I don't think anyone does this.

Jesse

#11 lore raw
Quoted 13 lines · Jesse Barnes
Quoted 12 lines · Vojtech Pavlik
Quoted 10 lines · Jesse Barnes
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

No, it's different hardware.

Quoted 7 lines
Quoted 2 lines

mmtimer and hpet are the same hardware actually, just a different specification revision, hpet being the newer one.

Well, the SHub RTC hardware (which mmtimer accesses) isn't really HPET or mmtimer hardware, but I tried to make the mmtimer *API* useful for HPET style hardware. The idea was to have several drivers supporting the mmtimer API with different hardware underneath.

Sorry, I got confused by the driver name.

Quoted 4 lines
Quoted 2 lines

HPET registers are MMIO so it's in theory possible, while not really useful if you're using it as your system timer as well.

I don't think anyone does this.

x86-64 does if SMP is enabled and HPET is present.

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#12 lore raw
In reply to Vojtech Pavlik
Quoted 2 lines · Vojtech Pavlik

mmtimer and hpet are the same hardware actually, just a different specification revision, hpet being the newer one.

Its basically the same software API but different hardware. But I would actually welcome a driver integration. If you would be willing to let me wedge the mmtimer specifics into the hpet.c driver ;-). I would insist though that the way mmtimer maps its timer to userspace be also supported by the hpet driver and that you will not insist on preserving the current memory layout of the userspace mapping for hpet. The rest of the API could be shared to large extend.

#13 lore raw
Quoted 5 lines · Christoph Lameter
Quoted 2 lines · Vojtech Pavlik

mmtimer and hpet are the same hardware actually, just a different specification revision, hpet being the newer one.

Its basically the same software API but different hardware.

OK, I guess I'm convinced that the SGI mmtimer and the HPET really are different things. It looks like the counter resolution, frequency, and size (which are all described in the HPET register set) are either compiled into mmtimer or discovered via special- purpose SGI hooks.

So maybe it's not really a good thing to integrate mmtimer and hpet. Apps that mmap the HPET will be expecting a certain register layout that mmtimer doesn't support.

I was confused because your mmtimer patch mentions the Intel spec, and the driver identifies itself as "IA-PC Multimedia Timer". My vote would be to leave mmtimer alone, and perhaps remove the references to the Intel spec and change the driver ident string. After all, it doesn't really implement very much of the HPET functionality, and I don't think the Intel spec says anything that relates to the SGI hardware.

#14 lore raw
In reply to Bjorn Helgaas
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

The Intel Multimedia Standard is a earlier and different timer spec.

#15 lore raw
Quoted 10 lines · Christoph Lameter
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

The Intel Multimedia Standard is a earlier and different timer spec.

I have a spec that's labelled "IA-PC Multimedia Timers", preliminary draft of June 2000, revision 0.97, which looks like the one mentioned in your patch.

I also have something labelled "IA-PC HPET (High Precision Event Timers) Specification", draft of February 2002, revision 0.98, which is what drivers/char/hpet.c supports.

I admit I haven't compared them in great detail, but they certainly *look* like they're close enough that the same driver could support both, and the 0.98 revision history only mentions fairly cosmetic changes (like the name :)).

Is there something specific that drivers/char/hpet.c expects that your hardware doesn't implement?

#16 lore raw
Quoted 30 lines · Bjorn Helgaas
Quoted 11 lines · Christoph Lameter
Quoted 8 lines · Bjorn Helgaas
Quoted 5 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

Quoted 7 lines
Quoted 4 lines

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

The Intel Multimedia Standard is a earlier and different timer spec.

I have a spec that's labelled "IA-PC Multimedia Timers", preliminary draft of June 2000, revision 0.97, which looks like the one mentioned in your patch.

I also have something labelled "IA-PC HPET (High Precision Event Timers) Specification", draft of February 2002, revision 0.98, which is what drivers/char/hpet.c supports.

Quoted 10 lines

I admit I haven't compared them in great detail, but they certainly *look* like they're close enough that the same driver could support both, and the 0.98 revision history only mentions fairly cosmetic changes (like the name :)).

Is there something specific that drivers/char/hpet.c expects that your hardware doesn't implement?

Look at HPET revision history. Specifically 0.98 01/20/2002
* Product name changed: from Multimedia Timer to HPET (High
Precision Event Timer)

Bob

#17 lore raw
Quoted 5 lines · Robert Picco
Quoted 2 lines

Is there something specific that drivers/char/hpet.c expects that your hardware doesn't implement?

Look at HPET revision history. Specifically 0.98 01/20/2002
* Product name changed: from Multimedia Timer to HPET (High
Precision Event Timer)

The HPET timer has a specific memory layout of registers that is mappable to user space. The mmtimer driver only allows the mapping of a single 64 bit counter to use space. We have lots of applications at SGI that rely on mmtimer since mmtimer provides a locally accessible clock in an NUMA environment with hundreds of CPU. A hpet device would have to show up in the global address space and require cross node accesses in our NUMA environment that would make access to the timer slow. All CPU would content for access to a certain global memory address.

The HPET hardware and the sgi mmtimer are totally different architectures that are not easily reconcilable.

The software API to handle both is similar and we would like it to be as compatible as possible.

#18 lore raw
Quoted 26 lines · Christoph Lameter
Quoted 9 lines · Robert Picco
Quoted 4 lines

Is there something specific that drivers/char/hpet.c expects that your hardware doesn't implement?

Look at HPET revision history. Specifically 0.98 01/20/2002
* Product name changed: from Multimedia Timer to HPET (High
Precision Event Timer)

The HPET timer has a specific memory layout of registers that is mappable to user space. The mmtimer driver only allows the mapping of a single 64 bit counter to use space. We have lots of applications at SGI that rely on mmtimer since mmtimer provides a locally accessible clock in an NUMA environment with hundreds of CPU. A hpet device would have to show up in the global address space and require cross node accesses in our NUMA environment that would make access to the timer slow. All CPU would content for access to a certain global memory address.

The HPET hardware and the sgi mmtimer are totally different architectures that are not easily reconcilable.

Quoted 11 lines

The software API to handle both is similar and we would like it to be as compatible as possible.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Ah. Well this might be possible. The HP HPET hardware is on each NUMA node. So cross node issues could be addressed. The bit counter isn't an open point for the HPET driver. Only the HPET timers which march against the bit counter can be opened. The current open logic in the driver hunts to find an available timer. To coexist with mmtimer and just enabling the mmaping of the bit counter would require changing the driver API. The other API issues are resolvable with little effort. I think ;-)

Bob

#19 lore raw
In reply to Bjorn Helgaas
Quoted 16 lines · Bjorn Helgaas
Quoted 10 lines · Christoph Lameter
Quoted 7 lines · Bjorn Helgaas
Quoted 3 lines · Christoph Lameter

The timer hardware was designed around the multimedia timer specification by Intel but to my knowledge only SGI has implemented that standard. The driver was written by Jesse Barnes.

As far as I can see, drivers/char/hpet.c talks to the same hardware. HP sx1000 machines (and probably others) also implement the HPET.

The Intel Multimedia Standard is a earlier and different timer spec.

I have a spec that's labelled "IA-PC Multimedia Timers", preliminary draft of June 2000, revision 0.97, which looks like the one mentioned in your patch.

Quoted 8 lines

I also have something labelled "IA-PC HPET (High Precision Event Timers) Specification", draft of February 2002, revision 0.98, which is what drivers/char/hpet.c supports.

I admit I haven't compared them in great detail, but they certainly *look* like they're close enough that the same driver could support both, and the 0.98 revision history only mentions fairly cosmetic changes (like the name :)).

Indeed, I coded the x86-64 HPET support using the 0.97 spec, and then only did a few minor fixups when I got the 0.98 spec.

Quoted 8 lines

Is there something specific that drivers/char/hpet.c expects that your hardware doesn't implement?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR