From patchwork Mon Jul 31 09:04:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Bird X-Patchwork-Id: 9871307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C7A06038F for ; Mon, 31 Jul 2017 09:07:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2345427FAE for ; Mon, 31 Jul 2017 09:07:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1560528575; Mon, 31 Jul 2017 09:07:03 +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=-3.3 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85B1627FAE for ; Mon, 31 Jul 2017 09:07:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dc6dK-0002rW-Sl; Mon, 31 Jul 2017 09:05:02 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dc6dK-0002rP-2w for xen-devel@lists.xen.org; Mon, 31 Jul 2017 09:05:02 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 08/5D-27137-DB2FE795; Mon, 31 Jul 2017 09:05:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42Jh9c9ZoLvnU12 kwf7DlhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bLY4eYC/rEKv52vGVsYFwm2MXIySEkUCZx +NIs9i5GLg4WgbdMEuumrmEHSUgIOEmc33iBCcLmk7j44geQzQFkl0t8bgUrYRPQkbi5YzOmX hEBaYlrny8zgtjMAn4ST5+9ZAaxhQWsJV5t3MYKYrMIqEq8uLIAbD6vgK3EhyVtzBC75CSWbr /OPIGRdwEjwypGjeLUorLUIl0jC72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMB wYACCHYzn1wYeYpTkYFIS5d32oS5SiC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvko9AOcGi1PTU irTMHGBgwqQlOHiURHhrQdK8xQWJucWZ6RCpU4yWHCsWbP3CxLFu+nYg+WrC/29MQix5+XmpU uK8JSANAiANGaV5cONg0XOJUVZKmJcR6EAhnoLUotzMElT5V4ziHIxKwrwBIFN4MvNK4La+Aj qICeggydJakINKEhFSUg2MNgdkdNXyP3Yf4tlW/W9zl2VQ9e/d9ze/OSy90sruc+UJfTdThTf blt8L1Zy3tj1hsbVnitS17AO+J2+f7+k4+sjMws97u7xJazT7PIHVvy07b+hkufRHSM060vTS gOtet+KWZSW5FTe+ppY23becvuZCZVjAajG5lDumXn6Xjn0rONp04iuLEktxRqKhFnNRcSIA+ zjp55kCAAA= X-Env-Sender: rustybird@openmailbox.org X-Msg-Ref: server-7.tower-21.messagelabs.com!1501491900!75752677!1 X-Originating-IP: [5.79.108.160] X-SpamReason: No, hits=0.7 required=7.0 tests=BODY_RANDOM_LONG, RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17769 invoked from network); 31 Jul 2017 09:05:00 -0000 Received: from lb1.openmailbox.org (HELO mail.openmailbox.org) (5.79.108.160) by server-7.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 31 Jul 2017 09:05:00 -0000 Received: by mail.openmailbox.org (Postfix, from userid 20002) id A47F74E01D3; Mon, 31 Jul 2017 11:05:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1501491900; bh=xams5Hyt/7WONStPj567Glfx7rvCrM2gntQd7C5VrVI=; h=From:To:Cc:Subject:Date:From; b=DD+WbtSxZujaQuEtbuByG2IMLvRs0jxb6qcbrcMWzAPpwACCxTFgDx7qDoJqLl030 s/C733lNaNkhCfqEou97a/fUBK/j0zEEhn7q41wbTi4GcXx/sNr+LwgIQX8lGDMTsV smNa4gny4VYHs8xW25Pg2C6ERhLi9po1VCkLOmSk= From: Rusty Bird DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1501491900; bh=xams5Hyt/7WONStPj567Glfx7rvCrM2gntQd7C5VrVI=; h=From:To:Cc:Subject:Date:From; b=DD+WbtSxZujaQuEtbuByG2IMLvRs0jxb6qcbrcMWzAPpwACCxTFgDx7qDoJqLl030 s/C733lNaNkhCfqEou97a/fUBK/j0zEEhn7q41wbTi4GcXx/sNr+LwgIQX8lGDMTsV smNa4gny4VYHs8xW25Pg2C6ERhLi9po1VCkLOmSk= To: xen-devel@lists.xen.org Date: Mon, 31 Jul 2017 09:04:04 +0000 Message-Id: <20170731090404.6503-1-rustybird@openmailbox.org> X-Mailer: git-send-email 2.9.4 Cc: Kevin Tian , Rusty Bird Subject: [Xen-devel] [PATCH v2] VT-d: don't panic/warn on iommu=no-igfx X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When operating on an Intel graphics device, iommu_enable_translation() panicked (force_iommu==1) or warned (force_iommu==0) about the BIOS if is_igd_vt_enabled_quirk() returned 0. That's good if the actual BIOS problem has been detected. But since commit 1463411, returning 0 could also happen if the user simply passed "iommu=no-igfx", in which case bailing out with an info message (instead of a panic/warning) would be more appropriate. The panic broke the combination "iommu=force,no-igfx", and also the case where "iommu=no-igfx" is passed but force_iommu=1 is set automatically by x2apic_bsp_setup(). Move the iommu_igfx check from is_igd_vt_enabled_quirk() into its only caller iommu_enable_translation(), and tweak the logic. Signed-off-by: Rusty Bird Acked-by: Kevin Tian --- Notes: Changed since v1: print info message when iommu_igfx==0 Best viewed with "git show --ignore-space-change --function-context" xen/drivers/passthrough/vtd/iommu.c | 22 ++++++++++++++++------ xen/drivers/passthrough/vtd/quirks.c | 3 --- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 19328f6..daaed0a 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -747,14 +747,24 @@ static void iommu_enable_translation(struct acpi_drhd_unit *drhd) unsigned long flags; struct iommu *iommu = drhd->iommu; - if ( is_igd_drhd(drhd) && !is_igd_vt_enabled_quirk() ) + if ( is_igd_drhd(drhd) ) { - if ( force_iommu ) - panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose"); + if ( !iommu_igfx ) + { + printk(XENLOG_INFO VTDPREFIX + "Passed iommu=no-igfx option. Disabling IGD VT-d engine.\n"); + return; + } - printk(XENLOG_WARNING VTDPREFIX - "BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n"); - return; + if ( !is_igd_vt_enabled_quirk() ) + { + if ( force_iommu ) + panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose"); + + printk(XENLOG_WARNING VTDPREFIX + "BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n"); + return; + } } /* apply platform specific errata workarounds */ diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c index 91f96ac..5bbbd96 100644 --- a/xen/drivers/passthrough/vtd/quirks.c +++ b/xen/drivers/passthrough/vtd/quirks.c @@ -70,9 +70,6 @@ int is_igd_vt_enabled_quirk(void) { u16 ggc; - if ( !iommu_igfx ) - return 0; - if ( !IS_ILK(ioh_id) ) return 1;