Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1414659
| From | Shanker Donthineni <shankerd@codeaurora.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn |
| Date | 2016-06-06 07:50 +0200 |
| Message-ID | <rGVAe-Hu-13@gated-at.bofh.it> (permalink) |
| References | <rGVAd-Hu-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch adds the two handy helper functions for reading and writing
ITS BASERn register.
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
drivers/irqchip/irq-gic-v3-its.c | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5eb1f9e..6392c82 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -56,13 +56,14 @@ struct its_collection {
};
/*
- * The ITS_BASER structure - contains memory information and cached
- * value of BASER register configuration.
+ * The ITS_BASER structure - contains memory information, cached value
+ * of BASER register configuration and register idx.
*/
struct its_baser {
void *base;
u64 val;
u32 order;
+ u32 idx;
};
/*
@@ -824,6 +825,17 @@ static const char *its_base_type_string[] = {
[GITS_BASER_TYPE_RESERVED7] = "Reserved (7)",
};
+static u64 its_read_baser(struct its_node *its, struct its_baser *baser)
+{
+ return readq_relaxed(its->base + GITS_BASER + (baser->idx << 3));
+}
+
+static void its_write_baser(struct its_node *its, struct its_baser *baser,
+ u64 val)
+{
+ writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
+}
+
static void its_free_tables(struct its_node *its)
{
int i;
@@ -863,14 +875,20 @@ static int its_alloc_tables(const char *node_name, struct its_node *its)
its->device_ids = ids;
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
- u64 val = readq_relaxed(its->base + GITS_BASER + i * 8);
- u64 type = GITS_BASER_TYPE(val);
- u64 entry_size = GITS_BASER_ENTRY_SIZE(val);
+ struct its_baser *baser = its->tables + i;
int order = get_order(psz);
+ u64 val, type, entry_size;
int alloc_pages;
u64 tmp;
void *base;
+ /* Record the register index */
+ baser->idx = i;
+
+ val = its_read_baser(its, baser);
+ type = GITS_BASER_TYPE(val);
+ entry_size = GITS_BASER_ENTRY_SIZE(val);
+
if (type == GITS_BASER_TYPE_NONE)
continue;
@@ -939,8 +957,8 @@ retry_baser:
val |= alloc_pages - 1;
its->tables[i].val = val;
- writeq_relaxed(val, its->base + GITS_BASER + i * 8);
- tmp = readq_relaxed(its->base + GITS_BASER + i * 8);
+ its_write_baser(its, baser, val);
+ tmp = its_read_baser(its, baser);
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
/*
--
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V4 0/5] Add two-level support for ITS device table Shanker Donthineni <shankerd@codeaurora.org> - 2016-06-06 07:50 +0200
[PATCH V4 3/5] irqchip/gicv3-its: Split its_alloc_tables() into two functions Shanker Donthineni <shankerd@codeaurora.org> - 2016-06-06 07:50 +0200
[PATCH V4 4/5] irqchip/gicv3-its: Remove an unused argument 'node_name' Shanker Donthineni <shankerd@codeaurora.org> - 2016-06-06 07:50 +0200
[PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn Shanker Donthineni <shankerd@codeaurora.org> - 2016-06-06 07:50 +0200
Re: [PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn Marc Zyngier <marc.zyngier@arm.com> - 2016-06-06 10:40 +0200
Re: [PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn Marc Zyngier <marc.zyngier@arm.com> - 2016-06-06 15:10 +0200
csiph-web