]> git.ipfire.org Git - thirdparty/qemu.git/commit
ppc/pnv/occ: Implement a basic dynamic OCC model
authorNicholas Piggin <npiggin@gmail.com>
Mon, 9 Dec 2024 10:00:45 +0000 (20:00 +1000)
committerNicholas Piggin <npiggin@gmail.com>
Tue, 11 Mar 2025 12:43:30 +0000 (22:43 +1000)
commita1750b2cba9c70191221f206bfbed277251dd644
treef274b6a022e438944eb77c5cea3de2838c183cc5
parent028b1803fbe79aaf598b3254338d7010960d1b44
ppc/pnv/occ: Implement a basic dynamic OCC model

The OCC is an On Chip Controller that handles various thermal and power
management. It is a PPC405 microcontroller that runs its own firmware
which is out of scope of the powernv machine model. Some dynamic
behaviour and interfaces that are important for host CPU testing can be
implemented with a much simpler state machine.

This change adds a 100ms timer that ticks through a simple state machine
that looks for "OCC command requests" coming from host firmware, and
responds to them.

For now the powercap command is implemented because that is used by
OPAL and exported to Linux and is easy to test.

  $ F=/sys/firmware/opal/powercap/system-powercap/powercap-current
  $ cat $F
  100
  $ echo 50 | sudo tee $F
  50
  $ cat $F
  50

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
hw/ppc/pnv_occ.c
include/hw/ppc/pnv_occ.h