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: 15130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp736784wru; Thu, 3 Nov 2022 12:54:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fusqWJWRB14se8BIlMaxHBpVlnvkF1v4FOxqvqh9XRuU+mRx8XDn/jmPKwDp8TTpRYEvJ X-Received: by 2002:aa7:c04f:0:b0:457:1b08:d056 with SMTP id k15-20020aa7c04f000000b004571b08d056mr33129514edo.146.1667505266454; Thu, 03 Nov 2022 12:54:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667505266; cv=none; d=google.com; s=arc-20160816; b=U7tOerlQeQd0eiErZ6lS68UsuvdxMa2oy7LIcSYoJHVdP6ZrbI6q5P/w8zspnq6m0H Ta4xHvgpcDFdDouhoo/l2wZ1clEayw8kEnNLbYZe/YyNjuKYwRK4lAj3ve2E38c2Bh9P cU3Rki4cQfFOHWzk/Gwfuyftj1mBg7DTFw4QkupVXc8yQHWNHh1bSpvP+PW6FqKQloli bda7BvyPGkff99j3gl2liJFhVFdW6gPTL2HE00PAbKKRhlMKS3llCWfjyrobkAoLTbpK hjUaaQqcKpEIjVbEts/y9S8YonaUut/f1lZgu6RUezOXWiYgRfJ1klCCGWjCPgVvMSxr FtxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8GteW77xtmVFSxJeOH5lkPz2xCnVHhXZ4689sF4PXr4=; b=l+EswZLKOsLJPv4hTrZz0XjfrXuOT3trYUfpauCoM8bGrsWZdstgi6Yd0D7FNl2z9h nsu7De/6nPASRNC+WcP/qS1WQlaRg5tyFJikBvINApT5lEtMHjPRLPrKZMJPyAcZs2wK OkT8ZOwqEgxQ0n/hoiGW0uhbpgZeuLzzEkECt5laq00S2oY/Y+6u76jmoG0rNzQVb5Yo k1VoFtlwPaGZ6FgJJVooXCMwDswge/sQiIERkpG5DI/B5KfLFSqOCGcopA5RsTl2N6kZ RCtM10FNOEKqZL85XEc54id5UOFTzvmWdvZpcWNizZ17AJiiqMunRCTv8U2VzkrEw7EH vo9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XS+nYmWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170907914300b0078de51e1c3dsi1732686ejs.840.2022.11.03.12.54.02; Thu, 03 Nov 2022 12:54:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XS+nYmWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231130AbiKCTwQ (ORCPT + 99 others); Thu, 3 Nov 2022 15:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbiKCTwF (ORCPT ); Thu, 3 Nov 2022 15:52:05 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076ED20358 for ; Thu, 3 Nov 2022 12:52:03 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id x2so4712022edd.2 for ; Thu, 03 Nov 2022 12:52:03 -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=zxPkt69izCMPtW2SBv1j1YQgCdun4bi0tZOFN+nimSq+nc6/3P+5MBufXEfN87d8l4 1xtD2RLPy4q3lujJxjQlBXPfSrkz7uq4Mzg/2zfEMhDi/13mgVuzlzjhiwQhsTDUv/S0 W4oWZrurS8Mix/4TA2yw1IJY9Hsef/cr7H989owwc5sbJe0WLV1MyF1VtDmIEHZTB1oD 2zIw9vvv1gaDgxZYPZt75M81ytJwiSJSfkiGk2c4mQCxxVOwL5JUTNOWjKGXrbIFTQ7q vaeEfxTDcC5fmvPGiF919UppH9AeDCRmM8AKZQ05PuBjJfrC+Njf5Nd9ZP5DLlZVyoJ+ sVww== X-Gm-Message-State: ACrzQf0dXLpvVy3rdRLqRa1ifTkXK2/kjsXIEWx7YgttQoBeYeoAqy5q ECJNaWddl9FKu4HUtjCyy2Q4VA== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748506002301655567?= X-GMAIL-MSGID: =?utf-8?q?1748506002301655567?= 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,