Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2929500rwb; Mon, 15 Aug 2022 14:15:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR7KojfoT5/3Bs6w10yxNpj+XggcaJbLApo+40+oFKxrFVmqSPb43v7tLmrM+uu2sYd4x+d6 X-Received: by 2002:a17:90a:6007:b0:1f3:3527:609e with SMTP id y7-20020a17090a600700b001f33527609emr20243855pji.52.1660598114032; Mon, 15 Aug 2022 14:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598114; cv=none; d=google.com; s=arc-20160816; b=UHEOFOB21zzGYsT0wAJE9MSnjZ7WDFwa0gGgQ93NfUkfyEiP5Zkh5zmmsowVE9Z47K vtp9EHRWtAJzqyxP4BPJdldSdqrIccnG0YiJ9fGZsfkf3DeDLJEgwFc29FUM7BwNu9NW 6cOMcDrx+JNI+WSvxoWORIzDd2DPlVrVDIMvYTAMxzlmZIoHpi9F8dgmyRTZG73Qk8ph 91uwsqZfPh0L7eFHZFohAd0hwx5wILidtRlh7vLg3qC8qG8kUXW9AydPoTdv7SaWsuPf i8NZ5U+Y7QrwfOxTDSpR4xMsPG2fBrX81jFKkEPrc8uir9iM5mpC3bCoGm5H3LrUTVCO 8zvQ== 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=CzAIZSZUQoEl7jACcEeK4hV2xFMKmzQYrqJH0+J19rLg477WPf7PharhSrd1CJnJHy pxZv/9e7APoMo2Uc6XTx8spnZn/6iGn0OyJVc8a19W6I1T7eQIGc52MgJ0FItk51D0Uh G8fVzRNObObfs7ucXuwFRT4MHhYJRb4soRshTIgoSnHeI1fUkhgcCyklQkGPhHPdyrFv EeOJfZ4Sh6XeJ7NX/Bd45Vo117nNnWpUeFKZse+B7WZb8suJJ0N6TtR0ZJTL/xQWZ+ig WPiYsePLZla45+Y6n56+ND9NKkJd2irwqQjM7UrdoAD9kvLAQRRtI20RfwIlCMd0HwMb YzFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Aa09H9oh; 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 j190-20020a6380c7000000b0041a60be4df2si8145055pgd.22.2022.08.15.14.14.59; Mon, 15 Aug 2022 14:15:14 -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=Aa09H9oh; 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 S244612AbiHOVL5 (ORCPT + 99 others); Mon, 15 Aug 2022 17:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347798AbiHOVHf (ORCPT ); Mon, 15 Aug 2022 17:07:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F275451A35; Mon, 15 Aug 2022 12:16:09 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 25D7060FB9; Mon, 15 Aug 2022 19:16:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35483C433C1; Mon, 15 Aug 2022 19:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590968; bh=+52ntI2e1KU5OBA4ew9V71YL6B2bJ+BVsws6QREl/Bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa09H9oh7fehYSGwjtD8ucyMNdxYUNL3pSBicdOIxyWI2xwcE8bbR7HfugaKEAAHI RH2/YvcDiPXt0HQJ29Ny0aG/U38CRQu+lB/kSZ6XU7z7x21IxguPgJd51Oe3JvADGl tQrPBcHwx5Kw1Eet0lnZaSRFPzhmyBOK5YzKd8eg= 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.18 0428/1095] media: amphion: release core lock before reset vpu core Date: Mon, 15 Aug 2022 19:57:07 +0200 Message-Id: <20220815180447.417794125@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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