Re: [PATCH] HV: move AP_MASK to cpu.h


Eddie Dong
 

If this one is only used in cpu.c, do we need to move the the header file?

-----Original Message-----
From: acrn-dev@... [mailto:acrn-dev@...]
On Behalf Of Kaige Fu
Sent: Tuesday, April 23, 2019 7:12 PM
To: acrn-dev@...
Subject: [acrn-dev] [PATCH] HV: move AP_MASK to cpu.h

It is better to use an unified MACRO. So, this patch moves AP_MASK to cpu.h
and removes the defination of the MACRO spanning different source files.

Signed-off-by: Kaige Fu <kaige.fu@...>
---
hypervisor/arch/x86/cpu.c | 2 --
hypervisor/arch/x86/pm.c | 2 --
hypervisor/include/arch/x86/cpu.h | 2 ++
3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index
9bea1a47..6a8d6a0b 100644
--- a/hypervisor/arch/x86/cpu.c
+++ b/hypervisor/arch/x86/cpu.c
@@ -30,8 +30,6 @@
#define CPU_UP_TIMEOUT 100U /* millisecond */
#define CPU_DOWN_TIMEOUT 100U /* millisecond */

-#define AP_MASK (((1UL << phys_cpu_num) - 1UL) & ~(1UL << 0U))
-
struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM]
__aligned(PAGE_SIZE); static uint16_t phys_cpu_num = 0U; static uint64_t
pcpu_sync = 0UL; diff --git a/hypervisor/arch/x86/pm.c
b/hypervisor/arch/x86/pm.c index 019d8cdd..f8c1e6de 100644
--- a/hypervisor/arch/x86/pm.c
+++ b/hypervisor/arch/x86/pm.c
@@ -20,8 +20,6 @@
#include <lapic.h>
#include <vcpu.h>

-#define AP_MASK (((1UL << get_pcpu_nums()) - 1UL) & ~(1UL << 0U))
-
struct cpu_context cpu_ctx;

/* The values in this structure should come from host ACPI table */ diff --git
a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h
index 276a4edc..621ebf9f 100644
--- a/hypervisor/include/arch/x86/cpu.h
+++ b/hypervisor/include/arch/x86/cpu.h
@@ -139,6 +139,8 @@

#define BUS_LOCK "lock ; "

+#define AP_MASK (((1UL << get_pcpu_nums()) - 1UL) & ~(1UL <<
0U))
+
/**
*
* Identifiers for architecturally defined registers.
--
2.20.0


Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.