From patchwork Wed Feb 16 05:01:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Lane X-Patchwork-Id: 1593379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=av40zHYY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jz5RG1DXdz9s0r for ; Wed, 16 Feb 2022 16:02:01 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nKCRq-00043Z-Ba; Wed, 16 Feb 2022 05:01:50 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nKCRn-00043G-Km for kernel-team@lists.ubuntu.com; Wed, 16 Feb 2022 05:01:47 +0000 Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 62DBB3F1B1 for ; Wed, 16 Feb 2022 05:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1644987707; bh=yjNssa+wHhZI5GjzVIyaOzci4bgZyddFK0nG2D+E8AQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=av40zHYYTWjItza1bvyIK8eCkDbHCj+afJnBriNv23O4RB/3hqjtcs5VynE6qmyQ/ EVMLhY3mqWKS8k4PHHP7c5TDXAbq9S+iSp5K9cfeLCIPRqCkRbt9Jl3lfHWrHPuB9o pfcUs9DBjaX+g1T8tNKrqgvZcG5ktxqs9uj1mFrv9P17CARCdjiOXxwT0Hg7gnSRyj RQ3x4bOwrOrtk6ZNTxpRLivkIQgDbt89TakmyXGo2cN5eYvt1hrsXIPOt08MwGOeXz UyiTDC2EmGr7WkNMsovphy/dYdeR4XWlXLwZuzlsfZ7iA7IghH4MBlzJG7zyqPv3+F GoaTdcHXrfl4w== Received: by mail-qt1-f200.google.com with SMTP id s1-20020ac85ec1000000b002cf7c93d56dso711137qtx.21 for ; Tue, 15 Feb 2022 21:01:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yjNssa+wHhZI5GjzVIyaOzci4bgZyddFK0nG2D+E8AQ=; b=hzdywngfkejSSdUgm7rvvoxUY4iDTU0pZO5Nu8Bqe+3xA3Bk+AW8H7IAWhELbUkpdD AwfuzRL9ouu/TQ6XhmOwxB7cpM3OGuiqQxtVzJcojcfeM6MV8xecRZOo0XakqwEDGGH4 38X4JnMNQzr5pwu/qn34a6h9LXksmhs9MHThMr82+0ayr+tZ5VKPkVBB1WT73AYZYMes Ipfphxcw3/ycGMNeNsiav+Ev/K+rPOS8c11vC4uDBg3PKG3QZWKApsyULF/0wP1Vtd+s OTpMsQko6p2L2xxX1a4RtPgHjU8vNh6Q8CMBXu7SgGyUgVvWlZioM4pBxIniBcyugMr3 lbjA== X-Gm-Message-State: AOAM532RrKq8gsgVdVht/6u3qciWuVW6TjV0666SSz18bTQEHSqC8AL+ XeIzggNE4F/eJgIEWgYmRtaAqGxZxnTJyvCqJeiJJka/BYL/Eo4BdKGbi7cnOt/+dp2KRWeGn6m IdAb3uX5Zwp9BIy+Xn3n8/pLqrHTMl09SXlAcl1spXg== X-Received: by 2002:a0c:ffa3:0:b0:42c:35ee:6d33 with SMTP id d3-20020a0cffa3000000b0042c35ee6d33mr757586qvv.77.1644987705998; Tue, 15 Feb 2022 21:01:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwO76+ajOb8boloG/iljJ5B2norshaZngBrCb6VUAkkVY0Rqgs7Okptyv/fnM8YP8OjxFIGdw== X-Received: by 2002:a0c:ffa3:0:b0:42c:35ee:6d33 with SMTP id d3-20020a0cffa3000000b0042c35ee6d33mr757571qvv.77.1644987705611; Tue, 15 Feb 2022 21:01:45 -0800 (PST) Received: from localhost.localdomain ([71.217.161.186]) by smtp.gmail.com with ESMTPSA id u9sm13082655qko.130.2022.02.15.21.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 21:01:45 -0800 (PST) From: Jeff Lane To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU Date: Wed, 16 Feb 2022 00:01:40 -0500 Message-Id: <20220216050140.426720-2-jeffrey.lane@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216050140.426720-1-jeffrey.lane@canonical.com> References: <20220216050140.426720-1-jeffrey.lane@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jeff@ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Adrian Huang BugLink: https://bugs.launchpad.net/bugs/1937295 When enabling VMD in BIOS setup (Ice Lake Processor: Whitley platform), the host OS cannot boot successfully with the following error message: nvme nvme0: I/O 12 QID 0 timeout, completion polled nvme nvme0: Shutdown timeout set to 6 seconds DMAR: DRHD: handling fault status reg 2 DMAR: [INTR-REMAP] Request device [0x00:0x00.5] fault index 0xa00 [fault reason 0x25] Blocked a compatibility format interrupt request The request device is the VMD controller: # lspci -s 0000:00.5 -nn 0000:00:00.5 RAID bus controller [0104]: Intel Corporation Volume Management Device NVMe RAID Controller [8086:28c0] (rev 04) `git bisect` points to this offending commit ee81ee84f873 ("PCI: vmd: Disable MSI-X remapping when possible"), which disables VMD MSI remapping. The IOMMU hardware blocks the compatibility format interrupt request because Interrupt Remapping Enable Status (IRES) and Extended Interrupt Mode Enable (EIME) are enabled. Please refer to section "5.1.4 Interrupt-Remapping Hardware Operation" in Intel VT-d spec. To fix the issue, VMD driver still enables the interrupt remapping irrespective of VMD_FEAT_CAN_BYPASS_MSI_REMAP if the IOMMU subsystem enables the interrupt remapping. Test configuration is shown as follows: * Two VMD controllers 1. 8086:28c0 (Whitley's VMD) 2. 8086:201d (Purley's VMD: The issue does not appear in this controller. Just make sure if any side effect occurs.) * w/wo intremap=off Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=214219 Link: https://lore.kernel.org/r/20210901124047.1615-1-adrianhuang0701@gmail.com Signed-off-by: Adrian Huang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Jon Derrick Cc: Jon Derrick Cc: Nirmal Patel Cc: Joerg Roedel (cherry picked from commit 2565e5b69c44b4e42469afea3cc5a97e74d1ed45) Signed-off-by: Jeff Lane Acked-by: Krzysztof Kozlowski --- drivers/pci/controller/vmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 274e42e967f6..1441ed746eaf 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -776,7 +777,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) * acceptable because the guest is usually CPU-limited and MSI * remapping doesn't become a performance bottleneck. */ - if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || + if (iommu_capable(vmd->dev->dev.bus, IOMMU_CAP_INTR_REMAP) || + !(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || offset[0] || offset[1]) { ret = vmd_alloc_irqs(vmd); if (ret)