From patchwork Fri Dec 6 09:43:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896784 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 A0F9DE77173 for ; Fri, 6 Dec 2024 09:45: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=VnGo6ZNwboubgG4PK3zPxjFnyRb2ICdQLCcJ6lGvxCQ=; b=fJfI84Ky8yVOHzJf90lPF5SX0L oALVFZRRo2Jv1afjOzAo1nZcwN3GUiFBAov8zRT406wSnmpMUAcV/0j/hiAyKNpgUW5Y3irSVTO6Q 4IioMNAWDYQCK6GfcEg50AZyrRWMZ1+lj1HGsh0mVS6OHHPo/gDPc1kH0Lu0DPYyCOAfAyURLrbFI SIB5JiHAq2RtWq1NK1O8s90yEk4VE5yZ1q4LaSef3X8bR5CzXs/oqXuI0GrFeFaJelsCG0HL2eNQy YJWXrrTyCkeK9fTiMTsy3O+4zH7RNw861rtsZ0Ri+m5cRbo+IIYswNwQDKcLf5An67NEEDTzCHS7R WVeJH8Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUtm-000000018De-2UZf; Fri, 06 Dec 2024 09:45:22 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrk-000000017UF-3aYL for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:18 +0000 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ffc1009a06so15202711fa.2 for ; Fri, 06 Dec 2024 01:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478195; x=1734082995; 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=VnGo6ZNwboubgG4PK3zPxjFnyRb2ICdQLCcJ6lGvxCQ=; b=Uz/RSjy5LZi4vTJM5W0FK6YDK5vVuMobzjzi4lgbf/P1AxLewdu4Z8vvZELXJ0relM RsXru+qIgz1i1wJ15xIfHugxPVR2T9KX7bNb9msdopHCKHpQ3lNdUi8p3i911AQd0/OI /tiwi6lpdo5ZPxr1mPkp/mlIltPpNMp1Hfc207oS+4mkCbrCrMlLKNSBhauA9/2UL6zR 0mdRRnPtnSwfoLjA/gWVsSYPRP1WJM6Sn5kgMemf3k5wEA3Ogy8KH59kBsLNyGjUq56o DcEQMQrRAIs1qw8SFjQwchaYzJHqeRPE1SIDZ0B9wPqSWEBHn/EptYGSQePMq59d9AED IBLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478195; x=1734082995; 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=VnGo6ZNwboubgG4PK3zPxjFnyRb2ICdQLCcJ6lGvxCQ=; b=U1slkOL+p0AE/4zVqQR5dc9HUF//5APoxR7Au9tG2PQPaHThgU8i6/4Ct3F7PSh1aJ 2M3FiguvPjWVUi0Slnan7nWAS+ZcfcY+1NczLq02nv1oxIlgXeemArwI95JMyPTaGVen RBtOWr9+ovqC5Dbw4C2WbK4QcFdHu7dgNJ+y5T8Xb06vfpBcDYC0mB7PqetM5HIe09I2 jfzCBxAShFlTyO0LhcD/En+6+bhueznO08cEI8U4pZhrYUzEcrtu81yKGYNHSV6rpoGI 9RCpd1Pgx6Ei8uL+fW5KW0pd7JJpNU9JJ6Dhc0ol2AWiWRD6ERF9ocWewQgbdv+Yv1eR lwpQ== X-Forwarded-Encrypted: i=1; AJvYcCXDlrHelpdRFYxuJErPZ0yg44IPjq5+4MxANOAWnad9/9edJXmU8RxI8f9LM0+2SSZsejiW/gKLG/sQaR50uK9r@lists.infradead.org X-Gm-Message-State: AOJu0YzQDqykU2yB2Y6fOkPB6fzLQYx3oaWRmhlnP/43ZTUTaf8PvsZT oleYjF35mbzNck/lgyR+dMLBWlfZVFV+aBIzLGvIL0wcqEzIk/GdWEyPpAri/sg= X-Gm-Gg: ASbGnctKBejJt8k2zKN1CZsneerdHe937LaIgoFlg9kj6P5t1L45Zf8FbCt4oN1pZIz FdXAF6b8UtWiF2GjdO6ngz6Uy3n2DxuR59yWYHwE96JLAuA+fKnubiwcCFk/zLgpvHsQIbe3+/f K4TZ+PDte43oDWDDRZOqL2IE0pC34ApGsQDcqop9yuXNPwNM2tXQoMTOtZh7ag9j4vvkjX2lwmQ ZiShKY1EFV6vzYAPSJbw1PNcXMjef+d4uLo26xF9fUaOnMxd9MVHGRzZA== X-Google-Smtp-Source: AGHT+IHOfIBmoyEolZXZdyLfUjfRu7LK9x/y6e2NRNb0G1IfVvxWYDXdxw9kGPS8sm9OVNX+a5FRXQ== X-Received: by 2002:a2e:bea8:0:b0:2ff:df01:2b43 with SMTP id 38308e7fff4ca-3002f8aaef2mr6873121fa.18.1733478194869; Fri, 06 Dec 2024 01:43:14 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:13 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:04 +0200 Subject: [PATCH v2 01/10] drm/connector: add mutex to protect ELD from concurrent access MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-1-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=3318; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=3Q5pbMu5lborNDPG00HVqHDspCjjhjGT9968qr3bz9k=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUsctUfPifOTQ8tgTrVr4NDA9HQHo4lV6wGZ/x 802YkRE+OKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLQAKCRCLPIo+Aiko 1YTBB/4+LnnhEaD+gppGgLjgyd7DzGULNQMgJ2hoRulbF1tCZiqhH2JwwQgaiFxKaCK13GN72v/ +MlHzrTYbtF24x6wcNLxIFk87u2wdjCt5dO8xqKiiFF4My86VJebVFFgPQmUXcFvMWkWUS3PByj f9McLONHSWPtO0XRW3DbeQ8zzl5cChJhSN8/mkvwrNqq0BkWWOEDxxROis0bi2KSFK0/SBEJ2rN X+RhP/l08plhS1bGyEvzzOyAMvtpjSEsEYXf5mCZGGnypfY+YKJQ1VDkpPcX3/Si3R6D3pZ0Vpw Wfr3vj5voa6Xeg3e/NqY4k/PPQjahgFQwpQeJMdgalo1w5Zq 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-20241206_014316_898398_8E6C3591 X-CRM114-Status: GOOD ( 15.85 ) 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. Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_connector.c | 1 + drivers/gpu/drm/drm_edid.c | 6 ++++++ include/drm/drm_connector.h | 5 ++++- 3 files changed, 11 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..13bc4c290b17d556d654b7cdd8c48c24a32aba9c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5605,7 +5605,9 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name); static void clear_eld(struct drm_connector *connector) { + mutex_lock(&connector->eld_mutex); memset(connector->eld, 0, sizeof(connector->eld)); + mutex_unlock(&connector->eld_mutex); connector->latency_present[0] = false; connector->latency_present[1] = false; @@ -5657,6 +5659,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 +5721,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 Fri Dec 6 09:43:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896785 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 4C8E6E77173 for ; Fri, 6 Dec 2024 09:46: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=BXd2OzHxXLbpmSJUeio7TPXwyPaZHSalM8FhliMGDmw=; b=VxZtUTNkshsM4yOpOGvIETQniM +NhFop4PUwmjUGZFzJDORi8X8e4tKvXl1/eqVABIFF03lvQalpKb5CoFTpbKYNjdm+fEBDHETuSHk gQOOqY1L9vfIcM06WwNy4jBUITMycepx7rqxk7XC7zvuSXmfMAlGCX3Z3p1kNYiHTcWDdyjy/xd1W PGYVeBbyDaMLfa3ODYnRiHcVirbo8rLmxYx4HVqnM5KUSvrzV9RFODe3voEUqvv3UkIJ3Urqemk6B kH9+0dJWwYUuLrs8mg9fdSja2wwPu5b94xbDPJ6i8afNidsjuo2dYf91z7r9yvQiT4Ph8Y7pw5Qgs 1hQPFDbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUum-000000018Tw-0oZR; Fri, 06 Dec 2024 09:46:24 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrm-000000017VD-3vqr for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:20 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2ffdbc0c103so16744131fa.3 for ; Fri, 06 Dec 2024 01:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478197; x=1734082997; 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=BXd2OzHxXLbpmSJUeio7TPXwyPaZHSalM8FhliMGDmw=; b=MAJB9u21/sfCSidLiS6Ko2zoLEgXVC4txa20p9fxDHVs1QwW6tMws9pxFMemBsvN4I tDsqPOkku0xlp0IKTDJtP2WE0KF9CYKiV1jYfbaY4XPyBwcCCzjseMuPtW1eh8Z2wEDq wxYKAKuLTQwM9z44pKhS5ICatR4Ox2z70tEZK7x5NAOWMTZZCT97lNRBz2SGUMNmmm4Z wSG+L/xG4NMzF2r0atwl5tQ0w//64sgLSLeBf0fu9YkrqL94/vKtRFUnNeK73csHb6ex qpDAj34qRdJQs97uqr29JOfD17EIchwdmfHo/o2H1Yli0ZppyVKcNFifbSpMuiuSepLo zbyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478197; x=1734082997; 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=BXd2OzHxXLbpmSJUeio7TPXwyPaZHSalM8FhliMGDmw=; b=fGv17l5JEzy57XuvEQk8dEACAeXbuluogYChqE6snzIoeJ4ajUog4TNeFdqBikR9QZ /vjTfCRCnmpXXE9uswsJxp3YMNfxclKxbXSp2FO04wZfF4ZL7NfPxRsM1jSyJx8pQjkI uBeG6Fu5/91m1U1hNFznML+mr0Dm/q5z/H+bJt+JSkWY12VJ+sQmUbkTcC6OAuDZGPbf h8UBh85k1C2N9WLBwjcDdto4TMv9L/brxNJ+5vXWAJRKpF/EWWByUI8RoMts+ibC1cjX GagWC1hgNx1xgT2lT6vVgGEKRXSAJAvL3EoIlUkGV8QqlquMloo6HmK7eywmRwpluZVO uMug== X-Forwarded-Encrypted: i=1; AJvYcCVTb05iEq1l8o480xxV/v6DEus2Ztqbs/qwe96IrKyJiUY2kxnaaWh7HguryDmQUZF6z4oLxqoylweRsVkMEdDQ@lists.infradead.org X-Gm-Message-State: AOJu0YxE6O2cUBQUQ7IWYEjIk/FajtgrdjIX7uLPYaoGSvyiGQmUck/+ tXa+OvruAA59ij5Q9uktNtFByY6dJDfXGSReXjU+ZfjZf2yLVh32NovFW9XkwYg= X-Gm-Gg: ASbGncsrQ8ESTN7KjYN2vp5rODTx7H4FIHWiYueuorKcUlNDa/7oeKcBk1uww62dJfF FIKXgA8uLnieHZXkXti4FLEIY82fH+WCT/uu/i+gMo9s37WKYqtRNnXiDPVbmDrcgSjTXMfb5jS pyIt8y4H/qvqwZbEui9GFJJ82ErWRALXQm/SbFy1GW9XOd60vgUlhJA5fc52YXGYXXEtOJWEna8 G+h8JILFrJ+Wu7qTHPiuaNGiKruDOeiMuLgZ4Aqh9wcIp91LzEfgLdJoQ== X-Google-Smtp-Source: AGHT+IHOzYvZJj8Vkykxd2x0JSD+NBvzpXfm6jlvPobPhv2vFXWDLmCYeuoQOdT69cvmzqWGVgvY9Q== X-Received: by 2002:a2e:a9ab:0:b0:2ff:d0aa:11b with SMTP id 38308e7fff4ca-3002f79b514mr6682241fa.16.1733478197396; Fri, 06 Dec 2024 01:43:17 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:16 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:05 +0200 Subject: [PATCH v2 02/10] drm/bridge: anx7625: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-2-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1073; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=zYvAEMAKJI/pMjPuMCGmB4bmJnIIZvQ3OxFQhHsqYJE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscuOWsnWIy+09WL6ZmIga61MhuoPN14wFRyc CTUUhM7PIGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1QuCB/9GVQCw++i7vtbIm18C0qWy2CcrBgiveGKyYFt0iSpolRcgaG6RbcwjW5qst9mjy3Q6fyT wfoOatec5nsxe7H0nq3z0RdLACzVly4qvlxnotelWRdH/BQ6ujFXyFerWcmtX3JM/VBGIQ2IBAc cy6kBFVrFFfY0hrjJEvNHpO8Jw7wJ8KQT4IzkIw7DCzBnKyhq7QShr5O2I++bdw+2PCmYR+Ig4l AKpe8UolsbHTV1DesMVMTPNQMXDw/veYJp5B5GOVzXYZoSXeg0/Wp4HONWYO6yhjuqBKn4BL1Kz Qv9O5BOb777DITYj54ixLYloqlzSi9P0cRUdPa0UewnOGLrp 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-20241206_014318_979837_2CCDF5FC X-CRM114-Status: GOOD ( 11.72 ) 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. Reviewed-by: Maxime Ripard 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 Fri Dec 6 09:43:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896786 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 405CAE77173 for ; Fri, 6 Dec 2024 09:47: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=Wh7X6NiXjO0ZK0icbu5RRSIlyMlU/s3VBkgppSRGnTc=; b=hDU6308YMQRsK8Lp7OrgDL8p2L KCBKhTaVt80KesOxHITgOCjTo4c55NAPFYlkPmFX6zX6fEWTC3UOU/+0ruLn/UmrGPiNfms561c7n TqWVh27HtIC8A0Beu6ufKvzBcBNmFAjuqCFaMr/KllTaXwJ42Z2JsGamL8sjnlp2q48Ev8aIWlW7K sUxZEZWdOoRo0FxNUKQWvznp4PNj2tkBhadbzFrKM7gel+WzJ8hxhknEjnu5k7dLWELo8aDas+WC3 4eIWOKpLrDNOtfb2uCeg+wN4t313KNhOWSa4M/yym+EteOBWO+12UIsv53u8oIKeDC6e89vh/Z4cD ldhY29sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUvl-000000018dZ-3ReH; Fri, 06 Dec 2024 09:47:25 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrp-000000017X0-34AA for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:22 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-30037784fceso2190851fa.2 for ; Fri, 06 Dec 2024 01:43:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478200; x=1734083000; 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=Wh7X6NiXjO0ZK0icbu5RRSIlyMlU/s3VBkgppSRGnTc=; b=g/kPGEwbRmvoyHIzU0z62li8f5CEikIw/pHewRoUWEkddbtstbMZLIKLea8acmP/oo Aaiu3Ug7B8kitP5sN6olURdTPLVe1e/R6G+CS8flGMdlBXGh6o0eAOfEiOwfk6t4Gbd3 Yszis4uwMLHOjozGXpSRduqHgMLErD47mNIcAY2qJ75Aj8dUntQLqHFqoTuUxcwkVfr0 eaVXxYNP0fdYGHLyecxxy2reGKI8TbmmzteTWXdY5LLgVXxJ+AxyrSRDIXQQUv+fSJjU 05MuX6so9gHokBlbGnDa5+sHnHs7x9nn4gnbFnHcy+Q3xb7R0RqIt7/UMgOpWtI1Vn27 ohVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478200; x=1734083000; 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=Wh7X6NiXjO0ZK0icbu5RRSIlyMlU/s3VBkgppSRGnTc=; b=wWCGiMYIsqh/Wbn6H9l+kXcjyj+sp+5ApbbU/NVpVUQhv8PYxZr1rtYaQW6GxuIVie ipwlU0G0PKdM/PrDrf/WNXA2wjyvVS98lmnp1wmyI4Cc8hS8FoWqaaZPVooS1jEUb8tm eACwnl2ugwH0bSb84VHXOeLPfzSVqldyIEGxGLNzHTILQ3CEU5FktmewT56ksBWBbceX T8Cwm7tFmT6/BFdJXfK18CyvYmJbcTMNiiilD/sYZ5ifgOPAod4NVdMm8Km+NbGnUS6h ncGP+HxI386SEM78P98yFTQ2o+hrQlYTkbSTHesaZtY6MDM8zU3y6gdbh5IJYPI4dx5H F46A== X-Forwarded-Encrypted: i=1; AJvYcCVEY7m9UbmRV6j4Xa4PJncfF2M3JjOk1Gz6+bqw6u9C1NwAfbYdtTnA1pCeb0vFwQFyawuN0vo8WVGGNVGVuiU4@lists.infradead.org X-Gm-Message-State: AOJu0YxP+npQwW0DsO5GnsVBsreA36LD4YX57/U63+PuH1uHb8/jV1/1 2wcfSSdT3LL/xNYXCdz8xEAkoZTGSCnHvSKS646P6uL/bdY/2Xe2IpAIzUv2E9c= X-Gm-Gg: ASbGncv4qL1XZoiklry0B/OLbJ6eeXgL1jfiV2tYUF+wqdQnex0+BQFMWi8gwS267lN bASaK8FWq/ACjVMgTbFiAxpaoieEfRkl8d9wngpp7ZqyrenkKQJp0bKDdUqDuzCR/OcF6tFkpri tDxlup08cW8YRPPzrjNst+Wzmx+W+no0Tq4YWUf1t9ddYZTw5nMzi1g7dsZT0b5iMkKyda/xdqj E4So3s8uP/6I9RGFgLPFms20COurpagPCTqMSUgR8mGYUBzMlavu/90Eg== X-Google-Smtp-Source: AGHT+IFBxT03pxchsuAow8zXPe44X5vXMeN6+pzw5XgO7yRZwFTl4DSSqXqmQN/nIOwdAf9XNhMk0g== X-Received: by 2002:a2e:a90f:0:b0:2fa:cc86:f217 with SMTP id 38308e7fff4ca-3002fcc6314mr10909661fa.35.1733478199996; Fri, 06 Dec 2024 01:43:19 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:18 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:06 +0200 Subject: [PATCH v2 03/10] drm/bridge: ite-it66121: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-3-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1093; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=S2LNy/QG/Pvu7jaLQRzV8x9aVeJiuTJJixaJAknwzOI=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ3rQcT0D+fWrdf7eTuO7miErYRRq/uGdQ1bilxVd2j16Z z/vrJ/SyWjMwsDIxSArpsjiU9AyNWZTctiHHVPrYQaxMoFMYeDiFICJpAtzMKxmXrAmIf3sx79J n5x5p8lbc0yOj9hTUFTN17jvemrJ5y/aGWJsN90qs3j2HCpJO3d947HLoiufHO66EK487WcPu11 nm12ex98Nfkt75Zb+CJdfGT4lNHqmtrDVbxVb710nCjUmbrr9djMbP9vtiRfb/tVodHA/9zbjTp F0UW+v3VO2sZRl3zl7tlRnDkUX0/ud0U8Cn1rduKSQ9zDX7POhM+sniP9cXR1c0TOtPPZAG7NQc 23p9xmHks64efKmbr0dkTlrP/cz+ZmZz6Y5SZ2ZxRdyk8vljuq/sP1L23tFZb+4PNSt8KvLEfbi rq6MWdlq8X/xgh4O6wU1LBPiahwNfFNvHJtbsfeP697ZAA== 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-20241206_014321_773217_8ED941C6 X-CRM114-Status: GOOD ( 11.61 ) 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. Reviewed-by: Maxime Ripard 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 Fri Dec 6 09:43:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896787 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 45F05E77173 for ; Fri, 6 Dec 2024 09:48: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=AlZ85fU7bMEdCr3Ivk/JPNhlYCX1et1nGUUrgQd3Dz8=; b=JNcI3vN/Gzdd4ZOaUugk7yWG9K aEujkvPqWgbRIhnc+jLIyaRC/Ua9r1Mqtalm6utjeACyfoS6QKk4wV3EYejl5Y9QAJ8x4tdEzDE/q HuZGuMURVOutNQN7vynLV53XfSpUsvGSav+/rOc9BC8mLfOwbrku+/DRrOW1WRadzWGpL0pDPt37y xavVTktcDJLlhOcM/40u76z/Wb9jz5NExO9Q3y8ssFtO0XwWf6MnRTjuPysDqXzif/DtfNSE9EDeC VQlAPMgXFwTZRtmKxYt4V8+vsdudTYMVwRy65Yz+T4WG4AX2ZlDFOPrRQthPwlsW8ZFw2BV5NdAfu /kXV0ADw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUwl-000000018oQ-2sBL; Fri, 06 Dec 2024 09:48:27 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrr-000000017Y1-3IOG for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:25 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-30020d33d05so15706061fa.0 for ; Fri, 06 Dec 2024 01:43:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478202; x=1734083002; 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=AlZ85fU7bMEdCr3Ivk/JPNhlYCX1et1nGUUrgQd3Dz8=; b=y7a2dQGKwCFRknorBocPKvxkjpgl9wau6fHT86gc1cZBjLnZjrLlMDH6aXMRnqJI9v ii3Jy/vW1hj8aTgWF1MvQqPCZWEaXfD7A0PfZb6BIFpjXJDZl6ZITl+XQDY+pnIJRU+2 vlqdBChAC2KDNHt6E2PF3sAhlOi36OR2cqVIF1vbUI5M+irhYJ4zfiMG2jUhSKVfo5Y1 sU+UU6uaOSCcfAwqlBz37g4o5f9t9tB7/R6yXwn77w6XdQ/Ht+It+dIKcEPyEVCvLrWY i0A60yECQHXtBdpU18TjKEVZIMwi5IzWHxvkLzlzHHxzfqq2NHj5wky6UNJEViOfWgef JD3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478202; x=1734083002; 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=AlZ85fU7bMEdCr3Ivk/JPNhlYCX1et1nGUUrgQd3Dz8=; b=GXaGCePtsphB9IREyFVGv5X3bCv5vPCeBWQaVMPhEKOR4/lm5VGwzYLE1Dg141lcb6 rVUMHUwr76lrEnQAfKkKkRjjASysV9SYPpyTVjUf2Ru3yKGmqBRlss9lxwFaAADuBLAX f2o/+RlW6eIWIvRSW2GsruFUxO0oolYnSxc1iqyq2Hi3JM/yfJ+xbLKMG0ouRo0ciXsd +E/3V0zxSxA1IK6MShJ5yN7QSgr6PxHaV+HYiDfASqcDQbb3meD57EQMWjuqEgNdvYQK ifXwDuNgh0obe5ZHWlaR/43vydWTR/jJ8Y7gIWRIF8ljQZsqXEXI7fESrbmL/PO7XCuT YcZw== X-Forwarded-Encrypted: i=1; AJvYcCU9Du3H6/aiw6C2y6SBs5QxbTfsZJixDM05MLYflHIOe6dLaILBbeAYvLPdcFZEUcuBFpbse9fMhbuZg8rBLZzt@lists.infradead.org X-Gm-Message-State: AOJu0Yx58LeKlB9gJVtBGwOgiZFUaXJsStoCMKXWmy6oa87PonU5QWT3 /jAoJRiiUNyJx4YzOUqrOBK6eB3zwGS6J44e3PEqaB6ZflOTtP0VsOSO4awNDNM= X-Gm-Gg: ASbGncuISIciUWCehCaWc5FXM46YmgiboeJ43naPS1DWO19LtAZM60gsuOZyQ7TrQNu RzEFwPXA20h/u/HVmPeOdwOLZMC/bzqPuQAjoQQE67xZw/r4EUyuFpWJzo+AvZ74Fifq12XuWGh tLtUl1sxtJnfHnV0eD63ClUGzniqlQGxhbl18J2f3+YqbeHz7BVH8LspUEu7YSoyAvBqzDW4SU1 hG+B1MoHfV6T6LnFieIf9S29j3Sj1YuOkTHBjp9RkL2Yt4UT81szfPogg== X-Google-Smtp-Source: AGHT+IGE6b4F5G8fB5UzCy612X2zS/z9Gws1TIKohedsOmxkKxomXTuE6wjdB8eKM7SaKj4xHi2otw== X-Received: by 2002:a2e:a9a6:0:b0:2ff:bf0a:2226 with SMTP id 38308e7fff4ca-3001eb8e67dmr19885601fa.17.1733478201781; Fri, 06 Dec 2024 01:43:21 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:21 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:07 +0200 Subject: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-4-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1082; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=xBnYTDnWSnfj2+gm2t5bxnQqQ5FnybkVoMOlzhUTQDQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscueDleWgUKJKAcLnM9AVfyZmdn0HpKF5uCT kBmRHGm9H6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1eleB/9rtsqyEXNmADXNUhLtuCtrT54s5AaOypZT19JWbxxkqIS98oj7wNLlcf7TA1rOQTNS5RC dvsjFVOL4cizIF20+Xp8TdJpnBVVRKORmoXxY/g+sGQsD+EyOh+b04CJUaXVrWxd8DJsAwzaO8w 75HquG2asaq4K33OkBPkZ85wATKlXdb9yjA+34HEfbGr4Dd71VsgTtQ3Ozs0zJ7lDxU778quIl/ b+/N+ADy5pyhsVGIAgmAr74L8TzRGdbpMnzmSPT2IwV7qsqdNr+KY8fyDGlhRaj2FA4wIhoLac1 9tx5/gz16qNpAiJ9A8ijUf1L2Ck59EMtUlTVlC/at/0sY+sa 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-20241206_014323_829476_2CB9073C X-CRM114-Status: GOOD ( 12.07 ) 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. Reviewed-by: Maxime Ripard 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 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 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 Fri Dec 6 09:43:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896793 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 53897E77173 for ; Fri, 6 Dec 2024 09:49: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=DR5UNfjajRu4P0t/KAHkaq8u/GtT1QuQGweWq5XMJM8=; b=Ep0Z9AbFcA1Krvkl7OSQ3M0yDt EahXwNML/Dq8/dhTUmAl28Rr3QyR3Vff0iYePf+C5pde1MF/5+/IR4pSaOR/YTvNME8ERX1zfcSWd Eor4uBtcc4wb15PeHmPI+gKZyR7PbOUIl6Ibk8UMCHerSGxMZaCkYFEJvvn1oIYdRc+Tln1CpYNoZ L2U7v7g0GiqAMocSJrC3CxZQnizno2eNG4ktPdef16kVB6UqWDdlYdBfHc6tHLJSDR88A5R9YLIYB bj1ejx4TDUVvHrBos5ksO6PSnSfyM1Hv0oefPZMBi9CpIlchZPh31i+0zMdJNRj3827xOH2l+LQkj ClXQuqNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUxl-0000000190b-1emA; Fri, 06 Dec 2024 09:49:29 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrt-000000017Zi-265G for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:26 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-30037784fceso2191531fa.2 for ; Fri, 06 Dec 2024 01:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478203; x=1734083003; 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=DR5UNfjajRu4P0t/KAHkaq8u/GtT1QuQGweWq5XMJM8=; b=VoFWAc0BaQdr7522+wuMYMHJxBcl5cSLGgy9cpDkbbmOgwx28IqBMfvwpk3F9qgscR j30nkD6qTAmfsffdnrwJbW2PvtqGIKFhLKQHxur7Xga95JCPYMf3ln/6eW0RppwNJU9K 73d1UeFyGPsXn8kyyo/jZum3MisDefH3SXs8wReHez5JCn+RIRuPOcG425mqUfO6aWhT xQXB/ZpQEv9wI9+ceFkwXZAqR2HCLcfM3nGGciFlag03jjJrsafHdGXirFVRhzpP6539 3ZFFagQdmIX8+QnwpNwV+RLQACHHQS9TkOeLmkMg3xZdLZ0G94TW8CmnOymSKV3FApMS 37mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478203; x=1734083003; 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=DR5UNfjajRu4P0t/KAHkaq8u/GtT1QuQGweWq5XMJM8=; b=Vz+D0oQ2tDOlRE2R5baV3mlTyLEzzFUATlNKM0Nr6MFIAbvbQNPyWFxheXssu3Niqq /KZr4PejdjF8EULhHfSUxN5UXjoKxF7DrNnG6jdd907LixmmWn2QSb+jcySfRWiim7/w xA0vkvBQWFIF+v+rIrIoJ/D6KC2MNiFIlmOxMMmUXo/MLqELlvRGVU9A9i/hkHQ3k6Y6 C14vfhmH9Ibb5DffJnn7GqBv8hi/ECebbNx+swJepqN/BaVaP45UnRZMrYpwYUjWZG4R Sc3k5rCZSJ9ieSw1MC1sMYeot07wYNjnnWIeZ6ke3Ov9gXzA9oKdpQ60R+rY3HJ+W0ni RVEw== X-Forwarded-Encrypted: i=1; AJvYcCXzzF5/nIpfa5kGl9hRcDhwA/JE9jHWTg0XFLC8UN2tSBGcMR+dw31OD9Rc/AhIoCxrXx6wY/B60EaQdg8qmP69@lists.infradead.org X-Gm-Message-State: AOJu0YzeQ7sA94f5O+XzlCNbeqHN5xPhBpFE7OIfodnSEdEtpozfWqT6 5uxheoPtSccQjslPwTXn9IBCzmYjeJ8yJl0RHMThpg2t8jQqqf9Ke0pJtIs+tic= X-Gm-Gg: ASbGncvDE6yqpxPgq+oSqcXLn/M6EwGQGcS8ZbRKd7AdrPS+U9gjm3Z0V403/MABzNu nQrRxvg5MHzPPHX3+yCZqpEcQIx6bn296j3vAJsm2E1XyF7HOLvdRykyPVtMrWcpyYxXL20kmyz uyJV4vXJk/PAIiUmVUM5PIExi3ILT+QLruJ4j6u5LcssXSBvSW7L3d1s7meMAa6tJJZ89ErFqr9 We1KE1oTAqr/f5w6Id04nW/P9FVATH/qfMnuzq36Z6AzvAbuw9hEbMC/w== X-Google-Smtp-Source: AGHT+IGCjsHeF9S3xd5zx/P4eEcmZ95qD374mHfeNE0TcJsafXsKauKXde2wl439IjRQlzjjyxvauA== X-Received: by 2002:a05:651c:19a5:b0:300:eb1:a4f3 with SMTP id 38308e7fff4ca-3002f8df262mr10870581fa.14.1733478203466; Fri, 06 Dec 2024 01:43:23 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:23 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:08 +0200 Subject: [PATCH v2 05/10] drm/exynos: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-5-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1061; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=I1wH9N5enlUiSVwdDRB0wmAdGhFse9ySIo7WNjanmNE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscuTpR0+HiR38S1fTr4ertYoyhKL7gh5Neki QVFnX1dWgWJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1cP5B/4t0Yy2pHo0bHZjNzf9FSu/qDR8IpkFFhM98PVBn8EV3bNlLhb3/FOwaAYFawC0R7RFsei 6gC0/YzWxhmMGYPjsOa/37GrWtmPrdHhBZ+KBT63EfOBOW+V3p8zsoWg67YBwUdMuuGRt0u0auc DgeeGk8WkE3xEW+/kPD2P0j0s/FWIYP6HpthpzIzXnTLkTKofLtovXgVO4JA7XKTloel9mAL6hd YV3thOkL+KoTiLV5O4nnCwLlrkMriaWauaCc/+rcxPaFF/ZnLJwVFuHb04GMj7WXisEfuKJ47PX zmzNh+qUndFSRAODqbBfgIEe9P0WLax3l98lRYUC73tWfPVy 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-20241206_014325_545235_05762E4E X-CRM114-Status: GOOD ( 11.87 ) 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. Reviewed-by: Maxime Ripard 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 Fri Dec 6 09:43:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896794 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 A6CB0E77173 for ; Fri, 6 Dec 2024 09:50:45 +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=gezQjvgIcYxaejQ8BDd64CZD9/Ck9vNVcEKNgvbZ4wE=; b=Eyd2K51eGCpIX/qIjqVpjHQPn+ Q/8PIHciqtEPCJlbAGH02Ivy3wCU+XvQeJmPZWtfIEakgYoo5GDPgoasIGGExhecC+2U8IIW1789M cT3liHYcBOvBeAn/qhn0WrcXI1Q12ltCs2L22TqIW2uiHO9Jhce547TXxgbWsonGt3jN1MlRk154U r3HyiuGso7X4z8dzFFVeEFsEmB77Y4DBK0u0DQJv+aYgOXGWqFePHqSp1WQx+LTdjN0MXZFLGTVbC iVgtd8Pm4r+XFG1RVZTLNiDQgCZGiMuP7nb6z1M5qECTImiXPrXWDRtPFDLttUJrpz+N+1/jpkGiV 83ACYNmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUyl-000000019Dw-0HHP; Fri, 06 Dec 2024 09:50:31 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrv-000000017bk-2H58 for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:28 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2ffc016f301so16427771fa.1 for ; Fri, 06 Dec 2024 01:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478206; x=1734083006; 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=gezQjvgIcYxaejQ8BDd64CZD9/Ck9vNVcEKNgvbZ4wE=; b=CcZGMC8hqgG+9pHVa9Dg7RXM4IGNMh9aCzKrZ6aEQ+R1u6GL2SlPW6TOC409QEq1+1 fuLM0vXntM2x8t2aQwdyETfIJmUf1elkn0lhBIYVSQSjqqwzu1YKx6ZbCuJ3zEEyj0ZB oSjXFy87Lr4NvPfjMyrScIS6EbGjYGOG1lLftEilB4NoqUHwLAGbMWFy5MaUDD4cqxYp Qh3np75io+Z+u8+AL+zqT6Dl+0ZzSyLIb26TtBR6+LdzmQh0PdhOYsCR6IXvEgxulsuw MqaZubJ0vJ0IwKsrIqknR4iHLT6Zn2xo9t5hAPza6TlCWZqNdXlMALGAjLmiAUdWXNQX giIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478206; x=1734083006; 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=gezQjvgIcYxaejQ8BDd64CZD9/Ck9vNVcEKNgvbZ4wE=; b=ocX085tyI3sYQLSWYpQNzn2ItLW2/N1bBYG793/Mcf5LeGDTOTV//hkSuXH25DKu7Q 7eYyC+dhRlBAoN5/7oiVeBtBoDpNxUEkLq66NKWrVV8s7v+rSItggYWfaQGgzxMPDYIT agdWG8IUlp2DWoB+gyf6la38ZqLRkxDUO0mD+TrAapte2xxPLAhfEN1XlE1bpNsTWGsq Rz6gS7rDNYPx/r1DVPIf0o9DLJsbPECFBSu+KjJvRGU0G+GXRUfRSsWaO5JzlOq1xs44 FmB9hga5DHlc+cjG6M2OySOeq30Hxv7ttzJ0fnPjkiKJtJftAANjWhAe3GGkBao5U8Nd +cnQ== X-Forwarded-Encrypted: i=1; AJvYcCXLvSQsiYuv5FEsFhEjHWRkm8TtEEib7otoWZirpog1+x9/rTszhTz8EpRmLoi9VM3EFx0NBCvt1SYLZ09rnWKm@lists.infradead.org X-Gm-Message-State: AOJu0YzF4CTnDZhYiPZi+l3mGnPDK7JQLpN9Ylw4fldGI1f3B8A4EY1J 2Xk+IAPSVIOt2CE6gnNtuBxMGffipB8QU+7NQRPYgS7spw53ZiKB79blA0v1p7s= X-Gm-Gg: ASbGncsxQAF9hNWbOydA9fhvjJ0zDMtrhRtGXILdezjVVnPmqt96hE7I79QA12Wk8OU M/AizIVUkkHaX22Sglg/thwWqyGRUQmZUxRlqJwv5LfazYCTINMwiDqcS4MJ/NzPm9YDSG2J8dI rloru7gxJAIOTikCjjX82KGCMnXOhcmrSdHSbs46KVfJerM75/RVY8MXwc+klknEabrGF5dV35v K0aJv6LZqHqMSGODPJ6Vvtc1N3lf3L9yKyYpIToEsS6eUEb7nqsxRzBMw== X-Google-Smtp-Source: AGHT+IFIxMP3XivqZCXghDCnZTnDDHCeTBksUkUbx72OhyJC9NMw97gxwKXoTkYomD8vLYGmPlA77w== X-Received: by 2002:a05:651c:150b:b0:2ff:c69c:db0f with SMTP id 38308e7fff4ca-3002fd14d81mr7610671fa.34.1733478206004; Fri, 06 Dec 2024 01:43:26 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:24 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:09 +0200 Subject: [PATCH v2 06/10] drm/i915/audio: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-6-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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, Jani Nikula X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1533; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=tgOWbzXmlfNkUNlgKabtbqj34BDfcm3kqO9iU9YutCA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscuyv5W8v1YTELbuHmMKcJNbiEngJDs2MHEM hFooEYTmIOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1axkB/99cecYxR+X5C1zAyfkKFkvE75Us55r2gVNp2BPRSD08mYQThqr5+QEsx38SPihPleo366 eaLD1hT6L2kyK6wdMq+Lkkj0kbXEPPTe9pj1Aad/UleIfoTG7Ps/uhFSFLdKRs0DnQaSZQME+VQ M2v8AFXHFAYJgM+8WPJgC0HTtuPSWfqBz+0JZQvtJgjoKRndMOmhlxr4vbN5xbJVZBgEPSDBujk kmWs3fgGh1o3Yx1/EyUv6Zz4X6sBrwrTlNvZNOSrOmgizBJLo+cBQyXqidSxYnZIp1DqJdxMFo4 Qq7ORf/cwV/dZd0e+mmP5jB0ifPb0a3lavlzcLRDNPRaca3O 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-20241206_014327_596703_114C0472 X-CRM114-Status: GOOD ( 10.86 ) 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. Reviewed-by: Maxime Ripard Reviewed-by: Jani Nikula Acked-by: Jani Nikula 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 Fri Dec 6 09:43:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896795 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 16ED9E77173 for ; Fri, 6 Dec 2024 09:51:44 +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=MGq6aED53P5HelbsA7MK6wW8IBVofd/BuTMfX8bnHpY=; b=VFgG5KSeLKPJgAJaM41cn2dhpG htrGDYaUhczLxsT0GAnsL4JiPZwcsL7YOIBrIOybVMo6zA1KWGpxXXaeqoTbip7DRrfridyJb6u9u Ai0TMnbbEOT4VN8VWxabN4wTW82Es5Qc0VizuJT7dzb3U1rrwAVVoC4HRkn+0pdwjJNiCzf8mBYyM WSruCB2zeffFvXWdxw5oy2sb7aJLCvo+XgfZk7yGs9uXWrp6c8XuoBL8Nd8xv+pVVpuebElX96ZQ5 gfCNQpI4exEoAKOusEbgEXNeldikw+J4mZOwxi1dyzNQH/Jafy6aRLAtGVQ2scBol+eHusKG7SbLA 1D91lJzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJUzj-000000019Ni-2xx3; Fri, 06 Dec 2024 09:51:31 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUry-000000017eS-1yeD for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:31 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2ffd6b7d77aso22752441fa.0 for ; Fri, 06 Dec 2024 01:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478208; x=1734083008; 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=MGq6aED53P5HelbsA7MK6wW8IBVofd/BuTMfX8bnHpY=; b=zQalvKYA7ibmWk8VVbvTXqUSj2tzQSK53h4HvFjzzS5UrPmEEUmOv3Bz/N3P9D7B2X iT7soR565Fq7ye3kBISyDw4ErD7jfg+gVQtK5AQ+uaK3RiUTYFcJyMle5yP58gfRJdvl E2OWMH8tzUjKCc/vOgOcf5G6Q+UF09spzZ5Yu/JFMiv5JLNjxMFDd1g1Fi4S++8cKKTb MkqjK2OjiEWgIfwWvIfra1sYJ9279od4iV3CztZ7630/qCtHoppwb6eiW0b5BDYxGynQ 5IFjJDm0UkxnEa4ffVbPBy0IiChV6psd/y36KI5C1/L9kh3OZ4bfhaflpgsskmprTik+ 4Snw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478208; x=1734083008; 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=MGq6aED53P5HelbsA7MK6wW8IBVofd/BuTMfX8bnHpY=; b=Q1JXUKN+NoXzzCN/L99crlMRG62/NGyjUOLtE7yfdRS3UnKrndIythGJfdZ/IJ5icj NOqoPxL7sjtdiZB41HcOiuZA7SdrsQqI92POJPsCdqg2NBd1QNjqtE+0xxjq+j6BFizo d3sY4HKSL6Y4h6smcUBNVtQQD2jJ+lV9kCwCBMNFtXPAk8P+OQpRrJH6gcK0IY/Gy9sl DgdEWKYnZ7/4T9tN9TWn/GOAOZr8S4tMJsSRzxD8dUfc7KN3nPR6E/Ji5tvBy8DSKK7f PcaL2ku1HRjotuj4YKaaZDZ27lYqB0DRS4T+Xryw0FSgtZ3qq9zdSVGKiOMsbgNMkTEE 0V1g== X-Forwarded-Encrypted: i=1; AJvYcCX3v1Dq29CF7Z3Obe7xZQFR4W0JtHjrntzlW1KR0+Ce/jUU2AFQAwJdncjbW2CtBFbpSJWcBzezTqjoUoB4tJ5a@lists.infradead.org X-Gm-Message-State: AOJu0YxA4aXOHW0OylQ5lusJ17HNUgIPtpeKWj8FWfGPCorxKPkstskV Ug5mnj1ko7cazipbYTasZ3i8WCbkTJpiMSImwn8EZM80wlVUNoHh6htNYG1h+wc= X-Gm-Gg: ASbGncsplV1J8Wd0IQeXkK5Z8+zc2GZ5eOow+CrrlFI2HJ+NNqf4Emxw+kmRlpRGEjv p0392GQv3uL2vqqdA4I7SpwbQu0L82asJAp/kMtXm/GCpox1kOvfBWACNQOSS+hriRYNkLRlVj2 EckIgSVPXTUf0L1vXH36jeEI2xB15YFouV+a+XMRcq1vXzeqg6rngo9OfAUXmYd3pmtO6q/xHgE 9qUjt7LSM8F9YgCyEEdNPcDYxt68K86O1ukQLIGOA0y+iMXAqOEV7DSiw== X-Google-Smtp-Source: AGHT+IE/NYxmjluRmONb1EoU7KbKKPH87buJ0IjBEcYtxmwcZQlKK0G0iiNZoTWvmIko49pJuOa6eQ== X-Received: by 2002:a05:651c:b29:b0:2fb:5f9d:c284 with SMTP id 38308e7fff4ca-3002f8e7df4mr10594341fa.16.1733478208528; Fri, 06 Dec 2024 01:43:28 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:27 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:10 +0200 Subject: [PATCH v2 07/10] drm/msm/dp: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-7-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1113; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=g8XDt4tMHXpR+O+C6P49zaXUZ1QAJx0+8PEn0RE7Eo4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscuHK4m+of5M0K58J1Ue7FnC+JgeJ7oM6NSu bFPedJdqXmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1bfrCACW5hMSxLBb5or6qGH5D5AVPGJIvY9BGjNY1WTyi2PUHO7TE/oo3Ggc7rv7l860G7eGzQ8 uVT1bon1fazOdXW+lYbtHJWim9TYibboTYhb22pQ3YrpWEiuV1UbYdHBB8vzbzO9jXkq/bJmQ1m +E4FMSQ4cvduHdnEWi/8FNjp7zOIShlJYI1KIxungwjDjpEKEtea0kLBR1PRGwCG8/yZZUFfQxI QckeAW77aJDzAZbPOuHWb2f1rJKPg5flOLCaaqtxskOhiUml7r060zILPXNfrxMo4DMSMj+jYwz 1HVsVa0f3CLU5a7ZBeGqVsa/7rnSuUMsfCkuJrb6r9MQM91w 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-20241206_014330_510911_3C185B39 X-CRM114-Status: GOOD ( 11.70 ) 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. Reviewed-by: Maxime Ripard Acked-by: Abhinav Kumar Reviewed-by: Abhinav Kumar 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 74e01a5dd4195d5e0e04250663886f1116f25711..0fd5e0abaf07828157085bd680bfd3c7d32deb61 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 msm_dp_audio_get_eld(struct device *dev, return -ENODEV; } + mutex_lock(&msm_dp_display->connector->eld_mutex); memcpy(buf, msm_dp_display->connector->eld, min(sizeof(msm_dp_display->connector->eld), len)); + mutex_unlock(&msm_dp_display->connector->eld_mutex); return 0; } From patchwork Fri Dec 6 09:43:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896796 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 021B8E77179 for ; Fri, 6 Dec 2024 09:52:44 +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=AjfS6UDkVSnKuZTI4p5OY7qDfSEHNtP2btpHCtUSsMw=; b=wK2vGp07zmPn5QTn0TOdYyo2Gc fGP+YU2wxcfGNqxkF4BqNNbzkNEFDBz69D5/LiaV7iQO8I2CrumhOkbq/BfOd/Q/aTR1Wwo0eY6CU twit99uz2AtTAgqbJT6mHUXBcLrtLJMAzfVpY7iVd2D0txWQ/KlaO0lzdQgKEFL0ZyeaPcMPabjik zYJKlx/ehNT1bThbdG43IWwI6I01oTV5YXfc3ZZAs7+J9LZd6yGJESXL40bUvOG9I+xyxnhzasfUX Ik8xLZ8vFiYG5skMQJtkhplJAU/fdzRZc2PJWTvxrsAzDkgmEsU9+5qXV4UQ8ReqKTddhW4WTYQ02 cP6Pbzdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJV0j-000000019Yh-3nZH; Fri, 06 Dec 2024 09:52:33 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUrz-000000017g3-3R9Y for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:33 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-30020d33d05so15707611fa.0 for ; Fri, 06 Dec 2024 01:43:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478210; x=1734083010; 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=AjfS6UDkVSnKuZTI4p5OY7qDfSEHNtP2btpHCtUSsMw=; b=LWyMmWitXjkbl+A8168Py6dxKdPhy18e5HhBiIa42zHLJnFAQhrjlxRLbDHmjwW/ip YxU+8rJML7CkUp/ncFPaQjqyRv6dczWQv7NCJ+Yh25Y+1VK8fUKDqdRT5Sk2KseSc3xq ZydNR53jr4X2ZW0kXNXcdUGhw5rPHvsqbGd2hRZT9TZVn3ZIAKXJUxwU+AZLeRnU+Na2 a32LuY2SnQY1t/gajn5B6Fbq08/cSFq3j77Jyw6xiJXAAIBOYlwXX1koBkOTOolI8EMR HNaw5/ObhhVGjd7gmJJq+zxv3lCLGMtENhQ2Is78zdFRDa94FJRQDFNC+ibspv8dI7r6 DNlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478210; x=1734083010; 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=AjfS6UDkVSnKuZTI4p5OY7qDfSEHNtP2btpHCtUSsMw=; b=Atnm128Yhnqx8AKgn0CEQ2cyqH5SPJ/+OZMXWBEMhDWT4NqrVmfuq06aH14jI0fyUn J+bLQG7CuHstoLpTlxz78uP8gxmJdWEhNqqlNe5dmWGJ7HrNtg3IegBvL32c0UcN82z7 KXCSN6pBubB+DBL1RF9LeT534MewbAsZMPowUX7XzJ+rajMcswy+st7NAp55g60ZfLBA wXhzDAesFbvSYGIHPiUU5g3a11uWK2O0h/y2G+JU5NBOFuX8ZdRqBZ420d3KZoBkldvn 4YO/nyy/eC3fvFPZXXHrcBiAzUAM2mnpSgWcs/doQmvYrE1oIt5cLdmDLoYAS2km6Faz PefA== X-Forwarded-Encrypted: i=1; AJvYcCUhPXtTcoJduK5SMCYkSIEGjHJhzfbN4pWXOgqrQOTdCdHwdDZmSTjn4Cz3OvAT1S7zvvl4rEplYEGPqfJbp766@lists.infradead.org X-Gm-Message-State: AOJu0YyBeGvYRRg1DrskqhjwTEk476U9/KPCJUB4AmZOXC9YKyX8ZN3g qK2xUqlpLP2SRD9GWOQWzL5HHFEPE+JmmBIV4ANu0XXOalhTzb9UT2EJ87EoVZ0= X-Gm-Gg: ASbGncuSqIJa+BiarIebi9qUf19qGUaR681GCik1mld/PbY4hWr4BwKHHJDlEEjY8+7 iiZYc8cfaG76V6QhSXkJwkkzUwPzxOD1wkp7YNBwVN6gNugnLO4AjRyWKWATsQUmcIpNIx+QXV6 HMBTcNnz3Q585PZzeksZmVBf+HeVzglKhrizRedlDH8tXMZvWjxoAxlCj/vEF2F9dgsTvP8VsG1 eaqJAbbpo5Ob0uE5cbxm7t0dqlP753l2B980xw9/clkX34hEom8Pu8tQg== X-Google-Smtp-Source: AGHT+IGlcn6F3j2D0eEiigVRHmv//hcsZLDTDwaSW1v+B5KM/LuoTROXlD1yn9Re0AjNw0cch3o94w== X-Received: by 2002:a2e:bc20:0:b0:300:ea4:4e24 with SMTP id 38308e7fff4ca-3001eac5caemr19445861fa.7.1733478210244; Fri, 06 Dec 2024 01:43:30 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:29 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:11 +0200 Subject: [PATCH v2 08/10] drm/radeon: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-8-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1057; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=AjWhuCZJu09L0XJl9lmri3iZkU99jRBF7lQVFbOa47M=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscv8mrxYpdnQrN5t7MGxWbI8gUEf4HV9oqdH /GygnY/E/+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLwAKCRCLPIo+Aiko 1eNuCACvtbdy2xfHWggRb/DI8ZumCyXC4iUXD9iziSzFcEDO8vqI/2fCDKjMpxlhsveDfytOBQZ oRdOPeOkoLL3uO62vDV5V2VYiUsdsxy4In6Ro6X3P/aCKb6E/3bVJBjfF1e+BpO4HzEDq5bshin Q8sislvKTDt/zFBM9TzroMIyWvYqMXzAusI5WH25he5flEL1wFwcBCMNr+2XOZ0+scdlLKi33FI Oi2na5oqsLdlqihifCjf1U3GXLKvDL4fvq79UN3+5aL4Wj6ChZbQ3Kt5ArimSGb7uZURbdsOMGp mVjDJQsRZ9XvpdnrqBt0x2sTm0oevUE5ykOyS/V7haBZ9PQf 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-20241206_014331_892567_FD7750AD X-CRM114-Status: GOOD ( 11.78 ) 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. Reviewed-by: Maxime Ripard 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 5b69cc8011b42b4686c02f97a2b451a63d6c346d..8d64ba18572ec4bb6f6985be3a5edf581c47d7a3 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c @@ -775,8 +775,10 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port, if (!dig->pin || dig->pin->id != 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 Fri Dec 6 09:43:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896797 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 14D82E77173 for ; Fri, 6 Dec 2024 09:53:45 +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=ZkigUKob5Mc9L+QSG9Cb+AQa6odUVvq9Ya0HTSeW6cY=; b=qkKEiK4GlHL4/IgeS2F1GsNEhI esAnEAF6isBQjm7f1ypRgGJt51fDQcerP8s8UF17JLH48NbBtfShwQnLukqeFxMfv6O3aLj/iU4Ue tM1n5FATkN2xyugBy+RtGCvlllmRZkiTMgXuF5BZPrdpTvY3BEWYj38aYk0d5ybxDvvLrThpR9X/J duWCDAO0Jfk36jwB3AfitoE/mWeslG5B2QUZLzUVJ3IgbwCtQhF9N+mwYHlUXGzbQEZugrbrjZMHH 9CqIzGI5le5KsCWpty8qaEeV+1kk8p0ciGOmD983QNdkrSD3HOh2dnzT5ri41mK/VDVs1PhIZqlER 483saQlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJV1j-000000019hT-2bbW; Fri, 06 Dec 2024 09:53:35 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUs2-000000017ii-1CuW for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:35 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2ffa49f623cso19396111fa.1 for ; Fri, 06 Dec 2024 01:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478213; x=1734083013; 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=ZkigUKob5Mc9L+QSG9Cb+AQa6odUVvq9Ya0HTSeW6cY=; b=uaF3iskQr5c6LpY4d4n3W3hhHFqbTw+GjAsAbXGE2ptGHfmRG9LPDUgeFz4XXgKP29 ex7VfB1QZyW/6GJ2DbxZouTgQN1QhoZlfCVTPB0zSofsiuGj+w9YpqXKuXp85s6CsgQ8 EYdauKoe0ZNl9c3fKsdDhD1i8s/Dxxv1Kcg+yYCUiF4tLFi5osm9hePhm+J+oK7Vy196 crT3Bg2EOU3C3Q2//7E1yorzf0XNY3XdfuicNptpoG5yOIIMEwR2khquS6pASOsphnlP 00mPRGu0dbqvajRakc6ArsuOc8Pauu/yje7qnb/VDRF0LXravHn6UFbBU91d10vS41nk H+0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478213; x=1734083013; 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=ZkigUKob5Mc9L+QSG9Cb+AQa6odUVvq9Ya0HTSeW6cY=; b=RPgKvP4YVeoCkq/BUx8TXYHDR65XLNe2Vlo9S89954I6vpBwCyEiRFpZ06DZrF9Rli SBuCjKK3xHzTk+TGFvKvYt6Jtu98e8HvkV4j+67scTkWY5FKBdrerx49wfTB9a2QjuG5 5HS9c3O09kkC+GPVo7/wKwT+GOz8PYT1F9N/fBt9ggWzl7U6WgFM1lSRczHvvagTbxq+ 6WNxYLsE+bYWrv77iG+kWn2aMR0PxacWd2t0+exK4rfQXNxPDOZauJrRwwNb+SFn01Q+ kDZXb+zxu0cMdqgzO0VjuflO43kQunOuEIJQDf2w5AI3JFrVSyGh4UqJj5eVp8mKmCwf sGpg== X-Forwarded-Encrypted: i=1; AJvYcCWr60Dk6RHK8v/QvC6pRpBT9poTBFma8tx5Zs4LOkjFQaELF8t/EqUijbMkHTpfcLnqNmiWEb5KhI9gGmEBGcKA@lists.infradead.org X-Gm-Message-State: AOJu0YxTb9bgV62uSmTDSDC/ckbuz1/k4ARgnLJT7oSVulyAan4yUdz6 f4tI6ceb6wqcPCvI9uZaQoCeEkwVJZl6y3HnyES4BUwVoU2hUwUh+jDmEmNfBe0= X-Gm-Gg: ASbGncsdIrU1OoYjF1iWbA7aH28CNE146YtITuiVi6WX7ZTFqEx03u/NslL/5tUnHMX rxHXvWNhxqkFfcfOTgrZ35TRhV8+FgxMyjBgDfygFaaCACLWRV/7u2VbnkJic3epNkOxPekjLfm hsvYWwJpc/PSzoM+N5bb9J9US+Fud0YHq3ZXP0IShhS36pDw5z4sjDBFoeHFVDzWE8Bx7R3DobM 8sKGBRGnp/Vzit5/fkyCWJUf3VjL23g7vO39Q8GjGa0pXor3ohx4taapQ== X-Google-Smtp-Source: AGHT+IFnWgDd0LQiOOyqxao9HQ2SRRt2EDypVuazWQgG9g3xYWmvYLAFADof0/JzzA41KcgjmV4COA== X-Received: by 2002:a2e:bc12:0:b0:2ff:d81f:2d34 with SMTP id 38308e7fff4ca-3002f89e73amr8312691fa.8.1733478212768; Fri, 06 Dec 2024 01:43:32 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:31 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:12 +0200 Subject: [PATCH v2 09/10] drm/sti: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-9-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1066; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=T6JPeyhrynxKGaIZwOdTxaj7xNpnpZ0LTNopG/6n9Zs=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ3rQcX25kP/6099+Y3hx23Dzne8aLO9XzJFZb9z4/HOYm bH+tPU/OxmNWRgYuRhkxRRZfApapsZsSg77sGNqPcwgViaQKQxcnAIwkYJV7P8sEtsYGnS1fHZY N6v4y56cu637YlyXwKadV03zMlc4ttxq3Crwz6qYV7CtsrDo9MHlXvvuuuT7v7hov3+iOGuw84P eOuPsuE9iV7LLFxUsPR5gYsiefjVFO1nyt2usyI6ibhPhj7UMf39E749suNgw22P/LxFtziC+Tn WRtWELrrEc5tq9toNNREI5uXeBpOlzlubMi7bXX1sfPDcrdsf/x9liHJvac29p84ZL8z2dq1QgM 7WlwLDhy4Qy7cfXWq0FX/w0s3kRpWmncvTdkXlJk4OKo1obHuSqT/3/T0mjdGMFO+vbmWI5eW1f jWc/nph+IGb3ku4TXWv7Lms/8ba/PcPz0OyqzlDRlRoPAQ== 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-20241206_014334_327153_ED200D8F X-CRM114-Status: GOOD ( 11.83 ) 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. Reviewed-by: Maxime Ripard Acked-by: Raphael Gallais-Pou 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 Fri Dec 6 09:43:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896799 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 24870E77173 for ; Fri, 6 Dec 2024 09:54:51 +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=IK1o74pdns8MHUCAUXuevFOWZGOyLWsbPpjGiW0nUAA=; b=fxijQ9MEPPrlHuzpcUUki/isLB 1jJcrLGopdYyK8Uz/abcMU1P1clTWb/QFdbP3albvrOO8YYzYohJD872aZfwyCpABqnAnAcE9tlmN 1iBNBPXPUcVXCiGpE+3zDwC48OV9jPRT2vF2SVphO3LVBpIl+R236jJSaQ2A0aHbrG4s72AqIFvyx FRoMFo+whCd+LirHq7s1mnZO5LNYxVhoW0QZmVTmEEF2DoGPO2dEpAu4KOx2To3jZ1HC41EJAQQIH vNroC0/bBLRCCtDkTZnmLaz/77KmaL1C67b1MkwouRk2ECrjwQmD6oVr4xfkxi34AQJavMMLTgimD 6vPjbyaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tJV2k-000000019s0-1Kx7; Fri, 06 Dec 2024 09:54:38 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tJUs5-000000017kq-1bCO for linux-arm-kernel@lists.infradead.org; Fri, 06 Dec 2024 09:43:38 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-300392cc4caso1124841fa.3 for ; Fri, 06 Dec 2024 01:43:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478215; x=1734083015; 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=IK1o74pdns8MHUCAUXuevFOWZGOyLWsbPpjGiW0nUAA=; b=Twgkp+1k7UZKw3PrCNThkdZCGQUheM+VxJwauVnYE0q8VPI15NBiNqjt4ox5SKPN4l CYZyVKyd2gsoZaJjJbvdlk0AMg1/bJGve5srQmcskZKTI1d5Uy5RR+dj+7aYcHcWTAiJ L6DYZfjVhkg5FywD+jFFAOv8G/rZnqr9QkOT6SQNmVQRMoaIrkymvQC91CrjoM8+r7/8 5LYOpt4txrrlmQla9WaIOpqpl+y64qtVTu1/hiWelypGWdhuuHVEdTN69jYtpiMycQw8 hcpHnF1WCdxVoFW7P2vlXIuo5dy52CDMJIFGZLrOtFLfko9dtSz2v1lwpNE5fr82+V1p 2uBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478215; x=1734083015; 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=IK1o74pdns8MHUCAUXuevFOWZGOyLWsbPpjGiW0nUAA=; b=u5Uz7EVX0WGMWgIvqNO303SgVLKeuL+IhRfSF+RXEd+jr1NFp5eW575kh0JZIJEtxy 7BbrUEz33Nw7kNl3KnuHW7XedlJUMcu81iUpi5+1xnpCfXdidXtwYwHIbJa/Yd391Pm5 xGmkrpPbK0lwgqSqWsmB5ceDSY7psjO35k2xT2oSG0M8m3qt6iWRyeddHtuK1jD1+oGM 7+uCpLZJyByYhikUvYxim1n7CrPi+UhXaHzwtDH7m8sxjqb/sB1xjnzjAcC97IrIK5Nr LHfLT8QhI9+Ov3PglBu2NEOdgBYUhB+iRDQaIa/froSZ3JOtETzPijQ3kN9ekiWqc9Km Kryw== X-Forwarded-Encrypted: i=1; AJvYcCWLFhtgj98uDtbcuxs+dY+ogBmCiFozwXh4JTYXh8v6iFAj5lnZTj23yIgsZTbSEckyyyeNUq6pYqp7Yej/ELJn@lists.infradead.org X-Gm-Message-State: AOJu0YyjUoC2SQN64dUw+3ZuBncI4atKpr4QrZKaS0mR1VAIzE5c1i6f qHCHpciHm+4/8kP9cIANeZhR55g9jDDAnt+KLxsFSn68ezHmz/yV3EgUrWlQRQQ= X-Gm-Gg: ASbGncvmlDr48s/0ZNDErSzveFs2R7o37AjEGoLXQ4ULWcvdvjtIlFo4pz3KWuJDqq3 ZCOX/DEr2ObenwHNmWKujkr0pfRSdY2/EidiZZBLsuPMW1m5kCLdaGbCP8eCevJAGdFc4O2VUZu VPI1JMAxM1ZrR3gjji/DuhSZncFRgB27mU0xah3+i5zI6CzprWw6BZBBKbhiCh4EphaOOOWSIeS ciPqEroDO3zT0E5UWZhv/yK49PacrGO+0/gqjd4YpRUsx49gXXyw/oRxQ== X-Google-Smtp-Source: AGHT+IE1jgPInMsiwRYU6/dysOt31sV51cEwkXMndrxO+i86Jp4v1LOQAej8bchTiqXotmvpJS013A== X-Received: by 2002:a2e:9a0e:0:b0:300:1dbd:b252 with SMTP id 38308e7fff4ca-3002f688872mr6560751fa.7.1733478215436; Fri, 06 Dec 2024 01:43:35 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:34 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:13 +0200 Subject: [PATCH v2 10/10] drm/vc4: hdmi: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-10-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@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=1109; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=MWBHkdOEPsNn+qx18lkyYR76WN4/LOkeB2bs8gaz3L8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscvPX017OK5vH3lmiCwL7kaJ0UcI+IYa3uXe 18ffiiI2Q6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLwAKCRCLPIo+Aiko 1TqVB/4m/VFWpZc/Kltqn587dwO8poPOaD02T82hJ5yhbMgXNJJ4xBgopTLH+t6y1qLkjWvPRa3 +noOhRXSMbmizw9O0yVwv6gxNAM+4g7LDPk06MwmatH6VGTF1E94wSnAXNKaI8qC1bl2SrnJ/BM KYHiVVScK35O/os2/qE4pWE0LXnnmku3xyIW8Ls6WMe1qmZtWPFHDfeYDOFCvmSz25/s1Mwwfwd KFZzI9qf+sRjDaObOOZkPq6Ckv7STP7qIOBBfScm5e7oF+CtiP6mBXMg9HuQFUocZsKI9nsQmsq 6UTE1LwnESZWvUAQ4ZC1j4eA/WqUA5QdWk1RE6h3yZLXYzYt 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-20241206_014337_433566_7076A82A X-CRM114-Status: GOOD ( 13.30 ) 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. Reviewed-by: Maxime Ripard 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 297afd89036ba8fba571379f5b6d63227eadb66e..f98617b8bf6cf9d92a806e35584e8f8ab0ac9f96 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2220,9 +2220,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; }