From patchwork Sat Nov 30 23:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8223FD7361B for ; Sat, 30 Nov 2024 23:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dVandmEjl29fQ2g5/xmh15AXnmnKHqPEzmZef3xU4Eo=; b=ulchiC0Q07ZQm0u97/q4ls9dee YKIsPgH/SJ/LbJiZ3RKxXyGfi1HYD4t664tKpDX/KfVEQ+pB8t36NESqPPqk9GoPG+DB68rJAObVU X27YCm32Mlze0FUmpa7K5rxfkmVWmoX38ouEmZPh7Kdl9Uka+qJkpZP7wrlAcLvVQ6ozNzVdPdUqw oS+rsRfjWKi/YpBsfnUqtDTLpl5mbtAhgzxCpd4bOFa8cnKxBF7hmjywMxyLgwxlztGPn8GYz/lku UGN1vMPuNJTLpMjevfrAz8N+zSk83C54ILcaQjRSHPge20z9JsFznnl+jN9sMoXnANrDAIZx5Uxgd 8eWmPERg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXLB-00000002lVq-1cAE; Sat, 30 Nov 2024 23:57:33 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJF-00000002kmC-314X for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:34 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ffdbc0c103so42653691fa.3 for ; Sat, 30 Nov 2024 15:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010932; x=1733615732; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dVandmEjl29fQ2g5/xmh15AXnmnKHqPEzmZef3xU4Eo=; b=xRMFzmkZCAf4/C8/+lb84YdOYCBZTXSVePKFc8Rrn76DLndUv68kKUcNATTkRAZqiG zGqwAHlR/g8zSJLGv48wURJAEZDAd8sSz7AV/PtI27XXPTLLTjUX5dcMNPrW9vIyur+A /Ej+tgbu1tHsdbVKKgFRItG2Zp486f6wplKau4gp5wBv1qT+HtmrHXlpS18dVEu+jyB3 /zrEpU1O3ED0WQmaVXD+4XJXN7euShrcuW8MsopSmyfKK8TwkF5qXp5sYtYx+aqzbAB7 YW+gl5A+NlZLbC8yMxwO8bTD1NkeP9kBOu6g+l6HXu1uJoXjHn465516UZLCfJv41DOX pxJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010932; x=1733615732; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dVandmEjl29fQ2g5/xmh15AXnmnKHqPEzmZef3xU4Eo=; b=h1vGET8MTOsZRv5S/1Xwgl+qcfFmRoAVlZ1AvhE4gg7eZ5lN/IZBJ4aU8L9U40CRhy 4OF7g1AcMmhpEYOoR9zVxgKxV17zmpD++Izg7zz4LUhsWN3xZpz9zYr2KAGqVcqJOoUK m0fDgaO1Np78yKT4rPF5vz7dh76YCiLstQwye2wz6I6Jb5Gt9vXXiSzZB8XC9J46J05j QIypsPbblRdsNvdIPRg7ZgQic543z/IhYkCZgsQGne8+RNy6ebf0O3nXkv3n+aVj2xyz 0MYcA3d+2cgat7TBZaQrSypxUHtdUkkgHwJxLtJuLsRF6eZZvv70e8YRqDEJXyyVSrj4 OUrw== X-Forwarded-Encrypted: i=1; AJvYcCXwwIeKHd+OEy/QPv2Vp+cU1jpwzmiOUIIxvAasplTz0C1VYqjk7DYsMqROYf8VZTop0dNJTC5wF62TgzDG+41C@lists.infradead.org X-Gm-Message-State: AOJu0YyydsUIgn/e2dwdAeyURoymobWS1GYBR+t+IS04/Fw20K/A4DYZ 8WfPBx82pu4frQnmsZis1L1xZjrIi5Z3QnlP524KdXfawTyRbDUujyI6XOkFuZI= X-Gm-Gg: ASbGnctsmdDycGl57rBTS7Wok0cInBDAHN5h5151crNOWBpZ3LkiU59aeWc/kiwegVY rRss5XPvLEJ3xJZNX8HOtvS+OHVFeKZvPZklAig/iP4rOujOcIbXiVsgsU/g5D+G02Y2ImHBsqg uPba5C1FBIm13uqyFwF7m6qYOLtDmxboUA5wxljPhFlE0suk5reytRQP7nlHWyIbMqBJXhGz2OE bsEUD3cpLK5MffmSfH6t5jqoC/iUq1q0QcICuOKy4OimF70nQv2H/T1pQ== X-Google-Smtp-Source: AGHT+IFxIGZTCl2+FV0phQXK3nZn1ZVOLyIwEd2xBNXTWsJOfxd6ufDjErhJ/Bt/Wlo7yiHe3hXNJg== X-Received: by 2002:a05:6512:2316:b0:53d:dc3c:2595 with SMTP id 2adb3069b0e04-53df010b113mr13994153e87.44.1733010931778; Sat, 30 Nov 2024 15:55:31 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:30 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:18 +0200 Subject: [PATCH 01/10] drm/connector: add mutex to protect ELD from concurrent access MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-1-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2918; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=dRMlgzQ8g4adZeqAK73JToeVmDq3hWsW88+VTTxsaX4=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7r30refv/TKFDs8Y2WIFPVQT4z9p9Ztb63x/CrnBwOpu 9X8J3Z0MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAiMjXs/4xDs4XudBZPNPqn kCpyM6RdQOWzeLBy8ZPpGxftDLy97qNmD6N3i6urZu4ODovJnRfad3DHVKg/ur1et6Vl+2EZu0e yxsFXpq526Q8JCdBwub7SsPv3+VQt9zlV4VNuM1ZNmV8c+7DodCpXyU7/vuWHrAQTr0qLTuNJfi 7+yf7LHPf/M7MW/7y1/o8Gc8MR93DzonOcBczZHvd3Lw7grt9wxPWA+kK1QFnfw27Ndcwznj48a nBgd8lz5tieNl+W3a6z98Q22chfUj3lPm/rWpttiy+c9vhvfVDCs6/vap3TuncOXcc5NpTp6qxe uz/kevSCnWG2aS7lyg2/S68xCj6sOHHJgUnIzND4q0scAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155533_761776_49DB1412 X-CRM114-Status: GOOD ( 16.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The connector->eld is accessed by the .get_eld() callback. This access can collide with the drm_edid_to_eld() updating the data at the same time. Add drm_connector.eld_mutex to protect the data from concurrenct access. Individual drivers are not updated (to reduce possible issues while applying the patch), maintainers are to find a best suitable way to lock that mutex while accessing the ELD data. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_edid.c | 4 ++++ include/drm/drm_connector.h | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index fc35f47e2849ed6786d6223ac9c69e1c359fc648..bbdaaf7022b62d84594a29f1b60144920903a99a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -277,6 +277,7 @@ static int __drm_connector_init(struct drm_device *dev, INIT_LIST_HEAD(&connector->probed_modes); INIT_LIST_HEAD(&connector->modes); mutex_init(&connector->mutex); + mutex_init(&connector->eld_mutex); mutex_init(&connector->edid_override_mutex); mutex_init(&connector->hdmi.infoframes.lock); connector->edid_blob_ptr = NULL; diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 855beafb76ffbecf5c08d58e2f54bfb76f30b930..f0ca77bd42fd518d505d0db78557e0c8d83efb29 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5657,6 +5657,8 @@ static void drm_edid_to_eld(struct drm_connector *connector, if (!drm_edid) return; + mutex_lock(&connector->eld_mutex); + mnl = get_monitor_name(drm_edid, &eld[DRM_ELD_MONITOR_NAME_STRING]); drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD monitor %s\n", connector->base.id, connector->name, @@ -5717,6 +5719,8 @@ static void drm_edid_to_eld(struct drm_connector *connector, drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] ELD size %d, SAD count %d\n", connector->base.id, connector->name, drm_eld_size(eld), total_sad_count); + + mutex_unlock(&connector->eld_mutex); } static int _drm_edid_to_sad(const struct drm_edid *drm_edid, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index e3fa43291f449d70f3b92a00985336c4f2237bc6..1e2b25e204cb523d61d30f5409faa059bf2b86eb 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -2001,8 +2001,11 @@ struct drm_connector { struct drm_encoder *encoder; #define MAX_ELD_BYTES 128 - /** @eld: EDID-like data, if present */ + /** @eld: EDID-like data, if present, protected by @eld_mutex */ uint8_t eld[MAX_ELD_BYTES]; + /** @eld_mutex: protection for concurrenct access to @eld */ + struct mutex eld_mutex; + /** @latency_present: AV delay info from ELD, if found */ bool latency_present[2]; /** From patchwork Sat Nov 30 23:55:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17B48D7361B for ; Sat, 30 Nov 2024 23:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FgyD7a8KnGJ66sjxEdDPFFI8o7yH9d7qAC7Fc+pHT8w=; b=c8gt4h6gIBBnpKuYVdYu0RGIlx 4bGh4E9i6j+ZjTGq6DK0XU28foGANntXMemDkMvmdNYGKjB1onLwlvv0+w+n0G/bNc0EueTNuwL+3 sEUjTMimMiDqkYrnP97TblbL6n4t+nHldQZTHaip6ZU1roNBQrjrwVxbVjiax954UgNQ9mS7MHPOf WFxuT9Ddp/jUQV2lXzXUbHDSCGFySfdX1vC4Gu8fS2JP2JywIfYvHsLg1V3fSCG6T0dnIXWdCiMWp jEwVL5cTkr0jkSSe2EU249H2UTM026IWU2dZVMwsErakvLhrsIwDhGjK+CDRIgGkidgFeviIGRnN1 UXg3s+yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXM8-00000002lie-04gL; Sat, 30 Nov 2024 23:58:32 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJI-00000002kml-11z0 for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:37 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53dd57589c8so4272085e87.1 for ; Sat, 30 Nov 2024 15:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010934; x=1733615734; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FgyD7a8KnGJ66sjxEdDPFFI8o7yH9d7qAC7Fc+pHT8w=; b=mSUeRYBoSSfkO7NtBl49rHkPUJi/Ycyne7zn9AqPdj8WqjghgvlTakGpOhiJlqTBQF 52/9dt7k3KfIKIR7oMwMdTboHJ58kv34GsRP/b5vzRyvFRsTHASAXEco8d3of+39462r ZVAv47Tq52Raismi9BB3/sJacw5SOPzjTBhXr/kdvKs05RSv/5BmxuNUMPZbZzK2cBNN vY2oeSUJENmQEcW7CIAhiDb0eIh69hvLpsImXcLpoKnXRR+7Yd6Z8wC4fessBjyrtLj/ LFoq4onddJrcQGbZd0pBtjOv1O9qwXpCD3Gn5BP/Q4xJhp+Yh5zivqqvWwWKvXiCc9DM /oPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010934; x=1733615734; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FgyD7a8KnGJ66sjxEdDPFFI8o7yH9d7qAC7Fc+pHT8w=; b=h/1Ehg+sirPUZEV9ZDQXdiplreNu+632gXFsp/R50P23i5t+z/19NGHPnBy8VMsXHj rannZdbzGecQwldg6qGPrV5PzLK8Um92BhtiFQ8rDbjqnX+S78ZDikpphjBLt8Pb9v50 +uwrn3+K4T0zX1D8Wzu/XVIu0ao1jTdmy1lUpzWREth9M1g1yG3Wx5pRjfp22yRIhCjm qFXyiosgEDazdkYu3Ys/amy2xiayOTZwi9o7UFjncEgbvphA/7lc6MKjNxNb2T1+zTjA Slj+hiXyDo/0fRaZ/GGQ0PkFxeWwCVt6UmCA8RDsGz7MPezO9Z2lXfCM7nD3ONh/KUl/ Q2qg== X-Forwarded-Encrypted: i=1; AJvYcCUfVUUuxqy4Yd1MauRt2fieLUovOLPjZ7/Qo3v7K+CSsRllzJmSMJfyuKxeFk+YPNmeJJ/6HT5L6xjkNcsqlAuP@lists.infradead.org X-Gm-Message-State: AOJu0Yx4oKz60PiHZbZO5eU7Jrhs1/AxtyrJ7/4Ts7yJG5/WQsBCpEKD jvvHOnBDxmDr7UeKhBbrn2LtcFVraKyg3ZVCumEGmC5ZIlhNVV/Iezq/J0fhppU= X-Gm-Gg: ASbGncvMJLvnkfHo/Bn0C/hLVDT2JPJCclNxljSbEuk21IhYT+cV+4rZGEQFevnk3MV 2KqWxMRVKoTiFWBX4+cBG8W8jDxZLysc8RQU49jSYicGj8Zp+XaiZPfdS5S6eOILT7RDU91FI9R lQhsXU1QXWcXbp2PJTxQAZ9zai9DkxJKGcZrXZ3KDrGtW9fpl76N8gEa6dl1dR8KCyBu2B4CwSD BCK4/R518gzU26sqNdpWllj1uwzAJNbVfq3JEv0t05eXbAdIpn/sbBtNA== X-Google-Smtp-Source: AGHT+IFfhVER9h/x9rK2y02O8ScgxqBwF/5PNitw9Xk11JpSQfAwSB2naROC3kIrCP+2Ei8nyJ5Kkg== X-Received: by 2002:a05:6512:3f7:b0:53d:f583:81df with SMTP id 2adb3069b0e04-53df5838209mr3265430e87.28.1733010934296; Sat, 30 Nov 2024 15:55:34 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:33 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:19 +0200 Subject: [PATCH 02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-2-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1024; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=jvlD3JuIycYlsUfGVML+3UeoaevWmHaaQytOdr+mxNU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xt/7pykgJj245vtdzYWdYBTAMnwoeiEVz0V cHOwIg5ZZOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7QAKCRCLPIo+Aiko 1Uh9CACs2EKgY3agKG4T+t0CkgNiBGM+05Aomb7V037y3ZsVMyGBgsnshcMdjjksyQHwWAR9UO4 phcMcAP56G/wnh2roZkGyvmlMsXgcYwC/JcmmAmqRpZ3BOU41lxrAgavIrurye9kHFCYMSeIXMC ZL/VeuwljGdXtKvbiNuFpq85TOh36Cs5evtJpDjaTBBuRCU3eJzaHjovDNB31z0KSlAG44ZpfKW /bdsJLcjoLwHRdTtVG4mRghPrGrLzz35ix7Igay76WHZuOI3nL19Gs+e3V6XTkA8m2kprqqo7x9 ff5KN4kX/nqX3Z+YcrmBBsD2/q8MSlB3PQI3Q2xKw0EPGz1c X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155536_285837_2622D50C X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/analogix/anx7625.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index a2675b121fe44b96945f34215fd900f35bfde43a..c036bbc92ba96ec4663c55cca091cd5da9f6d271 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2002,8 +2002,10 @@ static int anx7625_audio_get_eld(struct device *dev, void *data, memset(buf, 0, len); } else { dev_dbg(dev, "audio copy eld\n"); + mutex_lock(&ctx->connector->eld_mutex); memcpy(buf, ctx->connector->eld, min(sizeof(ctx->connector->eld), len)); + mutex_unlock(&ctx->connector->eld_mutex); } return 0; From patchwork Sat Nov 30 23:55:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DC4FD7361B for ; Sat, 30 Nov 2024 23:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zsbxRwNfx7fnCx+o56uBYxIXkBxgdk/p+7MwRahv2so=; b=xMG9MoEToHAWVWqsK8VfrEbuF0 bYpNkT30hmtwPtMOL4hy21VUh5zhgZk7Sj5Ex7Zjsawfh3Ynrl8Sf8FIuiGXGPoYpcV6cp5XPw9EW mUDKYJDtTPBeo18C/kx+k8Y9qPC56QyhXiJliVhzx69IMVJXsMLSUJG1drj3SdvRq0UHG2I/5dS85 +TWeEfFDvyi244t133SW8UhP4aXJDJOv1IK9e8Vmtbj//ITrC4iih3J232g2/3rEeUmh7Wq9f1iq5 xomB349rXz+aDTwImoXlPjIqclSTJxxBz5sUkAV+8o5I7tPa3sKrRuhotixdCfjZ9Tg1p8Yum+8Pa 38aFG5Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXN5-00000002loK-33XJ; Sat, 30 Nov 2024 23:59:31 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJK-00000002koP-3m5L for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:40 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ffa12ad18cso32370201fa.2 for ; Sat, 30 Nov 2024 15:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010937; x=1733615737; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zsbxRwNfx7fnCx+o56uBYxIXkBxgdk/p+7MwRahv2so=; b=JQCkjjSWi64I5c2LYS9KmM1n+PfIPinJkgLUrxbyuPAmUQqQOo0RJnT1r6k080lvB/ fTu2boDtVDAZngUS+5t3/HzO92SQ2u0i3WhigEFLMbUP24tQVa4a1IGZYLK95m4IRxEW v8UUOuCVzfoRiXo1tQU5C5THxcyxTIpj2R3cPwwgo3ej+vgeiz6u+HhRFHPoVsaFbXEf Tu27oZ87aoCA4J5PyyAOn2WkpXKcCjvRRAmvYULuyk8PObslYqvhba1ty3iriTQBKVMu L85wc1rpfTJkcOmdDdHQyfIBsbi+CiLy5h1pgxZqTD/Jt3NXDdS1TArO7/nODTHTfpWH dM4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010937; x=1733615737; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zsbxRwNfx7fnCx+o56uBYxIXkBxgdk/p+7MwRahv2so=; b=IzZ+c00A8BVhL0PDE6sC6v0c2g5WaccoCy9/ZtLa9PKtwioLvNedO1uFk38xLwC30m ngd2RKJ7BQ8jK3sN0wx2uZ67J0eTLFMEPS0e6yG8ktf94JAdi5FBPps95wBpnEeYr7le FQgVn7lPP6uYBTVbrQAAFI90Cb2lWTh5G0bIwyz0uSIqY05ZfynoJ3pqpXZH+ZrRuwFU rqBTP08lqeYrCL5ladJi2fb9nv8aoMapxhirZgBzlD7cysQfpUcn2twcFtHj1YYVxmbn hxtiv4f+tFlitGAo6OV9gyobmex6aSo3UYPXeqBaA9qHxet6hMUw74d1CqsuE6oPXqLR 7SPg== X-Forwarded-Encrypted: i=1; AJvYcCWenR4RmJVuWHGA9rTcFt0+t7vc9R+aEJUnM5vtAW9Fzhlz0BM8druwfnPoBWTYGGldDPXJoKD3WL4LrpMhc2Ej@lists.infradead.org X-Gm-Message-State: AOJu0YzUQ9xeDcqfOPfk6Mfwwye4UBOnfK3dxLQN3/WgawoVuaTPEqqQ DeojqjfxAecRRpDZ3LvWs1eGJ9JQpNzTGjs85RXX9wOI3MJx1unAj3baMq8ULOM= X-Gm-Gg: ASbGnctjWILRlICwObdNpaK+Of8zYFkUTpCavPHS1dnPlGHRTfiKLThbRThV2Z6YFe/ vjoWfPwNf1XP9pBCzUixhk6QBNRKWnxLkA5ENxht95il3kCFWvDJSBdmF/hywR0bDrRB/NCD+F+ gk3lfHkAGJgQm3oaIpvekZ4aZ+PgTNyCggpuQe7lAjEwFbExJeIH+u7AjYbZzsw5QbbsNkeDLSm HtYyq4dvtb5O/YjYdFj/FKf91WAiiMZRhtT23UorHSn7DgGsR1d+XEp4g== X-Google-Smtp-Source: AGHT+IGcKx3qxr+rKjFg6uN+w/t1xLv8z34zeudztpmb02c9r0uba4ZBSNTSBCZfWNmdHrXgT/XSFQ== X-Received: by 2002:a05:6512:3e2a:b0:53d:d431:7f3a with SMTP id 2adb3069b0e04-53df0108f71mr9006077e87.44.1733010936909; Sat, 30 Nov 2024 15:55:36 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:35 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:20 +0200 Subject: [PATCH 03/10] drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-3-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1044; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Ze1FOtye6ODMMZl22hb9QRrfAdzUkHN5Ex5hTjwt+GA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xt8KExBULQDlnc0kG9cX6l7/Qf0gOZJfErh qwvys0sxCOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7QAKCRCLPIo+Aiko 1X53B/9fdxZ832w1hRpbTcoyQFQHmA0ikcvv4VCzfB6ZaFGrG9T+SoyXM0lcIGKSaZczbYgwyYG VSyLd0BAxUhrC8MwHfMgp8Y4wCleisRxlVFA1vUdBWDg5Ra1tMCGv5yeTI8xG89vZvV7H1L56LH NJTuXCDHoAtdxiJGvpFCcxy/iyg5+gZ/1OqAZ21gCgzFdy4w/2V+gH4ahWa0JjEUHnsqPrt4sw9 GAq6r6bDqlUd/3uTwG/u/zV5dSLxpZwsGi5tupF0T0d+UKSbAj73ZOj0Mc5cIt2otyZ3ATuZeIK E5n0SMo3O3r0wqRpMmCiTAGk3no1OeU6uM+duf39jYehwa8p X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155538_956983_CAF70C09 X-CRM114-Status: GOOD ( 12.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/ite-it66121.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 35ae3f0e8f51f768229e055a086b53a419ffcd9f..940083e5d2ddbfc56f14e2bdc6ddd0b9dd50b1f8 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1450,8 +1450,10 @@ static int it66121_audio_get_eld(struct device *dev, void *data, dev_dbg(dev, "No connector present, passing empty EDID data"); memset(buf, 0, len); } else { + mutex_lock(&ctx->connector->eld_mutex); memcpy(buf, ctx->connector->eld, min(sizeof(ctx->connector->eld), len)); + mutex_unlock(&ctx->connector->eld_mutex); } mutex_unlock(&ctx->lock); From patchwork Sat Nov 30 23:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2590D7361B for ; Sun, 1 Dec 2024 00:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4cxY+K4yZx53tAspmDt/c32sXFm2om2yzHiockIbOqk=; b=NpFRJ4/HXvjIjLp9XhukhZQEuZ mQS1eBGUn1fw5Kuv5gBsHV/IYs6b82LzM0tqjERTbnymKY2NAe3aeTmLXtbP8QCASLp6sR5Tko7wP d/2nYuHPDCcjqgVF0SOkCG4pdWlG0ee5/TI0mcwtErMnLvctBjYV2U5aCA2hcwAu8P8Y0y2kIzLWB 1uWkM8FWM9Gtl27d8RDite2Zrv3DqxLD0blTwERRDroTOMU/5lngZeCJRS/+kD2YwmTsUWjX87xLc zXKarnbK5fbbxB64QEpsrB3ciT/5z/L1k5w4Y6L+2XS20EIwIQOtYd/79Tx+jN86/PVW4QzbQ2rZJ 6iB07FFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXO2-00000002lwd-20TM; Sun, 01 Dec 2024 00:00:30 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJN-00000002kqC-1iKl for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:42 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-53de5ec22adso3662451e87.3 for ; Sat, 30 Nov 2024 15:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010939; x=1733615739; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4cxY+K4yZx53tAspmDt/c32sXFm2om2yzHiockIbOqk=; b=Hais+ZC6lP7Y3Iu/gMrp9fB0OK+ODJZDz0JDkUs3mq//ZGLBrMSHJMvV0ry/CHuHcd +9a9owqiBkm14q5PhvRbGdWlfiqrno8FRdhaUqNigESYdn2zrWxwkRsgGU3B7BxYMfqQ 2rIQox19S0bXYuopt6QMPxRTMCaCNecSE/wsp0jVBN19YomDy9aHxRM8tUubkSGDAVSv QSJMmqZvvR1OPjTO4ibRFbvcAow+CxA7zX3c+1oJDzg9uSJE+gdKiSLFd+Mp0AxWJ9oM SkfmE1g9E0wkuvJ+uImQgR7i495lNAqZREFZz7cXgfBQZndVGN9w2f2fMCSavb2KRuw0 C6Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010939; x=1733615739; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4cxY+K4yZx53tAspmDt/c32sXFm2om2yzHiockIbOqk=; b=tv2cKcMdSQcEahBVYbCsixsdKUAnO+6CTe7cfb/WFmpxwOM7KjBoas8C2l35ojCMTl H4q6zjPjkRveXRco71eGWevmmcP2YcMT3O6OKkz48rmaGwQXi5gG/XhXurgMNYzQXZg7 TVWwAWT07y5toMazt9UXyc59jyRRvLcB2dz5zRcvpVZtOziJZy5cQrvgG8pkaqEMtWuN gJfxmOoiEeuYh3wKia6y9Izwies0Psgyw3FxLnpmgt9FF+TWQQFmj7s5/sGzdG+AKt1C YPXuClLxezckCrZ+uvzvY/jEc5zQWEmION+hPGfTcSXzY5IasyJS+x2D0kfzEZg4xDaT hoJA== X-Forwarded-Encrypted: i=1; AJvYcCW8tEld0fgetuL16eB/o31CFDRblK5gn0G1oRaw12QCr/zlSPHja2+FQg81BmUiwpyVk814DAtd42Br4FbL9SNe@lists.infradead.org X-Gm-Message-State: AOJu0YzRje45/1NX15szQs9TIohg0j7VZxC0xK/rSCUDORU2cn5w7Y7C B21YBPU7QW3XqLwG8Vu3Z8p0gFQaYD72tAHftAR4VmYZitHi55kfSqajHlgMZlo= X-Gm-Gg: ASbGncthrdWfRLbmrpuRFpItREqDrs/CwW7GlbvBc7ed2riIEEONBeXrJJcWLxwa6cz N9v2gE11yOi3Lx2Xj20AavrZpB1urqd0OLsPDGLz0HSprXj3ZNs3yL6Pa/tw2+WsdDhs7iuNbNi eZTqN1NPNeunI6cKZKUfMIwuANPKs4GzkjIhXn52lKEDajz4oj1fMdhjekv1EGJdIDTAutFWbUQ 8fgYNGFA5YRCRnKVOowmI+z7y6R0E+fN8trmlu3Aieib+3a0nI8/LRrfA== X-Google-Smtp-Source: AGHT+IEqhH9kCuwXPt69aMI3EvWDASBu5c9Vx1nORTc0e8euAsFhVw9NvHYYoIvx2navJeV6UfeSbQ== X-Received: by 2002:a05:6512:3d89:b0:539:f9b9:e6d2 with SMTP id 2adb3069b0e04-53df00ff7c6mr10203616e87.35.1733010939471; Sat, 30 Nov 2024 15:55:39 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:38 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:21 +0200 Subject: [PATCH 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-4-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1033; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=tW4andf3hq3R7WEIVc+7/mi1YkJBAZuwRdePwQe7SPw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6XtKnM5W7YbjO8PfgAgXIKJMU347EHoG7pN6 bC7slgMtUeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7QAKCRCLPIo+Aiko 1UpAB/98T+k5U79sPWHDEfdVoK/uxOqdWekFRUGXmaXz8lVAUaoc1w3Ob2vgVsHEmXEpRZcEqWq bqDqWhVxSkMp+nC/KP4LYMkzeAhQdwu6z7o3M+cI/LhyEPck5mRwoKlsIKia5ENA0q+YRaJX8R8 D/MbaqjEkVX7h5ODRsXt0b8del0LoST99BcdJPq6yynl2AInKf1mwGTeXOm09nkJ7B6JX9D3N0r XnUieG4H8ZtcZAOSBh2bHBQePXm7XUKBlvFoHDklRqI/YU7jyKDWow4es6KEqLKgoa9z5zUayj2 4MDN8Hi3OJ8XFsnfXmBTUuMae75l5OufjL1fj5yqKjhqazvg X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155541_448596_F23E6301 X-CRM114-Status: GOOD ( 12.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index a0bcc62f280f8e80f5d174cd2f567a8ec616e54f..2843283375551b0b85f5f897acdb2aeab652892c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port, continue; *enabled = true; + mutex_lock(&connector->eld_mutex); ret = drm_eld_size(connector->eld); memcpy(buf, connector->eld, min(max_bytes, ret)); + mutex_unlock(&connector->eld_mutex); break; } From patchwork Sat Nov 30 23:55:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E14EBD7361B for ; Sun, 1 Dec 2024 00:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Xien0N58sB4iffC9+suYdwxKcgrPQSZoNIx9TfZkSKE=; b=OGVLWu7jmLvhj2DGUx42SgQ1cj l3ew/w9/DV0k20N2Hmj0c0onntHlDIs3jiWSOFANJOm8tSBixBty0sttzyFjA9x7gM/srrVVLACzp YtEZPluO2FMHY9vuHrQ8/YtBKZWARM5q3yy8QwLcs5b51I89Ovy3KoP5/g75oBPyhXmgUuAQal6Av Ns+I1PKtb86P3lj+taiwKJ0H7Q1UMgf0GB5P4rCn57sj23MQIJUnnwjI/yxIADcZXqEgrG/rTWT4z hnutHPxTvlqiZsZAHLRr+K6BE+zYsTCi2eQ3gLI2C1k3td8605ZtXcuix1qYrVCQNUFbTV0X5cBIF F1tRfU8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXOz-00000002m3o-0kD0; Sun, 01 Dec 2024 00:01:29 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJP-00000002ksS-3fxZ for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:45 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53df6322ea7so5143205e87.0 for ; Sat, 30 Nov 2024 15:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010942; x=1733615742; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Xien0N58sB4iffC9+suYdwxKcgrPQSZoNIx9TfZkSKE=; b=rRjw5/zGjhye5+8gUqxNKqSFY8BeXmsvsiSaKcdHVSaeMnGJgkpeG2kx7Iv0kef7r1 kcERTYmG/qKfGPaoB67/nGER6/gSoH3NWWiCd4/3iZQ8ZlGp5AGGd+pOe16dXqGMaWEk 8vQF4J3wLwf/laVLeRpNgFOJP/yrqEBBavGLfrVrRxF7aRTSy+7T74HYIkczSMasbAig 2s3F5OhinBubRaQvUJoGv2Hffe4xSwecQhWkZTKaGm2bFjlBczwL/BaiN/vdnCVCamx0 FEwmGBDpNP16nlzj5ZvVyOiJ8psOLwKbnGaab0tHF8JyFwJ3wfR4EnClEvbCKvWtWP37 W+5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010942; x=1733615742; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xien0N58sB4iffC9+suYdwxKcgrPQSZoNIx9TfZkSKE=; b=kJsgzMIXq7b6JKJYOSa2YYlXgBFhfLi38kg6Q7vaQQTT35gD7kFUPqaHF695jfu0Xe l2RKRY/4rpwZ7UDq027AgTZUq49MJZQ1r9a8KAyHnUQJ2kePxvR/c+BuKgZGBqtLpqdn LY4JJdRjKFVbWtvie+vpGGYQuVLQ3lvjsowDj2aCzWULeUYVfAcV59BCyN8dDQpf7/J8 +FDsg3WEjgE1ZaLPca7ErQx45L5LkK4LRme9FLpC7sLHdvTW38SJOwo31Vvm4fQ/uFea p+bY1x9nm1DfGTd+5mPlpRTCJMn7iNCNgbCQ0abmm5aLftGhU8Ivzrn9fgXSW5Cr0sLl 7uIw== X-Forwarded-Encrypted: i=1; AJvYcCVr5rbagQ08yNWk87kFRbhwBI1a2shVI4uIR87a7aTzJK+Yb0zHOSdARlaNygyMrdtj1gqRncUHBR1L4DwSODJ5@lists.infradead.org X-Gm-Message-State: AOJu0YzsbGHnoxTmgAbkiAS5OYQQR5gzdL4HL1mOfuFhYLLy3Aa0q+xJ UJHE/rs3rMLhMUu0vPNfAwQz/fUbV7JX3YzxKUtmnulmJBZZrFolVpzsGuFozQ0= X-Gm-Gg: ASbGncuVslnPB0tZ7tEL9r4eSu794ClSOmQuhcEu2OpNbYu5wSxu0CqDYrBvPAvPSAb wCbInVHdbS0ZzuP7nxncs++spF571Z8FdIYW7Rne7JUiXNc4MV/7bonANJDcHCFDVUC7pVyqqVr 1H47DgVSp7d7o8vo5Oq/W6DfOCmATYpY2E5imCWjpG4LzueHlUKCpU1QXP3DkrQ38AJotVsYwTD uxhhw9MRuI79hipOSXlrNwqMYanNhBgGFcF3ZIG6Ca/jRHIYCYOBiy3qw== X-Google-Smtp-Source: AGHT+IEoIeugoET5BqjT6NRzZzzy0ZjjP0TBRwdTQ5WPutajVCKBkgCZ3DW7I0WGOJti6hbbaxziUA== X-Received: by 2002:a05:6512:3d86:b0:53d:a3a7:fe84 with SMTP id 2adb3069b0e04-53df00a96e8mr14561366e87.8.1733010941990; Sat, 30 Nov 2024 15:55:41 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:40 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:22 +0200 Subject: [PATCH 05/10] drm/exynos: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-5-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1012; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=IlBBKvhDiY+cvMucjbk73vB6IzNnRZ3+VuxCS/o7lvk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6XtFcmUlMe9gPJdYbealc8FI/qrUiornp5Sz cmdQjBUbCqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7QAKCRCLPIo+Aiko 1ZUyB/467hRM5fIPQYymRfBPSsYEC5gNFcEsRNSKClp6yBUjqbuT5K54U8veccTLagqpg6mrQHB sJYGNPnkUEjnK/JULDL886lHb/pd7SixyezCY9k1Mvf+/vpb3UQCr09dSOMw30NiV6NkWvyKje3 BIlrF/FZ/tS1DHxqV582BXI4mw5v2jinlQQFFXaTrs/2hLdXOEQ4QHa+nzNK2KyOa5RBmbNeNVm uQ+khov3pAbgUTXsoLh/W7vnwwJOU8GBcFGjx4o9CWpP8W8q76JzryVKmf3dp+2WCcFdRfvArJ2 8NknAwK5Hx6FXILV/EdSpHepfGGp/Zv/ytvXybjv5g6YrJ17 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155544_010038_6681E486 X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c9d4b9146df95bb46cb6bea4849c331616c2b463..6fc537c9048f5c8e57e30f083121c9aea6b99a5f 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1648,7 +1648,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, struct hdmi_context *hdata = dev_get_drvdata(dev); struct drm_connector *connector = &hdata->connector; + mutex_lock(&connector->eld_mutex); memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); + mutex_unlock(&connector->eld_mutex); return 0; } From patchwork Sat Nov 30 23:55:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58522D73619 for ; Sun, 1 Dec 2024 00:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=36yDOxib/1gmocQMgVorj80a3sqs2EFrrs6+X9Hy7i4=; b=oT+W8OKucSQkKaC/x5HaYyB/CL kb+8h/uctBl8GiMEWvGlmEtRMk6OOk17Rtmsq3/R8j0kFdD6HBV5CfIvrqpQ7Pth6uSWc/FEXf2/g NJvV4lFyAqbZIeJS9bqPPj55LMGKaHF4Nt9ThXEwHvxH9CFMx5pjAbkBeqDBT+y16ipN1qxXP8prQ ojTC9CDwk42szcG+zCMxRx4uJOg4hGukl0z+aLt+2lQYzyZw68kNIs29+rEJXY+q9838Fic+cA5yB 5Qf2qlU3cLvNY+Yzy/Pb9sCBtDfgN4ACPtLpjUpN12cyC/Vj1RbUVi+I01pvQQT9aaYjeBWdqrJ6L 3WMFtQOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXPw-00000002mA3-0JwF; Sun, 01 Dec 2024 00:02:28 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJS-00000002kvQ-293r for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:47 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53dde5262fdso3328372e87.2 for ; Sat, 30 Nov 2024 15:55:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010945; x=1733615745; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=36yDOxib/1gmocQMgVorj80a3sqs2EFrrs6+X9Hy7i4=; b=mNzBjEGgZlvV7RUNkGcQOSSj84ZyWl/Gd876AopqJHxTYBxWlmdvvqZPhCcY3JXqG6 y+z0O0pCN982vylZQQliFHou2qwefn4yvFYgePYWv0u95feukxgtqtDar9VaNWRcJkvr v7qaiY6vwxoyuvZtdr2PRre3AgFGvpSAUcARCY+Fd2z+54RN0hexxijPYBCBZ+9lUQor A3nqzmUgHg8BNX4cb9dwsS3XLJQoUDDAFAtJfSLDpjYORagtjcMBi3lg0kPvScWnU91s Yz+Zo6VDzKlsFcth0VEOU8J477GoTbD90FNW6SoTvJzK8QrDHakpm5aYkpvbDZ3DGyRY n87g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010945; x=1733615745; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=36yDOxib/1gmocQMgVorj80a3sqs2EFrrs6+X9Hy7i4=; b=tH3n+tnFWqjm8V2/whBq+ZZj+fpWCP3Jd+kfS4rg6g1pJFEGrIapYWe/KyI1gqhdsy CUsi9zD2yiZcWxj0Ip+GgvykSdliJ8SA83yrSQgjVzdqA57HQ+9H8MjQcsSuwK/zMVck X9JC6iKnnQ1aD4i2nisQ3WeYw4i9B0FmrBl2pugkSN3+vp/71JDqZ6guyilWJNK7ufxE hD+sLWqQA2wYX3EG7aYqre8R7nQBKSf2ondeK/Sy1+XcsCAFOeMMOJWcH14++0Y0Pqrb Uycy0jKBjB4R0e6sq9k7Tu5z10fTukZ8KjxGodxl/U9KjHNWnzdPZkNQ+2jZoFq8bXvm ciXg== X-Forwarded-Encrypted: i=1; AJvYcCUbWtMUYW3pGqzJZPPgbgulXvltz6IlthZ8knhSkgGMEKzqlDcHQTnTxc8YMI9/m7QRIxQ8+kMBE7hqlsoebq8n@lists.infradead.org X-Gm-Message-State: AOJu0YzxvjgdtUrMULWHX4/VAFW8JxKmklirUbHYqQl+atk8SApuQUJj ijsKuBHjoJz2A7cWNtPMHh1v7JME/TkMo04XLaHEsyrdPnxmxbGJc/akuQtPpR4= X-Gm-Gg: ASbGncuxcic7VeHRoAaITz3n4uztlnIMkmfOSzS8+raenP+yUyDK5PWR1BO6EieAPKZ EiLxGjBuK+U/43F5jQ93A8SaGZjLd7FK3EAcQNZO7SP6lM71wRxlpA6g/1odCdcMe8HdJIiH+ea gPSRpq3t/bV3l7RUyB6PvEChjul90GxDgiJVYUFtggB59iZM9nlbXtnxL95p+44JtAAH6bMZ0mk o3vWH471YKdHIFrVTXzbosxbsJovr1giGp1FNSR1GPNesdeBKkW+oWIfQ== X-Google-Smtp-Source: AGHT+IH1Dd+tGUe6sC5VDohyZs6YM5bJlrw02OG47IUbMBnDEhuVmgxIpQdpIhppnPqJWxsmsvhkAA== X-Received: by 2002:a05:6512:3c9c:b0:53d:e544:3fda with SMTP id 2adb3069b0e04-53df0114865mr10496986e87.55.1733010944592; Sat, 30 Nov 2024 15:55:44 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:43 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:23 +0200 Subject: [PATCH 06/10] drm/i915/audio: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-6-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1387; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ocQZIy+T4sFAsnN5vtnQkv7E1kptjCde/MaB/nCVvag=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xtmjf6X7lDNnSYnbN8EtG+XlG2iAcozEYaN vKRL0ru9MOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7QAKCRCLPIo+Aiko 1YA7B/4nI6CxdNCnT52tQHBg9M36pI1GVe1vqRtK5C3wJVqMCVhoJSG54VKPili2oAyP9q7Y5SM wfFkEzkHUs2iCBzvmcSxgtU8l7GXrHr4G37JlP3I6B3mtLZs7nUZ9Uh0WxA3RWI3Mvs0QxgkdOt d+fckwL/7V2GpA+I74A7OYQiz5GdF3miJBFmjtYL0TbdSjNBXXtzdj187qJpxJ5kogVYysHQ+Jx JRXPmwqhg8MNbZs+6GsTbv/A+sTxNTCEgU7RZ077JdqBKJNYgCqGX3SbCj59ZG+wd6EGcLw7COJ TaQwbVrLdRTZHn6/hP9VyBUkVHX5G7ONl7SU4lh2FjAe8VoW X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155546_560537_A330B127 X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/i915/display/intel_audio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index 32aa9ec1a204d2ecde46cad36598aa768a3af671..3902ab8431139c3ff4dc17b841d94b6d3241dec3 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -699,10 +699,12 @@ bool intel_audio_compute_config(struct intel_encoder *encoder, const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; + mutex_lock(&connector->eld_mutex); if (!connector->eld[0]) { drm_dbg_kms(&i915->drm, "Bogus ELD on [CONNECTOR:%d:%s]\n", connector->base.id, connector->name); + mutex_unlock(&connector->eld_mutex); return false; } @@ -710,6 +712,7 @@ bool intel_audio_compute_config(struct intel_encoder *encoder, memcpy(crtc_state->eld, connector->eld, sizeof(crtc_state->eld)); crtc_state->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2; + mutex_unlock(&connector->eld_mutex); return true; } From patchwork Sat Nov 30 23:55:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0C68D73619 for ; Sun, 1 Dec 2024 00:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uB5LaU5I1hAwk5eHmDH3lOZn5FvnrCwCeIdoknlGoqs=; b=C2pKn5hwDVi8fD90d+BT9rweGb 7kUbtk89RufQ9riyX5CdSRzrJ5/sVG4thCIAGR6b+HApoequFBEZB/0/mYOhD4Ma82MB7imOEhupw TlKAexXkOmXnz6bDSiuCH2iX0x/0QLXGxlUA2PgN0O+RW7BLs357x1kCh3+bRYoBULK5zw8+7f9ya 9iI+qpgrDmGZQ1WqP91rMehbygmImg9rcS3OFIURRtP587u3var8PLKbI9D2rZwd2/yKd5ZDg/CB7 U7oIrPYZB2KYc6NAtL/lb7Df6pstURlqcubjW8vshSKL/pzu9xsDNYHFQ5/5QvpBvO0DEETeTU3Ye jXJVWQbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXQt-00000002mFo-3yeu; Sun, 01 Dec 2024 00:03:27 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJU-00000002kxi-2gXc for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:49 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53de92be287so4395894e87.1 for ; Sat, 30 Nov 2024 15:55:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010947; x=1733615747; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uB5LaU5I1hAwk5eHmDH3lOZn5FvnrCwCeIdoknlGoqs=; b=azCxqqVt/PKrsLwhH6dnbfG26UItcqV2EuZ73HwERAtJmUKNKljSii3wsnuCkubPnE l62oJs4U1R3tkxlgC2MKR+YFk587a/GqS3UF7irH5+/PugCwev3QHuzMRZIr+d2uhb1c +DShgOef2hzpvFZQ1I5iM4fluESb2liXaP1tFy5mIn80+zgSuwsfL3WrxCclyxlTagjK 9zaqFAeIaSxYJ1cRotYdEpg+DyA6X8g/F6usl2Fq+lISNksRAB5uMi/LbJQ1w0KPJvfb N3bLyJ1gNgfccNv0NlLnXppko0N5IhmnmNuiKpryGfx04AAi8QQDO8DBEDD2U1dOPUU7 eDAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010947; x=1733615747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uB5LaU5I1hAwk5eHmDH3lOZn5FvnrCwCeIdoknlGoqs=; b=eNtai/G+Tiqq2GAOWtjIoC8Hkc4FQ1HszLM1GcfSNzdTp4+MCdqNjvcgsCKjuUAHFX zRFdI1mCf4/hNFatndfHiCjeCY8VQnKKcDVonvbsOG16F1zcwtfrrReNTR7twBNM7AJZ QqaLfE9lfnh5Janm3HZmkGfqZQaBty1ZQPrNmkcY0zZWYLpVZYyJ+EUXhpm32VuQ8+3u VHrk31KL9yiyeHSDH2ccSItZfPAaanIVQXg4hA6lisJ8/Pre0Rj4k7j7Jcib2RK4HeDT nOjmVsmE2Qg7c1+IuuB0kTN8Gk89g98cArJKUHroLfSeZrIrHJL1gvaW1sB43kn7X/hd pnSA== X-Forwarded-Encrypted: i=1; AJvYcCXD2ENBxS59CDm+3aoXwslLQ0oYfrQ7iVbWQTOIAE7vwHjULu5lgcTVxpAPhZPnVKal5CbSlrbU8AsjsQhl22gl@lists.infradead.org X-Gm-Message-State: AOJu0YxLtIGtxFCRUNVvfNU4RUCzbjIp2+eOF4xERy1/TN7xJg+xWJ1j 23CMzCorUS8PkdHXw4GA2O9ZJyioJADAJrlt5WuDHuyuz1GaY6jGy9MXGYQ0+lA= X-Gm-Gg: ASbGncuhE9rGLB1X/EAt0HA8v74UGBBbLwqT4H3eKVFnVv+eLmgM6XQLudb/iclciuL f3PPcEFkcZrrKqTUN0fTEWqpA+JJ3jRDuP2ZAdk0Dif7X+Ximv/m++mTEkuvZkidewdC1fSOd7/ dKcnTqfWxIvQ6RleBCYkEKlKn2a98MxpeTo9kjs8GwuyBDmXCxR1K6Oa8Q0eaO6N9b3oddJvJjU OqL9Mc7/Ssk6inL89NPQdyBs2TT8IDsvRxsOmy/0v+I3ONwoi/tYy24NQ== X-Google-Smtp-Source: AGHT+IEnSvktg0pFWgXq/l2+bx5WK3xZBCs4AgqZphc3ydAvUjOE+sdIjebGqlor4oQyehHElEBbzg== X-Received: by 2002:a05:6512:3c99:b0:53d:effe:591a with SMTP id 2adb3069b0e04-53df00a91e3mr15018922e87.3.1733010947102; Sat, 30 Nov 2024 15:55:47 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:45 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:24 +0200 Subject: [PATCH 07/10] drm/msm/dp: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-7-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=935; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=k/sdBeuIX6ZzNNN1qtwuMpr5v3fWj5pwQ/L03Dq+sDw=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xu0rcXOn0b4oPtwTlM+q76z8lrV6nasm4mB qYwkSdVllSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7gAKCRCLPIo+Aiko 1b8QB/9U7VqcSXJZcqnwzL14LI1Wm8fa0Vof9aggdEKIguYFSF6mBJxkKrcGEguEcmRWj1g76O4 hIPh6905NyRZ68dga7ppIwiH6+nuI3at8WHRyunXXScVm9yF0PsQ8bUDpPggd+hf5CS2nij612U DTBvf4gwViH4u5cxRfe0AoiK1SATjJXbJnm/r609EbOJDGSVy+bbt4lHoU054mBGEovBV0eVHbj 4VVam6isr2QpQJrTR4xtpKiiwUpVeFWoLxtsqui/lAqHwHNlRcqkZSMaeHh66xeCZH4wQ38Jo1O fdJOPzrGvySmqm3sGjUZSaZeFAPrET/XsBL1IOzrdkLgxrMq X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155548_680003_7BC1159F X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index a599fc5d63c524474276f5db98b05c7c512f332a..61952a0c49861efcb5e7c0884fcb85c040daf9ce 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -414,8 +414,10 @@ static int dp_audio_get_eld(struct device *dev, return -ENODEV; } + mutex_lock(&dp_display->connector->eld_mutex); memcpy(buf, dp_display->connector->eld, min(sizeof(dp_display->connector->eld), len)); + mutex_unlock(&dp_display->connector->eld_mutex); return 0; } From patchwork Sat Nov 30 23:55:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF06AD73619 for ; Sun, 1 Dec 2024 00:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8B/E5apatQK8hIbe5eE+ik8zb/UqM9JhfpXKxSqUpBI=; b=ykKP6dq1LufX0AjAwB6zv5eWRh 4S6QiBcMuORNpeemux8Pyqs8aSC/N5TYHnLr8gRKvos2Z0R90wb4hciKQjSC8Qd7Bgr6cGz3hK16V tgyRHs68RaHWH9qHGK8kol2hMVHRyYUZ5zSwkWlO7xXHmMs4FYsfGBwE35hpSspWYpyK4kJQkyAW+ B4SiSXcynuQCkxmL5ZIIOHffzyL/uLVCGTS+7Vjj8hflhzf8VSsCXiX8zg264UZk6ZVDR0jOJoXKr /nygcewbLZWQ/VbNAeulU9xnE5oS7MU+3TdULXY3oypP4qHLEEdlFEIXRjCNTgA9bip1jCrT38JOx wJ2RdqpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXRq-00000002mLx-2VRA; Sun, 01 Dec 2024 00:04:26 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJX-00000002l0a-0nWe for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:52 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53df1e0641fso3397188e87.1 for ; Sat, 30 Nov 2024 15:55:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010950; x=1733615750; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8B/E5apatQK8hIbe5eE+ik8zb/UqM9JhfpXKxSqUpBI=; b=jiCweXsbiic3N9ZcTk/BL4aTWmvtl3gzkBs9aJ3tIYBYG8VsVmH1J6DR4XK043ttcZ 90eF/4uGBMoYFwNsyZ6BzMRhyHftbibLlAH2VflsBnNhEHzx/9LrWpdRHkxdnfjmRXPe bYLKdwrT1Prnx2gQEOSQBfqR48FRkceb8J8Z8fBiXNIk48ww4V3KEoOuRhs9+ucAcqEF Zepd6djT60o3aHjkSRrDn5FAYuguQ1IshrcBNVvGuU6HfiEaSln/y+jT4mxJ7unStQBX LXoeH/i/1jBtlQqFfoO5l9VaQyEpF/z+hFYi+u5l+V9pnA7r42iJwUw9xDfqxk8CM4Bb 9XeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010950; x=1733615750; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8B/E5apatQK8hIbe5eE+ik8zb/UqM9JhfpXKxSqUpBI=; b=Xfwc70Z+inBW1MgTkqDofeZ53UcdZ0LYOFBdnmLWXKo/WljMXSlxia/4qDPGP3vQ5m hfWSSQp0qrrSoKkzRMtqq8vWxct9NlR2we4zelyf3gzScIKn8SKQtq6rt5rPsAqaguPl rt6GXZiCFoSdYc501KitsHhgeWPViKu4aoXRTD7HHzBtP7HfxXzreAt2XIB8bV6i8zjI tC/uD93wWrsbvLUdvdRP41VSnSAi2cB4J4nwr+7ebAU+75sEJgbmqFK7u61i9RJ2Ghe9 598X49uTlPM6u2YgVvODh2ClT8odhjYr08qiQcGLAHsAwkmmcVuVCIDfwTkKppaY9UXh JVMQ== X-Forwarded-Encrypted: i=1; AJvYcCVnwfKJKjvD9rnLtzuIr85p0ZFB2QYGBi9ElPx39F/OobfMlOImS9NVkJxP5drWe+uSzKIs9RlRG5nZWDzrkRHH@lists.infradead.org X-Gm-Message-State: AOJu0YxoLqdrbrCEixBj3k52kjCV8hvNwjCw6NI1z12HgMcrVUgE44Pw REpFLAYoGT+C3s5rdPpL/8vNX0JE6PoNNzURUuyYApPWVxKfECcgydfK4jQehkE= X-Gm-Gg: ASbGnctVxkpICg4K77rIzEMODahPAUbTcVlJ3SMxtLRHbsoz+yzfZDHPtTxfPFzhEe9 P9JDmrnbsklttAjiUhWekdnqaCZeycI6pUgAErbYxsHpAQQbMxEStB2+n1PwyUBetnabccd+op3 /mY7tmWhv3jwKZC2XCkzSCRybMhABE0UlKhVvROS3s5MR5N+qvGTEq3T8gCamQXICmSlN1K0hQ4 9dWukkCXmI93dukVfDyPprG1FHvOAioo0i3QiKLeuHS3HhMA/iaITlkjg== X-Google-Smtp-Source: AGHT+IEIp+dlWZhe+G8N9bEIs+K1C7FxJxPBY+37wRt4+mS0XWsu4Pb8i2syhEp1VwHJei72BT+biw== X-Received: by 2002:a05:6512:2391:b0:53d:eec6:4622 with SMTP id 2adb3069b0e04-53df0112169mr10013326e87.48.1733010949652; Sat, 30 Nov 2024 15:55:49 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:48 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:25 +0200 Subject: [PATCH 08/10] drm/radeon: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-8-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=985; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=nLL+m/6tlRaIYoSYEq8RR3ocF0ESeJZGxjq7LmbbmlA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xu1LiAN0LkPKwIvEI7W7y3lCM2SxWMHTvbj OKqmG8qGtSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7gAKCRCLPIo+Aiko 1U5zB/41XZZbXAdwu3uOSstE5ZQzDb/qDMfKvZlQ+OJnYtFRVRPjLns5mTLy8yXWP7axSZix0qW b7qL5zI7wvpO2vQvcGIlHhF/PbdVB95v/KMBMYnMbeU6gtmPf5jcjRy0jGVt10nRTw+BH1a7LiY s+eAItvf/SJKs3/lGEVhzQQaHbCps1ve7fnPjmWIfbHbFVndrKRvIwzNmZOCN46ii2MW1Zygzk9 BmcKvVQ0F1Xhlx8whhYB0/xD2Yk4tKPh56VWVlvcQRz3jc0BKV4UczX+YsA3+dmiQSZfSXRoEaZ S/wTkEVIXnpQxr5tpjXD/AFl1W8QgGZ//FF443/owvvry4TL X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155551_269735_D1EB4023 X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/radeon/radeon_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index 47aa06a9a94221555a4828f41a57cbe03d637ee1..547d8f420669cdb949ffebd0677ddb8cc3c25812 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c @@ -771,8 +771,10 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port, if (!connector) continue; *enabled = true; + mutex_lock(&connector->eld_mutex); ret = drm_eld_size(connector->eld); memcpy(buf, connector->eld, min(max_bytes, ret)); + mutex_unlock(&connector->eld_mutex); break; } From patchwork Sat Nov 30 23:55:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FDB4D73619 for ; Sun, 1 Dec 2024 00:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IU6Gl7Dl4dmhuEZdQnvRmTEGRcXAkcJN0vDa70RMZrc=; b=WmNITNNnSW0CGcoGV1KbXVN0yA TFk+BW8Cr8Ws4Pt43gxLV0ZOhMDTxiK7PKSrH790nwHeOtk76hfJIdElNkDN1Z7+7bP5Mpr2If5rD pNYWAjIxWnpvQrLd1py/Sjgb1i9t5073Z6VMOqVLSUvJaecxdQc/tRrEl6NDTztFyza4LEO9n5A6T mVLYcMe9RIM8UFbU0ES/o/AOEcb0eCw38AANd6jd5Z0jKbatPXtGv3pfYh3mszqiNwqmh/IGdWkgA hVyWg4nm09fHOU+DTlGDu804BmUS+Yeb1/iGe2/DtxPyYt7bAM7oTYKx085HFv4vvnBcpoftkKLqv e+2fu4ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXSn-00000002mUg-1Kl6; Sun, 01 Dec 2024 00:05:25 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJa-00000002l3Z-0cwk for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:55 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53dde5262fdso3328435e87.2 for ; Sat, 30 Nov 2024 15:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010952; x=1733615752; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IU6Gl7Dl4dmhuEZdQnvRmTEGRcXAkcJN0vDa70RMZrc=; b=r8ID9cb8CdqzPoCRL80ZKkOsPA3bRPcNDMVZ4sLGg9C/r9XSt7lfxp3MVJ7Iuaojvx HtwZbL/fdKQfJB8aSPjUqcSvz4fDgGlLQAwT0Lya5an9/khkKZuHs91wB5900W4tT4PS x/7NwaMuAwegslWiQW8F5ixtHasuIcI8kyMj7BnpyvdCuXMnS0uTkGieS2dji37PIyzh KU63tRbEmMRVzAYw011ffudlKOOOwJt6fmEKcoxEjsFnh7ZkNAIKYE00kuyiUqaTMClG sp0AuczHdJ8n+LWhToNaElscaeUQhUSMzJBx1oyxkzVgvvgsDQrecHVduy4ZcsTvE6Lz xjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010952; x=1733615752; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IU6Gl7Dl4dmhuEZdQnvRmTEGRcXAkcJN0vDa70RMZrc=; b=DhamPWP7eCqCKrzCS3iQS+gDWXg3dVDyGWHuaFreAFZ8p+yQlvr1ZSoUSyC6zEAHHK Gije2MpXN4NVSw44RsId3SKbxWDE2I5ZD7Nem6t1AeJjw9KPUg3EWsZ/jtURvGH86ENO lCo39N9VsxwFWTLaqrbEcHFi3TiW5xI/VBb0RJtko3HjTr9V5w7C8HPKCZS8RfZvB4dC Aa16OAwcPrccBeqHjicbHA93hIAa/Omvut9g0xFiWPOnBDnuEZk63lgDA/maZWy4E8aV dyKGY/6/LhqylYgoH1702fmuf3Bz1EjGxUpBb4dcKJOd8lD1esXzTRwhw6bOhKsqeVSO UPKA== X-Forwarded-Encrypted: i=1; AJvYcCXoRddaDPQMLKFp9XHXTqlKPJN0Pb6umxl2gb28mt9VCngujzqSaipP3JeirEZMk3mXKnMhb3ZJATmqKAI3UCSh@lists.infradead.org X-Gm-Message-State: AOJu0Yz2kZ1DLq0CxwJIluicn3bymf4MipQyJf069t6TkBCyI4O+yVra /Ay6ZPj+jFmOOBhyR7UFvi9Pn6kkwCDNBe3kPE3KeI4d1NfEfAQGlcUXZM3cgpM= X-Gm-Gg: ASbGncvYay8ZpIdziwQsvCnSHmfKE53AzaVlvcCwh/Cinv6zfA5862Mdz2mv7HDLBkF /yPMxLQxEq6yYzAseUyektmAjC4Ak6xiMj+XezKPq6zJ8oLtOGyznL1BXFOR02i5+/pDqXDaDOi zB/TW8f4t+1zGB+Et/IkZispY05pagYc282T7YnXWmOLDw865+8zYImvaBkn9J8mDejKrMlGOiP RWdpfS1twqsNewE//Edc2alN0w5a9eZrClfxmpLHcC5DHszA39ifzImbA== X-Google-Smtp-Source: AGHT+IF0apDYRdHR7KZD93hjbqsmabdU0vO1rz/bbiVNjvW03bvvtexlWq6c4CLLSgjKkBK26w1wwQ== X-Received: by 2002:a05:6512:2210:b0:53d:ed6c:26ea with SMTP id 2adb3069b0e04-53df00c79a2mr8823937e87.8.1733010952229; Sat, 30 Nov 2024 15:55:52 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:50 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:26 +0200 Subject: [PATCH 09/10] drm/sti: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-9-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=962; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=d3Sl+FXytgREFItAwcczh3Q1vneGssZw9wmeXf8zqcs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6Xuuw73RrqNIAMj0Vd/VMNJk3KOMIlLIxeOc 0MnV4M5vNuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7gAKCRCLPIo+Aiko 1Qv/B/4/5rLxZCjkqK+Zdlhp2+yqWP4ISG1uXt/zd2hXrjtxgOkih9U6WKdNa6Xoz/QuAEp+lKl oVznmDwzY+sTM1b4PwOdG5DBpKIgyXf5k7n1y/cyABsH0BdP5Tzn74sUaSZBQgnUGSYhGgKdDc/ YAAgPkbRyOmTtniJolkAmqMYl0NihkgeU26RZ+pfNtFLhks7GHDURf3XLOq7x45EuwGaROru3jt SmIhwz9wcEA5r2kDJq5DDr04T/9Y0XgMWhQKi1kbsG7wK9OJlgiYKe7dSOEQ94g/A4Aet9kG185 zd4yXm2idTSpwhIe2gyR7gCJgHyrA/FNOXXul+pcZq+liRGD X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155554_215774_059B4E34 X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sti/sti_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 847470f747c0efad61c2ebdc3fb3746a7a13a863..3c8f3532c79723e7b1a720c855c90e40584cc6ca 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1225,7 +1225,9 @@ static int hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf, size struct drm_connector *connector = hdmi->drm_connector; DRM_DEBUG_DRIVER("\n"); + mutex_lock(&connector->eld_mutex); memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); + mutex_unlock(&connector->eld_mutex); return 0; } From patchwork Sat Nov 30 23:55:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13889365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA647D7361B for ; Sun, 1 Dec 2024 00:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IxPAXAkXtGSfHE+6MDrNppIG4p1UF1/hBXNkV/LR66A=; b=CwYdDPN6IBaao+iPUactwQoiGJ 89n+q0mRdPTL3ODrKlkrfdVnjysv3N/DGrcOVKzomdRYKs3n/eanbl2IycVsx8APtJ7bCFYFaKZMq 7GqT3CBx5vxW6JPisFG9H3D8lIVd8My0Xvsy0AJlM/1ycJS4f9xmArQYTGs4eB4Thr08LJ97iTNlT dc0Z9Hd6Co5X6A/iThElph1LVv9lPg8eNe956vlMiKFZaqgimcdQCitVNZF31+GQQYiijN1ZVHVQx LNkNFaQqKPa427jXKgCPmpGOkF9azl0WUIOtmCgS+fsHKHieGxo/JMwF9efQXb8T2ePJ2eZg6wuNm WgkQOpdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tHXTj-00000002maY-49Gp; Sun, 01 Dec 2024 00:06:23 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tHXJc-00000002l5I-1CTt for linux-arm-kernel@lists.infradead.org; Sat, 30 Nov 2024 23:55:57 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53de79c2be4so3508546e87.2 for ; Sat, 30 Nov 2024 15:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733010955; x=1733615755; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IxPAXAkXtGSfHE+6MDrNppIG4p1UF1/hBXNkV/LR66A=; b=nLkh8I/r8WcNY2pvJGmrJrikMnn+TO8AMkPMGZM8pTXZjSvZxAHr8xOJesAZv/1mPp VIXlmNBzkFlstlj1dKzE8lywagSFz0SpKuPfhmeJzCV/M7Mk66SUxsgw6PxeBtml5wYb Z/JJUv8U+ouDF1MrAkcSV96IzZlzVdi+nEOio1l/A2z4Gtq2a4k/zlYPEiLPgQDDtgDT jTBSeYHGsRcFnV7r09aTec9zuBf4AHqJjP9EzkjDujVjsR+JSv/asxgMSQ/5/L/FSyh5 Y/9/JwrfWIfKPgvKZ6BL17nyxEgGZY3Kpvm8wk8AAubS2x2kJoFpByOMUL/tATpmS39s GDUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733010955; x=1733615755; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IxPAXAkXtGSfHE+6MDrNppIG4p1UF1/hBXNkV/LR66A=; b=Ds7/HFirgbqZAJ8n1tVyH3MaClQc1X9M9DFb3oblM+7G0wL4fVRPlU1AinItok/6ID qsPZBpcUsZP71/Z3eDiZDL7MY0JRFNk8/UU+rc0LVUiRsW6k0Z7cWfZ3/fLVynrYwUnx u2s4qKTPH26TxMDMyfwPW2XzjlGmBqYL3BcEhzHr+OqB4BHBDycVrGrimaV5uIE3tQih XYEYfuShSq5aklcGtZJBYD3RUTTYly2XFqh+t2sFJObUVMjnPYgbX3dPWn7VIr5mi51X Gl+FPHORRc/2LLXf2ZgE/20byauSeV3wGc2qDjFQW6aDuq3UEOPHyfeOueg4vrwkPNFB VUxw== X-Forwarded-Encrypted: i=1; AJvYcCU2oLQaLlbiyWt3ADfltQ06oFbW2bxKURnCeNPCIhKmlP71Uf9Fv9Okz7/ZPCHmagka6QcpMIeFdeRTPAyNvvDh@lists.infradead.org X-Gm-Message-State: AOJu0Yww0q8m8RIGr1bwcC+F55qpVpAWbZK4xi8w6jKrM9I66Iri/gD2 /49UnWMcLO+nlj+c2kGpxNFYM++ebJGQxtZIRFFh7yM8KA/q0SIZf86FUga1DT8= X-Gm-Gg: ASbGnctR1056Q6hg96nfbUO8mag25T8nPDWKp15Hs1n9lBfPYD+cFsqrjyIuhY+Jnkg UVC/gXzzqeTf5kKxFYSj3krgQF93SDH9/btoFcXK78x8BHjX4GwUBpwwYs0pwTBa5DrtFAPCZwn pThK1kz+7S1ElD9g8KuZuPBWa+3N+ZOjO9fMSL02G9SJVnB7QPZ1lRhkprVbz6/CEKA3AQcKjA/ 8CrfPnTY2h9Vj4yePIidKZgrt8wqGv2b2OKvxcMKPhcsIvs0yHeLZ8rlg== X-Google-Smtp-Source: AGHT+IEiP7LHRrhx+1WZHRcdbmuf6q9u5MgJwOgShs4CTI9tBcamTyp7ARZo+XbTG2Yuz34sCo+pVA== X-Received: by 2002:a05:6512:2355:b0:53d:e41a:c182 with SMTP id 2adb3069b0e04-53df00dc9afmr8720884e87.31.1733010954752; Sat, 30 Nov 2024 15:55:54 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649647dsm900706e87.195.2024.11.30.15.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2024 15:55:53 -0800 (PST) From: Dmitry Baryshkov Date: Sun, 01 Dec 2024 01:55:27 +0200 Subject: [PATCH 10/10] drm/vc4: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241201-drm-connector-eld-mutex-v1-10-ba56a6545c03@linaro.org> References: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> In-Reply-To: <20241201-drm-connector-eld-mutex-v1-0-ba56a6545c03@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1060; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=lgKbIB6YZtC8eZYzJNVRgp7pi8XWpClyliAzF0BBx7c=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnS6XuosVGIxLVzwgwJF8Kv6UpGUOBhiO+tdbfv UsZEOLUAHeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0ul7gAKCRCLPIo+Aiko 1V2qB/9kxbcsSq/MwiRkIP4VkcbtJ6bvhuQ7s59Dqdt1LcK7+6hylNonFqksssAfCJeGxk6Rz41 PgtsXMXUIVf52olUBxeNBxH2OY+HNW4u5Q21SkNlRJh2M0Jmo7qcQnvJomIEF/JLLln7LE967u4 LJzHO8MY0j+0/Z9PGmgWmBObyPWPr4XVV5y/Wl9HZN+30NHViJDwIBGE1n0gmK2YS1053O/fbr7 UN4+r2D3Hx6EkhG2ZPFdgyrFznaQnOHP4P43x3PUt3CBr+Op2Wwa39k2bJPTyZy7IXk/JXc3yhM OB9LNQpibUSlojNLFeX59UmOP5dzC3uJw9JhdOJFJ+2D7v9S X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241130_155556_361403_E2FF77A3 X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index b9fc4d981cf4d682bedd978795cf7284d2650e74..7295834e75fb1ab0cd241ed274e675567e66870b 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2221,9 +2221,9 @@ static int vc4_hdmi_audio_get_eld(struct device *dev, void *data, struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); struct drm_connector *connector = &vc4_hdmi->connector; - mutex_lock(&vc4_hdmi->mutex); + mutex_lock(&connector->eld_mutex); memcpy(buf, connector->eld, min(sizeof(connector->eld), len)); - mutex_unlock(&vc4_hdmi->mutex); + mutex_unlock(&connector->eld_mutex); return 0; }