Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1977011ybe; Tue, 3 Sep 2019 06:21:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJMxTgWXgfVzuByMJMBHFgtchRKk7v5tYKNSKsgO/unTInH0AurCjUTApnP8nQZ8pSQROj X-Received: by 2002:a65:65c5:: with SMTP id y5mr29791994pgv.342.1567516910695; Tue, 03 Sep 2019 06:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567516910; cv=none; d=google.com; s=arc-20160816; b=gM9LHAXsANVdGX9LgfnS+N1LADYMhXXQ8kiFTtLLEtfB2bQQ1nvWWi0ygYbW+LEx+3 FrESG8MnqwsSgQVkXwY+y2CLzwofDMyCgMTcYQl6iRbXZvtYumx9Aq4JejDknCmBW9i7 GSQqPAgLy3KqviLvRmKLW1mmKZaPp1jhPLikOwE5jLsT+dSVr3lPnSE5+/kb7cUkCyit BrZCJMavHz39LjNhpdNNvSEDCe9UmBuL4+dGC4apO1yhLvuqs3likOF77nuh0jhYOsFo Dsg2uGMFbSjUQD1CdqakCyhAlE8QoiiFI5D9dv2l214jKP872ZHDbfclC7OZ7Z32KvXA sqVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nW9V8hSZlRTShIcQpLtfMflDjHyk+uP9W1vX9l2GDHM=; b=Ynk8ThS0as6jWQ6MNfPSX/otP/Epi19lQaBBwRbUQkW9uubPWTQsnLqSuICOiUIl3a 9JNfkSOsY21GktsL4hAtlQjspDDSVi3VMYMa/uAOZL0d3coyQCHCIB9fcH1T5Ce3v8kP fHx9MvlaV4MG6aiiNhDHZ7U8L4e39nFl0BRmP4+9DAl+H0necLYUEDmNhtUBJZCbujaO ojO1dHOTKNnDcKms7yQ7GrhEeQHrdmxqITzu/r+NVQyMe/XUwmbdCMHqVUh99zKjtByj um6G7L/bln05/d3mA8ril6Lqso4T4/TucfrC57oDI3k8ymQnOp5zDeo9kp09S0TfzllU 6TvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si14540978pjt.51.2019.09.03.06.21.34; Tue, 03 Sep 2019 06:21:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729089AbfICNUl (ORCPT + 99 others); Tue, 3 Sep 2019 09:20:41 -0400 Received: from 8bytes.org ([81.169.241.247]:52978 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727005AbfICNUl (ORCPT ); Tue, 3 Sep 2019 09:20:41 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id B7FA5284; Tue, 3 Sep 2019 15:20:39 +0200 (CEST) Date: Tue, 3 Sep 2019 15:20:38 +0200 From: Joerg Roedel To: Stephen Rothwell Cc: "Lendacky, Thomas" , Thiago Jung Bauermann , Michael Ellerman , Linux Next Mailing List , Linux Kernel Mailing List Subject: [PATCH] iommu: Don't use sme_active() in generic code Message-ID: <20190903132038.GE11530@8bytes.org> References: <20190902163951.6280e030@canb.auug.org.au> <20190902140347.GA23482@8bytes.org> <20190903152849.770ae819@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190903152849.770ae819@canb.auug.org.au> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 03:28:49PM +1000, Stephen Rothwell wrote: > Hi all, > > On Mon, 2 Sep 2019 14:26:40 +0000 "Lendacky, Thomas" wrote: > > Maybe we should make this mem_encrypt_active(), since this will probably > > be needed if/when an IOMMU device is eventually added to a guest, and the > > referenced commit below doesn't remove that call. > > I have done that for today: Thanks Stephen and Tom. I queued the attached patch into the iommu tree to fix the problem. From 2896ba40d0becdb72b45f096cad70633abc014f6 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Tue, 3 Sep 2019 15:15:44 +0200 Subject: [PATCH] iommu: Don't use sme_active() in generic code Switch to the generic function mem_encrypt_active() because sme_active() is x86 specific and can't be called from generic code on other platforms than x86. Fixes: 2cc13bb4f59f ("iommu: Disable passthrough mode when SME is active") Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 66cfacaa483d..d658c7c6a2ab 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -120,8 +120,8 @@ static int __init iommu_subsys_init(void) else iommu_set_default_translated(false); - if (iommu_default_passthrough() && sme_active()) { - pr_info("SME detected - Disabling default IOMMU Passthrough\n"); + if (iommu_default_passthrough() && mem_encrypt_active()) { + pr_info("Memory encryption detected - Disabling default IOMMU Passthrough\n"); iommu_set_default_translated(false); } } -- 2.16.4