Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1649942 > unrolled thread
| Started by | Jork Loeser <jloeser@linuxonhyperv.com> |
|---|---|
| First post | 2017-05-24 22:50 +0200 |
| Last post | 2017-05-31 00:40 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 Jork Loeser <jloeser@linuxonhyperv.com> - 2017-05-24 22:50 +0200
[PATCH-v2 1/5] Hyper-V vPCI: Minor format and semantic fix Jork Loeser <jloeser@linuxonhyperv.com> - 2017-05-24 22:50 +0200
[PATCH-v2 2/5] Hyper-V vPCI: Use page allocation for hbus structure Jork Loeser <jloeser@linuxonhyperv.com> - 2017-05-24 22:50 +0200
[PATCH-v2 3/5] PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra Jork Loeser <jloeser@linuxonhyperv.com> - 2017-05-24 22:50 +0200
Re: [PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 Bjorn Helgaas <helgaas@kernel.org> - 2017-05-30 21:50 +0200
RE: [PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 KY Srinivasan <kys@microsoft.com> - 2017-05-31 00:20 +0200
Re: [PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 Bjorn Helgaas <helgaas@kernel.org> - 2017-05-31 00:40 +0200
| From | Jork Loeser <jloeser@linuxonhyperv.com> |
|---|---|
| Date | 2017-05-24 22:50 +0200 |
| Subject | [PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 |
| Message-ID | <tKLod-76t-3@gated-at.bofh.it> |
From: Jork Loeser <jloeser@microsoft.com> Update the Hyper-V vPCI driver to use the Server-2016 version of the vPCI protocol, fixing MSI creation and retargeting issues. Changes since v1: - reduced spew in protocol negotiation (Dan Carpenter) - work-around work racing Hyper-V patch (Stephen Hemminger) - formatting (Dan) Jork Loeser (5): Hyper-V vPCI: Minor format and semantic fix Hyper-V vPCI: Use page allocation for hbus structure PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra Hyper-V vPCI: Add vPCI version protocol negotiation Hyper-V vPCI: use vPCI protocol version 1.2 arch/x86/include/uapi/asm/hyperv.h | 6 + drivers/pci/host/pci-hyperv.c | 445 ++++++++++++++++++++++++++++++------- 2 files changed, 370 insertions(+), 81 deletions(-) -- 2.7.4
[toc] | [next] | [standalone]
| From | Jork Loeser <jloeser@linuxonhyperv.com> |
|---|---|
| Date | 2017-05-24 22:50 +0200 |
| Subject | [PATCH-v2 1/5] Hyper-V vPCI: Minor format and semantic fix |
| Message-ID | <tKLod-76t-15@gated-at.bofh.it> |
| In reply to | #1649942 |
From: Jork Loeser <jloeser@microsoft.com>
Fix comment formatting and use proper integer fields.
Signed-off-by: Jork Loeser <jloeser@microsoft.com>
---
drivers/pci/host/pci-hyperv.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 8493638..7bebdc6 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -245,7 +245,7 @@ struct pci_packet {
struct pci_version_request {
struct pci_message message_type;
- enum pci_message_type protocol_version;
+ u32 protocol_version;
} __packed;
/*
@@ -1513,12 +1513,12 @@ static void pci_devices_present_work(struct work_struct *work)
put_pcichild(hpdev, hv_pcidev_ref_initial);
}
- switch(hbus->state) {
+ switch (hbus->state) {
case hv_pcibus_installed:
/*
- * Tell the core to rescan bus
- * because there may have been changes.
- */
+ * Tell the core to rescan bus
+ * because there may have been changes.
+ */
pci_lock_rescan_remove();
pci_scan_child_bus(hbus->pci_bus);
pci_unlock_rescan_remove();
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Jork Loeser <jloeser@linuxonhyperv.com> |
|---|---|
| Date | 2017-05-24 22:50 +0200 |
| Subject | [PATCH-v2 2/5] Hyper-V vPCI: Use page allocation for hbus structure |
| Message-ID | <tKLod-76t-17@gated-at.bofh.it> |
| In reply to | #1649942 |
From: Jork Loeser <jloeser@microsoft.com>
The hv_pcibus_device structure contains an in-memory hypercall argument
that must not cross a page boundary. Allocate the structure as a page
to ensure that.
Signed-off-by: Jork Loeser <jloeser@microsoft.com>
---
drivers/pci/host/pci-hyperv.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 7bebdc6..6e4b026 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -382,7 +382,10 @@ struct hv_pcibus_device {
struct msi_domain_info msi_info;
struct msi_controller msi_chip;
struct irq_domain *irq_domain;
+
+ /* hypercall arg, must not cross page boundary */
struct retarget_msi_interrupt retarget_msi_interrupt_params;
+
spinlock_t retarget_msi_interrupt_lock;
};
@@ -2204,7 +2207,13 @@ static int hv_pci_probe(struct hv_device *hdev,
struct hv_pcibus_device *hbus;
int ret;
- hbus = kzalloc(sizeof(*hbus), GFP_KERNEL);
+ /*
+ * hv_pcibus_device contains the hypercall arguments for retargeting in
+ * hv_irq_unmask(). Those must not cross a page boundary.
+ */
+ BUILD_BUG_ON(sizeof(*hbus) > PAGE_SIZE);
+
+ hbus = (struct hv_pcibus_device *)get_zeroed_page(GFP_KERNEL);
if (!hbus)
return -ENOMEM;
hbus->state = hv_pcibus_init;
@@ -2308,7 +2317,7 @@ static int hv_pci_probe(struct hv_device *hdev,
close:
vmbus_close(hdev->channel);
free_bus:
- kfree(hbus);
+ free_page((unsigned long)hbus);
return ret;
}
@@ -2386,7 +2395,7 @@ static int hv_pci_remove(struct hv_device *hdev)
irq_domain_free_fwnode(hbus->sysdata.fwnode);
put_hvpcibus(hbus);
wait_for_completion(&hbus->remove_event);
- kfree(hbus);
+ free_page((unsigned long)hbus);
return 0;
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Jork Loeser <jloeser@linuxonhyperv.com> |
|---|---|
| Date | 2017-05-24 22:50 +0200 |
| Subject | [PATCH-v2 3/5] PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra |
| Message-ID | <tKLoe-76t-21@gated-at.bofh.it> |
| In reply to | #1649942 |
From: Jork Loeser <jloeser@microsoft.com>
To ease parallel effort to centralize CPU-number-to-vCPU-number
conversion, temporarily stand up own version, file-local
hv_tmp_cpu_nr_to_vp_nr(). Once the changes have merged, this
work-around can be removed, and the calls replaced with
hv_cpu_number_to_vp_number().
Signed-off-by: Jork Loeser <jloeser@microsoft.com>
---
drivers/pci/host/pci-hyperv.c | 52 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 6e4b026..ee70b1f 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -479,6 +479,52 @@ static void put_pcichild(struct hv_pci_dev *hv_pcidev,
static void get_hvpcibus(struct hv_pcibus_device *hv_pcibus);
static void put_hvpcibus(struct hv_pcibus_device *hv_pcibus);
+
+/*
+ * Temporary CPU to vCPU mapping to address transitioning
+ * vmbus_cpu_number_to_vp_number() being migrated to
+ * hv_cpu_number_to_vp_number() in a separate patch. Once that patch
+ * has been picked up in the main line, remove this code here and use
+ * the offical code.
+ */
+static struct hv_tmpcpumap
+{
+ bool initialized;
+ u32 vp_index[NR_CPUS];
+} hv_tmpcpumap;
+
+static void hv_tmpcpumap_init_cpu(void *_unused)
+{
+ int cpu = smp_processor_id();
+ u64 vp_index;
+
+ hv_get_vp_index(vp_index);
+
+ hv_tmpcpumap.vp_index[cpu] = vp_index;
+}
+
+static void hv_tmpcpumap_init(void)
+{
+ if (hv_tmpcpumap.initialized)
+ return;
+
+ memset(hv_tmpcpumap.vp_index, -1, sizeof(hv_tmpcpumap.vp_index));
+ on_each_cpu(hv_tmpcpumap_init_cpu, NULL, true);
+ hv_tmpcpumap.initialized = true;
+}
+
+/**
+ * hv_tmp_cpu_nr_to_vp_nr() - Convert Linux CPU nr to Hyper-V vCPU nr
+ *
+ * Remove once vmbus_cpu_number_to_vp_number() has been converted to
+ * hv_cpu_number_to_vp_number() and replace callers appropriately.
+ */
+static u32 hv_tmp_cpu_nr_to_vp_nr(int cpu)
+{
+ return hv_tmpcpumap.vp_index[cpu];
+}
+
+
/**
* devfn_to_wslot() - Convert from Linux PCI slot to Windows
* @devfn: The Linux representation of PCI slot
@@ -813,7 +859,7 @@ static void hv_irq_unmask(struct irq_data *data)
params->vector = cfg->vector;
for_each_cpu_and(cpu, dest, cpu_online_mask)
- params->vp_mask |= (1ULL << vmbus_cpu_number_to_vp_number(cpu));
+ params->vp_mask |= (1ULL << hv_tmp_cpu_nr_to_vp_nr(cpu));
hv_do_hypercall(HVCALL_RETARGET_INTERRUPT, params, NULL);
@@ -908,7 +954,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
} else {
for_each_cpu_and(cpu, affinity, cpu_online_mask) {
int_pkt->int_desc.cpu_mask |=
- (1ULL << vmbus_cpu_number_to_vp_number(cpu));
+ (1ULL << hv_tmp_cpu_nr_to_vp_nr(cpu));
}
}
@@ -2218,6 +2264,8 @@ static int hv_pci_probe(struct hv_device *hdev,
return -ENOMEM;
hbus->state = hv_pcibus_init;
+ hv_tmpcpumap_init();
+
/*
* The PCI bus "domain" is what is called "segment" in ACPI and
* other specs. Pull it from the instance ID, to get something
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-05-30 21:50 +0200 |
| Message-ID | <tMVjs-34l-11@gated-at.bofh.it> |
| In reply to | #1649942 |
On Wed, May 24, 2017 at 01:41:23PM -0700, Jork Loeser wrote: > From: Jork Loeser <jloeser@microsoft.com> > > Update the Hyper-V vPCI driver to use the Server-2016 version of the vPCI > protocol, fixing MSI creation and retargeting issues. > > Changes since v1: > - reduced spew in protocol negotiation (Dan Carpenter) > - work-around work racing Hyper-V patch (Stephen Hemminger) > - formatting (Dan) > > Jork Loeser (5): > Hyper-V vPCI: Minor format and semantic fix > Hyper-V vPCI: Use page allocation for hbus structure > PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra > Hyper-V vPCI: Add vPCI version protocol negotiation > Hyper-V vPCI: use vPCI protocol version 1.2 > > arch/x86/include/uapi/asm/hyperv.h | 6 + > drivers/pci/host/pci-hyperv.c | 445 ++++++++++++++++++++++++++++++------- > 2 files changed, 370 insertions(+), 81 deletions(-) Waiting for a maintainer ack: Hyper-V CORE AND DRIVERS M: "K. Y. Srinivasan" <kys@microsoft.com> M: Haiyang Zhang <haiyangz@microsoft.com> M: Stephen Hemminger <sthemmin@microsoft.com> ... F: drivers/pci/host/pci-hyperv.c
[toc] | [prev] | [next] | [standalone]
| From | KY Srinivasan <kys@microsoft.com> |
|---|---|
| Date | 2017-05-31 00:20 +0200 |
| Message-ID | <tMXEC-4Ei-23@gated-at.bofh.it> |
| In reply to | #1653526 |
> -----Original Message----- > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On > Behalf Of Bjorn Helgaas > Sent: Tuesday, May 30, 2017 12:45 PM > To: Jork Loeser <Jork.Loeser@microsoft.com> > Cc: olaf@aepfle.de; Stephen Hemminger <sthemmin@microsoft.com>; > linux-pci@vger.kernel.org; jasowang@redhat.com; linux- > kernel@vger.kernel.org; marcelo.cerri@canonical.com; apw@canonical.com; > devel@linuxdriverproject.org; vkuznets@redhat.com; > leann.ogasawara@canonical.com > Subject: Re: [PATCH-v2 0/5] Hyper-V vPCI: use vPCI protocol version 1.2 > > On Wed, May 24, 2017 at 01:41:23PM -0700, Jork Loeser wrote: > > From: Jork Loeser <jloeser@microsoft.com> > > > > Update the Hyper-V vPCI driver to use the Server-2016 version of the vPCI > > protocol, fixing MSI creation and retargeting issues. > > > > Changes since v1: > > - reduced spew in protocol negotiation (Dan Carpenter) > > - work-around work racing Hyper-V patch (Stephen Hemminger) > > - formatting (Dan) > > > > Jork Loeser (5): > > Hyper-V vPCI: Minor format and semantic fix > > Hyper-V vPCI: Use page allocation for hbus structure > > PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra > > Hyper-V vPCI: Add vPCI version protocol negotiation > > Hyper-V vPCI: use vPCI protocol version 1.2 > > > > arch/x86/include/uapi/asm/hyperv.h | 6 + > > drivers/pci/host/pci-hyperv.c | 445 > ++++++++++++++++++++++++++++++------- > > 2 files changed, 370 insertions(+), 81 deletions(-) > > Waiting for a maintainer ack: Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Acked-by: K. Y. Srinivasan <kys@microsoft.com> > > Hyper-V CORE AND DRIVERS > M: "K. Y. Srinivasan" <kys@microsoft.com> > M: Haiyang Zhang <haiyangz@microsoft.com> > M: Stephen Hemminger <sthemmin@microsoft.com> > ... > F: drivers/pci/host/pci-hyperv.c > _______________________________________________ > devel mailing list > devel@linuxdriverproject.org > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdriverd > ev.linuxdriverproject.org%2Fmailman%2Flistinfo%2Fdriverdev- > devel&data=02%7C01%7Ckys%40microsoft.com%7C08ff2147e87e4b9957090 > 8d4a794658f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6363177 > 03190907906&sdata=ET7UEDnBub1iNEOAb509JrjEZxKZjyhmLSubVzYZtic%3D > &reserved=0
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-05-31 00:40 +0200 |
| Message-ID | <tMXXY-4Lf-21@gated-at.bofh.it> |
| In reply to | #1649942 |
On Wed, May 24, 2017 at 01:41:23PM -0700, Jork Loeser wrote: > From: Jork Loeser <jloeser@microsoft.com> > > Update the Hyper-V vPCI driver to use the Server-2016 version of the vPCI > protocol, fixing MSI creation and retargeting issues. > > Changes since v1: > - reduced spew in protocol negotiation (Dan Carpenter) > - work-around work racing Hyper-V patch (Stephen Hemminger) > - formatting (Dan) > > Jork Loeser (5): > Hyper-V vPCI: Minor format and semantic fix > Hyper-V vPCI: Use page allocation for hbus structure > PCI-HyperV vPCI: Temporary own CPU-number-to-vCPU-number infra > Hyper-V vPCI: Add vPCI version protocol negotiation > Hyper-V vPCI: use vPCI protocol version 1.2 > > arch/x86/include/uapi/asm/hyperv.h | 6 + > drivers/pci/host/pci-hyperv.c | 445 ++++++++++++++++++++++++++++++------- > 2 files changed, 370 insertions(+), 81 deletions(-) Applied with K.Y.'s ack to pci/host-hv for v4.13, thanks!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web