* [PATCH v1 0/2] drm/i915/bios: vbt-related fixes @ 2026-11-26 17:50 Michał Grzelak 2026-11-26 17:50 ` [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature Michał Grzelak 2026-11-26 17:50 ` [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed Michał Grzelak 0 siblings, 2 replies; 5+ messages in thread From: Michał Grzelak @ 2026-11-26 17:50 UTC (permalink / raw) To: intel-gfx, intel-xe Cc: Jani Nikula, Ville Syrjälä, Michał Grzelak, Michał Grzelak Michał Grzelak (2): drm/i915/bios: include whitespace into VBT signature drm/i915/bios: check if VBT#57's tables are zeroed drivers/gpu/drm/i915/display/intel_bios.c | 17 +++++++++++++---- drivers/gpu/drm/i915/display/intel_vbt_defs.h | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) -- 2.45.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature 2026-11-26 17:50 [PATCH v1 0/2] drm/i915/bios: vbt-related fixes Michał Grzelak @ 2026-11-26 17:50 ` Michał Grzelak 2026-11-26 18:01 ` sashiko-bot 2026-11-26 17:50 ` [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed Michał Grzelak 1 sibling, 1 reply; 5+ messages in thread From: Michał Grzelak @ 2026-11-26 17:50 UTC (permalink / raw) To: intel-gfx, intel-xe Cc: Jani Nikula, Ville Syrjälä, Michał Grzelak, Michał Grzelak From: Michał Grzelak <michal.grzelak@intel.com> Product name always starts after whitespace which is part of VBT signature as per spec. Extend VBT signature to contain whitespace. Bspec: 20119 Cc: Jani Nikula <jani.nikula@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Michał Grzelak <michal.grzelak@linux.intel.com> --- This probably should see a Fixes: trailer but I can't find any suitable commit to blame since this existed for quite some time already. --- drivers/gpu/drm/i915/display/intel_bios.c | 8 ++++---- drivers/gpu/drm/i915/display/intel_vbt_defs.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index b77d1599482a7..f20cda5ad1a33 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -60,7 +60,7 @@ * The VBT consists of a VBT Header (defined as &struct vbt_header), a BDB * Header (&struct bdb_header), and a number of BIOS Data Blocks (BDB) that * contain the actual configuration information. The VBT Header, and thus the - * VBT, begins with "$VBT" signature. The VBT Header contains the offset of the + * VBT, begins with "$VBT " signature. The VBT Header contains the offset of the * BDB Header. The data blocks are concatenated after the BDB Header. The data * blocks have a 1-byte Block ID, 2-byte Block Size, and Block Size bytes of * data. (Block 53, the MIPI Sequence Block is an exception.) @@ -3131,8 +3131,8 @@ static const struct bdb_header *get_bdb_header(const struct vbt_header *vbt) return _vbt + vbt->bdb_offset; } -static const char vbt_signature[] = "$VBT"; -static const int vbt_signature_len = 4; +static const char vbt_signature[] = "$VBT "; +static const int vbt_signature_len = 5; /** * intel_bios_is_valid_vbt - does the given buffer contain a valid VBT @@ -3235,7 +3235,7 @@ static struct vbt_header *oprom_get_vbt(struct intel_display *display, return NULL; BUILD_BUG_ON(vbt_signature_len != sizeof(vbt_signature) - 1); - BUILD_BUG_ON(vbt_signature_len != sizeof(u32)); + BUILD_BUG_ON(vbt_signature_len != sizeof(u32) + 1); offset = intel_rom_find(rom, *(const u32 *)vbt_signature); if (offset < 0) diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h index 0dc13d080e8aa..1a393528ced91 100644 --- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h +++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h @@ -85,7 +85,7 @@ struct bdb_edid_dtd { /** * struct vbt_header - VBT Header structure - * @signature: VBT signature, always starts with "$VBT" + * @signature: VBT signature, always starts with "$VBT " * @version: Version of this structure * @header_size: Size of this structure * @vbt_size: Size of VBT (VBT Header, BDB Header and data blocks) -- 2.45.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature 2026-11-26 17:50 ` [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature Michał Grzelak @ 2026-11-26 18:01 ` sashiko-bot 0 siblings, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-11-26 18:01 UTC (permalink / raw) To: Michał Grzelak, intel-gfx, intel-xe Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/i915/bios: 5-byte vbt_signature breaks GVT-g VBT validation - [Low] drm/i915/bios: broken u32 needle BUILD_BUG_ON in oprom_get_vbt() -- commit 625db8b840b34894e85859eb7f1834474d12585a Author: Michał Grzelak <michal.grzelak@intel.com> drm/i915/bios: include whitespace into VBT signature This commit extends vbt_signature from "$VBT" to "$VBT " and updates the corresponding signature length and documentation comments. > diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c > index 7b6a6f8c3cf19..080a76a95136d 100644 > --- a/drivers/gpu/drm/i915/display/intel_bios.c > +++ b/drivers/gpu/drm/i915/display/intel_bios.c [ ... ] > @@ -3126,8 +3126,8 @@ static const struct bdb_header *get_bdb_header(const struct vbt_header *vbt) > return _vbt + vbt->bdb_offset; > } > > -static const char vbt_signature[] = "$VBT"; > -static const int vbt_signature_len = 4; > +static const char vbt_signature[] = "$VBT "; > +static const int vbt_signature_len = 5; [Severity: High] Does requiring a trailing space in vbt_signature break VBT validation for Intel GVT-g guests? In drivers/gpu/drm/i915/gvt/opregion.c, virt_vbt_generation() zero-fills struct vbt and only populates the first four bytes of v->header.signature: drivers/gpu/drm/i915/gvt/opregion.c:virt_vbt_generation() { memset(v, 0, sizeof(struct vbt)); v->header.signature[0] = '$'; v->header.signature[1] = 'V'; v->header.signature[2] = 'B'; v->header.signature[3] = 'T'; } With vbt_signature_len increased to 5, intel_bios_is_valid_vbt() rejects the emulated OpRegion VBT on both current and existing GVT-g hosts because vbt->signature[4] is 0x00, forcing guests to fall back to default VBT port definitions. > /** > * intel_bios_is_valid_vbt - does the given buffer contain a valid VBT > @@ -3230,7 +3230,7 @@ static struct vbt_header *oprom_get_vbt(struct intel_display *display, > return NULL; > > BUILD_BUG_ON(vbt_signature_len != sizeof(vbt_signature) - 1); > - BUILD_BUG_ON(vbt_signature_len != sizeof(u32)); > + BUILD_BUG_ON(vbt_signature_len != sizeof(u32) + 1); > > offset = intel_rom_find(rom, *(const u32 *)vbt_signature); > if (offset < 0) [Severity: Low] Does changing this BUILD_BUG_ON to sizeof(u32) + 1 defeat the check that intel_rom_find() searches for the full vbt_signature? intel_rom_find() only matches a 32-bit u32 needle and returns the first 4-byte "$VBT" match in the Option ROM without checking the fifth byte, so any earlier 4-byte "$VBT" sequence without a trailing space will stop the ROM scan and cause intel_bios_is_valid_vbt() to fail. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261126175033.181407-1-michal.grzelak@linux.intel.com?part=1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed 2026-11-26 17:50 [PATCH v1 0/2] drm/i915/bios: vbt-related fixes Michał Grzelak 2026-11-26 17:50 ` [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature Michał Grzelak @ 2026-11-26 17:50 ` Michał Grzelak 2026-11-26 18:04 ` sashiko-bot 1 sibling, 1 reply; 5+ messages in thread From: Michał Grzelak @ 2026-11-26 17:50 UTC (permalink / raw) To: intel-gfx, intel-xe Cc: Jani Nikula, Ville Syrjälä, Michał Grzelak, Michał Grzelak Turns out there are VBTs which have use_vbt_vswing enabled while their vswing/pre-emphasis override tables contain only zeroes instead of register values. Return from parsing of Vswing/Pre-emphasis Override if tables are empty. By doing so do not update metadata stored in vspeo substructure. Return from buffers' allocation if vspeo metadata is missing. Use default vswing/pre-emphasis then because of allocation failure. Fixes: a138a81d7805 ("drm/i915/bios: de/allocate VS/PE-O buffers for each port") Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9602 Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Suggested-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Michał Grzelak <michal.grzelak@linux.intel.com> --- Somewhat uglier hack would be to simply reset use_vbt_vswing after confirming that tables are empty. However that is more tricky because it would require finding devdata that requests Vswing/Pre-emphasis Override during parse_vswing_preemphasis_override(); which sounds like both wrong abstraction layer and also more lines of code. --- drivers/gpu/drm/i915/display/intel_bios.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index f20cda5ad1a33..04d07ee05e76d 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -2232,6 +2232,12 @@ parse_vswing_preemph_override(struct intel_display *display) if (!block) return; + /* adjust size for num_tables and num_columns fields */ + if (mem_is_zero(block->tables, get_blocksize(block) - 2)) { + drm_dbg_kms(display->drm, "VBT#57 tables are zeroed\n"); + return; + } + display->vbt.vspeo.tables = block->tables; display->vbt.vspeo.num_tables = block->num_tables; display->vbt.vspeo.num_columns = block->num_columns; @@ -2665,6 +2671,9 @@ static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *dev if (!intel_bios_encoder_requests_vspeo(devdata)) return; + if (!devdata->display->vbt.vspeo.tables) + return; + vspeo = kzalloc_obj(*vspeo); if (!vspeo) return; -- 2.45.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed 2026-11-26 17:50 ` [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed Michał Grzelak @ 2026-11-26 18:04 ` sashiko-bot 0 siblings, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-11-26 18:04 UTC (permalink / raw) To: Michał Grzelak, intel-gfx, intel-xe Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/i915/bios: whole-block zero check in parse_vswing_preemph_override() - [Medium] drm/i915/bios: u32 underflow in parse_vswing_preemph_override() size check -- commit 8d486a542cefe34b382644665b58bbe94c62cdf9 Author: Michał Grzelak <michal.grzelak@linux.intel.com> drm/i915/bios: check if VBT#57's tables are zeroed This commit skips storing VBT block 57 metadata and allocating per-port override buffers when the vswing/pre-emphasis override tables are zeroed. > diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c > index 080a76a95136d..d27fee52bc447 100644 > --- a/drivers/gpu/drm/i915/display/intel_bios.c > +++ b/drivers/gpu/drm/i915/display/intel_bios.c > @@ -2227,6 +2227,12 @@ parse_vswing_preemph_override(struct intel_display *display) > if (!block) > return; > > + /* adjust size for num_tables and num_columns fields */ > + if (mem_is_zero(block->tables, get_blocksize(block) - 2)) { > + drm_dbg_kms(display->drm, "VBT#57 tables are zeroed\n"); > + return; > + } [Severity: Medium] Can checking the entire block->tables buffer at once still leave an individual port with an all-zero override table when block 57 is only partially populated? block->tables contains multiple sub-tables indexed by PHY type and link rate (such as tables 0..3 in intel_bios_get_c10_vspeo() and tables 4..5 in intel_bios_get_c20_vspeo()). If one sub-table in block 57 has non-zero entries while the sub-table selected for another port or link rate is all zeroes, mem_is_zero() across the whole block returns false, and intel_bios_get_*_vspeo() still overrides the default PHY translation table with zeroes and breaks link training. Should the zero check be done on the selected sub-table slice (num_rows * num_columns * sizeof(u32) bytes at idx * num_rows * num_columns) in intel_bios_get_*_vspeo() instead? [Severity: Medium] Can get_blocksize(block) - 2 underflow if a malformed VBT header reports a block size of 0 or 1? init_bdb_block() allocates max(min_size, block_size) + 3 bytes for the BDB entry, but copies the raw 3-byte BDB header without updating the 16-bit size field when block_size < min_size: drivers/gpu/drm/i915/display/intel_bios.c:init_bdb_block() { ... entry = kzalloc_flex(*entry, data, max(min_size, block_size) + 3); ... memcpy(entry->data, block - 3, block_size + 3); ... } get_blocksize(block) returns that raw 16-bit size as a u32, so subtracting 2 without first checking get_blocksize(block) >= sizeof(*block) wraps to 0xfffffffe or 0xffffffff and passes that length to mem_is_zero(), causing an out-of-bounds read past entry->data. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261126175033.181407-1-michal.grzelak@linux.intel.com?part=2 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-26 18:04 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-26 17:50 [PATCH v1 0/2] drm/i915/bios: vbt-related fixes Michał Grzelak 2026-11-26 17:50 ` [PATCH v1 1/2] drm/i915/bios: include whitespace into VBT signature Michał Grzelak 2026-11-26 18:01 ` sashiko-bot 2026-11-26 17:50 ` [PATCH v1 2/2] drm/i915/bios: check if VBT#57's tables are zeroed Michał Grzelak 2026-11-26 18:04 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox