drm/i915: Duplicate opregion vbt memory

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
This commit is contained in:
Radhakrishna Sripada 2024-02-28 13:32:34 -08:00 committed by Jani Nikula
parent 9d9bb71f3e
commit 0cb9b4ead0
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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)