android_kernel_motorola_sm6225/include/drm
Linus Torvalds faa6c1146b drm: fix EDID struct for old ARM OABI format
[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]

When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc
will force alignment of all structures and unions to a word boundary
(see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX"
option if you're a gcc person), even when the members of said structures
do not want or need said alignment.

This completely messes up the structure alignment of 'struct edid' on
those targets, because even though all the embedded structures are
marked with "__attribute__((packed))", the unions that contain them are
not.

This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count
and size helpers"), but the bug is pre-existing.  That commit just made
the structure layout problem cause a build failure due to the addition
of the

        BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);

sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().

This legacy union alignment should probably not be used in the first
place, but we can fix the layout by adding the packed attribute to the
union entries even when each member is already packed and it shouldn't
matter in a sane build environment.

You can see this issue with a trivial test program:

  union {
	struct {
		char c[5];
	};
	struct {
		char d;
		unsigned e;
	} __attribute__((packed));
  } a = { "1234" };

where building this with a normal "gcc -S" will result in the expected
5-byte size of said union:

	.type	a, @object
	.size	a, 5

but with an ARM compiler and the old ABI:

    arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c

you get

	.type	a, %object
	.size	a, 8

instead, because even though each member of the union is packed, the
union itself still gets aligned.

This was reported by Sudip for the spear3xx_defconfig target.

