pseries: Allow kernel's early debug output to work
authorDavid Gibson <david@gibson.dropbear.id.au>
Sun, 13 Nov 2011 17:19:01 +0000 (17:19 +0000)
committerAlexander Graf <agraf@suse.de>
Fri, 18 Nov 2011 13:22:46 +0000 (14:22 +0100)
commit18d1feecd3188f6f91026e9c6436728f84fda890
treed5f4f07c19d97aa51336c2095fbf3dcb62fe5760
parentc73d5f2a5e48c219c972a7f9bf88795af3ff7dcd
pseries: Allow kernel's early debug output to work

The PAPR specification defines a virtual TTY/console interface for guest
OSes to use via the H_PUT_TERM_CHAR and H_GET_TERM_CHAR hypercalls.  There
can be multiple virtual ttys, so these take a "termno" parameter.  This
encodes which vty to use as the 'reg' property on the device tree node
associated with that vty.

However, with the early debug options enabled, the Linux kernel will
attempt debugging output through the vty very early, before it has read
the device tree.  In this case it always uses a termno of 0.  This works
on the existing PowerVM hypervisor, so we assume there must be a hack /
feature in there which interprets termno==0 to mean the default primary
console.

To help with debugging kernels, including existing distribution kernels,
this patch implements a similar feature / hack in qemu.  If termno==0
is supplied to H_{GET,PUT}_TERM_CHAR, they use the first available vty
device instead.

We need to be careful in the case that the user has manually created
an spapr-vty at address 0. So first we search for the specified reg and
only if that doesn't match do we fall back.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/spapr_vty.c