Re: [PATCH] drm/vmwgfx: Unmap the surface before resetting it on a plane state
On 12/23/23 21:25, Zack Rusin wrote: > Switch to a new plane state requires unreferencing of all held surfaces. > In the work required for mob cursors the mapped surfaces started being > cached but the variable indicating whether the surface is currently > mapped was not being reset. This leads to crashes as the duplicated > state, incorrectly, indicates the that surface is mapped even when > no surface is present. That's because after unreferencing the surface > it's perfectly possible for the plane to be backed by a bo instead of a > surface. > > Reset the surface mapped flag when unreferencing the plane state surface > to fix null derefs in cleanup. Fixes crashes in KDE KWin 6.0 on Wayland: > > Oops: [#1] PREEMPT SMP PTI > CPU: 4 PID: 2533 Comm: kwin_wayland Not tainted 6.7.0-rc3-vmwgfx #2 > Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference > Platform, BIOS 6.00 11/12/2020 > RIP: 0010:vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > Code: 00 00 00 75 3a 48 83 c4 10 5b 5d c3 cc cc cc cc 48 8b b3 a8 00 00 00 48 > c7 c7 99 90 43 c0 e8 93 c5 db ca 48 8b 83 a8 00 00 00 <48> 8b 78 28 e8 e3 f> > RSP: 0018:b6b98216fa80 EFLAGS: 00010246 > RAX: RBX: 969d84cdcb00 RCX: 0027 > RDX: RSI: 0001 RDI: 969e75f21600 > RBP: 969d4143dc50 R08: R09: b6b98216f920 > R10: 0003 R11: 969e7feb3b10 R12: > R13: R14: 027b R15: 969d49c9fc00 > FS: 7f1e8f1b4180() GS:969e75f0() knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 0028 CR3: 000104006004 CR4: 003706f0 > Call Trace: > > ? __die+0x23/0x70 > ? page_fault_oops+0x171/0x4e0 > ? exc_page_fault+0x7f/0x180 > ? asm_exc_page_fault+0x26/0x30 > ? vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > drm_atomic_helper_cleanup_planes+0x9b/0xc0 > commit_tail+0xd1/0x130 > drm_atomic_helper_commit+0x11a/0x140 > drm_atomic_commit+0x97/0xd0 > ? __pfx___drm_printfn_info+0x10/0x10 > drm_atomic_helper_update_plane+0xf5/0x160 > drm_mode_cursor_universal+0x10e/0x270 > drm_mode_cursor_common+0x102/0x230 > ? __pfx_drm_mode_cursor2_ioctl+0x10/0x10 > drm_ioctl_kernel+0xb2/0x110 > drm_ioctl+0x26d/0x4b0 > ? __pfx_drm_mode_cursor2_ioctl+0x10/0x10 > ? __pfx_drm_ioctl+0x10/0x10 > vmw_generic_ioctl+0xa4/0x110 [vmwgfx] > __x64_sys_ioctl+0x94/0xd0 > do_syscall_64+0x61/0xe0 > ? __x64_sys_ioctl+0xaf/0xd0 > ? syscall_exit_to_user_mode+0x2b/0x40 > ? do_syscall_64+0x70/0xe0 > ? __x64_sys_ioctl+0xaf/0xd0 > ? syscall_exit_to_user_mode+0x2b/0x40 > ? do_syscall_64+0x70/0xe0 > ? exc_page_fault+0x7f/0x180 > entry_SYSCALL_64_after_hwframe+0x6e/0x76 > RIP: 0033:0x7f1e93f279ed > Code: 04 25 28 00 00 00 48 89 45 c8 31 c0 48 8d 45 10 c7 45 b0 10 00 00 00 48 > 89 45 b8 48 8d 45 d0 48 89 45 c0 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff f> > RSP: 002b:7ffca0faf600 EFLAGS: 0246 ORIG_RAX: 0010 > RAX: ffda RBX: 55db876ed2c0 RCX: 7f1e93f279ed > RDX: 7ffca0faf6c0 RSI: c02464bb RDI: 0015 > RBP: 7ffca0faf650 R08: 55db87184010 R09: 0007 > R10: 55db886471a0 R11: 0246 R12: 7ffca0faf6c0 > R13: c02464bb R14: 0015 R15: 7ffca0faf790 > > Modules linked in: snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns > nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib > nft_reject_ine> > CR2: 0028 > ---[ end trace ]--- > RIP: 0010:vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > Code: 00 00 00 75 3a 48 83 c4 10 5b 5d c3 cc cc cc cc 48 8b b3 a8 00 00 00 48 > c7 c7 99 90 43 c0 e8 93 c5 db ca 48 8b 83 a8 00 00 00 <48> 8b 78 28 e8 e3 f> > RSP: 0018:b6b98216fa80 EFLAGS: 00010246 > RAX: RBX: 969d84cdcb00 RCX: 0027 > RDX: RSI: 0001 RDI: 969e75f21600 > RBP: 969d4143dc50 R08: R09: b6b98216f920 > R10: 0003 R11: 969e7feb3b10 R12: > R13: R14: 027b R15: 969d49c9fc00 > FS: 7f1e8f1b4180() GS:969e75f0() knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 0028 CR3: 000104006004 CR4: 003706f0 > > Signed-off-by: Zack Rusin > Fixes: 485d98d472d5 ("drm/vmwgfx: Add support for CursorMob and CursorBypass > 4") > Reported-by: Stefan Hoffmeister > Closes: https://gitlab.freedesktop.org/drm/misc/-/issues/34 > Cc: Martin Krastev > Cc: Maaz Mombasawala > Cc: Ian Forbes > Cc: Broadcom internal kernel review list > > Cc: dri-devel@lists.freedesktop.org > Cc: # v5.19+ > --- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c > index 65ed9b0617
Re: [PATCH v3 4/4] arm64: dts: rockchip: Add devicetree for Pine64 PineTab2
Hello Manuel, a few more things I noticed: On Tue, Jan 02, 2024 at 05:15:47PM +0100, Manuel Traut wrote: > From: Alexander Warnecke > > + leds { > + compatible = "gpio-leds"; > + > + pinctrl-names = "default"; > + pinctrl-0 = <&flash_led_en_h>; > + > + led-0 { > + gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; > + color = ; > + function = LED_FUNCTION_FLASH; > + }; This LED is supplied by VCC5V_MIDU, so maybe this should be a regulator-led supplied by gpio (FLASH_LED_EN_H) controlled regulator-fixed named f_led which is in turn supplied by VCC5V_MIDU. https://megous.com/dl/tmp/9bf0d85d78946b5e.png > + }; > + > [...] > > + > + speaker_amp: speaker-amplifier { > + compatible = "simple-audio-amplifier"; > + pinctrl-names = "default"; > + pinctrl-0 = <&spk_ctl>; > + enable-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; > + sound-name-prefix = "Speaker Amplifier"; > + VCC-supply = <&vcc_bat>; > + }; > + > + vcc_3v3: vcc-3v3 { > + compatible = "regulator-fixed"; > + regulator-name = "vcc_3v3"; > + regulator-always-on; > + regulator-boot-on; > + regulator-min-microvolt = <330>; > + regulator-max-microvolt = <330>; > + vin-supply = <&vcc3v3_sys>; > + }; > + > + vcc3v3_minipcie: vcc3v3-minipcie { > + compatible = "regulator-fixed"; > + enable-active-high; > + gpio = <&gpio4 RK_PC3 GPIO_ACTIVE_HIGH>; > + pinctrl-names = "default"; > + pinctrl-0 = <&pcie_pwren_h>; > + regulator-name = "vcc3v3_minipcie"; > + regulator-min-microvolt = <330>; > + regulator-max-microvolt = <330>; > + vin-supply = <&vcc_sys>; This regulator is supplied by vcc_bat: https://megous.com/dl/tmp/4ec71a4a2aea9498.png > + }; > + > + vcc3v3_sd: vcc3v3-sd { > + compatible = "regulator-fixed"; > + gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; > + pinctrl-names = "default"; > + pinctrl-0 = <&sdmmc_pwren_l>; > + regulator-name = "vcc3v3_sd"; > + regulator-min-microvolt = <330>; > + regulator-max-microvolt = <330>; > + vin-supply = <&vcc3v3_sys>; > + }; > + > + vcc5v0_usb_host0: vcc5v0-usb-host0 { > + compatible = "regulator-fixed"; > + enable-active-high; > + gpio = <&gpio4 RK_PC4 GPIO_ACTIVE_HIGH>; > + pinctrl-names = "default"; > + pinctrl-0 = <&usb_host_pwren1_h>; > + regulator-name = "vcc5v0_usb_host0"; > + regulator-min-microvolt = <500>; > + regulator-max-microvolt = <500>; > + vin-supply = <&vcc5v_midu>; > + }; > + > + vcc5v0_usb_host2: vcc5v0-usb-host2 { > + compatible = "regulator-fixed"; > + enable-active-high; > + gpio = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>; > + pinctrl-names = "default"; > + pinctrl-0 = <&usb_host_pwren2_h>; > + regulator-name = "vcc5v0_usb_host2"; > + regulator-min-microvolt = <500>; > + regulator-max-microvolt = <500>; > + vin-supply = <&vcc5v_midu>; > + }; > + > + vcc_bat: vcc-bat { > + compatible = "regulator-fixed"; > + regulator-name = "vcc_bat"; > + regulator-always-on; > + regulator-boot-on; > + }; > + > + vcc_sys: vcc-sys { > + compatible = "regulator-fixed"; > + regulator-name = "vcc_sys"; > + regulator-always-on; > + regulator-boot-on; > + vin-supply = <&vcc_bat>; > + }; > + > + vdd1v2_dvp: vdd1v2-dvp { > + compatible = "regulator-fixed"; > + regulator-name = "vdd1v2_dvp"; > + regulator-min-microvolt = <120>; > + regulator-max-microvolt = <120>; > + vin-supply = <&vcc_3v3>; > + /*enable-supply = <&vcc2v8_dvp>;*/ > + }; There's no vdd1v2_dvp in the schematic on the camera sensor connector, or elsewhere: https://megous.com/dl/tmp/fd95f003d8f3fbfb.png So I guess, you can drop this, entirely. Maybe it's VDD1V5_DVP but I don't think it needs to be described in DT, since it's pretty local to this camera sensor, and nothing else uses it. https://megous.com/dl/tmp/7fc384e196c5428f.png regards, o.
[PATCH v2 00/39] drm/bridge: switch to struct drm_edid
Convert all of drm/bridge to the new struct drm_edid infrastructure. It's safer than struct edid, because it contains meta information about the allocated size of the EDID, instead of relying on the size (number of extensions) originating from outside of the kernel. Among all of drm, I think bridge has the most uses of struct edid that do not originate from the drm_get_edid() family of functions, which means the validity checks are somewhat inconsistent, and having the meta information is more crucial. Only build tested. I'm sure there should be more Cc's especially in the patches towards the end of the series, but I just wanted to get the series out the door now. BR, Jani. Jani Nikula (39): drm/bridge: add ->edid_read hook and drm_bridge_edid_read() drm/bridge: switch to drm_bridge_read_edid() drm/bridge: chrontel-ch7033: switch to drm_bridge_read_edid() drm/bridge: lt8912b: use drm_bridge_read_edid() drm/bridge: lt8912b: clear the EDID property on failures drm/bridge: lt8912b: use ->edid_read callback drm/bridge: lt9611uxc: use drm_bridge_read_edid() drm: bridge: simple-bridge: use drm_bridge_edid_read() drm: bridge: simple-bridge: clear the EDID property on failures drm/bridge: tfp410: use drm_bridge_edid_read() drm/bridge: tfp410: clear the EDID property on failures drm/meson: switch to drm_bridge_edid_read() drm/bridge: remove drm_bridge_get_edid() in favour of drm_bridge_edid_read() drm/bridge: anx7625: switch to ->edid_read callback drm/bridge: cdns-mhdp8546: switch to ->edid_read callback drm/bridge: cdns-mhdp8546: clear the EDID property on failures drm/bridge: display-connector: switch to ->edid_read callback drm/bridge: it6505: switch to ->edid_read callback drm: bridge: it66121: switch to ->edid_read callback drm/bridge: lt9611: switch to ->edid_read callback drm/bridge: lt9611uxc: switch to ->edid_read callback drm/bridge: megachips: switch to ->edid_read callback drm/bridge: nxp-ptn3460: switch to ->edid_read callback drm/bridge: sii902x: use display info is_hdmi drm/bridge: sii902x: switch to ->edid_read callback drm/mediatek/dp: switch to ->edid_read callback drm/mediatek/hdmi: switch to ->edid_read callback drm/msm/hdmi: fix indent drm/msm/hdmi: switch to ->edid_read callback drm/omap/hdmi4: switch to ->edid_read callback drm/omap/hdmi5: switch to ->edid_read callback drm: xlnx: zynqmp_dpsub: switch to ->edid_read callback drm: adv7511: switch to ->edid_read callback drm: bridge: dw_hdmi: switch to ->edid_read callback drm: bridge: dw_hdmi: clear the EDID property and CEC address on failures drm/bridge: tc358767: update the EDID property drm/bridge: tc358767: switch to ->edid_read callback drm/bridge: ti-sn65dsi86: switch to ->edid_read callback drm/bridge: remove ->get_edid callback drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 47 --- drivers/gpu/drm/bridge/analogix/anx7625.c | 30 .../drm/bridge/cadence/cdns-mhdp8546-core.c | 28 ++- drivers/gpu/drm/bridge/chrontel-ch7033.c | 12 ++--- drivers/gpu/drm/bridge/display-connector.c| 8 ++-- drivers/gpu/drm/bridge/ite-it6505.c | 17 +++ drivers/gpu/drm/bridge/ite-it66121.c | 16 +++ drivers/gpu/drm/bridge/lontium-lt8912b.c | 20 drivers/gpu/drm/bridge/lontium-lt9611.c | 8 ++-- drivers/gpu/drm/bridge/lontium-lt9611uxc.c| 18 +++ .../bridge/megachips-stdp-ge-b850v3-fw.c | 18 +++ drivers/gpu/drm/bridge/nxp-ptn3460.c | 23 + drivers/gpu/drm/bridge/sii902x.c | 38 +++ drivers/gpu/drm/bridge/simple-bridge.c| 17 +++ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 43 ++--- drivers/gpu/drm/bridge/tc358767.c | 17 +++ drivers/gpu/drm/bridge/ti-sn65dsi86.c | 8 ++-- drivers/gpu/drm/bridge/ti-tfp410.c| 18 +++ drivers/gpu/drm/drm_bridge.c | 17 +++ drivers/gpu/drm/drm_bridge_connector.c| 16 +++ drivers/gpu/drm/mediatek/mtk_dp.c | 31 +++- drivers/gpu/drm/mediatek/mtk_hdmi.c | 26 ++ drivers/gpu/drm/meson/meson_encoder_hdmi.c| 20 ++-- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c| 33 - drivers/gpu/drm/omapdrm/dss/hdmi4.c | 22 ++--- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 12 ++--- drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 ++-- include/drm/drm_bridge.h | 25 +- 28 files changed, 329 insertions(+), 267 deletions(-) -- 2.39.2
[PATCH v2 01/39] drm/bridge: add ->edid_read hook and drm_bridge_edid_read()
Add new struct drm_edid based ->edid_read hook and drm_bridge_edid_read() function to call the hook. v2: Include drm/drm_edid.h Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_bridge.c | 46 +++- include/drm/drm_bridge.h | 33 ++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index cee3188adf3d..4f6f8c662d3f 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -27,8 +27,9 @@ #include #include -#include #include +#include +#include #include #include #include @@ -1206,6 +1207,47 @@ int drm_bridge_get_modes(struct drm_bridge *bridge, } EXPORT_SYMBOL_GPL(drm_bridge_get_modes); +/** + * drm_bridge_edid_read - read the EDID data of the connected display + * @bridge: bridge control structure + * @connector: the connector to read EDID for + * + * If the bridge supports output EDID retrieval, as reported by the + * DRM_BRIDGE_OP_EDID bridge ops flag, call &drm_bridge_funcs.edid_read to get + * the EDID and return it. Otherwise return NULL. + * + * If &drm_bridge_funcs.edid_read is not set, fall back to using + * drm_bridge_get_edid() and wrapping it in struct drm_edid. + * + * RETURNS: + * The retrieved EDID on success, or NULL otherwise. + */ +const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) +{ + if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) + return NULL; + + /* Transitional: Fall back to ->get_edid. */ + if (!bridge->funcs->edid_read) { + const struct drm_edid *drm_edid; + struct edid *edid; + + edid = drm_bridge_get_edid(bridge, connector); + if (!edid) + return NULL; + + drm_edid = drm_edid_alloc(edid, (edid->extensions + 1) * EDID_LENGTH); + + kfree(edid); + + return drm_edid; + } + + return bridge->funcs->edid_read(bridge, connector); +} +EXPORT_SYMBOL_GPL(drm_bridge_edid_read); + /** * drm_bridge_get_edid - get the EDID data of the connected display * @bridge: bridge control structure @@ -1215,6 +1257,8 @@ EXPORT_SYMBOL_GPL(drm_bridge_get_modes); * DRM_BRIDGE_OP_EDID bridge ops flag, call &drm_bridge_funcs.get_edid to * get the EDID and return it. Otherwise return NULL. * + * Deprecated. Prefer using drm_bridge_edid_read(). + * * RETURNS: * The retrieved EDID on success, or NULL otherwise. */ diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index e39da5807ba7..b7aed3ead705 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -557,6 +557,37 @@ struct drm_bridge_funcs { int (*get_modes)(struct drm_bridge *bridge, struct drm_connector *connector); + /** +* @edid_read: +* +* Read the EDID data of the connected display. +* +* The @edid_read callback is the preferred way of reporting mode +* information for a display connected to the bridge output. Bridges +* that support reading EDID shall implement this callback and leave +* the @get_modes callback unimplemented. +* +* The caller of this operation shall first verify the output +* connection status and refrain from reading EDID from a disconnected +* output. +* +* This callback is optional. Bridges that implement it shall set the +* DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops. +* +* The connector parameter shall be used for the sole purpose of EDID +* retrieval, and shall not be stored internally by bridge drivers for +* future usage. +* +* RETURNS: +* +* An edid structure newly allocated with drm_edid_alloc() or returned +* from drm_edid_read() family of functions on success, or NULL +* otherwise. The caller is responsible for freeing the returned edid +* structure with drm_edid_free(). +*/ + const struct drm_edid *(*edid_read)(struct drm_bridge *bridge, + struct drm_connector *connector); + /** * @get_edid: * @@ -888,6 +919,8 @@ drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, enum drm_connector_status drm_bridge_detect(struct drm_bridge *bridge); int drm_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector); +const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector); struct edid *drm_bridge_get_edid(struct drm_bridge *bridge, struct drm_connector *connector); void drm_bridge_hpd_enable(struct drm_bridge *bridge, -- 2.39.2
[PATCH v2 02/39] drm/bridge: switch to drm_bridge_read_edid()
Prefer using the struct drm_edid based functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_bridge_connector.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 3acd67021ec6..982552c9f92c 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -239,27 +239,27 @@ static int drm_bridge_connector_get_modes_edid(struct drm_connector *connector, struct drm_bridge *bridge) { enum drm_connector_status status; - struct edid *edid; + const struct drm_edid *drm_edid; int n; status = drm_bridge_connector_detect(connector, false); if (status != connector_status_connected) goto no_edid; - edid = drm_bridge_get_edid(bridge, connector); - if (!drm_edid_is_valid(edid)) { - kfree(edid); + drm_edid = drm_bridge_edid_read(bridge, connector); + if (!drm_edid_valid(drm_edid)) { + drm_edid_free(drm_edid); goto no_edid; } - drm_connector_update_edid_property(connector, edid); - n = drm_add_edid_modes(connector, edid); + drm_edid_connector_update(connector, drm_edid); + n = drm_edid_connector_add_modes(connector); - kfree(edid); + drm_edid_free(drm_edid); return n; no_edid: - drm_connector_update_edid_property(connector, NULL); + drm_edid_connector_update(connector, NULL); return 0; } -- 2.39.2
[PATCH v2 03/39] drm/bridge: chrontel-ch7033: switch to drm_bridge_read_edid()
Prefer using the struct drm_edid based functions. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/chrontel-ch7033.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/chrontel-ch7033.c b/drivers/gpu/drm/bridge/chrontel-ch7033.c index 483c28c7fc99..c83486cf6b15 100644 --- a/drivers/gpu/drm/bridge/chrontel-ch7033.c +++ b/drivers/gpu/drm/bridge/chrontel-ch7033.c @@ -230,14 +230,14 @@ static const struct drm_connector_funcs ch7033_connector_funcs = { static int ch7033_connector_get_modes(struct drm_connector *connector) { struct ch7033_priv *priv = conn_to_ch7033_priv(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int ret; - edid = drm_bridge_get_edid(priv->next_bridge, connector); - drm_connector_update_edid_property(connector, edid); - if (edid) { - ret = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid = drm_bridge_edid_read(priv->next_bridge, connector); + drm_edid_connector_update(connector, drm_edid); + if (drm_edid) { + ret = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); } else { ret = drm_add_modes_noedid(connector, 1920, 1080); drm_set_preferred_mode(connector, 1024, 768); -- 2.39.2
[PATCH v2 04/39] drm/bridge: lt8912b: use drm_bridge_read_edid()
Prefer using the struct drm_edid based functions. cc: Adrien Grassein Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index 273157428c82..4dc748d5d1ee 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -440,16 +440,16 @@ lt8912_connector_mode_valid(struct drm_connector *connector, static int lt8912_connector_get_modes(struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; int ret = -1; int num = 0; struct lt8912 *lt = connector_to_lt8912(connector); u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24; - edid = drm_bridge_get_edid(lt->hdmi_port, connector); - if (edid) { - drm_connector_update_edid_property(connector, edid); - num = drm_add_edid_modes(connector, edid); + drm_edid = drm_bridge_edid_read(lt->hdmi_port, connector); + if (drm_edid) { + drm_edid_connector_update(connector, drm_edid); + num = drm_edid_connector_add_modes(connector); } else { return ret; } @@ -459,7 +459,7 @@ static int lt8912_connector_get_modes(struct drm_connector *connector) if (ret) num = ret; - kfree(edid); + drm_edid_free(drm_edid); return num; } -- 2.39.2
[PATCH v2 05/39] drm/bridge: lt8912b: clear the EDID property on failures
If EDID read fails, clear the EDID property. Cc: Adrien Grassein Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index 4dc748d5d1ee..9c0ffc1c6fac 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -447,8 +447,8 @@ static int lt8912_connector_get_modes(struct drm_connector *connector) u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24; drm_edid = drm_bridge_edid_read(lt->hdmi_port, connector); + drm_edid_connector_update(connector, drm_edid); if (drm_edid) { - drm_edid_connector_update(connector, drm_edid); num = drm_edid_connector_add_modes(connector); } else { return ret; -- 2.39.2
[PATCH v2 06/39] drm/bridge: lt8912b: use ->edid_read callback
Prefer using the struct drm_edid based functions. Cc: Adrien Grassein Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index 9c0ffc1c6fac..e7c4bef74aa4 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -620,8 +620,8 @@ lt8912_bridge_detect(struct drm_bridge *bridge) return lt8912_check_cable_status(lt); } -static struct edid *lt8912_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *lt8912_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct lt8912 *lt = bridge_to_lt8912(bridge); @@ -630,7 +630,7 @@ static struct edid *lt8912_bridge_get_edid(struct drm_bridge *bridge, * given to the hdmi connector node. */ if (lt->hdmi_port->ops & DRM_BRIDGE_OP_EDID) - return drm_bridge_get_edid(lt->hdmi_port, connector); + return drm_bridge_edid_read(lt->hdmi_port, connector); dev_warn(lt->dev, "The connected bridge does not supports DRM_BRIDGE_OP_EDID\n"); return NULL; @@ -642,7 +642,7 @@ static const struct drm_bridge_funcs lt8912_bridge_funcs = { .mode_set = lt8912_bridge_mode_set, .enable = lt8912_bridge_enable, .detect = lt8912_bridge_detect, - .get_edid = lt8912_bridge_get_edid, + .edid_read = lt8912_bridge_edid_read, }; static int lt8912_bridge_resume(struct device *dev) -- 2.39.2
[PATCH v2 08/39] drm: bridge: simple-bridge: use drm_bridge_edid_read()
Prefer using the struct drm_edid based functions. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/simple-bridge.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index cbe8e778d7c7..e0cf7721bb8c 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -51,18 +51,18 @@ drm_connector_to_simple_bridge(struct drm_connector *connector) static int simple_bridge_get_modes(struct drm_connector *connector) { struct simple_bridge *sbridge = drm_connector_to_simple_bridge(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int ret; if (sbridge->next_bridge->ops & DRM_BRIDGE_OP_EDID) { - edid = drm_bridge_get_edid(sbridge->next_bridge, connector); - if (!edid) + drm_edid = drm_bridge_edid_read(sbridge->next_bridge, connector); + if (!drm_edid) DRM_INFO("EDID read failed. Fallback to standard modes\n"); } else { - edid = NULL; + drm_edid = NULL; } - if (!edid) { + if (!drm_edid) { /* * In case we cannot retrieve the EDIDs (missing or broken DDC * bus from the next bridge), fallback on the XGA standards and @@ -73,9 +73,9 @@ static int simple_bridge_get_modes(struct drm_connector *connector) return ret; } - drm_connector_update_edid_property(connector, edid); - ret = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid_connector_update(connector, drm_edid); + ret = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return ret; } -- 2.39.2
[PATCH v2 07/39] drm/bridge: lt9611uxc: use drm_bridge_read_edid()
Prefer using the struct drm_edid based functions. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index e971b75e90ad..3d916306a47d 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -294,12 +294,12 @@ static int lt9611uxc_connector_get_modes(struct drm_connector *connector) { struct lt9611uxc *lt9611uxc = connector_to_lt9611uxc(connector); unsigned int count; - struct edid *edid; + const struct drm_edid *drm_edid; - edid = drm_bridge_get_edid(<9611uxc->bridge, connector); - drm_connector_update_edid_property(connector, edid); - count = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid = drm_bridge_edid_read(<9611uxc->bridge, connector); + drm_edid_connector_update(connector, drm_edid); + count = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return count; } -- 2.39.2
[PATCH v2 09/39] drm: bridge: simple-bridge: clear the EDID property on failures
If EDID read fails, clear the EDID property. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/simple-bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index e0cf7721bb8c..5813a2c4fc5e 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -62,6 +62,8 @@ static int simple_bridge_get_modes(struct drm_connector *connector) drm_edid = NULL; } + drm_edid_connector_update(connector, drm_edid); + if (!drm_edid) { /* * In case we cannot retrieve the EDIDs (missing or broken DDC @@ -73,7 +75,6 @@ static int simple_bridge_get_modes(struct drm_connector *connector) return ret; } - drm_edid_connector_update(connector, drm_edid); ret = drm_edid_connector_add_modes(connector); drm_edid_free(drm_edid); -- 2.39.2
[PATCH v2 10/39] drm/bridge: tfp410: use drm_bridge_edid_read()
Prefer using the struct drm_edid based functions. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/ti-tfp410.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 28848a8eb42e..dd14731eb03e 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -50,18 +50,18 @@ drm_connector_to_tfp410(struct drm_connector *connector) static int tfp410_get_modes(struct drm_connector *connector) { struct tfp410 *dvi = drm_connector_to_tfp410(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int ret; if (dvi->next_bridge->ops & DRM_BRIDGE_OP_EDID) { - edid = drm_bridge_get_edid(dvi->next_bridge, connector); - if (!edid) + drm_edid = drm_bridge_edid_read(dvi->next_bridge, connector); + if (!drm_edid) DRM_INFO("EDID read failed. Fallback to standard modes\n"); } else { - edid = NULL; + drm_edid = NULL; } - if (!edid) { + if (!drm_edid) { /* * No EDID, fallback on the XGA standard modes and prefer a mode * pretty much anything can handle. @@ -71,11 +71,11 @@ static int tfp410_get_modes(struct drm_connector *connector) return ret; } - drm_connector_update_edid_property(connector, edid); + drm_edid_connector_update(connector, drm_edid); - ret = drm_add_edid_modes(connector, edid); + ret = drm_edid_connector_add_modes(connector); - kfree(edid); + drm_edid_free(drm_edid); return ret; } -- 2.39.2
[PATCH v2 11/39] drm/bridge: tfp410: clear the EDID property on failures
If EDID read fails, clear the EDID property. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/ti-tfp410.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index dd14731eb03e..c7bef5c23927 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -61,6 +61,8 @@ static int tfp410_get_modes(struct drm_connector *connector) drm_edid = NULL; } + drm_edid_connector_update(connector, drm_edid); + if (!drm_edid) { /* * No EDID, fallback on the XGA standard modes and prefer a mode @@ -71,8 +73,6 @@ static int tfp410_get_modes(struct drm_connector *connector) return ret; } - drm_edid_connector_update(connector, drm_edid); - ret = drm_edid_connector_add_modes(connector); drm_edid_free(drm_edid); -- 2.39.2
[PATCH v2 12/39] drm/meson: switch to drm_bridge_edid_read()
Prefer using the struct drm_edid based functions. Not ideal, should use source physical address from connector info. Signed-off-by: Jani Nikula --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index 25ea76558690..fff6ce394f98 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -323,19 +323,31 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, enum drm_connector_status status) { struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge); - struct edid *edid; if (!encoder_hdmi->cec_notifier) return; if (status == connector_status_connected) { - edid = drm_bridge_get_edid(encoder_hdmi->next_bridge, encoder_hdmi->connector); - if (!edid) + const struct drm_edid *drm_edid; + const struct edid *edid; + + drm_edid = drm_bridge_edid_read(encoder_hdmi->next_bridge, + encoder_hdmi->connector); + if (!drm_edid) return; + /* +* FIXME: The CEC physical address should be set using +* cec_notifier_set_phys_addr(encoder_hdmi->cec_notifier, +* connector->display_info.source_physical_address) from a path +* that has read the EDID and called +* drm_edid_connector_update(). +*/ + edid = drm_edid_raw(drm_edid); + cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid); - kfree(edid); + drm_edid_free(drm_edid); } else cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier); } -- 2.39.2
[PATCH v2 13/39] drm/bridge: remove drm_bridge_get_edid() in favour of drm_bridge_edid_read()
All users of drm_bridge_get_edid() have been converted to use drm_bridge_edid_read(). Remove drm_bridge_get_edid(). Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_bridge.c | 28 ++-- include/drm/drm_bridge.h | 2 -- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 4f6f8c662d3f..a3065d4aa3d6 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1217,7 +1217,7 @@ EXPORT_SYMBOL_GPL(drm_bridge_get_modes); * the EDID and return it. Otherwise return NULL. * * If &drm_bridge_funcs.edid_read is not set, fall back to using - * drm_bridge_get_edid() and wrapping it in struct drm_edid. + * &drm_bridge_funcs.get_edid and wrapping it in struct drm_edid. * * RETURNS: * The retrieved EDID on success, or NULL otherwise. @@ -1233,7 +1233,7 @@ const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, const struct drm_edid *drm_edid; struct edid *edid; - edid = drm_bridge_get_edid(bridge, connector); + edid = bridge->funcs->get_edid(bridge, connector); if (!edid) return NULL; @@ -1248,30 +1248,6 @@ const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, } EXPORT_SYMBOL_GPL(drm_bridge_edid_read); -/** - * drm_bridge_get_edid - get the EDID data of the connected display - * @bridge: bridge control structure - * @connector: the connector to read EDID for - * - * If the bridge supports output EDID retrieval, as reported by the - * DRM_BRIDGE_OP_EDID bridge ops flag, call &drm_bridge_funcs.get_edid to - * get the EDID and return it. Otherwise return NULL. - * - * Deprecated. Prefer using drm_bridge_edid_read(). - * - * RETURNS: - * The retrieved EDID on success, or NULL otherwise. - */ -struct edid *drm_bridge_get_edid(struct drm_bridge *bridge, -struct drm_connector *connector) -{ - if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) - return NULL; - - return bridge->funcs->get_edid(bridge, connector); -} -EXPORT_SYMBOL_GPL(drm_bridge_get_edid); - /** * drm_bridge_hpd_enable - enable hot plug detection for the bridge * @bridge: bridge control structure diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index b7aed3ead705..ee12f829aaf7 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -921,8 +921,6 @@ int drm_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector); const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, struct drm_connector *connector); -struct edid *drm_bridge_get_edid(struct drm_bridge *bridge, -struct drm_connector *connector); void drm_bridge_hpd_enable(struct drm_bridge *bridge, void (*cb)(void *data, enum drm_connector_status status), -- 2.39.2
[PATCH v2 15/39] drm/bridge: cdns-mhdp8546: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- .../drm/bridge/cadence/cdns-mhdp8546-core.c | 26 +-- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index 7d470527455b..e44cb89c33f0 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -1505,33 +1505,33 @@ static void cdns_mhdp_link_down(struct cdns_mhdp_device *mhdp) mhdp->link_up = false; } -static struct edid *cdns_mhdp_get_edid(struct cdns_mhdp_device *mhdp, - struct drm_connector *connector) +static const struct drm_edid *cdns_mhdp_edid_read(struct cdns_mhdp_device *mhdp, + struct drm_connector *connector) { if (!mhdp->plugged) return NULL; - return drm_do_get_edid(connector, cdns_mhdp_get_edid_block, mhdp); + return drm_edid_read_custom(connector, cdns_mhdp_get_edid_block, mhdp); } static int cdns_mhdp_get_modes(struct drm_connector *connector) { struct cdns_mhdp_device *mhdp = connector_to_mhdp(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int num_modes; if (!mhdp->plugged) return 0; - edid = cdns_mhdp_get_edid(mhdp, connector); - if (!edid) { + drm_edid = cdns_mhdp_edid_read(mhdp, connector); + if (!drm_edid) { dev_err(mhdp->dev, "Failed to read EDID\n"); return 0; } - drm_connector_update_edid_property(connector, edid); - num_modes = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid_connector_update(connector, drm_edid); + num_modes = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); /* * HACK: Warn about unsupported display formats until we deal @@ -2220,12 +2220,12 @@ static enum drm_connector_status cdns_mhdp_bridge_detect(struct drm_bridge *brid return cdns_mhdp_detect(mhdp); } -static struct edid *cdns_mhdp_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *cdns_mhdp_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); - return cdns_mhdp_get_edid(mhdp, connector); + return cdns_mhdp_edid_read(mhdp, connector); } static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { @@ -2239,7 +2239,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_reset = cdns_mhdp_bridge_atomic_reset, .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts, .detect = cdns_mhdp_bridge_detect, - .get_edid = cdns_mhdp_bridge_get_edid, + .edid_read = cdns_mhdp_bridge_edid_read, .hpd_enable = cdns_mhdp_bridge_hpd_enable, .hpd_disable = cdns_mhdp_bridge_hpd_disable, }; -- 2.39.2
[PATCH v2 16/39] drm/bridge: cdns-mhdp8546: clear the EDID property on failures
If EDID read fails, clear the EDID property. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index e44cb89c33f0..e226acc5c15e 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -1524,12 +1524,14 @@ static int cdns_mhdp_get_modes(struct drm_connector *connector) return 0; drm_edid = cdns_mhdp_edid_read(mhdp, connector); + + drm_edid_connector_update(connector, drm_edid); + if (!drm_edid) { dev_err(mhdp->dev, "Failed to read EDID\n"); return 0; } - drm_edid_connector_update(connector, drm_edid); num_modes = drm_edid_connector_add_modes(connector); drm_edid_free(drm_edid); -- 2.39.2
[PATCH v2 14/39] drm/bridge: anx7625: switch to ->edid_read callback
Prefer using the struct drm_edid based callback. v2: Fix build (goto out;) Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/analogix/anx7625.c | 30 --- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index ef31033439bc..25f7afa408c2 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1782,24 +1782,14 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, return ret; } -static struct edid *anx7625_get_edid(struct anx7625_data *ctx) +static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx) { struct device *dev = ctx->dev; struct s_edid_data *p_edid = &ctx->slimport_edid_p; int edid_num; - u8 *edid; - edid = kmalloc(FOUR_BLOCK_SIZE, GFP_KERNEL); - if (!edid) { - DRM_DEV_ERROR(dev, "Fail to allocate buffer\n"); - return NULL; - } - - if (ctx->slimport_edid_p.edid_block_num > 0) { - memcpy(edid, ctx->slimport_edid_p.edid_raw_data, - FOUR_BLOCK_SIZE); - return (struct edid *)edid; - } + if (ctx->slimport_edid_p.edid_block_num > 0) + goto out; pm_runtime_get_sync(dev); _anx7625_hpd_polling(ctx, 5000 * 100); @@ -1808,14 +1798,14 @@ static struct edid *anx7625_get_edid(struct anx7625_data *ctx) if (edid_num < 1) { DRM_DEV_ERROR(dev, "Fail to read EDID: %d\n", edid_num); - kfree(edid); return NULL; } p_edid->edid_block_num = edid_num; - memcpy(edid, ctx->slimport_edid_p.edid_raw_data, FOUR_BLOCK_SIZE); - return (struct edid *)edid; +out: + return drm_edid_alloc(ctx->slimport_edid_p.edid_raw_data, + FOUR_BLOCK_SIZE); } static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx) @@ -2488,15 +2478,15 @@ anx7625_bridge_detect(struct drm_bridge *bridge) return anx7625_sink_detect(ctx); } -static struct edid *anx7625_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *anx7625_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; DRM_DEV_DEBUG_DRIVER(dev, "drm bridge get edid\n"); - return anx7625_get_edid(ctx); + return anx7625_edid_read(ctx); } static const struct drm_bridge_funcs anx7625_bridge_funcs = { @@ -2511,7 +2501,7 @@ static const struct drm_bridge_funcs anx7625_bridge_funcs = { .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, .detect = anx7625_bridge_detect, - .get_edid = anx7625_bridge_get_edid, + .edid_read = anx7625_bridge_edid_read, }; static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx, -- 2.39.2
[PATCH v2 17/39] drm/bridge: display-connector: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/display-connector.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c index 08bd5695ddae..ab8e00baf3f1 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -81,12 +81,12 @@ display_connector_detect(struct drm_bridge *bridge) } } -static struct edid *display_connector_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *display_connector_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct display_connector *conn = to_display_connector(bridge); - return drm_get_edid(connector, conn->bridge.ddc); + return drm_edid_read_ddc(connector, conn->bridge.ddc); } /* @@ -172,7 +172,7 @@ static u32 *display_connector_get_input_bus_fmts(struct drm_bridge *bridge, static const struct drm_bridge_funcs display_connector_bridge_funcs = { .attach = display_connector_attach, .detect = display_connector_detect, - .get_edid = display_connector_get_edid, + .edid_read = display_connector_edid_read, .atomic_get_output_bus_fmts = display_connector_get_output_bus_fmts, .atomic_get_input_bus_fmts = display_connector_get_input_bus_fmts, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, -- 2.39.2
[PATCH v2 19/39] drm: bridge: it66121: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/ite-it66121.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 1cf3fb1f13dc..1c3433b5e366 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -874,33 +874,33 @@ static void it66121_bridge_hpd_disable(struct drm_bridge *bridge) dev_err(ctx->dev, "failed to disable HPD IRQ\n"); } -static struct edid *it66121_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *it66121_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge); - struct edid *edid; + const struct drm_edid *drm_edid; int ret; mutex_lock(&ctx->lock); ret = it66121_preamble_ddc(ctx); if (ret) { - edid = NULL; + drm_edid = NULL; goto out_unlock; } ret = regmap_write(ctx->regmap, IT66121_DDC_HEADER_REG, IT66121_DDC_HEADER_EDID); if (ret) { - edid = NULL; + drm_edid = NULL; goto out_unlock; } - edid = drm_do_get_edid(connector, it66121_get_edid_block, ctx); + drm_edid = drm_edid_read_custom(connector, it66121_get_edid_block, ctx); out_unlock: mutex_unlock(&ctx->lock); - return edid; + return drm_edid; } static const struct drm_bridge_funcs it66121_bridge_funcs = { @@ -916,7 +916,7 @@ static const struct drm_bridge_funcs it66121_bridge_funcs = { .mode_set = it66121_bridge_mode_set, .mode_valid = it66121_bridge_mode_valid, .detect = it66121_bridge_detect, - .get_edid = it66121_bridge_get_edid, + .edid_read = it66121_bridge_edid_read, .hpd_enable = it66121_bridge_hpd_enable, .hpd_disable = it66121_bridge_hpd_disable, }; -- 2.39.2
[PATCH v2 18/39] drm/bridge: it6505: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/ite-it6505.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 2f300f5ca051..914b58ec130d 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -458,7 +458,7 @@ struct it6505 { /* it6505 driver hold option */ bool enable_drv_hold; - struct edid *cached_edid; + const struct drm_edid *cached_edid; }; struct it6505_step_train_para { @@ -2261,7 +2261,7 @@ static void it6505_plugged_status_to_codec(struct it6505 *it6505) static void it6505_remove_edid(struct it6505 *it6505) { - kfree(it6505->cached_edid); + drm_edid_free(it6505->cached_edid); it6505->cached_edid = NULL; } @@ -3032,15 +3032,16 @@ it6505_bridge_detect(struct drm_bridge *bridge) return it6505_detect(it6505); } -static struct edid *it6505_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *it6505_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct it6505 *it6505 = bridge_to_it6505(bridge); struct device *dev = it6505->dev; if (!it6505->cached_edid) { - it6505->cached_edid = drm_do_get_edid(connector, it6505_get_edid_block, - it6505); + it6505->cached_edid = drm_edid_read_custom(connector, + it6505_get_edid_block, + it6505); if (!it6505->cached_edid) { DRM_DEV_DEBUG_DRIVER(dev, "failed to get edid!"); @@ -3048,7 +3049,7 @@ static struct edid *it6505_bridge_get_edid(struct drm_bridge *bridge, } } - return drm_edid_duplicate(it6505->cached_edid); + return drm_edid_dup(it6505->cached_edid); } static const struct drm_bridge_funcs it6505_bridge_funcs = { @@ -3063,7 +3064,7 @@ static const struct drm_bridge_funcs it6505_bridge_funcs = { .atomic_pre_enable = it6505_bridge_atomic_pre_enable, .atomic_post_disable = it6505_bridge_atomic_post_disable, .detect = it6505_bridge_detect, - .get_edid = it6505_bridge_get_edid, + .edid_read = it6505_bridge_edid_read, }; static __maybe_unused int it6505_bridge_resume(struct device *dev) -- 2.39.2
[PATCH v2 20/39] drm/bridge: lt9611: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt9611.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 9663601ce098..1385e3378985 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -846,13 +846,13 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge, lt9611_sleep_setup(lt9611); } -static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *lt9611_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); lt9611_power_on(lt9611); - return drm_do_get_edid(connector, lt9611_get_edid_block, lt9611); + return drm_edid_read_custom(connector, lt9611_get_edid_block, lt9611); } static void lt9611_bridge_hpd_enable(struct drm_bridge *bridge) @@ -892,7 +892,7 @@ static const struct drm_bridge_funcs lt9611_bridge_funcs = { .attach = lt9611_bridge_attach, .mode_valid = lt9611_bridge_mode_valid, .detect = lt9611_bridge_detect, - .get_edid = lt9611_bridge_get_edid, + .edid_read = lt9611_bridge_edid_read, .hpd_enable = lt9611_bridge_hpd_enable, .atomic_pre_enable = lt9611_bridge_atomic_pre_enable, -- 2.39.2
[PATCH v2 21/39] drm/bridge: lt9611uxc: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index 3d916306a47d..28ceae10fa25 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -494,8 +494,8 @@ static int lt9611uxc_get_edid_block(void *data, u8 *buf, unsigned int block, siz return 0; }; -static struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *lt9611uxc_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge); int ret; @@ -509,7 +509,7 @@ static struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge, return NULL; } - return drm_do_get_edid(connector, lt9611uxc_get_edid_block, lt9611uxc); + return drm_edid_read_custom(connector, lt9611uxc_get_edid_block, lt9611uxc); } static const struct drm_bridge_funcs lt9611uxc_bridge_funcs = { @@ -517,7 +517,7 @@ static const struct drm_bridge_funcs lt9611uxc_bridge_funcs = { .mode_valid = lt9611uxc_bridge_mode_valid, .mode_set = lt9611uxc_bridge_mode_set, .detect = lt9611uxc_bridge_detect, - .get_edid = lt9611uxc_bridge_get_edid, + .edid_read = lt9611uxc_bridge_edid_read, }; static int lt9611uxc_parse_dt(struct device *dev, -- 2.39.2
[PATCH v2 22/39] drm/bridge: megachips: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- .../bridge/megachips-stdp-ge-b850v3-fw.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdp-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdp-ge-b850v3-fw.c index e93083bbec9d..4480523244e4 100644 --- a/drivers/gpu/drm/bridge/megachips-stdp-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdp-ge-b850v3-fw.c @@ -91,26 +91,26 @@ static int stdp2690_read_block(void *context, u8 *buf, unsigned int block, size_ return 0; } -static struct edid *ge_b850v3_lvds_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *ge_b850v3_lvds_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct i2c_client *client; client = ge_b850v3_lvds_ptr->stdp2690_i2c; - return drm_do_get_edid(connector, stdp2690_read_block, client); + return drm_edid_read_custom(connector, stdp2690_read_block, client); } static int ge_b850v3_lvds_get_modes(struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; int num_modes; - edid = ge_b850v3_lvds_get_edid(&ge_b850v3_lvds_ptr->bridge, connector); + drm_edid = ge_b850v3_lvds_edid_read(&ge_b850v3_lvds_ptr->bridge, connector); - drm_connector_update_edid_property(connector, edid); - num_modes = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid_connector_update(connector, drm_edid); + num_modes = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return num_modes; } @@ -226,7 +226,7 @@ static int ge_b850v3_lvds_attach(struct drm_bridge *bridge, static const struct drm_bridge_funcs ge_b850v3_lvds_funcs = { .attach = ge_b850v3_lvds_attach, .detect = ge_b850v3_lvds_bridge_detect, - .get_edid = ge_b850v3_lvds_get_edid, + .edid_read = ge_b850v3_lvds_edid_read, }; static int ge_b850v3_lvds_init(struct device *dev) -- 2.39.2
[PATCH v2 23/39] drm/bridge: nxp-ptn3460: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/nxp-ptn3460.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c index 7c0076e49953..4af3af5662cc 100644 --- a/drivers/gpu/drm/bridge/nxp-ptn3460.c +++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c @@ -154,10 +154,11 @@ static void ptn3460_disable(struct drm_bridge *bridge) } -static struct edid *ptn3460_get_edid(struct drm_bridge *bridge, -struct drm_connector *connector) +static const struct drm_edid *ptn3460_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); + const struct drm_edid *drm_edid; bool power_off; u8 *edid; int ret; @@ -175,27 +176,29 @@ static struct edid *ptn3460_get_edid(struct drm_bridge *bridge, EDID_LENGTH); if (ret) { kfree(edid); - edid = NULL; + drm_edid = NULL; goto out; } + drm_edid = drm_edid_alloc(edid, EDID_LENGTH); + out: if (power_off) ptn3460_disable(&ptn_bridge->bridge); - return (struct edid *)edid; + return drm_edid; } static int ptn3460_connector_get_modes(struct drm_connector *connector) { struct ptn3460_bridge *ptn_bridge = connector_to_ptn3460(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int num_modes; - edid = ptn3460_get_edid(&ptn_bridge->bridge, connector); - drm_connector_update_edid_property(connector, edid); - num_modes = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid = ptn3460_edid_read(&ptn_bridge->bridge, connector); + drm_edid_connector_update(connector, drm_edid); + num_modes = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return num_modes; } @@ -254,7 +257,7 @@ static const struct drm_bridge_funcs ptn3460_bridge_funcs = { .pre_enable = ptn3460_pre_enable, .disable = ptn3460_disable, .attach = ptn3460_bridge_attach, - .get_edid = ptn3460_get_edid, + .edid_read = ptn3460_edid_read, }; static int ptn3460_probe(struct i2c_client *client) -- 2.39.2
[PATCH v2 24/39] drm/bridge: sii902x: use display info is_hdmi
Use the pre-parsed information instead of parsing EDID again. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/sii902x.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 2bdc5b439beb..2f876b805b83 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -286,12 +286,6 @@ static struct edid *sii902x_get_edid(struct sii902x *sii902x, mutex_lock(&sii902x->mutex); edid = drm_get_edid(connector, sii902x->i2cmux->adapter[0]); - if (edid) { - if (drm_detect_hdmi_monitor(edid)) - sii902x->sink_is_hdmi = true; - else - sii902x->sink_is_hdmi = false; - } mutex_unlock(&sii902x->mutex); @@ -311,6 +305,8 @@ static int sii902x_get_modes(struct drm_connector *connector) kfree(edid); } + sii902x->sink_is_hdmi = connector->display_info.is_hdmi; + return num; } -- 2.39.2
[PATCH v2 25/39] drm/bridge: sii902x: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/sii902x.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 2f876b805b83..12346bacecaf 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -278,31 +278,31 @@ static const struct drm_connector_funcs sii902x_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static struct edid *sii902x_get_edid(struct sii902x *sii902x, -struct drm_connector *connector) +static const struct drm_edid *sii902x_edid_read(struct sii902x *sii902x, + struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; mutex_lock(&sii902x->mutex); - edid = drm_get_edid(connector, sii902x->i2cmux->adapter[0]); + drm_edid = drm_edid_read_ddc(connector, sii902x->i2cmux->adapter[0]); mutex_unlock(&sii902x->mutex); - return edid; + return drm_edid; } static int sii902x_get_modes(struct drm_connector *connector) { struct sii902x *sii902x = connector_to_sii902x(connector); - struct edid *edid; + const struct drm_edid *drm_edid; int num = 0; - edid = sii902x_get_edid(sii902x, connector); - drm_connector_update_edid_property(connector, edid); - if (edid) { - num = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid = sii902x_edid_read(sii902x, connector); + drm_edid_connector_update(connector, drm_edid); + if (drm_edid) { + num = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); } sii902x->sink_is_hdmi = connector->display_info.is_hdmi; @@ -461,12 +461,12 @@ static enum drm_connector_status sii902x_bridge_detect(struct drm_bridge *bridge return sii902x_detect(sii902x); } -static struct edid *sii902x_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *sii902x_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct sii902x *sii902x = bridge_to_sii902x(bridge); - return sii902x_get_edid(sii902x, connector); + return sii902x_edid_read(sii902x, connector); } static u32 *sii902x_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, @@ -510,7 +510,7 @@ static const struct drm_bridge_funcs sii902x_bridge_funcs = { .disable = sii902x_bridge_disable, .enable = sii902x_bridge_enable, .detect = sii902x_bridge_detect, - .get_edid = sii902x_bridge_get_edid, + .edid_read = sii902x_bridge_edid_read, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, -- 2.39.2
[PATCH v2 26/39] drm/mediatek/dp: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/mediatek/mtk_dp.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 2136a596efa1..0ba72102636a 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2042,12 +2042,12 @@ static enum drm_connector_status mtk_dp_bdg_detect(struct drm_bridge *bridge) return ret; } -static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *mtk_dp_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge); bool enabled = mtk_dp->enabled; - struct edid *new_edid = NULL; + const struct drm_edid *drm_edid; struct mtk_dp_audio_cfg *audio_caps = &mtk_dp->info.audio_cur_cfg; if (!enabled) { @@ -2055,7 +2055,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, mtk_dp_aux_panel_poweron(mtk_dp, true); } - new_edid = drm_get_edid(connector, &mtk_dp->aux.ddc); + drm_edid = drm_edid_read_ddc(connector, &mtk_dp->aux.ddc); /* * Parse capability here to let atomic_get_input_bus_fmts and @@ -2063,17 +2063,26 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, */ if (mtk_dp_parse_capabilities(mtk_dp)) { drm_err(mtk_dp->drm_dev, "Can't parse capabilities\n"); - kfree(new_edid); - new_edid = NULL; + drm_edid_free(drm_edid); + drm_edid = NULL; } - if (new_edid) { + if (drm_edid) { + /* +* FIXME: get rid of drm_edid_raw() +*/ + const struct edid *edid = drm_edid_raw(drm_edid); struct cea_sad *sads; - audio_caps->sad_count = drm_edid_to_sad(new_edid, &sads); + audio_caps->sad_count = drm_edid_to_sad(edid, &sads); kfree(sads); - audio_caps->detect_monitor = drm_detect_monitor_audio(new_edid); + /* +* FIXME: This should use connector->display_info.has_audio from +* a path that has read the EDID and called +* drm_edid_connector_update(). +*/ + audio_caps->detect_monitor = drm_detect_monitor_audio(edid); } if (!enabled) { @@ -2081,7 +2090,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, drm_atomic_bridge_chain_post_disable(bridge, connector->state->state); } - return new_edid; + return drm_edid; } static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux, @@ -2433,7 +2442,7 @@ static const struct drm_bridge_funcs mtk_dp_bridge_funcs = { .atomic_enable = mtk_dp_bridge_atomic_enable, .atomic_disable = mtk_dp_bridge_atomic_disable, .mode_valid = mtk_dp_bridge_mode_valid, - .get_edid = mtk_dp_get_edid, + .edid_read = mtk_dp_edid_read, .detect = mtk_dp_bdg_detect, }; -- 2.39.2
[PATCH v2 27/39] drm/mediatek/hdmi: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 86133bf16326..c6bdc565e4a9 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1265,19 +1265,27 @@ static enum drm_connector_status mtk_hdmi_bridge_detect(struct drm_bridge *bridg return mtk_hdmi_detect(hdmi); } -static struct edid *mtk_hdmi_bridge_get_edid(struct drm_bridge *bridge, -struct drm_connector *connector) +static const struct drm_edid *mtk_hdmi_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge); - struct edid *edid; + const struct drm_edid *drm_edid; if (!hdmi->ddc_adpt) return NULL; - edid = drm_get_edid(connector, hdmi->ddc_adpt); - if (!edid) - return NULL; - hdmi->dvi_mode = !drm_detect_monitor_audio(edid); - return edid; + drm_edid = drm_edid_read_ddc(connector, hdmi->ddc_adpt); + if (drm_edid) { + /* +* FIXME: This should use !connector->display_info.has_audio (or +* !connector->display_info.is_hdmi) from a path that has read +* the EDID and called drm_edid_connector_update(). +*/ + const struct edid *edid = drm_edid_raw(drm_edid); + + hdmi->dvi_mode = !drm_detect_monitor_audio(edid); + } + + return drm_edid; } static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge, @@ -1417,7 +1425,7 @@ static const struct drm_bridge_funcs mtk_hdmi_bridge_funcs = { .atomic_pre_enable = mtk_hdmi_bridge_atomic_pre_enable, .atomic_enable = mtk_hdmi_bridge_atomic_enable, .detect = mtk_hdmi_bridge_detect, - .get_edid = mtk_hdmi_bridge_get_edid, + .edid_read = mtk_hdmi_bridge_edid_read, }; static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, -- 2.39.2
[PATCH v2 28/39] drm/msm/hdmi: fix indent
Remove the excess leading tabs. Signed-off-by: Jani Nikula --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index f5e01471b0b0..f28c61570533 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -290,12 +290,12 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge } static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { - .pre_enable = msm_hdmi_bridge_pre_enable, - .post_disable = msm_hdmi_bridge_post_disable, - .mode_set = msm_hdmi_bridge_mode_set, - .mode_valid = msm_hdmi_bridge_mode_valid, - .get_edid = msm_hdmi_bridge_get_edid, - .detect = msm_hdmi_bridge_detect, + .pre_enable = msm_hdmi_bridge_pre_enable, + .post_disable = msm_hdmi_bridge_post_disable, + .mode_set = msm_hdmi_bridge_mode_set, + .mode_valid = msm_hdmi_bridge_mode_valid, + .get_edid = msm_hdmi_bridge_get_edid, + .detect = msm_hdmi_bridge_detect, }; static void -- 2.39.2
Re: [PATCH v2 00/39] drm/bridge: switch to struct drm_edid
On Wed, 03 Jan 2024, Jani Nikula wrote: > Convert all of drm/bridge to the new struct drm_edid > infrastructure. It's safer than struct edid, because it contains meta > information about the allocated size of the EDID, instead of relying on > the size (number of extensions) originating from outside of the kernel. > > Among all of drm, I think bridge has the most uses of struct edid that > do not originate from the drm_get_edid() family of functions, which > means the validity checks are somewhat inconsistent, and having the meta > information is more crucial. > > Only build tested. I'm sure there should be more Cc's especially in the > patches towards the end of the series, but I just wanted to get the > series out the door now. PS. It's also available at https://gitlab.freedesktop.org/jani/linux/-/commits/drm-edid-bridge -- Jani Nikula, Intel
[PATCH v2 29/39] drm/msm/hdmi: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index f28c61570533..4a5b5112227f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -236,24 +236,33 @@ static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge, msm_hdmi_audio_update(hdmi); } -static struct edid *msm_hdmi_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *msm_hdmi_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; - struct edid *edid; + const struct drm_edid *drm_edid; uint32_t hdmi_ctrl; hdmi_ctrl = hdmi_read(hdmi, REG_HDMI_CTRL); hdmi_write(hdmi, REG_HDMI_CTRL, hdmi_ctrl | HDMI_CTRL_ENABLE); - edid = drm_get_edid(connector, hdmi->i2c); + drm_edid = drm_edid_read_ddc(connector, hdmi->i2c); hdmi_write(hdmi, REG_HDMI_CTRL, hdmi_ctrl); - hdmi->hdmi_mode = drm_detect_hdmi_monitor(edid); + if (drm_edid) { + /* +* FIXME: This should use connector->display_info.is_hdmi from a +* path that has read the EDID and called +* drm_edid_connector_update(). +*/ + const struct edid *edid = drm_edid_raw(drm_edid); - return edid; + hdmi->hdmi_mode = drm_detect_hdmi_monitor(edid); + } + + return drm_edid; } static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge, @@ -294,7 +303,7 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { .post_disable = msm_hdmi_bridge_post_disable, .mode_set = msm_hdmi_bridge_mode_set, .mode_valid = msm_hdmi_bridge_mode_valid, - .get_edid = msm_hdmi_bridge_get_edid, + .edid_read = msm_hdmi_bridge_edid_read, .detect = msm_hdmi_bridge_detect, }; -- 2.39.2
[PATCH v2 30/39] drm/omap/hdmi4: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index a26b77d99d52..9b8747d83ee8 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -436,11 +436,11 @@ static void hdmi4_bridge_hpd_notify(struct drm_bridge *bridge, hdmi4_cec_set_phys_addr(&hdmi->core, CEC_PHYS_ADDR_INVALID); } -static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *hdmi4_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); - struct edid *edid = NULL; + const struct drm_edid *drm_edid = NULL; unsigned int cec_addr; bool need_enable; int r; @@ -461,13 +461,21 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, if (r) goto done; - edid = drm_do_get_edid(connector, hdmi4_core_ddc_read, &hdmi->core); + drm_edid = drm_edid_read_custom(connector, hdmi4_core_ddc_read, &hdmi->core); done: hdmi_runtime_put(hdmi); mutex_unlock(&hdmi->lock); - if (edid && edid->extensions) { + if (drm_edid) { + /* +* FIXME: The CEC physical address should be set using +* hdmi4_cec_set_phys_addr(&hdmi->core, +* connector->display_info.source_physical_address) from a path +* that has read the EDID and called +* drm_edid_connector_update(). +*/ + const struct edid *edid = drm_edid_raw(drm_edid); unsigned int len = (edid->extensions + 1) * EDID_LENGTH; cec_addr = cec_get_edid_phys_addr((u8 *)edid, len, NULL); @@ -480,7 +488,7 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge, if (need_enable) hdmi4_core_disable(&hdmi->core); - return edid; + return drm_edid; } static const struct drm_bridge_funcs hdmi4_bridge_funcs = { @@ -492,7 +500,7 @@ static const struct drm_bridge_funcs hdmi4_bridge_funcs = { .atomic_enable = hdmi4_bridge_enable, .atomic_disable = hdmi4_bridge_disable, .hpd_notify = hdmi4_bridge_hpd_notify, - .get_edid = hdmi4_bridge_get_edid, + .edid_read = hdmi4_bridge_edid_read, }; static void hdmi4_bridge_init(struct omap_hdmi *hdmi) -- 2.39.2
[PATCH v2 31/39] drm/omap/hdmi5: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index e6611c683857..c7ae2235ae99 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -425,11 +425,11 @@ static void hdmi5_bridge_disable(struct drm_bridge *bridge, mutex_unlock(&hdmi->lock); } -static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *hdmi5_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); - struct edid *edid; + const struct drm_edid *drm_edid; bool need_enable; int idlemode; int r; @@ -452,7 +452,7 @@ static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge, hdmi5_core_ddc_init(&hdmi->core); - edid = drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core); + drm_edid = drm_edid_read_custom(connector, hdmi5_core_ddc_read, &hdmi->core); hdmi5_core_ddc_uninit(&hdmi->core); @@ -464,7 +464,7 @@ static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge, if (need_enable) hdmi_core_disable(hdmi); - return (struct edid *)edid; + return drm_edid; } static const struct drm_bridge_funcs hdmi5_bridge_funcs = { @@ -475,7 +475,7 @@ static const struct drm_bridge_funcs hdmi5_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = hdmi5_bridge_enable, .atomic_disable = hdmi5_bridge_disable, - .get_edid = hdmi5_bridge_get_edid, + .edid_read = hdmi5_bridge_edid_read, }; static void hdmi5_bridge_init(struct omap_hdmi *hdmi) -- 2.39.2
[PATCH v2 32/39] drm: xlnx: zynqmp_dpsub: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index a0606fab0e22..24213eaa38d0 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1560,12 +1560,12 @@ static enum drm_connector_status zynqmp_dp_bridge_detect(struct drm_bridge *brid return connector_status_disconnected; } -static struct edid *zynqmp_dp_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *zynqmp_dp_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct zynqmp_dp *dp = bridge_to_dp(bridge); - return drm_get_edid(connector, &dp->aux.ddc); + return drm_edid_read_ddc(connector, &dp->aux.ddc); } static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { @@ -1579,7 +1579,7 @@ static const struct drm_bridge_funcs zynqmp_dp_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_check = zynqmp_dp_bridge_atomic_check, .detect = zynqmp_dp_bridge_detect, - .get_edid = zynqmp_dp_bridge_get_edid, + .edid_read = zynqmp_dp_bridge_edid_read, }; /* - -- 2.39.2
[PATCH v2 33/39] drm: adv7511: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 47 +--- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8be235144f6d..1e40d451ce8c 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -604,10 +604,10 @@ static int adv7511_get_edid_block(void *data, u8 *buf, unsigned int block, * ADV75xx helpers */ -static struct edid *adv7511_get_edid(struct adv7511 *adv7511, -struct drm_connector *connector) +static const struct drm_edid *adv7511_edid_read(struct adv7511 *adv7511, + struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; /* Reading the EDID only works if the device is powered */ if (!adv7511->powered) { @@ -621,31 +621,44 @@ static struct edid *adv7511_get_edid(struct adv7511 *adv7511, edid_i2c_addr); } - edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511); + drm_edid = drm_edid_read_custom(connector, adv7511_get_edid_block, adv7511); if (!adv7511->powered) __adv7511_power_off(adv7511); - adv7511_set_config_csc(adv7511, connector, adv7511->rgb, - drm_detect_hdmi_monitor(edid)); + if (drm_edid) { + /* +* FIXME: The CEC physical address should be set using +* cec_s_phys_addr(adap, +* connector->display_info.source_physical_address, false) from +* a path that has read the EDID and called +* drm_edid_connector_update(). +*/ + const struct edid *edid = drm_edid_raw(drm_edid); + + adv7511_set_config_csc(adv7511, connector, adv7511->rgb, + drm_detect_hdmi_monitor(edid)); - cec_s_phys_addr_from_edid(adv7511->cec_adap, edid); + cec_s_phys_addr_from_edid(adv7511->cec_adap, edid); + } else { + cec_s_phys_addr_from_edid(adv7511->cec_adap, NULL); + } - return edid; + return drm_edid; } static int adv7511_get_modes(struct adv7511 *adv7511, struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; unsigned int count; - edid = adv7511_get_edid(adv7511, connector); + drm_edid = adv7511_edid_read(adv7511, connector); - drm_connector_update_edid_property(connector, edid); - count = drm_add_edid_modes(connector, edid); + drm_edid_connector_update(connector, drm_edid); + count = drm_edid_connector_add_modes(connector); - kfree(edid); + drm_edid_free(drm_edid); return count; } @@ -953,12 +966,12 @@ static enum drm_connector_status adv7511_bridge_detect(struct drm_bridge *bridge return adv7511_detect(adv, NULL); } -static struct edid *adv7511_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *adv7511_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct adv7511 *adv = bridge_to_adv7511(bridge); - return adv7511_get_edid(adv, connector); + return adv7511_edid_read(adv, connector); } static void adv7511_bridge_hpd_notify(struct drm_bridge *bridge, @@ -977,7 +990,7 @@ static const struct drm_bridge_funcs adv7511_bridge_funcs = { .mode_valid = adv7511_bridge_mode_valid, .attach = adv7511_bridge_attach, .detect = adv7511_bridge_detect, - .get_edid = adv7511_bridge_get_edid, + .edid_read = adv7511_bridge_edid_read, .hpd_notify = adv7511_bridge_hpd_notify, }; -- 2.39.2
[PATCH v2 34/39] drm: bridge: dw_hdmi: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 52d91a0df85e..8ce85e973b38 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2454,16 +2454,17 @@ static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) return result; } -static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, -struct drm_connector *connector) +static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi, + struct drm_connector *connector) { - struct edid *edid; + const struct drm_edid *drm_edid; + const struct edid *edid; if (!hdmi->ddc) return NULL; - edid = drm_get_edid(connector, hdmi->ddc); - if (!edid) { + drm_edid = drm_edid_read_ddc(connector, hdmi->ddc); + if (!drm_edid) { dev_dbg(hdmi->dev, "failed to get edid\n"); return NULL; } @@ -2471,10 +2472,17 @@ static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", edid->width_cm, edid->height_cm); + /* +* FIXME: This should use connector->display_info.is_hdmi and +* connector->display_info.has_audio from a path that has read the EDID +* and called drm_edid_connector_update(). +*/ + edid = drm_edid_raw(drm_edid); + hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->sink_has_audio = drm_detect_monitor_audio(edid); - return edid; + return drm_edid; } /* - @@ -2493,17 +2501,18 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) { struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); - struct edid *edid; + const struct drm_edid *drm_edid; int ret; - edid = dw_hdmi_get_edid(hdmi, connector); - if (!edid) + drm_edid = dw_hdmi_edid_read(hdmi, connector); + if (!drm_edid) return 0; - drm_connector_update_edid_property(connector, edid); - cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); - ret = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid_connector_update(connector, drm_edid); + cec_notifier_set_phys_addr(hdmi->cec_notifier, + connector->display_info.source_physical_address); + ret = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return ret; } @@ -2980,12 +2989,12 @@ static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge return dw_hdmi_detect(hdmi); } -static struct edid *dw_hdmi_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *dw_hdmi_bridge_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct dw_hdmi *hdmi = bridge->driver_private; - return dw_hdmi_get_edid(hdmi, connector); + return dw_hdmi_edid_read(hdmi, connector); } static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { @@ -3002,7 +3011,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { .mode_set = dw_hdmi_bridge_mode_set, .mode_valid = dw_hdmi_bridge_mode_valid, .detect = dw_hdmi_bridge_detect, - .get_edid = dw_hdmi_bridge_get_edid, + .edid_read = dw_hdmi_bridge_edid_read, }; /* - -- 2.39.2
[PATCH v2 35/39] drm: bridge: dw_hdmi: clear the EDID property and CEC address on failures
If EDID read fails, clear the EDID property and CEC address. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 8ce85e973b38..654f35ea516d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2505,8 +2505,6 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) int ret; drm_edid = dw_hdmi_edid_read(hdmi, connector); - if (!drm_edid) - return 0; drm_edid_connector_update(connector, drm_edid); cec_notifier_set_phys_addr(hdmi->cec_notifier, -- 2.39.2
[PATCH v2 36/39] drm/bridge: tc358767: update the EDID property
The EDID property should be updated between reading the EDID and adding the modes. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/tc358767.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index eb0d82a91cb9..da2aec5110c2 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1674,6 +1674,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) } edid = tc_get_edid(&tc->bridge, connector); + drm_connector_update_edid_property(connector, edid); num_modes = drm_add_edid_modes(connector, edid); kfree(edid); -- 2.39.2
[PATCH v2 37/39] drm/bridge: tc358767: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/tc358767.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index da2aec5110c2..975cec698452 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1646,19 +1646,19 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge, drm_mode_copy(&tc->mode, mode); } -static struct edid *tc_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *tc_edid_read(struct drm_bridge *bridge, + struct drm_connector *connector) { struct tc_data *tc = bridge_to_tc(bridge); - return drm_get_edid(connector, &tc->aux.ddc); + return drm_edid_read_ddc(connector, &tc->aux.ddc); } static int tc_connector_get_modes(struct drm_connector *connector) { struct tc_data *tc = connector_to_tc(connector); int num_modes; - struct edid *edid; + const struct drm_edid *drm_edid; int ret; ret = tc_get_display_props(tc); @@ -1673,10 +1673,10 @@ static int tc_connector_get_modes(struct drm_connector *connector) return num_modes; } - edid = tc_get_edid(&tc->bridge, connector); - drm_connector_update_edid_property(connector, edid); - num_modes = drm_add_edid_modes(connector, edid); - kfree(edid); + drm_edid = tc_edid_read(&tc->bridge, connector); + drm_edid_connector_update(connector, drm_edid); + num_modes = drm_edid_connector_add_modes(connector); + drm_edid_free(drm_edid); return num_modes; } @@ -1845,7 +1845,7 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { .atomic_enable = tc_edp_bridge_atomic_enable, .atomic_disable = tc_edp_bridge_atomic_disable, .detect = tc_bridge_detect, - .get_edid = tc_get_edid, + .edid_read = tc_edid_read, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, -- 2.39.2
[PATCH v2 38/39] drm/bridge: ti-sn65dsi86: switch to ->edid_read callback
Prefer using the struct drm_edid based callback and functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 62cc3893dca5..61dc6f063fb4 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -1207,19 +1207,19 @@ static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge) : connector_status_disconnected; } -static struct edid *ti_sn_bridge_get_edid(struct drm_bridge *bridge, - struct drm_connector *connector) +static const struct drm_edid *ti_sn_bridge_edid_read(struct drm_bridge *bridge, +struct drm_connector *connector) { struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); - return drm_get_edid(connector, &pdata->aux.ddc); + return drm_edid_read_ddc(connector, &pdata->aux.ddc); } static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .attach = ti_sn_bridge_attach, .detach = ti_sn_bridge_detach, .mode_valid = ti_sn_bridge_mode_valid, - .get_edid = ti_sn_bridge_get_edid, + .edid_read = ti_sn_bridge_edid_read, .detect = ti_sn_bridge_detect, .atomic_pre_enable = ti_sn_bridge_atomic_pre_enable, .atomic_enable = ti_sn_bridge_atomic_enable, -- 2.39.2
[PATCH v2 39/39] drm/bridge: remove ->get_edid callback
There are no more users of the ->get_edid callback left. They've all been converted to ->edid_read. Remove the callback, and the fallback in drm_bridge_edid_read(). Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_bridge.c | 19 --- include/drm/drm_bridge.h | 30 -- 2 files changed, 49 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index a3065d4aa3d6..521a71c61b16 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1216,9 +1216,6 @@ EXPORT_SYMBOL_GPL(drm_bridge_get_modes); * DRM_BRIDGE_OP_EDID bridge ops flag, call &drm_bridge_funcs.edid_read to get * the EDID and return it. Otherwise return NULL. * - * If &drm_bridge_funcs.edid_read is not set, fall back to using - * &drm_bridge_funcs.get_edid and wrapping it in struct drm_edid. - * * RETURNS: * The retrieved EDID on success, or NULL otherwise. */ @@ -1228,22 +1225,6 @@ const struct drm_edid *drm_bridge_edid_read(struct drm_bridge *bridge, if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) return NULL; - /* Transitional: Fall back to ->get_edid. */ - if (!bridge->funcs->edid_read) { - const struct drm_edid *drm_edid; - struct edid *edid; - - edid = bridge->funcs->get_edid(bridge, connector); - if (!edid) - return NULL; - - drm_edid = drm_edid_alloc(edid, (edid->extensions + 1) * EDID_LENGTH); - - kfree(edid); - - return drm_edid; - } - return bridge->funcs->edid_read(bridge, connector); } EXPORT_SYMBOL_GPL(drm_bridge_edid_read); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index ee12f829aaf7..7293c02e17c5 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -588,36 +588,6 @@ struct drm_bridge_funcs { const struct drm_edid *(*edid_read)(struct drm_bridge *bridge, struct drm_connector *connector); - /** -* @get_edid: -* -* Read and parse the EDID data of the connected display. -* -* The @get_edid callback is the preferred way of reporting mode -* information for a display connected to the bridge output. Bridges -* that support reading EDID shall implement this callback and leave -* the @get_modes callback unimplemented. -* -* The caller of this operation shall first verify the output -* connection status and refrain from reading EDID from a disconnected -* output. -* -* This callback is optional. Bridges that implement it shall set the -* DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops. -* -* The connector parameter shall be used for the sole purpose of EDID -* retrieval and parsing, and shall not be stored internally by bridge -* drivers for future usage. -* -* RETURNS: -* -* An edid structure newly allocated with kmalloc() (or similar) on -* success, or NULL otherwise. The caller is responsible for freeing -* the returned edid structure with kfree(). -*/ - struct edid *(*get_edid)(struct drm_bridge *bridge, -struct drm_connector *connector); - /** * @hpd_notify: * -- 2.39.2
Re: [PATCH 0/2] drm/bridge: start moving towards struct drm_edid
On Fri, 22 Dec 2023, Jani Nikula wrote: > Okay, I rebased and pushed [1]. Probably doesn't make sense to send a > patch bomb like that right now... And here are the patches: https://patchwork.freedesktop.org/series/128149/ BR, Jani. > > BR, > Jani. > > > [1] https://gitlab.freedesktop.org/jani/linux/-/commits/drm-edid-bridge -- Jani Nikula, Intel
[PATCH 1/4] drm/hyperv: Remove firmware framebuffers with aperture helper
Replace use of screen_info state with the correct interface from the aperture helpers. The state is only for architecture and firmware code. It is not guaranteed to contain valid data. Drivers are thus not allowed to use it. For removing conflicting firmware framebuffers, there are aperture helpers. Hence replace screen_info with the correct function that will remove conflicting framebuffers for the hyperv-drm driver. Also move the call to the correct place within the driver. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index d511d17c5bdf..cff85086f2d6 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -73,11 +72,6 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv, struct drm_device *dev = &hv->dev; int ret; - if (IS_ENABLED(CONFIG_SYSFB)) - drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base, - screen_info.lfb_size, -&hyperv_driver); - hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024; ret = vmbus_allocate_mmio(&hv->mem, hdev, 0, -1, hv->fb_size, 0x10, @@ -130,6 +124,8 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, goto err_hv_set_drv_data; } + drm_aperture_remove_framebuffers(&hyperv_driver); + ret = hyperv_setup_vram(hv, hdev); if (ret) goto err_vmbus_close; -- 2.43.0
[PATCH 0/4] hyperv, sysfb: Do not use screen_info in drivers
The global screen_info state is only meant for architecture and firmware code. Replace its use in hyperv graphics drivers with the correct aperture helpers. Patches 1 and 2 update hyperv-drm and hyperv-fb to use the correct aperture helpers instead of screen_info for removing existing firmware framebuffers. Hyperv-fb also modifies screen_info for better use with kexec. While that update makes sense, it's not supposed to be done by the driver. Patch 3 adds similar code to sysfb and patch 4 removes the code from the driver. An intented side effect of this patchset is that all systems now benefit from better kexec support. After rebooting with kexec, the kernel operated on stale settings on screen_info. Patch 3 fixes this and the kexec kernel will use screen_info in any meaningful way. Thomas Zimmermann (4): drm/hyperv: Remove firmware framebuffers with aperture helper fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers firmware/sysfb: Clear screen_info state after consuming it fbdev/hyperv_fb: Do not clear global screen_info drivers/firmware/sysfb.c| 14 +- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 8 ++-- drivers/video/fbdev/hyperv_fb.c | 20 +++- 3 files changed, 22 insertions(+), 20 deletions(-) base-commit: 25232eb8a9ac7fa0dac7e846a4bf7fba2b6db39a -- 2.43.0
[PATCH 2/4] fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers
Replace use of screen_info state with the correct interfaces from the aperture helpers. The state is only for architecture and firmware code. It is not guaranteed to contain valid data. Drivers are thus not allowed to use it. For removing conflicting firmware framebuffers, there are aperture helpers. Hence replace screen_info with the correct functions that will remove conflicting framebuffers for the hypervfb driver. For GEN1 PCI devices, the driver reads the framebuffer base and size from the PCI BAR, and uses the range for removing the firmware framebuffer. For GEN2 VMBUS devices no range can be detected, so the driver clears all firmware framebuffers. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/hyperv_fb.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index a80939fe2ee6..76c956b9a321 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -975,7 +975,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) struct pci_dev *pdev = NULL; void __iomem *fb_virt; int gen2vm = efi_enabled(EFI_BOOT); - resource_size_t base, size; + resource_size_t base = 0; + resource_size_t size = 0; phys_addr_t paddr; int ret; @@ -1010,9 +1011,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; } pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n"); - } else if (IS_ENABLED(CONFIG_SYSFB)) { - base = screen_info.lfb_base; - size = screen_info.lfb_size; } else { goto err1; } @@ -1056,7 +1054,10 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) info->screen_size = dio_fb_size; getmem_done: - aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); + if (base && size) + aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); + else + aperture_remove_all_conflicting_devices(KBUILD_MODNAME); if (!gen2vm) { pci_dev_put(pdev); -- 2.43.0
[PATCH 3/4] firmware/sysfb: Clear screen_info state after consuming it
After consuming the global screen_info_state in sysfb_init(), the created platform device maintains the firmware framebuffer. Clear screen_info to avoid conflicting access. Subsequent kexec reboots now ignore the firmware framebuffer. Signed-off-by: Thomas Zimmermann --- drivers/firmware/sysfb.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c index 82fcfd29bc4d..19706bd2642a 100644 --- a/drivers/firmware/sysfb.c +++ b/drivers/firmware/sysfb.c @@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(sysfb_disable); static __init int sysfb_init(void) { - struct screen_info *si = &screen_info; + const struct screen_info *si = &screen_info; struct simplefb_platform_data mode; const char *name; bool compatible; @@ -119,6 +119,18 @@ static __init int sysfb_init(void) if (ret) goto err; + /* +* The firmware framebuffer is now maintained by the created +* device. Disable screen_info after we've consumed it. Prevents +* invalid access during kexec reboots. +* +* TODO: Vgacon still relies on the global screen_info. Make +* vgacon work with the platform device, so we can clear +* the screen_info unconditionally. +*/ + if (strcmp(name, "platform-framebuffer")) + screen_info.orig_video_isVGA = 0; + goto unlock_mutex; err: platform_device_put(pd); -- 2.43.0
[PATCH 4/4] fbdev/hyperv_fb: Do not clear global screen_info
Do not clear the global instance of screen_info. If necessary, clearing fields in screen_info should be done by architecture or firmware code that maintains the firmware framebuffer. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/hyperv_fb.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 76c956b9a321..7d5717805c0b 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -1059,14 +1058,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) else aperture_remove_all_conflicting_devices(KBUILD_MODNAME); - if (!gen2vm) { + if (!gen2vm) pci_dev_put(pdev); - } else if (IS_ENABLED(CONFIG_SYSFB)) { - /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ - screen_info.lfb_size = 0; - screen_info.lfb_base = 0; - screen_info.orig_video_isVGA = 0; - } return 0; -- 2.43.0
Re: [PATCH v2 02/39] drm/bridge: switch to drm_bridge_read_edid()
Hi Jani > drm/bridge: switch to drm_bridge_read_edid() Did you mean drm_bridge_edid_read(), here and in the other patches? (Personally, I'd prefer read_edid over edid_read. The former is common style and easier to read.) Best regards Thomas Am 03.01.24 um 11:08 schrieb Jani Nikula: Prefer using the struct drm_edid based functions. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_bridge_connector.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 3acd67021ec6..982552c9f92c 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -239,27 +239,27 @@ static int drm_bridge_connector_get_modes_edid(struct drm_connector *connector, struct drm_bridge *bridge) { enum drm_connector_status status; - struct edid *edid; + const struct drm_edid *drm_edid; int n; status = drm_bridge_connector_detect(connector, false); if (status != connector_status_connected) goto no_edid; - edid = drm_bridge_get_edid(bridge, connector); - if (!drm_edid_is_valid(edid)) { - kfree(edid); + drm_edid = drm_bridge_edid_read(bridge, connector); + if (!drm_edid_valid(drm_edid)) { + drm_edid_free(drm_edid); goto no_edid; } - drm_connector_update_edid_property(connector, edid); - n = drm_add_edid_modes(connector, edid); + drm_edid_connector_update(connector, drm_edid); + n = drm_edid_connector_add_modes(connector); - kfree(edid); + drm_edid_free(drm_edid); return n; no_edid: - drm_connector_update_edid_property(connector, NULL); + drm_edid_connector_update(connector, NULL); return 0; } -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) OpenPGP_signature.asc Description: OpenPGP digital signature
Re: [PATCH] drm/vmwgfx: Unmap the surface before resetting it on a plane state
Great catch! That was a nasty one. Reviewed-by: Martin Krastev Regards, Martin On Sun, Dec 24, 2023 at 7:29 AM Zack Rusin wrote: > Switch to a new plane state requires unreferencing of all held surfaces. > In the work required for mob cursors the mapped surfaces started being > cached but the variable indicating whether the surface is currently > mapped was not being reset. This leads to crashes as the duplicated > state, incorrectly, indicates the that surface is mapped even when > no surface is present. That's because after unreferencing the surface > it's perfectly possible for the plane to be backed by a bo instead of a > surface. > > Reset the surface mapped flag when unreferencing the plane state surface > to fix null derefs in cleanup. Fixes crashes in KDE KWin 6.0 on Wayland: > > Oops: [#1] PREEMPT SMP PTI > CPU: 4 PID: 2533 Comm: kwin_wayland Not tainted 6.7.0-rc3-vmwgfx #2 > Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop > Reference Platform, BIOS 6.00 11/12/2020 > RIP: 0010:vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > Code: 00 00 00 75 3a 48 83 c4 10 5b 5d c3 cc cc cc cc 48 8b b3 a8 00 00 00 > 48 c7 c7 99 90 43 c0 e8 93 c5 db ca 48 8b 83 a8 00 00 00 <48> 8b 78 28 e8 > e3 f> > RSP: 0018:b6b98216fa80 EFLAGS: 00010246 > RAX: RBX: 969d84cdcb00 RCX: 0027 > RDX: RSI: 0001 RDI: 969e75f21600 > RBP: 969d4143dc50 R08: R09: b6b98216f920 > R10: 0003 R11: 969e7feb3b10 R12: > R13: R14: 027b R15: 969d49c9fc00 > FS: 7f1e8f1b4180() GS:969e75f0() > knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 0028 CR3: 000104006004 CR4: 003706f0 > Call Trace: > > ? __die+0x23/0x70 > ? page_fault_oops+0x171/0x4e0 > ? exc_page_fault+0x7f/0x180 > ? asm_exc_page_fault+0x26/0x30 > ? vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > drm_atomic_helper_cleanup_planes+0x9b/0xc0 > commit_tail+0xd1/0x130 > drm_atomic_helper_commit+0x11a/0x140 > drm_atomic_commit+0x97/0xd0 > ? __pfx___drm_printfn_info+0x10/0x10 > drm_atomic_helper_update_plane+0xf5/0x160 > drm_mode_cursor_universal+0x10e/0x270 > drm_mode_cursor_common+0x102/0x230 > ? __pfx_drm_mode_cursor2_ioctl+0x10/0x10 > drm_ioctl_kernel+0xb2/0x110 > drm_ioctl+0x26d/0x4b0 > ? __pfx_drm_mode_cursor2_ioctl+0x10/0x10 > ? __pfx_drm_ioctl+0x10/0x10 > vmw_generic_ioctl+0xa4/0x110 [vmwgfx] > __x64_sys_ioctl+0x94/0xd0 > do_syscall_64+0x61/0xe0 > ? __x64_sys_ioctl+0xaf/0xd0 > ? syscall_exit_to_user_mode+0x2b/0x40 > ? do_syscall_64+0x70/0xe0 > ? __x64_sys_ioctl+0xaf/0xd0 > ? syscall_exit_to_user_mode+0x2b/0x40 > ? do_syscall_64+0x70/0xe0 > ? exc_page_fault+0x7f/0x180 > entry_SYSCALL_64_after_hwframe+0x6e/0x76 > RIP: 0033:0x7f1e93f279ed > Code: 04 25 28 00 00 00 48 89 45 c8 31 c0 48 8d 45 10 c7 45 b0 10 00 00 00 > 48 89 45 b8 48 8d 45 d0 48 89 45 c0 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 > ff f> > RSP: 002b:7ffca0faf600 EFLAGS: 0246 ORIG_RAX: 0010 > RAX: ffda RBX: 55db876ed2c0 RCX: 7f1e93f279ed > RDX: 7ffca0faf6c0 RSI: c02464bb RDI: 0015 > RBP: 7ffca0faf650 R08: 55db87184010 R09: 0007 > R10: 55db886471a0 R11: 0246 R12: 7ffca0faf6c0 > R13: c02464bb R14: 0015 R15: 7ffca0faf790 > > Modules linked in: snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns > nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib > nft_reject_ine> > CR2: 0028 > ---[ end trace ]--- > RIP: 0010:vmw_du_cursor_plane_cleanup_fb+0x124/0x140 [vmwgfx] > Code: 00 00 00 75 3a 48 83 c4 10 5b 5d c3 cc cc cc cc 48 8b b3 a8 00 00 00 > 48 c7 c7 99 90 43 c0 e8 93 c5 db ca 48 8b 83 a8 00 00 00 <48> 8b 78 28 e8 > e3 f> > RSP: 0018:b6b98216fa80 EFLAGS: 00010246 > RAX: RBX: 969d84cdcb00 RCX: 0027 > RDX: RSI: 0001 RDI: 969e75f21600 > RBP: 969d4143dc50 R08: R09: b6b98216f920 > R10: 0003 R11: 969e7feb3b10 R12: > R13: R14: 027b R15: 969d49c9fc00 > FS: 7f1e8f1b4180() GS:969e75f0() > knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 0028 CR3: 000104006004 CR4: 003706f0 > > Signed-off-by: Zack Rusin > Fixes: 485d98d472d5 ("drm/vmwgfx: Add support for CursorMob and > CursorBypass 4") > Reported-by: Stefan Hoffmeister > Closes: https://gitlab.freedesktop.org/drm/misc/-/issues/34 > Cc: Martin Krastev > Cc: Maaz Mombasawala > Cc: Ian Forbes > Cc: Broadcom internal kernel review list < > bcm-kernel-feedback-l...@broadcom.com> > Cc: dri-devel@lists.freedesktop.org > Cc: # v5.19+ > --- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 > 1 fi
RE: [PATCH 1/7] drm: Add eDP 1.5 early transport definition
> -Original Message- > From: Intel-gfx On Behalf Of Jouni > Högander > Sent: Monday, December 18, 2023 7:50 PM > To: intel-...@lists.freedesktop.org > Cc: dri-devel@lists.freedesktop.org > Subject: [PATCH 1/7] drm: Add eDP 1.5 early transport definition > > Add DP_PSR_ENABLE_SU_REGION_ET to enable panel early transport. > > Cc: dri-devel@lists.freedesktop.org > Reviewed-by: Mika Kahola > Signed-off-by: Jouni Högander > --- > include/drm/display/drm_dp.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h > index 3731828825bd..281afff6ee4e 100644 > --- a/include/drm/display/drm_dp.h > +++ b/include/drm/display/drm_dp.h > @@ -718,6 +718,7 @@ > # define DP_PSR_SU_REGION_SCANLINE_CAPTURE BIT(4) /* eDP 1.4a */ > # define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS BIT(5) /* eDP 1.4a */ > # define DP_PSR_ENABLE_PSR2 BIT(6) /* eDP 1.4a */ > +# define DP_PSR_ENABLE_SU_REGION_ET BIT(7) /* eDP 1.5 */ > > #define DP_ADAPTER_CTRL 0x1a0 > # define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) > -- > 2.34.1
[PULL] drm-misc-fixes
Hi Dave, Daniel, Happy new year! ~Maarten drm-misc-fixes-2024-01-03: drm-misc-fixes for v6.7 final: - 2 small qaic fixes. - Fixes for overflow in aux xfer. - Fix uninitialised gamma lut in gmag200. - Small compiler warning fix for backports of a ps8640 fix. The following changes since commit 6c9dbee84cd005bed5f9d07b3a2797ae6414b435: drm/panel: ltk050h3146w: Set burst mode for ltk050h3148w (2023-12-13 18:33:43 +0100) are available in the Git repository at: git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2024-01-03 for you to fetch changes up to 11f9eb899ecc8c02b769cf8d2532ba12786a7af7: drm/mgag200: Fix gamma lut not initialized for G200ER, G200EV, G200SE (2023-12-20 13:26:57 +0100) drm-misc-fixes for v6.7 final: - 2 small qaic fixes. - Fixes for overflow in aux xfer. - Fix uninitialised gamma lut in gmag200. - Small compiler warning fix for backports of a ps8640 fix. Douglas Anderson (3): drm/bridge: parade-ps8640: Never store more than msg->size bytes in AUX xfer drm/bridge: ti-sn65dsi86: Never store more than msg->size bytes in AUX xfer drm/bridge: ps8640: Fix size mismatch warning w/ len Jeffrey Hugo (1): accel/qaic: Implement quirk for SOC_HW_VERSION Jocelyn Falempe (1): drm/mgag200: Fix gamma lut not initialized for G200ER, G200EV, G200SE Pranjal Ramajor Asha Kanojiya (1): accel/qaic: Fix GEM import path code drivers/accel/qaic/mhi_controller.c | 15 ++- drivers/accel/qaic/qaic_data.c | 6 ++ drivers/gpu/drm/bridge/parade-ps8640.c | 7 --- drivers/gpu/drm/bridge/ti-sn65dsi86.c| 4 +++- drivers/gpu/drm/mgag200/mgag200_drv.h| 5 + drivers/gpu/drm/mgag200/mgag200_g200er.c | 5 + drivers/gpu/drm/mgag200/mgag200_g200ev.c | 5 + drivers/gpu/drm/mgag200/mgag200_g200se.c | 5 + drivers/gpu/drm/mgag200/mgag200_mode.c | 10 +- 9 files changed, 48 insertions(+), 14 deletions(-)
Re: [PATCH v2 02/39] drm/bridge: switch to drm_bridge_read_edid()
On Wed, 03 Jan 2024, Thomas Zimmermann wrote: > Hi Jani > > > drm/bridge: switch to drm_bridge_read_edid() > > Did you mean drm_bridge_edid_read(), here and in the other patches? Ah, yeah, I did. > (Personally, I'd prefer read_edid over edid_read. The former is common > style and easier to read.) The name comes from drm_edid_read() family of functions, which are so named because they reside in drm_edid.[ch]. BR, Jani. > > Best regards > Thomas > > Am 03.01.24 um 11:08 schrieb Jani Nikula: >> Prefer using the struct drm_edid based functions. >> >> Signed-off-by: Jani Nikula >> --- >> drivers/gpu/drm/drm_bridge_connector.c | 16 >> 1 file changed, 8 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_bridge_connector.c >> b/drivers/gpu/drm/drm_bridge_connector.c >> index 3acd67021ec6..982552c9f92c 100644 >> --- a/drivers/gpu/drm/drm_bridge_connector.c >> +++ b/drivers/gpu/drm/drm_bridge_connector.c >> @@ -239,27 +239,27 @@ static int drm_bridge_connector_get_modes_edid(struct >> drm_connector *connector, >> struct drm_bridge *bridge) >> { >> enum drm_connector_status status; >> -struct edid *edid; >> +const struct drm_edid *drm_edid; >> int n; >> >> status = drm_bridge_connector_detect(connector, false); >> if (status != connector_status_connected) >> goto no_edid; >> >> -edid = drm_bridge_get_edid(bridge, connector); >> -if (!drm_edid_is_valid(edid)) { >> -kfree(edid); >> +drm_edid = drm_bridge_edid_read(bridge, connector); >> +if (!drm_edid_valid(drm_edid)) { >> +drm_edid_free(drm_edid); >> goto no_edid; >> } >> >> -drm_connector_update_edid_property(connector, edid); >> -n = drm_add_edid_modes(connector, edid); >> +drm_edid_connector_update(connector, drm_edid); >> +n = drm_edid_connector_add_modes(connector); >> >> -kfree(edid); >> +drm_edid_free(drm_edid); >> return n; >> >> no_edid: >> -drm_connector_update_edid_property(connector, NULL); >> +drm_edid_connector_update(connector, NULL); >> return 0; >> } >> -- Jani Nikula, Intel
[PATCH] drm/xe: circumvent bogus stringop-overflow warning
From: Arnd Bergmann gcc-13 warns about an array overflow that it sees but that is prevented by the "asid % NUM_PF_QUEUE" calculation: drivers/gpu/drm/xe/xe_gt_pagefault.c: In function 'xe_guc_pagefault_handler': include/linux/fortify-string.h:57:33: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=] include/linux/fortify-string.h:689:26: note: in expansion of macro '__fortify_memcpy_chk' 689 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \ | ^~~~ drivers/gpu/drm/xe/xe_gt_pagefault.c:341:17: note: in expansion of macro 'memcpy' 341 | memcpy(pf_queue->data + pf_queue->tail, msg, len * sizeof(u32)); | ^~ drivers/gpu/drm/xe/xe_gt_types.h:102:25: note: at offset [1144, 265324] into destination object 'tile' of size 8 I found that rewriting the assignment using pointer addition rather than the equivalent array index calculation prevents the warning, so use that instead. I sent a bug report against gcc for the false positive warning. Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113214 Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c index 59a70d2e0a7a..78dc08cc2bfe 100644 --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c @@ -332,7 +332,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len) return -EPROTO; asid = FIELD_GET(PFD_ASID, msg[1]); - pf_queue = >->usm.pf_queue[asid % NUM_PF_QUEUE]; + pf_queue = gt->usm.pf_queue + (asid % NUM_PF_QUEUE); spin_lock_irqsave(&pf_queue->lock, flags); full = pf_queue_full(pf_queue); -- 2.39.2
[PATCH] fbdev/sis: Remove dependency on screen_info
When built-in, the sis driver tries to detect the current display mode from the global screen_info state. That state is only for architecture and firmware code. Drivers should not use it directly as it's not guaranteed to contain valid information. Remove the mode-detection code from sis. Drivers that want to detect a pre-set mode on probe should read the hardware registers directly. Signed-off-by: Thomas Zimmermann --- drivers/video/fbdev/sis/sis_main.c | 37 -- 1 file changed, 37 deletions(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 6ad47b6b6004..803ccb6aa479 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -257,36 +256,6 @@ static void sisfb_search_mode(char *name, bool quiet) printk(KERN_ERR "sisfb: Invalid mode '%s'\n", nameptr); } -#ifndef MODULE -static void sisfb_get_vga_mode_from_kernel(void) -{ -#ifdef CONFIG_X86 - char mymode[32]; - int mydepth = screen_info.lfb_depth; - - if(screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) return; - - if( (screen_info.lfb_width >= 320) && (screen_info.lfb_width <= 2048) && - (screen_info.lfb_height >= 200) && (screen_info.lfb_height <= 1536) && - (mydepth >= 8) && (mydepth <= 32) ) { - - if(mydepth == 24) mydepth = 32; - - sprintf(mymode, "%ux%ux%u", screen_info.lfb_width, - screen_info.lfb_height, - mydepth); - - printk(KERN_DEBUG - "sisfb: Using vga mode %s pre-set by kernel as default\n", - mymode); - - sisfb_search_mode(mymode, true); - } -#endif - return; -} -#endif - static void __init sisfb_search_crt2type(const char *name) { @@ -5901,12 +5870,6 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ivideo->subsysvendor = pdev->subsystem_vendor; ivideo->subsysdevice = pdev->subsystem_device; -#ifndef MODULE - if(sisfb_mode_idx == -1) { - sisfb_get_vga_mode_from_kernel(); - } -#endif - ivideo->chip = chipinfo->chip; ivideo->chip_real_id = chipinfo->chip; ivideo->sisvga_engine = chipinfo->vgaengine; base-commit: 25232eb8a9ac7fa0dac7e846a4bf7fba2b6db39a -- 2.43.0
Re: [PATCH v4 6/6] x86/vmware: Add TDX hypercall support
On Thu, Dec 28, 2023 at 11:24:21AM -0800, Alexey Makhalov wrote: > From: Alexey Makhalov > > VMware hypercalls use I/O port, VMCALL or VMMCALL instructions. > Add __tdx_hypercall path to support TDX guests. > > No change in high bandwidth hypercalls, as only low bandwidth > ones are supported for TDX guests. > > Co-developed-by: Tim Merrifield > Signed-off-by: Tim Merrifield > Signed-off-by: Alexey Makhalov > Reviewed-by: Nadav Amit Acked-by: Kirill A. Shutemov -- Kiryl Shutsemau / Kirill A. Shutemov
AD107M (197), black screen
Hi all, i am testing current mainline (6.7.rc8), on a lenovo legion, with AD107M (chipset 197000a1). Looks like somewhere at driver probe, screen turns black and stays forever. If any hint, welcome. I can help debugging, rebuilding and testing in case. Regards, Angelo Dureghello
Re: [PATCH -next] drm/xe: Remove unneeded semicolon
Hi, Yang, On Wed, 2024-01-03 at 09:15 +0800, Yang Li wrote: > ./drivers/gpu/drm/xe/xe_rtp.c:168:2-3: Unneeded semicolon > Could you please reformulate using imperative "Remove..." rather than citing a style alert? With that, Reviewed-by: Thomas Hellström > Signed-off-by: Yang Li > --- > drivers/gpu/drm/xe/xe_rtp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xe/xe_rtp.c > b/drivers/gpu/drm/xe/xe_rtp.c > index fb44cc7521d8..316ed2f6d1f0 100644 > --- a/drivers/gpu/drm/xe/xe_rtp.c > +++ b/drivers/gpu/drm/xe/xe_rtp.c > @@ -165,7 +165,7 @@ static void rtp_get_context(struct > xe_rtp_process_ctx *ctx, > *gt = (*hwe)->gt; > *xe = gt_to_xe(*gt); > break; > - }; > + } > } > > /**
Re: [PATCH v3 4/4] arm64: dts: rockchip: Add devicetree for Pine64 PineTab2
On Tue, Jan 02, 2024 at 07:07:56PM +0100, Ondřej Jirman wrote: > Hello Manuel, Hello Ondřej, > On Tue, Jan 02, 2024 at 05:15:47PM +0100, Manuel Traut wrote: > > From: Alexander Warnecke > > > > [...] > > > > + > > + backlight: backlight { > > + compatible = "pwm-backlight"; > > + pwms = <&pwm4 0 25000 0>; > > + brightness-levels = <20 220>; > > + num-interpolated-steps = <200>; > > Does this linear brightness -> PWM duty cycle mapping lead to linear > relationship between brighntess level and subjective brightness on this HW? > > I doubt it a bit... I tested it with the brightness slider in phosh, for me it looks good. > > + > > + hdmi-con { > > hdmi-connector ack, changed for v4 > > + compatible = "hdmi-connector"; > > + type = "d"; > > + > > + port { > > + hdmi_con_in: endpoint { > > + remote-endpoint = <&hdmi_out_con>; > > + }; > > + }; > > + }; > > + > > + leds { > > + compatible = "gpio-leds"; > > + > > Spurious newline ^ ack, changed for v4 > > + vcc_3v3: vcc-3v3 { > > Regulator node names shoule end with -regulator suffix. The same applies for > all of the below nodes. ack, changed for v4 > > + compatible = "regulator-fixed"; > > + regulator-name = "vcc_3v3"; > > + regulator-always-on; > > + regulator-boot-on; > > + regulator-min-microvolt = <330>; > > + regulator-max-microvolt = <330>; > > + vin-supply = <&vcc3v3_sys>; > > + }; > > + > > + vdd1v2_dvp: vdd1v2-dvp { > > + compatible = "regulator-fixed"; > > + regulator-name = "vdd1v2_dvp"; > > + regulator-min-microvolt = <120>; > > + regulator-max-microvolt = <120>; > > + vin-supply = <&vcc_3v3>; > > + /*enable-supply = <&vcc2v8_dvp>;*/ > > There's no such property. Delete this commented out line. ack, changed for v4 > > + lcd: panel@0 { > > + compatible = "boe,th101mb31ig002-28a"; > > + reg = <0>; > > + backlight = <&backlight>; > > + enable-gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>; > > + pinctrl-names = "default"; > > + pinctrl-0 = <&lcd_pwren_h &lcd0_rst_l>; > > Re lcd0_rst_l: > > It's a bit weird conceptually to reference from dtsi something that's only > declared in dts that includes the dtsi. Maybe move pinctrl-* properties > to dts &lcd, too... Will be better I guess, changed for v4. > > + vcc5v_midu: BOOST { > > + regulator-always-on; > > + regulator-boot-on; > > + regulator-min-microvolt = <500>; > > + regulator-max-microvolt = <500>; > > + regulator-name = "boost"; > > + regulator-state-mem { > > + regulator-off-in-suspend; > > I guess this prevents remote USB wakeup by USB devices. Like wakeup via USB > keyboard. Probably not a bad thing, though. That is true. After 'echo mem > /sys/power/state' It is not possible to wakeup the device with a USB Keyboard or mouse. However if the surface like keyboard is used that is shipped with the device, wakeup works if the keyboard/tablet gets unfold. For me this behaviour is fine. Other opinions? > > +&pcie2x1 { > > + pinctrl-names = "default"; > > + pinctrl-0 = <&pcie_reset_h>; > > + reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>; > > + vpcie3v3-supply = <&vcc3v3_minipcie>; > > + status = "okay"; > > +}; > > Does it make sense to enable this HW block by default, when it isn't used on > actual HW? There is a flat ribbon connector, if someone wants to build sth. it might be helpful. However I am also fine with removing it for now. > > +&pinctrl { > > + bt { > > + bt_wake_host_h: bt-wake-host-h { > > + rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>; > > + }; > > + }; > > ^^^ unused I do not bother to removing unused pinctrls, however even if there is no user at the moment, if we look at a dtb as a machine parseable device description it is probably ok, that it is there? > > + > > + camerab { > > + camerab_pdn_l: camerab-pdn-l { > > + rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>; > > + }; > > + > > + camerab_rst_l: camerab-rst-l { > > + rockchip,pins = <4 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; > > + }; > > + }; > > + > > + cameraf { > > + cameraf_pdn_l: cameraf-pdn-l { > > + rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; > > + }; > > + > > + cameraf_rst_l: cameraf-rst-l { > > + rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; > > + }; > > + }; > >
[PATCH 0/2] drm/bridge: sii902x: Crash fixes
Two small fixes to sii902x for crashes. Signed-off-by: Tomi Valkeinen --- Tomi Valkeinen (2): drm/bridge: sii902x: Fix probing race issue drm/bridge: sii902x: Fix audio codec unregistration drivers/gpu/drm/bridge/sii902x.c | 42 +++- 1 file changed, 29 insertions(+), 13 deletions(-) --- base-commit: 0c75d52190b8bfa22cdb66e07148aea599c4535d change-id: 20240103-si902x-fixes-468d7153b8ee Best regards, -- Tomi Valkeinen
[PATCH 1/2] drm/bridge: sii902x: Fix probing race issue
A null pointer dereference crash has been observed rarely on TI platforms using sii9022 bridge: [ 53.271356] sii902x_get_edid+0x34/0x70 [sii902x] [ 53.276066] sii902x_bridge_get_edid+0x14/0x20 [sii902x] [ 53.281381] drm_bridge_get_edid+0x20/0x34 [drm] [ 53.286305] drm_bridge_connector_get_modes+0x8c/0xcc [drm_kms_helper] [ 53.292955] drm_helper_probe_single_connector_modes+0x190/0x538 [drm_kms_helper] [ 53.300510] drm_client_modeset_probe+0x1f0/0xbd4 [drm] [ 53.305958] __drm_fb_helper_initial_config_and_unlock+0x50/0x510 [drm_kms_helper] [ 53.313611] drm_fb_helper_initial_config+0x48/0x58 [drm_kms_helper] [ 53.320039] drm_fbdev_dma_client_hotplug+0x84/0xd4 [drm_dma_helper] [ 53.326401] drm_client_register+0x5c/0xa0 [drm] [ 53.331216] drm_fbdev_dma_setup+0xc8/0x13c [drm_dma_helper] [ 53.336881] tidss_probe+0x128/0x264 [tidss] [ 53.341174] platform_probe+0x68/0xc4 [ 53.344841] really_probe+0x188/0x3c4 [ 53.348501] __driver_probe_device+0x7c/0x16c [ 53.352854] driver_probe_device+0x3c/0x10c [ 53.357033] __device_attach_driver+0xbc/0x158 [ 53.361472] bus_for_each_drv+0x88/0xe8 [ 53.365303] __device_attach+0xa0/0x1b4 [ 53.369135] device_initial_probe+0x14/0x20 [ 53.373314] bus_probe_device+0xb0/0xb4 [ 53.377145] deferred_probe_work_func+0xcc/0x124 [ 53.381757] process_one_work+0x1f0/0x518 [ 53.385770] worker_thread+0x1e8/0x3dc [ 53.389519] kthread+0x11c/0x120 [ 53.392750] ret_from_fork+0x10/0x20 The issue here is as follows: - tidss probes, but is deferred as sii902x is still missing. - sii902x starts probing and enters sii902x_init(). - sii902x calls drm_bridge_add(). Now the sii902x bridge is ready from DRM's perspective. - sii902x calls sii902x_audio_codec_init() and platform_device_register_data() - The registration of the audio platform device causes probing of the deferred devices. - tidss probes, which eventually causes sii902x_bridge_get_edid() to be called. - sii902x_bridge_get_edid() tries to use the i2c to read the edid. However, the sii902x driver has not set up the i2c part yet, leading to the crash. Fix this by moving the drm_bridge_add() to the end of the sii902x_init(), which is also at the very end of sii902x_probe(). Signed-off-by: Tomi Valkeinen Fixes: 21d808405fe4 ("drm/bridge/sii902x: Fix EDID readback") --- drivers/gpu/drm/bridge/sii902x.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 2bdc5b439beb..69da73e414a9 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -1080,16 +1080,6 @@ static int sii902x_init(struct sii902x *sii902x) return ret; } - sii902x->bridge.funcs = &sii902x_bridge_funcs; - sii902x->bridge.of_node = dev->of_node; - sii902x->bridge.timings = &default_sii902x_timings; - sii902x->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; - - if (sii902x->i2c->irq > 0) - sii902x->bridge.ops |= DRM_BRIDGE_OP_HPD; - - drm_bridge_add(&sii902x->bridge); - sii902x_audio_codec_init(sii902x, dev); i2c_set_clientdata(sii902x->i2c, sii902x); @@ -1102,7 +1092,21 @@ static int sii902x_init(struct sii902x *sii902x) return -ENOMEM; sii902x->i2cmux->priv = sii902x; - return i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0); + ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0); + if (ret) + return ret; + + sii902x->bridge.funcs = &sii902x_bridge_funcs; + sii902x->bridge.of_node = dev->of_node; + sii902x->bridge.timings = &default_sii902x_timings; + sii902x->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; + + if (sii902x->i2c->irq > 0) + sii902x->bridge.ops |= DRM_BRIDGE_OP_HPD; + + drm_bridge_add(&sii902x->bridge); + + return 0; } static int sii902x_probe(struct i2c_client *client) @@ -1170,12 +1174,11 @@ static int sii902x_probe(struct i2c_client *client) } static void sii902x_remove(struct i2c_client *client) - { struct sii902x *sii902x = i2c_get_clientdata(client); - i2c_mux_del_adapters(sii902x->i2cmux); drm_bridge_remove(&sii902x->bridge); + i2c_mux_del_adapters(sii902x->i2cmux); } static const struct of_device_id sii902x_dt_ids[] = { -- 2.34.1
[PATCH 2/2] drm/bridge: sii902x: Fix audio codec unregistration
The driver never unregisters the audio codec platform device, which can lead to a crash on module reloading, nor does it handle the return value from sii902x_audio_codec_init(). Signed-off-by: Tomi Valkeinen Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support") Cc: Jyri Sarha --- drivers/gpu/drm/bridge/sii902x.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 69da73e414a9..4560ae9cbce1 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -1080,7 +1080,9 @@ static int sii902x_init(struct sii902x *sii902x) return ret; } - sii902x_audio_codec_init(sii902x, dev); + ret = sii902x_audio_codec_init(sii902x, dev); + if (ret) + return ret; i2c_set_clientdata(sii902x->i2c, sii902x); @@ -1088,13 +1090,15 @@ static int sii902x_init(struct sii902x *sii902x) 1, 0, I2C_MUX_GATE, sii902x_i2c_bypass_select, sii902x_i2c_bypass_deselect); - if (!sii902x->i2cmux) - return -ENOMEM; + if (!sii902x->i2cmux) { + ret = -ENOMEM; + goto err_unreg_audio; + } sii902x->i2cmux->priv = sii902x; ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0); if (ret) - return ret; + goto err_unreg_audio; sii902x->bridge.funcs = &sii902x_bridge_funcs; sii902x->bridge.of_node = dev->of_node; @@ -1107,6 +,12 @@ static int sii902x_init(struct sii902x *sii902x) drm_bridge_add(&sii902x->bridge); return 0; + +err_unreg_audio: + if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev)) + platform_device_unregister(sii902x->audio.pdev); + + return ret; } static int sii902x_probe(struct i2c_client *client) @@ -1179,6 +1189,9 @@ static void sii902x_remove(struct i2c_client *client) drm_bridge_remove(&sii902x->bridge); i2c_mux_del_adapters(sii902x->i2cmux); + + if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev)) + platform_device_unregister(sii902x->audio.pdev); } static const struct of_device_id sii902x_dt_ids[] = { -- 2.34.1
AD107M (197), black screen
Hi all, i am testing current mainline (6.7.rc8), on a lenovo legion, with AD107M (chipset 197000a1). Looks like somewhere at driver probe, screen turns black and stays forever. If any hint, welcome. I can help debugging, rebuilding and testing in case. Regards, Angelo Dureghello
Re: [PATCH v3 4/4] arm64: dts: rockchip: Add devicetree for Pine64 PineTab2
Hi Jonas and Ondřej, > >> +&sfc { > >> + pinctrl-names = "default"; > >> + pinctrl-0 = <&fspi_dual_io_pins>; > >> + status = "okay"; > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + > >> + flash@0 { > >> + compatible = "jedec,spi-nor"; > >> + reg = <0>; > >> + spi-max-frequency = <2400>; > > > > That's a bit on the low side. The flash chip should work for all commands > > up to > > 80MHz https://megous.com/dl/tmp/b428ad9b85ac4633.png and SGM3157YC6 switch > > for the FSPI-CLK should have high enough bandwidth, too. > > I agree that this is a little bit on the low side, it was a safe rate > that I used for U-Boot. U-Boot required an exact rate of the supported > sfc clk rates: 24, 50, 75, 100, 125 or 150 MHz. > > Please also note that the SPI NOR flash chip used in PineTab2 is not a > GigaDevice GD25LQ128E, it should be a SiliconKaiser SK25LP128, same as > found in the Pine64 PinePhone Pro. The schematics for v2.0 reference a GD25LQ128EWIGR. I never checked the jedec id. How did you retrieve this information, or is it maybe a difference in v0.1 and 2.0? > >> + spi-rx-bus-width = <2>; > > > > GD25LQ128E supports quad I/O. Maybe try 4 if it will work. > > The schematic only shows fspi D0 and D1 connected, and use the D2 line > for eMMC_RSTn, so spi-rx-bus-width = <2> should be correct. ack Since it is only needed for bootloader updates and environment its maybe better to stay on the safe side? But I can test faster frequency if you want me to do.. Regards Manuel
Re: [PATCH v9 09/25] drm/modes: Move named modes parsing to a separate function
Hi Dave, Happy new year :) On Tue, Jan 02, 2024 at 03:12:26PM +, Dave Stevenson wrote: > Hi Maxime > > On Mon, 14 Nov 2022 at 13:00, Maxime Ripard wrote: > > > > The current construction of the named mode parsing doesn't allow to extend > > it easily. Let's move it to a separate function so we can add more > > parameters and modes. > > > > In order for the tests to still pass, some extra checks are needed, so > > it's not a 1:1 move. > > > > Reviewed-by: Noralf Trønnes > > Tested-by: Mateusz Kwiatkowski > > Signed-off-by: Maxime Ripard > > > > --- > > Changes in v7: > > - Add Noralf Reviewed-by > > > > Changes in v6: > > - Simplify the test for connection status extras > > - Simplify the code path to call drm_mode_parse_cmdline_named_mode > > > > Changes in v4: > > - Fold down all the named mode patches that were split into a single > > patch again to maintain bisectability > > --- > > drivers/gpu/drm/drm_modes.c | 70 > > + > > 1 file changed, 58 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > > index 71c050c3ee6b..37542612912b 100644 > > --- a/drivers/gpu/drm/drm_modes.c > > +++ b/drivers/gpu/drm/drm_modes.c > > @@ -2229,6 +2229,51 @@ static const char * const > > drm_named_modes_whitelist[] = { > > "PAL", > > }; > > > > +static int drm_mode_parse_cmdline_named_mode(const char *name, > > +unsigned int name_end, > > +struct drm_cmdline_mode > > *cmdline_mode) > > +{ > > + unsigned int i; > > + > > + if (!name_end) > > + return 0; > > + > > + /* If the name starts with a digit, it's not a named mode */ > > + if (isdigit(name[0])) > > + return 0; > > + > > + /* > > +* If there's an equal sign in the name, the command-line > > +* contains only an option and no mode. > > +*/ > > + if (strnchr(name, name_end, '=')) > > + return 0; > > + > > + /* The connection status extras can be set without a mode. */ > > + if (name_end == 1 && > > + (name[0] == 'd' || name[0] == 'D' || name[0] == 'e')) > > + return 0; > > + > > + /* > > +* We're sure we're a named mode at this point, iterate over the > > +* list of modes we're aware of. > > +*/ > > + for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > + int ret; > > + > > + ret = str_has_prefix(name, drm_named_modes_whitelist[i]); > > + if (ret != name_end) > > + continue; > > + > > + strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); > > + cmdline_mode->specified = true; > > + > > + return 1; > > + } > > + > > + return -EINVAL; > > +} > > + > > /** > > * drm_mode_parse_command_line_for_connector - parse command line modeline > > for connector > > * @mode_option: optional per connector mode option > > @@ -2265,7 +2310,7 @@ bool drm_mode_parse_command_line_for_connector(const > > char *mode_option, > > const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; > > const char *options_ptr = NULL; > > char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; > > - int i, len, ret; > > + int len, ret; > > > > memset(mode, 0, sizeof(*mode)); > > mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; > > @@ -2306,18 +2351,19 @@ bool > > drm_mode_parse_command_line_for_connector(const char *mode_option, > > parse_extras = true; > > } > > > > - /* First check for a named mode */ > > - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); > > - if (ret == mode_end) { > > - if (refresh_ptr) > > - return false; /* named + refresh is invalid > > */ > > + if (!mode_end) > > + return false; > > I'm chasing down a change in behaviour between 6.1 and 6.6, and this > patch seems to be at least part of the cause. > > Since [1] we've had the emulated framebuffer on Pi being 16bpp to save > memory. All good. > > It used to be possible to use "video=HDMI-A-1:-32" on the kernel > command line to set it back to 32bpp. > > After this patch that is no longer possible. "mode_end = bpp_off", and > "bpp_off = bpp_ptr - name", so with bpp_ptr = name we get mode_end > being 0. That fails this conditional. > drm_mode_parse_cmdline_named_mode already aborts early but with no > error if name_end / mode_end is 0, so this "if" clause seems > redundant, and is a change in behaviour. > > We do then get a second parsing failure due to the check if (bpp_ptr > || refresh_ptr) at [2]. > Prior to this patch my vi
Re: [PATCH] nightly.conf: Add the xe repo to drm-tip
On Tue, 2023-12-26 at 13:30 -0500, Rodrigo Vivi wrote: > On Fri, Dec 22, 2023 at 12:36:39PM +0100, Thomas Hellström wrote: > > Add the xe repo to drm-tip and the dim tools. > > For now use the sha1 of the first drm-xe-next pull request for drm- > > tip, > > since that branch tip is currently adapted for our CI testing. > > > > Cc: Rodrigo Vivi > > Cc: Lucas De Marchi > > Cc: Oded Gabbay > > Cc: daniel.vet...@ffwll.ch > > Cc: Maarten Lankhorst > > Cc: dim-to...@lists.freedesktop.org > > Cc: dri-devel@lists.freedesktop.org > > Cc: intel-...@lists.freedesktop.org > > Signed-off-by: Thomas Hellström > > --- > > nightly.conf | 7 +++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/nightly.conf b/nightly.conf > > index 24126b61b797..accd3ff2cc39 100644 > > --- a/nightly.conf > > +++ b/nightly.conf > > @@ -24,6 +24,10 @@ git://anongit.freedesktop.org/drm-tip > > https://anongit.freedesktop.org/git/drm/drm-tip > > https://anongit.freedesktop.org/git/drm/drm-tip.git > > " > > +drm_tip_repos[drm-xe]=" > > +ssh://g...@gitlab.freedesktop.org/drm/xe/kernel.git > > +https://gitlab.freedesktop.org/drm/xe/kernel.git > > +" > > drm_tip_repos[drm-intel]=" > > ssh://git.freedesktop.org/git/drm/drm-intel > > ssh://git.freedesktop.org/git/drm-intel > > @@ -65,14 +69,17 @@ drm_tip_config=( > > "drmdrm-fixes" > > "drm-misc drm-misc-fixes" > > "drm-intel drm-intel-fixes" > > + "drm-xe drm-xe-fixes" > > > > "drmdrm-next" > > "drm-misc drm-misc-next-fixes" > > "drm-intel drm-intel-next-fixes" > > + "drm-xe drm-xe-next-fixes" > > > > "drm-misc drm-misc-next" > > "drm-intel drm-intel-next" > > "drm-intel drm-intel-gt-next" > > + "drm-xe drm-xe-next b6e1b7081768" > > yeap, up to this commit nothing else should change, but > then we will need an extra rebase of the rest on top of drm/drm-next. > > But then we need to decide where these following patches will live: > 880277f31cc69 drm/xe/guc: define LNL FW > 2cfc5ae1b8267 drm/xe/guc: define PVC FW > 52383b58eb8cf mei/hdcp: Also enable for XE > bea27d7369855 mei: gsc: add support for auxiliary device created by > Xe driver > fcb3410197f05 fault-inject: Include linux/types.h by default. > 8ebd9cd71f8ac drm/xe: Add PVC's PCI device IDs > > > Will it be the topic/core-for-CI? > or topic/xe-extras? > or what? This sounds to me like topic/core-for-CI? Or is there any drawback with that? > > Anyway, for the inclusion like this, after our CI is ready: Could we merge this patch already at this point, considering it will, at least for now, only update drm-tip with our fixes? Thanks, /Thomas > > Acked-by: Rodrigo Vivi > > > > > "drm-intel topic/core-for-CI" > > "drm-misc topic/i915-ttm" > > -- > > 2.42.0 > >
Re: [PATCH v9 09/25] drm/modes: Move named modes parsing to a separate function
Hi Maxime On Wed, 3 Jan 2024 at 13:33, Maxime Ripard wrote: > > Hi Dave, > > Happy new year :) And to you. > On Tue, Jan 02, 2024 at 03:12:26PM +, Dave Stevenson wrote: > > Hi Maxime > > > > On Mon, 14 Nov 2022 at 13:00, Maxime Ripard wrote: > > > > > > The current construction of the named mode parsing doesn't allow to extend > > > it easily. Let's move it to a separate function so we can add more > > > parameters and modes. > > > > > > In order for the tests to still pass, some extra checks are needed, so > > > it's not a 1:1 move. > > > > > > Reviewed-by: Noralf Trønnes > > > Tested-by: Mateusz Kwiatkowski > > > Signed-off-by: Maxime Ripard > > > > > > --- > > > Changes in v7: > > > - Add Noralf Reviewed-by > > > > > > Changes in v6: > > > - Simplify the test for connection status extras > > > - Simplify the code path to call drm_mode_parse_cmdline_named_mode > > > > > > Changes in v4: > > > - Fold down all the named mode patches that were split into a single > > > patch again to maintain bisectability > > > --- > > > drivers/gpu/drm/drm_modes.c | 70 > > > + > > > 1 file changed, 58 insertions(+), 12 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > > > index 71c050c3ee6b..37542612912b 100644 > > > --- a/drivers/gpu/drm/drm_modes.c > > > +++ b/drivers/gpu/drm/drm_modes.c > > > @@ -2229,6 +2229,51 @@ static const char * const > > > drm_named_modes_whitelist[] = { > > > "PAL", > > > }; > > > > > > +static int drm_mode_parse_cmdline_named_mode(const char *name, > > > +unsigned int name_end, > > > +struct drm_cmdline_mode > > > *cmdline_mode) > > > +{ > > > + unsigned int i; > > > + > > > + if (!name_end) > > > + return 0; > > > + > > > + /* If the name starts with a digit, it's not a named mode */ > > > + if (isdigit(name[0])) > > > + return 0; > > > + > > > + /* > > > +* If there's an equal sign in the name, the command-line > > > +* contains only an option and no mode. > > > +*/ > > > + if (strnchr(name, name_end, '=')) > > > + return 0; > > > + > > > + /* The connection status extras can be set without a mode. */ > > > + if (name_end == 1 && > > > + (name[0] == 'd' || name[0] == 'D' || name[0] == 'e')) > > > + return 0; > > > + > > > + /* > > > +* We're sure we're a named mode at this point, iterate over the > > > +* list of modes we're aware of. > > > +*/ > > > + for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > > + int ret; > > > + > > > + ret = str_has_prefix(name, drm_named_modes_whitelist[i]); > > > + if (ret != name_end) > > > + continue; > > > + > > > + strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); > > > + cmdline_mode->specified = true; > > > + > > > + return 1; > > > + } > > > + > > > + return -EINVAL; > > > +} > > > + > > > /** > > > * drm_mode_parse_command_line_for_connector - parse command line > > > modeline for connector > > > * @mode_option: optional per connector mode option > > > @@ -2265,7 +2310,7 @@ bool > > > drm_mode_parse_command_line_for_connector(const char *mode_option, > > > const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = > > > NULL; > > > const char *options_ptr = NULL; > > > char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; > > > - int i, len, ret; > > > + int len, ret; > > > > > > memset(mode, 0, sizeof(*mode)); > > > mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; > > > @@ -2306,18 +2351,19 @@ bool > > > drm_mode_parse_command_line_for_connector(const char *mode_option, > > > parse_extras = true; > > > } > > > > > > - /* First check for a named mode */ > > > - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > > - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); > > > - if (ret == mode_end) { > > > - if (refresh_ptr) > > > - return false; /* named + refresh is > > > invalid */ > > > + if (!mode_end) > > > + return false; > > > > I'm chasing down a change in behaviour between 6.1 and 6.6, and this > > patch seems to be at least part of the cause. > > > > Since [1] we've had the emulated framebuffer on Pi being 16bpp to save > > memory. All good. > > > > It used to be possible to use "video=HDMI-A-1:-32" on the kernel > > command line to set it back to 32bpp. > > > > After this patch that is no longer possible. "mode_end = bpp_off", and > > "bpp_off = bpp_ptr - name", so with bpp_ptr = name we get mode_end > >
[PATCH linux-next] drm/panel: samsung: Simplify with dev_err_probe()
From: Chen Haonan dev_err_probe() can check if the error code is -EPROBE_DEFER and can return the error code, replacing dev_err() with it simplifies the code. Signed-off-by: Chen Haonan --- drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c index 79f611963c61..f4103e762b53 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c @@ -194,10 +194,8 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi) s6->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(s6->reset_gpio)) { - ret = PTR_ERR(s6->reset_gpio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to request GPIO (%d)\n", ret); - return ret; + return dev_err_probe(dev, PTR_ERR(s6->reset_gpio), +"failed to request GPIO\n"); } drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs, -- 2.25.1
Re: [PATCH] drm/amdkfd: fixes for HMM mem allocation
On Sun, Dec 31, 2023 at 9:39 AM Dafna Hirschfeld wrote: > > Few fixes to amdkfd and the doc of > devm_request_free_mem_region. > > Signed-off-by: Dafna Hirschfeld > --- > drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 +++--- > kernel/resource.c| 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > index 6c25dab051d5..b8680e0753ca 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c > @@ -1021,7 +1021,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev) > } else { > res = devm_request_free_mem_region(adev->dev, > &iomem_resource, size); > if (IS_ERR(res)) > - return -ENOMEM; > + return PTR_ERR(res); > pgmap->range.start = res->start; > pgmap->range.end = res->end; > pgmap->type = MEMORY_DEVICE_PRIVATE; > @@ -1037,10 +1037,10 @@ int kgd2kfd_init_zone_device(struct amdgpu_device > *adev) > r = devm_memremap_pages(adev->dev, pgmap); > if (IS_ERR(r)) { > pr_err("failed to register HMM device memory\n"); > - /* Disable SVM support capability */ > - pgmap->type = 0; > if (pgmap->type == MEMORY_DEVICE_PRIVATE) > devm_release_mem_region(adev->dev, res->start, > resource_size(res)); > + /* Disable SVM support capability */ > + pgmap->type = 0; > return PTR_ERR(r); > } > > diff --git a/kernel/resource.c b/kernel/resource.c > index 866ef3663a0b..fe890b874606 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -1905,8 +1905,8 @@ get_free_mem_region(struct device *dev, struct resource > *base, > * devm_request_free_mem_region - find free region for device private memory > * > * @dev: device struct to bind the resource to > - * @size: size in bytes of the device memory to add > * @base: resource tree to look in > + * @size: size in bytes of the device memory to add This change should be a separate patch? It looks unrelated. Alex > * > * This function tries to find an empty range of physical address big enough > to > * contain the new resource, so that it can later be hotplugged as > ZONE_DEVICE > -- > 2.34.1 >
Re: [PATCH v3 4/4] arm64: dts: rockchip: Add devicetree for Pine64 PineTab2
Hi Manuel, On 2024-01-03 14:40, Manuel Traut wrote: > Hi Jonas and Ondřej, > +&sfc { + pinctrl-names = "default"; + pinctrl-0 = <&fspi_dual_io_pins>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <2400>; >>> >>> That's a bit on the low side. The flash chip should work for all commands >>> up to >>> 80MHz https://megous.com/dl/tmp/b428ad9b85ac4633.png and SGM3157YC6 switch >>> for the FSPI-CLK should have high enough bandwidth, too. >> >> I agree that this is a little bit on the low side, it was a safe rate >> that I used for U-Boot. U-Boot required an exact rate of the supported >> sfc clk rates: 24, 50, 75, 100, 125 or 150 MHz. >> >> Please also note that the SPI NOR flash chip used in PineTab2 is not a >> GigaDevice GD25LQ128E, it should be a SiliconKaiser SK25LP128, same as >> found in the Pine64 PinePhone Pro. > > The schematics for v2.0 reference a GD25LQ128EWIGR. I never checked the jedec > id. How did you retrieve this information, or is it maybe a difference in v0.1 > and 2.0? This was when working on mainline U-Boot for the PineTab2 (and other rk356x devices). See [1] for a pending U-Boot patch that is waiting on a proper mainline linux devicetree for the PT2. The JEDEC ID is reported as 0x257018 on my v2.0 production unit, and does not match the JEDEC ID for GD25LQ128E (0xc86018) referenced in the schematics. I found that the JEDEC ID 0x257018 was referenced in prior patches related to the SK25LP128 SPI NOR flash chip used in Pine64 PinePhone Pro. I have only ever tested the 24 MHz rate, but I am expecting that e.g. 100 MHz also should work. Will not be able to test on my PT2 until at earliest next week. [1] https://github.com/Kwiboo/u-boot-rockchip/commit/66562d6eaf2c11a9f97fcdba379d3ceda8aa70ef Regards, Jonas > + spi-rx-bus-width = <2>; >>> >>> GD25LQ128E supports quad I/O. Maybe try 4 if it will work. >> >> The schematic only shows fspi D0 and D1 connected, and use the D2 line >> for eMMC_RSTn, so spi-rx-bus-width = <2> should be correct. > > ack > > Since it is only needed for bootloader updates and environment its maybe > better > to stay on the safe side? > > But I can test faster frequency if you want me to do.. > > Regards > Manuel
Re: [PATCH] drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init
Applied. Thanks! On Mon, Dec 25, 2023 at 5:18 AM Zhipeng Lu wrote: > > The hwmgr->backend, (i.e. data) allocated by kzalloc is not freed in > the error-handling paths of smu7_get_evv_voltages and > smu7_update_edc_leakage_table. However, it did be freed in the > error-handling of phm_initializa_dynamic_state_adjustment_rule_settings, > by smu7_hwmgr_backend_fini. So the lack of free in smu7_get_evv_voltages > and smu7_update_edc_leakage_table is considered a memleak in this patch. > > Fixes: 599a7e9fe1b6 ("drm/amd/powerplay: implement smu7 hwmgr to manager > asics with smu ip version 7.") > Fixes: 8f0804c6b7d0 ("drm/amd/pm: add edc leakage controller setting") > Signed-off-by: Zhipeng Lu > --- > drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c > b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c > index 11372fcc59c8..b1a8799e2dee 100644 > --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c > +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c > @@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr > *hwmgr) > result = smu7_get_evv_voltages(hwmgr); > if (result) { > pr_info("Get EVV Voltage Failed. Abort Driver > loading!\n"); > + kfree(hwmgr->backend); > + hwmgr->backend = NULL; > return -EINVAL; > } > } else { > @@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr > *hwmgr) > } > > result = smu7_update_edc_leakage_table(hwmgr); > - if (result) > + if (result) { > + smu7_hwmgr_backend_fini(hwmgr); > return result; > + } > > return 0; > } > -- > 2.34.1 >
Re: [RFC PATCH] drm/amd/display: fix bandwidth validation failure on DCN 2.1
On 12/29/23 11:25, Melissa Wen wrote: IGT `amdgpu/amd_color/crtc-lut-accuracy` fails right at the beginning of the test execution, during atomic check, because DC rejects the bandwidth state for a fb sizing 64x64. The test was previously working with the deprecated dc_commit_state(). Now using dc_validate_with_context() approach, the atomic check needs to perform a full state validation. Therefore, set fast_validation to false in the dc_validate_global_state call for atomic check. Fixes: b8272241ff9d ("drm/amd/display: Drop dc_commit_state in favor of dc_commit_streams") Signed-off-by: Melissa Wen --- Hi, It's a long story. I was inspecting this bug report: - https://gitlab.freedesktop.org/drm/amd/-/issues/2016 and noticed the IGT test `igt@amdgpu/amd_color@crtc-lut-accuracy` mentioned there wasn't even being executed on a laptop with DCN 2.1 (HP HP ENVY x360 Convertible 13-ay1xxx/8929). The test fails right at the beginning due to an atomic check rejection, as below: Starting subtest: crtc-lut-accuracy (amd_color:14772) igt_kms-CRITICAL: Test assertion failure function igt_display_commit_atomic, file ../lib/igt_kms.c:4530: (amd_color:14772) igt_kms-CRITICAL: Failed assertion: ret == 0 (amd_color:14772) igt_kms-CRITICAL: Last errno: 22, Invalid argument (amd_color:14772) igt_kms-CRITICAL: error: -22 != 0 Stack trace: #0 ../lib/igt_core.c:1989 __igt_fail_assert() #1 [igt_display_commit_atomic+0x44] #2 ../tests/amdgpu/amd_color.c:159 __igt_uniquereal_main395() #3 ../tests/amdgpu/amd_color.c:395 main() #4 ../sysdeps/nptl/libc_start_call_main.h:74 __libc_start_call_main() #5 ../csu/libc-start.c:128 __libc_start_main@@GLIBC_2.34() #6 [_start+0x21] Subtest crtc-lut-accuracy failed. Checking dmesg, we can see that a bandwidth validation failure causes the atomic check rejection: [ 711.147663] amdgpu :04:00.0: [drm] Mode Validation Warning: Unknown Status failed validation. [ 711.147667] [drm:amdgpu_dm_atomic_check [amdgpu]] DC global validation failure: Bandwidth validation failure (BW and Watermark) (13) [ 711.147772] [drm:amdgpu_irq_dispatch [amdgpu]] Unregistered interrupt src_id: 243 of client_id:8 [ 711.148033] [drm:amdgpu_dm_atomic_check [amdgpu]] Atomic check failed with err: -22 I also noticed that the atomic check doesn't fail if I change the fb width and height used in the test from 64 to 66, and I can get the test execution back (and with success). However, I recall that all test cases of IGT `amd_color` were working in the past, so I bisected and found the first bad commit: b8272241ff9d drm/amd/display: Drop dc_commit_state in favor of dc_commit_streams Bringing the `dc_commit_state` machinery back also prevents the bandwidth validation failure, but the commit above says dc_commit_streams validation is more complete than dc_commit_state, so I discarded this approach. After some debugging and code inspection, I found out that avoiding fast validation on dc_validate_global_state during atomic check solves the issue, but I'm not sure if this change may affect performance. I compared exec time of some IGT tests and didn't see any differences, but I recognize it doesn't provide enough evidence. What do you think about this change? Should I examine other things? Do you see any potential issue that I should investigate? Could you recommend a better approach to assess any side-effect of not enabling fast validation in the atomic check? Please, let me know your thoughts. We shouldn't be doing fast updates when lock_and_validation_needed is true, so this seems to be correct. Which is to say, applied, thanks! Cc: sta...@vger.kernel.org Happy New Year! Melissa drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 2845c884398e..4f51a7ad7a3c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -10745,7 +10745,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, DRM_DEBUG_DRIVER("drm_dp_mst_atomic_check() failed\n"); goto fail; } - status = dc_validate_global_state(dc, dm_state->context, true); + status = dc_validate_global_state(dc, dm_state->context, false); if (status != DC_OK) { DRM_DEBUG_DRIVER("DC global validation failure: %s (%d)", dc_status_to_str(status), status); -- Hamza
Re: [PATCH 08/11] nouveau/gsp: don't free ctrl messages on errors
Hi Dave, kernel test robot noticed the following build warnings: https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/nouveau-gsp-drop-some-acpi-related-debug/20231222-180432 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20231222043308.3090089-9-airlied%40gmail.com patch subject: [PATCH 08/11] nouveau/gsp: don't free ctrl messages on errors config: powerpc-randconfig-r071-20231226 (https://download.01.org/0day-ci/archive/20231227/202312271917.55xudmdc-...@intel.com/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project d3ef86708241a3bee902615c190dead1638c4e09) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/202312271917.55xudmdc-...@intel.com/ New smatch warnings: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:659 r535_gsp_rpc_rm_ctrl_push() warn: passing zero to 'PTR_ERR' drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c:1063 r535_dp_aux_xfer() warn: passing a valid pointer to 'PTR_ERR' Old smatch warnings: drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1887 nvkm_gsp_radix3_sg() error: uninitialized symbol 'addr'. vim +/PTR_ERR +659 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c af265ee961627a Dave Airlie 2023-12-22 649 static int af265ee961627a Dave Airlie 2023-12-22 650 r535_gsp_rpc_rm_ctrl_push(struct nvkm_gsp_object *object, void **argv, u32 repc) 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 651 { af265ee961627a Dave Airlie 2023-12-22 652 rpc_gsp_rm_control_v03_00 *rpc = container_of((*argv), typeof(*rpc), params); 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 653 struct nvkm_gsp *gsp = object->client->gsp; af265ee961627a Dave Airlie 2023-12-22 654 int ret = 0; 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 655 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 656 rpc = nvkm_gsp_rpc_push(gsp, rpc, true, repc); af265ee961627a Dave Airlie 2023-12-22 657 if (IS_ERR_OR_NULL(rpc)) { af265ee961627a Dave Airlie 2023-12-22 658 *argv = NULL; af265ee961627a Dave Airlie 2023-12-22 @659 return PTR_ERR(rpc); If nvkm_gsp_rpc_push() returns NULL (probably a failure) then this returns PTR_ERR(NULL) which is zero/success. af265ee961627a Dave Airlie 2023-12-22 660 } 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 661 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 662 if (rpc->status) { af265ee961627a Dave Airlie 2023-12-22 663 ret = r535_rpc_status_to_errno(rpc->status); 555bb9c29a45be Dave Airlie 2023-12-22 664 if (ret != -EAGAIN) 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 665 nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: 0x%08x\n", 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 666 object->client->object.handle, object->handle, rpc->cmd, rpc->status); 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 667 } 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 668 af265ee961627a Dave Airlie 2023-12-22 669 if (repc) af265ee961627a Dave Airlie 2023-12-22 670 *argv = rpc->params; af265ee961627a Dave Airlie 2023-12-22 671 else 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 672 nvkm_gsp_rpc_done(gsp, rpc); 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 673 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 674 return ret; 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 675 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH] drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings()
Applied. Thanks! On Mon, Dec 25, 2023 at 5:30 AM Randy Dunlap wrote: > > > > On 11/22/23 14:13, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > gcc prints a warning about a possible array overflow for a couple of > > callers of dp_decide_lane_settings() after commit 1b56c90018f0 ("Makefile: > > Enable -Wstringop-overflow globally"): > > > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c: > > In function 'dp_perform_fixed_vs_pe_training_sequence_legacy': > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c:426:25: > > error: 'dp_decide_lane_settings' accessing 4 bytes in a region of size 1 > > [-Werror=stringop-overflow=] > > 426 | dp_decide_lane_settings(lt_settings, > > dpcd_lane_adjust, > > | > > ^~ > > 427 | > > lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); > > | > > ~~~ > > drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c:426:25: > > note: referencing argument 4 of type 'union dpcd_training_lane[4]' > > > > I'm not entirely sure what caused this, but changing the prototype to expect > > a pointer instead of an array avoids the warnings. > > > > Fixes: 7727e7b60f82 ("drm/amd/display: Improve robustness of FIXED_VS link > > training at DP1 rates") > > Signed-off-by: Arnd Bergmann > > > Acked-by: Randy Dunlap > Tested-by: Randy Dunlap # build-tested > > Thanks. > > > --- > > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c| 2 +- > > .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.h| 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git > > a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > index 90339c2dfd84..5a0b04518956 100644 > > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c > > @@ -807,7 +807,7 @@ void dp_decide_lane_settings( > > const struct link_training_settings *lt_settings, > > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX], > > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX], > > - union dpcd_training_lane > > dpcd_lane_settings[LANE_COUNT_DP_MAX]) > > + union dpcd_training_lane *dpcd_lane_settings) > > { > > uint32_t lane; > > > > diff --git > > a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > index 7d027bac8255..851bd17317a0 100644 > > --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.h > > @@ -111,7 +111,7 @@ void dp_decide_lane_settings( > > const struct link_training_settings *lt_settings, > > const union lane_adjust ln_adjust[LANE_COUNT_DP_MAX], > > struct dc_lane_settings hw_lane_settings[LANE_COUNT_DP_MAX], > > - union dpcd_training_lane dpcd_lane_settings[LANE_COUNT_DP_MAX]); > > + union dpcd_training_lane *dpcd_lane_settings); > > > > enum dc_dp_training_pattern decide_cr_training_pattern( > > const struct dc_link_settings *link_settings); > > -- > #Randy > https://people.kernel.org/tglx/notes-about-netiquette > https://subspace.kernel.org/etiquette.html
Re: [syzbot] [dri?] WARNING in drm_prime_destroy_file_private (2)
Am 28.12.23 um 03:57 schrieb Qi Zheng: On 2023/12/28 04:51, syzbot wrote: Hello, syzbot found the following issue on: HEAD commit: 5254c0cbc92d Merge tag 'block-6.7-2023-12-22' of git://git.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=10cc6995e8 kernel config: https://syzkaller.appspot.com/x/.config?x=314e9ad033a7d3a7 dashboard link: https://syzkaller.appspot.com/bug?extid=59dcc2e7283a6f5f5ba1 compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13e35809e8 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=155d5fd6e8 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/ebe09a5995ee/disk-5254c0cb.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/02178d7f5f98/vmlinux-5254c0cb.xz kernel image: https://storage.googleapis.com/syzbot-assets/12307f47d87c/bzImage-5254c0cb.xz The issue was bisected to: commit ea4452de2ae987342fadbdd2c044034e6480daad Author: Qi Zheng Date: Fri Nov 18 10:00:11 2022 + mm: fix unexpected changes to {failslab|fail_page_alloc}.attr bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13027f76e8 final oops: https://syzkaller.appspot.com/x/report.txt?x=10827f76e8 console output: https://syzkaller.appspot.com/x/log.txt?x=17027f76e8 IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+59dcc2e7283a6f5f5...@syzkaller.appspotmail.com Fixes: ea4452de2ae9 ("mm: fix unexpected changes to {failslab|fail_page_alloc}.attr") R10: R11: 0246 R12: 7efe98069194 R13: 7efe97fd2210 R14: 0002 R15: 6972642f7665642f [ cut here ] WARNING: CPU: 0 PID: 5107 at drivers/gpu/drm/drm_prime.c:227 drm_prime_destroy_file_private+0x43/0x60 drivers/gpu/drm/drm_prime.c:227 The warning is caused by !RB_EMPTY_ROOT(&prime_fpriv->dmabufs): drm_prime_destroy_file_private --> WARN_ON(!RB_EMPTY_ROOT(&prime_fpriv->dmabufs)); It seems irrelevant to the logic of fault injection. So I don't see why the commit ea4452de2ae9 can cause this warning. :( Making an educated guess I strongly think syzbot incorrectly bisected this. What basically happens is that a DRM test case crashes because a file private data structure is destroyed before all DMA-bufs referring to it are destroyed. Looks like a random race condition in a test case to me. Question is really what test is syzbot running and who is maintaining this test case? Regards, Christian. Modules linked in: CPU: 0 PID: 5107 Comm: syz-executor227 Not tainted 6.7.0-rc6-syzkaller-00248-g5254c0cbc92d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 RIP: 0010:drm_prime_destroy_file_private+0x43/0x60 drivers/gpu/drm/drm_prime.c:227 Code: 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 75 21 48 8b 83 90 00 00 00 48 85 c0 75 06 5b e9 13 f1 93 fc e8 0e f1 93 fc 90 <0f> 0b 90 5b e9 04 f1 93 fc e8 3f 9b ea fc eb d8 66 66 2e 0f 1f 84 RSP: 0018:c90003bdf9e0 EFLAGS: 00010293 RAX: RBX: 888019f28378 RCX: c90003bdf9b0 RDX: 888018ff9dc0 RSI: 84f380c2 RDI: 888019f28408 RBP: 888019f28000 R08: 0001 R09: 0001 R10: 8f193a57 R11: R12: 88814829a000 R13: 888019f282a8 R14: 88814829a068 R15: 88814829a0a0 FS: () GS:8880b980() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 7efe98050410 CR3: 6d1ff000 CR4: 00350ef0 Call Trace: drm_file_free.part.0+0x738/0xb90 drivers/gpu/drm/drm_file.c:290 drm_file_free drivers/gpu/drm/drm_file.c:247 [inline] drm_close_helper.isra.0+0x180/0x1f0 drivers/gpu/drm/drm_file.c:307 drm_release+0x22a/0x4f0 drivers/gpu/drm/drm_file.c:494 __fput+0x270/0xb70 fs/file_table.c:394 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa8a/0x2ad0 kernel/exit.c:869 do_group_exit+0xd4/0x2a0 kernel/exit.c:1018 get_signal+0x23b5/0x2790 kernel/signal.c:2904 arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:309 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x121/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1e/0x60 kernel/entry/common.c:296 do_syscall_64+0x4d/0x110 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7efe98014769 Code: Unable to access opcode bytes at 0x7efe9801473f. RSP: 002b:7efe97fd2208 EFLAGS: 0246 ORIG_RAX: 00ca RAX: fe00 RBX: 7efe9809c408 RCX: 7efe98014769 RDX: RSI: 0080 RDI: 7efe9809c408 RBP: 7efe9809c400 R08: 3131 R09: 0
Re: [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection
On 2023-12-26 10:38, Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 26 Dec 2023 08:44:37 +0100 > > The kfree() function was called in one case by the > drm_property_create() function during error handling > even if the passed data structure member contained a null pointer. > This issue was detected by using the Coccinelle software. > > Thus use another label. > > Signed-off-by: Markus Elfring > --- > drivers/gpu/drm/drm_property.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c > index 596272149a35..3440f4560e6e 100644 > --- a/drivers/gpu/drm/drm_property.c > +++ b/drivers/gpu/drm/drm_property.c > @@ -117,7 +117,7 @@ struct drm_property *drm_property_create(struct > drm_device *dev, > property->values = kcalloc(num_values, sizeof(uint64_t), > GFP_KERNEL); > if (!property->values) > - goto fail; > + goto free_property; > } > > ret = drm_mode_object_add(dev, &property->base, > DRM_MODE_OBJECT_PROPERTY); > @@ -135,6 +135,7 @@ struct drm_property *drm_property_create(struct > drm_device *dev, > return property; > fail: > kfree(property->values); > +free_property: > kfree(property); > return NULL; > } > -- > 2.43.0 > This change is pointless at best, kfree(NULL) works fine. Out of curiosity, what exactly did Coccinelle report? -- Earthling Michel Dänzer| https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Re: [RFC PATCH] drm/amd/display: fix bandwidth validation failure on DCN 2.1
On Wed, Jan 03, 2024 at 09:44:18AM -0500, Hamza Mahfooz wrote: > On 12/29/23 11:25, Melissa Wen wrote: > > IGT `amdgpu/amd_color/crtc-lut-accuracy` fails right at the beginning of > > the test execution, during atomic check, because DC rejects the > > bandwidth state for a fb sizing 64x64. The test was previously working > > with the deprecated dc_commit_state(). Now using > > dc_validate_with_context() approach, the atomic check needs to perform a > > full state validation. Therefore, set fast_validation to false in the > > dc_validate_global_state call for atomic check. > > > > Fixes: b8272241ff9d ("drm/amd/display: Drop dc_commit_state in favor of > > dc_commit_streams") > > Signed-off-by: Melissa Wen > > --- > > > > Hi, > > > > It's a long story. I was inspecting this bug report: > > - https://gitlab.freedesktop.org/drm/amd/-/issues/2016 > > and noticed the IGT test `igt@amdgpu/amd_color@crtc-lut-accuracy` > > mentioned there wasn't even being executed on a laptop with DCN 2.1 > > (HP HP ENVY x360 Convertible 13-ay1xxx/8929). The test fails right at > > the beginning due to an atomic check rejection, as below: > > > > Starting subtest: crtc-lut-accuracy > > (amd_color:14772) igt_kms-CRITICAL: Test assertion failure function > > igt_display_commit_atomic, file ../lib/igt_kms.c:4530: > > (amd_color:14772) igt_kms-CRITICAL: Failed assertion: ret == 0 > > (amd_color:14772) igt_kms-CRITICAL: Last errno: 22, Invalid argument > > (amd_color:14772) igt_kms-CRITICAL: error: -22 != 0 > > Stack trace: > >#0 ../lib/igt_core.c:1989 __igt_fail_assert() > >#1 [igt_display_commit_atomic+0x44] > >#2 ../tests/amdgpu/amd_color.c:159 __igt_uniquereal_main395() > >#3 ../tests/amdgpu/amd_color.c:395 main() > >#4 ../sysdeps/nptl/libc_start_call_main.h:74 __libc_start_call_main() > >#5 ../csu/libc-start.c:128 __libc_start_main@@GLIBC_2.34() > >#6 [_start+0x21] > > Subtest crtc-lut-accuracy failed. > > > > Checking dmesg, we can see that a bandwidth validation failure causes > > the atomic check rejection: > > > > [ 711.147663] amdgpu :04:00.0: [drm] Mode Validation Warning: Unknown > > Status failed validation. > > [ 711.147667] [drm:amdgpu_dm_atomic_check [amdgpu]] DC global validation > > failure: Bandwidth validation failure (BW and Watermark) (13) > > [ 711.147772] [drm:amdgpu_irq_dispatch [amdgpu]] Unregistered interrupt > > src_id: 243 of client_id:8 > > [ 711.148033] [drm:amdgpu_dm_atomic_check [amdgpu]] Atomic check failed > > with err: -22 > > > > I also noticed that the atomic check doesn't fail if I change the fb > > width and height used in the test from 64 to 66, and I can get the test > > execution back (and with success). However, I recall that all test cases > > of IGT `amd_color` were working in the past, so I bisected and found the > > first bad commit: > > > > b8272241ff9d drm/amd/display: Drop dc_commit_state in favor of > > dc_commit_streams > > > > Bringing the `dc_commit_state` machinery back also prevents the > > bandwidth validation failure, but the commit above says > > dc_commit_streams validation is more complete than dc_commit_state, so I > > discarded this approach. > > > > After some debugging and code inspection, I found out that avoiding fast > > validation on dc_validate_global_state during atomic check solves the > > issue, but I'm not sure if this change may affect performance. I > > compared exec time of some IGT tests and didn't see any differences, but > > I recognize it doesn't provide enough evidence. > > > > What do you think about this change? Should I examine other things? Do > > you see any potential issue that I should investigate? Could you > > recommend a better approach to assess any side-effect of not enabling > > fast validation in the atomic check? > > > > Please, let me know your thoughts. > > We shouldn't be doing fast updates when lock_and_validation_needed is > true, so this seems to be correct. > > Which is to say, applied, thanks! > > Cc: sta...@vger.kernel.org This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.
Re: [PATCH] drivers/accel/habanalabs: Remove unnecessary braces from if statement
On 28/12/2023 23:08, Malkoot Khan wrote: The coding style in the Linux kernel prefers not to use braces for single-statement if conditions. This patch removes the unnecessary braces from an if statement in the file drivers/accel/habanalabs/common/command_submission.c, which also resolves a coding style warning. Signed-off-by: Malkoot Khan --- drivers/accel/habanalabs/common/command_submission.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drivers/accel/habanalabs/common/command_submission.c index 3aa6eeef443b..39e23d625a3c 100644 --- a/drivers/accel/habanalabs/common/command_submission.c +++ b/drivers/accel/habanalabs/common/command_submission.c @@ -1360,9 +1360,8 @@ static int hl_cs_sanity_checks(struct hl_fpriv *hpriv, union hl_cs_args *args) return -EINVAL; } - if (!hl_device_operational(hdev, &status)) { + if (!hl_device_operational(hdev, &status)) return -EBUSY; - } if ((args->in.cs_flags & HL_CS_FLAGS_STAGED_SUBMISSION) && !hdev->supports_staged_submission) { Thanks for the patch. Reviewed-by: Oded Gabbay Applied to -next. Oded
Re: [PATCH v4 2/6] x86/vmware: Introduce VMware hypercall API
On Thu, Dec 28, 2023 at 11:24:17AM -0800, Alexey Makhalov wrote: > From: Alexey Makhalov > > Introduce vmware_hypercall family of functions. It is a common > implementation to be used by the VMware guest code and virtual > device drivers in architecture independent manner. > > The API consists of vmware_hypercallX and vmware_hypercall_hb_{out,in} > set of functions by analogy with KVM hypercall API. Architecture > specific implementation is hidden inside. > > It will simplify future enhancements in VMware hypercalls such > as SEV-ES and TDX related changes without needs to modify a > caller in device drivers code. > > Current implementation extends an idea from commit bac7b4e84323 > ("x86/vmware: Update platform detection code for VMCALL/VMMCALL > hypercalls") to have a slow, but safe path in VMWARE_HYPERCALL > earlier during the boot when alternatives are not yet applied. > This logic was inherited from VMWARE_CMD from the commit mentioned > above. Default alternative code was optimized by size to reduce > excessive nop alignment once alternatives are applied. Total > default code size is 26 bytes, in worse case (3 bytes alternative) > remaining 23 bytes will be aligned by only 3 long NOP instructions. > > Signed-off-by: Alexey Makhalov > Reviewed-by: Nadav Amit > Reviewed-by: Jeff Sipek Hi Alexey, I'd like to flag that this breaks gcc-13 x86_64 allmodconfig builds of the following files. And although this is resolved by the subsequent 3 patches in this series, it does still break bisection. drivers/gpu/drm/vmwgfx/vmwgfx_msg.c drivers/input/mouse/vmmouse.c drivers/ptp/ptp_vmw.c ...
Re: [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection
>> The kfree() function was called in one case by the >> drm_property_create() function during error handling >> even if the passed data structure member contained a null pointer. >> This issue was detected by using the Coccinelle software. >> >> Thus use another label. … >> +++ b/drivers/gpu/drm/drm_property.c >> @@ -117,7 +117,7 @@ struct drm_property *drm_property_create(struct >> drm_device *dev, >> property->values = kcalloc(num_values, sizeof(uint64_t), >> GFP_KERNEL); >> if (!property->values) >> -goto fail; >> +goto free_property; >> } >> >> ret = drm_mode_object_add(dev, &property->base, >> DRM_MODE_OBJECT_PROPERTY); >> @@ -135,6 +135,7 @@ struct drm_property *drm_property_create(struct >> drm_device *dev, >> return property; >> fail: >> kfree(property->values); >> +free_property: >> kfree(property); >> return NULL; >> } … > This change is pointless at best, kfree(NULL) works fine. * Would you interpret such a special function call as redundant? * Do you find advices applicable from another information source also for this function implementation? https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources > Out of curiosity, what exactly did Coccinelle report? Some SmPL scripts from my own selection tend to point questionable implementation details out. Regards, Markus
Re: [PATCH v9 09/25] drm/modes: Move named modes parsing to a separate function
On Wed, 3 Jan 2024 at 14:02, Dave Stevenson wrote: > > Hi Maxime > > On Wed, 3 Jan 2024 at 13:33, Maxime Ripard wrote: > > > > Hi Dave, > > > > Happy new year :) > > And to you. > > > On Tue, Jan 02, 2024 at 03:12:26PM +, Dave Stevenson wrote: > > > Hi Maxime > > > > > > On Mon, 14 Nov 2022 at 13:00, Maxime Ripard wrote: > > > > > > > > The current construction of the named mode parsing doesn't allow to > > > > extend > > > > it easily. Let's move it to a separate function so we can add more > > > > parameters and modes. > > > > > > > > In order for the tests to still pass, some extra checks are needed, so > > > > it's not a 1:1 move. > > > > > > > > Reviewed-by: Noralf Trønnes > > > > Tested-by: Mateusz Kwiatkowski > > > > Signed-off-by: Maxime Ripard > > > > > > > > --- > > > > Changes in v7: > > > > - Add Noralf Reviewed-by > > > > > > > > Changes in v6: > > > > - Simplify the test for connection status extras > > > > - Simplify the code path to call drm_mode_parse_cmdline_named_mode > > > > > > > > Changes in v4: > > > > - Fold down all the named mode patches that were split into a single > > > > patch again to maintain bisectability > > > > --- > > > > drivers/gpu/drm/drm_modes.c | 70 > > > > + > > > > 1 file changed, 58 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > > > > index 71c050c3ee6b..37542612912b 100644 > > > > --- a/drivers/gpu/drm/drm_modes.c > > > > +++ b/drivers/gpu/drm/drm_modes.c > > > > @@ -2229,6 +2229,51 @@ static const char * const > > > > drm_named_modes_whitelist[] = { > > > > "PAL", > > > > }; > > > > > > > > +static int drm_mode_parse_cmdline_named_mode(const char *name, > > > > +unsigned int name_end, > > > > +struct drm_cmdline_mode > > > > *cmdline_mode) > > > > +{ > > > > + unsigned int i; > > > > + > > > > + if (!name_end) > > > > + return 0; > > > > + > > > > + /* If the name starts with a digit, it's not a named mode */ > > > > + if (isdigit(name[0])) > > > > + return 0; > > > > + > > > > + /* > > > > +* If there's an equal sign in the name, the command-line > > > > +* contains only an option and no mode. > > > > +*/ > > > > + if (strnchr(name, name_end, '=')) > > > > + return 0; > > > > + > > > > + /* The connection status extras can be set without a mode. */ > > > > + if (name_end == 1 && > > > > + (name[0] == 'd' || name[0] == 'D' || name[0] == 'e')) > > > > + return 0; > > > > + > > > > + /* > > > > +* We're sure we're a named mode at this point, iterate over the > > > > +* list of modes we're aware of. > > > > +*/ > > > > + for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > > > + int ret; > > > > + > > > > + ret = str_has_prefix(name, > > > > drm_named_modes_whitelist[i]); > > > > + if (ret != name_end) > > > > + continue; > > > > + > > > > + strcpy(cmdline_mode->name, > > > > drm_named_modes_whitelist[i]); > > > > + cmdline_mode->specified = true; > > > > + > > > > + return 1; > > > > + } > > > > + > > > > + return -EINVAL; > > > > +} > > > > + > > > > /** > > > > * drm_mode_parse_command_line_for_connector - parse command line > > > > modeline for connector > > > > * @mode_option: optional per connector mode option > > > > @@ -2265,7 +2310,7 @@ bool > > > > drm_mode_parse_command_line_for_connector(const char *mode_option, > > > > const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = > > > > NULL; > > > > const char *options_ptr = NULL; > > > > char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; > > > > - int i, len, ret; > > > > + int len, ret; > > > > > > > > memset(mode, 0, sizeof(*mode)); > > > > mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; > > > > @@ -2306,18 +2351,19 @@ bool > > > > drm_mode_parse_command_line_for_connector(const char *mode_option, > > > > parse_extras = true; > > > > } > > > > > > > > - /* First check for a named mode */ > > > > - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { > > > > - ret = str_has_prefix(name, > > > > drm_named_modes_whitelist[i]); > > > > - if (ret == mode_end) { > > > > - if (refresh_ptr) > > > > - return false; /* named + refresh is > > > > invalid */ > > > > + if (!mode_end) > > > > + return false; > > > > > > I'm chasing down a change in behaviour between 6.1 and 6.6, and this > > > patch seems to be at least part of the cause. > > > > > > Since [1] we'
Re: [PATCH 1/3] drm: property: One function call less in drm_property_create() after error detection
On 2024-01-03 17:24, Markus Elfring wrote: > >> Out of curiosity, what exactly did Coccinelle report? > > Some SmPL scripts from my own selection tend to point questionable > implementation details out. That doesn't answer my question. Without seeing the actual Coccinelle report, I'll assume that it didn't actually call for this change. -- Earthling Michel Dänzer| https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
Re: [PATCH linux-next v2] drm/panel: Simplify with dev_err_probe()
On 12/25/2023 6:26 AM, chenguanxi11...@163.com wrote: From: Chen Haonan dev_err_probe() can check if the error code is -EPROBE_DEFER and can return the error code, replacing dev_err() with it simplifies the code. Signed-off-by: Chen Haonan Reviewed-by: Jessica Zhang --- drivers/gpu/drm/panel/panel-boe-himax8279d.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c index 11b64acbe8a9..e225840b0d67 100644 --- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c +++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c @@ -854,26 +854,20 @@ static int panel_add(struct panel_info *pinfo) pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH); if (IS_ERR(pinfo->pp18_gpio)) { - ret = PTR_ERR(pinfo->pp18_gpio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to get pp18 gpio: %d\n", ret); - return ret; + return dev_err_probe(dev, PTR_ERR(pinfo->pp18_gpio), +"failed to get pp18 gpio\n"); } pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH); if (IS_ERR(pinfo->pp33_gpio)) { - ret = PTR_ERR(pinfo->pp33_gpio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to get pp33 gpio: %d\n", ret); - return ret; + return dev_err_probe(dev, PTR_ERR(pinfo->pp33_gpio), +"failed to get pp33 gpio\n"); } pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); if (IS_ERR(pinfo->enable_gpio)) { - ret = PTR_ERR(pinfo->enable_gpio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to get enable gpio: %d\n", ret); - return ret; + return dev_err_probe(dev, PTR_ERR(pinfo->enable_gpio), +"failed to get enable gpio\n"); } drm_panel_init(&pinfo->base, dev, &panel_funcs, -- 2.25.1
Re: [PATCH linux-next] drm/panel: samsung: Simplify with dev_err_probe()
On 1/3/2024 6:17 AM, chenguanxi11...@163.com wrote: From: Chen Haonan dev_err_probe() can check if the error code is -EPROBE_DEFER and can return the error code, replacing dev_err() with it simplifies the code. Signed-off-by: Chen Haonan Reviewed-by: Jessica Zhang --- drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c index 79f611963c61..f4103e762b53 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6d16d0.c @@ -194,10 +194,8 @@ static int s6d16d0_probe(struct mipi_dsi_device *dsi) s6->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(s6->reset_gpio)) { - ret = PTR_ERR(s6->reset_gpio); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to request GPIO (%d)\n", ret); - return ret; + return dev_err_probe(dev, PTR_ERR(s6->reset_gpio), +"failed to request GPIO\n"); } drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs, -- 2.25.1
Re: [1/3] drm: property: One function call less in drm_property_create() after error detection
>>> Out of curiosity, what exactly did Coccinelle report? >> >> Some SmPL scripts from my own selection tend to point questionable >> implementation details out. > > That doesn't answer my question. It should. > Without seeing the actual Coccinelle report, There is no “official” report according to the discussed patch which is triggered by known advices for the application of labels in goto chains. > I'll assume that it didn't actually call for this change. Software development opinions are evolving accordingly. Regards, Markus
[PATCH] drm/rockchip: analogix_dp: get encoder port ID from DT
The VOP2 driver needs this port ID to properly configure the display data routing. Signed-off-by: Lucas Stach --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 84aa811ca1e9..cea8d1af0ec7 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -344,6 +344,9 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, return ret; } + rockchip_drm_encoder_set_crtc_endpoint_id(&dp->encoder, + dev->of_node, 0, 0); + dp->plat_data.encoder = &dp->encoder.encoder; ret = analogix_dp_bind(dp->adp, drm_dev); -- 2.43.0
Re: [PATCH] drm/msm/a7xx: Fix LLC typo
On Tue, Jan 2, 2024 at 12:12 PM Konrad Dybcio wrote: > > On 2.01.2024 20:33, Rob Clark wrote: > > From: Rob Clark > > > > We'd miss actually activating LLC. > > > > Signed-off-by: Rob Clark > > --- > > drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c > > b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c > > index a5660d63535b..54dc5eb37f70 100644 > > --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c > > +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c > > @@ -1646,7 +1646,7 @@ static int a6xx_gmu_pm_resume(struct msm_gpu *gpu) > > > > msm_devfreq_resume(gpu); > > > > - adreno_is_a7xx(adreno_gpu) ? a7xx_llc_activate : > > a6xx_llc_activate(a6xx_gpu); > > + adreno_is_a7xx(adreno_gpu) ? a7xx_llc_activate(a6xx_gpu) : > > a6xx_llc_activate(a6xx_gpu); > > /me cleans glasses > > oh.. > > Reviewed-by: Konrad Dybcio I suppose I should also add, Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support") > Konrad
Re: [PATCH v2 23/39] drm/bridge: nxp-ptn3460: switch to ->edid_read callback
Hi Jani, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.7-rc8 next-20240103] [cannot apply to drm-intel/for-linux-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-bridge-add-edid_read-hook-and-drm_bridge_edid_read/20240103-181513 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/87fb7fd52d087dd9a15b7194f3915b6b1c4146d6.1704276309.git.jani.nikula%40intel.com patch subject: [PATCH v2 23/39] drm/bridge: nxp-ptn3460: switch to ->edid_read callback config: arm-randconfig-001-20240103 (https://download.01.org/0day-ci/archive/20240104/202401040455.pphqjivr-...@intel.com/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240104/202401040455.pphqjivr-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202401040455.pphqjivr-...@intel.com/ All warnings (new ones prefixed by >>): >> drivers/gpu/drm/bridge/nxp-ptn3460.c:170:6: warning: variable 'drm_edid' is >> used uninitialized whenever 'if' condition is true >> [-Wsometimes-uninitialized] 170 | if (!edid) { | ^ drivers/gpu/drm/bridge/nxp-ptn3460.c:189:9: note: uninitialized use occurs here 189 | return drm_edid; |^~~~ drivers/gpu/drm/bridge/nxp-ptn3460.c:170:2: note: remove the 'if' if its condition is always false 170 | if (!edid) { | ^~~~ 171 | DRM_ERROR("Failed to allocate EDID\n"); | ~~~ 172 | goto out; | ~ 173 | } | ~ drivers/gpu/drm/bridge/nxp-ptn3460.c:161:33: note: initialize the variable 'drm_edid' to silence this warning 161 | const struct drm_edid *drm_edid; |^ | = NULL 1 warning generated. vim +170 drivers/gpu/drm/bridge/nxp-ptn3460.c a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 155 a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 156 dd6c2ed9dace84 drivers/gpu/drm/bridge/nxp-ptn3460.c Jani Nikula 2024-01-03 157 static const struct drm_edid *ptn3460_edid_read(struct drm_bridge *bridge, 4151c14cdda689 drivers/gpu/drm/bridge/nxp-ptn3460.c Sam Ravnborg 2020-07-27 158struct drm_connector *connector) a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 159 { 4151c14cdda689 drivers/gpu/drm/bridge/nxp-ptn3460.c Sam Ravnborg 2020-07-27 160struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); dd6c2ed9dace84 drivers/gpu/drm/bridge/nxp-ptn3460.c Jani Nikula 2024-01-03 161const struct drm_edid *drm_edid; a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 162bool power_off; 4151c14cdda689 drivers/gpu/drm/bridge/nxp-ptn3460.c Sam Ravnborg 2020-07-27 163u8 *edid; 4151c14cdda689 drivers/gpu/drm/bridge/nxp-ptn3460.c Sam Ravnborg 2020-07-27 164int ret; a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 165 a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 166power_off = !ptn_bridge->enabled; 94d50d57c4403a drivers/gpu/drm/bridge/ptn3460.c Ajay Kumar 2015-01-20 167ptn3460_pre_enable(&ptn_bridge->bridge); a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 168 a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 169edid = kmalloc(EDID_LENGTH, GFP_KERNEL); a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 @170if (!edid) { 94d50d57c4403a drivers/gpu/drm/bridge/ptn3460.c Ajay Kumar 2015-01-20 171DRM_ERROR("Failed to allocate EDID\n"); 4151c14cdda689 drivers/gpu/drm/bridge/nxp-ptn3460.c Sam Ravnborg 2020-07-27 172goto out; a9fe713d7d45c6 drivers/gpu/drm/bridge/ptn3460.c Sean Paul2014-02-24 173
Re: [PATCH v1 1/1] drm/virtio: Spelling fixes
On 12/19/23 18:19, Andy Shevchenko wrote: > While making a spelling mistake myself for `git grep kvalloc` > I found that the only file has such a typo. Fix it and update > to the standard de facto of how we refer to the functions. > Also spell usr-out as user-out, it seems this driver uses its > own terminology nobody else can decypher, make it more readable. > > Signed-off-by: Andy Shevchenko > --- > drivers/gpu/drm/virtio/virtgpu_submit.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_submit.c > b/drivers/gpu/drm/virtio/virtgpu_submit.c > index 5c514946bbad..1c7c7f61a222 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_submit.c > +++ b/drivers/gpu/drm/virtio/virtgpu_submit.c > @@ -99,8 +99,8 @@ virtio_gpu_parse_deps(struct virtio_gpu_submit *submit) > return 0; > > /* > - * kvalloc at first tries to allocate memory using kmalloc and > - * falls back to vmalloc only on failure. It also uses __GFP_NOWARN > + * kvmalloc() at first tries to allocate memory using kmalloc() and > + * falls back to vmalloc() only on failure. It also uses __GFP_NOWARN >* internally for allocations larger than a page size, preventing >* storm of KMSG warnings. >*/ > @@ -529,7 +529,7 @@ int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, > void *data, > virtio_gpu_submit(&submit); > > /* > - * Set up usr-out data after submitting the job to optimize > + * Set up user-out data after submitting the job to optimize >* the job submission path. >*/ > virtio_gpu_install_out_fence_fd(&submit); Applied to misc-next, thanks -- Best regards, Dmitry
Re: [PATCH 1/1] drm/virtio: Implement RESOURCE_GET_LAYOUT ioctl
On 12/21/23 13:00, Julia Zhang wrote: > From: Daniel Stone > > Add a new ioctl to allow the guest VM to discover how the guest > actually allocated the underlying buffer, which allows buffers to > be used for GL<->Vulkan interop and through standard window systems. > It's also a step towards properly supporting modifiers in the guest. > > Signed-off-by: Daniel Stone > Co-developed-by: Julia Zhang # support query > stride before it's created > Signed-off-by: Julia Zhang > --- > drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + > drivers/gpu/drm/virtio/virtgpu_drv.h | 22 - > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 66 ++ > drivers/gpu/drm/virtio/virtgpu_kms.c | 8 +++- > drivers/gpu/drm/virtio/virtgpu_vq.c| 63 > include/uapi/drm/virtgpu_drm.h | 21 > include/uapi/linux/virtio_gpu.h| 30 > 7 files changed, 208 insertions(+), 3 deletions(-) ... > +static int virtio_gpu_resource_query_layout_ioctl(struct drm_device *dev, > + void *data, > + struct drm_file *file) > +{ > + struct drm_virtgpu_resource_query_layout *args = data; > + struct virtio_gpu_device *vgdev = dev->dev_private; > + struct drm_gem_object *obj = NULL; > + struct virtio_gpu_object *bo = NULL; > + struct virtio_gpu_query_info bo_info = {0}; > + int ret = 0; > + int i; > + > + if (!vgdev->has_resource_query_layout) { > + DRM_ERROR("failing: no RQL on host\n"); Please remove this message > + return -EINVAL; return -ENOSYS > + } > + > + if (args->handle > 0) { > + obj = drm_gem_object_lookup(file, args->handle); > + if (obj == NULL) { > + DRM_ERROR("invalid handle 0x%x\n", args->handle); > + return -ENOENT; > + } > + bo = gem_to_virtio_gpu_obj(obj); > + } > + > + ret = virtio_gpu_cmd_get_resource_layout(vgdev, &bo_info, args->width, > + args->height, args->format, > + args->bind, bo ? > bo->hw_res_handle : 0); What this special hw_res_handle=0 is doing? Why is it needed? > + if (ret) > + goto out; > + > + ret = wait_event_timeout(vgdev->resp_wq, > + atomic_read(&bo_info.is_valid), > + 5 * HZ); > + if (!ret) > + goto out; > + > +valid: > + smp_rmb(); > + WARN_ON(atomic_read(&bo_info.is_valid)); Please remove this WARN_ON and fix the kernelbot report > + args->num_planes = bo_info.num_planes; > + args->modifier = bo_info.modifier; > + for (i = 0; i < args->num_planes; i++) { > + args->planes[i].offset = bo_info.planes[i].offset; > + args->planes[i].stride = bo_info.planes[i].stride; > + } > + for (; i < VIRTIO_GPU_MAX_RESOURCE_PLANES; i++) { > + args->planes[i].offset = 0; > + args->planes[i].stride = 0; > + } > + ret = 0; ret is already 0 here > +out: > + if (obj) > + drm_gem_object_put(obj); > + return ret; > +} ... > diff --git a/include/uapi/linux/virtio_gpu.h b/include/uapi/linux/virtio_gpu.h > index f556fde07b76..547575232376 100644 > --- a/include/uapi/linux/virtio_gpu.h > +++ b/include/uapi/linux/virtio_gpu.h > @@ -65,6 +65,11 @@ > */ > #define VIRTIO_GPU_F_CONTEXT_INIT4 > > +/* > + * VIRTIO_GPU_CMD_RESOURCE_QUERY_LAYOUT > + */ > +#define VIRTIO_GPU_F_RESOURCE_QUERY_LAYOUT 5 > + > enum virtio_gpu_ctrl_type { > VIRTIO_GPU_UNDEFINED = 0, > > @@ -95,6 +100,7 @@ enum virtio_gpu_ctrl_type { > VIRTIO_GPU_CMD_SUBMIT_3D, > VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB, > VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB, > + VIRTIO_GPU_CMD_RESOURCE_QUERY_LAYOUT, > > /* cursor commands */ > VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300, > @@ -108,6 +114,7 @@ enum virtio_gpu_ctrl_type { > VIRTIO_GPU_RESP_OK_EDID, > VIRTIO_GPU_RESP_OK_RESOURCE_UUID, > VIRTIO_GPU_RESP_OK_MAP_INFO, > + VIRTIO_GPU_RESP_OK_RESOURCE_LAYOUT, > > /* error responses */ > VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200, > @@ -453,4 +460,27 @@ struct virtio_gpu_resource_unmap_blob { > __le32 padding; > }; > > +/* VIRTIO_GPU_CMD_RESOURCE_QUERY_LAYOUT */ > +struct virtio_gpu_resource_query_layout { > + struct virtio_gpu_ctrl_hdr hdr; > + __le32 resource_id; > + __le32 width; > + __le32 height; > + __le32 format; > + __le32 bind; 64b pad missing > +}; > + > + > +/* VIRTIO_GPU_RESP_OK_RESOURCE_LAYOUT */ > +#define VIRTIO_GPU_RES_MAX_PLANES 4 > +struct virtio_gpu_resp_resource_layout { > + struct virtio_gpu_ctrl_hdr hdr; > + __le64 modifier; > + __le32 num_planes; > + struct virtio_gpu_resource_plane { > + __le64 offset; > +
Re: [PATCH 08/11] nouveau/gsp: don't free ctrl messages on errors
On Thu, 4 Jan 2024 at 00:47, Dan Carpenter wrote: > > Hi Dave, > > kernel test robot noticed the following build warnings: > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: > https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/nouveau-gsp-drop-some-acpi-related-debug/20231222-180432 > base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next > patch link: > https://lore.kernel.org/r/20231222043308.3090089-9-airlied%40gmail.com > patch subject: [PATCH 08/11] nouveau/gsp: don't free ctrl messages on errors > config: powerpc-randconfig-r071-20231226 > (https://download.01.org/0day-ci/archive/20231227/202312271917.55xudmdc-...@intel.com/config) > compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project > d3ef86708241a3bee902615c190dead1638c4e09) > > If you fix the issue in a separate patch/commit (i.e. not just a new version > of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > | Closes: https://lore.kernel.org/r/202312271917.55xudmdc-...@intel.com/ This is a false positive, I think the code is operating like I'd expect, we maybe could restructure it to avoid this warning? The idea is you send an rpc msg, if there's a reply you get a reply, if no reply you get NULL and if an error you get an error. So in the case you get an error or NULL you just want to return 0 for the NULL as it's successful, and error otherwise. Would using PTR_ERR_OR_ZERO make smatch happy? (even if it's not really what we want). Dave. > > New smatch warnings: > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:659 > r535_gsp_rpc_rm_ctrl_push() warn: passing zero to 'PTR_ERR' > drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c:1063 r535_dp_aux_xfer() warn: > passing a valid pointer to 'PTR_ERR' > > Old smatch warnings: > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1887 nvkm_gsp_radix3_sg() > error: uninitialized symbol 'addr'. > > vim +/PTR_ERR +659 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > > af265ee961627a Dave Airlie 2023-12-22 649 static int > af265ee961627a Dave Airlie 2023-12-22 650 r535_gsp_rpc_rm_ctrl_push(struct > nvkm_gsp_object *object, void **argv, u32 repc) > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 651 { > af265ee961627a Dave Airlie 2023-12-22 652 rpc_gsp_rm_control_v03_00 > *rpc = container_of((*argv), typeof(*rpc), params); > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 653 struct nvkm_gsp *gsp = > object->client->gsp; > af265ee961627a Dave Airlie 2023-12-22 654 int ret = 0; > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 655 > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 656 rpc = nvkm_gsp_rpc_push(gsp, > rpc, true, repc); > af265ee961627a Dave Airlie 2023-12-22 657 if (IS_ERR_OR_NULL(rpc)) { > af265ee961627a Dave Airlie 2023-12-22 658 *argv = NULL; > af265ee961627a Dave Airlie 2023-12-22 @659 return PTR_ERR(rpc); > > If nvkm_gsp_rpc_push() returns NULL (probably a failure) then this > returns PTR_ERR(NULL) which is zero/success. > > af265ee961627a Dave Airlie 2023-12-22 660 } > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 661 > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 662 if (rpc->status) { > af265ee961627a Dave Airlie 2023-12-22 663 ret = > r535_rpc_status_to_errno(rpc->status); > 555bb9c29a45be Dave Airlie 2023-12-22 664 if (ret != -EAGAIN) > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 665 > nvkm_error(&gsp->subdev, "cli:0x%08x obj:0x%08x ctrl cmd:0x%08x failed: > 0x%08x\n", > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 666 > object->client->object.handle, object->handle, rpc->cmd, rpc->status); > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 667 } > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 668 > af265ee961627a Dave Airlie 2023-12-22 669 if (repc) > af265ee961627a Dave Airlie 2023-12-22 670 *argv = rpc->params; > af265ee961627a Dave Airlie 2023-12-22 671 else > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 672 > nvkm_gsp_rpc_done(gsp, rpc); > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 673 > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 674 return ret; > 4cf2c83eb3a4c4 Ben Skeggs 2023-09-19 675 } > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki >
[git pull] drm fixes for 6.8
Hi Linus, These were from over the holiday period, mainly i915, a couple of qaic, bridge and an mgag200. I have a set of nouveau fixes that I'll send after this, that might be too rich for you at this point. I expect there might also be some more regular fixes before 6.8, but they should be minor. Dave. drm-fixes-2024-01-04: drm fixes for 6.8 qaic: - fix GEM import - add quirk for soc version bridge: - parade-ps8640, ti-sn65dsi86: fix aux reads bounds mgag200: - fix gamma LUT init i915: - Fix bogus DPCD rev usage for DP phy test pattern setup - Fix handling of MMIO triggered reports in the OA buffer The following changes since commit 610a9b8f49fbcf1100716370d3b5f6f884a2835a: Linux 6.7-rc8 (2023-12-31 12:51:25 -0800) are available in the Git repository at: git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2024-01-04 for you to fetch changes up to faa21f4c20960fee268bdb0fe977ed0edb6685fe: Merge tag 'drm-misc-fixes-2024-01-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2024-01-04 11:18:32 +1000) drm fixes for 6.8 qaic: - fix GEM import - add quirk for soc version bridge: - parade-ps8640, ti-sn65dsi86: fix aux reads bounds mgag200: - fix gamma LUT init i915: - Fix bogus DPCD rev usage for DP phy test pattern setup - Fix handling of MMIO triggered reports in the OA buffer Dave Airlie (2): Merge tag 'drm-intel-fixes-2023-12-28' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes Merge tag 'drm-misc-fixes-2024-01-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes Douglas Anderson (3): drm/bridge: parade-ps8640: Never store more than msg->size bytes in AUX xfer drm/bridge: ti-sn65dsi86: Never store more than msg->size bytes in AUX xfer drm/bridge: ps8640: Fix size mismatch warning w/ len Jeffrey Hugo (1): accel/qaic: Implement quirk for SOC_HW_VERSION Jocelyn Falempe (1): drm/mgag200: Fix gamma lut not initialized for G200ER, G200EV, G200SE Khaled Almahallawy (1): drm/i915/dp: Fix passing the correct DPCD_REV for drm_dp_set_phy_test_pattern Pranjal Ramajor Asha Kanojiya (1): accel/qaic: Fix GEM import path code Umesh Nerlige Ramappa (1): drm/i915/perf: Update handling of MMIO triggered reports drivers/accel/qaic/mhi_controller.c | 15 +++- drivers/accel/qaic/qaic_data.c | 6 ++--- drivers/gpu/drm/bridge/parade-ps8640.c | 7 +++--- drivers/gpu/drm/bridge/ti-sn65dsi86.c| 4 +++- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- drivers/gpu/drm/i915/i915_perf.c | 39 drivers/gpu/drm/mgag200/mgag200_drv.h| 5 drivers/gpu/drm/mgag200/mgag200_g200er.c | 5 drivers/gpu/drm/mgag200/mgag200_g200ev.c | 5 drivers/gpu/drm/mgag200/mgag200_g200se.c | 5 drivers/gpu/drm/mgag200/mgag200_mode.c | 10 11 files changed, 83 insertions(+), 20 deletions(-)
Re: [PATCH] [v2] drm/vmwgfx: fix a memleak in vmw_gmrid_man_get_node
On Mon, Dec 4, 2023 at 4:15 AM Zhipeng Lu wrote: > > When ida_alloc_max fails, resources allocated before should be freed, > including *res allocated by kmalloc and ttm_resource_init. > > Fixes: d3bcb4b02fe9 ("drm/vmwgfx: switch the TTM backends to self alloc") > Signed-off-by: Zhipeng Lu > --- > > Changelog: > > v2: Adding {} to correct the if statement > --- > drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c > index ceb4d3d3b965..a0b47c9b33f5 100644 > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c > @@ -64,8 +64,11 @@ static int vmw_gmrid_man_get_node(struct > ttm_resource_manager *man, > ttm_resource_init(bo, place, *res); > > id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL); > - if (id < 0) > + if (id < 0) { > + ttm_resource_fini(man, *res); > + kfree(*res); > return id; > + } > > spin_lock(&gman->lock); Thanks, I pushed it to drm-misc-next. z
Re: [PATCH] drm/vmwgfx: fix kernel-doc Excess struct member 'base'
On Fri, Dec 15, 2023 at 6:56 PM Randy Dunlap wrote: > > Fix a new kernel-doc warning reported by kernel test robot: > > vmwgfx_surface.c:55: warning: Excess struct member 'base' description in > 'vmw_user_surface' > > The other warning is not correct: it is confused by "__counted_by". > Kees has made a separate patch for that. > > In -Wall mode, kernel-doc still reports 20 warnings of this nature: > vmwgfx_surface.c:198: warning: No description found for return value of > 'vmw_surface_dma_size' > but I am not addressing those. > > Signed-off-by: Randy Dunlap > Reported-by: kernel test robot > Closes: > https://lore.kernel.org/oe-kbuild-all/202312150701.kni9lum3-...@intel.com/ > Cc: Kees Cook > Cc: Zack Rusin > Cc: VMware Graphics Reviewers > Cc: dri-devel@lists.freedesktop.org > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Thomas Zimmermann > --- > drivers/gpu/drm/vmwgfx/vmwgfx_surface.c |1 - > 1 file changed, 1 deletion(-) > > diff -- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c > @@ -44,7 +44,6 @@ > * struct vmw_user_surface - User-space visible surface resource > * > * @prime: The TTM prime object. > - * @base: The TTM base object handling user-space visibility. > * @srf:The surface metadata. > * @master: Master of the creating client. Used for security check. > */ Thanks, looks great. I went ahead and pushed this one to drm-misc-next. z
Re: [PATCH V2] drivers: gpu: drm: vmwgfx: fixed typos
On Fri, Dec 15, 2023 at 1:21 AM Randy Dunlap wrote: > > Hi-- > > On 12/14/23 22:01, Ghanshyam Agrawal wrote: > > Fixed multiple typos in vmwgfx_execbuf.c > > > > Signed-off-by: Ghanshyam Agrawal > > --- > > V2: > > Fixed some more typos suggested by codespell > > and the community. > > > > V1: > > Fixed multiple typos > > > > drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 8 > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > > b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > > index 36987ef3fc30..76aa72e8be73 100644 > > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c > > @@ -127,7 +127,7 @@ struct vmw_ctx_validation_info { > > * @func: Call-back to handle the command. > > * @user_allow: Whether allowed from the execbuf ioctl. > > * @gb_disable: Whether disabled if guest-backed objects are available. > > - * @gb_enable: Whether enabled iff guest-backed objects are available. > > + * @gb_enable: Whether enabled if guest-backed objects are available. > > "iff" normally means "if and only if" and its use in the kernel sources is > usually not a mistake. However, this one sounds dodgy to me (before your > change), > so it's OK IMO. Also, the line above it uses "if" for a similar comment. > > Maybe someone else knows better. Right, this one was "iff". I submitted a version of this without the iff change to drm-misc-next. z
Re: [PATCH v2 34/39] drm: bridge: dw_hdmi: switch to ->edid_read callback
Hi Jani, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.7-rc8 next-20240103] [cannot apply to drm-intel/for-linux-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-bridge-add-edid_read-hook-and-drm_bridge_edid_read/20240103-181513 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/a8f71940221fb085b8767f8123f496c9b36b22cc.1704276309.git.jani.nikula%40intel.com patch subject: [PATCH v2 34/39] drm: bridge: dw_hdmi: switch to ->edid_read callback config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240104/202401041305.nctmamoj-...@intel.com/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240104/202401041305.nctmamoj-...@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202401041305.nctmamoj-...@intel.com/ All warnings (new ones prefixed by >>): >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c:2473:3: warning: variable 'edid' >> is uninitialized when used here [-Wuninitialized] 2473 | edid->width_cm, edid->height_cm); | ^~~~ include/linux/dev_printk.h:155:39: note: expanded from macro 'dev_dbg' 155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~ include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg' 274 |dev, fmt, ##__VA_ARGS__) |^~~ include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call' 250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__) | ^~~ include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls' 248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__) | ^~~ include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls' 224 | func(&id, ##__VA_ARGS__); \ | ^~~ drivers/gpu/drm/bridge/synopsys/dw-hdmi.c:2461:25: note: initialize the variable 'edid' to silence this warning 2461 | const struct edid *edid; |^ | = NULL 1 warning generated. vim +/edid +2473 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 9aaf880ed4ee3c drivers/staging/imx-drm/imx-hdmi.cFabio Estevam 2013-11-29 2456 fcb55de55cf341 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Jani Nikula 2024-01-03 2457 static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi, ec971aaa6775cf drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Laurent Pinchart 2020-05-26 2458 struct drm_connector *connector) 9aaf880ed4ee3c drivers/staging/imx-drm/imx-hdmi.cFabio Estevam 2013-11-29 2459 { fcb55de55cf341 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Jani Nikula 2024-01-03 2460 const struct drm_edid *drm_edid; fcb55de55cf341 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Jani Nikula 2024-01-03 2461 const struct edid *edid; 9aaf880ed4ee3c drivers/staging/imx-drm/imx-hdmi.cFabio Estevam 2013-11-29 2462 9aaf880ed4ee3c drivers/staging/imx-drm/imx-hdmi.cFabio Estevam 2013-11-29 2463 if (!hdmi->ddc) ec971aaa6775cf drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Laurent Pinchart 2020-05-26 2464 return NULL; 9aaf880ed4ee3c drivers/staging/imx-drm/imx-hdmi.cFabio Estevam 2013-11-29 2465 fcb55de55cf341 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Jani Nikula 2024-01-03 2466 drm_edid = drm_edid_read_ddc(connector, hdmi->ddc); fcb55de55cf341 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c Jani Nikula 2024-01-03 2467 if (!drm_edid) { ec971aaa6775cf drivers/gpu/drm/bridge/synopsys/dw-hdmi.c L
Re: [PATCH] nightly.conf: Add the xe repo to drm-tip
On Wed, Jan 03, 2024 at 02:50:57PM +0100, Thomas Hellström wrote: On Tue, 2023-12-26 at 13:30 -0500, Rodrigo Vivi wrote: On Fri, Dec 22, 2023 at 12:36:39PM +0100, Thomas Hellström wrote: > Add the xe repo to drm-tip and the dim tools. > For now use the sha1 of the first drm-xe-next pull request for drm- > tip, > since that branch tip is currently adapted for our CI testing. > > Cc: Rodrigo Vivi > Cc: Lucas De Marchi > Cc: Oded Gabbay > Cc: daniel.vet...@ffwll.ch > Cc: Maarten Lankhorst > Cc: dim-to...@lists.freedesktop.org > Cc: dri-devel@lists.freedesktop.org > Cc: intel-...@lists.freedesktop.org > Signed-off-by: Thomas Hellström > --- > nightly.conf | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/nightly.conf b/nightly.conf > index 24126b61b797..accd3ff2cc39 100644 > --- a/nightly.conf > +++ b/nightly.conf > @@ -24,6 +24,10 @@ git://anongit.freedesktop.org/drm-tip > https://anongit.freedesktop.org/git/drm/drm-tip > https://anongit.freedesktop.org/git/drm/drm-tip.git > " > +drm_tip_repos[drm-xe]=" > +ssh://g...@gitlab.freedesktop.org/drm/xe/kernel.git > +https://gitlab.freedesktop.org/drm/xe/kernel.git > +" > drm_tip_repos[drm-intel]=" > ssh://git.freedesktop.org/git/drm/drm-intel > ssh://git.freedesktop.org/git/drm-intel > @@ -65,14 +69,17 @@ drm_tip_config=( > "drm drm-fixes" > "drm-misc drm-misc-fixes" > "drm-intel drm-intel-fixes" > + "drm-xedrm-xe-fixes" > > "drm drm-next" > "drm-misc drm-misc-next-fixes" > "drm-intel drm-intel-next-fixes" > + "drm-xedrm-xe-next-fixes" > > "drm-misc drm-misc-next" > "drm-intel drm-intel-next" > "drm-intel drm-intel-gt-next" > + "drm-xedrm-xe-next b6e1b7081768" yeap, up to this commit nothing else should change, but then we will need an extra rebase of the rest on top of drm/drm-next. But then we need to decide where these following patches will live: 880277f31cc69 drm/xe/guc: define LNL FW 2cfc5ae1b8267 drm/xe/guc: define PVC FW 52383b58eb8cf mei/hdcp: Also enable for XE bea27d7369855 mei: gsc: add support for auxiliary device created by Xe driver fcb3410197f05 fault-inject: Include linux/types.h by default. 8ebd9cd71f8ac drm/xe: Add PVC's PCI device IDs Will it be the topic/core-for-CI? or topic/xe-extras? or what? This sounds to me like topic/core-for-CI? Or is there any drawback with that? I think some of them are not really a "for CI". It's more like the workflow we are adopting e.g. with guc/huc, not sending it to linux-firmware until we are confident on what version we will start officially supporting. This one can't go to topic/core-for-CI neither: fcb3410197f05 fault-inject: Include linux/types.h by default. what it would do would be that we would not see the build error anymore, but everyone else would (and it's not a CI-only configuration). Unless it's merged to another branch, we shouldn't merge it. "52383b58eb8cf mei/hdcp: Also enable for XE" could be material for topic/core-for-CI and "8ebd9cd71f8ac drm/xe: Add PVC's PCI device IDs" could either be on that branch or another xe-specific one. Anyway, for the inclusion like this, after our CI is ready: Could we merge this patch already at this point, considering it will, at least for now, only update drm-tip with our fixes? ack Lucas De Marchi Thanks, /Thomas Acked-by: Rodrigo Vivi > > "drm-intel topic/core-for-CI" > "drm-misc topic/i915-ttm" > -- > 2.42.0 >