All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jisheng Zhang <jszhang@marvell.com>,
	kvm@vger.kernel.org, Gleb Natapov <gleb@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	David Binderman <dcb314@hotmail.com>,
	Fengguang Wu <fengguang.wu@intel.com>,
	kvmarm@lists.cs.columbia.edu
Subject: [PATCH 28/31] arm: KVM: Make kvm_arm.h friendly to assembly code
Date: Thu, 24 Dec 2015 11:12:36 +0000	[thread overview]
Message-ID: <1450955559-15639-29-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1450955559-15639-1-git-send-email-marc.zyngier@arm.com>

From: Vladimir Murzin <vladimir.murzin@arm.com>

kvm_arm.h is included from both C code and assembly code; however some
definitions in this header supplied with U/UL/ULL suffixes which might
confuse assembly once they got evaluated.
We have _AC macro for such cases, so just wrap problem places with it.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/kvm_arm.h | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index b05bb5a..01d4d7a 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -19,6 +19,7 @@
 #ifndef __ARM_KVM_ARM_H__
 #define __ARM_KVM_ARM_H__
 
+#include <linux/const.h>
 #include <linux/types.h>
 
 /* Hyp Configuration Register (HCR) bits */
@@ -132,9 +133,9 @@
  * space.
  */
 #define KVM_PHYS_SHIFT	(40)
-#define KVM_PHYS_SIZE	(1ULL << KVM_PHYS_SHIFT)
-#define KVM_PHYS_MASK	(KVM_PHYS_SIZE - 1ULL)
-#define PTRS_PER_S2_PGD	(1ULL << (KVM_PHYS_SHIFT - 30))
+#define KVM_PHYS_SIZE	(_AC(1, ULL) << KVM_PHYS_SHIFT)
+#define KVM_PHYS_MASK	(KVM_PHYS_SIZE - _AC(1, ULL))
+#define PTRS_PER_S2_PGD	(_AC(1, ULL) << (KVM_PHYS_SHIFT - 30))
 
 /* Virtualization Translation Control Register (VTCR) bits */
 #define VTCR_SH0	(3 << 12)
@@ -161,17 +162,17 @@
 #define VTTBR_X		(5 - KVM_T0SZ)
 #endif
 #define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
-#define VTTBR_BADDR_MASK  (((1LLU << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
-#define VTTBR_VMID_SHIFT  (48LLU)
-#define VTTBR_VMID_MASK	  (0xffLLU << VTTBR_VMID_SHIFT)
+#define VTTBR_BADDR_MASK  (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
+#define VTTBR_VMID_SHIFT  _AC(48, ULL)
+#define VTTBR_VMID_MASK	  (_AC(0xff, ULL) << VTTBR_VMID_SHIFT)
 
 /* Hyp Syndrome Register (HSR) bits */
 #define HSR_EC_SHIFT	(26)
-#define HSR_EC		(0x3fU << HSR_EC_SHIFT)
-#define HSR_IL		(1U << 25)
+#define HSR_EC		(_AC(0x3f, UL) << HSR_EC_SHIFT)
+#define HSR_IL		(_AC(1, UL) << 25)
 #define HSR_ISS		(HSR_IL - 1)
 #define HSR_ISV_SHIFT	(24)
-#define HSR_ISV		(1U << HSR_ISV_SHIFT)
+#define HSR_ISV		(_AC(1, UL) << HSR_ISV_SHIFT)
 #define HSR_SRT_SHIFT	(16)
 #define HSR_SRT_MASK	(0xf << HSR_SRT_SHIFT)
 #define HSR_FSC		(0x3f)
@@ -179,9 +180,9 @@
 #define HSR_SSE		(1 << 21)
 #define HSR_WNR		(1 << 6)
 #define HSR_CV_SHIFT	(24)
-#define HSR_CV		(1U << HSR_CV_SHIFT)
+#define HSR_CV		(_AC(1, UL) << HSR_CV_SHIFT)
 #define HSR_COND_SHIFT	(20)
-#define HSR_COND	(0xfU << HSR_COND_SHIFT)
+#define HSR_COND	(_AC(0xf, UL) << HSR_COND_SHIFT)
 
 #define FSC_FAULT	(0x04)
 #define FSC_ACCESS	(0x08)
