On Tue, Nov 04, 2025 at 11:21:28AM +0100, Louis Chauvet wrote: > > > Le 03/11/2025 à 18:45, Marius Vlad a écrit : > > vkms is missing any kind of HPD (polling/irq), so add polling to handle > > hotplug events. > > Hi, Hi Louis, thanks for the quick reply! > > I am a bit surprised by this addition, we currently have hotplug/unplug in > VKMS using configFS, and it seems to work. The current "irq" system is > writing in configFS the status and call drm_kms_helper_hotplug_event after > the status is updated [1]. The situation is that the VKMS connectors/card are also being exposed through sysfs similar to real devices. That's where we trigger/simulate a connector hot-plug without physically unplugging cables. Wasn't aware that VKMS had something similar to that with ConfigFS, so that needs adjusting. > > I think the polling will not work, I read in the drm_kms_helper_poll_init > documentation that the connector is not polled if some connector flags are > not set [2]/[3]. In this case the loop will be no-op, but prior to the loop `changed` is set to `changed = dev->mode_config.delayed_event` [1] so the code at [2] will do run. > > If the polling works, I don't think it will be enough for the current VKMS > implementation. Currently setting status using configFS will do everything > synchronously: > - Set the connector status (next call to connector->detect will have the new > value) > - Call drm_kms_helper_hotplug_event > > With your implementation, I think you expect something to update > connector->status_changed in between, using polling if I understood > correctly, which will probably happen after the call to > drm_kms_helper_hotplug_event. Right, that's another path for VKMS.
[1] https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L769 [2] https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L846 > > [1]:https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/vkms/vkms_connector.c?ref_type=heads#L91-96 > [2]:https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L917-L918 > [3]:https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L793 > > > Signed-off-by: Marius Vlad <[email protected]> > > --- > > drivers/gpu/drm/vkms/vkms_drv.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c > > b/drivers/gpu/drm/vkms/vkms_drv.c > > index e8472d9b6e3b..ec815c42ef04 100644 > > --- a/drivers/gpu/drm/vkms/vkms_drv.c > > +++ b/drivers/gpu/drm/vkms/vkms_drv.c > > @@ -198,6 +198,9 @@ static int vkms_create(struct vkms_config *config) > > if (ret) > > goto out_devres; > > + /* init kms poll for handling hpd */ > > + drm_kms_helper_poll_init(&vkms_device->drm); > > + > > drm_client_setup(&vkms_device->drm, NULL); > > return 0; > > @@ -240,6 +243,7 @@ static void vkms_destroy(struct vkms_config *config) > > fdev = config->dev->faux_dev; > > + drm_kms_helper_poll_fini(&config->dev->drm); > > drm_dev_unregister(&config->dev->drm); > > drm_atomic_helper_shutdown(&config->dev->drm); > > devres_release_group(&fdev->dev, NULL); > > -- > -- > Louis Chauvet, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >
signature.asc
Description: PGP signature
