Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FD7CC48BE5 for ; Wed, 16 Jun 2021 14:15:46 +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 13A3060FF4 for ; Wed, 16 Jun 2021 14:15:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13A3060FF4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 615026E58A; Wed, 16 Jun 2021 14:15:45 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FB296E55C for ; Wed, 16 Jun 2021 14:15:42 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AC6565C00AD; Wed, 16 Jun 2021 10:15:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 16 Jun 2021 10:15:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=3dtHcBV3tS8vF 0DKoVI8uru7i7UpqZ4KJaobGxNtttI=; b=3k59SEegZuGLSA9PebY0gVdB7w+m3 z7jCuQK42EMVyKWDf+3hFVJ6K4HfjT+KvqIAipi3WmdyTA6x5aia9m0qNq2DJDT6 BHxcBD5itGcKUCHjvLlVvaTRlWmMLgxTpsVz/c2LnReylXNeQx/ZMSm5VlSaMenu T7c5Ywuk96Nu2+grBVVzQ8AIT6/1Vb7xKZ7lDNm1PhwqiMMifIkidWQKe3FfP7Cy boIj1QELVU+iWw/lGoH/cj6FW/lJHCrUPWygtyVgXxuyxxR2090pZAGa2ldLOjOO 7tA57UNj1lrKD635dfKCNmH+bL7BHuXr1gGjBDWDJRcK0fklL0r1hqzpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=3dtHcBV3tS8vF0DKoVI8uru7i7UpqZ4KJaobGxNtttI=; b=ZrIjQ10v znZueIhgxG+Qp5+gUrsKahPwfTjerxvDMpUSCWFZhe01513HQLV9j3s3yhhggddi GAnp+nj64gM1etGSqoHSYORBM38qcfkEmMuHJ4RshYn6uSCEqVb8nqKZDVSbe4ap sLE/Q7vhDqIXA68Yb2Iy1siITiLWrxv1xE2SYkM5VV4zd38i+nkmKTRD/+49hbF9 FLSRTLlCA6QKNhRx3Zy2MJcnFt2jiDgbe3lifQhafHuqhBjrHxdvZnmqs4RRC13k raqI5YXyWagJnfG1fabRmCjm2S4W/x2vwN65+BOqiomRsxe3kp/4BoD//Odz6Pmz 9iTr2Xrg3bLdPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvledgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Jun 2021 10:15:41 -0400 (EDT) From: Maxime Ripard To: Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Subject: [PATCH v2 3/3] drm: Mention the power state requirement on side-channel operations Date: Wed, 16 Jun 2021 16:15:29 +0200 Message-Id: <20210616141529.630719-3-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616141529.630719-1-maxime@cerno.tech> References: <20210616141529.630719-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The drm_connector detect, drm_dp_aux transfer and mipi_dsi_host operations typically require to access their underlying device to perform what is expected of them. However, there's no guarantee on the fact that the device has been enabled through atomic_enable or similar that will usually power the device. The access to an unpowered device is then an undefined behaviour ranging from the access being ignored to a hard CPU hang. Let's document that expectation to avoid as much as possible those consequences. Signed-off-by: Maxime Ripard --- Changes from v1: - moved to the field documentation instead of the structure's --- include/drm/drm_connector.h | 5 +++++ include/drm/drm_dp_helper.h | 5 +++++ include/drm/drm_mipi_dsi.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 1922b278ffad..fae03a43d04f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -848,6 +848,11 @@ struct drm_connector_funcs { * locks to avoid races with concurrent modeset changes need to use * &drm_connector_helper_funcs.detect_ctx instead. * + * Also note that this callback can be called no matter the + * state the connector is in. Drivers that need the underlying + * device to be powered to perform the detection will first need + * to make sure it's been properly enabled. + * * RETURNS: * * drm_connector_status indicating the connector's status. diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 0cc6062ff3ad..cb673bc5b871 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1915,6 +1915,11 @@ struct drm_dp_aux { * The @transfer() function must only modify the reply field of * the &drm_dp_aux_msg structure. The retry logic and i2c * helpers assume this is the case. + * + * Also note that this callback can be called no matter the + * state @dev is in. Drivers that need that device to be powered + * to perform this operation will first need to make sure it's + * been properly enabled. */ ssize_t (*transfer)(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg); diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 360e6377e84b..849d3029e303 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -80,6 +80,11 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, * Note that typically DSI packet transmission is atomic, so the .transfer() * function will seldomly return anything other than the number of bytes * contained in the transmit buffer on success. + * + * Also note that those callbacks can be called no matter the state the + * host is in. Drivers that need the underlying device to be powered to + * perform these operations will first need to make sure it's been + * properly enabled. */ struct mipi_dsi_host_ops { int (*attach)(struct mipi_dsi_host *host, -- 2.31.1