* [PATCH] x86: Handle 64bit framebuffer memory address properly
@ 2018-11-23 9:26 Kairui Song
2018-12-04 11:50 ` Dave Young
2019-05-31 9:29 ` Simon Horman
0 siblings, 2 replies; 5+ messages in thread
From: Kairui Song @ 2018-11-23 9:26 UTC (permalink / raw)
To: kexec; +Cc: horms, dyoung, Kairui Song
In a EFI system, the frame buffer address is 64bit, so currently
if the address is beyound 4G, kexec will set wrong address due to
truncate.
Linux kernel commit ae2ee627dc87 ('efifb: Add support for 64-bit
frame buffer addresses') added support for 64bit frame buffer
address, an 'ext_lfb_base' field is added as the upper 32-bits of
the frame buffer, and introduced a new capability flag
'VIDEO_TYPE_CAPABILITY_64BIT_BASE' to indicate if the extend field is
used.
This patch adopts this change, set proper extent address and capability
flag when the address is beyound 4G.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
include/x86/x86-linux.h | 7 +++++--
kexec/arch/i386/x86-linux-setup.c | 7 ++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
index 7834751..352ea02 100644
--- a/include/x86/x86-linux.h
+++ b/include/x86/x86-linux.h
@@ -107,7 +107,10 @@ struct x86_linux_param_header {
uint16_t vesapm_seg; /* 0x2e */
uint16_t vesapm_off; /* 0x30 */
uint16_t pages; /* 0x32 */
- uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */
+ uint16_t vesa_attributes; /* 0x34 */
+ uint32_t capabilities; /* 0x36 */
+ uint32_t ext_lfb_base; /* 0x3a */
+ uint8_t reserved4[2]; /* 0x3e -- 0x3f reserved for future expansion */
struct apm_bios_info apm_bios_info; /* 0x40 */
struct drive_info_struct drive_info; /* 0x80 */
@@ -199,7 +202,7 @@ struct x86_linux_param_header {
struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
/* 0xeec */
#define COMMAND_LINE_SIZE 2048
-};
+} __attribute__((packed));
struct x86_linux_faked_param_header {
struct x86_linux_param_header hdr; /* 0x00 */
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 6cda12c..dc785a2 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -158,10 +158,15 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
real_mode->lfb_width = var.xres;
real_mode->lfb_height = var.yres;
real_mode->lfb_depth = var.bits_per_pixel;
- real_mode->lfb_base = fix.smem_start;
+ real_mode->lfb_base = fix.smem_start & 0xffffffff;
real_mode->lfb_linelength = fix.line_length;
real_mode->vesapm_seg = 0;
+ if (fix.smem_start > 0xffffffff) {
+ real_mode->ext_lfb_base = fix.smem_start >> 32;
+ real_mode->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
+ }
+
/* FIXME: better get size from the file returned by proc_iomem() */
real_mode->lfb_size = (fix.smem_len + 65535) / 65536;
real_mode->pages = (fix.smem_len + 4095) / 4096;
--
2.19.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Handle 64bit framebuffer memory address properly
2018-11-23 9:26 [PATCH] x86: Handle 64bit framebuffer memory address properly Kairui Song
@ 2018-12-04 11:50 ` Dave Young
2018-12-05 7:46 ` Kairui Song
2019-05-31 9:29 ` Simon Horman
1 sibling, 1 reply; 5+ messages in thread
From: Dave Young @ 2018-12-04 11:50 UTC (permalink / raw)
To: Kairui Song; +Cc: horms, kexec
Hi Kairui,
On 11/23/18 at 05:26pm, Kairui Song wrote:
> In a EFI system, the frame buffer address is 64bit, so currently
> if the address is beyound 4G, kexec will set wrong address due to
> truncate.
>
> Linux kernel commit ae2ee627dc87 ('efifb: Add support for 64-bit
> frame buffer addresses') added support for 64bit frame buffer
> address, an 'ext_lfb_base' field is added as the upper 32-bits of
> the frame buffer, and introduced a new capability flag
> 'VIDEO_TYPE_CAPABILITY_64BIT_BASE' to indicate if the extend field is
> used.
>
> This patch adopts this change, set proper extent address and capability
> flag when the address is beyound 4G.
>
> Signed-off-by: Kairui Song <kasong@redhat.com>
> ---
> include/x86/x86-linux.h | 7 +++++--
> kexec/arch/i386/x86-linux-setup.c | 7 ++++++-
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> index 7834751..352ea02 100644
> --- a/include/x86/x86-linux.h
> +++ b/include/x86/x86-linux.h
> @@ -107,7 +107,10 @@ struct x86_linux_param_header {
> uint16_t vesapm_seg; /* 0x2e */
> uint16_t vesapm_off; /* 0x30 */
> uint16_t pages; /* 0x32 */
> - uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */
> + uint16_t vesa_attributes; /* 0x34 */
> + uint32_t capabilities; /* 0x36 */
> + uint32_t ext_lfb_base; /* 0x3a */
> + uint8_t reserved4[2]; /* 0x3e -- 0x3f reserved for future expansion */
>
> struct apm_bios_info apm_bios_info; /* 0x40 */
> struct drive_info_struct drive_info; /* 0x80 */
> @@ -199,7 +202,7 @@ struct x86_linux_param_header {
> struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
> /* 0xeec */
> #define COMMAND_LINE_SIZE 2048
> -};
> +} __attribute__((packed));
>
> struct x86_linux_faked_param_header {
> struct x86_linux_param_header hdr; /* 0x00 */
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 6cda12c..dc785a2 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -158,10 +158,15 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
> real_mode->lfb_width = var.xres;
> real_mode->lfb_height = var.yres;
> real_mode->lfb_depth = var.bits_per_pixel;
> - real_mode->lfb_base = fix.smem_start;
> + real_mode->lfb_base = fix.smem_start & 0xffffffff;
> real_mode->lfb_linelength = fix.line_length;
> real_mode->vesapm_seg = 0;
>
> + if (fix.smem_start > 0xffffffff) {
This might be a problem for 32 bit case? Other than this I do not see
other issues of this patch.
> + real_mode->ext_lfb_base = fix.smem_start >> 32;
> + real_mode->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
> + }
> +
> /* FIXME: better get size from the file returned by proc_iomem() */
> real_mode->lfb_size = (fix.smem_len + 65535) / 65536;
> real_mode->pages = (fix.smem_len + 4095) / 4096;
> --
> 2.19.1
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
Thanks
Dave
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Handle 64bit framebuffer memory address properly
2018-12-04 11:50 ` Dave Young
@ 2018-12-05 7:46 ` Kairui Song
0 siblings, 0 replies; 5+ messages in thread
From: Kairui Song @ 2018-12-05 7:46 UTC (permalink / raw)
To: Dave Young; +Cc: horms, kexec
Hi Dave, thanks for the review.
It should be safe, "smem_start" is defined as an unsigned long and with 32bit
it will always smaller than 0xffffffff, but to make it cleaner and
safer I will update the
patch to use 0xffffffffUL instead.
On Tue, Dec 4, 2018 at 7:50 PM Dave Young <dyoung@redhat.com> wrote:
>
> Hi Kairui,
>
> On 11/23/18 at 05:26pm, Kairui Song wrote:
> > In a EFI system, the frame buffer address is 64bit, so currently
> > if the address is beyound 4G, kexec will set wrong address due to
> > truncate.
> >
> > Linux kernel commit ae2ee627dc87 ('efifb: Add support for 64-bit
> > frame buffer addresses') added support for 64bit frame buffer
> > address, an 'ext_lfb_base' field is added as the upper 32-bits of
> > the frame buffer, and introduced a new capability flag
> > 'VIDEO_TYPE_CAPABILITY_64BIT_BASE' to indicate if the extend field is
> > used.
> >
> > This patch adopts this change, set proper extent address and capability
> > flag when the address is beyound 4G.
> >
> > Signed-off-by: Kairui Song <kasong@redhat.com>
> > ---
> > include/x86/x86-linux.h | 7 +++++--
> > kexec/arch/i386/x86-linux-setup.c | 7 ++++++-
> > 2 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h
> > index 7834751..352ea02 100644
> > --- a/include/x86/x86-linux.h
> > +++ b/include/x86/x86-linux.h
> > @@ -107,7 +107,10 @@ struct x86_linux_param_header {
> > uint16_t vesapm_seg; /* 0x2e */
> > uint16_t vesapm_off; /* 0x30 */
> > uint16_t pages; /* 0x32 */
> > - uint8_t reserved4[12]; /* 0x34 -- 0x3f reserved for future expansion */
> > + uint16_t vesa_attributes; /* 0x34 */
> > + uint32_t capabilities; /* 0x36 */
> > + uint32_t ext_lfb_base; /* 0x3a */
> > + uint8_t reserved4[2]; /* 0x3e -- 0x3f reserved for future expansion */
> >
> > struct apm_bios_info apm_bios_info; /* 0x40 */
> > struct drive_info_struct drive_info; /* 0x80 */
> > @@ -199,7 +202,7 @@ struct x86_linux_param_header {
> > struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
> > /* 0xeec */
> > #define COMMAND_LINE_SIZE 2048
> > -};
> > +} __attribute__((packed));
> >
> > struct x86_linux_faked_param_header {
> > struct x86_linux_param_header hdr; /* 0x00 */
> > diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> > index 6cda12c..dc785a2 100644
> > --- a/kexec/arch/i386/x86-linux-setup.c
> > +++ b/kexec/arch/i386/x86-linux-setup.c
> > @@ -158,10 +158,15 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
> > real_mode->lfb_width = var.xres;
> > real_mode->lfb_height = var.yres;
> > real_mode->lfb_depth = var.bits_per_pixel;
> > - real_mode->lfb_base = fix.smem_start;
> > + real_mode->lfb_base = fix.smem_start & 0xffffffff;
> > real_mode->lfb_linelength = fix.line_length;
> > real_mode->vesapm_seg = 0;
> >
> > + if (fix.smem_start > 0xffffffff) {
>
> This might be a problem for 32 bit case? Other than this I do not see
> other issues of this patch.
>
> > + real_mode->ext_lfb_base = fix.smem_start >> 32;
> > + real_mode->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
> > + }
> > +
> > /* FIXME: better get size from the file returned by proc_iomem() */
> > real_mode->lfb_size = (fix.smem_len + 65535) / 65536;
> > real_mode->pages = (fix.smem_len + 4095) / 4096;
> > --
> > 2.19.1
> >
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
>
> Thanks
> Dave
--
Best Regards,
Kairui Song
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Handle 64bit framebuffer memory address properly
2018-11-23 9:26 [PATCH] x86: Handle 64bit framebuffer memory address properly Kairui Song
2018-12-04 11:50 ` Dave Young
@ 2019-05-31 9:29 ` Simon Horman
2019-05-31 9:38 ` Kairui Song
1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2019-05-31 9:29 UTC (permalink / raw)
To: Kairui Song; +Cc: dyoung, kexec
On Fri, Nov 23, 2018 at 05:26:33PM +0800, Kairui Song wrote:
> In a EFI system, the frame buffer address is 64bit, so currently
> if the address is beyound 4G, kexec will set wrong address due to
> truncate.
>
> Linux kernel commit ae2ee627dc87 ('efifb: Add support for 64-bit
> frame buffer addresses') added support for 64bit frame buffer
> address, an 'ext_lfb_base' field is added as the upper 32-bits of
> the frame buffer, and introduced a new capability flag
> 'VIDEO_TYPE_CAPABILITY_64BIT_BASE' to indicate if the extend field is
> used.
>
> This patch adopts this change, set proper extent address and capability
> flag when the address is beyound 4G.
>
> Signed-off-by: Kairui Song <kasong@redhat.com>
Sorry for letting this slip through the cracks.
Please let me know if this is still relevant.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Handle 64bit framebuffer memory address properly
2019-05-31 9:29 ` Simon Horman
@ 2019-05-31 9:38 ` Kairui Song
0 siblings, 0 replies; 5+ messages in thread
From: Kairui Song @ 2019-05-31 9:38 UTC (permalink / raw)
To: Simon Horman; +Cc: Dave Young, kexec
On Fri, May 31, 2019 at 5:29 PM Simon Horman <horms@verge.net.au> wrote:
>
> On Fri, Nov 23, 2018 at 05:26:33PM +0800, Kairui Song wrote:
> > In a EFI system, the frame buffer address is 64bit, so currently
> > if the address is beyound 4G, kexec will set wrong address due to
> > truncate.
> >
> > Linux kernel commit ae2ee627dc87 ('efifb: Add support for 64-bit
> > frame buffer addresses') added support for 64bit frame buffer
> > address, an 'ext_lfb_base' field is added as the upper 32-bits of
> > the frame buffer, and introduced a new capability flag
> > 'VIDEO_TYPE_CAPABILITY_64BIT_BASE' to indicate if the extend field is
> > used.
> >
> > This patch adopts this change, set proper extent address and capability
> > flag when the address is beyound 4G.
> >
> > Signed-off-by: Kairui Song <kasong@redhat.com>
>
> Sorry for letting this slip through the cracks.
> Please let me know if this is still relevant.
Hi Simon, I checked kexec-tools repo and this patch is merged already,
maybe you replied the wrong mail?
--
Best Regards,
Kairui Song
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-31 9:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23 9:26 [PATCH] x86: Handle 64bit framebuffer memory address properly Kairui Song
2018-12-04 11:50 ` Dave Young
2018-12-05 7:46 ` Kairui Song
2019-05-31 9:29 ` Simon Horman
2019-05-31 9:38 ` Kairui Song
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.