From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.25.150.194 with SMTP id y185csp912527lfd; Thu, 10 Nov 2016 09:21:39 -0800 (PST) X-Received: by 10.55.200.75 with SMTP id c72mr7507790qkj.169.1478798499744; Thu, 10 Nov 2016 09:21:39 -0800 (PST) Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id b14si3918760qtb.152.2016.11.10.09.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 09:21:39 -0800 (PST) Received-SPF: permerror (google.com: permanent error in processing during lookup of drjones@redhat.com: _spf1.redhat.com not found) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=permerror (google.com: permanent error in processing during lookup of drjones@redhat.com: _spf1.redhat.com not found) smtp.mailfrom=drjones@redhat.com Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 E377D8FCEA; Thu, 10 Nov 2016 17:21:38 +0000 (UTC) Received: from kamzik.brq.redhat.com (kamzik.brq.redhat.com [10.34.1.143]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAAHLMjf006894; Thu, 10 Nov 2016 12:21:36 -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 v5 05/11] arm/arm64: irq enable/disable Date: Thu, 10 Nov 2016 18:21:15 +0100 Message-Id: <1478798481-25030-6-git-send-email-drjones@redhat.com> In-Reply-To: <1478798481-25030-1-git-send-email-drjones@redhat.com> References: <1478798481-25030-1-git-send-email-drjones@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 Nov 2016 17:21:39 +0000 (UTC) X-TUID: /WHo0IBqZGX/ 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 bc46d1f980ee..959ecda5dced 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 long get_mpidr(void) { unsigned long 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) \ { \ -- 2.7.4