RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-28 Thread Haiyang Zhang
> -Original Message-
> From: Olaf Hering [mailto:o...@aepfle.de]
> Sent: Thursday, February 28, 2013 10:17 AM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
> jasow...@redhat.com; linux-kernel@vger.kernel.org;
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
> Driver
> 
> On Fri, Feb 15, Haiyang Zhang wrote:
> 
> > +   if (fb_get_options("hyperv_fb", ) || !opt || !*opt)
> 
> > +   strcpy(info->fix.id, "hyperv");
> 
> 
> Here is a mismatch between video= and /proc/fb output.
> Both should have the same string IMO.

I will make both of them to be KBUILD_MODNAME.

Thanks,
- Haiyang


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-28 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

> + if (fb_get_options("hyperv_fb", ) || !opt || !*opt)

> + strcpy(info->fix.id, "hyperv");


Here is a mismatch between video= and /proc/fb output.
Both should have the same string IMO.

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-28 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

 + if (fb_get_options(hyperv_fb, opt) || !opt || !*opt)

 + strcpy(info-fix.id, hyperv);


Here is a mismatch between video=optname and /proc/fb output.
Both should have the same string IMO.

Olaf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-28 Thread Haiyang Zhang
 -Original Message-
 From: Olaf Hering [mailto:o...@aepfle.de]
 Sent: Thursday, February 28, 2013 10:17 AM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
 jasow...@redhat.com; linux-kernel@vger.kernel.org;
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
 Driver
 
 On Fri, Feb 15, Haiyang Zhang wrote:
 
  +   if (fb_get_options(hyperv_fb, opt) || !opt || !*opt)
 
  +   strcpy(info-fix.id, hyperv);
 
 
 Here is a mismatch between video=optname and /proc/fb output.
 Both should have the same string IMO.

I will make both of them to be KBUILD_MODNAME.

Thanks,
- Haiyang


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-21 Thread Haiyang Zhang

> From: Olaf Hering
> Sent: Thursday, February 21, 2013 10:53 AM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan; 
> jasow...@redhat.com; linux-kernel@vger.kernel.org; 
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer 
> Driver
> 
> On Tue, Feb 19, Haiyang Zhang wrote:
> 
> > In my test, the vesafb doesn't automatically give up the emulated video 
> > device,
> > unless I add the DMI based mechanism to let it exit on Hyper-V.
> 
> From reading the code, it seems to do that via
> do_remove_conflicting_framebuffers(). hypervfb does not set apertures
> etc, so that function is a noop.

We are currently allocating a new framebuffer for hyperv_fb, which is different
from the framebuffer for the emulated video. So this cannot be detected by
do_remove_conflicting_framebuffers() based on apertures_overlap().

> My point is that with this new driver distro kernel will have no console
> output until hypervfb is loaded. On native hardware there is at least
> vesafb which can display something until initrd is running. So if the
> hypervisor allows that hypervfb can shutdown the emulated vesa hardware
> then it should do that.

Since the generic vga driver starts to work early in the boot process, the 
console
messages are still displayed without vesafb. Actually, I didn't see any console 
messages missing when comparing it to the original VM before my patch.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-21 Thread Olaf Hering
On Tue, Feb 19, Haiyang Zhang wrote:

> > I havent read the vesafb code, but I think it can kind of give up the
> > hardware, something ata_piix can not do.
> 
> In my test, the vesafb doesn't automatically give up the emulated video 
> device,
> unless I add the DMI based mechanism to let it exit on Hyper-V.

>From reading the code, it seems to do that via
do_remove_conflicting_framebuffers(). hypervfb does not set apertures
etc, so that function is a noop.


My point is that with this new driver distro kernel will have no console
output until hypervfb is loaded. On native hardware there is at least
vesafb which can display something until initrd is running. So if the
hypervisor allows that hypervfb can shutdown the emulated vesa hardware
then it should do that.


Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-21 Thread Olaf Hering
On Tue, Feb 19, Haiyang Zhang wrote:

  I havent read the vesafb code, but I think it can kind of give up the
  hardware, something ata_piix can not do.
 
 In my test, the vesafb doesn't automatically give up the emulated video 
 device,
 unless I add the DMI based mechanism to let it exit on Hyper-V.

