Project

General

Profile

Actions

Feature #16430

open

platform_type is not a bitfield

Added by Joshua M. Clulow about 2 months ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

On x86 systems, determine_platform() will use various mechanisms to identify the kind of environment in which the OS is running. In particular, this is either HW_NATIVE (usually bare metal, though could still be some unacknowledged emulated system), or one of various known hypervisors (e.g., VMware, KVM, etc).

Because the contents that we store in platform_type are clearly arranged as a bitfield, one would be forgiven for thinking that you could be on more than one platform at once. This is a nonsense, though: in reality it seems that the bitfield was used so that one could use the HW_VIRTUAL mask to cover fully virtualised hypervisor environments. Notably this mask does not cover HW_XEN_PV, which is a virtualised environment, but I suppose not in the way we usually mean; at any rate, that planet is one of those scheduled for demolition.

So that people can be clear on the state of things here, we should redo these values as an enumeration. We should also replace the use of the (get_hwenv() & HW_VIRTUAL) pattern with a separate symbol that clearly describes what we're looking for; e.g., bool is_hypervisor(void).

Actions #1

Updated by Joshua M. Clulow about 2 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF