Skip to content

Commit

Permalink
drm/i915: Duplicate opregion vbt memory
Browse files Browse the repository at this point in the history
In the case of vbt residing in opregion, we simply remap the region
into the kernel and pass the memory reference. Instead duplicate the
memory to handle a saner cleanup in intel_bios_init.

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240228213235.2495611-6-radhakrishna.sripada@intel.com
  • Loading branch information
Radhakrishna Sripada authored and Jani Nikula committed Mar 11, 2024
1 parent 9d9bb71 commit 0cb9b4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/i915/display/intel_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -3194,8 +3194,10 @@ void intel_bios_init(struct drm_i915_private *i915)
oprom_vbt = firmware_get_vbt(i915, NULL);
vbt = oprom_vbt;

if (!vbt)
vbt = intel_opregion_get_vbt(i915, NULL);
if (!vbt) {
oprom_vbt = intel_opregion_get_vbt(i915, NULL);
vbt = oprom_vbt;
}

/*
* If the OpRegion does not have VBT, look in SPI flash through MMIO or
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/display/intel_opregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size)
if (size)
*size = opregion->vbt_size;

return opregion->vbt;
return kmemdup(opregion->vbt, opregion->vbt_size, GFP_KERNEL);
}

bool intel_opregion_headless_sku(struct drm_i915_private *i915)
Expand Down

0 comments on commit 0cb9b4e

Please sign in to comment.