Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp884563yba; Thu, 18 Apr 2019 11:10:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiHkEksNjN0JJaBZoB6t/cL/ujgby3r9x1igWV1/TNwVg8PmQLczeKQ1i8g2bC8w1UVKtz X-Received: by 2002:a17:902:442:: with SMTP id 60mr97925624ple.107.1555611044046; Thu, 18 Apr 2019 11:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611044; cv=none; d=google.com; s=arc-20160816; b=R4K/6N4auZ2lD7Zme21KTIBgb/8wOS4p4FTLW5RA+ZWsS/4C8tpltX750pDXuXif6H WsN4UmMYQJtLp5LSsbIQb+ue0zU8AWcTN4KRV9j+rZTnrRtOOuTbLaWRIIjmvDwSkmRB ujwd0KmQmI7STBUmYTFjcn0GzNjuJJYiiMuQMSQm0Fg/2y3kEwCx6W6+M4wmYj2aMPWU FFJu6R+b50IAJ4AECkFnEF4e+We4spxDRBUOjt2FV9o47T2elcGB1AzCdLBBVQIhRUk2 KTQj2mq3vqsJYkNYrkxxLTVMetBKzJJTjGuP4nhtdWQJGXFiAnHpgIvA9B7ExRG9IHEk CqqA== 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=vVIsPirkDGYEcTFW5RUMSbl2F4RxgKKV74O+JwQT0UQ=; b=Ba4HfNac5Lef2bXZBdAFtgq0Wh+Vli2dOXXEOE9uMaS3166bDBZ3SMi3Gja1A6ibiJ 4rNSsmDMjSDV3yifVOaYL1i7YQQ8vyvescJ5djJ5BF5Rs1lCs/jE2gnXXEw9dSuiHKRz xGDjm73eWQHbImXM0V6jeQ8aqSfpjZllz+ObUgItIo/9bNUmlwr8fMe8L/f761bbcUfq KOWNwyopoB1G67TOG3fgv/dV0F6r5suWfPjQ0IfYrK8vx80rRy1rTdZSlzKFNj96Wn9g uCZdJdK9bG8GyEejxLusQKvJwNxsaZNl98GS0IQUDlf8ui66B1Pn2iXKxiDzVEgvfBYo b9zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DTUwsRjo; 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 b91si2775147plb.426.2019.04.18.11.10.28; Thu, 18 Apr 2019 11:10:44 -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=DTUwsRjo; 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 S2391438AbfDRSIn (ORCPT + 99 others); Thu, 18 Apr 2019 14:08:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:39956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391291AbfDRSIl (ORCPT ); Thu, 18 Apr 2019 14:08:41 -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 338632186A; Thu, 18 Apr 2019 18:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610920; bh=Hen+TTSEe0XSwNuPPVwf/vSjZrHh+340oHQeEFOLcjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTUwsRjoouDPt7Ves0UZJElXP6V56/jVuQNGXbr8d4jDSLB1qSnusfSFT8YgDkeu5 ms/0/R0qrE/5LNcYWOc077GJEzPCrvnoWB2cgqRrV68dwSer3ygm73iHI0Ii1abeTQ t8PNG6r3ilJZa7pGOE7sNAamPLZfnFMvZ/fiDtXo= 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 4.9 24/50] iommu/vt-d: Check capability before disabling protected memory Date: Thu, 18 Apr 2019 19:57:35 +0200 Message-Id: <20190418160425.651753798@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@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 86e349614e21..28feb1744710 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1636,6 +1636,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