Skip to content

Commit 18a34bb

Browse files
romank-msftliuw
authored andcommitted
Drivers: hv: vmbus: Introduce hv_get_vmbus_root_device()
The ARM64 PCI code for hyperv needs to know the VMBus root device, and it is private. Provide a function that returns it. Rename it from "hv_dev" as "hv_dev" as a symbol is very overloaded. No functional changes. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Link: https://lore.kernel.org/r/20250428210742.435282-10-romank@linux.microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org> Message-ID: <20250428210742.435282-10-romank@linux.microsoft.com>
1 parent 1dc5df1 commit 18a34bb

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

drivers/hv/vmbus_drv.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ struct vmbus_dynid {
4545
struct hv_vmbus_device_id id;
4646
};
4747

48-
static struct device *hv_dev;
48+
/* VMBus Root Device */
49+
static struct device *vmbus_root_device;
4950

5051
static int hyperv_cpuhp_online;
5152

@@ -80,9 +81,15 @@ static struct resource *fb_mmio;
8081
static struct resource *hyperv_mmio;
8182
static DEFINE_MUTEX(hyperv_mmio_lock);
8283

84+
struct device *hv_get_vmbus_root_device(void)
85+
{
86+
return vmbus_root_device;
87+
}
88+
EXPORT_SYMBOL_GPL(hv_get_vmbus_root_device);
89+
8390
static int vmbus_exists(void)
8491
{
85-
if (hv_dev == NULL)
92+
if (vmbus_root_device == NULL)
8693
return -ENODEV;
8794

8895
return 0;
@@ -861,7 +868,7 @@ static int vmbus_dma_configure(struct device *child_device)
861868
* On x86/x64 coherence is assumed and these calls have no effect.
862869
*/
863870
hv_setup_dma_ops(child_device,
864-
device_get_dma_attr(hv_dev) == DEV_DMA_COHERENT);
871+
device_get_dma_attr(vmbus_root_device) == DEV_DMA_COHERENT);
865872
return 0;
866873
}
867874

@@ -2037,7 +2044,7 @@ int vmbus_device_register(struct hv_device *child_device_obj)
20372044
&child_device_obj->channel->offermsg.offer.if_instance);
20382045

20392046
child_device_obj->device.bus = &hv_bus;
2040-
child_device_obj->device.parent = hv_dev;
2047+
child_device_obj->device.parent = vmbus_root_device;
20412048
child_device_obj->device.release = vmbus_device_release;
20422049

20432050
child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
@@ -2412,7 +2419,7 @@ static int vmbus_acpi_add(struct platform_device *pdev)
24122419
struct acpi_device *ancestor;
24132420
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
24142421

2415-
hv_dev = &device->dev;
2422+
vmbus_root_device = &device->dev;
24162423

24172424
/*
24182425
* Older versions of Hyper-V for ARM64 fail to include the _CCA
@@ -2498,7 +2505,7 @@ static int vmbus_device_add(struct platform_device *pdev)
24982505
struct device_node *np = pdev->dev.of_node;
24992506
int ret;
25002507

2501-
hv_dev = &pdev->dev;
2508+
vmbus_root_device = &pdev->dev;
25022509

25032510
ret = of_range_parser_init(&parser, np);
25042511
if (ret)
@@ -2816,7 +2823,7 @@ static int __init hv_acpi_init(void)
28162823
if (ret)
28172824
return ret;
28182825

2819-
if (!hv_dev) {
2826+
if (!vmbus_root_device) {
28202827
ret = -ENODEV;
28212828
goto cleanup;
28222829
}
@@ -2847,7 +2854,7 @@ static int __init hv_acpi_init(void)
28472854

28482855
cleanup:
28492856
platform_driver_unregister(&vmbus_platform_driver);
2850-
hv_dev = NULL;
2857+
vmbus_root_device = NULL;
28512858
return ret;
28522859
}
28532860

include/linux/hyperv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,8 @@ static inline void *hv_get_drvdata(struct hv_device *dev)
12831283
return dev_get_drvdata(&dev->device);
12841284
}
12851285

1286+
struct device *hv_get_vmbus_root_device(void);
1287+
12861288
struct hv_ring_buffer_debug_info {
12871289
u32 current_interrupt_mask;
12881290
u32 current_read_index;

0 commit comments

Comments
 (0)