From nobody Thu May 2 09:04:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506428376911729.8517712677457; Tue, 26 Sep 2017 05:19:36 -0700 (PDT) Received: from localhost ([::1]:47313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwopj-0001vT-PR for importer@patchew.org; Tue, 26 Sep 2017 08:19:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwooL-0001L3-Dx for qemu-devel@nongnu.org; Tue, 26 Sep 2017 08:18:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwooG-0004hy-Fu for qemu-devel@nongnu.org; Tue, 26 Sep 2017 08:18:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21797) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwooG-0004fp-AN; Tue, 26 Sep 2017 08:17:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B5357E440; Tue, 26 Sep 2017 12:17:53 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-104.ams2.redhat.com [10.36.116.104]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B53D6F954; Tue, 26 Sep 2017 12:17:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B5357E440 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lvivier@redhat.com From: Laurent Vivier To: David Gibson Date: Tue, 26 Sep 2017 14:17:50 +0200 Message-Id: <20170926121750.9015-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Sep 2017 12:17:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] spapr: select default vty X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" SLOF uses the "/chosen/linux,stdout-path" variable to choose its console. This variable is provided by QEMU. QEMU selects the spapr-vty using the "reg" property: it takes the vty with the lowest reg number. This patch allows the user to define "linux,stdout-path" from the command line by adding a keyword 'default' to the spapr-vty device. Signed-off-by: Laurent Vivier --- hw/char/spapr_vty.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 0fa416ca6b..aa56a9a6cb 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -15,6 +15,7 @@ typedef struct VIOsPAPRVTYDevice { CharBackend chardev; uint32_t in, out; uint8_t buf[VTERM_BUFSIZE]; + bool is_default; } VIOsPAPRVTYDevice; =20 #define TYPE_VIO_SPAPR_VTY_DEVICE "spapr-vty" @@ -153,6 +154,7 @@ void spapr_vty_create(VIOsPAPRBus *bus, Chardev *charde= v) static Property spapr_vty_properties[] =3D { DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev), DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), + DEFINE_PROP_BOOL("default", VIOsPAPRVTYDevice, is_default, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -194,11 +196,13 @@ static const TypeInfo spapr_vty_info =3D { VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) { VIOsPAPRDevice *sdev, *selected; + VIOsPAPRVTYDevice *dev; BusChild *kid; =20 /* * To avoid the console bouncing around we want one VTY to be - * the "default". We haven't really got anything to go on, so + * the "default". If the user doesn't provide the information + * we haven't really got anything to go on, so * arbitrarily choose the one with the lowest reg value. */ =20 @@ -213,6 +217,13 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) =20 sdev =3D VIO_SPAPR_DEVICE(iter); =20 + /* The user can provide the default console to use */ + + dev =3D VIO_SPAPR_VTY_DEVICE(sdev); + if (dev->is_default) { + return sdev; + } + /* First VTY we've found, so it is selected for now */ if (!selected) { selected =3D sdev; --=20 2.13.5