OpenBSD Journal

p2k16 Hackathon Report: pirofti@ on octeon and TPM

Contributed by tj on from the resume-hacking dept.

The next hackathon report comes from Paul Irofti, who writes:

This was probably the shortest hackathon I attended. The 4 days flew by and I realised we have to pack and go with nothing to show for.

My usual hackathon work flow is: waste 3-4 days trying to figure how some device works, and then polish the driver(s) for the remaining days while congratulating myself with coffee, GŁnther and beer.

Nantes was different in this regard. I spent the first two days hacking on PCIe support for Octeon machines until my brain refused to keep browsing Cavium's SDK infinite layers of abstraction for BARs and magic values.

I thought I'd take a day off and look at why my x250 had problems suspending.

Quickly I found that the Trusted Platform Module (TPM) was at fault. If I disabled it in the BIOS or switched from TPM 1.2 to TPM 2.0 my laptop would come back from resume and all would be fine. Never the less I was curious what made the default setting break suspend.

After a bit of research it seems that before going to sleep the SaveStates command has to be issued so that the TPM chip can reload properly. If the command is not executed, then the chip reads garbage and can, per spec, prevent the machine from resuming. Great, so all I need to do is send the command and then OpenBSD will support laptops with TPM 1.2.

Little did I know about how complicated and fragile reading and writing to TPM memory will be. Just to give you a hint, a write requires the driver to acquire locality, fetch the number of bytes it is allowed to write in one go, start writing them one byte at a time and then wait for the device to permit the next batch of bytes to be written. Waiting can be done either through polling (the old-way) or via interrupts, which both require some pretty fancy dance routines. Oh, and the last byte has to be written separately. Yes.

Anyway, my modern machine seems to be a hybrid between the pre TPM 1.2 implementation and current TPM because it supports all the 1.2 features but it lacks an interrupt. So while I can read anything from the chip, writing seems to fail in subtle ways.

While I was in the middle of discovering all this, last day came and I had to leave, furiously hacking on the train back to Paris with regrets that I did not get to see Nantes properly and that most of my work is sitting in my local tree waiting to be finished.

To sum up, this was a great hackathon that I wish could be extended to a full week. I want to thank gilles@ for organizing a great event and taking care of our every need (even if it involved faxing internationally in the 21st century)! Also a big thank you to Theo de Raadt and the OpenBSD Foundation for making these hackathons happen!

Thanks for your report, Paul!

(Comments are closed)

  1. By Anonymous Coward ( on

    Mulțumesc Paul!


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]