Skip to contentSkip to conversation

hyperv: factor out arch-independent API into hw/hyperv

PATCH Paolo Bonzini 2 participants 4 messages Oct 3, 2018 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 10 lines · Roman Kagan

A significant part of hyperv.c is not actually tied to x86, and can be moved to hw/.

This will allow to maintain most of Hyper-V and VMBus target-independent, and to avoid conflicts with inclusion of arch-specific headers down the road in VMBus implementation.

Also this stuff can now be opt-out with CONFIG_HYPERV.

We can squash this in too:

hw/Makefile.objs +1 -1
index b8f4675219..30722ccf98 100644
@@ -9,7 +9,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += cpu/
 devices-dirs-$(CONFIG_SOFTMMU) += display/
 devices-dirs-$(CONFIG_SOFTMMU) += dma/
 devices-dirs-$(CONFIG_SOFTMMU) += gpio/
-devices-dirs-$(CONFIG_SOFTMMU) += hyperv/
+devices-dirs-$(CONFIG_HYPERV) += hyperv/
 devices-dirs-$(CONFIG_SOFTMMU) += i2c/
 devices-dirs-$(CONFIG_SOFTMMU) += ide/
 devices-dirs-$(CONFIG_SOFTMMU) += input/
hw/hyperv/Makefile.objs +2 -1
index 19928b726e..edaca2f763 100644
@@ -1 +1,2 @@
-obj-$(CONFIG_HYPERV) += hyperv.o
+obj-y += hyperv.o
+obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
hw/hyperv/hyperv_testdev.c renamed from hw/misc/hyperv_testdev.c +0 -0
similarity index 100%
rename from hw/misc/hyperv_testdev.c
rename to hw/hyperv/hyperv_testdev.c
hw/misc/Makefile.objs +0 -1
index 6d50b03cfd..680350b3c3 100644
@@ -71,7 +71,6 @@ obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o
 obj-$(CONFIG_IOTKIT_SYSINFO) += iotkit-sysinfo.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
-obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
 obj-$(CONFIG_MSF2) += msf2-sysreg.o

Paolo

#3 lore raw
Quoted 18 lines · Paolo Bonzini
Quoted 10 lines · Roman Kagan

A significant part of hyperv.c is not actually tied to x86, and can be moved to hw/.

This will allow to maintain most of Hyper-V and VMBus target-independent, and to avoid conflicts with inclusion of arch-specific headers down the road in VMBus implementation.

Also this stuff can now be opt-out with CONFIG_HYPERV.

We can squash this in too:

hw/Makefile.objs +0 -0
index b8f4675219..30722ccf98 100644

...

Quoted 2 lines
hw/Makefile.objs +1 -1
-devices-dirs-$(CONFIG_SOFTMMU) += hyperv/
+devices-dirs-$(CONFIG_HYPERV) += hyperv/

...

Quoted 2 lines
hw/hyperv/Makefile.objs +0 -0

...

hw/hyperv/Makefile.objs line 1

Quoted 2 lines
hw/hyperv/Makefile.objs +1 -1
-obj-$(CONFIG_HYPERV) += hyperv.o
+obj-y += hyperv.o

Actually I did it this way at first, but then decided to follow the pattern of virtio/, xen/, and most other subdirectories there just for consistency. Is there any preference for this?

Quoted 10 lines
hw/hyperv/Makefile.objs +1 -0
+obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
hw/hyperv/hyperv_testdev.c renamed from hw/misc/hyperv_testdev.c +0 -0
similarity index 100%
rename from hw/misc/hyperv_testdev.c
rename to hw/hyperv/hyperv_testdev.c
hw/misc/Makefile.objs +0 -0
index 6d50b03cfd..680350b3c3 100644

hw/misc/Makefile.objs obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o · line 76

Quoted 7 lines
hw/misc/Makefile.objs +0 -1
@@ -71,7 +71,6 @@ obj-$(CONFIG_IOTKIT_SYSCTL) += iotkit-sysctl.o
 obj-$(CONFIG_IOTKIT_SYSINFO) += iotkit-sysinfo.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
-obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
 obj-$(CONFIG_MSF2) += msf2-sysreg.o

Fine by me.

Thanks,
Roman.

#4 lore raw
Quoted 26 lines · Roman Kagan
Quoted 18 lines · Paolo Bonzini
Quoted 10 lines · Roman Kagan

A significant part of hyperv.c is not actually tied to x86, and can be moved to hw/.

This will allow to maintain most of Hyper-V and VMBus target-independent, and to avoid conflicts with inclusion of arch-specific headers down the road in VMBus implementation.

Also this stuff can now be opt-out with CONFIG_HYPERV.

We can squash this in too:

hw/Makefile.objs +0 -0
index b8f4675219..30722ccf98 100644

...

Quoted 2 lines
hw/Makefile.objs +1 -1
-devices-dirs-$(CONFIG_SOFTMMU) += hyperv/
+devices-dirs-$(CONFIG_HYPERV) += hyperv/

...

Quoted 2 lines
hw/hyperv/Makefile.objs +0 -0

...

Quoted 6 lines

hw/hyperv/Makefile.objs line 1

Quoted 2 lines
hw/hyperv/Makefile.objs +1 -1
-obj-$(CONFIG_HYPERV) += hyperv.o
+obj-y += hyperv.o

Actually I did it this way at first, but then decided to follow the pattern of virtio/, xen/, and most other subdirectories there just for consistency. Is there any preference for this?

It's half-and-half. For example, CONFIG_IPMI, CONFIG_SCSI, CONFIG_VIRTFS work this way.

acpi/ and virtio/ use CONFIG_SOFTMMU just because they need to compile acpi-stub.o/ipmi-stub.o/vhost-stub.o unconditionally. xen/ could be changed if one was inclined to do it.

Paolo

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [Qemu-devel] [PATCH 4/5] default-configs: collect CONFIG_HYPERV* in hyperv.mak

default-configs/hyperv.mak line 2

Quoted 8 lines · Roman Kagan
default-configs/hyperv.mak new file +2 -0
new file mode 100644
index 0000000000..3d45e28403
@@ -0,0 +1,2 @@
+CONFIG_HYPERV=$(CONFIG_KVM)
+CONFIG_HYPERV_TESTDEV=$(CONFIG_HYPERV)

By moving the test device to hy/hyperv, this can be just CONFIG_HYPERV_TESTDEV=y.

Paolo