Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751576AbdG0Pzy (ORCPT ); Thu, 27 Jul 2017 11:55:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:43681 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751113AbdG0Pzx (ORCPT ); Thu, 27 Jul 2017 11:55:53 -0400 Date: Thu, 27 Jul 2017 17:55:50 +0200 From: Joerg Roedel To: Baoquan He Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 10/13] iommu/amd: Allocate memory below 4G for dev table if translation pre-enabled Message-ID: <20170727155550.GO3610@suse.de> References: <1500627551-12930-1-git-send-email-bhe@redhat.com> <1500627551-12930-11-git-send-email-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1500627551-12930-11-git-send-email-bhe@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 750 Lines: 15 On Fri, Jul 21, 2017 at 04:59:08PM +0800, Baoquan He wrote: > AMD pointed out it's unsafe to update the device-table while iommu > is enabled. It turns out that device-table pointer update is split > up into two 32bit writes in the IOMMU hardware. So updating it while > the IOMMU is enabled could have some nasty side effects. > > The only way to work around this is to allocate the device-table below > 4GB if translation is pre-enabled in kdump kernel. If allocation failed, > still use the old one. Not only for the kdump kernel. The old device table must also be below 4GB so that its pointer can be updated with a 32bit write. If the old table is above 4GB you still need the second write to zero the upper parts of the pointer in hardware.