All of lore.kernel.org
 help / color / mirror / Atom feed
From: vijay.kilari@gmail.com
To: Ian.Campbell@citrix.com, julien.grall@linaro.org,
	stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com,
	tim@xen.org, xen-devel@lists.xen.org
Cc: Prasun.Kapoor@caviumnetworks.com,
	Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>,
	manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com
Subject: [RFC PATCH 04/19] xen/arm: its: Move ITS command encode helper functions
Date: Mon,  2 Mar 2015 18:00:20 +0530	[thread overview]
Message-ID: <1425299435-3278-5-git-send-email-vijay.kilari@gmail.com> (raw)
In-Reply-To: <1425299435-3278-1-git-send-email-vijay.kilari@gmail.com>

From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>

ITS command encode functions are moved to
header file gits-its.h and made as inline functions.
This will be useful later in virtual its driver

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
---
 xen/arch/arm/gic-v3-its.c     |   71 +---------------------------
 xen/include/asm-arm/gic-its.h |  104 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 70 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index cde0ec0..53850fe 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -39,6 +39,7 @@
 #include <asm/device.h>
 #include <asm/gic.h>
 #include <asm/gic_v3_defs.h>
+#include <asm/gic-its.h>
 
 #define its_print(lvl, fmt, ...)                                        \
     printk(lvl "GIC-ITS:" fmt, ## __VA_ARGS__)
@@ -162,82 +163,12 @@ struct its_cmd_desc {
     };
 };
 
-/*
- * The ITS command block, which is what the ITS actually parses.
- */
-struct its_cmd_block {
-    u64 raw_cmd[4];
-};
-
 #define ITS_CMD_QUEUE_SZ            SZ_64K
 #define ITS_CMD_QUEUE_NR_ENTRIES    (ITS_CMD_QUEUE_SZ / sizeof(struct its_cmd_block))
 
 typedef struct its_collection *(*its_cmd_builder_t)(struct its_cmd_block *,
                                 struct its_cmd_desc *);
 
