* [PATCH V2 0/3] Emergency write support for virtio console devices. @ 2013-05-06 12:19 Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Pranavkumar Sawargaonkar ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-06 12:19 UTC (permalink / raw) To: linux-arm-kernel This patch-set implements early printk support for virtio console devices by adding and using emergency write register to virtio console's config space. The current virtio early printk code in kernel expects that hypervisor will provide some mechanism generally a hypercall to support early printk. This patch-set does not break existing hypercall based early print support. This implementation adds: 1. Emergency writeonly register named emerg_wr in virtio console's config space. 2. Host feature flags namely VIRTIO_CONSOLE_F_EMERG_WRITE for telling guest about early-write capability in console device. Emergency write mechanism: 1. When a guest wants to out some character, it has to simply write the character to emerg_wr register in config space of virtio console device. Pranavkumar Sawargaonkar (3): virtio: console: Add emergency writeonly register to config space Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. arm64: earlyprintk support for virtio-mmio console. Documentation/virtual/virtio-spec.txt | 8 +++++++- arch/arm64/kernel/early_printk.c | 35 +++++++++++++++++++++++++++++++++ include/uapi/linux/virtio_console.h | 3 +++ 3 files changed, 45 insertions(+), 1 deletion(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space 2013-05-06 12:19 [PATCH V2 0/3] Emergency write support for virtio console devices Pranavkumar Sawargaonkar @ 2013-05-06 12:19 ` Pranavkumar Sawargaonkar 2013-05-16 12:37 ` Amit Shah 2013-05-06 12:19 ` [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 3/3] arm64: earlyprintk support for virtio-mmio console Pranavkumar Sawargaonkar 2 siblings, 1 reply; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-06 12:19 UTC (permalink / raw) To: linux-arm-kernel This patch adds an 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..3fd0dce 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)); /* -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space 2013-05-06 12:19 ` [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Pranavkumar Sawargaonkar @ 2013-05-16 12:37 ` Amit Shah 2013-05-16 23:52 ` Rusty Russell 0 siblings, 1 reply; 14+ messages in thread From: Amit Shah @ 2013-05-16 12:37 UTC (permalink / raw) To: linux-arm-kernel On (Mon) 06 May 2013 [17:49:49], Pranavkumar Sawargaonkar wrote: > This patch adds an 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> OK, this change by itself looks harmless. Acked-by: Amit Shah <amit.shah@redhat.com> Amit ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space 2013-05-16 12:37 ` Amit Shah @ 2013-05-16 23:52 ` Rusty Russell 2013-05-17 6:00 ` Pranavkumar Sawargaonkar 0 siblings, 1 reply; 14+ messages in thread From: Rusty Russell @ 2013-05-16 23:52 UTC (permalink / raw) To: linux-arm-kernel Amit Shah <amit.shah@redhat.com> writes: > On (Mon) 06 May 2013 [17:49:49], Pranavkumar Sawargaonkar wrote: >> This patch adds an 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> > > OK, this change by itself looks harmless. > > Acked-by: Amit Shah <amit.shah@redhat.com> > > Amit Thanks. This is queued for *next* merge window. Cheers, Rusty. ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space 2013-05-16 23:52 ` Rusty Russell @ 2013-05-17 6:00 ` Pranavkumar Sawargaonkar 0 siblings, 0 replies; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-17 6:00 UTC (permalink / raw) To: linux-arm-kernel On 17 May 2013 05:22, Rusty Russell <rusty@rustcorp.com.au> wrote: > Amit Shah <amit.shah@redhat.com> writes: >> On (Mon) 06 May 2013 [17:49:49], Pranavkumar Sawargaonkar wrote: >>> This patch adds an 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> >> >> OK, this change by itself looks harmless. >> >> Acked-by: Amit Shah <amit.shah@redhat.com> >> >> Amit > > Thanks. This is queued for *next* merge window. > Thanks amit and rusty. > Cheers, > Rusty. Regards, Pranav ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-06 12:19 [PATCH V2 0/3] Emergency write support for virtio console devices Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Pranavkumar Sawargaonkar @ 2013-05-06 12:19 ` Pranavkumar Sawargaonkar 2013-05-07 5:02 ` Rob Landley 2013-05-13 2:52 ` Rusty Russell 2013-05-06 12:19 ` [PATCH V2 3/3] arm64: earlyprintk support for virtio-mmio console Pranavkumar Sawargaonkar 2 siblings, 2 replies; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-06 12:19 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> Signed-off-by: Anup Patel <anup.patel@linaro.org> --- Documentation/virtual/virtio-spec.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/virtual/virtio-spec.txt b/Documentation/virtual/virtio-spec.txt index 0d6ec85..3ca38f8 100644 --- a/Documentation/virtual/virtio-spec.txt +++ b/Documentation/virtual/virtio-spec.txt @@ -1927,11 +1927,16 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set ports; configuration fields nr_ports and max_nr_ports are valid and control virtqueues will be used. + VIRTIO_CONSOLE_F_EMERG_WRITE(2) Device has support for emergency + write. Configuration filed emerg_wr is valid. + Device configuration layout The size of the console is supplied in the configuration space if the VIRTIO_CONSOLE_F_SIZE feature is set. Furthermore, if the VIRTIO_CONSOLE_F_MULTIPORT feature is set, the maximum number of ports supported by the device can - be fetched.struct virtio_console_config { + be fetched. If VIRTIO_CONSOLE_F_EMERG_WRITE is set then one can + use emergency write to output single character without initializing + virtio queues. struct virtio_console_config { u16 cols; @@ -1941,6 +1946,7 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set u32 max_nr_ports; + u32 emerg_wr; }; Device Initialization -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-06 12:19 ` [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console Pranavkumar Sawargaonkar @ 2013-05-07 5:02 ` Rob Landley 2013-05-13 1:16 ` Rusty Russell 2013-05-13 2:52 ` Rusty Russell 1 sibling, 1 reply; 14+ messages in thread From: Rob Landley @ 2013-05-07 5:02 UTC (permalink / raw) To: linux-arm-kernel On 05/06/2013 07:19:50 AM, Pranavkumar Sawargaonkar wrote: > Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > Signed-off-by: Anup Patel <anup.patel@linaro.org> > --- > Documentation/virtual/virtio-spec.txt | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/Documentation/virtual/virtio-spec.txt > b/Documentation/virtual/virtio-spec.txt > index 0d6ec85..3ca38f8 100644 > --- a/Documentation/virtual/virtio-spec.txt > +++ b/Documentation/virtual/virtio-spec.txt > @@ -1927,11 +1927,16 @@ Ports 2 onwards only if > VIRTIO_CONSOLE_F_MULTIPORT is set > ports; configuration fields nr_ports and max_nr_ports are > valid and control virtqueues will be used. > > + VIRTIO_CONSOLE_F_EMERG_WRITE(2) Device has support for emergency > + write. Configuration filed emerg_wr is valid. Emergency? Really? Out of morbid curiosity, what would constitute an _emergency_ in a virtual machine logging context? Rob ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-07 5:02 ` Rob Landley @ 2013-05-13 1:16 ` Rusty Russell 0 siblings, 0 replies; 14+ messages in thread From: Rusty Russell @ 2013-05-13 1:16 UTC (permalink / raw) To: linux-arm-kernel Rob Landley <rob@landley.net> writes: > On 05/06/2013 07:19:50 AM, Pranavkumar Sawargaonkar wrote: >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >> Signed-off-by: Anup Patel <anup.patel@linaro.org> >> --- >> Documentation/virtual/virtio-spec.txt | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/virtual/virtio-spec.txt >> b/Documentation/virtual/virtio-spec.txt >> index 0d6ec85..3ca38f8 100644 >> --- a/Documentation/virtual/virtio-spec.txt >> +++ b/Documentation/virtual/virtio-spec.txt >> @@ -1927,11 +1927,16 @@ Ports 2 onwards only if >> VIRTIO_CONSOLE_F_MULTIPORT is set >> ports; configuration fields nr_ports and max_nr_ports are >> valid and control virtqueues will be used. >> >> + VIRTIO_CONSOLE_F_EMERG_WRITE(2) Device has support for emergency >> + write. Configuration filed emerg_wr is valid. > > Emergency? > > Really? > > Out of morbid curiosity, what would constitute an _emergency_ in a > virtual machine logging context? Usually, your console device is broken. Or you can't set it up because you can't allocate memory. Or you oops before it is configured. Terminology is a tricky thing, but the nuance here is that you don't want to use this as your main console. It may not do anything. It may drop characters. It's definitely slow. Cheers, Rusty. ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-06 12:19 ` [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console Pranavkumar Sawargaonkar 2013-05-07 5:02 ` Rob Landley @ 2013-05-13 2:52 ` Rusty Russell 2013-05-13 6:56 ` Pranavkumar Sawargaonkar 1 sibling, 1 reply; 14+ messages in thread From: Rusty Russell @ 2013-05-13 2:52 UTC (permalink / raw) To: linux-arm-kernel Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: > Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > Signed-off-by: Anup Patel <anup.patel@linaro.org> > --- > Documentation/virtual/virtio-spec.txt | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) OK, I applied this to the lyx master, with three changes: 1) Changed "filed" to "field". 2) Added ", or even acknowledging the feature" after "without initializing virtio queues". 3) Added an initial point to the Device Initialization section: 1. If the VIRTIO_CONSOLE_F_EMERG_WRITE feature is offered, the emerg_wr field of the configuration can be written at any time. Thus it should work for very early boot debugging output as well as catastophic OS failures (eg. virtio ring corruption). Thanks, Rusty. > diff --git a/Documentation/virtual/virtio-spec.txt b/Documentation/virtual/virtio-spec.txt > index 0d6ec85..3ca38f8 100644 > --- a/Documentation/virtual/virtio-spec.txt > +++ b/Documentation/virtual/virtio-spec.txt > @@ -1927,11 +1927,16 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set > ports; configuration fields nr_ports and max_nr_ports are > valid and control virtqueues will be used. > > + VIRTIO_CONSOLE_F_EMERG_WRITE(2) Device has support for emergency > + write. Configuration filed emerg_wr is valid. > + > Device configuration layout The size of the console is supplied > in the configuration space if the VIRTIO_CONSOLE_F_SIZE feature > is set. Furthermore, if the VIRTIO_CONSOLE_F_MULTIPORT feature > is set, the maximum number of ports supported by the device can > - be fetched.struct virtio_console_config { > + be fetched. If VIRTIO_CONSOLE_F_EMERG_WRITE is set then one can > + use emergency write to output single character without initializing > + virtio queues. struct virtio_console_config { > > u16 cols; > > @@ -1941,6 +1946,7 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set > > u32 max_nr_ports; > > + u32 emerg_wr; > }; > > Device Initialization > -- > 1.7.9.5 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-13 2:52 ` Rusty Russell @ 2013-05-13 6:56 ` Pranavkumar Sawargaonkar 2013-05-13 17:36 ` Christopher Covington 2013-05-15 4:29 ` Rusty Russell 0 siblings, 2 replies; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-13 6:56 UTC (permalink / raw) To: linux-arm-kernel Hi Rusty, On 13 May 2013 08:22, Rusty Russell <rusty@rustcorp.com.au> wrote: > Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >> Signed-off-by: Anup Patel <anup.patel@linaro.org> >> --- >> Documentation/virtual/virtio-spec.txt | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) > > OK, I applied this to the lyx master, with three changes: > 1) Changed "filed" to "field". > 2) Added ", or even acknowledging the feature" after "without > initializing virtio queues". > 3) Added an initial point to the Device Initialization section: > > 1. If the VIRTIO_CONSOLE_F_EMERG_WRITE feature is offered, the > emerg_wr field of the configuration can be written at any time. Thus > it should work for very early boot debugging output as well as > catastophic OS failures (eg. virtio ring corruption). Thanks for applying this patch. Have you also applied first patch ([PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space) with this? (https://lkml.org/lkml/2013/5/6/169) > > Thanks, > Rusty. Thanks, Pranav > >> diff --git a/Documentation/virtual/virtio-spec.txt b/Documentation/virtual/virtio-spec.txt >> index 0d6ec85..3ca38f8 100644 >> --- a/Documentation/virtual/virtio-spec.txt >> +++ b/Documentation/virtual/virtio-spec.txt >> @@ -1927,11 +1927,16 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set >> ports; configuration fields nr_ports and max_nr_ports are >> valid and control virtqueues will be used. >> >> + VIRTIO_CONSOLE_F_EMERG_WRITE(2) Device has support for emergency >> + write. Configuration filed emerg_wr is valid. >> + >> Device configuration layout The size of the console is supplied >> in the configuration space if the VIRTIO_CONSOLE_F_SIZE feature >> is set. Furthermore, if the VIRTIO_CONSOLE_F_MULTIPORT feature >> is set, the maximum number of ports supported by the device can >> - be fetched.struct virtio_console_config { >> + be fetched. If VIRTIO_CONSOLE_F_EMERG_WRITE is set then one can >> + use emergency write to output single character without initializing >> + virtio queues. struct virtio_console_config { >> >> u16 cols; >> >> @@ -1941,6 +1946,7 @@ Ports 2 onwards only if VIRTIO_CONSOLE_F_MULTIPORT is set >> >> u32 max_nr_ports; >> >> + u32 emerg_wr; >> }; >> >> Device Initialization >> -- >> 1.7.9.5 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-13 6:56 ` Pranavkumar Sawargaonkar @ 2013-05-13 17:36 ` Christopher Covington 2013-05-15 4:29 ` Rusty Russell 1 sibling, 0 replies; 14+ messages in thread From: Christopher Covington @ 2013-05-13 17:36 UTC (permalink / raw) To: linux-arm-kernel Hi Pranavkumar, On 05/13/2013 02:56 AM, Pranavkumar Sawargaonkar wrote: > Hi Rusty, > > On 13 May 2013 08:22, Rusty Russell <rusty@rustcorp.com.au> wrote: >> Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: >>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >>> Signed-off-by: Anup Patel <anup.patel@linaro.org> >>> --- >>> Documentation/virtual/virtio-spec.txt | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> OK, I applied this to the lyx master, with three changes: >> 1) Changed "filed" to "field". >> 2) Added ", or even acknowledging the feature" after "without >> initializing virtio queues". >> 3) Added an initial point to the Device Initialization section: >> >> 1. If the VIRTIO_CONSOLE_F_EMERG_WRITE feature is offered, the >> emerg_wr field of the configuration can be written at any time. Thus >> it should work for very early boot debugging output as well as >> catastophic OS failures (eg. virtio ring corruption). > > Thanks for applying this patch. > Have you also applied first patch ([PATCH V2 1/3] virtio: console: Add > emergency writeonly register to config space) > with this? (https://lkml.org/lkml/2013/5/6/169) You seem to have omitted copying virtualization at lists.linux-foundation.org, the mailing list documented in the MAINTAINERS file as appropriate for changes relating to the virtio console driver. [...] Christopher -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation. ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-13 6:56 ` Pranavkumar Sawargaonkar 2013-05-13 17:36 ` Christopher Covington @ 2013-05-15 4:29 ` Rusty Russell 2013-05-15 5:30 ` Amit Shah 1 sibling, 1 reply; 14+ messages in thread From: Rusty Russell @ 2013-05-15 4:29 UTC (permalink / raw) To: linux-arm-kernel Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: > Hi Rusty, > > On 13 May 2013 08:22, Rusty Russell <rusty@rustcorp.com.au> wrote: >> Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: >>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >>> Signed-off-by: Anup Patel <anup.patel@linaro.org> >>> --- >>> Documentation/virtual/virtio-spec.txt | 8 +++++++- >>> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> OK, I applied this to the lyx master, with three changes: >> 1) Changed "filed" to "field". >> 2) Added ", or even acknowledging the feature" after "without >> initializing virtio queues". >> 3) Added an initial point to the Device Initialization section: >> >> 1. If the VIRTIO_CONSOLE_F_EMERG_WRITE feature is offered, the >> emerg_wr field of the configuration can be written at any time. Thus >> it should work for very early boot debugging output as well as >> catastophic OS failures (eg. virtio ring corruption). > > Thanks for applying this patch. > Have you also applied first patch ([PATCH V2 1/3] virtio: console: Add > emergency writeonly register to config space) > with this? (https://lkml.org/lkml/2013/5/6/169) Would like Amit's Ack, since he's de-facto console maintainer. I've reproduced it below. Cheers, Rusty. Subject: [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Date: Mon, 6 May 2013 17:49:49 +0530 Message-Id: <1367842791-30285-2-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1367842791-30285-1-git-send-email-pranavkumar@linaro.org> References: <1367842791-30285-1-git-send-email-pranavkumar@linaro.org> X-Gm-Message-State: ALoCoQmDOoCdPmDpT+VgLwYAlJHmkUTB8sEAHVSbrNxWBzYgPHFT9rQ2A9dR8fToM81cHDZDppGx This patch adds an 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..3fd0dce 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)); /* ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console. 2013-05-15 4:29 ` Rusty Russell @ 2013-05-15 5:30 ` Amit Shah 0 siblings, 0 replies; 14+ messages in thread From: Amit Shah @ 2013-05-15 5:30 UTC (permalink / raw) To: linux-arm-kernel On (Wed) 15 May 2013 [13:59:29], Rusty Russell wrote: > Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: > > Hi Rusty, > > > > On 13 May 2013 08:22, Rusty Russell <rusty@rustcorp.com.au> wrote: > >> Pranavkumar Sawargaonkar <pranavkumar@linaro.org> writes: > >>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > >>> Signed-off-by: Anup Patel <anup.patel@linaro.org> > >>> --- > >>> Documentation/virtual/virtio-spec.txt | 8 +++++++- > >>> 1 file changed, 7 insertions(+), 1 deletion(-) > >> > >> OK, I applied this to the lyx master, with three changes: > >> 1) Changed "filed" to "field". > >> 2) Added ", or even acknowledging the feature" after "without > >> initializing virtio queues". > >> 3) Added an initial point to the Device Initialization section: > >> > >> 1. If the VIRTIO_CONSOLE_F_EMERG_WRITE feature is offered, the > >> emerg_wr field of the configuration can be written at any time. Thus > >> it should work for very early boot debugging output as well as > >> catastophic OS failures (eg. virtio ring corruption). > > > > Thanks for applying this patch. > > Have you also applied first patch ([PATCH V2 1/3] virtio: console: Add > > emergency writeonly register to config space) > > with this? (https://lkml.org/lkml/2013/5/6/169) > > Would like Amit's Ack, since he's de-facto console maintainer. I've been away, and am reviewing the discussions here. Expect a response later today. Thanks, Amit ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH V2 3/3] arm64: earlyprintk support for virtio-mmio console. 2013-05-06 12:19 [PATCH V2 0/3] Emergency write support for virtio console devices Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console Pranavkumar Sawargaonkar @ 2013-05-06 12:19 ` Pranavkumar Sawargaonkar 2 siblings, 0 replies; 14+ messages in thread From: Pranavkumar Sawargaonkar @ 2013-05-06 12:19 UTC (permalink / raw) To: linux-arm-kernel This patch implements earlyprintk based on virtio console using emerg_wr config register. Kernel args for using this will be: earlyprintk=virtio-console,<phys_address> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> Signed-off-by: Anup Patel <anup.patel@linaro.org> --- arch/arm64/kernel/early_printk.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c index ac974f4..ea3d2f5 100644 --- a/arch/arm64/kernel/early_printk.c +++ b/arch/arm64/kernel/early_printk.c @@ -25,6 +25,9 @@ #include <linux/amba/serial.h> #include <linux/serial_reg.h> +#include <linux/virtio_ids.h> +#include <linux/virtio_mmio.h> +#include <linux/virtio_console.h> static void __iomem *early_base; static void (*printch)(char ch); @@ -53,6 +56,37 @@ static void smh_printch(char ch) } /* + * VIRTIO MMIO console single character Tx. + */ +static void virtio_console_printch(char ch) +{ + u32 tmp; + static u32 init_done; + static u32 can_write; + struct virtio_console_config *p = early_base + VIRTIO_MMIO_CONFIG; + + if (!init_done) { + tmp = readl_relaxed(early_base + VIRTIO_MMIO_DEVICE_ID); + if (tmp != VIRTIO_ID_CONSOLE) { + init_done = 1; + return; + } + + tmp = readl_relaxed(early_base + VIRTIO_MMIO_HOST_FEATURES); + if (!(tmp & (1 << VIRTIO_CONSOLE_F_EMERG_WRITE))) { + init_done = 1; + return; + } + + init_done = 1; + can_write = 1; + } + + if (can_write) + writeb_relaxed(ch, &p->emerg_wr); +} + +/* * 8250/16550 (8-bit aligned registers) single character TX. */ static void uart8250_8bit_printch(char ch) @@ -82,6 +116,7 @@ static const struct earlycon_match earlycon_match[] __initconst = { { .name = "smh", .printch = smh_printch, }, { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, }, { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, }, + { .name = "virtio-console", .printch = virtio_console_printch, }, {} }; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-05-17 6:00 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-06 12:19 [PATCH V2 0/3] Emergency write support for virtio console devices Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 1/3] virtio: console: Add emergency writeonly register to config space Pranavkumar Sawargaonkar 2013-05-16 12:37 ` Amit Shah 2013-05-16 23:52 ` Rusty Russell 2013-05-17 6:00 ` Pranavkumar Sawargaonkar 2013-05-06 12:19 ` [PATCH V2 2/3] Documentation: virtio: Add emergency write (emerg_wr) config register in virtio console Pranavkumar Sawargaonkar 2013-05-07 5:02 ` Rob Landley 2013-05-13 1:16 ` Rusty Russell 2013-05-13 2:52 ` Rusty Russell 2013-05-13 6:56 ` Pranavkumar Sawargaonkar 2013-05-13 17:36 ` Christopher Covington 2013-05-15 4:29 ` Rusty Russell 2013-05-15 5:30 ` Amit Shah 2013-05-06 12:19 ` [PATCH V2 3/3] arm64: earlyprintk support for virtio-mmio console Pranavkumar Sawargaonkar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).