From patchwork Fri Oct 13 23:07:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 152858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp2201454vqb; Fri, 13 Oct 2023 16:08:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGK0Be9eVv2stMRJJMzuElk00V1v06yEedEJdwnZdv0mK67DD9aAFr92QLQmCEeeBcA1WlT X-Received: by 2002:a17:90b:3a8c:b0:27d:4d4d:3b19 with SMTP id om12-20020a17090b3a8c00b0027d4d4d3b19mr1929674pjb.0.1697238508719; Fri, 13 Oct 2023 16:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697238508; cv=none; d=google.com; s=arc-20160816; b=iJWuu5LxEm26nWIC8ltvtB6yPBvdVgjwUMXcN/0W1dGM0OKsYA5lAOe8JdGkyG/8eF QUvNm2jd0QKEKj3lE6rBx2sd7jYtQ0In6WogbnwODKBIrHjQY3BHZW5RiRevvZ/U1pCw rQHBPkODtTrzWIbIqaw6HxDb3eRiS/hl9p3MYDSAQlpnfb9T3/8fTf1tC3u1KYHWHhIb FWWZ/XuTyQgbXOSOvh9DsXXzHdASthptgYkPsJcpl0/zVWigeFLdJcrSWuFrdp/sCKR1 fOeznbzEBgoE2lJcPc9SV9c/5HOyE36kqLrd8Y4vGE4fSvyrPS2NlhvsYjy7/UrKs49m fJww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=ntpWA0KpoWbL2Mip0SNW/VcCmMEOAdpN3Qpqu/MvN+k=; fh=ZywVdCm2TaQdSuKnMyxwvQKan5nBWHepQylL0EAQlgA=; b=C/+FDNcg7rlzZgHpk9pihF8NZJ6lOxczsZabcqGSgwImrXtIB40bCceQFQg6J1bz3B qDRC7wEe7/UP9j81gCG065JEp66alsYniPyE6A6Y4ntbPpanOGbwANPN1euax05Xw+1q s7jtlo+1NgsbYXiXp/XycglIYDQ6fKgCPorDZsvcSKGsBN5R8nzPD35TKm5lY3cIBXyS QwgdoFMtL3mJHChEknY1pzpip4Q/0nVOLOlYf4Xng9Qn1EbrQGyNcZYqPdhB7Z0G3HHj vNPxCJugem3miKQLkm+jOZ04H/MAjQVUac266tJPZdj+Kdpu1TibPXZ1If9Evx0A2gm2 mlrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iSMOv8rP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id j10-20020a17090a31ca00b002632a1243dbsi952029pjf.104.2023.10.13.16.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 16:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iSMOv8rP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 99B5983CCA7E; Fri, 13 Oct 2023 16:08:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbjJMXIF (ORCPT + 19 others); Fri, 13 Oct 2023 19:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjJMXID (ORCPT ); Fri, 13 Oct 2023 19:08:03 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B20BF for ; Fri, 13 Oct 2023 16:07:59 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5079f3f3d7aso932793e87.1 for ; Fri, 13 Oct 2023 16:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697238478; x=1697843278; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=ntpWA0KpoWbL2Mip0SNW/VcCmMEOAdpN3Qpqu/MvN+k=; b=iSMOv8rPVRXSMfZrkL+mUnc1wCEmwheuV7AP1QnoaFT9ntFpNhLF2SA4bUfvt/I8H2 VKtm6u0hdPJ5Jd3UFQUb7NT6x3R9NWysTV0QEBRgFugWlbULTOX2xlyOheyviT5IWq+k pnDk0uaEHUQnx0dnPCjFdsDkUYXrdOljWn6QzMEQR3uovCDvjyJlW6QhTI8+Mfa1JGuG hR/HcNdGp4QfRXhq7iw99eFJGaZeDZid6O3wspnEpgSQcxA4ZZ8pJIXNzFE8yN9PNjzW iaFJTfrfNw1sZ59kdh6T0H5XqPMRvafQ7aZ2HZQfrStFAOUpdQpq+BxhzUghBYapvoJm gxng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697238478; x=1697843278; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ntpWA0KpoWbL2Mip0SNW/VcCmMEOAdpN3Qpqu/MvN+k=; b=TORhIp4EzeUqHxEpv8UWgU+7vtIjXoJ0UyE8N5EZpSuVKO8N9/1VFgZfZ4Dts1YZ+/ mjgJkGl+7AGXpFN68bDqJj2P1suS0L5IQGIUvA6tFMMbO7fG7zKGVOp9viGsMJ+x641p NaD2XpCTHaBw3i8dSeJr7N17dNzrT2EcpKd32tidCXLcVGw5VCDP2YcxjxXQaR+dAbZd EEQUvyFQ+pzlEk8E7GFtoKqD+SStyn4aglkUVSSb2+pPjdv3hAyNg2gCIUg1abAcwyzJ xE8V5nYzzpJlM0V3qbMC9kQTFKHpdJMJXMh6n6mRsGJKkpbUUjbi9m9c710gq7lvtC3X lUnw== X-Gm-Message-State: AOJu0YzUfLdQZwWDu49f2OIL4m3AJ1IBnpNHIe3y80EhxfUTShip1OUE 9wfsqXZdn7K7J46TQyIxTeN58A== X-Received: by 2002:a05:6512:1246:b0:500:9839:b13a with SMTP id fb6-20020a056512124600b005009839b13amr30206505lfb.66.1697238477814; Fri, 13 Oct 2023 16:07:57 -0700 (PDT) Received: from [10.167.154.1] (178235177169.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.169]) by smtp.gmail.com with ESMTPSA id u13-20020ac248ad000000b00504818fcb07sm3553202lfg.266.2023.10.13.16.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 16:07:57 -0700 (PDT) From: Konrad Dybcio Date: Sat, 14 Oct 2023 01:07:46 +0200 Subject: [PATCH] drm/msm/a6xx: Fix up QMP handling MIME-Version: 1.0 Message-Id: <20231014-topic-a7xxv3-v1-1-616bc95f21ce@linaro.org> X-B4-Tracking: v=1; b=H4sIAMHNKWUC/x2N0QqDMAwAf0XyvEBTNxR/RfYQ2zgDUqV1UhD/f WGPd3DcBUWySoGhuSDLqUW3ZECPBsLC6SOo0Ri88y05euKx7RqQu1rPFqOb2UfqO08vsGTiIjh lTmGxKH3X1eSeZdb6f4zv+/4Bzr+H7HMAAAA= To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter Cc: Marijn Suijten , Rob Clark , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dan Carpenter , Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1697238476; l=2554; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=L0RoG9B+wKNyrZ4UA2Vwj13Xo0muadgjIRaCHVUzQ3I=; b=0Tz640xtbRU3aIFgDrl3cQRCFtrEfteAL/Yvax+E5GHso3rsWZ6bqFX9Y5eSvxekDoMSTJduI Bz7I7UTi6RMAfWwBf2cx/MoFPYBqP+UETorzEdjQS28mwPa60aYQxVG X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 13 Oct 2023 16:08:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779683566649453334 X-GMAIL-MSGID: 1779683566649453334 The commit referenced in the Fixes tag had a couple problems (as pointed out by Dan): - qmp_put was never called, resulting in refcnt leaks - failling to acquire the QMP mailbox on A7xx would not undo the probe function properly - the qmp_put call present in the code was unreachable Fix all of these issues. Reported-by: Dan Carpenter Fixes: 88a0997f2f94 ("drm/msm/a6xx: Send ACD state to QMP at GMU resume") Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b change-id: 20231014-topic-a7xxv3-d0fa2d187215 Best regards, diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 0555a0134fad..8c4900444b2c 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1558,6 +1558,9 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) dev_pm_domain_detach(gmu->gxpd, false); } + if (!IS_ERR_OR_NULL(gmu->qmp)) + qmp_put(gmu->qmp); + iounmap(gmu->mmio); if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc")) iounmap(gmu->rscc); @@ -1654,6 +1657,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct a6xx_gmu *gmu = &a6xx_gpu->gmu; struct platform_device *pdev = of_find_device_by_node(node); + struct device_link *link; int ret; if (!pdev) @@ -1777,15 +1781,17 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) goto err_mmio; } - if (!device_link_add(gmu->dev, gmu->cxpd, - DL_FLAG_PM_RUNTIME)) { + link = device_link_add(gmu->dev, gmu->cxpd, DL_FLAG_PM_RUNTIME); + if (!link) { ret = -ENODEV; goto detach_cxpd; } gmu->qmp = qmp_get(gmu->dev); - if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu)) - return PTR_ERR(gmu->qmp); + if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu)) { + ret = PTR_ERR(gmu->qmp); + goto remove_device_link; + } init_completion(&gmu->pd_gate); complete_all(&gmu->pd_gate); @@ -1810,8 +1816,8 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) return 0; - if (!IS_ERR_OR_NULL(gmu->qmp)) - qmp_put(gmu->qmp); +remove_device_link: + device_link_del(link); detach_cxpd: dev_pm_domain_detach(gmu->cxpd, false);