From 948d58fb9c0b30bb4cab72c071e86cd3d0cce01c Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 16 Apr 2019 10:59:25 +0800 Subject: [PATCH] acrn-dm: enable debug option for acrn-dm enable acrn-dm debug option via RELEASE=0(by default) Tracked-On: #2939 Reviewed-by: Minggui Cao Signed-off-by: Wei Liu Acked-by: Yu Wang --- Makefile | 4 ++-- devicemodel/Makefile | 5 +++++ devicemodel/core/main.c | 2 ++ devicemodel/hw/pci/wdt_i6300esb.c | 4 ++++ devicemodel/include/vmmapi.h | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b6554baba..b11debb77 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,8 @@ sbl-hypervisor: $(MAKE) -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl/apl-up2 BOARD=apl-up2 FIRMWARE=sbl RELEASE=$(RELEASE) devicemodel: tools - $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) clean - $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) DM_ASL_COMPILER=$(ASL_COMPILER) + $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) RELEASE=$(RELEASE) clean + $(MAKE) -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) DM_ASL_COMPILER=$(ASL_COMPILER) RELEASE=$(RELEASE) tools: mkdir -p $(TOOLS_OUT) diff --git a/devicemodel/Makefile b/devicemodel/Makefile index cba0129d5..ed08ec392 100644 --- a/devicemodel/Makefile +++ b/devicemodel/Makefile @@ -9,6 +9,7 @@ DM_BUILD_VERSION ?= DM_BUILD_TAG ?= CC ?= gcc +RELEASE ?= 0 CFLAGS := -g -O0 -std=gnu11 CFLAGS += -D_GNU_SOURCE @@ -47,6 +48,10 @@ endif endif endif +ifeq ($(RELEASE),0) +CFLAGS += -DDM_DEBUG +endif + LDFLAGS += -Wl,-z,noexecstack LDFLAGS += -Wl,-z,relro,-z,now LDFLAGS += -pie diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index cfb0c0e16..2cb215815 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -322,12 +322,14 @@ delete_cpu(struct vmctx *ctx, int vcpu) return CPU_EMPTY(&cpumask); } +#ifdef DM_DEBUG void notify_vmloop_thread(void) { pthread_kill(mt_vmm_info[0].mt_thr, SIGCONT); return; } +#endif static void vmexit_inout(struct vmctx *ctx, struct vhm_request *vhm_req, int *pvcpu) diff --git a/devicemodel/hw/pci/wdt_i6300esb.c b/devicemodel/hw/pci/wdt_i6300esb.c index 5397d5764..8b395843b 100644 --- a/devicemodel/hw/pci/wdt_i6300esb.c +++ b/devicemodel/hw/pci/wdt_i6300esb.c @@ -136,9 +136,13 @@ wdt_expired_handler(void *arg, uint64_t nexp) wdt_timeout = 1; /* watchdog timer out, set the uos to reboot */ +#ifdef DM_DEBUG vm_set_suspend_mode(VM_SUSPEND_SYSTEM_RESET); /* Notify vm thread to handle VM_SUSPEND_SYSTEM_RESET request */ notify_vmloop_thread(); +#else + vm_set_suspend_mode(VM_SUSPEND_FULL_RESET); +#endif mevent_notify(); } else { /* if not need reboot, just loop timer */ diff --git a/devicemodel/include/vmmapi.h b/devicemodel/include/vmmapi.h index dcc90f87a..c8248a2e5 100644 --- a/devicemodel/include/vmmapi.h +++ b/devicemodel/include/vmmapi.h @@ -101,7 +101,9 @@ int vm_attach_ioreq_client(struct vmctx *ctx); int vm_notify_request_done(struct vmctx *ctx, int vcpu); void vm_clear_ioreq(struct vmctx *ctx); void vm_set_suspend_mode(enum vm_suspend_how how); +#ifdef DM_DEBUG void notify_vmloop_thread(void); +#endif int vm_get_suspend_mode(void); void vm_destroy(struct vmctx *ctx); int vm_parse_memsize(const char *optarg, size_t *memsize);