/*1* Copyright 2018 Samy Al Bahra.2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*25* $FreeBSD: head/sys/contrib/ck/include/ck_md.h 329388 2018-02-16 17:50:06Z cog26net $27*/2829/*30* This header file is meant for use of Concurrency Kit in the FreeBSD kernel.31*/3233#ifndef CK_MD_H34#define CK_MD_H3536#include <sys/param.h>3738#ifndef _KERNEL39#error This header file is meant for the FreeBSD kernel.40#endif /* _KERNEL */4142#ifndef CK_MD_CACHELINE43/*44* FreeBSD's CACHE_LINE macro is a compile-time maximum cache-line size for an45* architecture, defined to be 128 bytes by default on x86*. Even in presence46* of adjacent sector prefetch, this doesn't make sense from a modeling47* perspective.48*/49#if defined(__amd64__) || defined(__i386__)50#define CK_MD_CACHELINE (64)51#else52#define CK_MD_CACHELINE (CACHE_LINE_SIZE)53#endif /* !__amd64__ && !__i386__ */54#endif /* CK_MD_CACHELINE */5556#ifndef CK_MD_PAGESIZE57#define CK_MD_PAGESIZE (PAGE_SIZE)58#endif5960/*61* Once FreeBSD has a mechanism to detect RTM, this can be enabled and RTM62* facilities can be called. These facilities refer to TSX.63*/64#ifndef CK_MD_RTM_DISABLE65#define CK_MD_RTM_DISABLE66#endif /* CK_MD_RTM_DISABLE */6768/*69* Do not enable pointer-packing-related (VMA) optimizations in kernel-space.70*/71#ifndef CK_MD_POINTER_PACK_DISABLE72#define CK_MD_POINTER_PACK_DISABLE73#endif /* CK_MD_POINTER_PACK_DISABLE */7475/*76* The following would be used for pointer-packing tricks, disabled for the77* kernel.78*/79#ifndef CK_MD_VMA_BITS_UNKNOWN80#define CK_MD_VMA_BITS_UNKNOWN81#endif /* CK_MD_VMA_BITS_UNKNOWN */8283/*84* Do not enable double operations in kernel-space.85*/86#ifndef CK_PR_DISABLE_DOUBLE87#define CK_PR_DISABLE_DOUBLE88#endif /* CK_PR_DISABLE_DOUBLE */8990/*91* If building for a uni-processor target, then enable the uniprocessor92* feature flag. This, among other things, will remove the lock prefix.93*/94#ifndef SMP95#define CK_MD_UMP96#endif /* SMP */9798/*99* Disable the use of compiler builtin functions.100*/101#define CK_MD_CC_BUILTIN_DISABLE 1102103/*104* CK expects those, which are normally defined by the build system.105*/106#if defined(__i386__) && !defined(__x86__)107#define __x86__108/*109* If x86 becomes more relevant, we may want to consider importing in110* __mbk() to avoid potential issues around false sharing.111*/112#define CK_MD_TSO113#define CK_MD_SSE_DISABLE 1114#elif defined(__amd64__)115#define CK_MD_TSO116#elif defined(__powerpc64__) && !defined(__ppc64__)117#define __ppc64__118#elif defined(__powerpc__) && !defined(__ppc__)119#define __ppc__120#endif121122/* If no memory model has been defined, assume RMO. */123#if !defined(CK_MD_RMO) && !defined(CK_MD_TSO) && !defined(CK_MD_PSO)124#define CK_MD_RMO125#endif126127#define CK_VERSION "0.7.0"128#define CK_GIT_SHA "db5db44"129130#endif /* CK_MD_H */131132133