qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: <marcin.krzeminski@nokia.com>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
	rfsw-patches@mlist.nokia.com
Subject: [Qemu-devel] [RFC 3/3] exec: Allow to change Address Space from board level
Date: Fri, 16 Dec 2016 14:22:39 +0100	[thread overview]
Message-ID: <1481894559-13974-4-git-send-email-marcin.krzeminski@nokia.com> (raw)
In-Reply-To: <1481894559-13974-1-git-send-email-marcin.krzeminski@nokia.com>

From: Marcin Krzeminski <marcin.krzeminski@nokia.com>

By introduction of CPUAddressSpace table it is not possible
to change address space for CPU from board code. In my case
Cortex-M3 core has it own address space that is created at board
level, then updated by changing cpu->as. For current code cpu->as
is used only at init, so changing it does not change actual
address space.

Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
---
 exec.c            | 8 ++++++++
 include/qom/cpu.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/exec.c b/exec.c
index 08c558e..9c6e302 100644
--- a/exec.c
+++ b/exec.c
@@ -628,6 +628,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
     /* Return the AddressSpace corresponding to the specified index */
     return cpu->cpu_ases[asidx].as;
 }
+
+void cpu_set_address_space(CPUState *cpu, AddressSpace *as, int asidx)
+{
+    /* Return the AddressSpace corresponding to the specified index */
+    if (asidx < cpu->num_ases) {
+        cpu->cpu_ases[asidx].as = as;
+    }
+}
 #endif
 
 void cpu_exec_unrealizefn(CPUState *cpu)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 3f79a8e..7e2ead8 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -964,6 +964,7 @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
  * specifies which address space to read.
  */
 AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
+void cpu_set_address_space(CPUState *cpu, AddressSpace *as, int asidx);
 
 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
     GCC_FMT_ATTR(2, 3);
-- 
2.7.4

  parent reply	other threads:[~2016-12-16 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-16 13:22 [Qemu-devel] [RFC 0/3] MultiCPU changes marcin.krzeminski
2016-12-16 13:22 ` [Qemu-devel] [RFC 1/3] nvic: Add CPU numebr property marcin.krzeminski
2016-12-16 14:18   ` Peter Maydell
2016-12-30 10:13     ` [Qemu-devel] Odp.: " Krzeminski, Marcin (Nokia - PL/Wroclaw)
2016-12-16 13:22 ` [Qemu-devel] [RFC 2/3] ARM: boot: Add option to skip FDT memory node update marcin.krzeminski
2016-12-16 13:22 ` marcin.krzeminski [this message]
2016-12-16 14:07 ` [Qemu-devel] [RFC 0/3] MultiCPU changes no-reply

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=1481894559-13974-4-git-send-email-marcin.krzeminski@nokia.com \
    --to=marcin.krzeminski@nokia.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rfsw-patches@mlist.nokia.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 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).