Backports commit bb2e0039dc07177f928f9fe24758967da02d60a2 from qemu
Used later. An enum makes expected values explicit and bounds the value space of switches. Backports commit 77fc6f5e28667634916f114ae04c6029cd7b9c45 from qemu