lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z72jKZ4SDJYmcFf2@louis-chauvet-laptop>
Date: Tue, 25 Feb 2025 12:02:01 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: José Expósito <jose.exposito89@...il.com>
Cc: hamohammed.sa@...il.com, simona@...ll.ch, melissa.srw@...il.com,
	maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
	tzimmermann@...e.de, airlied@...il.com,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/16] drm/vkms: Allow to configure CRTC writeback
 support via configfs

On 18/02/25 - 18:07, José Expósito wrote:
> When a CRTC is created, add a `writeback` file to allow to enable or
> disable writeback connector support
> 
> Co-developed-by: Louis Chauvet <louis.chauvet@...tlin.com>
> Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
> Signed-off-by: José Expósito <jose.exposito89@...il.com>
> ---
>  Documentation/gpu/vkms.rst           |  4 +++
>  drivers/gpu/drm/vkms/vkms_configfs.c | 47 ++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
> 
> diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst
> index da5157adfd79..4e87d8a81844 100644
> --- a/Documentation/gpu/vkms.rst
> +++ b/Documentation/gpu/vkms.rst
> @@ -93,6 +93,10 @@ Continue by creating one or more CRTCs::
>  
>    sudo mkdir /config/vkms/my-vkms/crtcs/crtc0
>  
> +CRTCs have 1 configurable attribute:
> +
> +- writeback: Enable or disable writeback connector support

Can we add: "by writing 1 or 0"?

> +
>  Once you are done configuring the VKMS instance, enable it::
>  
>    echo "1" | sudo tee /config/vkms/my-vkms/enabled
> diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c
> index 52205a8a9cb4..88037a57a138 100644
> --- a/drivers/gpu/drm/vkms/vkms_configfs.c
> +++ b/drivers/gpu/drm/vkms/vkms_configfs.c
> @@ -73,6 +73,52 @@ struct vkms_configfs_crtc {
>  #define crtc_item_to_vkms_configfs_crtc(item) \
>  	container_of(to_config_group((item)), struct vkms_configfs_crtc, group)
>  
> +static ssize_t crtc_writeback_show(struct config_item *item, char *page)
> +{
> +	struct vkms_configfs_crtc *crtc;
> +	bool writeback;
> +
> +	crtc = crtc_item_to_vkms_configfs_crtc(item);
> +
> +	mutex_lock(&crtc->dev->lock);
> +	writeback = vkms_config_crtc_get_writeback(crtc->config);
> +	mutex_unlock(&crtc->dev->lock);
> +
> +	return sprintf(page, "%d\n", writeback);
> +}
> +
> +static ssize_t crtc_writeback_store(struct config_item *item, const char *page,
> +				    size_t count)
> +{
> +	struct vkms_configfs_crtc *crtc;
> +	bool writeback;
> +
> +	crtc = crtc_item_to_vkms_configfs_crtc(item);
> +
> +	if (kstrtobool(page, &writeback))
> +		return -EINVAL;
> +
> +	mutex_lock(&crtc->dev->lock);
> +
> +	if (crtc->dev->enabled) {
> +		mutex_unlock(&crtc->dev->lock);
> +		return -EPERM;
> +	}
> +
> +	vkms_config_crtc_set_writeback(crtc->config, writeback);
> +
> +	mutex_unlock(&crtc->dev->lock);
> +
> +	return (ssize_t)count;
> +}
> +
> +CONFIGFS_ATTR(crtc_, writeback);
> +
> +static struct configfs_attribute *crtc_item_attrs[] = {
> +	&crtc_attr_writeback,
> +	NULL,
> +};
> +
>  static void crtc_release(struct config_item *item)
>  {
>  	struct vkms_configfs_crtc *crtc;
> @@ -92,6 +138,7 @@ static struct configfs_item_operations crtc_item_operations = {
>  };
>  
>  static const struct config_item_type crtc_item_type = {
> +	.ct_attrs	= crtc_item_attrs,
>  	.ct_item_ops	= &crtc_item_operations,
>  	.ct_owner	= THIS_MODULE,
>  };
> -- 
> 2.48.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