From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753378AbbFAMBQ (ORCPT ); Mon, 1 Jun 2015 08:01:16 -0400 Received: from 8bytes.org ([81.169.241.247]:50925 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932101AbbFAMBF (ORCPT ); Mon, 1 Jun 2015 08:01:05 -0400 Date: Mon, 1 Jun 2015 14:01:03 +0200 From: Joerg Roedel To: Baoquan He Cc: linux-kernel@vger.kernel.org Subject: Re: A question about state machine function state_next() Message-ID: <20150601120103.GF20384@8bytes.org> References: <20150601030940.GK6353@dhcp-128-28.nay.redhat.com> <20150601064238.GC20384@8bytes.org> <20150601090902.GA31271@dhcp-128-28.nay.redhat.com> <20150601092124.GD20384@8bytes.org> <20150601111802.GD31271@dhcp-128-28.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150601111802.GD31271@dhcp-128-28.nay.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 01, 2015 at 07:18:02PM +0800, Baoquan He wrote: > Checked the code again, it may be a code bug if this is done in > device_dma_ops_init(). Since this is called in > amd_iommu_init_dma_ops()<-amd_iommu_init_dma(). And amd_iommu_init_dma() > is only called in case IOMMU_INTERRUPTS_EN code block. According to the > code flow if I understand correctly, it can't be here at boot stage. > state_next() will change the state according to the calling times. And > in amd iommu only four times to call iommu_go_to_state, it can't go to > IOMMU_PCI_INIT and the after cases. > > I am not sure if my understanding is correct, or I missed something. You probably missed the loop in iommu_go_to_state() which will call state_next() until it reaches either the requested state or an error state. Joerg