msm_rng-driver.txt 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. Introduction:
  2. =============
  3. The msm_rng device driver handles random number generation
  4. using hardware present in MSM chipsets.
  5. Hardware description:
  6. =====================
  7. The supported hardware is a macro block within a system-on-a-chip (SoC).
  8. The hardware is pseudo random number generator (PRNG) with four oscillators
  9. setup with a linear feedback shift register (LFSR).
  10. The hardware must be initially configured once for normal operation and
  11. a 32bit FIFO is read to obtain hardware generated pseudo random numbers.
  12. Currently the driver configures the hardware registers during initialization
  13. and the future plan is to have the boot loader configure these registers and
  14. write lock them so only host OS can read them and the driver writes will be
  15. ignored.
  16. Software description
  17. ====================
  18. The driver is based on the platform_driver model. It registers an entry,
  19. exit and probe functions. Once the probe function is called, the driver
  20. registers a callback function with the hwrng (Hardware Random Number Generator)
  21. subsystem that is called when the hardware device (i.e. /dev/hw_random) is
  22. requesting random data from this device.
  23. Once the callback is issued from the hwrng subsystem, the driver checks to
  24. make sure the hardware has random data available and determines the maximum
  25. data it can return and returns that much data back.
  26. Power Management
  27. ================
  28. Initially, no services are provided in the area of power management.
  29. SMP/multi-core
  30. ==============
  31. The locking mechanism for the hwrng operations is taken care of by the hwrng
  32. framework. There are no SMP situations within the driver that need addressing.
  33. Driver parameters
  34. =================
  35. This driver is built and statically linked into the kernel; therefore,
  36. there are no module parameters supported by this driver.
  37. There are no kernel command line parameters supported by this driver.
  38. Config options
  39. ==============
  40. This driver is enabled by the kernel config option CONFIG_HW_RANDOM_MSM.
  41. The option CONFIG_HW_RANDOM_MSM depends on HW_RANDOM && ARCH_MSM.
  42. Dependencies:
  43. =============
  44. This driver depends on the HW_RANDOM subsystem to register with and get
  45. callbacks to request random data.
  46. User space utilities:
  47. =====================
  48. The driver alone does not feed random numbers into kernel but just provides a
  49. method to get random numbers to a known device (i.e. /dev/hw_random). A user-
  50. space utility is required to monitor the /dev/random device entropy pool and
  51. feed it from the /dev/hw_random device. This application also must perform some
  52. sort of sanity checking on the returned data to make sure the data is not all
  53. the same.
  54. There is currently a GPL v2 tool called rng-tools that has a daemon called,
  55. "rngd" that performs this functionality. There is also a test tool in this
  56. package that tests the whole random subsystem.