Link: https://lore.kernel.org/lkml/YpCUzStDnSgQLNFN@debian/
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-14 16:59:18 +02:00
..
bridge drm for v4.18-rc1 2018-06-06 08:16:33 -07:00
i2c
tinydrm tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers 2019-05-31 06:46:32 -07:00
ttm drm/ttm: Add ttm_set_pages_wc and ttm_set_pages_uc helper 2018-08-01 17:23:05 -05:00
amd_asic_type.h drm/amdgpu: Add vega20 to asic_type enum. 2018-05-17 10:13:09 -05:00
ati_pcigart.h
drm_agpsupport.h
drm_atomic.h drm: Get ref on CRTC commit object when waiting for flip_done 2018-10-18 14:23:13 -04:00
drm_atomic_helper.h drm/crtc: Add a generic infrastructure to fake VBLANK events 2018-07-07 07:53:09 +02:00
drm_audio_component.h ALSA: hda: Make audio component support more generic 2018-07-17 22:25:48 +02:00
drm_auth.h
drm_blend.h drm/blend: Add a generic alpha property 2018-04-16 21:17:29 +02:00
drm_bridge.h drm/bridge: Move the struct drm_bridge member kerneldoc inline. 2018-06-21 14:00:06 -07:00
drm_cache.h drm: disable uncached DMA optimization for ARM and arm64 2019-03-13 14:02:40 -07:00
drm_client.h drm/cma-helper: Fix crash in fbdev error path 2018-10-02 13:03:34 +02:00
drm_color_mgmt.h drm: Introduce drm_color_lut_size() 2018-03-16 15:44:01 +02:00
drm_connector.h drm/atomic_helper: Stop modesets on unregistered connectors harder 2020-12-02 08:48:08 +01:00
drm_crtc.h drm/doc: use inline kerneldoc style for drm_crtc_state 2018-07-13 18:40:28 +02:00
drm_crtc_helper.h drm: Allow determining if current task is output poll worker 2018-02-16 22:30:06 +01:00
drm_debugfs.h
drm_debugfs_crc.h drm/crc: Only report a single overflow when a CRC fd is opened 2018-07-06 14:57:03 +02:00
drm_device.h drm/vblank: Allow dynamic per-crtc max_vblank_count 2019-09-16 08:22:04 +02:00
drm_displayid.h drm/edid: parse CEA blocks embedded in DisplayID 2019-07-26 09:14:26 +02:00
drm_dp_dual_mode_helper.h
drm_dp_helper.h drm: add support for DisplayPort CEC-Tunneling-over-AUX 2018-07-13 17:58:19 +03:00
drm_dp_mst_helper.h drm: mst: Fix query_payload ack reply struct 2019-12-31 16:34:47 +01:00
drm_drv.h drm: fix drm_drv_uses_atomic_modeset on non modesetting drivers. 2018-09-18 11:17:06 +02:00
drm_edid.h drm: fix EDID struct for old ARM OABI format 2022-06-14 16:59:18 +02:00
drm_encoder.h drm: Add drm_encoder_mask() 2018-07-02 18:45:55 +03:00
drm_encoder_slave.h
drm_fb_cma_helper.h drm/cma-helper: Remove drm_fb_cma_fbdev_init_with_funcs() 2018-07-10 14:54:50 +02:00
drm_fb_helper.h drm/fb-helper: Finish the generic fbdev emulation 2018-07-10 14:54:09 +02:00
drm_file.h drm: writeback: Add client capability for exposing writeback connectors 2018-06-20 15:30:20 +01:00
drm_fixed.h
drm_flip_work.h
drm_fourcc.h drm/fourcc: Add is_yuv field to drm_format_info to denote if the format is yuv 2018-07-18 16:56:45 +01:00
drm_framebuffer.h drm/framebuffer: Print task that allocated the fb in debug info. 2017-12-20 15:30:17 +01:00
drm_gem.h drm: move read_domains and write_domain into i915 2018-02-16 14:12:48 +00:00
drm_gem_cma_helper.h
drm_gem_framebuffer_helper.h drm: Move simple_display_pipe prepare_fb helper into gem fb helpers 2018-04-24 13:57:22 +02:00
drm_global.h
drm_hashtab.h
drm_hdcp.h drm: Fix HDCP downstream dev count read 2018-04-16 12:10:48 -04:00
drm_ioctl.h drm: Return -ENOTTY for non-drm ioctls 2021-07-28 11:13:51 +02:00
drm_irq.h
drm_lease.h
drm_legacy.h drm: prefer inline over __inline__ 2018-03-28 09:34:12 +03:00
drm_mipi_dsi.h
drm_mm.h drm/mm: Add a search-by-address variant to only inspect a single hole 2018-05-24 15:04:30 +01:00
drm_mode_config.h drm: Document mode_config.max_width/height as the max fb dimensions 2018-06-21 19:16:07 +03:00
drm_mode_object.h drm: remove drm_mode_object_{un/reference} aliases 2018-03-19 09:09:46 -04:00
drm_modes.h drm: drop _mode_ from remaining connector functions 2018-07-13 18:40:27 +02:00
drm_modeset_helper.h
drm_modeset_helper_vtables.h drm: don't block fb changes for async plane updates 2019-06-11 12:20:56 +02:00
drm_modeset_lock.h
drm_of.h drm: of: Export and rename drm_crtc_port_mask() 2018-06-27 21:44:04 +02:00
drm_os_linux.h
drm_panel.h drm/panel: make drm_panel.h self-contained 2020-01-27 14:51:01 +01:00
drm_pci.h drm: drop drm_pcie_get_speed_cap_mask and drm_pcie_get_max_link_width 2018-07-05 16:40:00 -05:00
drm_pciids.h
drm_plane.h drm: switch drm_plane to inline comments 2018-07-13 18:40:28 +02:00
drm_plane_helper.h drm: add missing ctx argument to plane transitional helpers 2018-07-03 09:30:19 +02:00
drm_prime.h dma-buf: remove kmap_atomic interface 2018-06-20 15:59:34 +02:00
drm_print.h drm: Add puts callback for the coredump printer 2018-07-30 08:49:41 -04:00
drm_property.h drm: Fix kerneldoc for DRM_MODE_PROP_IMMUTABLE 2018-07-13 12:18:03 -04:00
drm_rect.h drm/rect: Handle rounding errors in drm_rect_clip_scaled, v3. 2018-05-04 11:09:54 +02:00
drm_scdc_helper.h
drm_simple_kms_helper.h drm: Move simple_display_pipe prepare_fb helper into gem fb helpers 2018-04-24 13:57:22 +02:00
drm_syncobj.h drm/syncobj: some kerneldoc polish 2017-12-15 11:26:52 +01:00
drm_sysfs.h
drm_utils.h
drm_vblank.h drm/vblank: Allow dynamic per-crtc max_vblank_count 2019-09-16 08:22:04 +02:00
drm_vma_manager.h drm/i915: Prevent writing into a read-only object via a GGTT mmap 2018-07-13 16:14:04 +01:00
drm_writeback.h drm/atomic: Avoid connector to writeback_connector casts 2018-07-07 07:51:19 +02:00
drmP.h drm: move drv test macros out of drmP.h 2018-07-13 18:40:27 +02:00
gma_drm.h
gpu_scheduler.h drm/scheduler: only kill entity if last user is killed v2 2018-07-31 16:58:20 -05:00
i915_component.h drm/i915: Split audio component to a generic type 2018-07-17 22:25:19 +02:00
i915_drm.h x86/gpu: reserve ICL's graphics stolen memory 2018-07-10 16:28:47 -07:00
i915_pciids.h drm/i915/cfl: Add a new CFL PCI ID. 2019-08-25 10:48:01 +02:00
intel-gtt.h drm/i915: prefer resource_size_t for everything stolen 2017-12-12 12:30:22 +02:00
intel_lpe_audio.h
spsc_queue.h drm: move amd_gpu_scheduler into common location 2017-12-07 11:51:56 -05:00