From patchwork Thu Nov 3 19:51:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030954 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E8E0C43217 for ; Thu, 3 Nov 2022 19:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbiKCTwA (ORCPT ); Thu, 3 Nov 2022 15:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiKCTwA (ORCPT ); Thu, 3 Nov 2022 15:52:00 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34E21E3D8 for ; Thu, 3 Nov 2022 12:51:58 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id l11so4692469edb.4 for ; Thu, 03 Nov 2022 12:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h+MC8kK4zWQiBOS9TmUZzl813e7Kce9jFI4colJBhao=; b=qA13inhD1EP6l24EPFrU95U+zViK6UVln1wnFLBXMzU3guuv5XL87mQ657GGlBJDv5 Ynobk1ef/cexQULn5sXQz2W0DyjHLeN7af3yGWh1e+lEc2Ci2EuKhObBAOHiQw202pbb R0A9SrGxiRDi2/BfD0GbOpeSesGZlhz1/w/9u3MExoFW2+fBs9XPOktTxlaIj5vZ3DA9 wAsSWuQhV1ShmHc74HtGrM/RnLpTzmFNT3bIBaR/+Ty0SC55iaEr0ywSRpT1ZiP9Lele IsDff9Xm4w6mcr2mzhB53onaIFRvURcJExNk1TF372aT5uZ6RbcwgSWVohvYMIrkep41 GRNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h+MC8kK4zWQiBOS9TmUZzl813e7Kce9jFI4colJBhao=; b=7V7VIr579IlF45qEjZ+c/9EfqM8KjbuFkwFO3jBxivHPVaDeL/DkSLRq9Vv2zC/UDU /bttlC7r0137PcXMayFiBkW2S/VIkNn21lKbSF+A7t0F+yAkJbdMVcyQG2saRS6qBbnL F9aLIrvJyuL/PTjmxdp/12h5YjFPAE2kihaR6BvmZLRkIcJ/BBphZ+o9PLyMD2adiBNA 4e7R9T2iEPHRbdoZo9jdS2LJfW6rPaXfJg42BSVU4Oq9XDzpfLRxTjG/xLXPMgx0A4lc I9s/NYuo2ek0jbYFNizrKmDuhqoJu5Neutg2TEDuZLVop6qjAW8aS0FedOEyeqiH91Ht aE0Q== X-Gm-Message-State: ACrzQf2rz9VmLSaVBKlBLz3q3g/w5soxZlnNBPmmyPJQXRLv8V0jnnK5 ToWPQ77MTHgOPUvUnFuwkPVZeA== X-Google-Smtp-Source: AMsMyM4XDFAXZNyMtBoTJ07WXs5ANJcqdCknrHoZzRGrPrQdaq9x5LBRX5LsVLVT4RaHWxBqe5ZMeA== X-Received: by 2002:aa7:c1d9:0:b0:463:aeaf:3383 with SMTP id d25-20020aa7c1d9000000b00463aeaf3383mr16737337edp.253.1667505117553; Thu, 03 Nov 2022 12:51:57 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id j1-20020a17090623e100b007030c97ae62sm847433ejg.191.2022.11.03.12.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:51:57 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 1/6] iommu: Export iommu_group_default_domain() API Date: Thu, 3 Nov 2022 20:51:49 +0100 Message-Id: <20221103195154.21495-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org iommu_group_default_domain() may be needed for module users. E.g. exynos-iommu driver is using it right now, and it's going to be converted to a module soon. Signed-off-by: Sam Protsenko --- Changes in v2: - (none) drivers/iommu/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 6ca377f4fbf9..006a65411a28 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1675,6 +1675,7 @@ struct iommu_domain *iommu_group_default_domain(struct iommu_group *group) { return group->default_domain; } +EXPORT_SYMBOL_GPL(iommu_group_default_domain); static int probe_iommu_group(struct device *dev, void *data) { From patchwork Thu Nov 3 19:51:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030955 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BC21C43217 for ; Thu, 3 Nov 2022 19:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229560AbiKCTwE (ORCPT ); Thu, 3 Nov 2022 15:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiKCTwC (ORCPT ); Thu, 3 Nov 2022 15:52:02 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E7D120185 for ; Thu, 3 Nov 2022 12:52:00 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id v27so4717862eda.1 for ; Thu, 03 Nov 2022 12:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C88yKCopssymOAMe7KHFSlCl2Lylr4sF9uZV7UHC95E=; b=JNnSWiaLPu25KnAyCNpaAD7Ly2+4NcVx1V6Eugxf+ijwsUjrFE9ecgyeuEgPFSEyxz FKf4DWokPxTymvXIRFJCPn0ZpWILr52tu/S0yEzdyMAff5tTSxtHw8Z8xhoPjTDU9tfD bBq9y1xE4YfD8UQu5ZFgRhYzuUzOytWCb9pbu4MovgFkctkLmV/L9dBwQ8vu1/YzszeC qDTCvEwTaxg5dBDp0D1xq8KrSAN8FLdNejgZRNeJu2qKXC7eNNhAdG7mQpbpyk3hnWKF BkgxrumY+6mwjvxtqef2jQAZ7+SHEv/MoZgYdsJWgK7ZznhFuWS87Nv3WmzoQd6o3Z4b Nx5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C88yKCopssymOAMe7KHFSlCl2Lylr4sF9uZV7UHC95E=; b=XSaS1N++czXNhK2KqdEDyNqVgGZk+1QX2IKIK10FISFc9B2nnmIKhWRYK8Pn0KbAe7 rCRCaYuAJqw1TdW6HW8qJMs2pFyboF3SRKOzdmx50td90biRUfEYitSVQz1aKS8yXATY Grj81H0M8EjBt7tGq6ed/+Pcv+DzdXxOJGDGBW1LWtaglpKLnmAFWnccgJPnuLUxnvaM REbIslJVLRihtLlVhQwUndIdS725fC9bYNz3BUYXBC9H9r0rfSodJrKI2olMtHrbGeEk zXoUJHGQjmYi0C4T6ewZM7g3fPRC1kaeSC9JsP95+tMsP5x+WGCiFTgLZXkIVv6SrGEv UPfg== X-Gm-Message-State: ACrzQf1DskOynn8V1x7CljD0etZGUCqAbfZcwP5hSubYpLLaHZ5RHEJ8 kzmJyRiCixJJ6MXwpzOj6q5ykA== X-Google-Smtp-Source: AMsMyM6Y55R2EylxgpVkhefZzzu5RD8DbeFh1wK3GdXxJzvb2ejuoWCID5I4EuKnM999UShBLermFA== X-Received: by 2002:aa7:de0a:0:b0:462:d2a0:93a with SMTP id h10-20020aa7de0a000000b00462d2a0093amr30786059edv.275.1667505119162; Thu, 03 Nov 2022 12:51:59 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id tz14-20020a170907c78e00b0078ddb518a90sm834227ejc.223.2022.11.03.12.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:51:58 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 2/6] iommu/exynos: Fix retval on getting clocks in probe Date: Thu, 3 Nov 2022 20:51:50 +0100 Message-Id: <20221103195154.21495-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org checkpatch reports next warning for clock getting code in probe function: WARNING: ENOSYS means 'invalid syscall nr' and nothing else Replace it with -ENOINT to make checkpatch happy. Signed-off-by: Sam Protsenko Acked-by: Krzysztof Kozlowski --- Changes in v2: - (none) drivers/iommu/exynos-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 45fd4850bacb..0d150b383d04 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -689,7 +689,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) if (!data->clk && (!data->aclk || !data->pclk)) { dev_err(dev, "Failed to get device clock(s)!\n"); - return -ENOSYS; + return -ENOENT; } data->clk_master = devm_clk_get(dev, "master"); From patchwork Thu Nov 3 19:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030956 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BEA1C433FE for ; Thu, 3 Nov 2022 19:52:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbiKCTwG (ORCPT ); Thu, 3 Nov 2022 15:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbiKCTwE (ORCPT ); Thu, 3 Nov 2022 15:52:04 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC16201A8 for ; Thu, 3 Nov 2022 12:52:02 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id r14so4683011edc.7 for ; Thu, 03 Nov 2022 12:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aXCO9a7x2xoJr3hX2LIdzuSb2rVW3qJQzBsWlbB8ZK0=; b=nQGsSI60wh19jmS5rh2BuaBTcb5URMCprPZR1Qt20h8IGzb8IM4pplEyq6DQ3Q+n0C h5qaEV3zI/t4vLs0Je8PEyDomt+aBsAELhfOyIdRwQBWKObdhTH3xshRT9xXWpIwrTjW l5TryGbITzNYIzK155TRxE63/dj/a/V9XNmyzurtcNFQs5g6emh1Mp2+GdixLYxcuJNU hrOdEkVQM6OG83HiAUYRvmpIgGmU8Msf9q5a6Kti8Fnah1eeJ5JWaQgmgO+n2dgM1PIP Uq2NJ6bEBBQFVVXElJ10vvwkVK4BE96g5CeDj+Ro58KWu7BsrOA/CqM/hHL9mbNNkYTP cJkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aXCO9a7x2xoJr3hX2LIdzuSb2rVW3qJQzBsWlbB8ZK0=; b=Vucesr3b4JnP5RyGmgz6DEW3jiUSkWQKAtEABwj++aSIdWlO43S2ppeDIX6Y2mIQL/ zg0dM7ysLbe0QCU/jRC1rwsAJpVU/4cpPZOG2YeZFBrvMW4xCcEnvMCMtnidxIB/IbmM dsbshtKdU31x/AsI48hTe7S79sC+9AJGOKKvfq85wo5Eot+B1C+ab6QNcWp7oeeLEmsQ JUM2kygMKRjuaymyFFDCJAhbNayeBi20JWTfXUEhL5jD6N69MwZhFQt1KHZARFvsJKNX FJaMZ0dBORb6FjZVVG4mL/Qql/aOJX2GSK0Kr3vLEKNEkuHGCk9Dy883Yl5TNt7kCT6K g/WQ== X-Gm-Message-State: ACrzQf0MBweUvd02OTxKqRDZzQxB8q/S8jh519q01dTf+nZCUbQQKetq cjMIf79WD8c1UFBfizaJWKf61w== X-Google-Smtp-Source: AMsMyM6GuGLXLDhRmMnsQt0YiPv3zTLETFhVFIZP2Bap/XDV65f5mB5C1KHbKH7MNTJRJt+lwpbmlA== X-Received: by 2002:a05:6402:440f:b0:45d:297b:c70a with SMTP id y15-20020a056402440f00b0045d297bc70amr31990965eda.187.1667505121017; Thu, 03 Nov 2022 12:52:01 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id g16-20020a170906539000b007ad98918743sm880137ejo.1.2022.11.03.12.52.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:52:00 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 3/6] iommu/exynos: Modularize the driver Date: Thu, 3 Nov 2022 20:51:51 +0100 Message-Id: <20221103195154.21495-4-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Rework the driver so it can be built as a loadable module. That can be useful as not all ARM64 platforms need it. And that's ok for it to be a module because it's not a critical driver (platform can work when it's disabled). Remove method and module exit function are not implemented, as the removal of IOMMUs cannot be done reliably. As Robin Murphy mentioned in [1]: ...it's better not to even pretend that removing an IOMMU's driver while other drivers are using it (usually via DMA ops without even realising) is going to have anything other than catastrophic results. [1] https://lore.kernel.org/lkml/20220702213724.3949-2-semen.protsenko@linaro.org/T/#md7e1e3f5b2c9e7fa5bc28fe33e818b6aa4a7237c Signed-off-by: Sam Protsenko Acked-by: Krzysztof Kozlowski --- Changes in v2: - Add MODULE_DEVICE_TABLE(of, ...) to support hot-plug loading - Add MODULE_ALIAS() line - Extracted "shutdown" driver method adding into a separate patch drivers/iommu/Kconfig | 2 +- drivers/iommu/exynos-iommu.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index dc5f7a156ff5..6f7055606679 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -259,7 +259,7 @@ config TEGRA_IOMMU_SMMU SoCs (Tegra30 up to Tegra210). config EXYNOS_IOMMU - bool "Exynos IOMMU Support" + tristate "Exynos IOMMU Support" depends on ARCH_EXYNOS || COMPILE_TEST depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes select IOMMU_API diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 0d150b383d04..aad845677bda 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -798,8 +799,9 @@ static const struct of_device_id sysmmu_of_match[] = { { .compatible = "samsung,exynos-sysmmu", }, { }, }; +MODULE_DEVICE_TABLE(of, sysmmu_of_match); -static struct platform_driver exynos_sysmmu_driver __refdata = { +static struct platform_driver exynos_sysmmu_driver = { .probe = exynos_sysmmu_probe, .driver = { .name = "exynos-sysmmu", @@ -1404,6 +1406,7 @@ static const struct iommu_ops exynos_iommu_ops = { .release_device = exynos_iommu_release_device, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, .of_xlate = exynos_iommu_of_xlate, + .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = exynos_iommu_attach_device, .detach_dev = exynos_iommu_detach_device, @@ -1454,3 +1457,7 @@ static int __init exynos_iommu_init(void) return ret; } core_initcall(exynos_iommu_init); + +MODULE_DESCRIPTION("IOMMU driver for Exynos SoCs"); +MODULE_ALIAS("platform:exynos-sysmmu"); +MODULE_LICENSE("GPL"); From patchwork Thu Nov 3 19:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030957 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5748C4332F for ; Thu, 3 Nov 2022 19:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiKCTwH (ORCPT ); Thu, 3 Nov 2022 15:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbiKCTwE (ORCPT ); Thu, 3 Nov 2022 15:52:04 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE45520341 for ; Thu, 3 Nov 2022 12:52:02 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id v27so4718008eda.1 for ; Thu, 03 Nov 2022 12:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8GteW77xtmVFSxJeOH5lkPz2xCnVHhXZ4689sF4PXr4=; b=XS+nYmWGxVzp8b3+Ikv2y44FFDaFheYgYIbiPVlgn49mfTqtgEsOyaHPJ3r/p5B3tt Nt5dBpQKml2iwalKxnRphnFIG/LSj40LX/DzeEwbsW5Dg19uBCqt/dPpJ2mM/QlxNP0t ViMsoPF0uR0Y3DKOyO063X/SvB/Y+eaqBrfHolnwX/6pjNtDDh3k1wIWEqvSHb7fE5B7 BIhEjckfBLuXmH/TBcTQHGLPIYq+oavrnSOxXg6z7utaTTQs+wYLNmcNTZ/7g3YeuT0q LHdaXBVv5HYmGiczZ9CUEcLy03QRnuty4MISIWcoLtHL7iaGIIQ20TYEJGlpEADAFiA4 Gw+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8GteW77xtmVFSxJeOH5lkPz2xCnVHhXZ4689sF4PXr4=; b=IJsVC2WinUqCy5rDTfZ8NCSuXZcH/mJVVv/QLs3uZIXvhxc9lDLKt3SRA1nBgO5j4G jHz3sEMmuEtU1X43BDvjswWLpIYVcUPRx53nYebSv5rGn4svYEZo/zb1dSpdZzzgtewh mET6FrwB6W/453+Djkxuu4YogLXXSH6zWcV4Yw4h0jzErwMdx29uNLmigcCUo65H7Hr/ SibVstMA4/PsXAHByQJ1QMk1NmUa+0cxFuLLRlfz5PhyRRtQhr0L98wblvUJ2lqnmVvp +rTXTQM6HFpCgvsDNYRgTE64q87pOk5IWNOFswrPwEUDgcarQ6nr3HcNr/LyyMJA/MPc O9Qw== X-Gm-Message-State: ACrzQf2EfHEnj9EHjolIb/CrWDK/KYZSVtSAUsdgFfmRllrmXp009pM2 xbGFacmzxizgM2U6Hp99ImfmUQ== X-Google-Smtp-Source: AMsMyM4DNEi7YFpsAkwoRPewFN1jOqD6yNDTR6Aqxrw0T9uOy1Ku99Cu3zusUZikSVaqJSi9fToi2A== X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr31567406edb.238.1667505122589; Thu, 03 Nov 2022 12:52:02 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id m4-20020a1709062b8400b0078c213ad441sm864087ejg.101.2022.11.03.12.52.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:52:02 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 4/6] iommu/exynos: Implement shutdown driver method Date: Thu, 3 Nov 2022 20:51:52 +0100 Message-Id: <20221103195154.21495-5-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org While remove method shouldn't be implemented, as it can't be done reliably, the shutdown method can be useful for performing a kexec. That was inspired by other IOMMU drivers, see commit 1a4e90f25b2c ("iommu/rockchip: Perform a reset on shutdown") for example. Signed-off-by: Sam Protsenko Acked-by: Krzysztof Kozlowski --- Changes in v2: - New patch drivers/iommu/exynos-iommu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index aad845677bda..cd3f74e638f0 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -753,6 +753,16 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) return ret; } +static void exynos_sysmmu_shutdown(struct platform_device *pdev) +{ + struct sysmmu_drvdata *data = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + int irq = platform_get_irq(pdev, 0); + + devm_free_irq(dev, irq, data); + pm_runtime_force_suspend(dev); +} + static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) { struct sysmmu_drvdata *data = dev_get_drvdata(dev); @@ -803,6 +813,7 @@ MODULE_DEVICE_TABLE(of, sysmmu_of_match); static struct platform_driver exynos_sysmmu_driver = { .probe = exynos_sysmmu_probe, + .shutdown = exynos_sysmmu_shutdown, .driver = { .name = "exynos-sysmmu", .of_match_table = sysmmu_of_match, From patchwork Thu Nov 3 19:51:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030959 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEDA3C4332F for ; Thu, 3 Nov 2022 19:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231197AbiKCTwT (ORCPT ); Thu, 3 Nov 2022 15:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiKCTwI (ORCPT ); Thu, 3 Nov 2022 15:52:08 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B995020185 for ; Thu, 3 Nov 2022 12:52:05 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ud5so8204209ejc.4 for ; Thu, 03 Nov 2022 12:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9AClRHYQmmiljK9Z1RfiVXUSaeI4B4a5JMw83y2hLjc=; b=I+yQTuz7Ehdp6gLmvTSiRfW8d7safqQgm6xFo5ffNjn2ymI6ele5uztQfdKB4w4of1 yrdAXb+n5lMSvHrXuRCJOJd+gH8sXRbJpxlOgvSiFHqDtwIDsxml9RVmYOg+GFT8gTrS YTmIBlFiJlnYK8RaSHjXa6bKk3jKG0F1eTZEaQDfUMHldgm3Tt2pxx8HelUqTLOmRBbA uqONeXXZErQ2pmSgLWy+3iRhMLG+GvxowruU7JdfgPlA7i5d3zK1FlR146IqWScRjSN8 Si36SZHhp0LSKvd4jiiwjucmqr3vgbhiGYOGK+03e6QnliPU18z+4wy1nkIopXZtEI/O 05eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9AClRHYQmmiljK9Z1RfiVXUSaeI4B4a5JMw83y2hLjc=; b=4LV7R1vkjjOorK1ig+Yrf7Np19UDyW11bZJ6MnHD747itQXyH6u2KoZY8VrCJ3p5JJ Gi/vPJcpnyxDUjXFM3fQwe7LWkVtU5vwzAcHfkMSXFTXvZJwJcscaM7xJwxf1hyTwnEI qJYm8TNopzI6RFsyHNYospKWLX0XU9yPetxZ7EVco5q6iUPmjPLT92RRj591sfznyYqV 00dX4vPd+SNMKycA8rnJ++u+MLvkCN/7GMBQMpMrwmtQ2lRSD6lGkEa4yme0A/i+dYrK 5PI3+2Fu5GiT5da9z+ZOBJjDIQJCX5ITa5YuQ+aRplJVJvUOA07tyONlImzn6xk6bGrM fcZg== X-Gm-Message-State: ACrzQf0VF2CnELu5MtOqRvtNDL46sfDlz5Kk91nSgh0AzOJLGRMN6v/l yYNaicxwS5V/ujhPSaYHCEpQcw== X-Google-Smtp-Source: AMsMyM6J5RCvHZ4nfAKpAsy44oTqJ0eAdadZ1UgP4V2W93kLu/WbhZUuA/LB4sy2MA3T1iCYEwidFA== X-Received: by 2002:a17:907:3f26:b0:78d:9c30:4529 with SMTP id hq38-20020a1709073f2600b0078d9c304529mr30510256ejc.195.1667505124242; Thu, 03 Nov 2022 12:52:04 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id br26-20020a170906d15a00b0072af4af2f46sm872441ejb.74.2022.11.03.12.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:52:03 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 5/6] iommu/exynos: Rearrange the platform driver code Date: Thu, 3 Nov 2022 20:51:53 +0100 Message-Id: <20221103195154.21495-6-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Move the platform_driver code to the bottom of the driver, as it's a canonical form for that. No functional change. Signed-off-by: Sam Protsenko Acked-by: Krzysztof Kozlowski --- Changes in v2: - Fixed checkpatch style suggestion with "--strict" flag drivers/iommu/exynos-iommu.c | 361 +++++++++++++++++------------------ 1 file changed, 180 insertions(+), 181 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index cd3f74e638f0..c995cf8294cf 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -641,187 +641,6 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data, spin_unlock_irqrestore(&data->lock, flags); } -static const struct iommu_ops exynos_iommu_ops; - -static int exynos_sysmmu_probe(struct platform_device *pdev) -{ - int irq, ret; - struct device *dev = &pdev->dev; - struct sysmmu_drvdata *data; - struct resource *res; - - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - data->sfrbase = devm_ioremap_resource(dev, res); - if (IS_ERR(data->sfrbase)) - return PTR_ERR(data->sfrbase); - - irq = platform_get_irq(pdev, 0); - if (irq <= 0) - return irq; - - ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0, - dev_name(dev), data); - if (ret) { - dev_err(dev, "Unabled to register handler of irq %d\n", irq); - return ret; - } - - data->clk = devm_clk_get(dev, "sysmmu"); - if (PTR_ERR(data->clk) == -ENOENT) - data->clk = NULL; - else if (IS_ERR(data->clk)) - return PTR_ERR(data->clk); - - data->aclk = devm_clk_get(dev, "aclk"); - if (PTR_ERR(data->aclk) == -ENOENT) - data->aclk = NULL; - else if (IS_ERR(data->aclk)) - return PTR_ERR(data->aclk); - - data->pclk = devm_clk_get(dev, "pclk"); - if (PTR_ERR(data->pclk) == -ENOENT) - data->pclk = NULL; - else if (IS_ERR(data->pclk)) - return PTR_ERR(data->pclk); - - if (!data->clk && (!data->aclk || !data->pclk)) { - dev_err(dev, "Failed to get device clock(s)!\n"); - return -ENOENT; - } - - data->clk_master = devm_clk_get(dev, "master"); - if (PTR_ERR(data->clk_master) == -ENOENT) - data->clk_master = NULL; - else if (IS_ERR(data->clk_master)) - return PTR_ERR(data->clk_master); - - data->sysmmu = dev; - spin_lock_init(&data->lock); - - __sysmmu_get_version(data); - - ret = iommu_device_sysfs_add(&data->iommu, &pdev->dev, NULL, - dev_name(data->sysmmu)); - if (ret) - return ret; - - ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev); - if (ret) - goto err_iommu_register; - - platform_set_drvdata(pdev, data); - - if (PG_ENT_SHIFT < 0) { - if (MMU_MAJ_VER(data->version) < 5) { - PG_ENT_SHIFT = SYSMMU_PG_ENT_SHIFT; - LV1_PROT = SYSMMU_LV1_PROT; - LV2_PROT = SYSMMU_LV2_PROT; - } else { - PG_ENT_SHIFT = SYSMMU_V5_PG_ENT_SHIFT; - LV1_PROT = SYSMMU_V5_LV1_PROT; - LV2_PROT = SYSMMU_V5_LV2_PROT; - } - } - - if (MMU_MAJ_VER(data->version) >= 5) { - ret = dma_set_mask(dev, DMA_BIT_MASK(36)); - if (ret) { - dev_err(dev, "Unable to set DMA mask: %d\n", ret); - goto err_dma_set_mask; - } - } - - /* - * use the first registered sysmmu device for performing - * dma mapping operations on iommu page tables (cpu cache flush) - */ - if (!dma_dev) - dma_dev = &pdev->dev; - - pm_runtime_enable(dev); - - return 0; - -err_dma_set_mask: - iommu_device_unregister(&data->iommu); -err_iommu_register: - iommu_device_sysfs_remove(&data->iommu); - return ret; -} - -static void exynos_sysmmu_shutdown(struct platform_device *pdev) -{ - struct sysmmu_drvdata *data = platform_get_drvdata(pdev); - struct device *dev = &pdev->dev; - int irq = platform_get_irq(pdev, 0); - - devm_free_irq(dev, irq, data); - pm_runtime_force_suspend(dev); -} - -static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) -{ - struct sysmmu_drvdata *data = dev_get_drvdata(dev); - struct device *master = data->master; - - if (master) { - struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); - - mutex_lock(&owner->rpm_lock); - if (data->domain) { - dev_dbg(data->sysmmu, "saving state\n"); - __sysmmu_disable(data); - } - mutex_unlock(&owner->rpm_lock); - } - return 0; -} - -static int __maybe_unused exynos_sysmmu_resume(struct device *dev) -{ - struct sysmmu_drvdata *data = dev_get_drvdata(dev); - struct device *master = data->master; - - if (master) { - struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); - - mutex_lock(&owner->rpm_lock); - if (data->domain) { - dev_dbg(data->sysmmu, "restoring state\n"); - __sysmmu_enable(data); - } - mutex_unlock(&owner->rpm_lock); - } - return 0; -} - -static const struct dev_pm_ops sysmmu_pm_ops = { - SET_RUNTIME_PM_OPS(exynos_sysmmu_suspend, exynos_sysmmu_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) -}; - -static const struct of_device_id sysmmu_of_match[] = { - { .compatible = "samsung,exynos-sysmmu", }, - { }, -}; -MODULE_DEVICE_TABLE(of, sysmmu_of_match); - -static struct platform_driver exynos_sysmmu_driver = { - .probe = exynos_sysmmu_probe, - .shutdown = exynos_sysmmu_shutdown, - .driver = { - .name = "exynos-sysmmu", - .of_match_table = sysmmu_of_match, - .pm = &sysmmu_pm_ops, - .suppress_bind_attrs = true, - } -}; - static inline void exynos_iommu_set_pte(sysmmu_pte_t *ent, sysmmu_pte_t val) { dma_sync_single_for_cpu(dma_dev, virt_to_phys(ent), sizeof(*ent), @@ -1428,6 +1247,185 @@ static const struct iommu_ops exynos_iommu_ops = { } }; +static int exynos_sysmmu_probe(struct platform_device *pdev) +{ + int irq, ret; + struct device *dev = &pdev->dev; + struct sysmmu_drvdata *data; + struct resource *res; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + data->sfrbase = devm_ioremap_resource(dev, res); + if (IS_ERR(data->sfrbase)) + return PTR_ERR(data->sfrbase); + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return irq; + + ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0, dev_name(dev), + data); + if (ret) { + dev_err(dev, "Unabled to register handler of irq %d\n", irq); + return ret; + } + + data->clk = devm_clk_get(dev, "sysmmu"); + if (PTR_ERR(data->clk) == -ENOENT) + data->clk = NULL; + else if (IS_ERR(data->clk)) + return PTR_ERR(data->clk); + + data->aclk = devm_clk_get(dev, "aclk"); + if (PTR_ERR(data->aclk) == -ENOENT) + data->aclk = NULL; + else if (IS_ERR(data->aclk)) + return PTR_ERR(data->aclk); + + data->pclk = devm_clk_get(dev, "pclk"); + if (PTR_ERR(data->pclk) == -ENOENT) + data->pclk = NULL; + else if (IS_ERR(data->pclk)) + return PTR_ERR(data->pclk); + + if (!data->clk && (!data->aclk || !data->pclk)) { + dev_err(dev, "Failed to get device clock(s)!\n"); + return -ENOENT; + } + + data->clk_master = devm_clk_get(dev, "master"); + if (PTR_ERR(data->clk_master) == -ENOENT) + data->clk_master = NULL; + else if (IS_ERR(data->clk_master)) + return PTR_ERR(data->clk_master); + + data->sysmmu = dev; + spin_lock_init(&data->lock); + + __sysmmu_get_version(data); + + ret = iommu_device_sysfs_add(&data->iommu, &pdev->dev, NULL, + dev_name(data->sysmmu)); + if (ret) + return ret; + + ret = iommu_device_register(&data->iommu, &exynos_iommu_ops, dev); + if (ret) + goto err_iommu_register; + + platform_set_drvdata(pdev, data); + + if (PG_ENT_SHIFT < 0) { + if (MMU_MAJ_VER(data->version) < 5) { + PG_ENT_SHIFT = SYSMMU_PG_ENT_SHIFT; + LV1_PROT = SYSMMU_LV1_PROT; + LV2_PROT = SYSMMU_LV2_PROT; + } else { + PG_ENT_SHIFT = SYSMMU_V5_PG_ENT_SHIFT; + LV1_PROT = SYSMMU_V5_LV1_PROT; + LV2_PROT = SYSMMU_V5_LV2_PROT; + } + } + + if (MMU_MAJ_VER(data->version) >= 5) { + ret = dma_set_mask(dev, DMA_BIT_MASK(36)); + if (ret) { + dev_err(dev, "Unable to set DMA mask: %d\n", ret); + goto err_dma_set_mask; + } + } + + /* + * use the first registered sysmmu device for performing + * dma mapping operations on iommu page tables (cpu cache flush) + */ + if (!dma_dev) + dma_dev = &pdev->dev; + + pm_runtime_enable(dev); + + return 0; + +err_dma_set_mask: + iommu_device_unregister(&data->iommu); +err_iommu_register: + iommu_device_sysfs_remove(&data->iommu); + return ret; +} + +static void exynos_sysmmu_shutdown(struct platform_device *pdev) +{ + struct sysmmu_drvdata *data = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + int irq = platform_get_irq(pdev, 0); + + devm_free_irq(dev, irq, data); + pm_runtime_force_suspend(dev); +} + +static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) +{ + struct sysmmu_drvdata *data = dev_get_drvdata(dev); + struct device *master = data->master; + + if (master) { + struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); + + mutex_lock(&owner->rpm_lock); + if (data->domain) { + dev_dbg(data->sysmmu, "saving state\n"); + __sysmmu_disable(data); + } + mutex_unlock(&owner->rpm_lock); + } + return 0; +} + +static int __maybe_unused exynos_sysmmu_resume(struct device *dev) +{ + struct sysmmu_drvdata *data = dev_get_drvdata(dev); + struct device *master = data->master; + + if (master) { + struct exynos_iommu_owner *owner = dev_iommu_priv_get(master); + + mutex_lock(&owner->rpm_lock); + if (data->domain) { + dev_dbg(data->sysmmu, "restoring state\n"); + __sysmmu_enable(data); + } + mutex_unlock(&owner->rpm_lock); + } + return 0; +} + +static const struct dev_pm_ops sysmmu_pm_ops = { + SET_RUNTIME_PM_OPS(exynos_sysmmu_suspend, exynos_sysmmu_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) +}; + +static const struct of_device_id sysmmu_of_match[] = { + { .compatible = "samsung,exynos-sysmmu", }, + { }, +}; +MODULE_DEVICE_TABLE(of, sysmmu_of_match); + +static struct platform_driver exynos_sysmmu_driver = { + .probe = exynos_sysmmu_probe, + .shutdown = exynos_sysmmu_shutdown, + .driver = { + .name = "exynos-sysmmu", + .of_match_table = sysmmu_of_match, + .pm = &sysmmu_pm_ops, + .suppress_bind_attrs = true, + } +}; + static int __init exynos_iommu_init(void) { struct device_node *np; @@ -1461,6 +1459,7 @@ static int __init exynos_iommu_init(void) } return 0; + err_zero_lv2: platform_driver_unregister(&exynos_sysmmu_driver); err_reg_driver: From patchwork Thu Nov 3 19:51:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 13030958 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9FF2C43217 for ; Thu, 3 Nov 2022 19:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbiKCTwK (ORCPT ); Thu, 3 Nov 2022 15:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbiKCTwI (ORCPT ); Thu, 3 Nov 2022 15:52:08 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35DF520369 for ; Thu, 3 Nov 2022 12:52:06 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id r14so4683270edc.7 for ; Thu, 03 Nov 2022 12:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oVK/kV0R0vkenb2LDbscFxA0X0dByuia1tz97ff80yM=; b=yjqdzBc5QkyWO8tIOpyy1HtXjyZWn0cIpOjMTkb96S3bxh24aATJ8xyBB1R/B77CcN NObHEXqX95u/z65/XPcAc2WpVxQKcNaxILUDOynzEmr1ML60iu9C07+LqmPtznkychUZ U9kL90pOsziktU0wt5b2868dOA9QSFgj2X/BX+G6yE/NYEQYIYBP/r/DhrDopUiHidb2 c39d5XT8elagWGepDKVNz/nymSi2onmOLUbPW85gTrTHZd6MnqlK+lVA2WT/cxSGl82j l9XHJYIoXhBrnlmf27/QcKjQSI8RtSLMN87uzifXjW670JH8PGoZxwEFBkTmWPyXeMLy F8Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oVK/kV0R0vkenb2LDbscFxA0X0dByuia1tz97ff80yM=; b=zXu4fNJ4qASUIUm3Gc/V/be2l02tj8IsLgTuOSr0K/ZVD8PHLc7yqTot+eGhzIU7Qf 62QPcsl90P7mig7kGB7hOcNSIyZh4dzuxxqYBqQnco5M6mCTGroToN4dQnsKnJLm5oEt fkvFa+4O/HvS9XJug+3xrl+T+ex6DXMwVpH2+nGiXGOG8wesi6fKlurh5HZ967/TAHyi O1dtIfAjKZK9/GEKXKKzXPhspGCURpIlDT6xVwewgchhiXiBV8+JBOHRMHgEhrV/ovxi qdQUbliWsaoyLHBTCK7iYvhGVuUQpB4FNB/0usdJ0EXOd7GqZnAUGJ48ks6IIKfC/KvU g86w== X-Gm-Message-State: ACrzQf1iJQ7pyPQYKatpYW3OwSRZI4yPy0JYg63pdY9k13/tMO8MQv7F +PXGenGuXf/bZ5aTry1/lrDRdQ== X-Google-Smtp-Source: AMsMyM7ofQ+KeORNK7Xlf3qp7IJQwgQUB3P6e82hsOfsUmArPfMzYSqz5U1Wsk/ERagunutF5X6Uqg== X-Received: by 2002:a05:6402:1c0a:b0:463:3cda:3750 with SMTP id ck10-20020a0564021c0a00b004633cda3750mr26374259edb.341.1667505125822; Thu, 03 Nov 2022 12:52:05 -0700 (PDT) Received: from localhost (cgw.msart-bajzova4.ke.cust.o2bs.sk. [90.176.4.227]) by smtp.gmail.com with ESMTPSA id n19-20020a170906165300b0078907275a44sm863484ejd.42.2022.11.03.12.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 12:52:05 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Sumit Semwal , Alim Akhtar , Janghyuck Kim , Cho KyongHo , Daniel Mentz , David Virag , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 6/6] media: platform: Use IS_ENABLED() to check EXYNOS_IOMMU in s5p_mfc Date: Thu, 3 Nov 2022 20:51:54 +0100 Message-Id: <20221103195154.21495-7-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221103195154.21495-1-semen.protsenko@linaro.org> References: <20221103195154.21495-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Now that CONFIG_EXYNOS_IOMMU can be built as a module, it's not correct anymore to check whether it's enabled or not just with #ifdef. Use proper IS_ENABLED() macro to handle both built-in and module cases. Signed-off-by: Sam Protsenko Acked-by: Krzysztof Kozlowski --- Changes in v2: - New patch drivers/media/platform/samsung/s5p-mfc/s5p_mfc_iommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_iommu.h b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_iommu.h index 1a32266b7ddc..a8b48692d128 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_iommu.h +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_iommu.h @@ -7,7 +7,9 @@ #ifndef S5P_MFC_IOMMU_H_ #define S5P_MFC_IOMMU_H_ -#if defined(CONFIG_EXYNOS_IOMMU) +#include + +#if IS_ENABLED(CONFIG_EXYNOS_IOMMU) #include