@@ -209,13 +210,13 @@
 #define HSR_EC_DABT	(0x24)
 #define HSR_EC_DABT_HYP	(0x25)
 
-#define HSR_WFI_IS_WFE		(1U << 0)
+#define HSR_WFI_IS_WFE		(_AC(1, UL) << 0)
 
-#define HSR_HVC_IMM_MASK	((1UL << 16) - 1)
+#define HSR_HVC_IMM_MASK	((_AC(1, UL) << 16) - 1)
 
-#define HSR_DABT_S1PTW		(1U << 7)
-#define HSR_DABT_CM		(1U << 8)
-#define HSR_DABT_EA		(1U << 9)
+#define HSR_DABT_S1PTW		(_AC(1, UL) << 7)
+#define HSR_DABT_CM		(_AC(1, UL) << 8)
+#define HSR_DABT_EA		(_AC(1, UL) << 9)
 
 #define kvm_arm_exception_type	\
 	{0, "RESET" }, 		\
-- 
2.1.4

WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 28/31] arm: KVM: Make kvm_arm.h friendly to assembly code
Date: Thu, 24 Dec 2015 11:12:36 +0000	[thread overview]
Message-ID: <1450955559-15639-29-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1450955559-15639-1-git-send-email-marc.zyngier@arm.com>

From: Vladimir Murzin <vladimir.murzin@arm.com>

kvm_arm.h is included from both C code and assembly code; however some
definitions in this header supplied with U/UL/ULL suffixes which might
confuse assembly once they got evaluated.
We have _AC macro for such cases, so just wrap problem places with it.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/include/asm/kvm_arm.h | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index b05bb5a..01d4d7a 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -19,6 +19,7 @@
 #ifndef __ARM_KVM_ARM_H__
 #define __ARM_KVM_ARM_H__
 
+#include <linux/const.h>
 #include <linux/types.h>
 
 /* Hyp Configuration Register (HCR) bits */
@@ -132,9 +133,9 @@
  * space.
  */
 #define KVM_PHYS_SHIFT	(40)
-#define KVM_PHYS_SIZE	(1ULL << KVM_PHYS_SHIFT)
-#define KVM_PHYS_MASK	(KVM_PHYS_SIZE - 1ULL)
-#define PTRS_PER_S2_PGD	(1ULL << (KVM_PHYS_SHIFT - 30))
+#define KVM_PHYS_SIZE	(_AC(1, ULL) << KVM_PHYS_SHIFT)
+#define KVM_PHYS_MASK	(KVM_PHYS_SIZE - _AC(1, ULL))
+#define PTRS_PER_S2_PGD	(_AC(1, ULL) << (KVM_PHYS_SHIFT - 30))
 
 /* Virtualization Translation Control Register (VTCR) bits */
 #define VTCR_SH0	(3 << 12)
@@ -161,17 +162,17 @@
 #define VTTBR_X		(5 - KVM_T0SZ)
 #endif
 #define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
-#define VTTBR_BADDR_MASK  (((1LLU << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
-#define VTTBR_VMID_SHIFT  (48LLU)
-#define VTTBR_VMID_MASK	  (0xffLLU << VTTBR_VMID_SHIFT)
+#define VTTBR_BADDR_MASK  (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
+#define VTTBR_VMID_SHIFT  _AC(48, ULL)
+#define VTTBR_VMID_MASK	  (_AC(0xff, ULL) << VTTBR_VMID_SHIFT)
 
 /* Hyp Syndrome Register (HSR) bits */
 #define HSR_EC_SHIFT	(26)
-#define HSR_EC		(0x3fU << HSR_EC_SHIFT)
-#define HSR_IL		(1U << 25)
+#define HSR_EC		(_AC(0x3f, UL) << HSR_EC_SHIFT)
+#define HSR_IL		(_AC(1, UL) << 25)
 #define HSR_ISS		(HSR_IL - 1)
 #define HSR_ISV_SHIFT	(24)
-#define HSR_ISV		(1U << HSR_ISV_SHIFT)
+#define HSR_ISV		(_AC(1, UL) << HSR_ISV_SHIFT)
 #define HSR_SRT_SHIFT	(16)
 #define HSR_SRT_MASK	(0xf << HSR_SRT_SHIFT)
 #define HSR_FSC		(0x3f)
