From: longli@linuxonhyperv.com
To: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org
Cc: Long Li <longli@microsoft.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>
Subject: [PATCH 1/2] Drivers: hv: vmbus: add support to ignore certain PCIE devices
Date: Mon, 7 Jun 2021 18:04:35 -0700 [thread overview]
Message-ID: <1623114276-11696-2-git-send-email-longli@linuxonhyperv.com> (raw)
In-Reply-To: <1623114276-11696-1-git-send-email-longli@linuxonhyperv.com>
From: Long Li <longli@microsoft.com>
When Hyper-v presents a FlexIOV device to VMBUS, this device has its VMBUS
channel and a PCIE channel. The PCIE channel is not used in Linux and does
not have a backing PCIE device on Hyper-v. For such FlexIOV devices, add
the code to ignore those PCIE devices so they are not getting probed by the
PCI subsystem.
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/hv/channel_mgmt.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index caf6d0c..6fd7ae5 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -26,6 +26,20 @@
static void init_vp_index(struct vmbus_channel *channel);
+/*
+ * Hyper-v presents FlexIOV devices on the PCIE.
+ * Those devices have no real PCI implementation in Hyper-V, and should be
+ * ignored and not presented to the PCI layer.
+ */
+static const guid_t vpci_ignore_instances[] = {
+ /*
+ * XStore Fastpath instance ID in VPCI introduced by FlexIOV
+ * {d4573da2-2caa-4711-a8f9-bbabf4ee9685}
+ */
+ GUID_INIT(0xd4573da2, 0x2caa, 0x4711, 0xa8, 0xf9,
+ 0xbb, 0xab, 0xf4, 0xee, 0x96, 0x85),
+};
+
const struct vmbus_device vmbus_devs[] = {
/* IDE */
{ .dev_type = HV_IDE,
@@ -487,6 +501,16 @@ void vmbus_free_channels(void)
}
}
+static bool ignore_pcie_device(guid_t *if_instance)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(vpci_ignore_instances); i++)
+ if (guid_equal(&vpci_ignore_instances[i], if_instance))
+ return true;
+ return false;
+}
+
/* Note: the function can run concurrently for primary/sub channels. */
static void vmbus_add_channel_work(struct work_struct *work)
{
@@ -958,6 +982,17 @@ static bool vmbus_is_valid_device(const guid_t *guid)
return false;
}
+static bool is_pcie_offer(struct vmbus_channel_offer_channel *offer)
+{
+ int i;
+
+ for (i = HV_IDE; i < HV_UNKNOWN; i++)
+ if (guid_equal(&offer->offer.if_type, &vmbus_devs[i].guid))
+ break;
+
+ return i == HV_PCIE;
+}
+
/*
* vmbus_onoffer - Handler for channel offers from vmbus in parent partition.
*
@@ -1051,6 +1086,14 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
return;
}
+ /* Check to see if we should ignore this PCIe channel */
+ if (is_pcie_offer(offer) &&
+ ignore_pcie_device(&offer->offer.if_instance)) {
+ pr_info("Ignore instance %pUl over VPCI\n",
+ &offer->offer.if_instance);
+ return;
+ }
+
/* Allocate the channel object and save this offer. */
newchannel = alloc_channel();
if (!newchannel) {
--
1.8.3.1
next prev parent reply other threads:[~2021-06-08 1:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 1:04 [PATCH 0/2] Add a driver for host accelerated Microsoft Azure Blob Storage access longli
2021-06-08 1:04 ` longli [this message]
2021-06-21 18:06 ` [PATCH 1/2] Drivers: hv: vmbus: add support to ignore certain PCIE devices Michael Kelley
2021-06-23 18:05 ` Long Li
2021-06-08 1:04 ` [PATCH 2/2] Drivers: hv: add XStore Fastpath driver longli
2021-06-21 18:09 ` Michael Kelley
2021-06-23 19:21 ` Long Li
2021-06-23 22:01 ` Michael Kelley
2021-06-23 22:59 ` Long Li
2021-06-25 18:39 ` Michael Kelley
2021-06-25 19:51 ` Long Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1623114276-11696-2-git-send-email-longli@linuxonhyperv.com \
--to=longli@linuxonhyperv.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).