public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	john@jfloren.net, kvm@vger.kernel.org, asias.hejun@gmail.com,
	gorcunov@gmail.com, prasadjoshi124@gmail.com
Subject: Re: [PATCH 5/5 V2] kvm tools: Initialize and use VESA and VNC
Date: Mon, 23 May 2011 14:45:10 +0300	[thread overview]
Message-ID: <4DDA48C6.2030103@cs.helsinki.fi> (raw)
In-Reply-To: <20110523113824.GE4042@elte.hu>

On 5/23/11 2:38 PM, Ingo Molnar wrote:
> * Sasha Levin<levinsasha928@gmail.com>  wrote:
>
>> @@ -511,7 +515,13 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>>   	kvm->nrcpus = nrcpus;
>>
>>   	memset(real_cmdline, 0, sizeof(real_cmdline));
>> -	strcpy(real_cmdline, "notsc noapic noacpi pci=conf1 console=ttyS0 earlyprintk=serial");
>> +	strcpy(real_cmdline, "notsc noapic noacpi pci=conf1");
>> +	if (vnc) {
>> +		strcat(real_cmdline, " video=vesafb console=tty0");
>> +		vidmode = 0x312;
>> +	} else {
>> +		strcat(real_cmdline, " console=ttyS0 earlyprintk=serial");
>> +	}
> Hm, i think all the kernel parameter handling code wants to move into driver
> specific routines as well. Something like:
>
> 	serial_init(kvm, real_cmdline);
>
> where serial_init() would append to real_cmdline if needed.
>
> This removes a bit of serial-driver specific knowledge from kvm-run.c.
>
> Same goes for the VESA driver and the above video mode flag logic.
>
>> @@ -597,6 +607,9 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>>
>>   	kvm__init_ram(kvm);
>>
>> +	if (vnc)
>> +		vesa__init(kvm);
> Shouldnt vesa__init() itself know about whether it's active (i.e. the 'vnc'
> flag is set) and return early if it's not set?
>
> That way this could become more encapsulated and self-sufficient:
>
> 	vesa__init(kvm);
>
> With no VESA driver specific state exposed to the generic kvm_cmd_run()
> function.
>
> Ideally kvm_cmd_run() hould just be a series of:
>
> 	serial_init(kvm, real_cmdline);
> 	vesa_init(kvm, real_cmdline);
> 	...
>
> initialization routines. Later on even this could be removed: using section
> tricks we can put init functions into a section and drivers could register
> their init function like initcall(func) functions are registered within the
> kernel. kvm_cmd_run() could thus iterate over that (build time constructed)
> section like this:
>
> extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
>
> static void __init do_initcalls(void)
> {
>          initcall_t *fn;
>
>          for (fn = __early_initcall_end; fn<  __initcall_end; fn++)
>                  do_one_initcall(*fn);
> }
>
> and would not actually have *any* knowledge about what drivers were built in.
>
> Currently it's fine to initialize everything explicitly - but this would be the
> long term model to work towards ...

Prasad, didn't you have patches to do exactly that?

  reply	other threads:[~2011-05-23 11:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 11:19 [PATCH 1/5 V2] kvm tools: Add BIOS INT10 handler Sasha Levin
2011-05-23 11:19 ` [PATCH 2/5 V2] kvm tools: Add video mode to kernel initialization Sasha Levin
2011-05-23 11:30   ` Ingo Molnar
2011-05-23 11:19 ` [PATCH 3/5 V2] kvm tools: Add VESA device Sasha Levin
2011-05-23 11:32   ` Ingo Molnar
2011-05-23 11:19 ` [PATCH 4/5 V2] kvm tools: Update makefile and feature tests Sasha Levin
2011-05-23 11:19 ` [PATCH 5/5 V2] kvm tools: Initialize and use VESA and VNC Sasha Levin
2011-05-23 11:38   ` Ingo Molnar
2011-05-23 11:45     ` Pekka Enberg [this message]
2011-05-24  8:37     ` Paolo Bonzini
2011-05-24  8:50       ` Ingo Molnar
2011-05-24  9:10         ` Paolo Bonzini
2011-05-24  9:55           ` Pekka Enberg
2011-05-24 11:22             ` Avi Kivity
2011-05-24 11:26               ` Pekka Enberg
2011-05-24 11:30                 ` Sasha Levin
2011-05-24 11:30                 ` Avi Kivity
2011-05-24 11:38                   ` Pekka Enberg
2011-05-24 11:41                     ` Avi Kivity
2011-05-24 11:56                       ` Pekka Enberg
2011-05-24 12:27                         ` Paolo Bonzini
2011-05-24 14:38                           ` Avi Kivity
2011-05-24 14:37                       ` Avi Kivity
2011-05-24 14:54                         ` Pekka Enberg
2011-05-24 19:03                           ` Ingo Molnar
2011-05-24 19:00                     ` Ingo Molnar
2011-05-24 19:16           ` Ingo Molnar
2011-05-24  9:18         ` Paolo Bonzini
2011-05-24 19:40           ` Ingo Molnar
2011-05-25  8:21             ` Paolo Bonzini
2011-05-25  8:32               ` Ingo Molnar
2011-05-25  9:15                 ` Paolo Bonzini
2011-05-25  9:36                   ` Ingo Molnar
2011-05-25 10:01                     ` Paolo Bonzini
2011-05-25 10:17                       ` Ingo Molnar
2011-05-25 10:44                         ` Paolo Bonzini
2011-05-25 12:53                           ` Ingo Molnar
2011-05-25 15:37                             ` Paolo Bonzini
2011-05-25  9:49                   ` Ingo Molnar
2011-05-25  8:38               ` Ingo Molnar
2011-05-24  8:51       ` Cyrill Gorcunov
2011-05-23 14:10   ` Pekka Enberg
2011-05-23 11:29 ` [PATCH 1/5 V2] kvm tools: Add BIOS INT10 handler Ingo Molnar

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=4DDA48C6.2030103@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=john@jfloren.net \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=prasadjoshi124@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox