From patchwork Fri Feb 2 14:19:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 126716 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp687263ljc; Fri, 2 Feb 2018 06:21:56 -0800 (PST) X-Google-Smtp-Source: AH8x225LPsTk3qI8MJHa3sTl0PIjqy0FeKKA9GYYhaQpxfRNVTQFzxFbAzOQlvpZIL9v9UExHff1 X-Received: by 10.107.51.149 with SMTP id z143mr43188071ioz.287.1517581315886; Fri, 02 Feb 2018 06:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517581315; cv=none; d=google.com; s=arc-20160816; b=uMHnk0WNO/G2EMhMjQK1H1UrqYh0tXVBGocJ7ZoCi6otUZlUF3jkmw9slp4+h5iTB7 j5dAM026V8N9lfYGkpYAZBrCGafyKl65YkXXk4i8Ts4FKLTnVXROuPakaH9g0U2q39tr Z+gV6mf3DwIyccLe4IP6fhLxGyMIAVSa2LKgoXQ7VI5u77YyYxGbUa9vi1qa9dyH8jz6 fQfDsHj0UlxKRnvU7ugrGmlxzNvayllZT5MYu5bR8EoH5CvmkqwziT3AHoko9z0gQcmK k0jIHkJbpvvtiYXu+tNAAcjHCKmxGJUyMZRmR8InqjlPA3oPDmrh1ib26Btea6FgFgKa rFYQ== 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=rHQUnbifTuF7Pn7usM6MJgvor6xVpZTk9DtEbWxJE7M=; b=dtgUqVFpR6Wf59obmVzD0+3cMZje9XxHtO88Ymh/CF5DqkQZOnqEMvy9MbuOQVk5ts YQaDDGT+pcbzWyTAAZ4mi8S941zvpLpZ/Nj7hMvjaNTKsLNx7ePMPpp7C8iVUFeq1uFM Nz2ADDcP43yW8LcLDGLQ5+XREaKnrQmUZTmSPKQxsNz5VaowLx7XmRGyiE/09uoWwJlC Gn7HcKeg0+QedpGo+tysAK+02B6UGALrWWXJpkGTzsPmSmzh2E7agCIvxrJCe8FUs4uD Ivuhvxx7SyvhlcxRT3o2gl8TJRMrWHd2j8DkPZZ2mqaGt8ugBdJtF5VRnsZf4WmiNrWe nBKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XIXdi2IS; 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 j63si1821939ioo.127.2018.02.02.06.21.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 06:21:55 -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=XIXdi2IS; 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 1ehcBg-00084l-Ev; Fri, 02 Feb 2018 14:19:32 +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 1ehcBf-00084U-Hl for xen-devel@lists.xen.org; Fri, 02 Feb 2018 14:19:31 +0000 X-Inumbo-ID: 0a2edf52-0824-11e8-ba59-bc764e045a96 Received: from mail-wm0-x241.google.com (unknown [2a00:1450:400c:c09::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0a2edf52-0824-11e8-ba59-bc764e045a96; Fri, 02 Feb 2018 15:19:12 +0100 (CET) Received: by mail-wm0-x241.google.com with SMTP id f3so12739959wmc.1 for ; Fri, 02 Feb 2018 06:19:29 -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=P/xlNr0sL12gck5AzLgDJU5rzE0bHrECiy+jMPKtdJE=; b=XIXdi2ISv+/dkqIcupi4GTugJ+HxHqRnCqgmY7YEyIbudo1jynYiqQz2R5cfz9qGMY hRRaEGA9Rs66fgbmQa30Yxc2/dRmSreEQL1htVezhTJKlRXVx1A98+GuiuMLC2UlY0H4 b4Us9BmDPv5+Wnm6QBcrORtRxe8lYgiuPklcw= 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=P/xlNr0sL12gck5AzLgDJU5rzE0bHrECiy+jMPKtdJE=; b=IB05bx2JAsoVyI0xyy+m1rNXH1P47eObKxWFiJMPcJFQjaH84BOWvqTC/8h5oVddyi IRiPiDGWDjzq7CQrb63cxWiDcA9CtG7NUH7w19jXxuPJHqiuMEK3yNy5K+W8xt8FLhtV kl8nceEamS9zTDt6df6WuLw9nk5osbT0IFagK39XBcWDqanElJRpT78/PYpx1P2vUxSe UUx1jCwFnyxe0AReaxnHgSkEG8SI5bSpi9aqaCULoKMCMIc+NWxvMRd2p6/x9LzJD7LY oubESvjkR63+b9wsVlMuvkbliKr1U7/Ktb1KcNnB+n8J02jtIs0FeR/QFJMfB4QyysxC 7Oyg== X-Gm-Message-State: AKwxytcweKlTlho978Ln8A/ptAHv0U2Obxi5H9FZaJXRi/NeFVZSr/yr MsOAlFNalPx7WzUmaEZvG928i/xB4b4= X-Received: by 10.28.86.131 with SMTP id k125mr29876869wmb.83.1517581168394; Fri, 02 Feb 2018 06:19:28 -0800 (PST) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id u79sm3057422wma.10.2018.02.02.06.19.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 06:19:27 -0800 (PST) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 2 Feb 2018 14:19:19 +0000 Message-Id: <20180202141925.19387-2-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180202141925.19387-1-julien.grall@linaro.org> References: <20180202141925.19387-1-julien.grall@linaro.org> Cc: sstabellini@kernel.org, Julien Grall , andre.przywara@linaro.org Subject: [Xen-devel] [PATCH v4 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 --- 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)