@@ -179,9 +180,9 @@
 #define HSR_SSE		(1 << 21)
 #define HSR_WNR		(1 << 6)
 #define HSR_CV_SHIFT	(24)
-#define HSR_CV		(1U << HSR_CV_SHIFT)
+#define HSR_CV		(_AC(1, UL) << HSR_CV_SHIFT)
 #define HSR_COND_SHIFT	(20)
-#define HSR_COND	(0xfU << HSR_COND_SHIFT)
+#define HSR_COND	(_AC(0xf, UL) << HSR_COND_SHIFT)
 
 #define FSC_FAULT	(0x04)
 #define FSC_ACCESS	(0x08)
@@ -209,13 +210,13 @@
 #define HSR_EC_DABT	(0x24)
 #define HSR_EC_DABT_HYP	(0x25)
 
-#define HSR_WFI_IS_WFE		(1U << 0)
+#define HSR_WFI_IS_WFE		(_AC(1, UL) << 0)
 
-#define HSR_HVC_IMM_MASK	((1UL << 16) - 1)
+#define HSR_HVC_IMM_MASK	((_AC(1, UL) << 16) - 1)
 
-#define HSR_DABT_S1PTW		(1U << 7)
-#define HSR_DABT_CM		(1U << 8)
-#define HSR_DABT_EA		(1U << 9)
+#define HSR_DABT_S1PTW		(_AC(1, UL) << 7)
+#define HSR_DABT_CM		(_AC(1, UL) << 8)
+#define HSR_DABT_EA		(_AC(1, UL) << 9)
 
 #define kvm_arm_exception_type	\
 	{0, "RESET" }, 		\
-- 
2.1.4

  parent reply	other threads:[~2015-12-24 11:12 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-24 11:12 [PULL] KVM/ARM updates for 4.5 Marc Zyngier
2015-12-24 11:12 ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 01/31] KVM: arm/arm64: vgic: make vgic_io_ops static Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 02/31] KVM: arm/arm64: Count guest exit due to various reasons Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 03/31] arm64: Add macros to read/write system registers Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 04/31] arm64: KVM: Add a HYP-specific header file Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 05/31] arm64: KVM: Implement vgic-v2 save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 06/31] KVM: arm/arm64: vgic-v3: Make the LR indexing macro public Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 07/31] arm64: KVM: Implement vgic-v3 save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 08/31] arm64: KVM: Implement timer save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 09/31] arm64: KVM: Implement system register save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 10/31] arm64: KVM: Implement 32bit " Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 11/31] arm64: KVM: Implement debug save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 12/31] arm64: KVM: Implement guest entry Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 13/31] arm64: KVM: Add patchable function selector Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 14/31] arm64: KVM: Implement the core world switch Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 15/31] arm64: KVM: Implement fpsimd save/restore Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 16/31] arm64: KVM: Implement TLB handling Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 17/31] arm64: KVM: HYP mode entry points Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 18/31] arm64: KVM: Add panic handling Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 19/31] arm64: KVM: Add compatibility aliases Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 20/31] arm64: KVM: Map the kernel RO section into HYP Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 21/31] arm64: KVM: Move away from the assembly version of the world switch Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 22/31] arm64: KVM: Turn system register numbers to an enum Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 23/31] arm64: KVM: Cleanup asm-offset.c Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 24/31] arm64: KVM: Remove weak attributes Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 25/31] ARM: KVM: Cleanup exception injection Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 26/31] arm64: KVM: debug: Remove spurious inline attributes Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 27/31] arm/arm64: KVM: Remove unreferenced S2_PGD_ORDER Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` Marc Zyngier [this message]
2015-12-24 11:12   ` [PATCH 28/31] arm: KVM: Make kvm_arm.h friendly to assembly code Marc Zyngier
2015-12-24 11:12 ` [PATCH 29/31] arm64: KVM: Add support for 16-bit VMID Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 30/31] MAINTAINERS: add git URL for KVM/ARM Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2015-12-24 11:12 ` [PATCH 31/31] arm/arm64: KVM: Detect vGIC presence at runtime Marc Zyngier
2015-12-24 11:12   ` Marc Zyngier
2016-01-07 10:07 ` [PULL] KVM/ARM updates for 4.5 Paolo Bonzini
2016-01-07 10:07   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450955559-15639-29-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dcb314@hotmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=gleb@kernel.org \
    --cc=jszhang@marvell.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.