From patchwork Mon Jul 1 03:23:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 11024735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 281BE746 for ; Mon, 1 Jul 2019 03:23:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B672849B for ; Mon, 1 Jul 2019 03:23:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B132284C9; Mon, 1 Jul 2019 03:23:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 267F72849B for ; Mon, 1 Jul 2019 03:23:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE8FF89D73; Mon, 1 Jul 2019 03:23:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF7BE89D73 for ; Mon, 1 Jul 2019 03:23:44 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id h24so10132606qto.0 for ; Sun, 30 Jun 2019 20:23:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=bafLLGxzRxByJVBG7vRwFnpyj42fKM5Pnwg7VF4Oo5w=; b=FQAtDGuQv/Ezqa8yftlp46A/xxnEQW1GQhvPT4yx7Uz498jkLfwWxM1yiTqaB2NhUN xxlKAN5ODmSy3yiPMywP+BeDoDUtsx5pr2kKj+jYV0fH6wiYabeoGf1zd9CPdRaAOPbd KRE/ZR5XrolM+iFk5Qqr5PpGRRQ5nhFdbnSjoi3iEBo2r8t4J0SbDe2f0+HEYdicYSLN +cP17XTaPY4alD9KMfR9eoXCgg8u7SVfug3BYRUlipsoi/bs8f0CgSI3FcRPxa+ngOqz eNS6x7Uysgngmz+ExSGfFTakfX0mNfUE6OYDMUUuVsJeUfvRxSBxwj3+L4PYFp+jTc++ FW6w== X-Gm-Message-State: APjAAAXUtebKZTDXMI+cmtksPhDNpNDh6wxXhk0q7lXruKFaWOhzrUie FH3zIloP0BJ52WMmdhx+jaY= X-Google-Smtp-Source: APXvYqxb4rpzh/Ir0dSJsyxBuujq9tbJs+bFK+AgE1Zha9YKieMGjOF9pP0kARj9zJyeg8uWeVNbPA== X-Received: by 2002:a0c:f9c1:: with SMTP id j1mr19298673qvo.235.1561951423846; Sun, 30 Jun 2019 20:23:43 -0700 (PDT) Received: from smtp.gmail.com ([187.121.151.22]) by smtp.gmail.com with ESMTPSA id l4sm4611434qtd.25.2019.06.30.20.23.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 20:23:43 -0700 (PDT) Date: Mon, 1 Jul 2019 00:23:39 -0300 From: Rodrigo Siqueira To: Daniel Vetter , Haneen Mohammed , David Airlie , Simon Ser Subject: [PATCH 0/2] drm/vkms: Introduce basic support for configfs Message-ID: MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=bafLLGxzRxByJVBG7vRwFnpyj42fKM5Pnwg7VF4Oo5w=; b=IJYrL6KMhAQ2gTf/9x/jTlmgJjybilb869TBwxd0iHT+NRLtXc2D4xPunWEcJJ2XW9 OcMUXGJ+3f3kxQa2WvKVwksvG0b49rj0MxaMoWelQPRxPjqXg/IX350QMd6LInDy+XUe hAucj63HrKLgbauP88cm6ONVzQ/WYLQH+5xiDPvZ0vKd4oWKMrxCzCgbdaTTeCM2i3ss 6mOX9Zn4zxwJAxqMrl4s9tCYyoRapU3WoVzHP9FyLWVY0VcMx9jV8WEcAEoUk6N50+g0 CGrSoz1CKGiPVwP6YvDgjZj769YIsrvzjAW9iv5cLW0e3xnQeUfuJtf0/EjAvARnrMFd pAkw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patchset introduces the support for configfs in vkms by adding a primary structure for handling the vkms subsystem and exposing connectors as a use case. This series allows enabling/disabling virtual and writeback connectors on the fly. The first patch of this series reworks the initialization and cleanup code of each type of connector, with this change, the second patch adds the configfs support for vkms. It is important to highlight that this patchset depends on https://patchwork.freedesktop.org/series/61738/. After applying this series, the user can utilize these features with the following steps: 1. Load vkms without parameter modprobe vkms 2. Mount a configfs filesystem mount -t configfs none /mnt/ After that, the vkms subsystem will look like this: vkms/ |__connectors |__Virtual |__ enable The connectors directories have information related to connectors, and as can be seen, the virtual connector is enabled by default. Inside a connector directory (e.g., Virtual) has an attribute named ‘enable’ which is used to enable and disable the target connector. For example, the Virtual connector has the enable attribute set to 1. If the user wants to enable the writeback connector it is required to use the mkdir command, as follows: cd /mnt/vkms/connectors mkdir Writeback After the above command, the writeback connector will be enabled, and the user could see the following tree: vkms/ |__connectors |__Virtual | |__ enable |__Writeback |__ enable If the user wants to remove the writeback connector, it is required to use the command rmdir, for example rmdir Writeback Another way to enable and disable a connector it is by using the enable attribute, for example, we can disable the Virtual connector with: echo 0 > /mnt/vkms/connectors/Virtual/enable And enable it again with: echo 1 > /mnt/vkms/connectors/Virtual/enable It is important to highlight that configfs 'obey' the parameters used during the vkms load and does not allow users to remove a connector directory if it was load via module parameter. For example: modprobe vkms enable_writeback=1 vkms/ |__connectors |__Virtual | |__ enable |__Writeback |__ enable If the user tries to remove the Writeback connector with “rmdir Writeback”, the operation will be not permitted because the Writeback connector was loaded with the modules. However, the user may disable the writeback connector with: echo 0 > /mnt/vkms/connectors/Writeback/enable Rodrigo Siqueira (2): drm/vkms: Add enable/disable functions per connector drm/vkms: Introduce configfs for enabling/disabling connectors drivers/gpu/drm/vkms/Makefile | 3 +- drivers/gpu/drm/vkms/vkms_configfs.c | 229 ++++++++++++++++++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 6 + drivers/gpu/drm/vkms/vkms_drv.h | 17 ++ drivers/gpu/drm/vkms/vkms_output.c | 84 ++++++---- drivers/gpu/drm/vkms/vkms_writeback.c | 31 +++- 6 files changed, 332 insertions(+), 38 deletions(-) create mode 100644 drivers/gpu/drm/vkms/vkms_configfs.c