From patchwork Fri Jan 19 13:40:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 125412 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1133496ljf; Mon, 22 Jan 2018 04:39:42 -0800 (PST) X-Google-Smtp-Source: AH8x225nnv23YGMEvq4Bc56+hh3JPtkZnd8VjmtQ6DDnle/cazhyKUjJNi/6azlhhvOU6RF98SMU X-Received: by 10.36.25.196 with SMTP id b187mr8050462itb.18.1516624782362; Mon, 22 Jan 2018 04:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516624782; cv=none; d=google.com; s=arc-20160816; b=R8GzkRymsrwWAifwrxoo3DoeWpWEoNm1oc6tbAv8FMKWt8UFqWvAPAqtwZcuX9YvU1 YI48gpMM25fcTnlmR5niEjhXCdqm/69tydI07mxOur+F2HgaLeU/5BkN3lBnEKzdusdA 3QuAqS44JaPqd3zglkoBWm5+N7puuIO4mkRfu1lCm4bfwDvIE1WgTnOIWc2gosCP0dPq i035wfCHec0eDSoefKkMzvn8eHZ/zceL4Y9LlwT8npCFjWz5p22a/kScPuM/5mXi7uB9 JYsIhBpxyyaShBm16mb+TBZDGZVoBv6NIaNp2K3PUnpzZHQHWln/pCyaA5mN2IYVlKEA 1gBA== 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=VZUtIxZZZzSZ3Dre7PKo7dj94C4i5Rm4y8PVMcRoAXY=; b=ISAK9xVqqJ+2ECYvcL6OwJsHBEV+sTERfy8Xe2Piq57fw00LKzHpkxn4Kmo4cjpMju obiZ51RlzOU+R8Ab9kNegen5PrilrkyjjcB/z2AzGlgBRKsEyDlA5vDa4z2Yf2Y8Fggt rW2EvvkOVnQaWwsWG5mP8iTwlZM5kbi8GArZRim5wHRhUy2Prsu7uT3QoZF5gpRKgxr3 7fvkdaI+VW78PuSCVAJ003Z/NxD+R3g7WzFzh/VY9mvIe8YbC3bn2+sfoveNPtGw+d4I wtjWjjfqVpz8u6lEMbYrNs1a4dLnaudivaSoIJsjqDbCvmHOy+eVYJHJLQa08miXBqvq GTUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=grCvKbIN; 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 f2si11136674iob.94.2018.01.22.04.39.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 04:39:42 -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=grCvKbIN; 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 1edbKf-0001HE-Sn; Mon, 22 Jan 2018 12:36:13 +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 1edbKf-0001Gy-48 for xen-devel@lists.xen.org; Mon, 22 Jan 2018 12:36:13 +0000 X-Inumbo-ID: d342659c-ff70-11e7-ba59-bc764e045a96 Received: from mail-wm0-x243.google.com (unknown [2a00:1450:400c:c09::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id d342659c-ff70-11e7-ba59-bc764e045a96; Mon, 22 Jan 2018 13:36:11 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id t74so16112197wme.3 for ; Mon, 22 Jan 2018 04:36:11 -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=AKESHymqzBZWBb53EH1NdvAguZN0V5+i3qROjUDk2so=; b=grCvKbINI4Dd/Dc0DTaygX7Xm13BbPCqLSuMFLvV7EnbU717bfnnoT5T+oq5NSSTQ+ mLfUDVSyspszU1Ah0xCa3XTP0l53kl4oTShwXzI69gVY5G7kq4BEMcX8iQCrcXiNkuaU +QG+ZUZ0dy01kMKbilp+ZNKmCObQuMhI6BpbU= 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=AKESHymqzBZWBb53EH1NdvAguZN0V5+i3qROjUDk2so=; b=OkA5AZ0k2p7G9Mc7QszQiPG+/cfu8BHOktS2nZViGb7xqX43I0LstFWvzqypwdQ0YQ Lj34wuz3p6iScNczZS31+GEL8ueWYUXpv1MwG5r8DkjCjZbtvMvrX5WjYgL9xO/F/Uyd Zv0QtIIS7X2JAfnpfXgIravy2mAtQE986YyfGBkRWS7KuZ77V+414D7Hi1/mQBJhe33g 7PXNleOWfx0G4ftvVLQ3r9BQ+6dx2big0gdMBXaBSvaw+bIqT/WlI70b+lE3v5SlCEWp WLe2m/jSjLifbuWKDzyO7PXHKkYNpAPwVt158XJI60LGMWvIZyxbZ4mka1UBVpC+Z+G9 y91w== X-Gm-Message-State: AKwxytdQjn4iz164KNVwDxgWGTVZAPo78YSASVaWUmMP6HqvaDa3AiGn mZyOwyAOEVERJAOOwAlIAPSG04hPYQI= X-Received: by 10.28.51.12 with SMTP id z12mr7501441wmz.16.1516369266502; Fri, 19 Jan 2018 05:41:06 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id s44sm5113642wrc.64.2018.01.19.05.41.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 05:41:06 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 19 Jan 2018 13:40:57 +0000 Message-Id: <20180119134103.3390-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180119134103.3390-1-julien.grall@linaro.org> References: <20180119134103.3390-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, andre.przywara@linaro.org Subject: [Xen-devel] [PATCH 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" 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 --- 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)