1
0
Fork 0
alistair23-linux/drivers/gpu/drm
Mikel Rychliski 535943c46d PCI: Use ioremap(), not phys_to_virt() for platform ROM
[ Upstream commit 72e0ef0e5f ]

On some EFI systems, the video BIOS is provided by the EFI firmware.  The
boot stub code stores the physical address of the ROM image in pdev->rom.
Currently we attempt to access this pointer using phys_to_virt(), which
doesn't work with CONFIG_HIGHMEM.

On these systems, attempting to load the radeon module on a x86_32 kernel
can result in the following:

  BUG: unable to handle page fault for address: 3e8ed03c
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  *pde = 00000000
  Oops: 0000 [#1] PREEMPT SMP
  CPU: 0 PID: 317 Comm: systemd-udevd Not tainted 5.6.0-rc3-next-20200228 #2
  Hardware name: Apple Computer, Inc. MacPro1,1/Mac-F4208DC8, BIOS     MP11.88Z.005C.B08.0707021221 07/02/07
  EIP: radeon_get_bios+0x5ed/0xe50 [radeon]
  Code: 00 00 84 c0 0f 85 12 fd ff ff c7 87 64 01 00 00 00 00 00 00 8b 47 08 8b 55 b0 e8 1e 83 e1 d6 85 c0 74 1a 8b 55 c0 85 d2 74 13 <80> 38 55 75 0e 80 78 01 aa 0f 84 a4 03 00 00 8d 74 26 00 68 dc 06
  EAX: 3e8ed03c EBX: 00000000 ECX: 3e8ed03c EDX: 00010000
  ESI: 00040000 EDI: eec04000 EBP: eef3fc60 ESP: eef3fbe0
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010206
  CR0: 80050033 CR2: 3e8ed03c CR3: 2ec77000 CR4: 000006d0
  Call Trace:
   r520_init+0x26/0x240 [radeon]
   radeon_device_init+0x533/0xa50 [radeon]
   radeon_driver_load_kms+0x80/0x220 [radeon]
   drm_dev_register+0xa7/0x180 [drm]
   radeon_pci_probe+0x10f/0x1a0 [radeon]
   pci_device_probe+0xd4/0x140

Fix the issue by updating all drivers which can access a platform provided
ROM. Instead of calling the helper function pci_platform_rom() which uses
phys_to_virt(), call ioremap() directly on the pdev->rom.

radeon_read_platform_bios() previously directly accessed an __iomem
pointer. Avoid this by calling memcpy_fromio() instead of kmemdup().

pci_platform_rom() now has no remaining callers, so remove it.

Link: https://lore.kernel.org/r/20200319021623.5426-1-mikel@mikelr.com
Signed-off-by: Mikel Rychliski <mikel@mikelr.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 13:17:51 +02:00
..
amd PCI: Use ioremap(), not phys_to_virt() for platform ROM 2020-10-01 13:17:51 +02:00
arc drm/arc: Drop drm_gem_prime_export/import 2019-06-21 20:02:10 +02:00
arm drm/arm: fix unintentional integer overflow on left shift 2020-08-19 08:16:07 +02:00
armada drm/armada: drop use of drmP.h 2019-08-14 18:31:10 +02:00
aspeed drm/aspeed: gfc_crtc: Make structure aspeed_gfx_funcs constant 2019-08-14 19:27:26 +02:00
ast drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
atmel-hlcdc drm: atmel-hlcdc: prefer a lower pixel-clock than requested 2020-02-11 04:35:36 -08:00
bochs drm/drm_fb_helper: fix fbdev with sparc64 2020-08-11 15:33:37 +02:00
bridge drm/bridge: sil_sii8620: initialize return of sii8620_readb 2020-08-19 08:16:11 +02:00
cirrus drm/prime: Actually remove DRIVER_PRIME everywhere 2019-06-21 17:30:32 +02:00
etnaviv drm/etnaviv: fix TS cache flushing on GPUs with BLT engine 2020-09-05 11:22:50 +02:00
exynos drm/exynos: fix ref count leak in mic_pre_enable 2020-07-22 09:32:51 +02:00
fsl-dcu drm/fsl-dcu: fix opencoded use of drm_panel_* 2019-08-10 15:41:48 +02:00
gma500 gma/gma500: fix a memory disclosure bug due to uninitialized bytes 2020-10-01 13:17:13 +02:00
hisilicon drm: kirin: Revert "Fix for hikey620 display offset problem" 2020-03-12 13:00:26 +01:00
i2c drm/i2c/tda998x: drop use of drmP.h 2019-08-14 18:30:52 +02:00
i810 drm/i810: Prevent underflow in ioctl 2019-12-13 08:42:56 +01:00
i915 drm/i915: Filter wake_flags passed to default_wake_function 2020-09-23 12:40:43 +02:00
imx drm/imx: imx-ldb: Disable both channels for split mode in enc->disable() 2020-08-21 13:05:29 +02:00
ingenic drm/ingenic: Fix incorrect assumption about plane->index 2020-09-03 11:26:52 +02:00
lib
lima drm main pull for 5.4-rc1 2019-09-19 16:24:24 -07:00
mcde drm/mcde: Handle pending vblank while disabling display 2020-10-01 13:17:25 +02:00
mediatek drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata() 2020-09-23 12:40:42 +02:00
meson drm/meson: vclk: use the correct G12A frac max value 2019-12-31 16:43:09 +01:00
mga drm/mga: drop use of drmP.h 2019-06-30 09:48:05 +02:00
mgag200 drm/mgag200: Flag all G200 SE A machines as broken wrt <startadd> 2019-12-21 11:04:54 +01:00
msm drm/msm/a5xx: Always set an OPP supported hardware value 2020-10-01 13:17:44 +02:00
mxsfb dma-buf: rename reservation_object to dma_resv 2019-08-13 09:09:30 +02:00
nouveau PCI: Use ioremap(), not phys_to_virt() for platform ROM 2020-10-01 13:17:51 +02:00
omapdrm drm/omap: dss: Cleanup DSS ports on initialisation failure 2020-10-01 13:17:37 +02:00
panel drm: panel: simple: Fix bpc for LG LB070WV8 panel 2020-08-19 08:16:11 +02:00
panfrost drm/panfrost: Use kvfree() to free bo->sgts 2020-08-21 13:05:39 +02:00
pl111 drm/pl111: Support grayscale 2019-08-09 09:15:05 +02:00
qxl drm/qxl: Use correct notify port address when creating cursor ring 2020-06-24 17:50:48 +02:00
r128 drm/r128: drop use of drmP.h 2019-07-17 12:52:55 +02:00
radeon PCI: Use ioremap(), not phys_to_virt() for platform ROM 2020-10-01 13:17:51 +02:00
rcar-du drm: rcar-du: Fix build error 2020-06-30 15:37:11 -04:00
rockchip drm/bridge: analogix_dp: Split bind() into probe() and real bind() 2020-05-10 10:31:22 +02:00
savage drm/savage: drop use of drmP.h 2019-06-05 20:31:04 +02:00
scheduler drm/scheduler: Avoid accessing freed bad job. 2020-10-01 13:17:25 +02:00
selftests drm/modes: Make sure to parse valid rotation value from cmdline 2020-03-12 13:00:11 +01:00
shmobile drm/shmobile: drop use of drmP.h 2019-07-15 18:11:31 +02:00
sis drm/sis: drop drmP.h use 2019-06-05 20:29:57 +02:00
sti drm/sti: fix opencoded use of drm_panel_* 2019-08-07 13:54:17 +02:00
stm drm/stm: repair runtime power management 2020-08-19 08:16:11 +02:00
sun4i drm/sun4i: backend: Disable alpha on the lowest plane on the A20 2020-09-17 13:47:43 +02:00
tdfx drm/tdfx: drop use of drmP.h 2019-07-17 12:52:55 +02:00
tegra drm/tegra: hub: Do not enable orphaned window group 2020-07-16 08:16:33 +02:00
tilcdc drm/tilcdc: fix leak & null ref in panel_connector_get_modes 2020-08-19 08:15:59 +02:00
tiny drm/tiny: Kconfig: Remove always-y THERMAL dep. from TINYDRM_REPAPER 2019-10-10 15:15:51 +02:00
ttm drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access 2020-08-26 10:40:56 +02:00
tve200 drm/tve200: Stabilize enable/disable 2020-09-17 13:47:53 +02:00
udl drm/udl: drop use of drmP.h 2019-07-17 12:52:55 +02:00
v3d drm/v3d: Fix memory leak in v3d_submit_cl_ioctl 2019-10-23 20:57:05 +02:00
vboxvideo drm/vboxvideo: Make structure vbox_fb_helper_funcs constant 2019-08-18 12:52:52 +02:00
vc4 drm/vc4: Fix HDMI mode validation 2020-04-23 10:36:39 +02:00
vgem drm/vgem: Replace opencoded version of drm_gem_dumb_map_offset() 2020-08-26 10:40:47 +02:00
via drivers/gpu/drm/via: convert put_page() to put_user_page*() 2019-09-24 15:54:08 -07:00
virtio drm/virtio: module_param_named() requires linux/moduleparam.h 2020-03-12 13:00:32 +01:00
vkms drm/vkms: Hold gem object while still in-use 2020-06-17 16:40:36 +02:00
vmwgfx drm/vmwgfx: Fix two list_for_each loop exit tests 2020-08-21 13:05:36 +02:00
xen drm/xen-front: Fix misused IS_ERR_OR_NULL checks 2020-09-03 11:26:50 +02:00
zte Linus 5.3-rc1 2019-07-22 21:24:10 +02:00
Kconfig drm-misc-next for 5.4: 2019-08-09 16:04:31 +10:00
Makefile drm/amd: remove meaningless descending into amd/amdkfd/ 2019-08-27 10:09:12 -05:00
ati_pcigart.c drm/ati_pcigart: drop dependency on drm_os_linux.h 2019-07-19 23:24:16 +02:00
drm_agpsupport.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_atomic.c drm: Free the writeback_job when it with an empty fb 2019-09-23 15:31:53 +08:00
drm_atomic_helper.c drm/atomic: fix self-refresh helpers crtc state dereference 2019-11-06 13:00:21 -05:00
drm_atomic_state_helper.c drm/atomic: Rename crtc_state->pageflip_flags to async_flip 2019-09-18 18:43:36 +02:00
drm_atomic_uapi.c drm/atomic: Reject FLIP_ASYNC unconditionally 2019-09-18 18:42:57 +02:00
drm_auth.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_blend.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_bridge.c drm: Add atomic variants for bridge enable/disable 2019-06-13 13:00:29 -04:00
drm_bufs.c drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
drm_cache.c
drm_client.c drm/fb-helper: Map DRM client buffer only when required 2019-08-01 15:01:29 +02:00
drm_client_modeset.c Revert "drm/fbdev: Fallback to non tiled mode if all tiles not present" 2020-03-25 08:25:50 +01:00
drm_color_mgmt.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_connector.c drm/connector: notify userspace on hotplug after register complete 2020-06-24 17:50:50 +02:00
drm_context.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_crtc.c drm: no need to check return value of debugfs_create functions 2019-06-13 16:39:16 +02:00
drm_crtc_helper.c drm: Remove bridge support from legacy helpers 2019-08-16 15:50:27 +03:00
drm_crtc_helper_internal.h
drm_crtc_internal.h drm/atomic: Move __drm_atomic_helper_disable_plane/set_config() 2019-06-08 16:46:37 +02:00
drm_damage_helper.c drm: damage_helper: Fix race checking plane->state->fb 2019-12-13 08:42:55 +01:00
drm_debugfs.c drm/debugfs: fix plain echo to connector "force" attribute 2020-08-19 08:16:02 +02:00
drm_debugfs_crc.c drm: remove the newline for CRC source name. 2020-02-24 08:36:44 +01:00
drm_dma.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_dp_aux_dev.c drm/dp_mst: Enable registration of AUX devices for MST ports 2019-07-25 16:39:35 -04:00
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm: Make the bw/link rate calculations more forgiving 2019-07-17 12:45:30 -04:00
drm_dp_mst_topology.c drm: fix drm_dp_mst_port refcount leaks in drm_dp_mst_allocate_vcpi 2020-08-21 13:05:39 +02:00
drm_drv.c drm/kms: Duct-tape for mode object lifetime checks 2019-09-18 11:27:18 +02:00
drm_dsc.c
drm_dumb_buffers.c Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()" 2019-08-07 11:56:48 -04:00
drm_edid.c drm/edid: Add Oculus Rift S to non-desktop list 2020-06-07 13:18:51 +02:00
drm_edid_load.c Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2019-05-28 09:39:08 +02:00
drm_encoder.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_encoder_slave.c drm: encoder_slave: fix refcouting error for modules 2020-06-24 17:50:47 +02:00
drm_fb_cma_helper.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
drm_fb_helper.c drm/drm_fb_helper: fix fbdev with sparc64 2020-08-11 15:33:37 +02:00
drm_file.c drm/prime: Unconditionally set up the prime file private 2019-06-21 11:48:09 +02:00
drm_flip_work.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_format_helper.c
drm_fourcc.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_framebuffer.c drm: silence variable 'conn' set but not used 2019-07-22 16:04:53 -04:00
drm_gem.c drm/gem: Fix a leak in drm_gem_objects_lookup() 2020-08-19 08:16:05 +02:00
drm_gem_cma_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_gem_framebuffer_helper.c dma-buf: rename reservation_object to dma_resv 2019-08-13 09:09:30 +02:00
drm_gem_shmem_helper.c drm/shmem: Use mutex_trylock in drm_gem_shmem_purge 2019-08-28 10:02:39 -05:00
drm_gem_vram_helper.c drm/ttm: use gem vma_node 2019-08-06 08:21:54 +02:00
drm_hashtab.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_hdcp.c drm/hdcp: reference for srm file format 2019-08-06 13:18:42 +05:30
drm_internal.h drm/gem: Unexport drm_gem_(un)pin/v(un)map 2019-06-17 17:37:01 +02:00
drm_ioc32.c Linus 5.3-rc1 2019-07-22 21:24:10 +02:00
drm_ioctl.c drm/atomic: Take the atomic toys away from X 2019-09-18 18:42:21 +02:00
drm_irq.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_kms_helper_common.c drm: fix module name in edid_firmware log message 2019-08-22 10:41:06 +03:00
drm_lease.c drm/lease: fix WARNING in idr_destroy 2020-03-25 08:25:56 +01:00
drm_legacy.h drm: make drm_legacy.h self-contained 2019-05-27 18:06:47 +02:00
drm_legacy_misc.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_lock.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_memory.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_mipi_dbi.c drm/dbi: Fix SPI Type 1 (9-bit) transfer 2020-08-05 09:59:44 +02:00
drm_mipi_dsi.c drm/mipi: use dcs write for mipi_dsi_dcs_set_tear_scanline 2020-08-19 08:16:08 +02:00
drm_mm.c drm: Allow range of 0 for drm_mm_insert_node_in_range() 2019-06-26 21:13:12 +01:00
drm_mode_config.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_mode_object.c drm/kms: Duct-tape for mode object lifetime checks 2019-09-18 11:27:18 +02:00
drm_modes.c drm/modes: Make sure to parse valid rotation value from cmdline 2020-03-12 13:00:11 +01:00
drm_modeset_helper.c
drm_modeset_lock.c docs conversion for v5.3-rc1 2019-07-16 12:21:41 -07:00
drm_of.c Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2019-05-28 09:39:08 +02:00
drm_panel.c drm/panel: drop return code from drm_panel_detach() 2019-08-10 15:41:48 +02:00
drm_panel_orientation_quirks.c drm: Added orientation quirk for ASUS tablet model T103HAF 2020-08-21 13:05:39 +02:00
drm_pci.c drm: Remove PageReserved manipulation from drm_pci_alloc 2020-04-17 10:50:20 +02:00
drm_plane.c
drm_plane_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_prime.c drm/prime: Ditch gem_prime_res_obj hook 2019-07-31 10:19:23 +02:00
drm_print.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_probe_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_property.c drm: limit to INT_MAX in create_blob ioctl 2020-01-04 19:18:43 +01:00
drm_rect.c drm/rect: Avoid division by zero 2020-02-11 04:35:36 -08:00
drm_scatter.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_scdc_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_self_refresh_helper.c drm/atomic: fix self-refresh helpers crtc state dereference 2019-11-06 13:00:21 -05:00
drm_simple_kms_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_syncobj.c drm/syncobj: Add better overview documentation for syncobj (v2) 2019-08-12 16:58:52 +02:00
drm_sysfs.c drm/connector: notify userspace on hotplug after register complete 2020-06-24 17:50:50 +02:00
drm_trace.h drm: make drm_trace.h self-contained 2019-05-27 18:06:54 +02:00
drm_trace_points.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_vblank.c drm/drm_vblank: Change EINVAL by the correct errno 2019-12-31 16:43:50 +01:00
drm_vm.c gpu/drm: fix a few kernel-doc "/**" mark warnings 2019-07-16 11:25:02 +02:00
drm_vma_manager.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_vram_helper_common.c
drm_vram_mm_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_writeback.c drm: Clear the fence pointer when writeback job signaled 2019-09-23 15:32:53 +08:00