From reading the code, it seems to do that via
do_remove_conflicting_framebuffers(). hypervfb does not set apertures
etc, so that function is a noop.


My point is that with this new driver distro kernel will have no console
output until hypervfb is loaded. On native hardware there is at least
vesafb which can display something until initrd is running. So if the
hypervisor allows that hypervfb can shutdown the emulated vesa hardware
then it should do that.


Olaf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-21 Thread Haiyang Zhang

 From: Olaf Hering
 Sent: Thursday, February 21, 2013 10:53 AM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan; 
 jasow...@redhat.com; linux-kernel@vger.kernel.org; 
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer 
 Driver
 
 On Tue, Feb 19, Haiyang Zhang wrote:
 
  In my test, the vesafb doesn't automatically give up the emulated video 
  device,
  unless I add the DMI based mechanism to let it exit on Hyper-V.
 
 From reading the code, it seems to do that via
 do_remove_conflicting_framebuffers(). hypervfb does not set apertures
 etc, so that function is a noop.

We are currently allocating a new framebuffer for hyperv_fb, which is different
from the framebuffer for the emulated video. So this cannot be detected by
do_remove_conflicting_framebuffers() based on apertures_overlap().

 My point is that with this new driver distro kernel will have no console
 output until hypervfb is loaded. On native hardware there is at least
 vesafb which can display something until initrd is running. So if the
 hypervisor allows that hypervfb can shutdown the emulated vesa hardware
 then it should do that.

Since the generic vga driver starts to work early in the boot process, the 
console
messages are still displayed without vesafb. Actually, I didn't see any console 
messages missing when comparing it to the original VM before my patch.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Haiyang Zhang
> -Original Message-
> From: linux-fbdev-ow...@vger.kernel.org [mailto:linux-fbdev-
> ow...@vger.kernel.org] On Behalf Of Olaf Hering
> Sent: Tuesday, February 19, 2013 1:40 PM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
> jasow...@redhat.com; linux-kernel@vger.kernel.org;
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
> Driver
> 
> On Tue, Feb 19, Haiyang Zhang wrote:
> 
> > The emulated video device is a separate device from the synthetic
> video.
> > The synthetic driver can only take control of the synthetic video, but
> not
> > the emulated video.
> 
> Please add this to the comment above.

Will do.

> > Actually, we already have a similar mechanism in ata/ata_piix.c to
> disable
> > emulated IDE drive on Hyper-V, so it won't conflict with the synthetic
> drive.
> 
> I havent read the vesafb code, but I think it can kind of give up the
> hardware, something ata_piix can not do.

In my test, the vesafb doesn't automatically give up the emulated video device,
unless I add the DMI based mechanism to let it exit on Hyper-V.

Thanks,
- Haiyang



Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Olaf Hering
On Tue, Feb 19, Haiyang Zhang wrote:

> The emulated video device is a separate device from the synthetic video.
> The synthetic driver can only take control of the synthetic video, but not
> the emulated video.

Please add this to the comment above.

> Actually, we already have a similar mechanism in ata/ata_piix.c to disable
> emulated IDE drive on Hyper-V, so it won't conflict with the synthetic drive.

I havent read the vesafb code, but I think it can kind of give up the
hardware, something ata_piix can not do.

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Haiyang Zhang
> -Original Message-
> From: Olaf Hering [mailto:o...@aepfle.de]
> Sent: Tuesday, February 19, 2013 11:51 AM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
> jasow...@redhat.com; linux-kernel@vger.kernel.org;
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
> Driver
> 
> On Fri, Feb 15, Haiyang Zhang wrote:
> 
> > @@ -508,6 +544,18 @@ static int __init vesafb_init(void)
> > int ret;
> > char *option = NULL;
> >
> > +#if IS_ENABLED(CONFIG_HYPERV_FB)
> > +   /*
> > +* On Hyper-V both the emulated and synthetic video devices are
> > +* available. To avoid conflicts, we disable vesafb for the
> emulated
> > +* video if hyperv_fb is configured.
> > +*/
> > +   if (is_hyperv()) {
> > +   pr_info("Disabled vesafb on Hyper-V.\n");
> > +   return -ENODEV;
> > +   }
> > +#endif
> 
> What is the reason for this hook? Is it not possible to claim the
> display like its appearently done by other drivers (like radeonfb can
> take over display from vesafb)?

