Skip to content

Commit 2215336

Browse files
committed
Merge tag 'hyperv-next-signed-20251006' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv updates from Wei Liu: - Unify guest entry code for KVM and MSHV (Sean Christopherson) - Switch Hyper-V MSI domain to use msi_create_parent_irq_domain() (Nam Cao) - Add CONFIG_HYPERV_VMBUS and limit the semantics of CONFIG_HYPERV (Mukesh Rathor) - Add kexec/kdump support on Azure CVMs (Vitaly Kuznetsov) - Deprecate hyperv_fb in favor of Hyper-V DRM driver (Prasanna Kumar T S M) - Miscellaneous enhancements, fixes and cleanups (Abhishek Tiwari, Alok Tiwari, Nuno Das Neves, Wei Liu, Roman Kisel, Michael Kelley) * tag 'hyperv-next-signed-20251006' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: hyperv: Remove the spurious null directive line MAINTAINERS: Mark hyperv_fb driver Obsolete fbdev/hyperv_fb: deprecate this in favor of Hyper-V DRM driver Drivers: hv: Make CONFIG_HYPERV bool Drivers: hv: Add CONFIG_HYPERV_VMBUS option Drivers: hv: vmbus: Fix typos in vmbus_drv.c Drivers: hv: vmbus: Fix sysfs output format for ring buffer index Drivers: hv: vmbus: Clean up sscanf format specifier in target_cpu_store() x86/hyperv: Switch to msi_create_parent_irq_domain() mshv: Use common "entry virt" APIs to do work in root before running guest entry: Rename "kvm" entry code assets to "virt" to genericize APIs entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper mshv: Handle NEED_RESCHED_LAZY before transferring to guest x86/hyperv: Add kexec/kdump support on Azure CVMs Drivers: hv: Simplify data structures for VMBus channel close message Drivers: hv: util: Cosmetic changes for hv_utils_transport.c mshv: Add support for a new parent partition configuration clocksource: hyper-v: Skip unnecessary checks for the root partition hyperv: Add missing field to hv_output_map_device_interrupt
2 parents c746c3b + b595edc commit 2215336

45 files changed

Lines changed: 449 additions & 193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MAINTAINERS

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10390,7 +10390,7 @@ L: linux-kernel@vger.kernel.org
1039010390
S: Maintained
1039110391
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/entry
1039210392
F: include/linux/entry-common.h
10393-
F: include/linux/entry-kvm.h
10393+
F: include/linux/entry-virt.h
1039410394
F: include/linux/irq-entry-common.h
1039510395
F: kernel/entry/
1039610396

@@ -11604,7 +11604,6 @@ F: drivers/pci/controller/pci-hyperv-intf.c
1160411604
F: drivers/pci/controller/pci-hyperv.c
1160511605
F: drivers/scsi/storvsc_drv.c
1160611606
F: drivers/uio/uio_hv_generic.c
11607-
F: drivers/video/fbdev/hyperv_fb.c
1160811607
F: include/asm-generic/mshyperv.h
1160911608
F: include/clocksource/hyperv_timer.h
1161011609
F: include/hyperv/hvgdk.h
@@ -11618,6 +11617,16 @@ F: include/uapi/linux/hyperv.h
1161811617
F: net/vmw_vsock/hyperv_transport.c
1161911618
F: tools/hv/
1162011619

11620+
HYPER-V FRAMEBUFFER DRIVER
11621+
M: "K. Y. Srinivasan" <kys@microsoft.com>
11622+
M: Haiyang Zhang <haiyangz@microsoft.com>
11623+
M: Wei Liu <wei.liu@kernel.org>
11624+
M: Dexuan Cui <decui@microsoft.com>
11625+
L: linux-hyperv@vger.kernel.org
11626+
S: Obsolete
11627+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
11628+
F: drivers/video/fbdev/hyperv_fb.c
11629+
1162111630
HYPERBUS SUPPORT
1162211631
M: Vignesh Raghavendra <vigneshr@ti.com>
1162311632
R: Tudor Ambarus <tudor.ambarus@linaro.org>

arch/arm64/kvm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ menuconfig KVM
2525
select HAVE_KVM_CPU_RELAX_INTERCEPT
2626
select KVM_MMIO
2727
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
28-
select KVM_XFER_TO_GUEST_WORK
28+
select VIRT_XFER_TO_GUEST_WORK
2929
select KVM_VFIO
3030
select HAVE_KVM_DIRTY_RING_ACQ_REL
3131
select NEED_KVM_DIRTY_RING_WITH_BITMAP

