From patchwork Wed Jan 31 16:53:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 126369 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp906062ljc; Wed, 31 Jan 2018 08:56:01 -0800 (PST) X-Google-Smtp-Source: AH8x225BJ5zPI1D9hPmvNvOYaj905q1hKTpTkzofTVcWmnEfRLhZjVRcscn2LRtYNjssWvdNiKkR X-Received: by 10.36.20.145 with SMTP id 139mr35927219itg.15.1517417761335; Wed, 31 Jan 2018 08:56:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517417761; cv=none; d=google.com; s=arc-20160816; b=Zsd0bkmPdjhb8Z8MDyy6cITX29ewvGyUD+kP94vdv5wKpLNM6uc8fPoULkT16auZsO KLcNXtEnM51LtJG5Scj9nN3234nr3bI1Cf67Gq4jHzU/Pb+/6D2E2UPwSiEzySQ14kNa l6EkSSSY+JcYb7+E/4iVQwPL0NMSUJndU+Mpxu4U336RZWwrfa9ZWoJfgr70wl0F8e3p sylsE/V5hDRe6LP+95yLuq+VOL2uIsQr+AOB9E6IIx3kwp+/45aS1Dw/fqJwk0zPQESD WOStomn2x9pgpA3isZT2oCxkKcaAQZjdZEKMhfJexPHfrGinO+dtfI7XqGj4s1ZaxyTD h+qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=9y2KBumOSDGNt172UGYeNLn2GDOJdX3V60ufRqLRJtk=; b=H6d/VEKtCHu1m+zKtGK5vlDxwlQlaKpJqdWXo/kNu2XMa2ESx1US0re537X7T5bpfE LYS4+/15OdS26rz3pyyGulTsBSnQ08X02axO5WzYxj+TyU++Ew2bjmoxzSUcvsKxyQFw YZsh5YQqotpdrkSAEE/2b/UMsoxAsVciJ64H5EmDvbrhWCNaB+cKXrsnNZi+EztYWBoE TWQ97enVKBRqcQMCAxU6KoBocv0sQ+D+blslmav/JWeehK2uUAJfnpSf5AfICt+pJI6n hsxrRx4LVRYo7h73iPQXCpcIJoCThfsRn7UIx5R3b+L3r3WXKfODMcDpyAtaHgi6tWdl PuXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PHHLuLcr; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z3si79907ite.166.2018.01.31.08.56.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 08:56:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PHHLuLcr; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egvdn-00041A-Bs; Wed, 31 Jan 2018 16:53:43 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egvdm-00040r-IH for xen-devel@lists.xen.org; Wed, 31 Jan 2018 16:53:42 +0000 X-Inumbo-ID: 4192ea13-06a7-11e8-ba59-bc764e045a96 Received: from mail-wr0-x241.google.com (unknown [2a00:1450:400c:c0c::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 4192ea13-06a7-11e8-ba59-bc764e045a96; Wed, 31 Jan 2018 17:53:27 +0100 (CET) Received: by mail-wr0-x241.google.com with SMTP id f6so14114395wra.6 for ; Wed, 31 Jan 2018 08:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BGqGk+EjkrOkZthPFwTXa3D+SAXF6gXGIlHoIxQ/6xo=; b=PHHLuLcrjzG5t9XRXXJN0Wtbz44PIifIuR85N8iO0bIb0YWN0FN3mMMv+39gipFORK 7y90X9CzPeJYx/2jT6fkORCKIdb8jiQZYeK8jiQTSNXwYtn4HPT55ef6rC7jbruGRsmO jnu7JhXzXYBiON2UNYTE7o+xcCuqu6LFQ/bKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BGqGk+EjkrOkZthPFwTXa3D+SAXF6gXGIlHoIxQ/6xo=; b=kFIApxCx1U65GLOuZ8JGtdpEQQ/PiT/D1DiJX3ZKyN9YDPvEJF6DV3XD1kh/9n3Tbd WnaSSMAOSbzwqGgnVJDt0Htt6mLK/qKmc/yatqrNNHwkbtvFdLNPhN6aJ5u5YTMm4kvB vL+XHqk2VonHHUMBcKGg8p0u5Gg047gGJJ7ZSZ9MEPG/nXUxt2KMI8miKkHq8slZjDGl hT4rSYae9Xa0F5g3FRqBum4tdSfRTo1RVNd3C3jR/DFmbdXBZhQvzolPQMOZ/KnfStFy VGOQMWj/qyWb8C9JSBYfSeNIalegr7LOC/AuETeDl/Hd8cUP1wQjjLVkBHUzNdQEccYV wpaw== X-Gm-Message-State: AKwxytcAk6cVUMH3VnUE9OLcN5ajttO2CUFKWqcH2MlaZAxMovV8zGBQ dceYcMBDfaCrxOZShkLcFA3Jaz27nAM= X-Received: by 10.223.182.4 with SMTP id f4mr5093021wre.11.1517417620121; Wed, 31 Jan 2018 08:53:40 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id h194sm223745wma.8.2018.01.31.08.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 08:53:39 -0800 (PST) From: Julien Grall X-Google-Original-From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 31 Jan 2018 16:53:28 +0000 Message-Id: <20180131165334.23175-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180131165334.23175-1-julien.grall@arm.com> References: <20180131165334.23175-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v2 1/7] xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY_* macros X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall The only difference between all the DEFINE_TRAP_ENTRY_* macros are the interrupts (Asynchronous Abort, IRQ, FIQ) unmasked. Rather than duplicating the code, introduce __DEFINE_TRAP_ENTRY macro that will take the list of interrupts to unmask. This is part of XSA-254. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/arm32/entry.S | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S index 120922e64e..c6490d2847 100644 --- a/xen/arch/arm/arm32/entry.S +++ b/xen/arch/arm/arm32/entry.S @@ -111,39 +111,29 @@ abort_guest_exit_end: skip_check: mov pc, lr -#define DEFINE_TRAP_ENTRY(trap) \ +/* + * Macro to define trap entry. The iflags corresponds to the list of + * interrupts (Asynchronous Abort, IRQ, FIQ) to unmask. + */ +#define __DEFINE_TRAP_ENTRY(trap, iflags) \ ALIGN; \ trap_##trap: \ SAVE_ALL; \ - cpsie i; /* local_irq_enable */ \ - cpsie a; /* asynchronous abort enable */ \ + cpsie iflags; \ adr lr, return_from_trap; \ mov r0, sp; \ mov r11, sp; \ bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \ b do_trap_##trap -#define DEFINE_TRAP_ENTRY_NOIRQ(trap) \ - ALIGN; \ -trap_##trap: \ - SAVE_ALL; \ - cpsie a; /* asynchronous abort enable */ \ - adr lr, return_from_trap; \ - mov r0, sp; \ - mov r11, sp; \ - bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \ - b do_trap_##trap +/* Trap handler which unmask IRQ/Abort, keep FIQ masked */ +#define DEFINE_TRAP_ENTRY(trap) __DEFINE_TRAP_ENTRY(trap, ai) -#define DEFINE_TRAP_ENTRY_NOABORT(trap) \ - ALIGN; \ -trap_##trap: \ - SAVE_ALL; \ - cpsie i; /* local_irq_enable */ \ - adr lr, return_from_trap; \ - mov r0, sp; \ - mov r11, sp; \ - bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \ - b do_trap_##trap +/* Trap handler which unmask Abort, keep IRQ/FIQ masked */ +#define DEFINE_TRAP_ENTRY_NOIRQ(trap) __DEFINE_TRAP_ENTRY(trap, a) + +/* Trap handler which unmask IRQ, keep Abort/FIQ masked */ +#define DEFINE_TRAP_ENTRY_NOABORT(trap) __DEFINE_TRAP_ENTRY(trap, i) .align 5 GLOBAL(hyp_traps_vector)