From patchwork Mon May 6 05:11:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 16713 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38CEC20F2F for ; Mon, 6 May 2013 07:55:00 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id a11sf6723012qen.8 for ; Mon, 06 May 2013 00:54:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=tBwr3RJhdZpnyEQM1r53HfG08x7RrmEB4LrCEUlfUhQ=; b=lswwI+3TOmV1defGvfj0xOxvV5I2JIAIAaMSLyeCeYJSf3ybM+loGg8QlMc6PDja1s 24wuYVEl7P/DD67IMhHIc0tWQhr2aQGKpxblnB4ObycQMjiMqqXFsrOE3NMSSKZed8zt 6seG4xnFERpJJHOxlr12iU9s67WoJ85Tw2q9MHgVlo1ZbBgi642NxbhdVdK45h7wz1aE F+7W3LAvMUVaSaCLfpVfM4SdKgLcea68dO1QqBILMknT8w/aUxV+yNfEqjw0zBVpMixD EimJh/LV+rAYE6fmJ0z//7hblPo4M5sc2Nc/xIAcAKNoC5pf77EI2MkeXplX9ygLUBae jWnw== X-Received: by 10.59.10.9 with SMTP id dw9mr16999476ved.3.1367826883526; Mon, 06 May 2013 00:54:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.104 with SMTP id nn8ls1476114qeb.64.gmail; Mon, 06 May 2013 00:54:43 -0700 (PDT) X-Received: by 10.52.95.103 with SMTP id dj7mr718529vdb.25.1367826883341; Mon, 06 May 2013 00:54:43 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id ha8si9364774vdb.126.2013.05.06.00.54.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 00:54:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id m16so2819836vca.2 for ; Mon, 06 May 2013 00:54:43 -0700 (PDT) X-Received: by 10.220.89.198 with SMTP id f6mr6559488vcm.45.1367826882901; Mon, 06 May 2013 00:54:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp35735veb; Mon, 6 May 2013 00:54:42 -0700 (PDT) X-Received: by 10.68.105.164 with SMTP id gn4mr2139909pbb.42.1367826881504; Mon, 06 May 2013 00:54:41 -0700 (PDT) Received: from ozlabs.org (ozlabs.org. [2402:b800:7003:1:1::1]) by mx.google.com with ESMTPS id h1si14725206pad.346.2013.05.06.00.54.40 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 00:54:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rusty@ozlabs.org designates 2402:b800:7003:1:1::1 as permitted sender) client-ip=2402:b800:7003:1:1::1; Received: by ozlabs.org (Postfix, from userid 1011) id 1F5842C00D0; Mon, 6 May 2013 17:54:37 +1000 (EST) From: Rusty Russell To: Peter Maydell Cc: Alexander Graf , Pranavkumar Sawargaonkar , "linux-arm-kernel\@lists.infradead.org" , "linaro-kernel\@lists.linaro.org" , "patches\@linaro.org" , "linux-kernel\@vger.kernel.org List" , "kvmarm\@lists.cs.columbia.edu" , Amit Shah Subject: Re: [PATCH 0/2] Early printk support for virtio console devices. In-Reply-To: References: <1366974299-17877-1-git-send-email-pranavkumar@linaro.org> <87obcyc9sh.fsf@rustcorp.com.au> <336C59AA-D5D7-472E-A8DA-EEB413DD6C68@suse.de> <87sj27xxjr.fsf@rustcorp.com.au> User-Agent: Notmuch/0.15.2+81~gd2c8818 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Mon, 06 May 2013 14:41:46 +0930 Message-ID: <87ip2wr8tp.fsf@rustcorp.com.au> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQn0oJR5K89U1+6vfFl3lONc/TB5x86J1zcuGXevqb5L5h2gWQjr2l6gXdrDU2VxyauAMKxB X-Original-Sender: rusty@rustcorp.com.au X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Peter Maydell writes: > On 1 May 2013 03:07, Rusty Russell 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 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 Signed-off-by: Anup Patel Signed-off-by: Rusty Russell --- 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)); /*