mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 18:06:50 +00:00
lx_emul(x86): shadow cpu_relax to advance jiffies
The i2c code has a busy loop (see commit for the location), which expects that the jiffies advances without a cooperative scheduling decision. Issue #4450
This commit is contained in:
parent
18c5f1e90d
commit
00479aea29
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* \brief Shadow copy of asm/vdso/processor.h
|
||||
* \author Alexander Boettcher
|
||||
* \date 2022-03-23
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef __ASM_VDSO_PROCESSOR_H
|
||||
#define __ASM_VDSO_PROCESSOR_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
extern u64 jiffies_64;
|
||||
|
||||
|
||||
static __always_inline void rep_nop(void)
|
||||
{
|
||||
asm volatile("rep; nop" ::: "memory");
|
||||
}
|
||||
|
||||
|
||||
static __always_inline void cpu_relax(void)
|
||||
{
|
||||
/* break busy loop of slchi() in drivers/i2c/algos/i2c-algo-bit.c */
|
||||
u64 const us = jiffies_to_usecs(1);
|
||||
usleep_range(us, us);
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_VDSO_PROCESSOR_H */
|
@ -6,6 +6,8 @@ TARGET := pc_intel_fb_drv
|
||||
LIBS := base pc_lx_emul blit
|
||||
|
||||
INC_DIR += $(REL_PRG_DIR)
|
||||
INC_DIR += $(REL_PRG_DIR)/shadow
|
||||
|
||||
SRC_CC += main.cc
|
||||
SRC_CC += misc.cc
|
||||
SRC_CC += time.cc
|
||||
|
Loading…
x
Reference in New Issue
Block a user