Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp888601yba; Thu, 18 Apr 2019 11:15:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZ+y84owCEZVtOcDTLpKZJrkKSflfqL3Q0nRpL9n0pc4d5ILWq6TXCFK+JZXMEYfJhIJ4L X-Received: by 2002:a63:f212:: with SMTP id v18mr87119299pgh.231.1555611300297; Thu, 18 Apr 2019 11:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611300; cv=none; d=google.com; s=arc-20160816; b=jqubA6zEt7FdQdoBKjGjDxI0ZHY0z+Zeip1kY9sBNHa5JSAS8zhsoEwwlQCLeLXy2j 00VHBx3E91W0WV2T/+b6zXeMf9+NmtREcfifgux+YqziQ8jjfXXB99719SSjUkOUxa4L RJ2KI1+ZRTeFehipeT9/oSc0x4KR0eXX0UAOrhOCzrTNzD3ymQ6rsg0YysLLY+zHTI8R iRoEeJD14YmK4TZSGROobMhkz1ExpsMf/NknQh5Rv4Azsdq6xj+buYLv2nCAPXb7f+/c pOFfeetbGDiaSpi68VEeLNturLCcGQpendRaI9QYcayeHBDVskmGn53zWwU3wkV47AcW 6S0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EonYLupmxHvjWULSBibZ9/Q5huHGt9VBL4AcZH6EMlY=; b=vLmwy99PElILD30ch7fd/nfbRTkGO65wuL5+xTMAd34ZJxqyCWdae3CJcQD6A7q+Rl yMlf5M96YqO3TRwoJW526kvhOI31yajr+Z99JXmYCz1DyTxeGg28lGxiQsh8YNK++Zbp E11cq9zE+bJE4pxpKSzU/Rw4p9IDwDvTdhu+4LHph2aktmy++xKWWk4TmOEegvLy9Yy/ GY3TJtIqTS1/ETC2MKWsPBe6O5I3HtS878+P8m6lj35Jehn2f9J/DQhDTeZEeTnzAvtA WaNuN76klvuDBAhZz95tzRiCd0Cw0HCsTagLvfpWN6/YQs0k+pogf+brS8duVw3m44hf fgRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XNrikkqG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si2856675pfh.162.2019.04.18.11.14.45; Thu, 18 Apr 2019 11:15:00 -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; dkim=pass header.i=@kernel.org header.s=default header.b=XNrikkqG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391962AbfDRSLu (ORCPT + 99 others); Thu, 18 Apr 2019 14:11:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:44110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390418AbfDRSLs (ORCPT ); Thu, 18 Apr 2019 14:11:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C26C20675; Thu, 18 Apr 2019 18:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611107; bh=CDm8xkbvK43nmag0DodTXsi2Wv2I9htfhsw0iT/voho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNrikkqGxKpXN2fyHKvkxL+VzNVRBZK86A3D6nnPUF98rvmGEH0ye88vUKl5xNi42 NQIxRBGNCX5l01DiwF6i0A+qCxnQYvcIZMg/BbmQVkxPHwXTevYTSQ3K+pSkkDYzy4 X2fOtP2XjU+u5FgtwzRauINj5g5YOPPhn5VxOU/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Pan , mark gross , Ashok Raj , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.0 60/93] iommu/vt-d: Check capability before disabling protected memory Date: Thu, 18 Apr 2019 19:57:38 +0200 Message-Id: <20190418160443.575619863@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5bb71fc790a88d063507dc5d445ab8b14e845591 ] The spec states in 10.4.16 that the Protected Memory Enable Register should be treated as read-only for implementations not supporting protected memory regions (PLMR and PHMR fields reported as Clear in the Capability register). Cc: Jacob Pan Cc: mark gross Suggested-by: Ashok Raj Fixes: f8bab73515ca5 ("intel-iommu: PMEN support") Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/intel-iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index dbd6824dfffa..68a21c49c562 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1534,6 +1534,9 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu) u32 pmen; unsigned long flags; + if (!cap_plmr(iommu->cap) && !cap_phmr(iommu->cap)) + return; + raw_spin_lock_irqsave(&iommu->register_lock, flags); pmen = readl(iommu->reg + DMAR_PMEN_REG); pmen &= ~DMA_PMEN_EPM; -- 2.19.1