From patchwork Thu May 12 08:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1629995 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=nVgmPzyC; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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 4KzQ403BXvz9sFx for ; Thu, 12 May 2022 18:31:43 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1np4EO-0003hE-KP; Thu, 12 May 2022 08:31:32 +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 1np4EK-0003gJ-He for kernel-team@lists.ubuntu.com; Thu, 12 May 2022 08:31:28 +0000 Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.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 5C47F3F1B3 for ; Thu, 12 May 2022 08:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1652344288; bh=SZj+kD7F4KpLaIOt2ncBgpCraxDVjtnPp94iKwIDVpo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nVgmPzyCA2jQR/6nOta/eYdEKvqn4tdl+6MqOkpuI6njf+5Ih+cWN+iZ28fSRBbG/ hmFCOPMgCg+eWwIgtCkEICu+BBVcKwSfmIAsogMMaMQG7oObDjr5tkZ5CFOiE50WnP 0r7Y/0wIT7Ub1TZDRR3os9JlByDimUS54U8xRkFqbD9yeymZicg6/7odSR09ye2kz2 TweSqKRu77ptKnPem/14SWI6Em/kauFy8AzenHbyta5G96Z3EZwsAoYHKxxlgsAjOQ ht2akT5nxGT6uqRtXRq1/7zL/zl6tu3e+Br42f39ADGCac1NiyF41D2trvvutI5fnn zBGjqqXN2fUSw== Received: by mail-pg1-f200.google.com with SMTP id f7-20020a6547c7000000b003c600995546so2303779pgs.5 for ; Thu, 12 May 2022 01:31:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SZj+kD7F4KpLaIOt2ncBgpCraxDVjtnPp94iKwIDVpo=; b=uX6cm0/U4qOB/HpVOEL+PeINx94DK1Qyfv2LArQp520FWlx6vXOYFex2TugGrvJQw1 wQzpAdcwLltC+qiejCWIWfSX7Z7BrSrr8iQls9YeOYNM78mGI+zNb8H5Yhg/n3BeEMwO PPM0MJEBIwI2G9m8SG448eROTiY5mU+MrfLDPLDrDWlu8/3VBNwnaDVMni8a/Wmxp6Ig RTt9l8ldhWvKt3yk0qbXTfc8DWk/WqPTHVDBr3mkiogQQT2n+8xvrgW/NNLEDgrLkaOE AfRIz0oDuAXKcFz1jcIXNz/934/7x/oAHyTuZVq6Qa0vMmLXISlLX1nfb4HM0JY5KHG7 CBow== X-Gm-Message-State: AOAM5320roc9taZQ/K8XdTyezLSWznQj7xdVmSuyhtMMn4pCqCE+xSo7 T322NYfbeFMqqi7RCwJddsguyERFyOE3k5T16ha3kchEV/nq3KvesGVIOzshd5jcRirJrTAVQ98 picCjI4RtXGWPaOKIgr/i90XVC68aDK8eY23aop+yeQ== X-Received: by 2002:a65:6cc9:0:b0:399:26da:29af with SMTP id g9-20020a656cc9000000b0039926da29afmr24057015pgw.489.1652344286758; Thu, 12 May 2022 01:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+983Piu6mbztNI83C4SkYgkWLFrlehMSJl4womO4by8OLs0Vg42PV6DluHDwo2vVV48csPw== X-Received: by 2002:a65:6cc9:0:b0:399:26da:29af with SMTP id g9-20020a656cc9000000b0039926da29afmr24056998pgw.489.1652344286322; Thu, 12 May 2022 01:31:26 -0700 (PDT) Received: from canonical.com (2001-b011-3815-5664-8a19-ebc1-1fa2-edf3.dynamic-ip6.hinet.net. [2001:b011:3815:5664:8a19:ebc1:1fa2:edf3]) by smtp.gmail.com with ESMTPSA id n5-20020a170902e54500b0015e8d4eb2ebsm3325270plf.309.2022.05.12.01.31.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 01:31:25 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][SRU][OEM-5.14/OEM-5.17] PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU Date: Thu, 12 May 2022 16:31:20 +0800 Message-Id: <20220512083121.1271583-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220512083121.1271583-1-koba.ko@canonical.com> References: <20220512083121.1271583-1-koba.ko@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: , 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: Koba Ko --- 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 c9a1776d16c95..453c789fc38f5 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -725,7 +726,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)