Skip to content

Commit 86e38e8

Browse files
authored
Add patches for irqchip creation from Hedge (#71)
Signed-off-by: Charalampos Mainas <[email protected]>
1 parent 9dd572f commit 86e38e8

2 files changed

+246
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
From 6dafa5c894aad5ae0b531938cf43d64ee7219854 Mon Sep 17 00:00:00 2001
2+
From: Charalampos Mainas <[email protected]>
3+
Date: Tue, 29 Aug 2023 18:03:33 +0300
4+
Subject: [PATCH] Export additional functions to create irqchip in KVM
5+
6+
This patch exposes the necessary functions that are needed from Hedge,
7+
in order to create an irqchip, using KVM's API.
8+
9+
Signed-off-by: Charalampos Mainas <[email protected]>
10+
---
11+
arch/x86/kvm/i8254.c | 6 ++++++
12+
arch/x86/kvm/i8259.c | 12 ++++++++++++
13+
arch/x86/kvm/ioapic.c | 12 ++++++++++++
14+
arch/x86/kvm/irq_comm.c | 6 ++++++
15+
arch/x86/kvm/x86.c | 1 +
16+
5 files changed, 37 insertions(+)
17+
18+
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
19+
index febca334c..6816bd064 100644
20+
--- a/arch/x86/kvm/i8254.c
21+
+++ b/arch/x86/kvm/i8254.c
22+
@@ -731,6 +731,12 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
23+
return NULL;
24+
}
25+
26+
+struct kvm_pit *hedge_kvm_create_pit(struct kvm *kvm, u32 flags)
27+
+{
28+
+ return kvm_create_pit(kvm, flags);
29+
+}
30+
+EXPORT_SYMBOL(hedge_kvm_create_pit);
31+
+
32+
void kvm_free_pit(struct kvm *kvm)
33+
{
34+
struct kvm_pit *pit = kvm->arch.vpit;
35+
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
36+
index 629a09ca9..196279813 100644
37+
--- a/arch/x86/kvm/i8259.c
38+
+++ b/arch/x86/kvm/i8259.c
39+
@@ -637,6 +637,12 @@ int kvm_pic_init(struct kvm *kvm)
40+
return ret;
41+
}
42+
43+
+int hedge_kvm_pic_init(struct kvm *kvm)
44+
+{
45+
+ return kvm_pic_init(kvm);
46+
+}
47+
+EXPORT_SYMBOL(hedge_kvm_pic_init);
48+
+
49+
void kvm_pic_destroy(struct kvm *kvm)
50+
{
51+
struct kvm_pic *vpic = kvm->arch.vpic;
52+
@@ -653,3 +659,9 @@ void kvm_pic_destroy(struct kvm *kvm)
53+
kvm->arch.vpic = NULL;
54+
kfree(vpic);
55+
}
56+
+
57+
+void hedge_kvm_pic_destroy(struct kvm *kvm)
58+
+{
59+
+ kvm_pic_destroy(kvm);
60+
+}
61+
+EXPORT_SYMBOL(hedge_kvm_pic_destroy);
62+
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
63+
index d057376bd..ffdfa7684 100644
64+
--- a/arch/x86/kvm/ioapic.c
65+
+++ b/arch/x86/kvm/ioapic.c
66+
@@ -711,6 +711,12 @@ int kvm_ioapic_init(struct kvm *kvm)
67+
return ret;
68+
}
69+
70+
+int hedge_kvm_ioapic_init(struct kvm *kvm)
71+
+{
72+
+ return kvm_ioapic_init(kvm);
73+
+}
74+
+EXPORT_SYMBOL(hedge_kvm_ioapic_init);
75+
+
76+
void kvm_ioapic_destroy(struct kvm *kvm)
77+
{
78+
struct kvm_ioapic *ioapic = kvm->arch.vioapic;
79+
@@ -726,6 +732,12 @@ void kvm_ioapic_destroy(struct kvm *kvm)
80+
kfree(ioapic);
81+
}
82+
83+
+void hedge_kvm_ioapic_destroy(struct kvm *kvm)
84+
+{
85+
+ kvm_ioapic_destroy(kvm);
86+
+}
87+
+EXPORT_SYMBOL(hedge_kvm_ioapic_destroy);
88+
+
89+
void kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state)
90+
{
91+
struct kvm_ioapic *ioapic = kvm->arch.vioapic;
92+
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
93+
index c47d2acec..561f9c8b4 100644
94+
--- a/arch/x86/kvm/irq_comm.c
95+
+++ b/arch/x86/kvm/irq_comm.c
96+
@@ -381,6 +381,12 @@ int kvm_setup_default_irq_routing(struct kvm *kvm)
97+
ARRAY_SIZE(default_routing), 0);
98+
}
99+
100+
+int hedge_kvm_setup_default_irq_routing(struct kvm *kvm)
101+
+{
102+
+ return kvm_setup_default_irq_routing(kvm);
103+
+}
104+
+EXPORT_SYMBOL(hedge_kvm_setup_default_irq_routing);
105+
+
106+
static const struct kvm_irq_routing_entry empty_routing[] = {};
107+
108+
int kvm_setup_empty_irq_routing(struct kvm *kvm)
109+
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
110+
index 924a1ffb9..8ea73933e 100644
111+
--- a/arch/x86/kvm/x86.c
112+
+++ b/arch/x86/kvm/x86.c
113+
@@ -3446,6 +3446,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
114+
return r;
115+
116+
}
117+
+EXPORT_SYMBOL(kvm_vm_ioctl_check_extension);
118+
119+
long kvm_arch_dev_ioctl(struct file *filp,
120+
unsigned int ioctl, unsigned long arg)
121+
--
122+
2.40.1
123+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
From 51225be222c4cc8df99c0305b9d2330bd99b25a0 Mon Sep 17 00:00:00 2001
2+
From: Charalampos Mainas <[email protected]>
3+
Date: Fri, 14 Jul 2023 18:09:17 +0300
4+
Subject: [PATCH] Export additional functions to create irqchip in KVM
5+
6+
This patch exposes the necessary functions that are needed from Hedge,
7+
in order to create an irqchip, using KVM's API.
8+
9+
Signed-off-by: Charalampos Mainas <[email protected]>
10+
---
11+
arch/x86/kvm/i8254.c | 6 ++++++
12+
arch/x86/kvm/i8259.c | 12 ++++++++++++
13+
arch/x86/kvm/ioapic.c | 12 ++++++++++++
14+
arch/x86/kvm/irq_comm.c | 6 ++++++
15+
arch/x86/kvm/x86.c | 1 +
16+
5 files changed, 37 insertions(+)
17+
18+
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
19+
index a6e218c61..86b9d9d0d 100644
20+
--- a/arch/x86/kvm/i8254.c
21+
+++ b/arch/x86/kvm/i8254.c
22+
@@ -730,6 +730,12 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
23+
return NULL;
24+
}
25+
26+
+struct kvm_pit *hedge_kvm_create_pit(struct kvm *kvm, u32 flags)
27+
+{
28+
+ return kvm_create_pit(kvm, flags);
29+
+}
30+
+EXPORT_SYMBOL(hedge_kvm_create_pit);
31+
+
32+
void kvm_free_pit(struct kvm *kvm)
33+
{
34+
struct kvm_pit *pit = kvm->arch.vpit;
35+
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
36+
index 629a09ca9..196279813 100644
37+
--- a/arch/x86/kvm/i8259.c
38+
+++ b/arch/x86/kvm/i8259.c
39+
@@ -637,6 +637,12 @@ int kvm_pic_init(struct kvm *kvm)
40+
return ret;
41+
}
42+
43+
+int hedge_kvm_pic_init(struct kvm *kvm)
44+
+{
45+
+ return kvm_pic_init(kvm);
46+
+}
47+
+EXPORT_SYMBOL(hedge_kvm_pic_init);
48+
+
49+
void kvm_pic_destroy(struct kvm *kvm)
50+
{
51+
struct kvm_pic *vpic = kvm->arch.vpic;
52+
@@ -653,3 +659,9 @@ void kvm_pic_destroy(struct kvm *kvm)
53+
kvm->arch.vpic = NULL;
54+
kfree(vpic);
55+
}
56+
+
57+
+void hedge_kvm_pic_destroy(struct kvm *kvm)
58+
+{
59+
+ kvm_pic_destroy(kvm);
60+
+}
61+
+EXPORT_SYMBOL(hedge_kvm_pic_destroy);
62+
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
63+
index d057376bd..ffdfa7684 100644
64+
--- a/arch/x86/kvm/ioapic.c
65+
+++ b/arch/x86/kvm/ioapic.c
66+
@@ -711,6 +711,12 @@ int kvm_ioapic_init(struct kvm *kvm)
67+
return ret;
68+
}
69+
70+
+int hedge_kvm_ioapic_init(struct kvm *kvm)
71+
+{
72+
+ return kvm_ioapic_init(kvm);
73+
+}
74+
+EXPORT_SYMBOL(hedge_kvm_ioapic_init);
75+
+
76+
void kvm_ioapic_destroy(struct kvm *kvm)
77+
{
78+
struct kvm_ioapic *ioapic = kvm->arch.vioapic;
79+
@@ -726,6 +732,12 @@ void kvm_ioapic_destroy(struct kvm *kvm)
80+
kfree(ioapic);
81+
}
82+
83+
+void hedge_kvm_ioapic_destroy(struct kvm *kvm)
84+
+{
85+
+ kvm_ioapic_destroy(kvm);
86+
+}
87+
+EXPORT_SYMBOL(hedge_kvm_ioapic_destroy);
88+
+
89+
void kvm_get_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state)
90+
{
91+
struct kvm_ioapic *ioapic = kvm->arch.vioapic;
92+
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
93+
index c47d2acec..561f9c8b4 100644
94+
--- a/arch/x86/kvm/irq_comm.c
95+
+++ b/arch/x86/kvm/irq_comm.c
96+
@@ -381,6 +381,12 @@ int kvm_setup_default_irq_routing(struct kvm *kvm)
97+
ARRAY_SIZE(default_routing), 0);
98+
}
99+
100+
+int hedge_kvm_setup_default_irq_routing(struct kvm *kvm)
101+
+{
102+
+ return kvm_setup_default_irq_routing(kvm);
103+
+}
104+
+EXPORT_SYMBOL(hedge_kvm_setup_default_irq_routing);
105+
+
106+
static const struct kvm_irq_routing_entry empty_routing[] = {};
107+
108+
int kvm_setup_empty_irq_routing(struct kvm *kvm)
109+
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
110+
index 770d9fc0f..8c17063a4 100644
111+
--- a/arch/x86/kvm/x86.c
112+
+++ b/arch/x86/kvm/x86.c
113+
@@ -3544,6 +3544,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
114+
return r;
115+
116+
}
117+
+EXPORT_SYMBOL(kvm_vm_ioctl_check_extension);
118+
119+
long kvm_arch_dev_ioctl(struct file *filp,
120+
unsigned int ioctl, unsigned long arg)
121+
--
122+
2.40.1
123+

0 commit comments

Comments
 (0)