From patchwork Mon Apr 23 11:45:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xie Yisheng X-Patchwork-Id: 10356881 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 B09D5601D3 for ; Mon, 23 Apr 2018 11:57:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F49C26E1A for ; Mon, 23 Apr 2018 11:57:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93CA92808F; Mon, 23 Apr 2018 11:57:50 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 1B6AF26E1A for ; Mon, 23 Apr 2018 11:57:49 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=8C8p+tAHcyN+f6EzzGc4hAGIZWrGdhqabNKhjRw7t4E=; b=FQvxrtNXCCHIf+ 5AFnlLpo9Fn1Se0iEGOeFHJblLvsQmary1PWU/IQi9ZsNsUpgUxjULkkCVGVuC/wozwegJ79Fp88e wS0X6RFsjbqvaeWmBONrqlzFYnoW41mmiCRI4KRGYaPr9kcrDmOYYTZe4vghyRFgowZwJ37J91aEW mCOu+gUS6sRSLX79pE30EvCPSaobJOc9+yk28L8vbTro2SIMAkR6RZed1HrNJxWtIBsmzXvuT0JGf 8Hv1cVxGkh5c8VYAHC40rJ3y9gmrH2b3QPVanF/eVpr8uXsjHjJXJcb20mQVxIT5IUlZGZsXm/e65 NP1pr5nIEvR6LemfJCHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAa6G-0002LL-9P; Mon, 23 Apr 2018 11:57:40 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fAa5W-0001zq-Kx for linux-arm-kernel@lists.infradead.org; Mon, 23 Apr 2018 11:56:56 +0000 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 41E44E1B3F2C7; Mon, 23 Apr 2018 19:56:24 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Mon, 23 Apr 2018 19:56:16 +0800 From: Yisheng Xie To: , , Subject: [RFC 1/2] iommu/arm-smmu-v3: Remove bypass in arm_smmu_reset_device Date: Mon, 23 Apr 2018 19:45:58 +0800 Message-ID: <1524483959-54940-2-git-send-email-xieyisheng1@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1524483959-54940-1-git-send-email-xieyisheng1@huawei.com> References: <1524483959-54940-1-git-send-email-xieyisheng1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180423_045654_886184_28097E9F X-CRM114-Status: GOOD ( 11.60 ) 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: Yisheng Xie , liubo95@huawei.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, dingtianhong@huawei.com, linux-arm-kernel@lists.infradead.org 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 Add a bypass parameter in arm_smmu_device to keep whether smmu device should pypass or not, so parameter bypass in arm_smmu_reset_device can be removed. This should not have any functional change, but prepare for later patch. Signed-off-by: Yisheng Xie --- drivers/iommu/arm-smmu-v3.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 1d64710..044df6e 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -587,6 +587,8 @@ struct arm_smmu_device { u32 sync_count; + bool bypass; + /* IOMMU core code handle */ struct iommu_device iommu; }; @@ -2384,7 +2386,7 @@ static int arm_smmu_device_disable(struct arm_smmu_device *smmu) return ret; } -static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) +static int arm_smmu_device_reset(struct arm_smmu_device *smmu) { int ret; u32 reg, enables; @@ -2487,7 +2489,7 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass) /* Enable the SMMU interface, or ensure bypass */ - if (!bypass || disable_bypass) { + if (!smmu->bypass || disable_bypass) { enables |= CR0_SMMUEN; } else { ret = arm_smmu_update_gbpa(smmu, 0, GBPA_ABORT); @@ -2778,7 +2780,6 @@ static int arm_smmu_device_probe(struct platform_device *pdev) resource_size_t ioaddr; struct arm_smmu_device *smmu; struct device *dev = &pdev->dev; - bool bypass; smmu = devm_kzalloc(dev, sizeof(*smmu), GFP_KERNEL); if (!smmu) { @@ -2796,7 +2797,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) } /* Set bypass mode according to firmware probing result */ - bypass = !!ret; + smmu->bypass = !!ret; /* Base address */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -2842,7 +2843,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev) platform_set_drvdata(pdev, smmu); /* Reset the device */ - ret = arm_smmu_device_reset(smmu, bypass); + ret = arm_smmu_device_reset(smmu); if (ret) return ret;