public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Graf <agraf@suse.de>,
	Pranavkumar Sawargaonkar <pranavkumar@linaro.org>,
	"linux-arm-kernel\@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linaro-kernel\@lists.linaro.org"
	<linaro-kernel@lists.linaro.org>,
	"patches\@linaro.org" <patches@linaro.org>,
	"linux-kernel\@vger.kernel.org List"
	<linux-kernel@vger.kernel.org>,
	"kvmarm\@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	Amit Shah <amit.shah@redhat.com>
Subject: Re: [PATCH 0/2] Early printk support for virtio console devices.
Date: Mon, 06 May 2013 14:41:46 +0930	[thread overview]
Message-ID: <87ip2wr8tp.fsf@rustcorp.com.au> (raw)
In-Reply-To: <CAFEAcA9h8iSYfTBtf6n+Vk5sDtBR2yB2oafRxikHoWbKt0VRUw@mail.gmail.com>

Peter Maydell <peter.maydell@linaro.org> writes:
> On 1 May 2013 03:07, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> An emergency output is a reasonable idea, and this is a reasonable
>> implementation.  The question is practical: will it be used?  Because we
>> don't implement reasonable ideas which aren't going to be used.
>
> If you think it fits reasonably into the virtio spec (ie doesn't
> implement things at the wrong level of the transport/backend
> abstraction) then we can implement it in QEMU, and I think it
> makes more sense to do this than to throw in a random extra
> serial port.
>
> To be actually useful we need to also specify something in
> the device tree to say "here is where you will find your
> emergency output and what it is".

Hmm, I'm not sure that's true.  It looks like it needs:

1) An enhancment to the vdev->set_config callback to pass through (at
   least) an offset, probably offset and length.

2) An emerg_write() function ptr which can be called at any time, set by
   virtio_console.c's class_init:

static void emerg_write(VirtIOSerialPort *port, char c)
{
    VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);

    if (vcon->chr)
        qemu_chr_fe_write(vcon->chr, &c, 1);
}

3) A routine to find an emerg-write-capable console in
   virtio_serial_bus.c (or just assume port 0?):

static VirtIOSerialPort *find_emerg_write_port(VirtIOSerial *vser)
{
    VirtIOSerialPort *port;

    QTAILQ_FOREACH(port, &vser->ports, next) {
        VirtIOSerialPortClass *vsc;
        vsc = VIRTIO_SERIAL_PORT_GET_CLASS(port);

        if (vsc->emerg_write) {
            return port;
        }
    }
    return NULL;
}

4) set_config in virtio_serial_bus.c to notice emergency writes:

    if (offset == offsetof(struct virtio_console_config, emerg_w) {
        VirtIOSerial *vser;
        vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
        VirtIOSerialPort *port;

        port = find_emerg_write_port(vser);
        if (port) {
            vsc->emerg_write(port, config.emerg_w);
        }
    }

Amit might have more clue... Amit?

Thanks,
Rusty.

From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Subject: virtio: console: Add early writeonly register to config space

This patch adds a emerg_wr register (writeonly) in config space of virtio console device which can be used for debugging.

Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 include/uapi/linux/virtio_console.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/virtio_console.h b/include/uapi/linux/virtio_console.h
index ee13ab6..586678d 100644
--- a/include/uapi/linux/virtio_console.h
+++ b/include/uapi/linux/virtio_console.h
@@ -38,6 +38,7 @@
 /* Feature bits */
 #define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
 #define VIRTIO_CONSOLE_F_MULTIPORT 1	/* Does host provide multiple ports? */
+#define VIRTIO_CONSOLE_F_EMERG_WRITE 2	/* Does host support emergency write? */
 
 #define VIRTIO_CONSOLE_BAD_ID		(~(u32)0)
 
@@ -48,6 +49,8 @@ struct virtio_console_config {
 	__u16 rows;
 	/* max. number of ports this device can hold */
 	__u32 max_nr_ports;
+	/* emergency write register */
+	__u32 emerg_wr;
 } __attribute__((packed));
 
 /*

  reply	other threads:[~2013-05-06  7:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 11:04 [PATCH 0/2] Early printk support for virtio console devices Pranavkumar Sawargaonkar
2013-04-26 11:04 ` [PATCH 1/2] virtio: console: Add early writeonly register to config space Pranavkumar Sawargaonkar
2013-04-29  3:10   ` Rusty Russell
2013-04-26 11:04 ` [PATCH 2/2] arm64: earlyprintk support for virtio-mmio console Pranavkumar Sawargaonkar
2013-04-26 11:19 ` [PATCH 0/2] Early printk support for virtio console devices Alexander Graf
2013-04-26 11:33   ` Peter Maydell
2013-04-26 12:06     ` Anup Patel
2013-04-26 12:33       ` Arnd Bergmann
2013-04-26 12:59         ` Anup Patel
2013-04-26 15:03           ` Arnd Bergmann
2013-04-26 15:54             ` Marc Zyngier
2013-04-26 15:19         ` Peter Maydell
2013-04-29  3:09   ` Rusty Russell
2013-04-29 12:22     ` Alexander Graf
2013-04-29 12:48       ` Pranavkumar Sawargaonkar
2013-04-29 12:53         ` Alexander Graf
2013-05-01  2:07           ` Rusty Russell
2013-05-01  6:53             ` Anup Patel
2013-05-01 14:46               ` Will Deacon
2013-05-02 10:06             ` Peter Maydell
2013-05-06  5:11               ` Rusty Russell [this message]
2013-05-06  9:14                 ` Peter Maydell
2013-05-07  4:46                   ` Rusty Russell
2013-05-07 12:19                     ` Peter Maydell
2013-05-07 15:52                       ` Christopher Covington
2013-05-07 15:58                         ` Peter Maydell
2013-05-08 14:17                           ` Catalin Marinas
2013-05-09 10:39                             ` Grant Likely
2013-05-06  9:40                 ` Pranavkumar Sawargaonkar
2013-04-29 12:50       ` Peter Maydell
2013-04-29 12:53         ` Alexander Graf
2013-04-30  0:32       ` Rusty Russell
2013-05-01  0:26         ` Alexander Graf
2013-05-01  5:01           ` Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ip2wr8tp.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=agraf@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=pranavkumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox