Skip to content

Commit 5f054ef

Browse files
committed
Merge tag 'hyperv-fixes-signed-20250718' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv fixes from Wei Liu: - Select use CONFIG_SYSFB only if EFI is enabled (Michael Kelley) - An assorted set of fixes to remove warnings for missing export.h header inclusion (Naman Jain) - An assorted set of fixes for when Linux run as the root partition for Microsoft Hypervisor (Mukesh Rathor, Nuno Das Neves, Stanislav Kinsburskii) - Fix the check for HYPERVISOR_CALLBACK_VECTOR (Naman Jain) - Fix fcopy tool to handle irregularities with size of ring buffer (Naman Jain) - Fix incorrect file path conversion in fcopy tool (Yasumasa Suenaga) * tag 'hyperv-fixes-signed-20250718' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: tools/hv: fcopy: Fix irregularities with size of ring buffer PCI: hv: Use the correct hypercall for unmasking interrupts on nested x86/hyperv: Expose hv_map_msi_interrupt() Drivers: hv: Use nested hypercall for post message and signal event x86/hyperv: Clean up hv_map/unmap_interrupt() return values x86/hyperv: Fix usage of cpu_online_mask to get valid cpu PCI: hv: Don't load the driver for baremetal root partition net: mana: Fix warnings for missing export.h header inclusion PCI: hv: Fix warnings for missing export.h header inclusion clocksource: hyper-v: Fix warnings for missing export.h header inclusion x86/hyperv: Fix warnings for missing export.h header inclusion Drivers: hv: Fix warnings for missing export.h header inclusion Drivers: hv: Fix the check for HYPERVISOR_CALLBACK_VECTOR tools/hv: fcopy: Fix incorrect file path conversion Drivers: hv: Select CONFIG_SYSFB only if EFI is enabled
2 parents 4f066b1 + a4131a5 commit 5f054ef

File tree

22 files changed

+196
-112
lines changed

22 files changed

+196
-112
lines changed

arch/x86/hyperv/hv_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/syscore_ops.h>
3535
#include <clocksource/hyperv_timer.h>
3636
#include <linux/highmem.h>
37+
#include <linux/export.h>
3738

3839
void *hv_hypercall_pg;
3940
EXPORT_SYMBOL_GPL(hv_hypercall_pg);

arch/x86/hyperv/irqdomain.c

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <linux/pci.h>
1212
#include <linux/irq.h>
13+
#include <linux/export.h>
1314
#include <asm/mshyperv.h>
1415

1516
static int hv_map_interrupt(union hv_device_id device_id, bool level,
@@ -46,7 +47,7 @@ static int hv_map_interrupt(union hv_device_id device_id, bool level,
4647
if (nr_bank < 0) {
4748
local_irq_restore(flags);
4849
pr_err("%s: unable to generate VP set\n", __func__);
49-
return EINVAL;
50+
return -EINVAL;
5051
}
5152
intr_desc->target.flags = HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET;
5253

@@ -66,7 +67,7 @@ static int hv_map_interrupt(union hv_device_id device_id, bool level,
6667
if (!hv_result_success(status))
6768
hv_status_err(status, "\n");
6869

69-
return hv_result(status);
70+
return hv_result_to_errno(status);
7071
}
7172

7273
static int hv_unmap_interrupt(u64 id, struct hv_interrupt_entry *old_entry)
@@ -88,7 +89,10 @@ static int hv_unmap_interrupt(u64 id, struct hv_interrupt_entry *old_entry)
8889
status = hv_do_hypercall(HVCALL_UNMAP_DEVICE_INTERRUPT, input, NULL);
8990
local_irq_restore(flags);
9091

91-
return hv_result(status);
92+
if (!hv_result_success(status))
93+
hv_status_err(status, "\n");
94+
95+
return hv_result_to_errno(status);
9296
}
9397

9498
#ifdef CONFIG_PCI_MSI
@@ -169,13 +173,34 @@ static union hv_device_id hv_build_pci_dev_id(struct pci_dev *dev)
169173
return dev_id;
170174
}
171175

