From patchwork Thu Nov 10 16:07:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 9421351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCE2860484 for ; Thu, 10 Nov 2016 16:08:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADEFE297AF for ; Thu, 10 Nov 2016 16:08:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A267A297B5; Thu, 10 Nov 2016 16:08:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4357D297AF for ; Thu, 10 Nov 2016 16:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934841AbcKJQIZ (ORCPT ); Thu, 10 Nov 2016 11:08:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48916 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934786AbcKJQIW (ORCPT ); Thu, 10 Nov 2016 11:08:22 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EFD28F02B; Thu, 10 Nov 2016 16:08:22 +0000 (UTC) Received: from kamzik.brq.redhat.com (kamzik.brq.redhat.com [10.34.1.143]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAAG86nq023413; Thu, 10 Nov 2016 11:08:19 -0500 From: Andrew Jones To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: pbonzini@redhat.com, andre.przywara@arm.com, peter.maydell@linaro.org, alex.bennee@linaro.org, marc.zyngier@arm.com, eric.auger@redhat.com, christoffer.dall@linaro.org Subject: [kvm-unit-tests PATCH v4 05/11] arm/arm64: irq enable/disable Date: Thu, 10 Nov 2016 17:07:58 +0100 Message-Id: <1478794084-5273-6-git-send-email-drjones@redhat.com> In-Reply-To: <1478794084-5273-1-git-send-email-drjones@redhat.com> References: <1478794084-5273-1-git-send-email-drjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 Nov 2016 16:08:22 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Alex Bennée Reviewed-by: Eric Auger Signed-off-by: Andrew Jones --- lib/arm/asm/processor.h | 10 ++++++++++ lib/arm64/asm/processor.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/arm/asm/processor.h b/lib/arm/asm/processor.h index afc903ca7d4a..75a8d08b8933 100644 --- a/lib/arm/asm/processor.h +++ b/lib/arm/asm/processor.h @@ -35,6 +35,16 @@ static inline unsigned long current_cpsr(void) #define current_mode() (current_cpsr() & MODE_MASK) +static inline void local_irq_enable(void) +{ + asm volatile("cpsie i" : : : "memory", "cc"); +} + +static inline void local_irq_disable(void) +{ + asm volatile("cpsid i" : : : "memory", "cc"); +} + static inline unsigned int get_mpidr(void) { unsigned int mpidr; diff --git a/lib/arm64/asm/processor.h b/lib/arm64/asm/processor.h index 94f7ce35b65c..d54a4ed1c187 100644 --- a/lib/arm64/asm/processor.h +++ b/lib/arm64/asm/processor.h @@ -68,6 +68,16 @@ static inline unsigned long current_level(void) return el & 0xc; } +static inline void local_irq_enable(void) +{ + asm volatile("msr daifclr, #2" : : : "memory"); +} + +static inline void local_irq_disable(void) +{ + asm volatile("msr daifset, #2" : : : "memory"); +} + #define DEFINE_GET_SYSREG(reg, type) \ static inline type get_##reg(void) \ { \