Skip to contentSkip to conversation

x86: hyper-v: expose hv_hypercall() from hyperv.h

PATCH In review Siddharth Chandrasekaran 2 participants 4 messages Jun 10, 2021 KVM

lore
Share & tools
lore
#0 lore raw

cover x86: hyper-v: expose hv_hypercall() from hyperv.h

Couple of minor patches that promote hyperv.h to lib/x86 and expose hv_hypercall() from there so other tests can use do hypercalls too.

~ Sid.

Siddharth Chandrasekaran (2):
x86: Move hyperv helpers into libs/x86
x86: Move hyper-v hypercall related methods to lib/x86/

 x86/Makefile.common       |  9 +-----
 {x86 => lib/x86}/hyperv.h |  3 ++
 {x86 => lib/x86}/hyperv.c | 52 +++++++++++++++++++++++++++++++++
 x86/hyperv_connections.c  | 60 ++++-----------------------------------
 4 files changed, 61 insertions(+), 63 deletions(-)
 rename {x86 => lib/x86}/hyperv.h (98%)
 rename {x86 => lib/x86}/hyperv.c (63%)
Signature · 11 lines
2.17.1



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
#1 lore raw

PATCH 1/2 x86: Move hyperv helpers into libs/x86

Move hyperv.c and hyperv.h into into libs/x86/ as it appears to be a better place for them.

---
 x86/Makefile.common       | 9 +--------
 {x86 => lib/x86}/hyperv.h | 1 -
 {x86 => lib/x86}/hyperv.c | 0
 3 files changed, 1 insertion(+), 9 deletions(-)
 rename {x86 => lib/x86}/hyperv.h (99%)
 rename {x86 => lib/x86}/hyperv.c (100%)
x86/Makefile.common +1 -8
index 85dc427..118c1c8 100644
@@ -22,6 +22,7 @@ cflatobjs += lib/x86/acpi.o
 cflatobjs += lib/x86/stack.o
 cflatobjs += lib/x86/fault_test.o
 cflatobjs += lib/x86/delay.o
+cflatobjs += lib/x86/hyperv.o
 
 OBJDIRS += lib/x86
 
@@ -77,14 +78,6 @@ $(TEST_DIR)/realmode.o: bits = $(if $(call cc-option,-m16,""),16,32)
 
 $(TEST_DIR)/kvmclock_test.elf: $(TEST_DIR)/kvmclock.o
 
-$(TEST_DIR)/hyperv_synic.elf: $(TEST_DIR)/hyperv.o
-
-$(TEST_DIR)/hyperv_stimer.elf: $(TEST_DIR)/hyperv.o
-
-$(TEST_DIR)/hyperv_connections.elf: $(TEST_DIR)/hyperv.o
-
-$(TEST_DIR)/hyperv_overlay.elf: $(TEST_DIR)/hyperv.o
-
 arch_clean:
 	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \
 	$(TEST_DIR)/.*.d lib/x86/.*.d \
lib/x86/hyperv.h renamed from x86/hyperv.h +0 -1
similarity index 99%
rename from x86/hyperv.h
rename to lib/x86/hyperv.h
index 6f69c29..bb4bd84 100644
@@ -214,5 +214,4 @@ struct hv_reference_tsc_page {
         int64_t tsc_offset;
 };
 
-
 #endif
lib/x86/hyperv.c renamed from x86/hyperv.c +0 -0
similarity index 100%
rename from x86/hyperv.c
rename to lib/x86/hyperv.c
Signature · 12 lines
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
#2 lore raw

PATCH 2/2 x86: Move hyper-v hypercall related methods to lib/x86/

In reply to Siddharth Chandrasekaran

Some future tests that we are about to write need to perform hypercalls; move do_hypercall() and hypercall page setup methods to a more accessible location: libs/x86/hyperv.c.

---
 lib/x86/hyperv.h         |  4 +++
 lib/x86/hyperv.c         | 52 ++++++++++++++++++++++++++++++++++
 x86/hyperv_connections.c | 60 ++++------------------------------------
 3 files changed, 61 insertions(+), 55 deletions(-)
lib/x86/hyperv.h +4 -0
index bb4bd84..fc4603b 100644
@@ -214,4 +214,8 @@ struct hv_reference_tsc_page {
         int64_t tsc_offset;
 };
 
+void hv_setup_hypercall(void);
+void hv_teardown_hypercall(void);
+u64 hv_hypercall(u16 code, u64 arg, bool fast);
+
 #endif
lib/x86/hyperv.c +52 -0

61 lines not on this page · raw message

x86/hyperv_connections.c +5 -55

91 lines not on this page · raw message

Signature · 12 lines
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
maintainer
#3 lore raw
In reply to Siddharth Chandrasekaran
Quoted 9 lines · Siddharth Chandrasekaran

Couple of minor patches that promote hyperv.h to lib/x86 and expose hv_hypercall() from there so other tests can use do hypercalls too.

~ Sid.

Siddharth Chandrasekaran (2):
x86: Move hyperv helpers into libs/x86
x86: Move hyper-v hypercall related methods to lib/x86/

Quoted 8 lines
  x86/Makefile.common       |  9 +-----
  {x86 => lib/x86}/hyperv.h |  3 ++
  {x86 => lib/x86}/hyperv.c | 52 +++++++++++++++++++++++++++++++++
  x86/hyperv_connections.c  | 60 ++++-----------------------------------
  4 files changed, 61 insertions(+), 63 deletions(-)

rename {x86 => lib/x86}/hyperv.h (98%)
rename {x86 => lib/x86}/hyperv.c (63%)

Please base the overlay test on this patch instead of the other way round, thanks! (You can send them in a single series).

Paolo