From patchwork Wed Oct 4 19:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 114815 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp6266141edb; Wed, 4 Oct 2017 12:00:57 -0700 (PDT) X-Google-Smtp-Source: AOwi7QA12m8zEkefVGn/6JLWWSYgKCpjiXYU1jRldrgapws4VOEaRvOn6FPwNria0LpIwNRyMnJE X-Received: by 10.55.161.200 with SMTP id k191mr19477677qke.158.1507143656939; Wed, 04 Oct 2017 12:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507143656; cv=none; d=google.com; s=arc-20160816; b=FPXNALNlcCS2Wkce7JqQM3usow92RNIWbqNfe3tAMoHFuhgTA6a18LjvP3KchPz0/Y k7f/yLP5JZwI7xsgk53SNFRd/qTIBCzBHWidsLBNj5vdVj6RXVXQgiKg8lXie73Bp/uw BW/mo6sc1/+gDqNzaeTNwiiB9hiwIxxExe5KeGvVO/aeCcE+7Eoa/AYUDTgJ+tSqzvm6 PIA8oWNgCwKO0SPn4plRChcEMVB+a2tBvQ2fWmHp7VsLfAgGGc8H75vTyYyZVgT/Pe6Q 58iGhPdUU1Wggx309yRU40r430+sIhAIzRgAz+rfw9PlIIKS4uk+CKox4Rr7Iu53x0wy DPbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=US80oU+QxKBf8s751LBhEye1ePJGDmfR0uObAIMBC7w=; b=dUKcaHBKCb7eiNKuEs3ysIYFOLNqbip8CUZHIzm4ltvRKS0vdLXe2W0IZpIvqs/1h7 bRw3yekkSUI8UTpETuZ/5OG61VzQTK5Zg0spAD/qsRA9YxppnTz0qBdiNrO5w84IxosC Z7iYXcTYwo0TPSdtWjqug10T2TPYP+9v8wlJ8Ql6H5dxzN3A6d1ozqc+8gFp/z0yAWT0 sul2DEKiEaiqTynIBDjYJOfRBMBsbKVJlMJ0co3gem8G67jdgE3bA6vZ/6fT2LmFnOww nYMei3N3riwv0MtwzK8ZU62XU1/XBNrVLj+Nzwro5C1pASZIS8vDIyZiOvBvnEbiz6U3 aLyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j45si584041qtj.255.2017.10.04.12.00.56; Wed, 04 Oct 2017 12:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 061E964478; Wed, 4 Oct 2017 19:00:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id BD8EF6156B; Wed, 4 Oct 2017 19:00:24 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1C6BA60E19; Wed, 4 Oct 2017 19:00:17 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id D34AE60D8F for ; Wed, 4 Oct 2017 19:00:13 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 4CD4870584C for ; Wed, 4 Oct 2017 22:00:12 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id WLmdJe0jkJ-0CvO3dKm; Wed, 04 Oct 2017 22:00:12 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ftu7Q4zrbA-0B2eucu3; Wed, 04 Oct 2017 22:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 4 Oct 2017 22:00:08 +0300 Message-Id: <1507143608-13625-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507143608-13625-1-git-send-email-odpbot@yandex.ru> References: <1507143608-13625-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 211 Subject: [lng-odp] [PATCH API-NEXT v2 2/2] linux-gen: more unification of arch-specific code X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 211 (lumag:fix-api-next-merge) ** https://github.com/Linaro/odp/pull/211 ** Patch: https://github.com/Linaro/odp/pull/211.patch ** Base sha: 75cfc6f70d5b21d6f04082e1d03a7e677a895280 ** Merge commit sha: b5aebf54bd0f3e939b778b754975259df1c44de3 **/ platform/linux-generic/Makefile.am | 11 +++++-- .../linux-generic/arch/aarch64/odp_cpu_idling.h | 20 +++++------- platform/linux-generic/arch/arm/odp_cpu_idling.h | 20 +++++------- platform/linux-generic/arch/default/odp_cpu.h | 24 +-------------- .../linux-generic/arch/default/odp_cpu_idling.h | 36 ++++++++++++++++++++++ 5 files changed, 59 insertions(+), 52 deletions(-) create mode 100644 platform/linux-generic/arch/default/odp_cpu_idling.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index f830d69f2..054566817 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -278,6 +278,7 @@ arch_odp_headers = $(srcdir)/arch/arm/odp/api/cpu_arch.h noinst_HEADERS += ${srcdir}/arch/arm/odp_atomic.h \ ${srcdir}/arch/arm/odp_cpu.h \ ${srcdir}/arch/arm/odp_cpu_idling.h \ + ${srcdir}/arch/default/odp_cpu_idling.h \ ${srcdir}/arch/arm/odp_llsc.h endif if ARCH_IS_AARCH64 @@ -289,6 +290,7 @@ arch_odp_headers = $(srcdir)/arch/aarch64/odp/api/cpu_arch.h noinst_HEADERS += ${srcdir}/arch/aarch64/odp_atomic.h \ ${srcdir}/arch/aarch64/odp_cpu.h \ ${srcdir}/arch/aarch64/odp_cpu_idling.h \ + ${srcdir}/arch/default/odp_cpu_idling.h \ ${srcdir}/arch/aarch64/odp_llsc.h endif if ARCH_IS_MIPS64 @@ -297,7 +299,8 @@ __LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/mips64/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/mips64/odp/api/cpu_arch.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif if ARCH_IS_POWERPC __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ @@ -305,7 +308,8 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/powerpc/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/powerpc/odp/api/cpu_arch.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif if ARCH_IS_X86 __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ @@ -315,7 +319,8 @@ __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ arch/x86/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/x86/odp/api/cpu_arch.h noinst_HEADERS += $(srcdir)/arch/x86/cpu_flags.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif noinst_HEADERS += $(srcdir)/arch/default/odp/api/cpu_arch.h diff --git a/platform/linux-generic/arch/aarch64/odp_cpu_idling.h b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h index ab29455bb..e7dec7d9f 100644 --- a/platform/linux-generic/arch/aarch64/odp_cpu_idling.h +++ b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h @@ -13,39 +13,33 @@ #error This file should not be included directly, please include odp_cpu.h #endif +#ifndef CONFIG_WFE + +#include "../default/odp_cpu_idling.h" + +#else /* CONFIG_WFE */ + static inline void sevl(void) { -#ifdef CONFIG_WFE __asm__ volatile("sevl" : : : ); -#endif } static inline int wfe(void) { -#ifdef CONFIG_WFE __asm__ volatile("wfe" : : : "memory"); -#endif return 1; } static inline void doze(void) { -#ifndef CONFIG_WFE /* When using WFE do not stall the pipeline using other means */ odp_cpu_pause(); -#endif } -#ifdef CONFIG_WFE #define monitor128(addr, mo) lld((addr), (mo)) #define monitor64(addr, mo) ll64((addr), (mo)) #define monitor32(addr, mo) ll32((addr), (mo)) #define monitor8(addr, mo) ll8((addr), (mo)) -#else -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) -#endif +#endif /* CONFIG_WFE */ #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */ diff --git a/platform/linux-generic/arch/arm/odp_cpu_idling.h b/platform/linux-generic/arch/arm/odp_cpu_idling.h index ab29455bb..e7dec7d9f 100644 --- a/platform/linux-generic/arch/arm/odp_cpu_idling.h +++ b/platform/linux-generic/arch/arm/odp_cpu_idling.h @@ -13,39 +13,33 @@ #error This file should not be included directly, please include odp_cpu.h #endif +#ifndef CONFIG_WFE + +#include "../default/odp_cpu_idling.h" + +#else /* CONFIG_WFE */ + static inline void sevl(void) { -#ifdef CONFIG_WFE __asm__ volatile("sevl" : : : ); -#endif } static inline int wfe(void) { -#ifdef CONFIG_WFE __asm__ volatile("wfe" : : : "memory"); -#endif return 1; } static inline void doze(void) { -#ifndef CONFIG_WFE /* When using WFE do not stall the pipeline using other means */ odp_cpu_pause(); -#endif } -#ifdef CONFIG_WFE #define monitor128(addr, mo) lld((addr), (mo)) #define monitor64(addr, mo) ll64((addr), (mo)) #define monitor32(addr, mo) ll32((addr), (mo)) #define monitor8(addr, mo) ll8((addr), (mo)) -#else -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) -#endif +#endif /* CONFIG_WFE */ #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */ diff --git a/platform/linux-generic/arch/default/odp_cpu.h b/platform/linux-generic/arch/default/odp_cpu.h index 12a44b93f..2df6f65c8 100644 --- a/platform/linux-generic/arch/default/odp_cpu.h +++ b/platform/linux-generic/arch/default/odp_cpu.h @@ -16,28 +16,6 @@ #define atomic_store_release(loc, val, ro) \ __atomic_store_n(loc, val, __ATOMIC_RELEASE) -/****************************************************************************** - * Idle mgmt - *****************************************************************************/ - -static inline void sevl(void) -{ - /* empty */ -} - -static inline int wfe(void) -{ - return 1; -} - -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) - -static inline void doze(void) -{ - odp_cpu_pause(); -} +#include "odp_cpu_idling.h" #endif diff --git a/platform/linux-generic/arch/default/odp_cpu_idling.h b/platform/linux-generic/arch/default/odp_cpu_idling.h new file mode 100644 index 000000000..db1eebd12 --- /dev/null +++ b/platform/linux-generic/arch/default/odp_cpu_idling.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_DEFAULT_CPU_IDLING_H_ +#define ODP_DEFAULT_CPU_IDLING_H_ + +/****************************************************************************** + * Idle mgmt + *****************************************************************************/ + +static inline void sevl(void) +{ + /* empty */ +} + +static inline int wfe(void) +{ + return 1; +} + +#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) + +static inline void doze(void) +{ + odp_cpu_pause(); +} + +#endif