From patchwork Sun May 12 05:49:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiarash Hajian X-Patchwork-Id: 13662596 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 69C55C10F1A for ; Sun, 12 May 2024 05:50:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9756810E0B5; Sun, 12 May 2024 05:50:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="j68OD5pz"; dkim-atps=neutral Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id E001710E0B5; Sun, 12 May 2024 05:50:36 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3504f34a086so1803763f8f.1; Sat, 11 May 2024 22:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715493035; x=1716097835; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3P87QNQI1cdzXKDd3JYfTiYCdS5DbA/31YPlGfdPOLE=; b=j68OD5pzEtNy8XtAC3ooEY+9XKKxpTU9WOIh4L+q/BIumYUTG3N6YRjposfBEPiUF8 mabyj9WEbUzu71jLho4OnYhWqI46IvXiYPbZO2zHUk/Y22q8XgYKSv93W3jKpo5fiegY Rh51sjUk70czUhZ70z/B9MrVmAXXqbfR8pA5HqCzfT7VZPcYJW7JjzcaZ+8MLYvbw8NM q6kWT9RTeD0o31WtMQNaiB4BJF7KlPAxfgLVdl9787xQJONTVRS6NsDreGkwchxB8tW2 3JwkrtGhMwu0avfy/MGb6We0+CatGA+s8Eo5mkxP1M2Dr8Ui3p6AXx6inFEqWdU8UF1r NuwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715493035; x=1716097835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3P87QNQI1cdzXKDd3JYfTiYCdS5DbA/31YPlGfdPOLE=; b=dBoKNfFWlqNq+/CqaoxCrcnKAIm89g0Iq5qHZwD18Bs6ocXwRYi20xkUi9q+cBPjSK fXobK5+51Gs+UHFsP/qISwksKrIwFpPhOZk7NZcpzycxRl13NsWJEdb70+QB0ZDOAJnZ qR/WAYYz56Es9cKbvb58G/Z0wl2bVzCzsmJjjYQQwPNLHbq3VwePMvIH7Hpe7nQ5YFxW H2UvKinWH6hFqW+zGM+mFIGW0fx1G1IHLW1HV8+VlsRIUxx0G0N/zPmhGwQE2aWsVxfP JTOAmyyCSKKoszsetzsX6ZVU0LEtW63eQCOf6a1m4d5VdlB9yXPGcdhjG3g1nm1KwAHL hVYA== X-Forwarded-Encrypted: i=1; AJvYcCVvYunjg8/CYjtaHjJPDmqNJN7kNJUmtJxnKkEWqJ+tLtuVHFaQhA+zoJtF20BVUHfF4OpqvbI+rzApmbMvFMyWHqORE5ua1uSjeF9fXcW3YS4md33Np2TVP6HSlxuU9A24a4XwL4lF+eg60BEqmmUl X-Gm-Message-State: AOJu0YwGUjilQ3O2ePFiJklTGM3MrQ1sbxcnRsISk7OGyEzJyfWOhTOw h7G+sRQGQHcEdg2Uvv/rdqvaN3/07gm5nM2zirlF84MTxEwctaIN X-Google-Smtp-Source: AGHT+IF04Ds5tvXV4Cg/hI3Oyl/H3/3cE837ElBsfTF9KwyluX0RHqTIK53+1bMLv6gpxAE6fO6PAw== X-Received: by 2002:a5d:52d1:0:b0:34e:4105:b3f6 with SMTP id ffacd0b85a97d-3504a73ee8dmr4703871f8f.39.1715493035057; Sat, 11 May 2024 22:50:35 -0700 (PDT) Received: from kali.localhost ([5.208.126.127]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbde1sm8233658f8f.97.2024.05.11.22.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 22:50:34 -0700 (PDT) From: Kiarash Hajian Date: Sun, 12 May 2024 01:49:38 -0400 Subject: [PATCH v3 1/2] drm/msm/a6xx: request memory region MIME-Version: 1.0 Message-Id: <20240512-msm-adreno-memory-region-v3-1-0a728ad45010@gmail.com> References: <20240512-msm-adreno-memory-region-v3-0-0a728ad45010@gmail.com> In-Reply-To: <20240512-msm-adreno-memory-region-v3-0-0a728ad45010@gmail.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kiarash Hajian X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715493029; l=2001; i=kiarash8112hajian@gmail.com; s=20240409; h=from:subject:message-id; bh=pqxwzpqjeLaRI5EDxNPTtTBb3Tu0jXn7ELZFMBQ3ty8=; b=H1PJF04vum4qJtdfIWyr9687LM2NkNqG5XOS95rodZCI9HFRySOf6DcwRQtOabGfvstM9AaKi r9xxWalD41rCsDelS/PxoRH6imO3T1D+OApZolw/o4IT8w570QCekh/ X-Developer-Key: i=kiarash8112hajian@gmail.com; a=ed25519; pk=ehVBr28gPcA8cMB/wneVh0Mj6WGkqZoyYRdRNi5+aI0= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver's memory regions are currently just ioremap()ed, but not reserved through a request. That's not a bug, but having the request is a little more robust. Implement the region-request through the corresponding managed devres-function. Signed-off-by: Kiarash Hajian --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 8bea8ef26f77..aa83cb461a75 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -636,9 +636,9 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) err: if (!IS_ERR_OR_NULL(pdcptr)) - iounmap(pdcptr); + devm_iounmap(&pdev->dev,pdcptr); if (!IS_ERR_OR_NULL(seqptr)) - iounmap(seqptr); + devm_iounmap(&pdev->dev,seqptr); } /* @@ -1503,7 +1503,7 @@ static void __iomem *a6xx_gmu_get_mmio(struct platform_device *pdev, return ERR_PTR(-EINVAL); } - ret = ioremap(res->start, resource_size(res)); + ret = devm_ioremap_resource(&pdev->dev, res); if (!ret) { DRM_DEV_ERROR(&pdev->dev, "Unable to map the %s registers\n", name); return ERR_PTR(-EINVAL); @@ -1646,7 +1646,7 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) dev_pm_domain_detach(gmu->cxpd, false); err_mmio: - iounmap(gmu->mmio); + devm_iounmap(gmu->dev ,gmu->mmio); /* Drop reference taken in of_find_device_by_node */ put_device(gmu->dev); @@ -1825,9 +1825,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) dev_pm_domain_detach(gmu->cxpd, false); err_mmio: - iounmap(gmu->mmio); + devm_iounmap(gmu->dev ,gmu->mmio); if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc")) - iounmap(gmu->rscc); + devm_iounmap(gmu->dev ,gmu->rscc); free_irq(gmu->gmu_irq, gmu); free_irq(gmu->hfi_irq, gmu); From patchwork Sun May 12 05:49:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiarash Hajian X-Patchwork-Id: 13662597 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 28359C10F1A for ; Sun, 12 May 2024 05:50:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 25FE810E0DA; Sun, 12 May 2024 05:50:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Anx9Q2LB"; dkim-atps=neutral Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1747910E0DA; Sun, 12 May 2024 05:50:39 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-34d7d04808bso2475892f8f.0; Sat, 11 May 2024 22:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715493038; x=1716097838; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=L1XpgzHw/Nytzeexk8L71Zuu6UpL2KUJOeWc+Pl9H0M=; b=Anx9Q2LBYYdGG/wHGY0GXH+a+vfO4hYBBZBuHtM/XA/m5FlfafOTQWZTBEKh93BCWh +8MhRUZyTUk8aDhoYUlykDn+fZPuKQ6rx9WBV7JFN9iYIcE97ou7563+iCV6gPnwBcL1 cvNKBrcVIfdeuXjAwa2R10gT/H5z24Z4W5N+0+SWIldGIN14q095lJvNzbivwvllIMOv h0VwiLQIdRA38aEaCJ247xbr7dHD72OdXF/tPfKoeGwwA80eVSiH6zecvZkvlejGSrXU /3uRDK4BvfyKDyHTn7xGF01dvI/ls/LhV/05x7LZ+/vvsZUMt2FWYUTTz0/gch/nmVCi 7CRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715493038; x=1716097838; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L1XpgzHw/Nytzeexk8L71Zuu6UpL2KUJOeWc+Pl9H0M=; b=wBH3uq/rFPRWoj9YHs8pSe9HsYQ38bMnN7t8I/vHZf6jS1hin08Cu++tYwaKXTeHt7 uPKLNuzHKurBjdFwc+xBDapA7rLIPc19hdjt5CF1uVJ/LG7yOyf30FuaIcFAfyl1H+En D/LOCCAxAtw53Caft3tHt2YPBm+/rl1zOmDHFpUfQ961RimbL/G5sAylMv8jAzwHyNnr odtE5aKAGUWwN/C483gLq59w5kbfdzYCJRXIMDc1DvTWoLEfZCmifDfvJ2hwvrk4/1x0 pEgFuzWLXtE1yKmppT9e79eyW5UmomuVnGg4KjgGoqOidt15do3zIETJ0QFw/EVXiZz0 BeUA== X-Forwarded-Encrypted: i=1; AJvYcCVw+KHbisb2k2p2cFFQT80dNbYjk1GelxYtHqiLSvuZ6K//wUfWF7mL5bgU375rCxSOgVMEfWeVBzGvZTwI0fOfzSlZpvUIpECGOQ1MebPiYiMcU9D23GqvR9NpGxBJB+FUajOYXcm/Th/r1CBxztAm X-Gm-Message-State: AOJu0Yz/p9noU/bdnesEVvLVxzubetlww2TcPdmdE4IxXQa3WXo3x3vX II9sdYJsadZ0bJnm8ikH+JqJI18JqeSAa7Uc+c4XJ7RJvZqC/ziV X-Google-Smtp-Source: AGHT+IGIegRhuRPR8A8oUnqlzeg+u+kIoiZi/2RatA7tPrm34L76cljbxtIM6JSDvoiVm0RVB2cSvA== X-Received: by 2002:a05:6000:1d9b:b0:351:b7c8:3efe with SMTP id ffacd0b85a97d-351b7c83f88mr680423f8f.3.1715493038023; Sat, 11 May 2024 22:50:38 -0700 (PDT) Received: from kali.localhost ([5.208.126.127]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbde1sm8233658f8f.97.2024.05.11.22.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 22:50:37 -0700 (PDT) From: Kiarash Hajian Date: Sun, 12 May 2024 01:49:39 -0400 Subject: [PATCH v3 2/2] drm/msm/a6xx: request memory region MIME-Version: 1.0 Message-Id: <20240512-msm-adreno-memory-region-v3-2-0a728ad45010@gmail.com> References: <20240512-msm-adreno-memory-region-v3-0-0a728ad45010@gmail.com> In-Reply-To: <20240512-msm-adreno-memory-region-v3-0-0a728ad45010@gmail.com> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kiarash Hajian X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1715493029; l=2351; i=kiarash8112hajian@gmail.com; s=20240409; h=from:subject:message-id; bh=Kt2K7zMmwsE77jHHj+rr+4K04ypr7zZgiyA3hJnQQlw=; b=+D9LeDZ7VE3tcvVCJr9j4KAbxEFaFEkYeJj75Ut20EejIA44pc07J/vbovudnIqib5kWvfbPZ l7q0Nf+92GNAVKmCJr9YUBXVhTeQMFS6KPXkILP3ksfLfCoehZPdvbg X-Developer-Key: i=kiarash8112hajian@gmail.com; a=ed25519; pk=ehVBr28gPcA8cMB/wneVh0Mj6WGkqZoyYRdRNi5+aI0= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The devm_iounmap function is being used unnecessarily, managed resource mechanisms (devres) are handling resource cleanup automatically This commit removes the calls to devm_iounmap and relies on devres Signed-off-by: Kiarash Hajian --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index aa83cb461a75..d64bf6212d6f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -524,9 +524,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) uint32_t pdc_address_offset; bool pdc_in_aop = false; - if (IS_ERR(pdcptr)) - goto err; - if (adreno_is_a650(adreno_gpu) || adreno_is_a660_family(adreno_gpu) || adreno_is_a7xx(adreno_gpu)) @@ -540,8 +537,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) if (!pdc_in_aop) { seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq"); - if (IS_ERR(seqptr)) - goto err; } /* Disable SDE clock gating */ @@ -633,12 +628,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) wmb(); a6xx_rpmh_stop(gmu); - -err: - if (!IS_ERR_OR_NULL(pdcptr)) - devm_iounmap(&pdev->dev,pdcptr); - if (!IS_ERR_OR_NULL(seqptr)) - devm_iounmap(&pdev->dev,seqptr); } /* @@ -1635,7 +1624,6 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) gmu->gxpd = dev_pm_domain_attach_by_name(gmu->dev, "gx"); if (IS_ERR(gmu->gxpd)) { ret = PTR_ERR(gmu->gxpd); - goto err_mmio; } gmu->initialized = true; @@ -1645,9 +1633,6 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) detach_cxpd: dev_pm_domain_detach(gmu->cxpd, false); -err_mmio: - devm_iounmap(gmu->dev ,gmu->mmio); - /* Drop reference taken in of_find_device_by_node */ put_device(gmu->dev); @@ -1825,9 +1810,6 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) dev_pm_domain_detach(gmu->cxpd, false); err_mmio: - devm_iounmap(gmu->dev ,gmu->mmio); - if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc")) - devm_iounmap(gmu->dev ,gmu->rscc); free_irq(gmu->gmu_irq, gmu); free_irq(gmu->hfi_irq, gmu);