From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71E07C43381 for ; Wed, 20 Mar 2019 20:19:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 455F02184D for ; Wed, 20 Mar 2019 20:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553113166; bh=e996L09GG+v46l2mReUaq3En97QpjilxbY5macD4XlU=; h=Subject:To:Cc:From:Date:List-ID:From; b=gcB1+f5dAuio6mro0AYfQuyp0pW7d7rEphvIKLcliLn9iwhzzOHJAiCvdgn0qf9UR IWqxi0fSEuOUo3V1HIOAziVCiKa7yQJPhtdkYbwcfm9ZY3343lV2dw3o7zuRB9M69S GZEx7OuBosh3HRrk3bby0zVHaOOa/Gnqt6TJdW6A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727404AbfCTUTZ (ORCPT ); Wed, 20 Mar 2019 16:19:25 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:35531 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726644AbfCTUTZ (ORCPT ); Wed, 20 Mar 2019 16:19:25 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id CFE9D23C50; Wed, 20 Mar 2019 16:19:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 20 Mar 2019 16:19:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=k0vGWY 4+IIylAbQPYoabWvkbiZp38t4Wd1nQOYi/Lfk=; b=nBgz365pV/vuLC/5tMWNMb mKlOqfCPx4/st13FMvdVZgO7nJvZhC777rSbT50fStUBqa8d2nH3z4EMV9SgDqMN CxyLvawTj9JzunI1Xtxqy6mfAkRypMiYQvZLr4UjHTqDq0+YINmo954tIGcfXY39 ClmA2UyrmAf12ZGZOcLAbmRwQpwRMbC8GENJNWfIo53DRSmanlkpjrM5p0YFzrjO IUQc/3ob2Moy6nkKqGJRP3lT0HQOe2P836kq6pYT/LkNud7SOym6FW9yr6qTRnhr loLfb+kVfrxVbgXKN8ctdJRIwP9zNGc/l+Swbayo0TLjj5iRVzqoZvz5uYRiA1GA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeigddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 28275102D0; Wed, 20 Mar 2019 16:19:24 -0400 (EDT) Subject: FAILED: patch "[PATCH] iommu/vt-d: Check identity map for hot-added devices" failed to apply to 3.18-stable tree To: baolu.lu@linux.intel.com, ashok.raj@intel.com, fenghua.yu@intel.com, jacob.jun.pan@linux.intel.com, jisben@google.com, jroedel@suse.de, xmdong@google.com Cc: From: Date: Wed, 20 Mar 2019 21:19:13 +0100 Message-ID: <15531131531051@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 3.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 117266fd59ddf46e98e36df09326d861738c6180 Mon Sep 17 00:00:00 2001 From: Lu Baolu Date: Mon, 25 Feb 2019 10:46:36 +0800 Subject: [PATCH] iommu/vt-d: Check identity map for hot-added devices The Intel IOMMU driver will put devices into a static identity mapped domain during boot if the kernel parameter "iommu=pt" is used. That means the IOMMU hardware will translate a DMA address into the same memory address. Unfortunately, hot-added devices are not subject to this. That results in some devices not working properly after hot added. A quick way to reproduce this issue is to boot a system with iommu=pt and, remove then readd the pci device with echo 1 > /sys/bus/pci/devices/[pci_source_id]/remove echo 1 > /sys/bus/pci/rescan You will find the identity mapped domain was replaced with a normal domain. Cc: Ashok Raj Cc: Jacob Pan Cc: Fenghua Yu Cc: stable@vger.kernel.org Reported-by: Jis Ben Signed-off-by: Lu Baolu Tested-by: James Dong Fixes: 99dcadede42f ('intel-iommu: Support PCIe hot-plug') Signed-off-by: Joerg Roedel diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 00f46021d690..c30b73d41bf2 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4567,16 +4567,19 @@ static int device_notifier(struct notifier_block *nb, if (iommu_dummy(dev)) return 0; - if (action != BUS_NOTIFY_REMOVED_DEVICE) - return 0; - - domain = find_domain(dev); - if (!domain) - return 0; + if (action == BUS_NOTIFY_REMOVED_DEVICE) { + domain = find_domain(dev); + if (!domain) + return 0; - dmar_remove_one_dev_info(dev); - if (!domain_type_is_vm_or_si(domain) && list_empty(&domain->devices)) - domain_exit(domain); + dmar_remove_one_dev_info(dev); + if (!domain_type_is_vm_or_si(domain) && + list_empty(&domain->devices)) + domain_exit(domain); + } else if (action == BUS_NOTIFY_ADD_DEVICE) { + if (iommu_should_identity_map(dev, 1)) + domain_add_dev_info(si_domain, dev); + } return 0; }