The emulated video device is a separate device from the synthetic video.
The synthetic driver can only take control of the synthetic video, but not
the emulated video.

Actually, we already have a similar mechanism in ata/ata_piix.c to disable
emulated IDE drive on Hyper-V, so it won't conflict with the synthetic drive.

Thanks,
- Haiyang



Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

> @@ -508,6 +544,18 @@ static int __init vesafb_init(void)
>   int ret;
>   char *option = NULL;
>  
> +#if IS_ENABLED(CONFIG_HYPERV_FB)
> + /*
> +  * On Hyper-V both the emulated and synthetic video devices are
> +  * available. To avoid conflicts, we disable vesafb for the emulated
> +  * video if hyperv_fb is configured.
> +  */
> + if (is_hyperv()) {
> + pr_info("Disabled vesafb on Hyper-V.\n");
> + return -ENODEV;
> + }
> +#endif

What is the reason for this hook? Is it not possible to claim the
display like its appearently done by other drivers (like radeonfb can
take over display from vesafb)?

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

 @@ -508,6 +544,18 @@ static int __init vesafb_init(void)
   int ret;
   char *option = NULL;
  
 +#if IS_ENABLED(CONFIG_HYPERV_FB)
 + /*
 +  * On Hyper-V both the emulated and synthetic video devices are
 +  * available. To avoid conflicts, we disable vesafb for the emulated
 +  * video if hyperv_fb is configured.
 +  */
 + if (is_hyperv()) {
 + pr_info(Disabled vesafb on Hyper-V.\n);
 + return -ENODEV;
 + }
 +#endif

What is the reason for this hook? Is it not possible to claim the
display like its appearently done by other drivers (like radeonfb can
take over display from vesafb)?

Olaf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Haiyang Zhang
 -Original Message-
 From: Olaf Hering [mailto:o...@aepfle.de]
 Sent: Tuesday, February 19, 2013 11:51 AM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
 jasow...@redhat.com; linux-kernel@vger.kernel.org;
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
 Driver
 
 On Fri, Feb 15, Haiyang Zhang wrote:
 
  @@ -508,6 +544,18 @@ static int __init vesafb_init(void)
  int ret;
  char *option = NULL;
 
  +#if IS_ENABLED(CONFIG_HYPERV_FB)
  +   /*
  +* On Hyper-V both the emulated and synthetic video devices are
  +* available. To avoid conflicts, we disable vesafb for the
 emulated
  +* video if hyperv_fb is configured.
  +*/
  +   if (is_hyperv()) {
  +   pr_info(Disabled vesafb on Hyper-V.\n);
  +   return -ENODEV;
  +   }
  +#endif
 
 What is the reason for this hook? Is it not possible to claim the
 display like its appearently done by other drivers (like radeonfb can
 take over display from vesafb)?

The emulated video device is a separate device from the synthetic video.
The synthetic driver can only take control of the synthetic video, but not
the emulated video.

Actually, we already have a similar mechanism in ata/ata_piix.c to disable
emulated IDE drive on Hyper-V, so it won't conflict with the synthetic drive.

Thanks,
- Haiyang



Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Olaf Hering
On Tue, Feb 19, Haiyang Zhang wrote:

 The emulated video device is a separate device from the synthetic video.
 The synthetic driver can only take control of the synthetic video, but not
 the emulated video.

Please add this to the comment above.

 Actually, we already have a similar mechanism in ata/ata_piix.c to disable
 emulated IDE drive on Hyper-V, so it won't conflict with the synthetic drive.

I havent read the vesafb code, but I think it can kind of give up the
hardware, something ata_piix can not do.

Olaf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-19 Thread Haiyang Zhang
 -Original Message-
 From: linux-fbdev-ow...@vger.kernel.org [mailto:linux-fbdev-
 ow...@vger.kernel.org] On Behalf Of Olaf Hering
 Sent: Tuesday, February 19, 2013 1:40 PM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
 jasow...@redhat.com; linux-kernel@vger.kernel.org;
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
 Driver
 
 On Tue, Feb 19, Haiyang Zhang wrote:
 
  The emulated video device is a separate device from the synthetic
 video.
  The synthetic driver can only take control of the synthetic video, but
 not
  the emulated video.
 
 Please add this to the comment above.

