From patchwork Thu May 23 17:16:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F35D112C for ; Thu, 23 May 2019 17:16:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6043E2228E for ; Thu, 23 May 2019 17:16:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5421B27E01; Thu, 23 May 2019 17:16:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7B5A2228E for ; Thu, 23 May 2019 17:16:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCC606E045; Thu, 23 May 2019 17:16:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6FD5A6E045 for ; Thu, 23 May 2019 17:16:56 +0000 (UTC) Received: by mail-qt1-x842.google.com with SMTP id h1so7669436qtp.1 for ; Thu, 23 May 2019 10:16:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OVyySMQJl3gBMSC8bbpoLt1NhD1HgNiXu8ozFZBZ59E=; b=PuIGgeOL7eNEnhcFoxfQR/lOrIH2AuD6LyPg9cqYfWM3oSvIj2GVWIQ3M8lwNP5WhM owRMcrUMJI8uZZ4xEVVf9rfTPjYyChyrpHoIp7znXrJ6SEwOPZiJ+wY408cAxxGOS2Cc pB97ZuJWwS68hd30/uAlXzCU4BR0kCJbytWr2xkz/MFuGDTgBvkRvHmTleAylDPEDKP+ VfGRSfhD4q5m7I6O/wRj4UAz6QXVse5HUMHvzk87LYSFI1aGpAjdeklo/GA6lPgsNHBG Aw8DzYKhmWfS6Qws59MxR36YN/BP6aaIEtzl9EMdNW8rlPOtnLOVLoCcGspidB5zoYER 0eCA== X-Gm-Message-State: APjAAAUO9IzRb9eNHc3uriXv8f1DpQSkECPITgdX4UPxQYIv+hQzZS7H 8cv/DbcW/6FieAtUTXHAkhMVVa7JnFU= X-Google-Smtp-Source: APXvYqx9L4yMF7KYPCpYv00QYxVIIjD4u5i22XRmGgtco4zLN/t6HQ9AhX/fqHgLqrbqiVeUTh9KLA== X-Received: by 2002:a0c:be87:: with SMTP id n7mr41100426qvi.65.1558631815491; Thu, 23 May 2019 10:16:55 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.16.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:16:54 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 1/6] drm/msm/a6xx: Avoid freeing gmu resources multiple times Date: Thu, 23 May 2019 13:16:40 -0400 Message-Id: <20190523171653.138678-1-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OVyySMQJl3gBMSC8bbpoLt1NhD1HgNiXu8ozFZBZ59E=; b=cEtmouNiutaoR3NwHaVYVUSLIb4Nun+cTeOsHerD0b9/E1jcOmLsCyjmpFNoqLG3+n cbUHD9VNJmHfzX/3zwdApXoJQv1T2++xVpOGcdknLIV5argkPmRby4Uwyx7jxHT2SnBe OXBS4ZVv36rR4yyIowM0jEog4c/U05sowWYLmFKV2yU9h7T6rXeTBjSZZzQhy3mgJN6K ljPAyEnEkcLNT7ScllQvRQUEvDoh1o604AZ05MiTl1ybQ6eKQpHnRJP3jtTAsUG1Gf0c OBcTZoOeKSq8XVcVLHbWyz4E4J2Wo2uuF3+azMlSmGrgWEGBXwqbieYa9U3PuMHJcihl SdFg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul The driver checks for gmu->mmio as a sign that the device has been initialized, however there are failures in probe below the mmio init. If one of those is hit, mmio will be non-null but freed. In that case, a6xx_gmu_probe will return an error to a6xx_gpu_init which will in turn call a6xx_gmu_remove which checks gmu->mmio and tries to free resources for a second time. This causes a great boom. Fix this by adding an initialized member to gmu which is set on successful probe and cleared on removal. Changes in v2: - None Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 14 +++++++++----- drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 38e2cfa9cec7..aa84edb25d91 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -74,7 +74,7 @@ bool a6xx_gmu_sptprac_is_on(struct a6xx_gmu *gmu) u32 val; /* This can be called from gpu state code so make sure GMU is valid */ - if (IS_ERR_OR_NULL(gmu->mmio)) + if (!gmu->initialized) return false; val = gmu_read(gmu, REG_A6XX_GMU_SPTPRAC_PWR_CLK_STATUS); @@ -90,7 +90,7 @@ bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu) u32 val; /* This can be called from gpu state code so make sure GMU is valid */ - if (IS_ERR_OR_NULL(gmu->mmio)) + if (!gmu->initialized) return false; val = gmu_read(gmu, REG_A6XX_GMU_SPTPRAC_PWR_CLK_STATUS); @@ -695,7 +695,7 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) struct a6xx_gmu *gmu = &a6xx_gpu->gmu; int status, ret; - if (WARN(!gmu->mmio, "The GMU is not set up yet\n")) + if (WARN(!gmu->initialized, "The GMU is not set up yet\n")) return 0; gmu->hung = false; @@ -765,7 +765,7 @@ bool a6xx_gmu_isidle(struct a6xx_gmu *gmu) { u32 reg; - if (!gmu->mmio) + if (!gmu->initialized) return true; reg = gmu_read(gmu, REG_A6XX_GPU_GMU_AO_GPU_CX_BUSY_STATUS); @@ -1227,7 +1227,7 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) { struct a6xx_gmu *gmu = &a6xx_gpu->gmu; - if (IS_ERR_OR_NULL(gmu->mmio)) + if (!gmu->initialized) return; a6xx_gmu_stop(a6xx_gpu); @@ -1245,6 +1245,8 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) iommu_detach_device(gmu->domain, gmu->dev); iommu_domain_free(gmu->domain); + + gmu->initialized = false; } int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) @@ -1309,6 +1311,8 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) /* Set up the HFI queues */ a6xx_hfi_init(gmu); + gmu->initialized = true; + return 0; err: a6xx_gmu_memory_free(gmu, gmu->hfi); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h index bedd8e6a63aa..39a26dd63674 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h @@ -75,6 +75,7 @@ struct a6xx_gmu { struct a6xx_hfi_queue queues[2]; + bool initialized; bool hung; }; From patchwork Thu May 23 17:16:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B22AB1395 for ; Thu, 23 May 2019 17:17:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93F7D2228E for ; Thu, 23 May 2019 17:17:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87CD427E01; Thu, 23 May 2019 17:17:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43A562228E for ; Thu, 23 May 2019 17:17:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AB636E046; Thu, 23 May 2019 17:17:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by gabe.freedesktop.org (Postfix) with ESMTPS id D04E26E04A for ; Thu, 23 May 2019 17:17:02 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id j1so4254025qkk.12 for ; Thu, 23 May 2019 10:17:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GCPOgKXDLNcR6sFL6yT6feeZpVf/aYG9QLic+JdxubM=; b=VzewyZvLAdn0x8DY3n8mK97OXU9zCS0L1MK0ee9YYpC8wTdLzQa1IVbDXCkbn7mdY4 D9RmSh0uzfi7PSHooOome2nNTnJO6mD0HTVKLk36suw3rItrz2L7w4MGtXwHb7LKmbwX F2Ub5HqSntgh6S6yl3L6vVwzKyLY9QuYZTaFpoZK0jo+3A2cgrBnbNvy5ZhdlysoXueA Xma+E1PyczBgh46AnkoRBDJILiP/2L29YiJHbWtNtj9w/nFx05e9fd82kECFhbndbQmk IBxqY0Y+h2X92sF+da7G9u2MAdrDWXx/54RQ8D8p56F1ceVYdTvTes1B0IaVCYXIl080 H5xA== X-Gm-Message-State: APjAAAVrZX+c+XPDOHTVPRYOQBQjFjjFPfNO9+EZe+kUDzqqH75VXZok XbPIkZbM0j2R4bXSdWng0TNtzOFKm8g= X-Google-Smtp-Source: APXvYqzQK71cctzLw03xT3jdNw0SD9PtL3nBDxCQtUeUy9B9Z9lczPE6z44Z2LgpEKo1y0LKyhEpiQ== X-Received: by 2002:a37:bd42:: with SMTP id n63mr32955087qkf.262.1558631821916; Thu, 23 May 2019 10:17:01 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.17.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:17:01 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 2/6] drm/msm/a6xx: Remove duplicate irq disable from remove Date: Thu, 23 May 2019 13:16:41 -0400 Message-Id: <20190523171653.138678-2-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190523171653.138678-1-sean@poorly.run> References: <20190523171653.138678-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GCPOgKXDLNcR6sFL6yT6feeZpVf/aYG9QLic+JdxubM=; b=Z1BBTBNQGFwi1a6YCUrwlBkcg4d0qRPyeFFxcIpPo4kL342FYfzrTCrsCkzAKJSa8D kCvCZ4JJX1m+FaxkU6hE15FHkcAFiT2zElk/si/zSkchoOAdiwBxiOLRU0lML2gbFAFs Rg5cE0bbhO58zclxCiqYroZnyhw2gnIFuJ6HBh83XRG1VtMiuf65JIJdSxWZtfJvw94P Qq5yMfEY+W/7B2yQ1pB1dzV/MwFKp6QkShaRF+MFs/e2FgyMUxrZNt9lQ4K8MjDBNhVv +R1ZRdQv5bv4yai7m51LsnP6d0vgTkdl+odwD3o3xD/PGRz88NrIgiGzuFCZchP1VT9m rdAA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul a6xx_gmu_stop() already calls this function via shutdown or force_stop, so it's not necessary to call it twice. Previously this would have knocked the irq refcount out of sync, but now with the irqs_enabled flag it's just housekeeping. Changes in v2: - None Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index aa84edb25d91..742c8ff9a61c 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1239,7 +1239,6 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) dev_pm_domain_detach(gmu->gxpd, false); } - a6xx_gmu_irq_disable(gmu); a6xx_gmu_memory_free(gmu, gmu->hfi); iommu_detach_device(gmu->domain, gmu->dev); From patchwork Thu May 23 17:16:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBC6A112C for ; Thu, 23 May 2019 17:17:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABA702228E for ; Thu, 23 May 2019 17:17:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A04C027E01; Thu, 23 May 2019 17:17:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61A302228E for ; Thu, 23 May 2019 17:17:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CCBE6E04E; Thu, 23 May 2019 17:17:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BEA66E04B for ; Thu, 23 May 2019 17:17:06 +0000 (UTC) Received: by mail-qt1-x842.google.com with SMTP id a17so7661756qth.3 for ; Thu, 23 May 2019 10:17:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r1uMx4HlXEIWJhoxtRZuApdyrpL8kUyECxg5uM75EcQ=; b=YxWkwRVHRrLwV7q6R2zNUQKPb5NT3LJwWbh/uF92pQdh0k/kxwP79LlTsFs7tZcFoQ Cw7PHIpN9z+9T6SkE5TcN68B6D0TzsIWdoIECWZ4qbao7k03VGrhmYAej33gNitDp2I2 NiedM+kftI2Hm+hbcD2bcnbV3eyXCW6hCrcq7YYTFq7C6wBZoGXuiGJ6W3zkHKBD3055 ESJmTsrLCVd+grwIS4SMvMLkQIP4LtiLGNapRiohHJD83gvlgf+3OXx8AG+AeLpoaKhX mtGslYIuEIFHuJNZKVNCFrukWAqh8E7MZCgFOv7Csh9N58eMISSJm2/zNekTzAv7jqdB D+LQ== X-Gm-Message-State: APjAAAWdFSdCrDqYGL+QbdfzR/7xO8Jj0yna4vZTl6oo1lAAZLkZDb6t Tbfws2VuI72XmSKKjYu/6Lb52LhzxBs= X-Google-Smtp-Source: APXvYqw6qd2/bm3XDuds3ElkTbvU8jLAH+jx5B8lOufj9jGw5Pr4Vtmo68zBsIF6kAxsiF4lv8g0xQ== X-Received: by 2002:ac8:193b:: with SMTP id t56mr58719700qtj.346.1558631824791; Thu, 23 May 2019 10:17:04 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.17.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:17:04 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 3/6] drm/msm/a6xx: Check for ERR or NULL before iounmap Date: Thu, 23 May 2019 13:16:42 -0400 Message-Id: <20190523171653.138678-3-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190523171653.138678-1-sean@poorly.run> References: <20190523171653.138678-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r1uMx4HlXEIWJhoxtRZuApdyrpL8kUyECxg5uM75EcQ=; b=fgrbGFp7nygVomfe4EMnidETfJIB6CM+tkh7RLf66aVDXAFgEMGmyMw9ds1JnFIyH9 aI6FZXYuBnUWJeSXtErJwiDxtWaBOW903lX4oFmcui9xjC217AaXL7s80elnz/ZASXlz XZc3P/lyc2al7uYbmMFJjCOXWYFVkZY/4t0Spn/qGhC8I+aINXeNmSKFHV07owyGS+mz JaqgNCaTQkh30BlrketQocvxAeF9TIJI7gjm3SU8Bt72QqQYRIJg7fYhmt/V/RXJ35AB LpSQxAIY5nnbYUCuAW6D0Nyuaqkh/sCou9XElxa/v1JhsLLD1pRS2+PNyGCEYoyNrqnM Rq0w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul pdcptr and seqptr aren't necessarily valid, check them before trying to unmap them. Changes in v2: - None Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 742c8ff9a61c..7465423e9b71 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -504,8 +504,10 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) wmb(); err: - devm_iounmap(gmu->dev, pdcptr); - devm_iounmap(gmu->dev, seqptr); + if (!IS_ERR_OR_NULL(pdcptr)) + devm_iounmap(gmu->dev, pdcptr); + if (!IS_ERR_OR_NULL(seqptr)) + devm_iounmap(gmu->dev, seqptr); } /* From patchwork Thu May 23 17:16:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958549 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26C851395 for ; Thu, 23 May 2019 17:17:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 066502228E for ; Thu, 23 May 2019 17:17:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDF9227E01; Thu, 23 May 2019 17:17:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C5E52228E for ; Thu, 23 May 2019 17:17:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B33096E055; Thu, 23 May 2019 17:17:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by gabe.freedesktop.org (Postfix) with ESMTPS id A65AB6E053 for ; Thu, 23 May 2019 17:17:08 +0000 (UTC) Received: by mail-qt1-x842.google.com with SMTP id f24so7611187qtk.11 for ; Thu, 23 May 2019 10:17:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YOoI+kFEFfz9LrL8Adfvk8PSVi8fDSRQM6ZIbKpC71Q=; b=OLz0j9lqIpugumxjMkEjk4xemoeeSIondeDwQkG2KvwSHOQzM/YuOXeh1zNzn0uyjm 4HbhInUBSV2uD4ek9gFbYhRrpy3cA0ERJuKqUfa6P7IHVsC/ty25bRmEN6IosqiibjG9 6s6gQeIUUaFQuZxoRYddfaTVveArffRCEUzHgZyUz56iFG19cq0vT29H6kbHh2zylnBc SqX3Jale0EqsvTeRMIwgBvmIid5SQMMGxgkFFQ6GFoQWHjFiMsP3gZ1Q6obIScEDlsDv swz+DcYJiFb4w9dxTDCG1npJUvnRG3logUC+wbzKgww+uO4B4kEiSj61MNBxmmNLQDbI c3XA== X-Gm-Message-State: APjAAAVX/1tacdgSI1MaPzqdHeAw2sb5PjOUN8Xxbaq2X4ZC+Ie59hGV fWI2n0tsB69oLMyQFo4eXXEeMYx55kk= X-Google-Smtp-Source: APXvYqxQoLBWcUdmZJt5A7maTk+7saVt300tFlzQsl2BLsrTVmobiF3JlblgyopmJed3KTL4ljJVfw== X-Received: by 2002:ac8:2809:: with SMTP id 9mr66230566qtq.4.1558631827700; Thu, 23 May 2019 10:17:07 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.17.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:17:07 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 4/6] drm/msm/a6xx: Remove devm calls from gmu driver Date: Thu, 23 May 2019 13:16:43 -0400 Message-Id: <20190523171653.138678-4-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190523171653.138678-1-sean@poorly.run> References: <20190523171653.138678-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YOoI+kFEFfz9LrL8Adfvk8PSVi8fDSRQM6ZIbKpC71Q=; b=WOyQTxGFjpgVbzMyOh6x8CBVZIC4EmjNx9VoiKWwVDRBwjidnFD+Arrimko93Sgb+j ULIKYLV3wI5JNHuDQ42Gf0DBiDwP+1JgdiCjYOCAJ1lvB1FxkYdUuZsO+sEH7cyI8nLj VnlYsxy7mtFNq7iZIjbajz4ZuFkBggxiIgvG4wAXb2SCPA5anCyU7KQ68Vv75Ox4dT2E u7kaM1IqRO5Phdy+Rm1TtBkY3DEjq5j+LsuA++pxJ5WrsvKcxQlORRqmQsuPUIVd5nFG LDtCcZ/GgkV582VHLoKcO8MwFeapNl4ClAPjhJiF/EEYWIIJse7Iv6pyfwzwE7B+/v7y 2Z3g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul The gmu driver is initialized and cleaned up with calls from the gpu driver. As such, the platform device stays valid after a6xx_gmu_remove is called and the device managed resources are not freed. In the case of gpu probe failures or unbind, these resources will remain managed. If the gpu bind is run again (eg: if there's a probe defer somewhere in msm), these resources will be initialized again for the same device, creating multiple references. In the case of irqs, this causes failures since the irqs are not shared (nor should they be). This patch removes all devm_* calls and manually cleans things up in gmu_remove. Changes in v2: - Add iounmap and free_irq to gmu_probe error paths Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 7465423e9b71..f7240c9e11fb 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -505,9 +505,9 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) err: if (!IS_ERR_OR_NULL(pdcptr)) - devm_iounmap(gmu->dev, pdcptr); + iounmap(pdcptr); if (!IS_ERR_OR_NULL(seqptr)) - devm_iounmap(gmu->dev, seqptr); + iounmap(seqptr); } /* @@ -1197,7 +1197,7 @@ static void __iomem *a6xx_gmu_get_mmio(struct platform_device *pdev, return ERR_PTR(-EINVAL); } - ret = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + ret = ioremap(res->start, resource_size(res)); if (!ret) { DRM_DEV_ERROR(&pdev->dev, "Unable to map the %s registers\n", name); return ERR_PTR(-EINVAL); @@ -1213,10 +1213,10 @@ static int a6xx_gmu_get_irq(struct a6xx_gmu *gmu, struct platform_device *pdev, irq = platform_get_irq_byname(pdev, name); - ret = devm_request_irq(&pdev->dev, irq, handler, IRQF_TRIGGER_HIGH, - name, gmu); + ret = request_irq(irq, handler, IRQF_TRIGGER_HIGH, name, gmu); if (ret) { - DRM_DEV_ERROR(&pdev->dev, "Unable to get interrupt %s\n", name); + DRM_DEV_ERROR(&pdev->dev, "Unable to get interrupt %s %d\n", + name, ret); return ret; } @@ -1241,12 +1241,18 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) dev_pm_domain_detach(gmu->gxpd, false); } + iounmap(gmu->mmio); + gmu->mmio = NULL; + a6xx_gmu_memory_free(gmu, gmu->hfi); iommu_detach_device(gmu->domain, gmu->dev); iommu_domain_free(gmu->domain); + free_irq(gmu->gmu_irq, gmu); + free_irq(gmu->hfi_irq, gmu); + gmu->initialized = false; } @@ -1281,24 +1287,24 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) /* Allocate memory for for the HFI queues */ gmu->hfi = a6xx_gmu_memory_alloc(gmu, SZ_16K); if (IS_ERR(gmu->hfi)) - goto err; + goto err_memory; /* Allocate memory for the GMU debug region */ gmu->debug = a6xx_gmu_memory_alloc(gmu, SZ_16K); if (IS_ERR(gmu->debug)) - goto err; + goto err_memory; /* Map the GMU registers */ gmu->mmio = a6xx_gmu_get_mmio(pdev, "gmu"); if (IS_ERR(gmu->mmio)) - goto err; + goto err_memory; /* Get the HFI and GMU interrupts */ gmu->hfi_irq = a6xx_gmu_get_irq(gmu, pdev, "hfi", a6xx_hfi_irq); gmu->gmu_irq = a6xx_gmu_get_irq(gmu, pdev, "gmu", a6xx_gmu_irq); if (gmu->hfi_irq < 0 || gmu->gmu_irq < 0) - goto err; + goto err_mmio; /* * Get a link to the GX power domain to reset the GPU in case of GMU @@ -1315,7 +1321,12 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) gmu->initialized = true; return 0; -err: + +err_mmio: + iounmap(gmu->mmio); + free_irq(gmu->gmu_irq, gmu); + free_irq(gmu->hfi_irq, gmu); +err_memory: a6xx_gmu_memory_free(gmu, gmu->hfi); if (gmu->domain) { From patchwork Thu May 23 17:16:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFD7B1395 for ; Thu, 23 May 2019 17:17:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF2826E47 for ; Thu, 23 May 2019 17:17:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B41CE2842D; Thu, 23 May 2019 17:17:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6573126E47 for ; Thu, 23 May 2019 17:17:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71F076E053; Thu, 23 May 2019 17:17:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D4516E054 for ; Thu, 23 May 2019 17:17:11 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id j53so7622120qta.9 for ; Thu, 23 May 2019 10:17:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LAxvAIcKgOQtgxLFmLme64DEPUv6dyfyGiKy9z9/MCs=; b=rQIjPdXXb4YiFB9W5FV1FwfgPCCAJbSy8UqI6mjpc/lLdUmlfgm2jLmREAKQqFC1KK eml/VAAiyoqEZsh4q4hNSLXcCj6NA/0TqIOoxVh5HedXQdDY+Zzgn4pGaNQGYSZ+f8+W m9SKnEtXu6OYrLE8r0xercxGWTZsVjak/10fPb9fkPB6Dkm6ILMldfJp1OH/GFpUPsk0 8Zq0E0hIP5p9b/dk+rS1hP1JHjd/xgmqAHDw3NksDIOHdhdiLqIZbxo54oPMHV7Ryk/d FC/JMNBjwVrY30Zdp0gEmTz6S0XPzOgVuXl77MsdQMHMngnpSYVkgaQ/sbASV1m6iqXH SzIA== X-Gm-Message-State: APjAAAUsVrKaVx92NbmxDyalz8dW5rOlOtYUgMm9PjV3zcg8Wwm6PaIU dusoCEuAdjKbvrvz1PkWJKbIsTiq+sg= X-Google-Smtp-Source: APXvYqyYw1/bFwr5ugr6PT9CZN+/0NEYxJLX3rL7031w7JMYQiQvCowH+7AbKLe2zMD0244RVWYD4A== X-Received: by 2002:ac8:38c6:: with SMTP id g6mr12497608qtc.353.1558631830415; Thu, 23 May 2019 10:17:10 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:17:09 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 5/6] drm/msm/a6xx: Drop the device reference in gmu Date: Thu, 23 May 2019 13:16:44 -0400 Message-Id: <20190523171653.138678-5-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190523171653.138678-1-sean@poorly.run> References: <20190523171653.138678-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LAxvAIcKgOQtgxLFmLme64DEPUv6dyfyGiKy9z9/MCs=; b=V0CFGOhhRC9eOWybC6/ZBTPxvnDMwWa8evXcjFmVfoOF7xn1ScLItpDL3v/QCcz/QX 1wzP9oTnirrNEy2iiPcV4Lg/ITtuPPrbCzYpG1fKug7lRL0OrvjUCMHlNcK6CvH2318I 4SqhOH8ZWTfrtUaanBHb8TCdO8xRCQZbeflqzPt8OqFzNrLoQ0bPgTPbHMvcB7JyDiDZ AbVW4myrmGjYp6ArQkkS7s0z2FDKZR+Z0lJMOYvt6J6zaOnXIrwCOuqk8KM0sGltNNIC W576cyuZhs6n1Xcw0NPM7KLGwkyshxKBySWID0gN/7UQW71pIfT+i2Ln/b3PgkrlPo9J IfkQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul of_find_device_by_node() grabs a dev reference, so make sure we clear it on error and remove. Changes in v2: - Added to the set (Jordan) Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index f7240c9e11fb..e2b839b5d3bd 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1253,6 +1253,9 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) free_irq(gmu->gmu_irq, gmu); free_irq(gmu->hfi_irq, gmu); + /* Drop reference taken in of_find_device_by_node */ + put_device(gmu->dev); + gmu->initialized = false; } @@ -1277,12 +1280,12 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) /* Get the list of clocks */ ret = a6xx_gmu_clocks_probe(gmu); if (ret) - return ret; + goto err_put_device; /* Set up the IOMMU context bank */ ret = a6xx_gmu_memory_probe(gmu); if (ret) - return ret; + goto err_put_device; /* Allocate memory for for the HFI queues */ gmu->hfi = a6xx_gmu_memory_alloc(gmu, SZ_16K); @@ -1334,6 +1337,11 @@ int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) iommu_domain_free(gmu->domain); } + ret = -ENODEV; - return -ENODEV; +err_put_device: + /* Drop reference taken in of_find_device_by_node */ + put_device(gmu->dev); + + return ret; } From patchwork Thu May 23 17:16:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10958555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D67DF112C for ; Thu, 23 May 2019 17:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6A882228E for ; Thu, 23 May 2019 17:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB35427E01; Thu, 23 May 2019 17:17:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B8092228E for ; Thu, 23 May 2019 17:17:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18C4D6E056; Thu, 23 May 2019 17:17:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23C3F6E056 for ; Thu, 23 May 2019 17:17:15 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id h1so7670616qtp.1 for ; Thu, 23 May 2019 10:17:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hZe31Z2x4VZIoxtbM4ZpRRber9rntpgDGP2PgN5budQ=; b=FyLhuchNZrCmYCnmGDH0f/0u1aHSz+qGohb3mgEvXTukApi9fCKZ3ikDMWbPbm+QsS dRnLPnHyULUPdHebMjeS6DqFe3olNi/Mv0gkUVWwRJz6tSP/m+JJe0iGTpvMxli/IpyY eswrPX6tAt4e6vSrmBs/PsxC1f2uBwhUV7mJSR8Nqc/X79JQ7/bENrC+zfbwIlSojWMi 2MYQX9mVSxpGQ8qteCQJ4C67k8pWTVV+tesdWJrLg9ktREtkO4c/TxtFozZ+IKmn69qt C7yFylF6tjHqsDX1SCFzhE2UYRIV1G2IweoKolPIq5omD/FdDSKjDlvgiMErr1592eZ1 TI/g== X-Gm-Message-State: APjAAAWArrZyYnTRaio3WUYnJIyBLBZE2mFOeqtPM02764a5NQpjrpCQ a+1acFVt0FRmH09jOmYgnw84vI5C06Y= X-Google-Smtp-Source: APXvYqxRprHyHT6NlQk7WcwvlRTrpIwhUGLkLhawVE7G3xLGTBOWzBMT9iOE+OiXjWCjQTl9u9p9vw== X-Received: by 2002:ac8:2fa2:: with SMTP id l31mr43692903qta.277.1558631833831; Thu, 23 May 2019 10:17:13 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id v25sm662660qtv.2.2019.05.23.10.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 10:17:13 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 6/6] drm/msm/a6xx: Rename a6xx_gmu_probe to a6xx_gmu_init Date: Thu, 23 May 2019 13:16:45 -0400 Message-Id: <20190523171653.138678-6-sean@poorly.run> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190523171653.138678-1-sean@poorly.run> References: <20190523171653.138678-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hZe31Z2x4VZIoxtbM4ZpRRber9rntpgDGP2PgN5budQ=; b=b3u8Er9VI4JeQuWJ/pKPImBGjjHWw+5VyWes76BQby1qFilLFyRvguFRcg+EjEZ72N Iy8uiJIgS21AY13yoVx2lAKHp14UAzvZDzRYLYsqGOF7G0N/uXdqIj0hFD+AQsHLRnyp ib80Eiy/80UZ1pYDBN3JfBAC6sFN8VfoTKHxMSnZeQAdEnLVetLjJ6hsH4d+V0dK2tSJ Q6y4weOLCjuVD8ttzNYu4cGQaKmCx16rsLgH9bbWiHfeD2jqYyNtXlhkePcqLB3CROyz jKfANJS9/vInV8vQuBdNvhbvKw4IShqwFetNDLeB/ifaR6RsgTuoRCz6Y9WJbn2nBusU r9Rw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Sean Paul , linux-arm-msm@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul This rename makes it more clear that everything initialized in the _init function must be cleaned up in a6xx_gmu_remove. This will hopefully dissuade people from using device managed resources (for reasons laid out in the previous patch). Changes in v2: - None Cc: Jordan Crouse Signed-off-by: Sean Paul Reviewed-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index e2b839b5d3bd..5ab69dcd5479 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1259,7 +1259,7 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) gmu->initialized = false; } -int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node) +int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) { struct a6xx_gmu *gmu = &a6xx_gpu->gmu; struct platform_device *pdev = of_find_device_by_node(node); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index e74dce474250..1f9f4b0a9656 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -854,7 +854,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) /* FIXME: How do we gracefully handle this? */ BUG_ON(!node); - ret = a6xx_gmu_probe(a6xx_gpu, node); + ret = a6xx_gmu_init(a6xx_gpu, node); if (ret) { a6xx_destroy(&(a6xx_gpu->base.base)); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h index b46279eb18c5..64399554f2dd 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -53,7 +53,7 @@ bool a6xx_gmu_isidle(struct a6xx_gmu *gmu); int a6xx_gmu_set_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state); void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state); -int a6xx_gmu_probe(struct a6xx_gpu *a6xx_gpu, struct device_node *node); +int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu); void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq);