Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbeAQItF (ORCPT + 1 other); Wed, 17 Jan 2018 03:49:05 -0500 Received: from regular1.263xmail.com ([211.150.99.131]:55019 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752324AbeAQItC (ORCPT ); Wed, 17 Jan 2018 03:49:02 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: tfiga@chromium.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Message-ID: <5A5F0DEE.9030508@rock-chips.com> Date: Wed, 17 Jan 2018 16:48:46 +0800 From: JeffyChen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Tomasz Figa CC: linux-kernel@vger.kernel.org, Ricky Liang , Robin Murphy , simon xue , Heiko Stuebner , "open list:ARM/Rockchip SoC..." , "list@263.net:IOMMU DRIVERS" , Joerg Roedel , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 12/13] iommu/rockchip: Add runtime PM support References: <20180116132540.18939-1-jeffy.chen@rock-chips.com> <20180116132540.18939-13-jeffy.chen@rock-chips.com> <5A5EFAB2.7040001@rock-chips.com> <5A5F00D1.5010506@rock-chips.com> In-Reply-To: <5A5F00D1.5010506@rock-chips.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Tomasz, On 01/17/2018 03:52 PM, JeffyChen wrote: > Hi Tomasz, > > On 01/17/2018 03:38 PM, Tomasz Figa wrote: >>>> >>Don't we need to check here (and in _shutdown() too) if we have a >>>> >>domain attached? >>> > >>> >hmmm, right, the startup might been called by resume, so should check >>> >iommu->domain here. >>> > >>> >but the shutdown would be called at the end of detach or suspend, it >>> could >>> >be not attached or attached. >> If startup might be called by resume, without domain attached, what >> prevents shutdown from being called by suspend after that resume, >> still without domain attached? Is it guaranteed that if resume is >> called, someone will attach a domain before suspend is called? >> > no, the shutdown would be called by: > 1/ end of detach_dev > so it would be not attached at that time > > 2/ suspend > so it could be attached, and also could be not attached > > > anyway, i think the shutdown would work without domain attached(just > disable paging and clear the iommu bases) ;) > hmmm, i see the problem. so we need to: 1/ move shutdown a little earlier in detach_dev, so it could still see the iommu->domain 2/ check iommu->domain in shutdown, to prevent unnecessary shutdown or maybe just add iommu->domain check in suspend and resume. >> Best regards, >> Tomasz >> >> >> >