arch/arm64/kvm/arm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <linux/bug.h>
88
#include <linux/cpu_pm.h>
9-
#include <linux/entry-kvm.h>
109
#include <linux/errno.h>
1110
#include <linux/err.h>
1211
#include <linux/kvm_host.h>
@@ -1183,7 +1182,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
11831182
/*
11841183
* Check conditions before entering the guest
11851184
*/
1186-
ret = xfer_to_guest_mode_handle_work(vcpu);
1185+
ret = kvm_xfer_to_guest_mode_handle_work(vcpu);
11871186
if (!ret)
11881187
ret = 1;
11891188

arch/loongarch/kvm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ config KVM
3131
select KVM_GENERIC_HARDWARE_ENABLING
3232
select KVM_GENERIC_MMU_NOTIFIER
3333
select KVM_MMIO
34-
select KVM_XFER_TO_GUEST_WORK
34+
select VIRT_XFER_TO_GUEST_WORK
3535
select SCHED_INFO
3636
select GUEST_PERF_EVENTS if PERF_EVENTS
3737
help

arch/loongarch/kvm/vcpu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
#include <linux/kvm_host.h>
7-
#include <linux/entry-kvm.h>
87
#include <asm/fpu.h>
98
#include <asm/lbt.h>
109
#include <asm/loongarch.h>
@@ -251,7 +250,7 @@ static int kvm_enter_guest_check(struct kvm_vcpu *vcpu)
251250
/*
252251
* Check conditions before entering the guest
253252
*/
254-
ret = xfer_to_guest_mode_handle_work(vcpu);
253+
ret = kvm_xfer_to_guest_mode_handle_work(vcpu);
255254
if (ret < 0)
256255
return ret;
257256

arch/riscv/kvm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ config KVM
3030
select KVM_GENERIC_DIRTYLOG_READ_PROTECT
3131
select KVM_GENERIC_HARDWARE_ENABLING
3232
select KVM_MMIO
33-
select KVM_XFER_TO_GUEST_WORK
33+
select VIRT_XFER_TO_GUEST_WORK
3434
select KVM_GENERIC_MMU_NOTIFIER
3535
select SCHED_INFO
3636
select GUEST_PERF_EVENTS if PERF_EVENTS

