Message ID | 1498117132-27139-16-git-send-email-bhupinder.thakur@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | SBSA UART emulation support in Xen | expand |
On Thu, 22 Jun 2017, Bhupinder Thakur wrote: > Add a new console type VUART to connect to guest's emualated vuart > console. > > Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > CC: Ian Jackson <ian.jackson@eu.citrix.com> > CC: Wei Liu <wei.liu2@citrix.com> > CC: Stefano Stabellini <sstabellini@kernel.org> > CC: Julien Grall <julien.grall@arm.com> > > Changes since v4: > - Removed the vuart compile time flag so that vuart code is compiled always. > > Changes since v3: > - The vuart console support is under CONFIG_VUART_CONSOLE option. > - Since there is a change from last review, I have not included > reviewed-by tag from Stefano and acked-by tag from Wei. > > tools/console/client/main.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/tools/console/client/main.c b/tools/console/client/main.c > index 977779f..3dbb06f 100644 > --- a/tools/console/client/main.c > +++ b/tools/console/client/main.c > @@ -76,7 +76,7 @@ static void usage(const char *program) { > "\n" > " -h, --help display this help and exit\n" > " -n, --num N use console number N\n" > - " --type TYPE console type. must be 'pv' or 'serial'\n" > + " --type TYPE console type. must be 'pv', 'serial' or 'vuart'\n" > " --start-notify-fd N file descriptor used to notify parent\n" > , program); > } > @@ -264,6 +264,7 @@ typedef enum { > CONSOLE_INVAL, > CONSOLE_PV, > CONSOLE_SERIAL, > + CONSOLE_VUART, > } console_type; > > static struct termios stdin_old_attr; > @@ -343,6 +344,7 @@ int main(int argc, char **argv) > char *end; > console_type type = CONSOLE_INVAL; > bool interactive = 0; > + char *console_names = "serial, pv, vuart"; > > if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) > interactive = 1; > @@ -361,9 +363,12 @@ int main(int argc, char **argv) > type = CONSOLE_SERIAL; > else if (!strcmp(optarg, "pv")) > type = CONSOLE_PV; > + else if (!strcmp(optarg, "vuart")) > + type = CONSOLE_VUART; > else { > fprintf(stderr, "Invalid type argument\n"); > - fprintf(stderr, "Console types supported are: serial, pv\n"); > + fprintf(stderr, "Console types supported are: %s\n", > + console_names); > exit(EINVAL); > } > break; > @@ -436,6 +441,10 @@ int main(int argc, char **argv) > else > snprintf(path, strlen(dom_path) + strlen("/device/console/%d/tty") + 5, "%s/device/console/%d/tty", dom_path, num); > } > + if (type == CONSOLE_VUART) { > + snprintf(path, strlen(dom_path) + strlen("/vuart/0/tty") + 1, > + "%s/vuart/0/tty", dom_path); > + } > > /* FIXME consoled currently does not assume domain-0 doesn't have a > console which is good when we break domain-0 up. To keep us > -- > 2.7.4 >
On Thu, Jun 22, 2017 at 01:08:50PM +0530, Bhupinder Thakur wrote: [...] > static struct termios stdin_old_attr; > @@ -343,6 +344,7 @@ int main(int argc, char **argv) > char *end; > console_type type = CONSOLE_INVAL; > bool interactive = 0; > + char *console_names = "serial, pv, vuart"; > > if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) > interactive = 1; > @@ -361,9 +363,12 @@ int main(int argc, char **argv) > type = CONSOLE_SERIAL; > else if (!strcmp(optarg, "pv")) > type = CONSOLE_PV; > + else if (!strcmp(optarg, "vuart")) > + type = CONSOLE_VUART; > else { > fprintf(stderr, "Invalid type argument\n"); > - fprintf(stderr, "Console types supported are: serial, pv\n"); > + fprintf(stderr, "Console types supported are: %s\n", > + console_names); Coding style. > exit(EINVAL); > } > break; > @@ -436,6 +441,10 @@ int main(int argc, char **argv) > else > snprintf(path, strlen(dom_path) + strlen("/device/console/%d/tty") + 5, "%s/device/console/%d/tty", dom_path, num); > } > + if (type == CONSOLE_VUART) { > + snprintf(path, strlen(dom_path) + strlen("/vuart/0/tty") + 1, > + "%s/vuart/0/tty", dom_path); Ditto. Fix them and: Acked-by: Wei Liu <wei.liu2@citrix.com>
Hi Wei, On 28 June 2017 at 22:47, Wei Liu <wei.liu2@citrix.com> wrote: > On Thu, Jun 22, 2017 at 01:08:50PM +0530, Bhupinder Thakur wrote: > [...] >> static struct termios stdin_old_attr; >> @@ -343,6 +344,7 @@ int main(int argc, char **argv) >> char *end; >> console_type type = CONSOLE_INVAL; >> bool interactive = 0; >> + char *console_names = "serial, pv, vuart"; >> >> if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) >> interactive = 1; >> @@ -361,9 +363,12 @@ int main(int argc, char **argv) >> type = CONSOLE_SERIAL; >> else if (!strcmp(optarg, "pv")) >> type = CONSOLE_PV; >> + else if (!strcmp(optarg, "vuart")) >> + type = CONSOLE_VUART; >> else { >> fprintf(stderr, "Invalid type argument\n"); >> - fprintf(stderr, "Console types supported are: serial, pv\n"); >> + fprintf(stderr, "Console types supported are: %s\n", >> + console_names); > > Coding style. I believe you are referring to the alignment of console_names with stderr above? Since in this file, tabs are used for indentation and preserved, I am using tabs to align them but for some reason it is showing as unaligned here. If I open the patch file in vim with a tab setting of 4 then it is displayed correctly aligned. Is it my gmail setting which is making them unaligned? Regards, Bhupinder
On Thu, Jun 29, 2017 at 03:03:45PM +0530, Bhupinder Thakur wrote: > Hi Wei, > > On 28 June 2017 at 22:47, Wei Liu <wei.liu2@citrix.com> wrote: > > On Thu, Jun 22, 2017 at 01:08:50PM +0530, Bhupinder Thakur wrote: > > [...] > >> static struct termios stdin_old_attr; > >> @@ -343,6 +344,7 @@ int main(int argc, char **argv) > >> char *end; > >> console_type type = CONSOLE_INVAL; > >> bool interactive = 0; > >> + char *console_names = "serial, pv, vuart"; > >> > >> if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) > >> interactive = 1; > >> @@ -361,9 +363,12 @@ int main(int argc, char **argv) > >> type = CONSOLE_SERIAL; > >> else if (!strcmp(optarg, "pv")) > >> type = CONSOLE_PV; > >> + else if (!strcmp(optarg, "vuart")) > >> + type = CONSOLE_VUART; > >> else { > >> fprintf(stderr, "Invalid type argument\n"); > >> - fprintf(stderr, "Console types supported are: serial, pv\n"); > >> + fprintf(stderr, "Console types supported are: %s\n", > >> + console_names); > > > > Coding style. > I believe you are referring to the alignment of console_names with > stderr above? Since in this file, tabs are used for indentation and Yes. > preserved, I am using tabs to align them but for some reason it is > showing as unaligned here. If I open the patch file in vim with a tab > setting of 4 then it is displayed correctly aligned. > That's the problem. We all use 8 spaces for tab. :-)
diff --git a/tools/console/client/main.c b/tools/console/client/main.c index 977779f..3dbb06f 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -76,7 +76,7 @@ static void usage(const char *program) { "\n" " -h, --help display this help and exit\n" " -n, --num N use console number N\n" - " --type TYPE console type. must be 'pv' or 'serial'\n" + " --type TYPE console type. must be 'pv', 'serial' or 'vuart'\n" " --start-notify-fd N file descriptor used to notify parent\n" , program); } @@ -264,6 +264,7 @@ typedef enum { CONSOLE_INVAL, CONSOLE_PV, CONSOLE_SERIAL, + CONSOLE_VUART, } console_type; static struct termios stdin_old_attr; @@ -343,6 +344,7 @@ int main(int argc, char **argv) char *end; console_type type = CONSOLE_INVAL; bool interactive = 0; + char *console_names = "serial, pv, vuart"; if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) interactive = 1; @@ -361,9 +363,12 @@ int main(int argc, char **argv) type = CONSOLE_SERIAL; else if (!strcmp(optarg, "pv")) type = CONSOLE_PV; + else if (!strcmp(optarg, "vuart")) + type = CONSOLE_VUART; else { fprintf(stderr, "Invalid type argument\n"); - fprintf(stderr, "Console types supported are: serial, pv\n"); + fprintf(stderr, "Console types supported are: %s\n", + console_names); exit(EINVAL); } break; @@ -436,6 +441,10 @@ int main(int argc, char **argv) else snprintf(path, strlen(dom_path) + strlen("/device/console/%d/tty") + 5, "%s/device/console/%d/tty", dom_path, num); } + if (type == CONSOLE_VUART) { + snprintf(path, strlen(dom_path) + strlen("/vuart/0/tty") + 1, + "%s/vuart/0/tty", dom_path); + } /* FIXME consoled currently does not assume domain-0 doesn't have a console which is good when we break domain-0 up. To keep us
Add a new console type VUART to connect to guest's emualated vuart console. Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org> --- CC: Ian Jackson <ian.jackson@eu.citrix.com> CC: Wei Liu <wei.liu2@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: Julien Grall <julien.grall@arm.com> Changes since v4: - Removed the vuart compile time flag so that vuart code is compiled always. Changes since v3: - The vuart console support is under CONFIG_VUART_CONSOLE option. - Since there is a change from last review, I have not included reviewed-by tag from Stefano and acked-by tag from Wei. tools/console/client/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)