172-
static int hv_map_msi_interrupt(struct pci_dev *dev, int cpu, int vector,
173-
struct hv_interrupt_entry *entry)
176+
/**
177+
* hv_map_msi_interrupt() - "Map" the MSI IRQ in the hypervisor.
178+
* @data: Describes the IRQ
179+
* @out_entry: Hypervisor (MSI) interrupt entry (can be NULL)
180+
*
181+
* Map the IRQ in the hypervisor by issuing a MAP_DEVICE_INTERRUPT hypercall.
182+
*
183+
* Return: 0 on success, -errno on failure
184+
*/
185+
int hv_map_msi_interrupt(struct irq_data *data,
186+
struct hv_interrupt_entry *out_entry)
174187
{
175-
union hv_device_id device_id = hv_build_pci_dev_id(dev);
188+
struct irq_cfg *cfg = irqd_cfg(data);
189+
struct hv_interrupt_entry dummy;
190+
union hv_device_id device_id;
191+
struct msi_desc *msidesc;
192+
struct pci_dev *dev;
193+
int cpu;
176194

177-
return hv_map_interrupt(device_id, false, cpu, vector, entry);
195+
msidesc = irq_data_get_msi_desc(data);
196+
dev = msi_desc_to_pci_dev(msidesc);
197+
device_id = hv_build_pci_dev_id(dev);
198+
cpu = cpumask_first(irq_data_get_effective_affinity_mask(data));
199+
200+
return hv_map_interrupt(device_id, false, cpu, cfg->vector,
201+
out_entry ? out_entry : &dummy);
178202
}
203+
EXPORT_SYMBOL_GPL(hv_map_msi_interrupt);
179204

180205
static inline void entry_to_msi_msg(struct hv_interrupt_entry *entry, struct msi_msg *msg)
181206
{
@@ -188,13 +213,11 @@ static inline void entry_to_msi_msg(struct hv_interrupt_entry *entry, struct msi
188213
static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt_entry *old_entry);
189214
static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
190215
{
216+
struct hv_interrupt_entry *stored_entry;
217+
struct irq_cfg *cfg = irqd_cfg(data);
191218
struct msi_desc *msidesc;
192219
struct pci_dev *dev;
193-
struct hv_interrupt_entry out_entry, *stored_entry;
194-
struct irq_cfg *cfg = irqd_cfg(data);
195-
const cpumask_t *affinity;
196-
int cpu;
197-
u64 status;
220+
int ret;
198221

199222
msidesc = irq_data_get_msi_desc(data);
200223
dev = msi_desc_to_pci_dev(msidesc);
@@ -204,9 +227,6 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
204227
return;
205228
}
206229

207-
affinity = irq_data_get_effective_affinity_mask(data);
208-
cpu = cpumask_first_and(affinity, cpu_online_mask);
209-
210230
if (data->chip_data) {
211231
/*
212232
* This interrupt is already mapped. Let's unmap first.
@@ -219,14 +239,12 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
219239
stored_entry = data->chip_data;
220240
data->chip_data = NULL;
221241

222-
status = hv_unmap_msi_interrupt(dev, stored_entry);
242+
ret = hv_unmap_msi_interrupt(dev, stored_entry);
223243

224244
kfree(stored_entry);
225245

226-
if (status != HV_STATUS_SUCCESS) {
227-
hv_status_debug(status, "failed to unmap\n");
246+
if (ret)
228247
return;
229-
}
230248
}
231249

232250
stored_entry = kzalloc(sizeof(*stored_entry), GFP_ATOMIC);
@@ -235,15 +253,14 @@ static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
235253
return;
236254
}
237255

238-
status = hv_map_msi_interrupt(dev, cpu, cfg->vector, &out_entry);
239-
if (status != HV_STATUS_SUCCESS) {
256+
ret = hv_map_msi_interrupt(data, stored_entry);
257+
if (ret) {
240258
kfree(stored_entry);
241259
return;
242260
}
243261

244-
*stored_entry = out_entry;
245262
data->chip_data = stored_entry;
246-
entry_to_msi_msg(&out_entry, msg);
263+
entry_to_msi_msg(data->chip_data, msg);
247264

248265
return;
249266
}
@@ -257,7 +274,6 @@ static void hv_teardown_msi_irq(struct pci_dev *dev, struct irq_data *irqd)
257274
{
258275
struct hv_interrupt_entry old_entry;
259276
struct msi_msg msg;
260-
u64 status;
261277

262278
if (!irqd->chip_data) {
263279
pr_debug("%s: no chip data\n!", __func__);
@@ -270,10 +286,7 @@ static void hv_teardown_msi_irq(struct pci_dev *dev, struct irq_data *irqd)
270286
kfree(irqd->chip_data);
271287
irqd->chip_data = NULL;
272288

273-
status = hv_unmap_msi_interrupt(dev, &old_entry);
274-
275-
if (status != HV_STATUS_SUCCESS)
276-
hv_status_err(status, "\n");
289+
(void)hv_unmap_msi_interrupt(dev, &old_entry);
277290
}
278291

279292
static void hv_msi_free_irq(struct irq_domain *domain,

arch/x86/hyperv/ivm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/types.h>
1111
#include <linux/slab.h>
1212
#include <linux/cpu.h>
13+
#include <linux/export.h>
1314
#include <asm/svm.h>
1415
#include <asm/sev.h>
1516
#include <asm/io.h>

arch/x86/hyperv/nested.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212

1313
#include <linux/types.h>
14+
#include <linux/export.h>
1415
#include <hyperv/hvhdk.h>
1516
#include <asm/mshyperv.h>
1617
#include <asm/tlbflush.h>

arch/x86/include/asm/mshyperv.h

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,6 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
112112
return hv_status;
113113
}
114114

115-
/* Hypercall to the L0 hypervisor */
116-
static inline u64 hv_do_nested_hypercall(u64 control, void *input, void *output)
117-
{
118-
return hv_do_hypercall(control | HV_HYPERCALL_NESTED, input, output);
119-
}
120-
121115
/* Fast hypercall with 8 bytes of input and no output */
122116
static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1)
123117
{
@@ -165,13 +159,6 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
165159
return _hv_do_fast_hypercall8(control, input1);
166160
}
167161

168-
static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1)
169-
{
170-
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
171-
172-
return _hv_do_fast_hypercall8(control, input1);
173-
}
174-
175162
/* Fast hypercall with 16 bytes of input */
176163
static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2)
177164
{
@@ -223,13 +210,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
223210
return _hv_do_fast_hypercall16(control, input1, input2);
224211
}
225212

