mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-06 08:04:55 +00:00
HV:treewide:C99-friendly per_cpu implementation change the per_cpu method
The current implementation of per_cpu relies on several non-c99 features, and in additional involves arbitrary pointer arithmetic which is not MIS- RA C friendly. This patch introduces struct per_cpu_region which holds all the per_cpu variables. Allocation of per_cpu data regions and access to per_cpu vari- ables are greatly simplified, at the cost of making all per_cpu varaibl- es accessible in files. Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
This commit is contained in:
@@ -5,23 +5,13 @@
|
||||
*/
|
||||
|
||||
#include <hypervisor.h>
|
||||
|
||||
#define LOG_ENTRY_SIZE 80
|
||||
|
||||
/* Size of buffer used to store a message being logged,
|
||||
* should align to LOG_ENTRY_SIZE.
|
||||
*/
|
||||
#define LOG_MESSAGE_MAX_SIZE (4 * LOG_ENTRY_SIZE)
|
||||
|
||||
#include <per_cpu.h>
|
||||
/* buf size should be identical to the size in hvlog option, which is
|
||||
* transfered to SOS:
|
||||
* bsp/uefi/clearlinux/acrn.conf: hvlog=2M@0x1FE00000
|
||||
*/
|
||||
#define HVLOG_BUF_SIZE (2*1024*1024)
|
||||
|
||||
DEFINE_CPU_DATA(char [LOG_MESSAGE_MAX_SIZE], logbuf);
|
||||
DEFINE_CPU_DATA(struct shared_buf *, earlylog_sbuf);
|
||||
|
||||
struct logmsg {
|
||||
uint32_t flags;
|
||||
int seq;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#include <hypervisor.h>
|
||||
|
||||
DEFINE_CPU_DATA(uint64_t * [ACRN_SBUF_ID_MAX], sbuf);
|
||||
|
||||
static inline bool sbuf_is_empty(struct shared_buf *sbuf)
|
||||
{
|
||||
return (sbuf->head == sbuf->tail);
|
||||
|
||||
Reference in New Issue
Block a user