From patchwork Thu Jun 29 17:40:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nate Watterson X-Patchwork-Id: 9817499 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36CB86020A for ; Thu, 29 Jun 2017 17:45:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2617D289A9 for ; Thu, 29 Jun 2017 17:45:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 192B0289B2; Thu, 29 Jun 2017 17:45:32 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F99A289A9 for ; Thu, 29 Jun 2017 17:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=gfNzO8CEP6vz6Hd3uyvfPzGsirThKSTbWLtPW+JBLNw=; b=l/X TlG8J4JVFBam2cn6UeNcyqXp/tEDhzQuSBtJx6jAGf0bJJlNaFrKtxxrXOR9I1JBJ4EIEPuoDWPjj BzGT6wgsMwr3TVZtd9ijdecYEmHWYS70z4XcUyd04jzirzyB3ip9pSwM4o92Wcmo+qo/vwj6mV3ND RdPY9iCS5KAombVVqs/3KoSy4TdzADbglJ8uR+NO32CPB5nGOlA1s7dZ11ZYYhbHehOXz2OAzU+1p zPcyjsm7u1tekD+rcwJBPQKByvN93bTr/eMZgsPuRnDn4kN3bUO+ltBDdMzCE1s47/0k0P6mVZ690 Wrw/jnzwFJr5wRPNYJIbcP0v5PmNmmw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dQdVL-0000Ve-Uw; Thu, 29 Jun 2017 17:45:23 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dQdVI-0007fH-Am for linux-arm-kernel@lists.infradead.org; Thu, 29 Jun 2017 17:45:21 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A40A260DDF; Thu, 29 Jun 2017 17:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498758299; bh=A+NBOAaUBaw+/DrhBZOFBb2BXGnyfCdgy7PVmQSSeX8=; h=From:To:Cc:Subject:Date:From; b=dHXQl1DK57E0CWdxBrZwuzsY+txQ/77zLzTkNOx3JytHnoV5R/siztlfYoY2RPo+W AN16NkPmuLgKYQX5dKJqnSdBTQOZYdcr1dpj6Vj/Xt0nfStSQiszeLQZwWhdK5NlTY prFwrNEkXZc4HohpSykVrqCc9TwuJkmMGcGPx6I8= Received: from ssd-mint172.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: nwatters@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 46CA460715; Thu, 29 Jun 2017 17:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498758299; bh=A+NBOAaUBaw+/DrhBZOFBb2BXGnyfCdgy7PVmQSSeX8=; h=From:To:Cc:Subject:Date:From; b=dHXQl1DK57E0CWdxBrZwuzsY+txQ/77zLzTkNOx3JytHnoV5R/siztlfYoY2RPo+W AN16NkPmuLgKYQX5dKJqnSdBTQOZYdcr1dpj6Vj/Xt0nfStSQiszeLQZwWhdK5NlTY prFwrNEkXZc4HohpSykVrqCc9TwuJkmMGcGPx6I8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 46CA460715 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=nwatters@codeaurora.org From: Nate Watterson To: Will Deacon , Robin Murphy , Joerg Roedel , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] iommu/arm-smmu-v3: Implement shutdown method Date: Thu, 29 Jun 2017 13:40:15 -0400 Message-Id: <1498758015-7072-1-git-send-email-nwatters@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170629_104520_436764_4D3700E0 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nate Watterson MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The shutdown method disables the SMMU and its interrupts to avoid potentially corrupting a new kernel started with kexec. Signed-off-by: Nate Watterson --- drivers/iommu/arm-smmu-v3.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 380969a..907d576 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2765,9 +2765,19 @@ static int arm_smmu_device_remove(struct platform_device *pdev) struct arm_smmu_device *smmu = platform_get_drvdata(pdev); arm_smmu_device_disable(smmu); + + /* Disable IRQs */ + arm_smmu_write_reg_sync(smmu, 0, ARM_SMMU_IRQ_CTRL, + ARM_SMMU_IRQ_CTRLACK); + return 0; } +static void arm_smmu_device_shutdown(struct platform_device *pdev) +{ + arm_smmu_device_remove(pdev); +} + static struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v3", }, { }, @@ -2781,6 +2791,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev) }, .probe = arm_smmu_device_probe, .remove = arm_smmu_device_remove, + .shutdown = arm_smmu_device_shutdown, }; module_platform_driver(arm_smmu_driver);