arch/riscv/kvm/vcpu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
#include <linux/bitops.h>
10-
#include <linux/entry-kvm.h>
1110
#include <linux/errno.h>
1211
#include <linux/err.h>
1312
#include <linux/kdebug.h>
@@ -911,7 +910,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
911910
run->exit_reason = KVM_EXIT_UNKNOWN;
912911
while (ret > 0) {
913912
/* Check conditions before entering the guest */
914-
ret = xfer_to_guest_mode_handle_work(vcpu);
913+
ret = kvm_xfer_to_guest_mode_handle_work(vcpu);
915914
if (ret)
916915
continue;
917916
ret = 1;

arch/x86/hyperv/irqdomain.c

Lines changed: 76 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/pci.h>
1212
#include <linux/irq.h>
1313
#include <linux/export.h>
14+
#include <linux/irqchip/irq-msi-lib.h>
1415
#include <asm/mshyperv.h>
1516

1617
static int hv_map_interrupt(union hv_device_id device_id, bool level,
@@ -289,59 +290,99 @@ static void hv_teardown_msi_irq(struct pci_dev *dev, struct irq_data *irqd)
289290
(void)hv_unmap_msi_interrupt(dev, &old_entry);
290291
}
291292

292-
static void hv_msi_free_irq(struct irq_domain *domain,
293-
struct msi_domain_info *info, unsigned int virq)
294-
{
295-
struct irq_data *irqd = irq_get_irq_data(virq);
296-
struct msi_desc *desc;
297-
298-
if (!irqd)
299-
return;
300-
301-
desc = irq_data_get_msi_desc(irqd);
302-
if (!desc || !desc->irq || WARN_ON_ONCE(!dev_is_pci(desc->dev)))
303-
return;
304-
305-
hv_teardown_msi_irq(to_pci_dev(desc->dev), irqd);
306-
}
307-
308293
/*
309294
* IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices,
310295
* which implement the MSI or MSI-X Capability Structure.
311296
*/
312297
static struct irq_chip hv_pci_msi_controller = {
313298
.name = "HV-PCI-MSI",
314-
.irq_unmask = pci_msi_unmask_irq,
315-
.irq_mask = pci_msi_mask_irq,
316299
.irq_ack = irq_chip_ack_parent,
317-
.irq_retrigger = irq_chip_retrigger_hierarchy,
318300
.irq_compose_msi_msg = hv_irq_compose_msi_msg,
319-
.irq_set_affinity = msi_domain_set_affinity,
320-
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED,
301+
.irq_set_affinity = irq_chip_set_affinity_parent,
321302
};
322303

323-
static struct msi_domain_ops pci_msi_domain_ops = {
324-
.msi_free = hv_msi_free_irq,
325-
.msi_prepare = pci_msi_prepare,
304+
static bool hv_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
305+
struct irq_domain *real_parent, struct msi_domain_info *info)
306+
{
307+
struct irq_chip *chip = info->chip;
308+
309+
if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
310+
return false;
311+
312+
chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;
313+
314+
info->ops->msi_prepare = pci_msi_prepare;
315+
316+
return true;
317+
}
318+
319+
#define HV_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | MSI_FLAG_PCI_MSIX)
320+
#define HV_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS)
321+
322+
static struct msi_parent_ops hv_msi_parent_ops = {
323+
.supported_flags = HV_MSI_FLAGS_SUPPORTED,
324+
.required_flags = HV_MSI_FLAGS_REQUIRED,
325+
.bus_select_token = DOMAIN_BUS_NEXUS,
326+
.bus_select_mask = MATCH_PCI_MSI,
327+
.chip_flags = MSI_CHIP_FLAG_SET_ACK,
328+
.prefix = "HV-",
329+
.init_dev_msi_info = hv_init_dev_msi_info,
326330
};
327331

328-
static struct msi_domain_info hv_pci_msi_domain_info = {
329-
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
330-
MSI_FLAG_PCI_MSIX,
331-
.ops = &pci_msi_domain_ops,
332-
.chip = &hv_pci_msi_controller,
333-
.handler = handle_edge_irq,
334-
.handler_name = "edge",
332+
static int hv_msi_domain_alloc(struct irq_domain *d, unsigned int virq, unsigned int nr_irqs,
333+
void *arg)
334+
{
335+
/*
336+
* TODO: The allocation bits of hv_irq_compose_msi_msg(), i.e. everything except
337+
* entry_to_msi_msg() should be in here.
338+
*/
339+
340+
int ret;
341+
342+
ret = irq_domain_alloc_irqs_parent(d, virq, nr_irqs, arg);
343+
if (ret)
344+
return ret;
345+
346+
for (int i = 0; i < nr_irqs; ++i) {
347+
irq_domain_set_info(d, virq + i, 0, &hv_pci_msi_controller, NULL,
348+
handle_edge_irq, NULL, "edge");
349+
}
350+
return 0;
351+
}
352+
353+
static void hv_msi_domain_free(struct irq_domain *d, unsigned int virq, unsigned int nr_irqs)
354+
{
355+
for (int i = 0; i < nr_irqs; ++i) {
356+
struct irq_data *irqd = irq_domain_get_irq_data(d, virq);
357+
struct msi_desc *desc;
358+
359+
desc = irq_data_get_msi_desc(irqd);
360+
if (!desc || !desc->irq || WARN_ON_ONCE(!dev_is_pci(desc->dev)))
361+
continue;
362+
363+
hv_teardown_msi_irq(to_pci_dev(desc->dev), irqd);
364+
}
365+
irq_domain_free_irqs_top(d, virq, nr_irqs);
366+
}
367+
368+
static const struct irq_domain_ops hv_msi_domain_ops = {
369+
.select = msi_lib_irq_domain_select,
370+
.alloc = hv_msi_domain_alloc,
371+
.free = hv_msi_domain_free,
335372
};
336373

337374
struct irq_domain * __init hv_create_pci_msi_domain(void)
338375
{
339376
struct irq_domain *d = NULL;
340-
struct fwnode_handle *fn;
341377

342-
fn = irq_domain_alloc_named_fwnode("HV-PCI-MSI");
343-
if (fn)
344-
d = pci_msi_create_irq_domain(fn, &hv_pci_msi_domain_info, x86_vector_domain);
378+
struct irq_domain_info info = {
379+
.fwnode = irq_domain_alloc_named_fwnode("HV-PCI-MSI"),
380+
.ops = &hv_msi_domain_ops,
381+
.parent = x86_vector_domain,
382+
};
383+
384+
if (info.fwnode)
385+
d = msi_create_parent_irq_domain(&info, &hv_msi_parent_ops);
345386

346387
/* No point in going further if we can't get an irq domain */
347388
BUG_ON(!d);

0 commit comments

Comments
 (0)