Will do.

  Actually, we already have a similar mechanism in ata/ata_piix.c to
 disable
  emulated IDE drive on Hyper-V, so it won't conflict with the synthetic
 drive.
 
 I havent read the vesafb code, but I think it can kind of give up the
 hardware, something ata_piix can not do.

In my test, the vesafb doesn't automatically give up the emulated video device,
unless I add the DMI based mechanism to let it exit on Hyper-V.

Thanks,
- Haiyang



RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-18 Thread Haiyang Zhang
> -Original Message-
> From: geert.uytterhoe...@gmail.com
> [mailto:geert.uytterhoe...@gmail.com] On Behalf Of Geert Uytterhoeven
> Sent: Monday, February 18, 2013 5:29 AM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
> o...@aepfle.de; jasow...@redhat.com; linux-kernel@vger.kernel.org;
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
> Driver
> 
> On Fri, Feb 15, 2013 at 8:09 PM, Haiyang Zhang 
> wrote:
> > +/* Allocate framebuffer memory */
>
> Please instead reserve some memory at boot time, or allocate it very early
> (cfr. ps3fb).

I will look into this.

Thanks,
- Haiyang

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-18 Thread Geert Uytterhoeven
On Fri, Feb 15, 2013 at 8:09 PM, Haiyang Zhang  wrote:
> +/* Allocate framebuffer memory */
> +#define FOUR_MEGA (4*1024*1024)
> +#define NALLOC 10
> +static void *hvfb_getmem(void)
> +{
> +   ulong *p;
> +   int i, j;
> +   ulong ret = 0;
> +
> +   if (screen_fb_size == FOUR_MEGA) {
> +   ret = __get_free_pages(GFP_KERNEL|__GFP_ZERO,
> +  get_order(FOUR_MEGA));
> +   goto out1;
> +   }
> +
> +   if (screen_fb_size != FOUR_MEGA * 2)
> +   return NULL;
> +
> +   /*
> +* Windows 2012 requires frame buffer size to be 8MB, which exceeds
> +* the limit of __get_free_pages(). So, we allocate multiple 4MB
> +* chunks, and find out two adjacent ones.
> +*/
> +   p = kmalloc(NALLOC * sizeof(ulong), GFP_KERNEL);
> +   if (!p)
> +   return NULL;
> +
> +   for (i = 0; i < NALLOC; i++)
> +   p[i] = __get_free_pages(GFP_KERNEL|__GFP_ZERO,
> +   get_order(FOUR_MEGA));
> +
> +   for (i = 0; i < NALLOC; i++)
> +   for (j = 0; j < NALLOC; j++) {
> +   if (p[j] && p[i] && virt_to_phys((void *)p[j]) -
> +   virt_to_phys((void *)p[i]) == FOUR_MEGA &&
> +   p[j] - p[i] == FOUR_MEGA) {
> +   ret = p[i];
> +   goto out;
> +   }
> +   }
> +
> +out:
> +   for (i = 0; i < NALLOC; i++)
> +   if (p[i] && !(ret && (p[i] == ret || p[i] == ret + 
> FOUR_MEGA)))
> +   free_pages(p[i], get_order(FOUR_MEGA));
> +
> +   kfree(p);
> +
> +out1:
> +   if (!ret)
> +   return NULL;
> +
> +   /* Get an extra ref-count to prevent page error when x-window exits */
> +   for (i = 0; i < screen_fb_size; i += PAGE_SIZE)
> +   atomic_inc(_to_page((void *)ret + i)->_count);
> +
> +   return (void *)ret;
> +}

