[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v18 4/6] KVM: Move hwpoison page related functions
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h |
Date: |
Fri, 27 Sep 2019 14:19:32 +0100 |
On Fri, 6 Sep 2019 at 09:33, Xiang Zheng <address@hidden> wrote:
>
> From: Dongjiu Geng <address@hidden>
>
> kvm_hwpoison_page_add() and kvm_unpoison_all() will both be used by X86
> and ARM platforms, so moving them into "include/sysemu/kvm_int.h" to
> avoid duplicate code.
>
> Signed-off-by: Dongjiu Geng <address@hidden>
> Signed-off-by: Xiang Zheng <address@hidden>
> ---
> accel/kvm/kvm-all.c | 33 +++++++++++++++++++++++++++++++++
> include/sysemu/kvm_int.h | 23 +++++++++++++++++++++++
> target/arm/kvm.c | 3 +++
> target/i386/kvm.c | 34 ----------------------------------
> 4 files changed, 59 insertions(+), 34 deletions(-)
> static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
> {
> #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
> diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
> index 72b2d1b3ae..3ad49f9a28 100644
> --- a/include/sysemu/kvm_int.h
> +++ b/include/sysemu/kvm_int.h
> @@ -41,4 +41,27 @@ typedef struct KVMMemoryListener {
> void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
> AddressSpace *as, int as_id);
>
> +/**
> + * kvm_hwpoison_page_add:
> + *
> + * Parameters:
> + * @ram_addr: the address in the RAM for the poisoned page
> + *
> + * Add a poisoned page to the list
> + *
> + * Return: None.
> + */
> +void kvm_hwpoison_page_add(ram_addr_t ram_addr);
> +
> +/**
> + * kvm_unpoison_all:
> + *
> + * Parameters:
> + * @param: some data may be passed to this function
> + *
> + * Free and remove all the poisoned pages in the list
> + *
> + * Return: None.
> + */
> +void kvm_unpoison_all(void *param);
> #endif
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index b2eaa50b8d..3a110be7b8 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -20,6 +20,7 @@
> #include "sysemu/sysemu.h"
> #include "sysemu/kvm.h"
> #include "sysemu/kvm_int.h"
> +#include "sysemu/reset.h"
> #include "kvm_arm.h"
> #include "cpu.h"
> #include "trace.h"
> @@ -195,6 +196,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>
> cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>
> + qemu_register_reset(kvm_unpoison_all, NULL);
> +
Rather than registering the same reset handler in
all the architectures, we could register it in the
generic kvm_init() function. (For architectures that
don't use the poison-list functionality the reset handler
will harmlessly do nothing, because there will be nothing
in the list.)
This would allow you to not have to make the
kvm_unpoison_all() function global -- it can be static
in accel/tcg/kvm-all.c.
> return 0;
> }
thanks
-- PMM
- [Qemu-devel] [PATCH v18 0/6] Add ARMv8 RAS virtualization support in QEMU, Xiang Zheng, 2019/09/06
- [Qemu-devel] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h, Xiang Zheng, 2019/09/06
- Re: [Qemu-arm] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h,
Peter Maydell <=
- [Qemu-devel] [PATCH v18 1/6] hw/arm/virt: Introduce RAS platform version and RAS machine option, Xiang Zheng, 2019/09/06
- [Qemu-devel] [PATCH v18 2/6] docs: APEI GHES generation and CPER record description, Xiang Zheng, 2019/09/06
- [Qemu-devel] [PATCH v18 5/6] target-arm: kvm64: inject synchronous External Abort, Xiang Zheng, 2019/09/06
- [Qemu-devel] [PATCH v18 6/6] target-arm: kvm64: handle SIGBUS signal from kernel or KVM, Xiang Zheng, 2019/09/06