[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v1 03/12] Arm: GICv3: Enable vreg_reg64_* macros for AArch32


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Fri, 21 Oct 2022 16:31:19 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JJMSyBlDQwvi9L8pMaAlcyuBO1JJuHAXtoeiZrBPh7s=; b=K3FEwDhy2a3PJp2oqwC6cJwgrnrn7WEtt8qOgWOtKQJZqHo0+gBdGxIXV1KpJWX4Q4I1CifVU6TPDoSUYZL6xl471fL/13Iehu2dlUsvc0P63kMU74cSgHu9mWPdLrYf3TPvR8hFC9a6TfGe71upyC+CR9YTnxP7jjSJpGRZPmTK14UZBDzSORv1/3hwb9l/y9D1wSZ6R0e0T+I+93+74RIRwpGKdfLZQXhg+eg4FP3bOFqi8PM6Uq/M5MbRaIzIqeexe1G1Sh6wA6mDxj3UODOMLw4LV2l2DDwt6JSoBqlQefUZZn26cZX/LXXc2BhJiZY+J48DNYTNCfibA+BwMQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5NlqKIp2AhLESUckS4yH+T0Ohi/XfCzEd5yvIohnxN/OV00rUc0xpXYcSdgEzuhlqGuUqwbtZiwyos2vdQN7vu9DCFjBl3rYCV71sNA6+/6ioq9AT9uuDf07vIJoFav8TOa9s03iaHG0PJY5d14XQs7+zYHskZo/RuUG6/8Nf9vnbMVpPCnzsF3uOg7h97+KE17TaWhaQzSwsIuoITv797nZaHPxMtmktS8K0N41ql3TwtM+xiPlyQDu7Qa8KFtE9xjHwTQH8ZxNiv6bFsB/vHltJqJMpME3LChm/5/+Nqq2Oy28QIIb1XumFCV94J6uyd8+zPGegKz0R5nYB6x0Q==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefanos@xxxxxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Delivery-date: Fri, 21 Oct 2022 15:32:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In some situations (eg GICR_TYPER), the hypervior may need to emulate
64bit registers in aarch32 mode. In such situations, the hypervisor may
need to read/modify the lower or upper 32 bits of the 64 bit register.

In aarch32, 64 bit is represented by unsigned long long. Thus, we need
to change the prototype accordingly.

Signed-off-by: Ayan Kumar Halder <ayankuma@xxxxxxx>
---
 xen/arch/arm/include/asm/vreg.h | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/include/asm/vreg.h b/xen/arch/arm/include/asm/vreg.h
index f26a70d024..ac6e702c5c 100644
--- a/xen/arch/arm/include/asm/vreg.h
+++ b/xen/arch/arm/include/asm/vreg.h
@@ -95,7 +95,7 @@ static inline bool vreg_emulate_sysreg(struct cpu_user_regs 
*regs, union hsr hsr
  * Note that the alignment fault will always be taken in the guest
  * (see B3.12.7 DDI0406.b).
  */
-static inline register_t vreg_reg_extract(unsigned long reg,
+static inline register_t vreg_reg_extract(unsigned long long reg,
                                           unsigned int offset,
                                           enum dabt_size size)
 {
@@ -105,7 +105,7 @@ static inline register_t vreg_reg_extract(unsigned long reg,
     return reg;
 }
 
-static inline void vreg_reg_update(unsigned long *reg, register_t val,
+static inline void vreg_reg_update(unsigned long long *reg, register_t val,
                                    unsigned int offset,
                                    enum dabt_size size)
 {
@@ -116,7 +116,7 @@ static inline void vreg_reg_update(unsigned long *reg, 
register_t val,
     *reg |= ((unsigned long)val & mask) << shift;
 }
 
-static inline void vreg_reg_setbits(unsigned long *reg, register_t bits,
+static inline void vreg_reg_setbits(unsigned long long *reg, register_t bits,
                                     unsigned int offset,
                                     enum dabt_size size)
 {
@@ -126,7 +126,7 @@ static inline void vreg_reg_setbits(unsigned long *reg, 
register_t bits,
     *reg |= ((unsigned long)bits & mask) << shift;
 }
 
-static inline void vreg_reg_clearbits(unsigned long *reg, register_t bits,
+static inline void vreg_reg_clearbits(unsigned long long *reg, register_t bits,
                                       unsigned int offset,
                                       enum dabt_size size)
 {
@@ -149,7 +149,7 @@ static inline void vreg_reg##sz##_update(uint##sz##_t *reg, 
            \
                                          register_t val,                \
                                          const mmio_info_t *info)       \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
+    unsigned long long tmp = *reg;                                      \
                                                                         \
     vreg_reg_update(&tmp, val, info->gpa & (offmask),                   \
                     info->dabt.size);                                   \
@@ -161,7 +161,7 @@ static inline void vreg_reg##sz##_setbits(uint##sz##_t 
*reg,            \
                                           register_t bits,              \
                                           const mmio_info_t *info)      \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
+    unsigned long long tmp = *reg;                                      \
                                                                         \
     vreg_reg_setbits(&tmp, bits, info->gpa & (offmask),                 \
                      info->dabt.size);                                  \
@@ -173,7 +173,7 @@ static inline void vreg_reg##sz##_clearbits(uint##sz##_t 
*reg,          \
                                             register_t bits,            \
                                             const mmio_info_t *info)    \
 {                                                                       \
-    unsigned long tmp = *reg;                                           \
+    unsigned long long tmp = *reg;                                      \
                                                                         \
     vreg_reg_clearbits(&tmp, bits, info->gpa & (offmask),               \
                        info->dabt.size);                                \
@@ -181,15 +181,8 @@ static inline void vreg_reg##sz##_clearbits(uint##sz##_t 
*reg,          \
     *reg = tmp;                                                         \
 }
 
-/*
- * 64 bits registers are only supported on platform with 64-bit long.
- * This is also allow us to optimize the 32 bit case by using
- * unsigned long rather than uint64_t
- */
-#if BITS_PER_LONG == 64
-VREG_REG_HELPERS(64, 0x7);
-#endif
 VREG_REG_HELPERS(32, 0x3);
+VREG_REG_HELPERS(64, 0x7);
 
 #undef VREG_REG_HELPERS
 
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.