Please instead reserve some memory at boot time, or allocate it very early
(cfr. ps3fb).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-18 Thread Geert Uytterhoeven
On Fri, Feb 15, 2013 at 8:09 PM, Haiyang Zhang haiya...@microsoft.com wrote:
 +/* Allocate framebuffer memory */
 +#define FOUR_MEGA (4*1024*1024)
 +#define NALLOC 10
 +static void *hvfb_getmem(void)
 +{
 +   ulong *p;
 +   int i, j;
 +   ulong ret = 0;
 +
 +   if (screen_fb_size == FOUR_MEGA) {
 +   ret = __get_free_pages(GFP_KERNEL|__GFP_ZERO,
 +  get_order(FOUR_MEGA));
 +   goto out1;
 +   }
 +
 +   if (screen_fb_size != FOUR_MEGA * 2)
 +   return NULL;
 +
 +   /*
 +* Windows 2012 requires frame buffer size to be 8MB, which exceeds
 +* the limit of __get_free_pages(). So, we allocate multiple 4MB
 +* chunks, and find out two adjacent ones.
 +*/
 +   p = kmalloc(NALLOC * sizeof(ulong), GFP_KERNEL);
 +   if (!p)
 +   return NULL;
 +
 +   for (i = 0; i  NALLOC; i++)
 +   p[i] = __get_free_pages(GFP_KERNEL|__GFP_ZERO,
 +   get_order(FOUR_MEGA));
 +
 +   for (i = 0; i  NALLOC; i++)
 +   for (j = 0; j  NALLOC; j++) {
 +   if (p[j]  p[i]  virt_to_phys((void *)p[j]) -
 +   virt_to_phys((void *)p[i]) == FOUR_MEGA 
 +   p[j] - p[i] == FOUR_MEGA) {
 +   ret = p[i];
 +   goto out;
 +   }
 +   }
 +
 +out:
 +   for (i = 0; i  NALLOC; i++)
 +   if (p[i]  !(ret  (p[i] == ret || p[i] == ret + 
 FOUR_MEGA)))
 +   free_pages(p[i], get_order(FOUR_MEGA));
 +
 +   kfree(p);
 +
 +out1:
 +   if (!ret)
 +   return NULL;
 +
 +   /* Get an extra ref-count to prevent page error when x-window exits */
 +   for (i = 0; i  screen_fb_size; i += PAGE_SIZE)
 +   atomic_inc(virt_to_page((void *)ret + i)-_count);
 +
 +   return (void *)ret;
 +}

Please instead reserve some memory at boot time, or allocate it very early
(cfr. ps3fb).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-18 Thread Haiyang Zhang
 -Original Message-
 From: geert.uytterhoe...@gmail.com
 [mailto:geert.uytterhoe...@gmail.com] On Behalf Of Geert Uytterhoeven
 Sent: Monday, February 18, 2013 5:29 AM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan;
 o...@aepfle.de; jasow...@redhat.com; linux-kernel@vger.kernel.org;
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer
 Driver
 
 On Fri, Feb 15, 2013 at 8:09 PM, Haiyang Zhang haiya...@microsoft.com
 wrote:
  +/* Allocate framebuffer memory */

 Please instead reserve some memory at boot time, or allocate it very early
 (cfr. ps3fb).

I will look into this.

Thanks,
- Haiyang

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-17 Thread Haiyang Zhang
> From: Olaf Hering
> Sent: Sunday, February 17, 2013 9:32 AM
> To: Haiyang Zhang
> Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan; 
> jasow...@redhat.com; linux-kernel@vger.kernel.org; 
> de...@linuxdriverproject.org
> Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer 
> Driver

> On Fri, Feb 15, Haiyang Zhang wrote:

> +config HYPERV_FB

> This should probably be FB_HYPERB to follow the naming of all other
> drivers.

Will do.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-17 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

> +config HYPERV_FB

This should probably be FB_HYPERB to follow the naming of all other
drivers.

Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-17 Thread Olaf Hering
On Fri, Feb 15, Haiyang Zhang wrote:

 +config HYPERV_FB

This should probably be FB_HYPERB to follow the naming of all other
drivers.

Olaf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer Driver

2013-02-17 Thread Haiyang Zhang
 From: Olaf Hering
 Sent: Sunday, February 17, 2013 9:32 AM
 To: Haiyang Zhang
 Cc: florianschandi...@gmx.de; linux-fb...@vger.kernel.org; KY Srinivasan; 
 jasow...@redhat.com; linux-kernel@vger.kernel.org; 
 de...@linuxdriverproject.org
 Subject: Re: [PATCH RFC] video: Add Hyper-V Synthetic Video Frame Buffer 
 Driver

 On Fri, Feb 15, Haiyang Zhang wrote:

 +config HYPERV_FB

 This should probably be FB_HYPERB to follow the naming of all other
 drivers.

Will do.

Thanks,
- Haiyang
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/