-static void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr)
-{
-    cmd->raw_cmd[0] &= ~0xffULL;
-    cmd->raw_cmd[0] |= cmd_nr;
-}
-
-static void its_encode_devid(struct its_cmd_block *cmd, u32 devid)
-{
-    cmd->raw_cmd[0] &= 0xffffffffULL;
-    cmd->raw_cmd[0] |= ((u64)devid) << 32;
-}
-
-static void its_encode_event_id(struct its_cmd_block *cmd, u32 id)
-{
-    cmd->raw_cmd[1] &= ~0xffffffffULL;
-    cmd->raw_cmd[1] |= id;
-}
-
-static void its_encode_phys_id(struct its_cmd_block *cmd, u32 phys_id)
-{
-    cmd->raw_cmd[1] &= 0xffffffffULL;
-    cmd->raw_cmd[1] |= ((u64)phys_id) << 32;
-}
-
-static void its_encode_size(struct its_cmd_block *cmd, u8 size)
-{
-    cmd->raw_cmd[1] &= ~0xffULL;
-    cmd->raw_cmd[1] |= size;
-}
-
-static void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr)
-{
-    cmd->raw_cmd[2] &= ~0xffffffffffffULL;
-    cmd->raw_cmd[2] |= itt_addr & 0xffffffffff00ULL;
-}
-
-static void its_encode_valid(struct its_cmd_block *cmd, int valid)
-{
-    cmd->raw_cmd[2] &= ~(1ULL << 63);
-    cmd->raw_cmd[2] |= ((u64)!!valid) << 63;
-}
-
-static void its_encode_target(struct its_cmd_block *cmd, u64 target_addr)
-{
-    cmd->raw_cmd[2] &= ~(0xffffffffULL << 16);
-    cmd->raw_cmd[2] |= (target_addr & (0xffffffffULL << 16));
-}
-
-static void its_encode_collection(struct its_cmd_block *cmd, u16 col)
-{
-    cmd->raw_cmd[2] &= ~0xffffULL;
-    cmd->raw_cmd[2] |= col;
-}
-
-static inline void its_fixup_cmd(struct its_cmd_block *cmd)
-{
-    /* Let's fixup BE commands */
-    cmd->raw_cmd[0] = cpu_to_le64(cmd->raw_cmd[0]);
-    cmd->raw_cmd[1] = cpu_to_le64(cmd->raw_cmd[1]);
-    cmd->raw_cmd[2] = cpu_to_le64(cmd->raw_cmd[2]);
-    cmd->raw_cmd[3] = cpu_to_le64(cmd->raw_cmd[3]);
-}
-
 static struct its_collection *its_build_mapd_cmd(struct its_cmd_block *cmd,
                                                  struct its_cmd_desc *desc)
 {
diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h
new file mode 100644
index 0000000..099ed9c
--- /dev/null
+++ b/xen/include/asm-arm/gic-its.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2013, 2014 ARM Limited, All Rights Reserved.
+ * Author: Marc Zyngier <marc.zyngier@arm.com>
+ *
+ * Xen changes:
+ * Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
+ * Copyright (C) 2014, 2015 Cavium Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __ASM_ARM_GIC_ITS_H__
+#define __ASM_ARM_GIC_ITS_H__
+
+/*
+ * The ITS command block, which is what the ITS actually parses.
+ */
+struct its_cmd_block {
+    u64 raw_cmd[4];
+};
+
+static inline void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr)
+{
+    cmd->raw_cmd[0] &= ~0xffULL;
+    cmd->raw_cmd[0] |= cmd_nr;
+}
+
+static inline void its_encode_devid(struct its_cmd_block *cmd, u32 devid)
+{
+    cmd->raw_cmd[0] &= 0xffffffffULL;
+    cmd->raw_cmd[0] |= ((u64)devid) << 32;
+}
+
+static inline void its_encode_event_id(struct its_cmd_block *cmd, u32 id)
+{
+    cmd->raw_cmd[1] &= ~0xffffffffULL;
+    cmd->raw_cmd[1] |= id;
+}
+
+static inline void its_encode_phys_id(struct its_cmd_block *cmd, u32 phys_id)
+{
+    cmd->raw_cmd[1] &= 0xffffffffULL;
+    cmd->raw_cmd[1] |= ((u64)phys_id) << 32;
+}
+
+static inline void its_encode_size(struct its_cmd_block *cmd, u8 size)
+{
+    cmd->raw_cmd[1] &= ~0xffULL;
+    cmd->raw_cmd[1] |= size;
+}
+
+static inline void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr)
+{
+    cmd->raw_cmd[2] &= ~0xffffffffffffULL;
+    cmd->raw_cmd[2] |= itt_addr & 0xffffffffff00ULL;
+}
+
+static inline void its_encode_valid(struct its_cmd_block *cmd, int valid)
+{
+    cmd->raw_cmd[2] &= ~(1ULL << 63);
+    cmd->raw_cmd[2] |= ((u64)!!valid) << 63;
+}
+
+static inline void its_encode_target(struct its_cmd_block *cmd, u64 target_addr)
+{
+    cmd->raw_cmd[2] &= ~(0xffffffffULL << 16);
+    cmd->raw_cmd[2] |= (target_addr & (0xffffffffULL << 16));
+}
+
+static inline void its_encode_collection(struct its_cmd_block *cmd, u16 col)
+{
+    cmd->raw_cmd[2] &= ~0xffffULL;
+    cmd->raw_cmd[2] |= col;
+}
+
+static inline void its_fixup_cmd(struct its_cmd_block *cmd)
+{
+    /* Let's fixup BE commands */
+    cmd->raw_cmd[0] = cpu_to_le64(cmd->raw_cmd[0]);
+    cmd->raw_cmd[1] = cpu_to_le64(cmd->raw_cmd[1]);
+    cmd->raw_cmd[2] = cpu_to_le64(cmd->raw_cmd[2]);
+    cmd->raw_cmd[3] = cpu_to_le64(cmd->raw_cmd[3]);
+}
+
+#endif /* __ASM_ARM_GIC_ITS_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
1.7.9.5

  parent reply	other threads:[~2015-03-02 12:30 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 12:30 [RFC PATCH 00/19] xen/arm: Add ITS support vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 01/19] xen/arm: add linked list apis vijay.kilari
