qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yongbok Kim <yongbok.kim@imgtec.com>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>,
	Paul Burton <paul.burton@imgtec.com>
Subject: [Qemu-devel] [PATCH v5 1/8] hw/mips_cmgcr: allow GCR base to be moved
Date: Thu, 16 Feb 2017 00:27:23 +0000	[thread overview]
Message-ID: <1487204850-16448-2-git-send-email-yongbok.kim@imgtec.com> (raw)
In-Reply-To: <1487204850-16448-1-git-send-email-yongbok.kim@imgtec.com>

From: Paul Burton <paul.burton@imgtec.com>

Support moving the GCR base address & updating the CPU's CP0 CMGCRBase
register appropriately. This is required if a platform needs to move its
GCRs away from other memory, as the MIPS Boston development board does
to avoid its flash memory.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
 hw/misc/mips_cmgcr.c         | 17 +++++++++++++++++
 include/hw/misc/mips_cmgcr.h |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c
index b3ba166..a1edb53 100644
--- a/hw/misc/mips_cmgcr.c
+++ b/hw/misc/mips_cmgcr.c
@@ -29,6 +29,20 @@ static inline bool is_gic_connected(MIPSGCRState *s)
     return s->gic_mr != NULL;
 }
 
+static inline void update_gcr_base(MIPSGCRState *gcr, uint64_t val)
+{
+    CPUState *cpu;
+    MIPSCPU *mips_cpu;
+
+    gcr->gcr_base = val & GCR_BASE_GCRBASE_MSK;
+    memory_region_set_address(&gcr->iomem, gcr->gcr_base);
+
+    CPU_FOREACH(cpu) {
+        mips_cpu = MIPS_CPU(cpu);
+        mips_cpu->env.CP0_CMGCRBase = gcr->gcr_base >> 4;
+    }
+}
+
 static inline void update_cpc_base(MIPSGCRState *gcr, uint64_t val)
 {
     if (is_cpc_connected(gcr)) {
@@ -117,6 +131,9 @@ static void gcr_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
     MIPSGCRVPState *other_vps = &gcr->vps[current_vps->other];
 
     switch (addr) {
+    case GCR_BASE_OFS:
+        update_gcr_base(gcr, data);
+        break;
     case GCR_GIC_BASE_OFS:
         update_gic_base(gcr, data);
         break;
diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h
index a209d91..c9dfcb4 100644
--- a/include/hw/misc/mips_cmgcr.h
+++ b/include/hw/misc/mips_cmgcr.h
@@ -41,6 +41,9 @@
 #define GCR_L2_CONFIG_BYPASS_SHF    20
 #define GCR_L2_CONFIG_BYPASS_MSK    ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF)
 
+/* GCR_BASE register fields */
+#define GCR_BASE_GCRBASE_MSK     0xffffffff8000ULL
+
 /* GCR_GIC_BASE register fields */
 #define GCR_GIC_BASE_GICEN_MSK   1
 #define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL
-- 
2.7.4

  reply	other threads:[~2017-02-16  0:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  0:27 [Qemu-devel] [PATCH v5 0/8] MIPS Boston board support Yongbok Kim
2017-02-16  0:27 ` Yongbok Kim [this message]
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 2/8] hw/mips_gictimer: provide API for retrieving frequency Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 3/8] hw/mips_gic: Update pin state on mask changes Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 4/8] target-mips: Provide function to test if a CPU supports an ISA Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 5/8] dtc: Update requirement to v1.4.2 Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 6/8] loader: Support Flattened Image Trees (FIT images) Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 7/8] hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller Yongbok Kim
2017-02-16  0:27 ` [Qemu-devel] [PATCH v5 8/8] hw/mips: MIPS Boston board support Yongbok Kim

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=1487204850-16448-2-git-send-email-yongbok.kim@imgtec.com \
    --to=yongbok.kim@imgtec.com \
    --cc=aurelien@aurel32.net \
    --cc=paul.burton@imgtec.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).