xen/domain: Prepare data for is_{pv,hvm}_domain() as early as possible
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 3 Sep 2018 13:22:16 +0000 (14:22 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Sep 2018 12:25:44 +0000 (13:25 +0100)
commit6817c6fd38086d2cb998571a3db4a38a1098d6aa
treeb303540d7efac9cd2d422a89d2c4e36efc7fe431
parent9f3fd3d339b42a632ccc1c5fff218d1d19a69f01
xen/domain: Prepare data for is_{pv,hvm}_domain() as early as possible

Given two subtle failures from getting this wrong before, and more cleanup on
the way, move the setting of d->guest_type as early as possible.

Note that despite moving the assignment of d->guest_type outside of the
is_idle_domain(d) check, it still behaves the same.  Previously, system
domains had no direct assignment of d->guest_type and behaved as PV guests
because guest_type_pv has the value 0.

While tidying up the predicate, leave a comment referring to
is_system_domain(), and move the associated ASSERT() to be beside the
assignment.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
xen/common/domain.c