All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Alexander Graf <agraf@suse.de>,
	nikunj@linux.vnet.ibm.com, Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] Add a generic vga device type for that specified by '-device'
Date: Fri, 07 Mar 2014 17:34:01 +0800	[thread overview]
Message-ID: <53199289.3010802@linux.vnet.ibm.com> (raw)
In-Reply-To: <53189DCE.5050101@redhat.com>

On 03/07/2014 12:09 AM, Paolo Bonzini wrote:
> Il 06/03/2014 15:39, Andreas Färber ha scritto:
>> Am 06.03.2014 15:33, schrieb Paolo Bonzini:
>>> Il 06/03/2014 14:37, Mark Wu ha scritto:
>>>> Thanks for your reply!  I need confirm I am understanding your comments
>>>> correctly.  I think you're suggesting to traverse the pci devices and
>>>> check if it owns the I/O port 0x3d4 to detect if the vga device
>>>> is initialized.    But it seems not be able to resolve the bug. Because
>>>> the machine initialization code runs before the generic device
>>>> initialization, the I/O port 0x3d4 will not be registered at the time
>>>> machine initializes.  So it can't change the return value of
>>>> pci_vga_init.  The return value is checked in ppc code, which causes the
>>>> bug.
>>> Right.  What about looking for any PCI device with VGA class?
>> Since VGA doesn't need to be PCI (e.g., ISA, SysBus) maybe it would be a
>> good idea to add a QOM interface to those devices?
> Actually, I now understand the problem better.  All of this happens
> before the VGA device is even created, so it cannot be done with QOM.
> It's basically a command-line parsing problem.
>
> There are four cases:
>
> 1) "-vga none" on the command line
>
> 2) "-device VGA" on the command line
>
> 3) "-nodefaults" on the command line
>
> 4) "-nodefaults -device VGA" on the command line
>
> sPAPR wants to enable graphics in the second and fourth case.  However,
> this is not exactly what the patch does, as I read it, because it actually
> enables graphics in the third and fourth cases, and not in the second
> case.  Both the third and the fourth case have !has_defaults, and with
> has_defaults == 0 you always have default_vga == 0.	
Yes, you're correct. I didn't think it clearly.  I will update the patch as
what you suggested.  Thanks a lot for the great help!
>
> The last three cases have "default_vga == 0" in vl.c.  The problem is
> that -nodefaults sets default_vga to 0 too early.  Perhaps something
> like this would work:
>
> diff --git a/vl.c b/vl.c
> index 685a7a9..d9afff4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -213,6 +213,7 @@ ---> add a new variable
>   enum xen_mode xen_mode = XEN_EMULATE;
>   static int tcg_tb_size;
>
> +static int no_defaults = 0;
>   static int default_serial = 1;
>   static int default_parallel = 1;
>   static int default_virtcon = 1;
> @@ -2041,7 +2042,7 @@ ---> select_vgahw is never called with VGA_DEVICE
>   {
>       const char *opts;
>
> -    vga_interface_type = VGA_NONE;
> +    assert(vga_interface_type == VGA_NONE);
>       if (strstart(p, "std", &opts)) {
>           if (vga_available()) {
>               vga_interface_type = VGA_STD;
> @@ -2825,7 +2826,7 @@ ---> need to detect -vga
>       const char *loadvm = NULL;
>       QEMUMachine *machine;
>       const char *cpu_model;
> -    const char *vga_model = "none";
> +    const char *vga_model = NULL;
>       const char *qtest_chrdev = NULL;
>       const char *qtest_log = NULL;
>       const char *pid_file = NULL;
> @@ -3682,16 +3683,7 @@ ---> just set a flag here
>                   runstate_set(RUN_STATE_INMIGRATE);
>                   break;
>               case QEMU_OPTION_nodefaults:
> -                default_serial = 0;
> -                default_parallel = 0;
> -                default_virtcon = 0;
> -                default_sclp = 0;
> -                default_monitor = 0;
> -                default_net = 0;
> -                default_floppy = 0;
> -                default_cdrom = 0;
> -                default_sdcard = 0;
> -                default_vga = 0;
> +                no_defaults = 1;
>                   break;
>               case QEMU_OPTION_xen_domid:
>                   if (!(xen_available())) {
> @@ -3918,27 +3910,35 @@ ---> detect "-device VGA" here, also disable defaults for -nodefaults
>       qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0);
>       qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0);
>
> -    if (machine->no_serial) {
> +    if (!vga_model && !default_vga) {
> +        vga_interface_type = VGA_DEVICE;
> +    }
> +    if (no_defaults || machine->no_serial) {
>           default_serial = 0;
>       }
> -    if (machine->no_parallel) {
> +    if (no_defaults || machine->no_parallel) {
>           default_parallel = 0;
>       }
> -    if (!machine->use_virtcon) {
> +    if (no_defaults || !machine->use_virtcon) {
>           default_virtcon = 0;
>       }
> -    if (!machine->use_sclp) {
> +    if (no_defaults || !machine->use_sclp) {
>           default_sclp = 0;
>       }
> -    if (machine->no_floppy) {
> +    if (no_defaults || machine->no_floppy) {
>           default_floppy = 0;
>       }
> -    if (machine->no_cdrom) {
> +    if (no_defaults || machine->no_cdrom) {
>           default_cdrom = 0;
>       }
> -    if (machine->no_sdcard) {
> +    if (no_defaults || machine->no_sdcard) {
>           default_sdcard = 0;
>       }
> +    if (no_defaults) {
> +        default_monitor = 0;
> +        default_net = 0;
> +        default_vga = 0;
> +    }
>
>       if (is_daemonized()) {
>           /* According to documentation and historically, -nographic redirects
> @@ -4243,7 +4243,9 @@ ---> only call select_vgahw for "-vga" (or the default VGA, see the if ending here)
>               vga_model = "std";
>           }
>       }
> -    select_vgahw(vga_model);
> +    if (vga_model) {
> +        select_vgahw(vga_model);
> +    }
>
>       if (watchdog) {
>           i = select_watchdog(watchdog);
>

      reply	other threads:[~2014-03-07  9:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 12:45 [Qemu-devel] [PATCH 1/2] Add a generic vga device type for that specified by '-device' Mark Wu
2014-02-28 12:45 ` [Qemu-devel] [PATCH 2/2] Fix return value of vga initlization on ppc Mark Wu
2014-02-28 13:03 ` [Qemu-devel] [PATCH 1/2] Add a generic vga device type for that specified by '-device' Paolo Bonzini
2014-03-06 13:37   ` Mark Wu
2014-03-06 14:33     ` Paolo Bonzini
2014-03-06 14:39       ` Andreas Färber
2014-03-06 16:09         ` Paolo Bonzini
2014-03-07  9:34           ` Mark Wu [this message]

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=53199289.3010802@linux.vnet.ibm.com \
    --to=wudxw@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.