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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 41F5CC32792 for ; Thu, 3 Oct 2019 16:35:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 164A520830 for ; Thu, 3 Oct 2019 16:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120547; bh=nXQIQUChDQTJepmXhuT4OoVw16fDzfRJkyUABc3APIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rciPvJPdJS1HPiJCmwI3zg2TAJ1tgRZLbjwKVPWdY58b5vldtrvg/exwVDF4K30fS bDMR9dqOCAShBn0rgWMSkzwNyUQylvOrFd8O3A4QXgWoLy/Eh3lK4NZs9oChjVUwLA ZvOtdAQPsj2fTpjUE4zcxV+qwNOENKgue+0BS87c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404318AbfJCQfq (ORCPT ); Thu, 3 Oct 2019 12:35:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:44586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404284AbfJCQfi (ORCPT ); Thu, 3 Oct 2019 12:35:38 -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 692412070B; Thu, 3 Oct 2019 16:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120537; bh=nXQIQUChDQTJepmXhuT4OoVw16fDzfRJkyUABc3APIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lQ1BPX3xVY0pD7RpBslwtIv6pJ4wz7NrB2Hs6cRHceR+2CS3WOPxr+q/X7GSEwci0 +NRYA0kuJvJeeIgo5RZ5dI5BP5C4dPQ6lHpC93ZepldOImAD7j+gON+1uNSLl35rNx 1oJB7JC/7HT5wjS4WLw/dLapFZSE2LSTW2awN7iA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , David Woodhouse , Joerg Roedel , Jacob Pan , Nadav Amit , Joerg Roedel Subject: [PATCH 5.2 260/313] iommu/vt-d: Fix wrong analysis whether devices share the same bus Date: Thu, 3 Oct 2019 17:53:58 +0200 Message-Id: <20191003154558.642942460@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@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 From: Nadav Amit commit 2c70010867f164d1b30e787e360e05d10cc40046 upstream. set_msi_sid_cb() is used to determine whether device aliases share the same bus, but it can provide false indications that aliases use the same bus when in fact they do not. The reason is that set_msi_sid_cb() assumes that pdev is fixed, while actually pci_for_each_dma_alias() can call fn() when pdev is set to a subordinate device. As a result, running an VM on ESX with VT-d emulation enabled can results in the log warning such as: DMAR: [INTR-REMAP] Request device [00:11.0] fault index 3b [fault reason 38] Blocked an interrupt request due to source-id verification failure This seems to cause additional ata errors such as: ata3.00: qc timeout (cmd 0xa1) ata3.00: failed to IDENTIFY (I/O error, err_mask=0x4) These timeouts also cause boot to be much longer and other errors. Fix it by checking comparing the alias with the previous one instead. Fixes: 3f0c625c6ae71 ("iommu/vt-d: Allow interrupts from the entire bus for aliased devices") Cc: stable@vger.kernel.org Cc: Logan Gunthorpe Cc: David Woodhouse Cc: Joerg Roedel Cc: Jacob Pan Signed-off-by: Nadav Amit Reviewed-by: Logan Gunthorpe Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/intel_irq_remapping.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -376,13 +376,13 @@ static int set_msi_sid_cb(struct pci_dev { struct set_msi_sid_data *data = opaque; + if (data->count == 0 || PCI_BUS_NUM(alias) == PCI_BUS_NUM(data->alias)) + data->busmatch_count++; + data->pdev = pdev; data->alias = alias; data->count++; - if (PCI_BUS_NUM(alias) == pdev->bus->number) - data->busmatch_count++; - return 0; }