From patchwork Wed Mar 20 20:22:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Druzhinin X-Patchwork-Id: 10862597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4B7E1575 for ; Wed, 20 Mar 2019 20:24:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBE3B2969F for ; Wed, 20 Mar 2019 20:24:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF6B0298A1; Wed, 20 Mar 2019 20:24:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88C0429E87 for ; Wed, 20 Mar 2019 20:24:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6hj1-0002Iy-3u; Wed, 20 Mar 2019 20:22:11 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6hiz-0002It-TB for xen-devel@lists.xenproject.org; Wed, 20 Mar 2019 20:22:09 +0000 X-Inumbo-ID: d5a4fbee-4b4d-11e9-bc90-bc764e045a96 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id d5a4fbee-4b4d-11e9-bc90-bc764e045a96; Wed, 20 Mar 2019 20:22:08 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,249,1549929600"; d="scan'208";a="81180862" From: Igor Druzhinin To: Date: Wed, 20 Mar 2019 20:22:03 +0000 Message-ID: <1553113323-14664-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] VT-d/DMAR: accept DRHD with non-discoverable PCI devices X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Igor Druzhinin , kevin.tian@intel.com, sstabellini@kernel.org, wei.liu2@citrix.com, konrad.wilk@oracle.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, julien.grall@arm.com, jbeulich@suse.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since commit dcf41790 ("x86/mmcfg/drhd: Move acpi_mmcfg_init() call before calling acpi_parse_dmar()") PCI segment 0 is now known early which made the sanity check on DRHD definition structure to work. This, in turn, caused a regression on some machines (in particular, HP PowerEdge R740 with I/O AT DMA disabled) where IOMMU was explicitly disabled due to some internal PCI devices being non-discoverable but present in DMAR. While this is indeed a BIOS mistake it seems to be not that critical to disable the whole IOMMU. Instead, extend the scope of "workaround_bios_bug" option and make it enabled by default. This is consistent with our documentation and actually what a user might expect from an option with that name. It also doesn't seem safe to simply ignore DRHD without initialization so remove this case. But leave the original DMAR check in place to still allow error reporting. Signed-off-by: Igor Druzhinin --- docs/misc/xen-command-line.pandoc | 2 +- xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/vtd/dmar.c | 25 ++++++------------------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc index b0b6300..9413354 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1261,7 +1261,7 @@ The following options are specific to Intel VT-d hardware: similar to Linux's `intel_iommu=igfx_off` option. If specifying `no-igfx` fixes anything, please report the problem. -* The `workaround_bios_bug` boolean is disabled by default. It can be used +* The `workaround_bios_bug` boolean is enabled by default. It can be used to ignore errors when parsing the ACPI tables, and finding a listed PCI device which doesn't appear to exist in the system. diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 5ecaa10..de3a9eb 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -30,7 +30,7 @@ bool_t __initdata iommu_enable = 1; bool_t __read_mostly iommu_enabled; bool_t __read_mostly force_iommu; bool_t __read_mostly iommu_verbose; -bool_t __read_mostly iommu_workaround_bios_bug; +bool_t __read_mostly iommu_workaround_bios_bug = 1; bool_t __read_mostly iommu_igfx = 1; bool_t __read_mostly iommu_snoop = 1; bool_t __read_mostly iommu_qinval = 1; diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index ac10602..9526ee7 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -553,26 +553,13 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header) } } - if ( invalid_cnt ) + if ( invalid_cnt && !iommu_workaround_bios_bug ) { - if ( iommu_workaround_bios_bug && - invalid_cnt == dmaru->scope.devices_cnt ) - { - printk(XENLOG_WARNING VTDPREFIX - " Workaround BIOS bug: ignoring DRHD (no devices in its scope are PCI discoverable)\n"); - - scope_devices_free(&dmaru->scope); - iommu_free(dmaru); - xfree(dmaru); - } - else - { - printk(XENLOG_WARNING VTDPREFIX - " DRHD is invalid (some devices in its scope are not PCI discoverable)\n"); - printk(XENLOG_WARNING VTDPREFIX - " Try \"iommu=force\" or \"iommu=workaround_bios_bug\" if you really want VT-d\n"); - ret = -EINVAL; - } + printk(XENLOG_WARNING VTDPREFIX + " DRHD is invalid (some devices in its scope are not PCI discoverable)\n"); + printk(XENLOG_WARNING VTDPREFIX + " Try \"iommu=force\" or \"iommu=workaround_bios_bug\" if you really want VT-d\n"); + ret = -EINVAL; } else acpi_register_drhd_unit(dmaru);