fbdev/hyperv_fb: Fix logic error for Gen2 VMs in hvfb_getmem()
PATCH 1/1 fbdev/hyperv_fb: Fix logic error for Gen2 VMs in hvfb_getmem()
From: Michael Kelley <[email protected]>
A recent commit removing the use of screen_info introduced a logic error. The error causes hvfb_getmem() to always return -ENOMEM for Generation 2 VMs. As a result, the Hyper-V frame buffer device fails to initialize. The error was introduced by removing an "else if" clause, leaving Gen2 VMs to always take the -ENOMEM error path.
Fix the problem by removing the error path "else" clause. Gen 2 VMs now always proceed through the MMIO memory allocation code, but with "base" and "size" defaulting to 0.
--- drivers/video/fbdev/hyperv_fb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/video/fbdev/hyperv_fb.c +0 -2
@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { - goto err1; }/*
Signature · 1 line
2.25.1
Hi
Am 01.02.24 um 07:00 schrieb [email protected]:
Quoted 9 lines
From: Michael Kelley <[email protected]>
A recent commit removing the use of
screen_infointroduced a logic error. The error causeshvfb_getmem()to always return-ENOMEMfor Generation 2 VMs. As a result, the Hyper-V frame buffer device fails to initialize. The error was introduced by removing an "else if" clause, leaving Gen2 VMs to always take the-ENOMEMerror path.
Quoted 3 lines
Fix the problem by removing the error path "else" clause. Gen 2 VMs now always proceed through the MMIO memory allocation code, but with "base" and "size" defaulting to 0.
Indeed, that's how it was supposed to work. IDK how I didn't notice this bug. Thanks a lot for the fix.
Quoted 3 lines
Fixes 0aa0838c84da ("fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers")Signed-off-by Michael Kelley <[email protected]>
Quoted 17 lines
--- drivers/video/fbdev/hyperv_fb.c | 2 -- 1 file changed, 2 deletions(-)drivers/video/fbdev/hyperv_fb.c +0
-2@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { - goto err1; }/*
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
From: Thomas Zimmermann <[email protected]> Sent: Thursday, February 1, 2024 12:17 AM
Quoted 17 lines
Hi
Am 01.02.24 um 07:00 schrieb [email protected]:
Quoted 9 lines
From: Michael Kelley <[email protected]>
A recent commit removing the use of
screen_infointroduced a logic error. The error causeshvfb_getmem()to always return-ENOMEMfor Generation 2 VMs. As a result, the Hyper-V frame buffer device fails to initialize. The error was introduced by removing an "else if" clause, leaving Gen2 VMs to always take the-ENOMEMerror path.Quoted 3 lines
Fix the problem by removing the error path "else" clause. Gen 2 VMs now always proceed through the MMIO memory allocation code, but with "base" and "size" defaulting to 0.
Quoted 8 lines
Indeed, that's how it was supposed to work. IDK how I didn't notice this bug. Thanks a lot for the fix.
Quoted 3 lines
Fixes 0aa0838c84da ("fbdev/hyperv_fb: Remove firmware framebufferswith aperture helpers")Signed-off-by Michael Kelley <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>
Wei Liu and Helge Deller --
Should this fix go through the Hyper-V tree or the fbdev tree? I'm not
aware of a reason that it really matters, but it needs to be one or the other, and sooner rather than later, because the Hyper-V driver is broken starting in 6.8-rc1.
Michael
Quoted 21 lines
Review
Quoted 6 lines
--- drivers/video/fbdev/hyperv_fb.c | 2 -- 1 file changed, 2 deletions(-)(quoted diff) +0
-0
b/drivers/video/fbdev/hyperv_fb.cdrivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev,
Quoted 4 lines
index
c26ee6fd73c9..8fdccf033b2d100644drivers/video/fbdev/hyperv_fb.c +0
-0@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev,struct
fb_info*info)Quoted 8 lines
drivers/video/fbdev/hyperv_fb.c +0
-2goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { - goto err1; }/*
Helge Deller
maintainerQuoted 25 lines · Michael Kelley
From: Thomas Zimmermann <[email protected]> Sent: Thursday, February 1, 2024 12:17 AM
Quoted 24 lines
Hi
Am 01.02.24 um 07:00 schrieb [email protected]:
Quoted 9 lines
From: Michael Kelley <[email protected]>
A recent commit removing the use of
screen_infointroduced a logic error. The error causeshvfb_getmem()to always return-ENOMEMfor Generation 2 VMs. As a result, the Hyper-V frame buffer device fails to initialize. The error was introduced by removing an "else if" clause, leaving Gen2 VMs to always take the-ENOMEMerror path.Quoted 3 lines
Fix the problem by removing the error path "else" clause. Gen 2 VMs now always proceed through the MMIO memory allocation code, but with "base" and "size" defaulting to 0.
Indeed, that's how it was supposed to work. IDK how I didn't notice this bug. Thanks a lot for the fix.
Quoted 3 lines
Fixes 0aa0838c84da ("fbdev/hyperv_fb: Remove firmware framebufferswith aperture helpers")Signed-off-by Michael Kelley <[email protected]>
Quoted 8 lines
Quoted 1 line
Reviewed-by Thomas Zimmermann <[email protected]>Wei Liu and Helge Deller --
Should this fix go through the Hyper-V tree or the fbdev tree? I'm not
aware of a reason that it really matters, but it needs to be one or the other, and sooner rather than later, because the Hyper-V driver is broken starting in 6.8-rc1.
I'm fine with either.
If there is an upcoming hyper-v pull request, I'm fine if this is included there. If not, let me know and I can take it via fbdev.
Helge
Quoted 26 lines
Michael
Quoted 21 lines
Review
Quoted 6 lines
--- drivers/video/fbdev/hyperv_fb.c | 2 -- 1 file changed, 2 deletions(-)(quoted diff) +0
-0
b/drivers/video/fbdev/hyperv_fb.cdrivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev,
Quoted 4 lines
index
c26ee6fd73c9..8fdccf033b2d100644drivers/video/fbdev/hyperv_fb.c +0
-0@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev,struct
fb_info*info)Quoted 8 lines
drivers/video/fbdev/hyperv_fb.c +0
-2goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { - goto err1; }/*
Quoted 2 lines · Helge Deller
Quoted 1 line · Michael Kelley
From: Thomas Zimmermann <[email protected]> Sent: Thursday, February 1, 2024 12:17 AM
[...]
Quoted 11 lines
Quoted 7 lines
Wei Liu and Helge Deller --
Should this fix go through the Hyper-V tree or the fbdev tree? I'm not
aware of a reason that it really matters, but it needs to be one or the other, and sooner rather than later, because the Hyper-V driver is broken starting in 6.8-rc1.I'm fine with either.
If there is an upcoming hyper-v pull request, I'm fine if this is included there. If not, let me know and I can take it via fbdev.
I've applied this to the hyperv-fixes tree. Thanks.
From: Wei Liu <[email protected]> Sent: Friday, March 1, 2024 1:26 AM
Quoted 13 lines · Helge Deller
Quoted 2 lines · Michael Kelley
Quoted 1 line
From: Thomas Zimmermann <[email protected]> Sent: Thursday, February 1, 2024 12:17 AM
[...]
Quoted 8 lines
Quoted 7 lines
Wei Liu and Helge Deller --
Should this fix go through the Hyper-V tree or the fbdev tree? I'm not
aware of a reason that it really matters, but it needs to be one or the other, and sooner rather than later, because the Hyper-V driver is broken starting in 6.8-rc1.
Quoted 5 lines
Quoted 3 lines
I'm fine with either.
If there is an upcoming hyper-v pull request, I'm fine if this is included there. If not, let me know and I can take it via fbdev.I've applied this to the hyperv-fixes tree. Thanks.
Thanks, Wei, for picking up this patch as well as several others of mine.
Michael
Quoted 35 lines · On Wed, Jan 31, 2024 at 10:00:22PM -0800, [email protected] wrote:
From: Michael Kelley <[email protected]>
A recent commit removing the use of
screen_infointroduced a logic error. The error causeshvfb_getmem()to always return-ENOMEMfor Generation 2 VMs. As a result, the Hyper-V frame buffer device fails to initialize. The error was introduced by removing an "else if" clause, leaving Gen2 VMs to always take the-ENOMEMerror path.Fix the problem by removing the error path "else" clause. Gen 2 VMs now always proceed through the MMIO memory allocation code, but with "base" and "size" defaulting to 0.
Fixes 0aa0838c84da ("fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers")Signed-off-by Michael Kelley <[email protected]>--- drivers/video/fbdev/hyperv_fb.c | 2 -- 1 file changed, 2 deletions(-)drivers/video/fbdev/hyperv_fb.c +0
-2@@ -1010,8 +1010,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { - goto err1; }/* Signature · 1 line
2.25.1