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=-10.8 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 A4AD7C388F2 for ; Mon, 2 Nov 2020 10:06:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 216E62225E for ; Mon, 2 Nov 2020 10:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728226AbgKBKG3 (ORCPT ); Mon, 2 Nov 2020 05:06:29 -0500 Received: from mga01.intel.com ([192.55.52.88]:47414 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728004AbgKBKG3 (ORCPT ); Mon, 2 Nov 2020 05:06:29 -0500 IronPort-SDR: HE8E9QULEDf2ch5+Wsg7z+OgUV1LESyi9krEynIAc1XAEEpHzWWRvUcFs+1RvV1tJGNVuFFu4m KQperzu9iWJA== X-IronPort-AV: E=McAfee;i="6000,8403,9792"; a="186692421" X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="186692421" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 02:06:28 -0800 IronPort-SDR: dOcdvCG/tii0EzWUK+yCLhpjz/Z99X5uQxcVBlpB+z/PyrSQ+5MNTAlzS3z2R9arPLoXhtVH3D /RFj2QOzDdTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="336121710" Received: from cfl-host.sh.intel.com ([10.239.158.142]) by orsmga002.jf.intel.com with ESMTP; 02 Nov 2020 02:06:26 -0800 From: Fred Gao To: kvm@vger.kernel.org, intel-gfx@lists.freedesktop.org Cc: Fred Gao , Zhenyu Wang , Xiong Zhang , Hang Yuan , Stuart Summers Subject: [PATCH v3] vfio/pci: Bypass IGD init in case of -ENODEV Date: Tue, 3 Nov 2020 02:01:20 +0800 Message-Id: <20201102180120.25319-1-fred.gao@intel.com> X-Mailer: git-send-email 2.24.1.1.gb6d4d82bd5 In-Reply-To: <20200929161038.15465-1-fred.gao@intel.com> References: <20200929161038.15465-1-fred.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Bypass the IGD initialization when -ENODEV returns, that should be the case if opregion is not available for IGD or within discrete graphics device's option ROM, or host/lpc bridge is not found. Then use of -ENODEV here means no special device resources found which needs special care for VFIO, but we still allow other normal device resource access. Cc: Zhenyu Wang Cc: Xiong Zhang Cc: Hang Yuan Cc: Stuart Summers Signed-off-by: Fred Gao --- drivers/vfio/pci/vfio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index f634c81998bb..c88cf9937469 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -341,7 +341,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) pdev->vendor == PCI_VENDOR_ID_INTEL && IS_ENABLED(CONFIG_VFIO_PCI_IGD)) { ret = vfio_pci_igd_init(vdev); - if (ret) { + if (ret && ret != -ENODEV) { pci_warn(pdev, "Failed to setup Intel IGD regions\n"); goto disable_exit; } -- 2.24.1.1.gb6d4d82bd5