From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbdF1Jgk (ORCPT ); Wed, 28 Jun 2017 05:36:40 -0400 Received: from 8bytes.org ([81.169.241.247]:46988 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491AbdF1Jgb (ORCPT ); Wed, 28 Jun 2017 05:36:31 -0400 Date: Wed, 28 Jun 2017 11:36:27 +0200 From: Joerg Roedel To: Tom Lendacky Cc: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, xen-devel@lists.xen.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Brijesh Singh , Toshimitsu Kani , Radim =?utf-8?B?S3LEjW3DocWZ?= , Matt Fleming , Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , Jonathan Corbet , "Michael S. Tsirkin" , Ingo Molnar , Andrey Ryabinin , Dave Young , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Borislav Petkov , Andy Lutomirski , Boris Ostrovsky , Dmitry Vyukov , Juergen Gross , Thomas Gleixner , Paolo Bonzini Subject: Re: [PATCH v8 RESEND 27/38] iommu/amd: Allow the AMD IOMMU to work with memory encryption Message-ID: <20170628093627.GD14532@8bytes.org> References: <20170627150718.17428.81813.stgit@tlendack-t1.amdoffice.net> <20170627151230.17428.75281.stgit@tlendack-t1.amdoffice.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170627151230.17428.75281.stgit@tlendack-t1.amdoffice.net> 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 Hi Tom, On Tue, Jun 27, 2017 at 10:12:30AM -0500, Tom Lendacky wrote: > --- > drivers/iommu/amd_iommu.c | 30 ++++++++++++++++-------------- > drivers/iommu/amd_iommu_init.c | 34 ++++++++++++++++++++++++++++------ > drivers/iommu/amd_iommu_proto.h | 10 ++++++++++ > drivers/iommu/amd_iommu_types.h | 2 +- > 4 files changed, 55 insertions(+), 21 deletions(-) Looks like a straightforward change. Just one nit below. > +static bool amd_iommu_supports_sme(void) > +{ > + if (!sme_active() || (boot_cpu_data.x86 != 0x17)) > + return true; > + > + /* For Fam17h, a specific level of support is required */ > + if (boot_cpu_data.microcode >= 0x08001205) > + return true; > + > + if ((boot_cpu_data.microcode >= 0x08001126) && > + (boot_cpu_data.microcode <= 0x080011ff)) > + return true; > + > + pr_notice("AMD-Vi: IOMMU not currently supported when SME is active\n"); > + > + return false; > +} The name of the function is misleading. It checks whether the IOMMU can be enabled when SME is active. But the name suggests that it checks whether the iommu hardware supports SME. How about renaming it to amd_iommu_sme_check()? With that change the patch is: Acked-by: Joerg Roedel