From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751253AbbFALSM (ORCPT ); Mon, 1 Jun 2015 07:18:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6604 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbbFALSG (ORCPT ); Mon, 1 Jun 2015 07:18:06 -0400 Date: Mon, 1 Jun 2015 19:18:02 +0800 From: Baoquan He To: Joerg Roedel Cc: linux-kernel@vger.kernel.org Subject: Re: A question about state machine function state_next() Message-ID: <20150601111802.GD31271@dhcp-128-28.nay.redhat.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150601092124.GD20384@8bytes.org> 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 06/01/15 at 11:21am, Joerg Roedel wrote: > Hi Baoquan, > > On Mon, Jun 01, 2015 at 05:09:02PM +0800, Baoquan He wrote: > > Then I am wondering how amd_iommu_dma_ops is assigned. Maybe I need > > check all functions more clearly. > > The AMD IOMMU driver only uses per-device dma_ops. They are assigned to > each device in device_dma_ops_init() at boot and in the > device_change_notifier() on hotplug events. 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. Thanks Baoquan > > > > Actually I am investigating how to port Zhenhua's kdump fix for intel > > iommu to amd iommu since the similar bug happened on systems with amd > > iommu. If you don't mind I can make these clean up during I understand > > these iommu codes. And if Zhenhua plan to post patch for amd fix, I > > can help review and test. Otherwise I can make some research and try > > to post a draft patch. > > Thanks for looking into this. Unfortunatly this somehow conflicts with > my recent default-domain patch-set, which moves functionality into the > IOMMU core and converts the AMD driver to make use of it. I have no real > idea yet how to make both work, but it shouldn't be too hard. Maybe you can > have a look into that patch-set too? > > > Joerg >