diff mbox series

[RFC,v1,09/10] target/loongarch: Add kvm-stub.c

Message ID 20230420093606.3366969-10-zhaotianrui@loongson.cn (mailing list archive)
State New, archived
Headers show
Series Add loongarch kvm accel support | expand

Commit Message

zhaotianrui April 20, 2023, 9:36 a.m. UTC
Add kvm-stub.c for loongarch, there are two stub functions:
kvm_loongarch_reset_vcpu and kvm_loongarch_set_interrupt.

Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
---
 target/loongarch/kvm-stub.c      | 17 +++++++++++++++++
 target/loongarch/kvm_loongarch.h |  1 +
 2 files changed, 18 insertions(+)
 create mode 100644 target/loongarch/kvm-stub.c

Comments

Philippe Mathieu-Daudé April 20, 2023, 10:04 a.m. UTC | #1
On 20/4/23 11:36, Tianrui Zhao wrote:
> Add kvm-stub.c for loongarch, there are two stub functions:
> kvm_loongarch_reset_vcpu and kvm_loongarch_set_interrupt.
> 
> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
> ---
>   target/loongarch/kvm-stub.c      | 17 +++++++++++++++++
>   target/loongarch/kvm_loongarch.h |  1 +
>   2 files changed, 18 insertions(+)
>   create mode 100644 target/loongarch/kvm-stub.c
> 
> diff --git a/target/loongarch/kvm-stub.c b/target/loongarch/kvm-stub.c
> new file mode 100644
> index 0000000000..e28827ee07
> --- /dev/null
> +++ b/target/loongarch/kvm-stub.c
> @@ -0,0 +1,17 @@
> +/*
> + * QEMU KVM LoongArch specific function stubs
> + *
> + * Copyright (c) 2023 Loongson Technology Corporation Limited
> + */
> +#include "qemu/osdep.h"
> +#include "cpu.h"
> +
> +void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu)

Where is kvm_loongarch_reset_vcpu() called?

> +{
> +    abort();
> +}
> +
> +void kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level)
> +{
> +    abort();

Please use g_assert_not_reached() which display more useful informations.

> +}

Add this stub in the previous patch "Implement set vcpu intr for kvm".

> diff --git a/target/loongarch/kvm_loongarch.h b/target/loongarch/kvm_loongarch.h
> index cdef980eec..c03f4bef0f 100644
> --- a/target/loongarch/kvm_loongarch.h
> +++ b/target/loongarch/kvm_loongarch.h
> @@ -8,6 +8,7 @@
>   #ifndef QEMU_KVM_LOONGARCH_H
>   #define QEMU_KVM_LOONGARCH_H
>   
> +void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu);
>   int  kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level);
>   
>   #endif
zhaotianrui April 20, 2023, 11:13 a.m. UTC | #2
在 2023年04月20日 18:04, Philippe Mathieu-Daudé 写道:
> On 20/4/23 11:36, Tianrui Zhao wrote:
>> Add kvm-stub.c for loongarch, there are two stub functions:
>> kvm_loongarch_reset_vcpu and kvm_loongarch_set_interrupt.
>>
>> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
>> ---
>>   target/loongarch/kvm-stub.c      | 17 +++++++++++++++++
>>   target/loongarch/kvm_loongarch.h |  1 +
>>   2 files changed, 18 insertions(+)
>>   create mode 100644 target/loongarch/kvm-stub.c
>>
>> diff --git a/target/loongarch/kvm-stub.c b/target/loongarch/kvm-stub.c
>> new file mode 100644
>> index 0000000000..e28827ee07
>> --- /dev/null
>> +++ b/target/loongarch/kvm-stub.c
>> @@ -0,0 +1,17 @@
>> +/*
>> + * QEMU KVM LoongArch specific function stubs
>> + *
>> + * Copyright (c) 2023 Loongson Technology Corporation Limited
>> + */
>> +#include "qemu/osdep.h"
>> +#include "cpu.h"
>> +
>> +void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu)
>
> Where is kvm_loongarch_reset_vcpu() called?
Thanks and nowhere called this function, I will remove it.

Thanks
Tianrui Zhao
>
>> +{
>> +    abort();
>> +}
>> +
>> +void kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level)
>> +{
>> +    abort();
>
> Please use g_assert_not_reached() which display more useful informations.
Thanks, I will use the g_assert_not_reached() to replace it.

Thanks
Tianrui Zhao
>
>> +}
>
> Add this stub in the previous patch "Implement set vcpu intr for kvm".
Thanks, I will move this stub function into previous patch "Implement 
set vcpu intr for kvm".

Thanks
Tianrui Zhao
>
>> diff --git a/target/loongarch/kvm_loongarch.h 
>> b/target/loongarch/kvm_loongarch.h
>> index cdef980eec..c03f4bef0f 100644
>> --- a/target/loongarch/kvm_loongarch.h
>> +++ b/target/loongarch/kvm_loongarch.h
>> @@ -8,6 +8,7 @@
>>   #ifndef QEMU_KVM_LOONGARCH_H
>>   #define QEMU_KVM_LOONGARCH_H
>>   +void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu);
>>   int  kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int 
>> level);
>>     #endif
diff mbox series

Patch

diff --git a/target/loongarch/kvm-stub.c b/target/loongarch/kvm-stub.c
new file mode 100644
index 0000000000..e28827ee07
--- /dev/null
+++ b/target/loongarch/kvm-stub.c
@@ -0,0 +1,17 @@ 
+/*
+ * QEMU KVM LoongArch specific function stubs
+ *
+ * Copyright (c) 2023 Loongson Technology Corporation Limited
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+
+void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu)
+{
+    abort();
+}
+
+void kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level)
+{
+    abort();
+}
diff --git a/target/loongarch/kvm_loongarch.h b/target/loongarch/kvm_loongarch.h
index cdef980eec..c03f4bef0f 100644
--- a/target/loongarch/kvm_loongarch.h
+++ b/target/loongarch/kvm_loongarch.h
@@ -8,6 +8,7 @@ 
 #ifndef QEMU_KVM_LOONGARCH_H
 #define QEMU_KVM_LOONGARCH_H
 
+void kvm_loongarch_reset_vcpu(LoongArchCPU *cpu);
 int  kvm_loongarch_set_interrupt(LoongArchCPU *cpu, int irq, int level);
 
 #endif