[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/10] pseries: Add a routine to find a stable "defa
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 07/10] pseries: Add a routine to find a stable "default" vty and use it |
Date: |
Tue, 3 Jan 2012 16:08:19 +0100 |
From: David Gibson <address@hidden>
In vty_lookup() we have a special case for supporting early debug in
the kernel. This accepts reg == 0 as a special case to mean "any vty".
We implement this by searching the vtys on the bus and returning the
first we find. This means that the vty we chose depends on the order
the vtys are specified on the QEMU command line - because that determines
the order of the vtys on the bus.
We'd rather the command line order was irrelevant, so instead return
the vty with the lowest reg value. This is still a guess as to what the
user really means, but it is at least stable WRT command line ordering.
Signed-off-by: Michael Ellerman <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
[agraf] fix braces
---
hw/spapr_vty.c | 47 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index e217314..2923ca7 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -149,24 +149,53 @@ static VIOsPAPRDeviceInfo spapr_vty = {
},
};
+static VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus)
+{
+ VIOsPAPRDevice *sdev, *selected;
+ DeviceState *iter;
+
+ /*
+ * To avoid the console bouncing around we want one VTY to be
+ * the "default". We haven't really got anything to go on, so
+ * arbitrarily choose the one with the lowest reg value.
+ */
+
+ selected = NULL;
+ QTAILQ_FOREACH(iter, &bus->bus.children, sibling) {
+ /* Only look at VTY devices */
+ if (iter->info != &spapr_vty.qdev) {
+ continue;
+ }
+
+ sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter);
+
+ /* First VTY we've found, so it is selected for now */
+ if (!selected) {
+ selected = sdev;
+ continue;
+ }
+
+ /* Choose VTY with lowest reg value */
+ if (sdev->reg < selected->reg) {
+ selected = sdev;
+ }
+ }
+
+ return selected;
+}
+
static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg)
{
VIOsPAPRDevice *sdev;
sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg);
if (!sdev && reg == 0) {
- DeviceState *qdev;
-
/* Hack for kernel early debug, which always specifies reg==0.
- * We search all VIO devices, and grab the first available vty
- * device. This attempts to mimic existing PowerVM behaviour
+ * We search all VIO devices, and grab the vty with the lowest
+ * reg. This attempts to mimic existing PowerVM behaviour
* (early debug does work there, despite having no vty with
* reg==0. */
- QTAILQ_FOREACH(qdev, &spapr->vio_bus->bus.children, sibling) {
- if (qdev->info == &spapr_vty.qdev) {
- return DO_UPCAST(VIOsPAPRDevice, qdev, qdev);
- }
- }
+ return spapr_vty_get_default(spapr->vio_bus);
}
return sdev;
--
1.6.0.2
- [Qemu-devel] [PULL 00/10] ppc patch queue 2012-01-03, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 02/10] console: Fix segfault on screendump without VGA adapter, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 05/10] pseries: FDT NUMA extensions to support multi-node guests, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 08/10] pseries: Populate "/chosen/linux, stdout-path" in the FDT, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 10/10] PPC: Add description for the Freescale e500mc core., Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 03/10] kvm-ppc: halt secondary cpus when guest reset, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 06/10] pseries: Emit device tree nodes in reg order, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 09/10] pseries: Check for duplicate addresses on the spapr-vio bus, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 01/10] PPC: monitor: add ability to dump SLB entries, Alexander Graf, 2012/01/03
- [Qemu-devel] [PATCH 07/10] pseries: Add a routine to find a stable "default" vty and use it,
Alexander Graf <=
- [Qemu-devel] [PATCH 04/10] pseries: Remove hcalls callback, Alexander Graf, 2012/01/03
- Re: [Qemu-devel] [PULL 00/10] ppc patch queue 2012-01-03, Aurelien Jarno, 2012/01/07