diff mbox series

[v3,4/9] ockchip: video: vop: Reserve efi fb memory

Message ID 20201120132823.799855386@rtp-net.org
State Changes Requested
Delegated to: Kever Yang
Headers show
Series rk3399 (Pinebook pro) EDP support | expand

Commit Message

Arnaud Patard (Rtp) Nov. 20, 2020, 1:24 p.m. UTC
When booting with EFI and graphics, the memory used for framebuffer
has to be reserved, otherwise it may leads to kernel memory
overwrite.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>

Comments

Kever Yang Jan. 21, 2021, 1:06 p.m. UTC | #1
Hi Arnaud,

First, please correct the typo in the subject line.

Arnaud Patard <arnaud.patard@rtp-net.org> 于2020年11月20日周五 下午9:31写道:

> When booting with EFI and graphics, the memory used for framebuffer
> has to be reserved, otherwise it may leads to kernel memory
> overwrite.
>
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
> Index: u-boot/drivers/video/rockchip/rk_vop.c
> ===================================================================
> --- u-boot.orig/drivers/video/rockchip/rk_vop.c
> +++ u-boot/drivers/video/rockchip/rk_vop.c
> @@ -20,6 +20,8 @@
>  #include <asm/arch-rockchip/vop_rk3288.h>
>  #include <dm/device-internal.h>
>  #include <dm/uclass-internal.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>  #include <linux/bitops.h>
>  #include <linux/err.h>
>  #include <power/regulator.h>
> @@ -394,6 +396,13 @@ int rk_vop_probe(struct udevice *dev)
>         if (!(gd->flags & GD_FLG_RELOC))
>                 return 0;
>
> +       plat->base = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size -
> plat->size;
>
This is a change to plat->base value, do we have to do this?
If we have to use this address for EFI, I would like this code not to
change for board
without EFI_LOADER support.

Thanks,
- Kever

> +
> +#if defined(CONFIG_EFI_LOADER)
> +       debug("Adding to EFI map %d @ %lx\n", plat->size, plat->base);
> +       efi_add_memory_map(plat->base, plat->size,
> EFI_RESERVED_MEMORY_TYPE);
> +#endif
> +
>         priv->regs = (struct rk3288_vop *)dev_read_addr(dev);
>
>         /*
>
>
>
diff mbox series

Patch

Index: u-boot/drivers/video/rockchip/rk_vop.c
===================================================================
--- u-boot.orig/drivers/video/rockchip/rk_vop.c
+++ u-boot/drivers/video/rockchip/rk_vop.c
@@ -20,6 +20,8 @@ 
 #include <asm/arch-rockchip/vop_rk3288.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <power/regulator.h>
@@ -394,6 +396,13 @@  int rk_vop_probe(struct udevice *dev)
 	if (!(gd->flags & GD_FLG_RELOC))
 		return 0;
 
+	plat->base = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - plat->size;
+
+#if defined(CONFIG_EFI_LOADER)
+	debug("Adding to EFI map %d @ %lx\n", plat->size, plat->base);
+	efi_add_memory_map(plat->base, plat->size, EFI_RESERVED_MEMORY_TYPE);
+#endif
+
 	priv->regs = (struct rk3288_vop *)dev_read_addr(dev);
 
 	/*