From patchwork Wed Sep 7 10:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smitha T Murthy X-Patchwork-Id: 12968992 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 BB6C7C6FA89 for ; Wed, 7 Sep 2022 13:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=fEzkBhRJbODYWl4hae/a9EWHPOsKj4oPYwHSyUakVfA=; b=jpwcYUAwalHiLI jDir4JB2sq0eqot/hvHMxFe445LNFSW1LSS55WpMGUnye9SUKSdEY8piBEb/cbIevYOHsQkxsqRC8 13g3F7/gfOjJ3HCv9USkVGL6+UR6jLmU0AijblrRjbQOCouoIEJXFhC+WhX8rSuMyqeKyCGbm8pZn 5vSirr8v17FzAw//Ef8vFc+tIvMv4DMKQN+Q2vb7xqQVkK6d6QPlhQ9+wvPjhCfnceNsFIVi68LUx pwgphcmoIKI64QrmPre0Q3TfEfJnRGPc2+8+1cbKpTRIllH4VLOk1FyS7iKWi4UrsuV1lF0qeaNPK NYndX+fESTL2ajltuGmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKO-006ZtX-Rm; Wed, 07 Sep 2022 13:42:53 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKK-006Znc-Vc for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 13:42:50 +0000 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220907134230epoutp02177c06e6b3a95350d3161f914726930a~Sl9Qv9IZi1739917399epoutp02x for ; Wed, 7 Sep 2022 13:42:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220907134230epoutp02177c06e6b3a95350d3161f914726930a~Sl9Qv9IZi1739917399epoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662558150; bh=ANdL1iNQslYKX0O7F+SUtWXTCE68cYMhgQFXj3+NFRM=; h=From:To:Cc:Subject:Date:References:From; b=iVA2UcLYS6RVNpl+vdRpa/cdLieGL9k7WE6psTA13ZQsSoxXLMVJ/Z55UeL0AWwsn WfGW5HFVzsaXmvL0KZhJdNi5STjBvyX8ioftYSZ3ANdhW013CtFK3DrMpLaiDv1iNL 5HVeYXJVrUYsa8ZhOkQaTgaAITjNSU08Y/dMGyHs= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220907134229epcas5p25dddca5096ab3e487c0687e607395e6d~Sl9QPIzoA3275732757epcas5p2M; Wed, 7 Sep 2022 13:42:29 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4MN3N319rFz4x9Pv; Wed, 7 Sep 2022 13:42:27 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3F.8D.59633.2CF98136; Wed, 7 Sep 2022 22:42:27 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220907101823epcas5p22148836690ecf1d8e0e7ab81fd9aee28~SjLDBDE2o2030720307epcas5p2s; Wed, 7 Sep 2022 10:18:23 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220907101823epsmtrp1110f571454dca32c497880f174410d28~SjLDAFP_30915809158epsmtrp1o; Wed, 7 Sep 2022 10:18:23 +0000 (GMT) X-AuditID: b6c32a49-dfdff7000000e8f1-8d-63189fc28adf Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D7.B5.14392.FEF68136; Wed, 7 Sep 2022 19:18:23 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.109.115.6]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220907101821epsmtip15bcc546cd6fb245d2ce800bc465375f9~SjLBD6oKc3253232532epsmtip1r; Wed, 7 Sep 2022 10:18:21 +0000 (GMT) From: Smitha T Murthy To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: m.szyprowski@samsung.com, andrzej.hajda@intel.com, mchehab@kernel.org, alim.akhtar@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, linux-fsd@tesla.com, aakarsh.jain@samsung.com, Smitha T Murthy , stable@vger.kernel.org Subject: [PATCH 1/3] media: s5p-mfc: Fix in register read and write for H264 Date: Wed, 7 Sep 2022 16:02:25 +0530 Message-Id: <20220907103227.61088-1-smitha.t@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEKsWRmVeSWpSXmKPExsWy7bCmpu7h+RLJBi//M1o83TGT1eLBvG1s FvcXf2axOLR5K7vFpsfXWC0evgq3uLxrDptFz4atrBZ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d8e0e7ab81fd9aee28 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220907101823epcas5p22148836690ecf1d8e0e7ab81fd9aee28 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_064249_408387_7D0ED41A X-CRM114-Status: GOOD ( 14.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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Few of the H264 encoder registers written were not getting reflected since the read values was not stored and getting overwritten. Fixes: 6a9c6f6812579 ("[media] s5p-mfc: Add variants to access mfc registers") Cc: stable@vger.kernel.org Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy --- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index 8227004f6746..c0df5ac9fcff 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -1060,7 +1060,7 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) } /* aspect ratio VUI */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 5); reg |= ((p_h264->vui_sar & 0x1) << 5); writel(reg, mfc_regs->e_h264_options); @@ -1083,7 +1083,7 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) /* intra picture period for H.264 open GOP */ /* control */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 4); reg |= ((p_h264->open_gop & 0x1) << 4); writel(reg, mfc_regs->e_h264_options); @@ -1097,23 +1097,23 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) } /* 'WEIGHTED_BI_PREDICTION' for B is disable */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x3 << 9); writel(reg, mfc_regs->e_h264_options); /* 'CONSTRAINED_INTRA_PRED_ENABLE' is disable */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 14); writel(reg, mfc_regs->e_h264_options); /* ASO */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 6); reg |= ((p_h264->aso & 0x1) << 6); writel(reg, mfc_regs->e_h264_options); /* hier qp enable */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 8); reg |= ((p_h264->open_gop & 0x1) << 8); writel(reg, mfc_regs->e_h264_options); @@ -1134,7 +1134,7 @@ static int s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx) writel(reg, mfc_regs->e_h264_num_t_layer); /* frame packing SEI generation */ - readl(mfc_regs->e_h264_options); + reg = readl(mfc_regs->e_h264_options); reg &= ~(0x1 << 25); reg |= ((p_h264->sei_frame_packing & 0x1) << 25); writel(reg, mfc_regs->e_h264_options); From patchwork Wed Sep 7 10:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smitha T Murthy X-Patchwork-Id: 12968991 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 935F4C54EE9 for ; Wed, 7 Sep 2022 13:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2xfBaLdX+OHxzFnPyqd0rtES5AzIq8v98kug4QGsGOw=; b=m91YtkR9QrewO4 J1RtH3w3yo3lTKVdveHWwKHAoP0WH3LIusgjTEG+h0gdVZYw+OWMO2Q14cFrySij5Y1FXilXHtVbo 3c5H7Aughe4Hw+Q2aIGIC3OlAQBZoewtGkjJ6n9/PcbPrE+Lf1RBaiQ0wIw2cPU3nPNekv+hjwDoY /X4wH2SRAnosRweAM9jPVNSlSVJ++RVk3OAz5jo25eQOCmGhWDaI9f5kIobzpcdOmcXHzxqSwmDLb wxcXi5uU0atS24sfd2RVpAd3EJ0ZJ50CiqJvKfCrEJ2C/iZgTlv3j0FJ7fuHxgOhPVwVADpliqAaG NTWU9CavMnJ3/gWRenYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKY-006ZwR-H7; Wed, 07 Sep 2022 13:43:02 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKK-006Zpd-VJ for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 13:42:52 +0000 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220907134236epoutp02eae6a67bda745cfd8260cd4366b05c0e~Sl9WqBYZD1739917399epoutp02z for ; Wed, 7 Sep 2022 13:42:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220907134236epoutp02eae6a67bda745cfd8260cd4366b05c0e~Sl9WqBYZD1739917399epoutp02z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662558156; bh=uKppsoNnbbL+dhUZLkGDMSWsNgwF5YdpFD8OZ4YqNIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3nwaDuc483HcpxWzjrnkiTScdusDC2+K5+KSyMEWzcb78ofSCZUneEGsj/LXVKQK k3McfNmkHf7rfTNIytjkginuRl7kJYa1Xe4auBlSoHtSjhJGuQeiP4/kJkxLupjnI2 4qxQt8O3P8hRtRGX9zS4a3kEzxbT+IkcQUhUTAxA= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20220907134235epcas5p49f392d6e525cb8459cfab7df0a4b0f41~Sl9WMhKqN2674426744epcas5p4M; Wed, 7 Sep 2022 13:42:35 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.176]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4MN3N92ytbz4x9Pp; Wed, 7 Sep 2022 13:42:33 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id FA.76.54060.9CF98136; Wed, 7 Sep 2022 22:42:33 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20220907101825epcas5p321eaebfafa5f69a9695d4b12532eccfd~SjLFDTbJ81838818388epcas5p37; Wed, 7 Sep 2022 10:18:25 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220907101825epsmtrp2970b3a9d4e4dd6e1878b16969760feaf~SjLFCTXPR2177721777epsmtrp2E; Wed, 7 Sep 2022 10:18:25 +0000 (GMT) X-AuditID: b6c32a4b-be1ff7000000d32c-49-63189fc90da4 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 5A.B5.14392.1FF68136; Wed, 7 Sep 2022 19:18:25 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.109.115.6]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220907101823epsmtip1cc68be055fa7e75fa830ad8da451dde9~SjLDGOn923176031760epsmtip1m; Wed, 7 Sep 2022 10:18:23 +0000 (GMT) From: Smitha T Murthy To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: m.szyprowski@samsung.com, andrzej.hajda@intel.com, mchehab@kernel.org, alim.akhtar@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, linux-fsd@tesla.com, aakarsh.jain@samsung.com, Smitha T Murthy , stable@vger.kernel.org Subject: [PATCH 2/3] media: s5p-mfc: Clear workbit to handle error condition Date: Wed, 7 Sep 2022 16:02:26 +0530 Message-Id: <20220907103227.61088-2-smitha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220907103227.61088-1-smitha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgk+LIzCtJLcpLzFFi42LZdlhTS/fkfIlkg5cTRS2e7pjJavFg3jY2 i/uLP7NYHNq8ld1i0+NrrBYPX4VbXN41h82iZ8NWVou1R+6yWyzb9IfJYtHWL+wWd/dsY7RY sPERowOvx+I9L5k8Nq3qZPPYvKTeo2/LKkaPf01z2T0+b5ILYIvKtslITUxJLVJIzUvOT8nM S7dV8g6Od443NTMw1DW0tDBXUshLzE21VXLxCdB1y8wBulNJoSwxpxQoFJBYXKykb2dTlF9a kqqQkV9cYquUWpCSU2BSoFecmFtcmpeul5daYmVoYGBkClSYkJ1x83cjc8Fjrorp/y0aGFdw djFyckgImEhMXNXJ2sXIxSEksJtRYvGWdUwQzidGiRXv9zNDON8YJQ5s7GaBafk1YSVUy15G ia8LlzFCOM1MEk9+/2MHqWIT0JH49v40G4gtIpAq8WrdWrAOZoFuJom789czgySEBXwk1vc9 BStiEVCVuPzlJpjNK2Apcb5lOzPEOnmJ1RsOgNmcAlYS747MBztQQuAru8SFGW8ZIYpcJDZ3 bmWFsIUlXh3fwg5hS0l8freXDcJOl7j/uRmqvkBibsMWJgjbXuLAlTlAv3EAXacpsX6XPkRY VmLqqXVgJcwCfBK9v59AlfNK7JgHYytJLDpzAmqVhMTVtyAncADZHhJXXyqChIUEehklZl2z ncAoNwthwQJGxlWMkqkFxbnpqcWmBcZ5qeXwSEvOz93ECE6KWt47GB89+KB3iJGJg/EQowQH s5IIb8oOkWQh3pTEyqrUovz4otKc1OJDjKbA4JvILCWanA9My3kl8YYmlgYmZmZmJpbGZoZK 4rxTtBmThQTSE0tSs1NTC1KLYPqYODilGpjq95oaLpv0tMjPzmLiwfic9HA5z60yB3KcPVwf zFJXN8+RtX1/Yg73X8nvTYun77f9dU2gR46Vv7n78Zb0pxu2iyyx/L+rPCTmIfuv9D3T3s/K OzndROJawyPjANfzEYeWBwYw/rVaIiDSZJB9ZL2Oici0vufGrhUtairi923zJso1cE1I/3/k eufN33rzeJb1rK/1XKOu5C+T+r22c9exuXyx946tL2NqmRJuubfL2jq/nensTI9jrtYll4X/ 2mRzO248c+RqWYRWRZjiM5048U8qzKb/cuXeRCV73v9aHb175YWavWb+R++7MIsseq+wuueX 3adFBQq1bak+Gxd0ReSf3xirG9xwTvvDPCWW4oxEQy3mouJEADQpRlUTBAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGLMWRmVeSWpSXmKPExsWy7bCSnO7HfIlkgwObRCye7pjJavFg3jY2 i/uLP7NYHNq8ld1i0+NrrBYPX4VbXN41h82iZ8NWVou1R+6yWyzb9IfJYtHWL+wWd/dsY7RY sPERowOvx+I9L5k8Nq3qZPPYvKTeo2/LKkaPf01z2T0+b5ILYIvisklJzcksSy3St0vgyrj5 u5G54DFXxfT/Fg2MKzi7GDk5JARMJH5NWMkKYgsJ7GaUmPi7CiIuIbHy9yRGCFtYYuW/5+xd jFxANY1MEs9mzWcCSbAJ6Eh8e3+aDcQWEUiXmHTnKwtIEbPAdCaJPauesIMkhAV8JNb3PQUr YhFQlbj85SaYzStgKXG+ZTszxAZ5idUbDoDZnAJWEu+OgCzgANpmKXH8YtUERr4FjAyrGCVT C4pz03OLDQsM81LL9YoTc4tL89L1kvNzNzGCg1ZLcwfj9lUf9A4xMnEwHmKU4GBWEuFN2SGS LMSbklhZlVqUH19UmpNafIhRmoNFSZz3QtfJeCGB9MSS1OzU1ILUIpgsEwenVAOTafV9D6NL Ge+8m/Vj7qW/OtN/6AefgNTFY+GdLWw6Opy54a+uTJ9Q5i8cc8mz9Mqrh569364/b+fe8CS/ 172/KiNUd0vN0YRdOq33khZuWqTn4pZ45soGufe9dU075cpfbQuwqhH8+cLuHHeLvXHlr13d 0r8+7FOV//vacItl1YmN2/47Kx3J2nJJodK+ue3dCWfWzdHcnl3eb+olHN7tSmkWCeYRL7fo Wrl5gc5vvf6XFa9KDeSEJlk1F9zsaZcQz6gteTL3d++m5Usb9/HZhBR57VCu3CURflXqWpJ3 yeuayMSKluoV+VdY5qnJFeflmXM/uuJj+lRVpCmV58W2G19mxHgvczcXCV0socRSnJFoqMVc VJwIAPSmdPbJAgAA X-CMS-MailID: 20220907101825epcas5p321eaebfafa5f69a9695d4b12532eccfd X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220907101825epcas5p321eaebfafa5f69a9695d4b12532eccfd References: <20220907103227.61088-1-smitha.t@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_064249_391368_095FEF9B X-CRM114-Status: GOOD ( 15.22 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org During error on CLOSE_INSTANCE command, ctx_work_bits was not getting cleared. During consequent mfc execution NULL pointer dereferencing of this context led to kernel panic. This patch fixes this issue by making sure to clear ctx_work_bits always. Fixes: 818cd91ab8c6e ("[media] s5p-mfc: Extract open/close MFC instance commands) Cc: stable@vger.kernel.org Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c index 72d70984e99a..6d3c92045c05 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c @@ -468,8 +468,10 @@ void s5p_mfc_close_mfc_inst(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx) s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); /* Wait until instance is returned or timeout occurred */ if (s5p_mfc_wait_for_done_ctx(ctx, - S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)) + S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)){ + clear_work_bit_irqsave(ctx); mfc_err("Err returning instance\n"); + } /* Free resources */ s5p_mfc_hw_call(dev->mfc_ops, release_codec_buffers, ctx); From patchwork Wed Sep 7 10:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smitha T Murthy X-Patchwork-Id: 12968993 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 D2F42C38145 for ; Wed, 7 Sep 2022 13:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2Yq9i/Ps5adFJqbEci5fNQWaBfTRcGQxWUQACGS3Dk0=; b=3pp24yISHM4vO/ BjFGRSvu624N2AhjS+5Tk6Momm6I/ncE2jYoRiJLfZnpdvIQNQP2PdGiLj546GopJIX1/TPq+XH95 LNJfAJUsSK3/JsxvFQKWyeNxsVZxkIY7CaW0HCkB2/TAZLGKxVVSwC0Y4AY1HNp+cDI7tW3bRtimV LhukAJMhGhzdHEZTyfMgcVGzXoOhotO7B0amMTfdoGC3qCWI0bJ9v0haKnRjfwdtPhgB+bzFhN879 a4dnO9yiDwrrgFoK7Hj7kzXpeb9YOm0igw4pXQD7ZNaTHOxg4YHV8fiqwkDlN4xq1Hdf7xNR34+Y6 gcqWxey5AE/TwR0S3aZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKh-006Zz2-KM; Wed, 07 Sep 2022 13:43:11 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVvKK-006ZpC-VI for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 13:42:52 +0000 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220907134240epoutp025f216f1b05f0a2b13b0e8a8ddd8d3f04~Sl9azbSx-1739917399epoutp020 for ; Wed, 7 Sep 2022 13:42:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220907134240epoutp025f216f1b05f0a2b13b0e8a8ddd8d3f04~Sl9azbSx-1739917399epoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662558160; bh=gSif8NMM6wosPp4czbq6ghp4X8l/PNF06f6zjCg20J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RUoIN0gYAYDxiz5CleIJWbt4VTmlZ3C52vCoX/1tMQwElBD0mj8NTYnItpsdkCGFi Rb+Dvbn6VV6Q83MDYaEibf2O+0Z7rdz5kgmCQmr3SCv/T/nJvm9qA9S+b4KTsAIKmQ QMwnbvdMUn9Mk8DTOMv8SQbshIH7r9D0mU4Px4VQ= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220907134240epcas5p28b2f86dd0e4f0da92c4e47ffd09a1eba~Sl9aPlwok0998509985epcas5p2c; Wed, 7 Sep 2022 13:42:40 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.175]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4MN3NF5gpLz4x9Pp; Wed, 7 Sep 2022 13:42:37 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 5E.69.53458.DCF98136; Wed, 7 Sep 2022 22:42:37 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220907101827epcas5p2afa088ce5a591040094d2b49b928f3c2~SjLHHpNUm2030720307epcas5p20; Wed, 7 Sep 2022 10:18:27 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220907101827epsmtrp1e3eff56e01088162beff031f9e566d64~SjLHGv0t40915809158epsmtrp1s; Wed, 7 Sep 2022 10:18:27 +0000 (GMT) X-AuditID: b6c32a4a-a5bff7000000d0d2-e3-63189fcd52b7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 9C.B8.18644.3FF68136; Wed, 7 Sep 2022 19:18:27 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.109.115.6]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220907101825epsmtip154204b88be3cf7dd290da6f4ee1397bd~SjLFJqolx3175831758epsmtip1p; Wed, 7 Sep 2022 10:18:25 +0000 (GMT) From: Smitha T Murthy To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: m.szyprowski@samsung.com, andrzej.hajda@intel.com, mchehab@kernel.org, alim.akhtar@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, linux-fsd@tesla.com, aakarsh.jain@samsung.com, Smitha T Murthy , stable@vger.kernel.org Subject: [PATCH 3/3] media: s5p-mfc: Fix to handle reference queue during finishing Date: Wed, 7 Sep 2022 16:02:27 +0530 Message-Id: <20220907103227.61088-3-smitha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220907103227.61088-1-smitha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgk+LIzCtJLcpLzFFi42LZdlhTQ/fsfIlkg2/XtCye7pjJavFg3jY2 i/uLP7NYHNq8ld1i0+NrrBYPX4VbXN41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X-CMS-MailID: 20220907101827epcas5p2afa088ce5a591040094d2b49b928f3c2 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220907101827epcas5p2afa088ce5a591040094d2b49b928f3c2 References: <20220907103227.61088-1-smitha.t@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_064249_389585_8FA15114 X-CRM114-Status: GOOD ( 17.67 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On receiving last buffer driver puts MFC to MFCINST_FINISHING state which in turn skips transferring of frame from SRC to REF queue. This causes driver to stop MFC encoding and last frame is lost. This patch guarantees safe handling of frames during MFCINST_FINISHING and correct clearing of workbit to avoid early stopping of encoding. Fixes: af93574678108 ("[media] MFC: Add MFC 5.1 V4L2 driver") Cc: stable@vger.kernel.org Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index b65e506665af..e064bdd74f2e 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1218,6 +1218,7 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) unsigned long mb_y_addr, mb_c_addr; int slice_type; unsigned int strm_size; + bool src_ready; slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); @@ -1257,7 +1258,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) } } } - if ((ctx->src_queue_cnt > 0) && (ctx->state == MFCINST_RUNNING)) { + if ((ctx->src_queue_cnt > 0) && (ctx->state == MFCINST_RUNNING || + ctx->state == MFCINST_FINISHING)) { mb_entry = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); if (mb_entry->flags & MFC_BUF_FLAG_USED) { @@ -1288,7 +1290,13 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, strm_size); vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); } - if ((ctx->src_queue_cnt == 0) || (ctx->dst_queue_cnt == 0)) + + src_ready = true; + if ((ctx->state == MFCINST_RUNNING) && (ctx->src_queue_cnt == 0)) + src_ready = false; + if ((ctx->state == MFCINST_FINISHING) && (ctx->ref_queue_cnt == 0)) + src_ready = false; + if ((!src_ready) || (ctx->dst_queue_cnt == 0)) clear_work_bit(ctx); return 0;