lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ip2wr8tp.fsf@rustcorp.com.au>
Date:	Mon, 06 May 2013 14:41:46 +0930
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Peter Maydell <peter.maydell@...aro.org>
Cc:	Alexander Graf <agraf@...e.de>,
	Pranavkumar Sawargaonkar <pranavkumar@...aro.org>,
	"linux-arm-kernel\@lists.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linaro-kernel\@lists.linaro.org" <linaro-kernel@...ts.linaro.org>,
	"patches\@linaro.org" <patches@...aro.org>,
	"linux-kernel\@vger.kernel.org List" <linux-kernel@...r.kernel.org>,
	"kvmarm\@lists.cs.columbia.edu" <kvmarm@...ts.cs.columbia.edu>,
	Amit Shah <amit.shah@...hat.com>
Subject: Re: [PATCH 0/2] Early printk support for virtio console devices.

Peter Maydell <peter.maydell@...aro.org> writes:
> On 1 May 2013 03:07, Rusty Russell <rusty@...tcorp.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@...aro.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@...aro.org>
Signed-off-by: Anup Patel <anup.patel@...aro.org>
Signed-off-by: Rusty Russell <rusty@...tcorp.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));
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