From patchwork Wed Aug 8 12:23:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Dave Martin X-Patchwork-Id: 1294921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 23AC5DF223 for ; Wed, 8 Aug 2012 12:27:46 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sz5Ja-0002gj-B3; Wed, 08 Aug 2012 12:24:42 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sz5J1-0002cw-2x for linux-arm-kernel@lists.infradead.org; Wed, 08 Aug 2012 12:24:11 +0000 Received: by eekc13 with SMTP id c13so200596eek.36 for ; Wed, 08 Aug 2012 05:24:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=o/eJ1v2/8t6f3zrED1ExHAy/R6U2N8HLTAIn9BRni/A=; b=enl5r6mu/JlR/7UXqsjBKBgCFpRRGTdHMXBoRHx3dNnQNK3Qfjqd32xvNoIJJIRPOw 3t9XR4KZe4p5ASjdlHCofm099gINf9RGBio/UawLp1dIXJZIUWlNTneeyw/vTQSrhU5d qBQYB1K40keAzvhAd1QT43vD20WCALqE7KQYVmrpMGWYLo0xcJmYfvzdb1ol7IwWKF6r FXafsiDLaW85MRp++XmYyPkZUj6xtOIbTN/4YetILRpLalFPRryyXVn4gKGdd6FL8ypu 97VbKQCKvE0RqrK8vdHdYo2WvelICnufB+PSye/EI9OzPyqfMkinUrWGeVe3xY84F23A 5ZeA== Received: by 10.14.181.137 with SMTP id l9mr21948192eem.28.1344428646027; Wed, 08 Aug 2012 05:24:06 -0700 (PDT) Received: from e103592.peterhouse.linaro.org (fw-lnat.cambridge.arm.com. [217.140.96.63]) by mx.google.com with ESMTPS id e7sm28153355eep.2.2012.08.08.05.24.03 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 05:24:04 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 REPOST 4/4] ARM: opcodes: Opcode definitions for the Virtualization Extensions Date: Wed, 8 Aug 2012 13:23:49 +0100 Message-Id: <1344428629-12787-5-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1344428629-12787-1-git-send-email-dave.martin@linaro.org> References: <1344428629-12787-1-git-send-email-dave.martin@linaro.org> X-Gm-Message-State: ALoCoQmtBNwHAtMsaKedaHxzjhyCEmeIk0DYCDeIyGDxO/uIJS+GMOmgmRwCCsVy/YM0sZEl4V8L X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Nicolas Pitre , Christoffer Dall , Ian Campbell , Stefano Stabellini , Marc Zyngier , Rusty Russell , Will Deacon , Jon Medhurst , Rabin Vincent , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For now, this patch just adds a definition for the HVC instruction. More can be added here later, as needed. Now that we have a real example of how to use the opcode injection macros properly, this patch also adds a cross-reference from the explanation in opcodes.h (since without an example, figuring out how to use the macros is not that easy). Signed-off-by: Dave Martin Acked-by: Nicolas Pitre --- arch/arm/include/asm/opcodes-virt.h | 29 +++++++++++++++++++++++++++++ arch/arm/include/asm/opcodes.h | 2 ++ 2 files changed, 31 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/opcodes-virt.h diff --git a/arch/arm/include/asm/opcodes-virt.h b/arch/arm/include/asm/opcodes-virt.h new file mode 100644 index 0000000..b85665a --- /dev/null +++ b/arch/arm/include/asm/opcodes-virt.h @@ -0,0 +1,29 @@ +/* + * opcodes-virt.h: Opcode definitions for the ARM virtualization extensions + * Copyright (C) 2012 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef __ASM_ARM_OPCODES_VIRT_H +#define __ASM_ARM_OPCODES_VIRT_H + +#include + +#define __HVC(imm16) __inst_arm_thumb32( \ + 0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F), \ + 0xF7E08000 | (((imm16) & 0xF000) << 4) | ((imm16) & 0x0FFF) \ +) + +#endif /* ! __ASM_ARM_OPCODES_VIRT_H */ diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h index f7937e1..74e211a 100644 --- a/arch/arm/include/asm/opcodes.h +++ b/arch/arm/include/asm/opcodes.h @@ -193,6 +193,8 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr); * specify the ARM and Thumb alternatives at the same time. This ensures * that the correct opcode gets emitted depending on the instruction set * used for the kernel build. + * + * Look at opcodes-virt.h for an example of how to use these macros. */ #include