From nobody Mon Feb 9 09:32:22 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4189A322B9E for ; Mon, 22 Dec 2025 10:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398363; cv=none; b=kNv0U0rc0H5fpgQfyXakHMgXqtpd6+Vc23gsCrxYnwDAyuuM0OYnJLHzH7/qqbsJdi12xh/R6cR5QYE7RqZpggIUG+QNuZlZmN1VkCjEnCpe1OYm1cWqReJzOSO7vJcl3GGFZ3WgyeIVN0PMlq19tRXzYPVz+y6kKbLlxFSGEDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766398363; c=relaxed/simple; bh=cl8tG4qtFzsCp8zzIFZIkraQNRqrm8LmoP3yMF+oXaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W4BWLq1A9OxaqH1shlFTpde3+g/KyNABDBkgpnYCj8zfIJZF34x/5WF3c1UVo3jZUoiaZtc+MXhNmc3IZrU0sQ/1ws8+WKAqKXweb377RB5z9zLwfxyw0nVT+ePYEIaSvNseNNSJ6gh0aBsxUcIxHUeKH9YqqRniiDBeHs1/xqM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=CR1sNsc5; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="CR1sNsc5" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E0CE81A2373; Mon, 22 Dec 2025 10:12:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B6CEC606C1; Mon, 22 Dec 2025 10:12:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id F1C7110AB01A1; Mon, 22 Dec 2025 11:12:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1766398358; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=leEQUM/D0frCB8WsJTkJzyoJM1iUZ4sosJdWRFn8k1k=; b=CR1sNsc5mMDY9dCd7wq38cTs4u/4aOSD/55b2u0UzUWKOJgyURLICLoeROQP3daKVDnTrU 5v9311XQnFx1KE0SWIPJzUjxRJa48mFSVLOTglWHwt+oRQ8bBwy+jWRRmrcbt09Gnk3WOQ 6gFGxKArNZcvMdWg+IjlHXAHdbtpvh1/XQh0yhdhBmEOPLcqC0NdAk3TaOXAVigs94EVPa fmaNWlyjKPBZrBM+QlIWKF71EGONSgGk2ufAFsj8c5Cpb5oIFvrzckUbnax6LgYuJFix2Z 2vpCdPdmg6xCX3Df+obnhYJ1cXXPFKZfEFiHhf0oZMUtrQYeX5oxHjGcpNrz6w== From: Louis Chauvet Date: Mon, 22 Dec 2025 11:11:30 +0100 Subject: [PATCH v3 28/33] drm/vkms: Introduce configfs for connector EDID Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-vkms-all-config-v3-28-ba42dc3fb9ff@bootlin.com> References: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> In-Reply-To: <20251222-vkms-all-config-v3-0-ba42dc3fb9ff@bootlin.com> To: Haneen Mohammed , Simona Vetter , Melissa Wen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , jose.exposito89@gmail.com, Jonathan Corbet Cc: victoria@system76.com, sebastian.wick@redhat.com, victoria@system76.com, airlied@gmail.com, thomas.petazzoni@bootlin.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Louis Chauvet , Luca Ceresoli X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6440; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=cl8tG4qtFzsCp8zzIFZIkraQNRqrm8LmoP3yMF+oXaE=; b=owEBiQJ2/ZANAwAIASCtLsZbECziAcsmYgBpSRlDdxpCFERYmAaf45qESPVSBWxU5pI4HM+J7 noGn52eLz+JAk8EAAEIADkWIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCaUkZQxsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMSwyLDIACgkQIK0uxlsQLOJXTA//YBk7ddaHabqwQrBzB3gRtpI5qlbv29j b2QO8/CQe6Bvm7ZRvbj0nxDTMKmPiooUrqXoc1IMOqBNRP01pyPnmh4jRQR5R8HcD8AZ/rNf7tX nrS2H4TdJNwRlxCUnuLQHMfuJo8EOi4zY7/3RD7+6XaGG2OJqSVg+g+3Wa//nNiz97b8xXDIPO1 xalTjDN9sTAIwhgTFNpmzvR+zyXV3cGXWOuW6lmbFgbXdYu3HgUPHhCFFUXWzCE/XLmY/HRhYOr VtsNVYdlCnVumiNutJgqqtZSPmMmukXK95Pj8Lb3LGSDTk4HW2YZUon1dqaaCM2pMlDCKWmiTu1 T7rQgsLzYFoJue+HiR/HIyMFHcSrs98jQmFolg4GNv0g+bPxCCl0ETr0G6FwydjUNZkwNBUvW+5 ya2UTIpoJVmEay36dgYmtqN4Q2g/4//6dIJriE8Sf5ATNvmxOMaqWKZhdyL//TkyO41CNJt7zCH QCQ4A8gThXJVlEAb1AdcZyxX/oVsP9bV6+Ls5SftZhckWMXHEjN9X9qh4mBWxcY/+QQVAtAIDz8 Ly5wIaZP1CdLvod7FSAEwuWiSVkEWPQYSynmaAWTV80rGnlZzH/tSd3t7x2dxILjbFvlC5Ov0BK 2f7uLkTcin26ChnSimDnOkKI1+fotO+1iQhsFQT791e2tbV7yNlQ= X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-Last-TLS-Session-Version: TLSv1.3 Introduce new attributes to configure EDID of a connector: - edid_enable - chose if the connector will have an EDID or not - edid - raw edid content Due to limitation of ConfigFS, the max len of EDID is PAGE_SIZE (4kB on x86), it should be sufficient for many tests. One possible evolution is using a ConfigFS blob to allow bigger EDID. Reviewed-by: Luca Ceresoli Signed-off-by: Louis Chauvet --- Documentation/ABI/testing/configfs-vkms | 14 ++++++ Documentation/gpu/vkms.rst | 5 ++- drivers/gpu/drm/vkms/vkms_configfs.c | 80 +++++++++++++++++++++++++++++= ++++ drivers/gpu/drm/vkms/vkms_connector.c | 3 ++ 4 files changed, 101 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/configfs-vkms b/Documentation/ABI/te= sting/configfs-vkms index f750e616be54..4061ada5d88b 100644 --- a/Documentation/ABI/testing/configfs-vkms +++ b/Documentation/ABI/testing/configfs-vkms @@ -48,6 +48,20 @@ Description: Value is a bitfield, where 0x1 =3D NO_DATA, 0x2 =3D SMPTE_170M_YCC, etc. See enum drm_colorspace for full list. =20 +What: /sys/kernel/config/vkms//connectors//edid_enabled +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Enable or disable EDID for this connector. Value: + 1 - enabled, 0 - disabled. + +What: /sys/kernel/config/vkms//connectors//edid +Date: Nov 2025 +Contact: dri-devel@lists.freedesktop.org +Description: + Content of the EDID for this connector. Ignored if + edid_enabled is not set. + What: /sys/kernel/config/vkms//connectors//possible_en= coders Date: Nov 2025 Contact: dri-devel@lists.freedesktop.org diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst index 1c4a8023374c..60367fd1bd65 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -138,7 +138,7 @@ Last but not least, create one or more connectors:: =20 sudo mkdir /config/vkms/my-vkms/connectors/connector0 =20 -Connectors have 3 configurable attribute: +Connectors have 5 configurable attribute: =20 - status: Connection status: 1 connected, 2 disconnected, 3 unknown (same = values as those exposed by the "status" property of a connector) @@ -147,6 +147,9 @@ Connectors have 3 configurable attribute: If supported_colorspaces is not 0, the HDR_OUTPUT_METADATA will also be = created. Value is a bitfield, 0x1 =3D NO_DATA, 0x2 =3D SMPTE_170M_YCC... see enum= drm_colorspace for full list. +- edid_enabled: Enable or not EDID for this connector. Some connectors may= not have an + EDID but just a list of modes, this attribute allows to disable EDID pro= perty. +- edid: Content of the EDID. Ignored if edid_enabled is not set =20 =20 To finish the configuration, link the different pipeline items:: diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vk= ms_configfs.c index 90bf6e6995ae..20f5150e8b24 100644 --- a/drivers/gpu/drm/vkms/vkms_configfs.c +++ b/drivers/gpu/drm/vkms/vkms_configfs.c @@ -1271,14 +1271,94 @@ static ssize_t connector_supported_colorspaces_stor= e(struct config_item *item, return count; } =20 +static ssize_t connector_edid_enabled_show(struct config_item *item, char = *page) +{ + struct vkms_configfs_connector *connector; + bool enabled; + + connector =3D connector_item_to_vkms_configfs_connector(item); + + scoped_guard(mutex, &connector->dev->lock) + enabled =3D vkms_config_connector_get_edid_enabled(connector->config); + + return sprintf(page, "%d\n", enabled); +} + +static ssize_t connector_edid_enabled_store(struct config_item *item, + const char *page, size_t count) +{ + struct vkms_configfs_connector *connector; + struct vkms_config_connector *connector_cfg; + bool enabled; + + connector =3D connector_item_to_vkms_configfs_connector(item); + connector_cfg =3D connector->config; + + if (kstrtobool(page, &enabled)) + return -EINVAL; + + scoped_guard(mutex, &connector->dev->lock) + { + vkms_config_connector_set_edid_enabled(connector_cfg, enabled); + + if (connector->dev->enabled && + vkms_config_connector_get_status(connector_cfg) !=3D + connector_status_disconnected) + vkms_trigger_connector_hotplug(connector->dev->config->dev); + } + return count; +} + +static ssize_t connector_edid_show(struct config_item *item, char *page) +{ + struct vkms_configfs_connector *connector; + + connector =3D connector_item_to_vkms_configfs_connector(item); + + scoped_guard(mutex, &connector->dev->lock) + { + unsigned int len =3D 0; + const u8 *edid =3D vkms_config_connector_get_edid(connector->config, &le= n); + + memcpy(page, edid, min(len, PAGE_SIZE)); + return min(len, PAGE_SIZE); + } + + return -EINVAL; +} + +static ssize_t connector_edid_store(struct config_item *item, + const char *page, size_t count) +{ + struct vkms_configfs_connector *connector; + + connector =3D connector_item_to_vkms_configfs_connector(item); + + scoped_guard(mutex, &connector->dev->lock) + { + vkms_config_connector_set_edid(connector->config, page, count); + + if (connector->dev->enabled && + vkms_config_connector_get_status(connector->config) !=3D + connector_status_disconnected) + vkms_trigger_connector_hotplug(connector->dev->config->dev); + } + + return count; +} + CONFIGFS_ATTR(connector_, status); CONFIGFS_ATTR(connector_, type); CONFIGFS_ATTR(connector_, supported_colorspaces); +CONFIGFS_ATTR(connector_, edid_enabled); +CONFIGFS_ATTR(connector_, edid); =20 static struct configfs_attribute *connector_item_attrs[] =3D { &connector_attr_status, &connector_attr_type, &connector_attr_supported_colorspaces, + &connector_attr_edid_enabled, + &connector_attr_edid, NULL, }; =20 diff --git a/drivers/gpu/drm/vkms/vkms_connector.c b/drivers/gpu/drm/vkms/v= kms_connector.c index c85d19013720..311858727175 100644 --- a/drivers/gpu/drm/vkms/vkms_connector.c +++ b/drivers/gpu/drm/vkms/vkms_connector.c @@ -143,6 +143,9 @@ struct vkms_connector *vkms_connector_init(struct vkms_= device *vkmsdev, =20 drm_connector_helper_add(&connector->base, &vkms_conn_helper_funcs); =20 + if (vkms_config_connector_get_edid_enabled(connector_cfg)) + drm_connector_attach_edid_property(&connector->base); + return connector; } =20 --=20 2.51.2