226-
static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 input2)
227-
{
228-
u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
229-
230-
return _hv_do_fast_hypercall16(control, input1, input2);
231-
}
232-
233213
extern struct hv_vp_assist_page **hv_vp_assist_page;
234214

235215
static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)
@@ -262,6 +242,8 @@ static inline void hv_apic_init(void) {}
262242

263243
struct irq_domain *hv_create_pci_msi_domain(void);
264244

245+
int hv_map_msi_interrupt(struct irq_data *data,
246+
struct hv_interrupt_entry *out_entry);
265247
int hv_map_ioapic_interrupt(int ioapic_id, bool level, int vcpu, int vector,
266248
struct hv_interrupt_entry *entry);
267249
int hv_unmap_ioapic_interrupt(int ioapic_id, struct hv_interrupt_entry *entry);

drivers/clocksource/hyperv_timer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/irq.h>
2323
#include <linux/acpi.h>
2424
#include <linux/hyperv.h>
25+
#include <linux/export.h>
2526
#include <clocksource/hyperv_timer.h>
2627
#include <hyperv/hvhdk.h>
2728
#include <asm/mshyperv.h>

drivers/hv/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ config HYPERV
99
select PARAVIRT
1010
select X86_HV_CALLBACK_VECTOR if X86
1111
select OF_EARLY_FLATTREE if OF
12-
select SYSFB if !HYPERV_VTL_MODE
12+
select SYSFB if EFI && !HYPERV_VTL_MODE
1313
help
1414
Select this option to run Linux as a Hyper-V client operating
1515
system.

drivers/hv/channel.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/uio.h>
1919
#include <linux/interrupt.h>
2020
#include <linux/set_memory.h>
21+
#include <linux/export.h>
2122
#include <asm/page.h>
2223
#include <asm/mshyperv.h>
2324

drivers/hv/channel_mgmt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/delay.h>
2121
#include <linux/cpu.h>
2222
#include <linux/hyperv.h>
23+
#include <linux/export.h>
2324
#include <asm/mshyperv.h>
2425
#include <linux/sched/isolation.h>
2526

drivers/hv/connection.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,10 @@ void vmbus_set_event(struct vmbus_channel *channel)
519519
else
520520
WARN_ON_ONCE(1);
521521
} else {
522-
hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event);
522+
u64 control = HVCALL_SIGNAL_EVENT;
523+
524+
control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
525+
hv_do_fast_hypercall8(control, channel->sig_event);
523526
}
524527
}
525528
EXPORT_SYMBOL_GPL(vmbus_set_event);

0 commit comments

Comments
 (0)