Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3086599rwb; Mon, 15 Aug 2022 17:48:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6HwsU7kwVEk/VF0hL7XpxVIQu1GWEwxOcC4req+l7LXllu+FVb1wsHewmtiPktc7zW1bHt X-Received: by 2002:a17:906:cc56:b0:730:a2f0:7466 with SMTP id mm22-20020a170906cc5600b00730a2f07466mr11856735ejb.211.1660610886683; Mon, 15 Aug 2022 17:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610886; cv=none; d=google.com; s=arc-20160816; b=bZaD4h/QEvNfDTtGUu88FDR/0j1bg3vxTSU2wpHM4grPH67wFgYq2ftd9kXkrK29ca TNJ+EsELOzMjc5IAVu4AYg25M6tfrySsq0TY7b6KarVTZDBl4d18UTH0QCzG4W1XZggC JWSO+44hyu6EC/NgESUP4L4swRC9utcPoGvaEPE0lRRd8/qcHZSmDJxDBXdZCQuM6hmM altmsYR42rw1nswux8CNFuT5EoxjjUNfsoQGI3TjcYABAPi4bEh3EVkowErFNJWImK9a TrdqYSIoOP5NmjUdxAxnb2xS9Jz9JwV3cqj61iqxmB7MONp3a9ApIAUx+JCA6CSB/thm ng3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wzXGekG4R3rBzQ9LSScUGnoKi3BxcNPfDyUHbrL6spQ=; b=DutpyiTM9LkAtQsQPEmrkQDsMBW1bCwdy2Lmu+UL1boo/DbAe1KCus3Gl6gm01qMRG A6uEK9/3zt7mJXBfOH3d2daxCT33A/ua23PT/Z9y8aQzQEg0K1MgWrnvjwpbTlLAa+J2 Z8ZFDBRsto7LQqU0J56rh9N7Z1AQ04ouGFsWxb7S+k5TxBSVbH1GOxziYCGm+GYq5ffM 36t6GK+0qqlQI+b1EBfV5mjFmq3GCrfbZdRwL+1Q4zVD/VsKpuL5sSD6KavV8+kwwyz1 krIiL/Dnr7ha2u/Np9RwM0Y8e6NFgC2bo5zLto0E61GwoW64r6uCfWs1HAP7H6Ddjnpf nqUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tWvFh4Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a05640235c400b0043c7df15c19si9712924edc.554.2022.08.15.17.47.41; Mon, 15 Aug 2022 17:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tWvFh4Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354742AbiHOXuK (ORCPT + 99 others); Mon, 15 Aug 2022 19:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354501AbiHOXpr (ORCPT ); Mon, 15 Aug 2022 19:45:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6BBA8A6FA; Mon, 15 Aug 2022 13:14:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 316D0B80EA9; Mon, 15 Aug 2022 20:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7271CC433D6; Mon, 15 Aug 2022 20:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594459; bh=+52ntI2e1KU5OBA4ew9V71YL6B2bJ+BVsws6QREl/Bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWvFh4VwXB3fWHoObZagw3iLYxfXZ3TTIA9In74icbcvdkEqR1bhMjBeBWxiyOlGT jZ13q18jYxmF86puZJYxRxUARbeHV0K9kPJUSwkluW5MlnYtvE84gJIpbv2WYfvWuH pxLMG2uF0257rg4QWOd2+fddWbB9kE/7NstmZFZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 0455/1157] media: amphion: release core lock before reset vpu core Date: Mon, 15 Aug 2022 19:56:51 +0200 Message-Id: <20220815180457.795323741@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ming Qian [ Upstream commit a621cc4bed97e49f5a8019f5215dec7e208a7c4d ] In reset vpu core, driver will wait for a response event, but if there are still some events unhandled, they will be handled first, driver may acquire core lock for that. So if we do reset in core lock, it may led to reset timeout. Fixes: 9f599f351e86a ("media: amphion: add vpu core driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 68ad183925fd..51a764713159 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -455,8 +455,13 @@ int vpu_inst_unregister(struct vpu_inst *inst) } vpu_core_check_hang(core); if (core->state == VPU_CORE_HANG && !core->instance_mask) { + int err; + dev_info(core->dev, "reset hang core\n"); - if (!vpu_core_sw_reset(core)) { + mutex_unlock(&core->lock); + err = vpu_core_sw_reset(core); + mutex_lock(&core->lock); + if (!err) { core->state = VPU_CORE_ACTIVE; core->hang_mask = 0; } -- 2.35.1