From patchwork Wed Oct 23 14:49:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11206971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AE3E112B for ; Wed, 23 Oct 2019 14:50:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52FCA21906 for ; Wed, 23 Oct 2019 14:50:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52FCA21906 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED7EF6E0F1; Wed, 23 Oct 2019 14:50:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB8D56EAEF for ; Wed, 23 Oct 2019 14:50:03 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id c22so10844620wmd.1 for ; Wed, 23 Oct 2019 07:50:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TgNcxEwD/Rw+XsHHUoWKtnyQ7Kd75vAYAE7l7GYdjMw=; b=TffrRr5UBidelHp/a+K1U1iUFhbZPKVsuyLwDGH7MCXMXEWEaOF4zZ7vkCro3LPsP6 DGaiLG1bTzuiNu9e3MPdnW+RoVNIRVhMtpKUmC33SqOzXRKipfhd1UpJKyPaY4fKXj7B ASfYYKFm5l9dFMfr6D6pTUPoUCrdR6lXzBseWqMn5RJf6HKzR3kPKtWiSTIBydhjnwNG 6ZYIJVL23HetJ8g+8D6kwZfZK3/F+JEDAmmHT5iH0H1tKCs4iSz/qEVUJTMQfnqykwDw emEyw3YvGIvktOJ3JxR9femMhuOpV95nlNW5IOVL78k2IXoDryctIUUp82qc/1PWvCKf yZ4g== X-Gm-Message-State: APjAAAVymj1XemR6BAM716FkQeBD4kx+/OT+WNwcUYlQ+d/IdSbED6Rb QkN8Yv7zy5PZgMHHyKNIPD7fZp4FIPU= X-Google-Smtp-Source: APXvYqxBybYZhBzgCwl8sjJ1UHbUbu9xiERzLdeA22Nqrezpw1E1ihlJAn/cLHEHT8CYvoFqDh8h8Q== X-Received: by 2002:a1c:dd06:: with SMTP id u6mr261130wmg.109.1571842202346; Wed, 23 Oct 2019 07:50:02 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id z125sm29614190wme.37.2019.10.23.07.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 07:49:59 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Wed, 23 Oct 2019 16:49:52 +0200 Message-Id: <20191023144953.28190-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TgNcxEwD/Rw+XsHHUoWKtnyQ7Kd75vAYAE7l7GYdjMw=; b=WGzE7qffBMivLCljiUXSRqpVN97SZOL/56BMB9CMFOMsN0qHEJRDyLLPJpmGZ6OUiW P4Vf/TDutlZKpZLOz8HwOWTfTjkMKWBlnm6xmFq4ZYgPblEV+uWiu2vsQacqkTymj+6U dnVIX/7SAFgNX8tHFNpel1YTG23II2Pb673/k= Subject: [Intel-gfx] [PATCH 1/2] drm/property: Enforce more lifetime rules X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Rajat Jain , Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Properties can't be attached after registering, userspace would get confused (no one bothers to reprobe really). - Add kerneldoc - Enforce this with some checks. This needs a somewhat ugly check since connectors can be added later on, but we still need to attach all properties before they go public. Note that we already enforce that properties themselves are created before the entire device is registered. Cc: Jani Nikula Cc: Rajat Jain Signed-off-by: Daniel Vetter Reviewed-by: Thierry Reding Reviewed-by: Jani Nikula --- drivers/gpu/drm/drm_mode_object.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 6a23e36ed4fe..35c2719407a8 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -224,12 +224,26 @@ EXPORT_SYMBOL(drm_mode_object_get); * This attaches the given property to the modeset object with the given initial * value. Currently this function cannot fail since the properties are stored in * a statically sized array. + * + * Note that all properties must be attached before the object itself is + * registered and accessible from userspace. */ void drm_object_attach_property(struct drm_mode_object *obj, struct drm_property *property, uint64_t init_val) { int count = obj->properties->count; + struct drm_device *dev = property->dev; + + + if (obj->type == DRM_MODE_OBJECT_CONNECTOR) { + struct drm_connector *connector = obj_to_connector(obj); + + WARN_ON(!dev->driver->load && + connector->registration_state == DRM_CONNECTOR_REGISTERED); + } else { + WARN_ON(!dev->driver->load && dev->registered); + } if (count == DRM_OBJECT_MAX_PROPERTY) { WARN(1, "Failed to attach object property (type: 0x%x). Please " From patchwork Wed Oct 23 14:49:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11206975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C022813BD for ; Wed, 23 Oct 2019 14:50:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A819C21906 for ; Wed, 23 Oct 2019 14:50:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A819C21906 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F1C416EAF2; Wed, 23 Oct 2019 14:50:07 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 363A86EAF2 for ; Wed, 23 Oct 2019 14:50:07 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id r141so10365093wme.4 for ; Wed, 23 Oct 2019 07:50:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hI++rq87/vzhhNCoiGKRBhfGgl78W1Dui9zd3x/qQ6w=; b=JK02Z/Q0B6V/fFVgfKEG1jNY3OR+wYvqWdaj67Vw+UvP4HOJ69gLKftXQaa95VO1MP 3T4x1QFcm2hSqZKJ2TpdDjuTbTMrqhx1XEvXCG4u+OzMrwGJ4jP9jSyKY0MKywTlnLgU UYRH6/NlVrGsOAxeVdqHq+E4L4uHdJpNJRWrg19ujMCsWKjtkAL0+lzZksM5hlqPsfOX U4a/mpOy9n1hVeYW3MDRR3ZLrK0xRzbl3FSUay+kyHyPNJChf+K7ipT/QWxrY8Y3Vh/s pexeh9jOcu/S0Or0pv7g9Qkwy7+HJ6eFx0WEo97C06/9Pi8oCkvdTsr8+UzyUeBeKLib TxTg== X-Gm-Message-State: APjAAAVUUR1kR8OJ8nVhF9P96pHx4g5sKwsj4cm3t4czDK2AzYAwE5uF /NstpWaXAUk632Rbx6wUi87S+A== X-Google-Smtp-Source: APXvYqz6SKA1161CLMMgJ+Bb7B3GJ2UJet2eQgt0IepdWzg0DsNtFTJCakql9yy/ZLRrb4nH2k81nA== X-Received: by 2002:a1c:7401:: with SMTP id p1mr267890wmc.144.1571842205591; Wed, 23 Oct 2019 07:50:05 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id z125sm29614190wme.37.2019.10.23.07.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 07:50:02 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Wed, 23 Oct 2019 16:49:53 +0200 Message-Id: <20191023144953.28190-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191023144953.28190-1-daniel.vetter@ffwll.ch> References: <20191023144953.28190-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hI++rq87/vzhhNCoiGKRBhfGgl78W1Dui9zd3x/qQ6w=; b=T5ZB9xenAjjIIKo5qRh3lmAZbur2qrfnZtFve4tLR8MQANz2jUmcpDG3iSzhQJBkBH aSPzPD+ZjNBnZEFJ6stEhPneyEMQdLFxQ+L8c9q0/KmsgxpwYvY+L5sz8mxo6igX3/47 a80RXwxP5ZraAz1L4j+T9YOG8W6AcHFP9o35Q= Subject: [Intel-gfx] [PATCH 2/2] drm/todo: Add entry to remove load/unload hooks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Deucher , Daniel Vetter , Intel Graphics Development , Harry Wentland , Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" They're midlayer, broken, and because of the old gunk, we can't fix them. For examples see the various checks in drm_mode_object.c against dev->registered, which cannot be enforced if the driver still uses the load hook. Unfortunately our biggest driver still uses load/unload, so this would be really great to get fixed. Cc: Alex Deucher Cc: Harry Wentland Signed-off-by: Daniel Vetter Reviewed-by: Thierry Reding --- Documentation/gpu/todo.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 73c51b5a0997..5a44f46380c2 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -351,6 +351,23 @@ connector register/unregister fixes Level: Intermediate +Remove load/unload callbacks from all non-DRIVER_LEGACY drivers +--------------------------------------------------------------- + +The load/unload callbacks in struct &drm_driver are very much midlayers, plus +for historical reasons they get the ordering wrong (and we can't fix that) +between setting up the &drm_driver structure and calling drm_dev_register(). + +- Rework drivers to no longer use the load/unload callbacks, directly coding the + load/unload sequence into the driver's probe function. + +- Once all non-DRIVER_LEGACY drivers are converted, disallow the load/unload + callbacks for all modern drivers. + +Contact: Daniel Vetter + +Level: Intermediate + Core refactorings =================