2015-03-02 13:21   ` Jan Beulich
2015-03-02 12:30 ` [RFC PATCH 02/19] xen/arm: its: Import GICv3 ITS driver from linux vijay.kilari
2015-03-13 10:24   ` Julien Grall
2015-03-13 10:35     ` Julien Grall
2015-03-16  9:55       ` Vijay Kilari
2015-03-16 10:12         ` Stefano Stabellini
2015-03-16 13:04           ` Julien Grall
2015-03-16 13:15         ` Julien Grall
2015-03-16 13:32           ` Vijay Kilari
2015-03-02 12:30 ` [RFC PATCH 03/19] xen/arm: its: Port ITS driver to xen vijay.kilari
2015-03-13 11:46   ` Julien Grall
2015-03-16 14:06     ` Vijay Kilari
2015-03-16 14:20       ` Julien Grall
2015-03-16 16:03         ` Vijay Kilari
2015-03-16 16:18           ` Julien Grall
2015-03-02 12:30 ` vijay.kilari [this message]
2015-03-02 12:30 ` [RFC PATCH 05/19] xen/arm: its: Remove unused code in ITS driver vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 06/19] xen/arm: its: Add helper functions to decode ITS Command vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 07/19] xen/arm: vits: Move LPI handling to basic virtual its driver vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 08/19] xen/arm: Add helper function to get domain page vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 09/19] xen/arm: Update irq descriptor for LPIs support vijay.kilari
2015-03-02 14:17   ` Julien Grall
2015-03-03 17:54   ` Stefano Stabellini
2015-03-02 12:30 ` [RFC PATCH 10/19] xen/arm: its: Add virtual ITS command support vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 11/19] xen/arm: its: Add emulation of ITS control registers vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 12/19] xen/arm: its: Add support to emulate GICR register for LPIs vijay.kilari
2015-03-03 17:16   ` Stefano Stabellini
2015-03-04 12:10     ` Stefano Stabellini
2015-03-02 12:30 ` [RFC PATCH 13/19] xen/arm: its: implement hw_irq_controller " vijay.kilari
2015-03-03 17:28   ` Stefano Stabellini
2015-03-09 13:03     ` Vijay Kilari
2015-03-09 16:09       ` Stefano Stabellini
2015-03-09 16:32         ` Vijay Kilari
2015-03-02 12:30 ` [RFC PATCH 14/19] xen/arm: vits: Map ITS translation space vijay.kilari
2015-03-03 17:31   ` Stefano Stabellini
2015-03-03 17:41     ` Julien Grall
2015-03-02 12:30 ` [RFC PATCH 15/19] xen/arm: gicv3: Refactor redistributor information vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 16/19] xen/arm: its: Dynamic allocation of LPI descriptors vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 17/19] xen/arm: its: Support ITS interrupt handling vijay.kilari
2015-03-03 18:07   ` Stefano Stabellini
2015-03-03 19:49     ` Julien Grall
2015-03-04  9:57       ` Stefano Stabellini
2015-03-02 12:30 ` [RFC PATCH 18/19] xen/arm: its: Generate ITS node for Dom0 vijay.kilari
2015-03-02 12:30 ` [RFC PATCH 19/19] xen/arm: its: Initialize virtual and physical ITS driver vijay.kilari
2015-03-02 13:19 ` [RFC PATCH 00/19] xen/arm: Add ITS support Julien Grall
2015-03-03  3:55   ` Vijay Kilari
2015-03-03 11:43     ` Julien Grall
2015-03-09 12:57       ` Vijay Kilari
2015-03-09 16:06         ` Stefano Stabellini
2015-03-09 18:16         ` Julien Grall
2015-03-13  4:48           ` Vijay Kilari
2015-03-13 10:13             ` Julien Grall
2015-03-16 10:30               ` Vijay Kilari
2015-03-02 14:53 ` Ian Campbell
2015-03-02 17:39   ` Ian Campbell
2015-03-03  4:02     ` Vijay Kilari
2015-03-03 10:07       ` Ian Campbell

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=1425299435-3278-5-git-send-email-vijay.kilari@gmail.com \
    --to=vijay.kilari@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=Vijaya.Kumar@caviumnetworks.com \
    --cc=julien.grall@linaro.org \
    --cc=manish.jaggi@caviumnetworks.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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.