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; }