All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] target-xtensa: implement do_unassigned_access
@ 2015-01-01 23:38 Max Filippov
  2015-01-01 23:38 ` [Qemu-devel] [PATCH 1/2] hw/xtensa: allow reads/writes in the system I/O region Max Filippov
  2015-01-01 23:38 ` [Qemu-devel] [PATCH 2/2] target-xtensa: implement do_unassigned_access callback Max Filippov
  0 siblings, 2 replies; 3+ messages in thread
From: Max Filippov @ 2015-01-01 23:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Hi,

this series implements do_unassigned_access callback for target-xtensa and
adds default memory access handler for the system I/O region of the XTFPGA
board to retain current behaviour.

Max Filippov (2):
  hw/xtensa: allow reads/writes in the system I/O region
  target-xtensa: implement do_unassigned_access callback

 hw/xtensa/xtfpga.c        | 20 +++++++++++++++++++-
 target-xtensa/cpu-qom.h   |  3 +++
 target-xtensa/cpu.c       |  1 +
 target-xtensa/op_helper.c | 14 ++++++++++++++
 4 files changed, 37 insertions(+), 1 deletion(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 1/2] hw/xtensa: allow reads/writes in the system I/O region
  2015-01-01 23:38 [Qemu-devel] [PATCH 0/2] target-xtensa: implement do_unassigned_access Max Filippov
@ 2015-01-01 23:38 ` Max Filippov
  2015-01-01 23:38 ` [Qemu-devel] [PATCH 2/2] target-xtensa: implement do_unassigned_access callback Max Filippov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2015-01-01 23:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Ignore writes to unassigned areas of system I/O regison and return 0 for
reads. This makes drivers for unimportant unimplemented hardware blocks
happy.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 hw/xtensa/xtfpga.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index e5a6bba..2c2f997 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -162,6 +162,23 @@ static void lx60_reset(void *opaque)
     cpu_reset(CPU(cpu));
 }
 
+static uint64_t lx60_io_read(void *opaque, hwaddr addr,
+        unsigned size)
+{
+    return 0;
+}
+
+static void lx60_io_write(void *opaque, hwaddr addr,
+        uint64_t val, unsigned size)
+{
+}
+
+static const MemoryRegionOps lx60_io_ops = {
+    .read = lx60_io_read,
+    .write = lx60_io_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
 static void lx_init(const LxBoardDesc *board, MachineState *machine)
 {
 #ifdef TARGET_WORDS_BIGENDIAN
@@ -211,7 +228,8 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
     memory_region_add_subregion(system_memory, 0, ram);
 
     system_io = g_malloc(sizeof(*system_io));
-    memory_region_init(system_io, NULL, "lx60.io", 224 * 1024 * 1024);
+    memory_region_init_io(system_io, NULL, &lx60_io_ops, NULL, "lx60.io",
+                          224 * 1024 * 1024);
     memory_region_add_subregion(system_memory, 0xf0000000, system_io);
     lx60_fpga_init(system_io, 0x0d020000);
     if (nd_table[0].used) {
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PATCH 2/2] target-xtensa: implement do_unassigned_access callback
  2015-01-01 23:38 [Qemu-devel] [PATCH 0/2] target-xtensa: implement do_unassigned_access Max Filippov
  2015-01-01 23:38 ` [Qemu-devel] [PATCH 1/2] hw/xtensa: allow reads/writes in the system I/O region Max Filippov
@ 2015-01-01 23:38 ` Max Filippov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2015-01-01 23:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Depending on access type raise either InstrPIFDataError or
LoadStorePIFDataError exception.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 target-xtensa/cpu-qom.h   |  3 +++
 target-xtensa/cpu.c       |  1 +
 target-xtensa/op_helper.c | 14 ++++++++++++++
 3 files changed, 18 insertions(+)

diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h
index 9de5c6e..2258224 100644
--- a/target-xtensa/cpu-qom.h
+++ b/target-xtensa/cpu-qom.h
@@ -85,6 +85,9 @@ static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
 
 void xtensa_cpu_do_interrupt(CPUState *cpu);
 bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request);
+void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
+                                     bool is_write, bool is_exec, int opaque,
+                                     unsigned size);
 void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
                            fprintf_function cpu_fprintf, int flags);
 hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c
index 6a5414f..2b75678 100644
--- a/target-xtensa/cpu.c
+++ b/target-xtensa/cpu.c
@@ -151,6 +151,7 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
 #ifndef CONFIG_USER_ONLY
     cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
     cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
+    cc->do_unassigned_access = xtensa_cpu_do_unassigned_access;
 #endif
     cc->debug_excp_handler = xtensa_breakpoint_handler;
     dc->vmsd = &vmstate_xtensa_cpu;
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 49e8634..be657e6 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -71,6 +71,20 @@ void tlb_fill(CPUState *cs,
     }
 }
 
+void xtensa_cpu_do_unassigned_access(CPUState *cs, hwaddr addr,
+                                     bool is_write, bool is_exec, int opaque,
+                                     unsigned size)
+{
+    XtensaCPU *cpu = XTENSA_CPU(cs);
+    CPUXtensaState *env = &cpu->env;
+
+    HELPER(exception_cause_vaddr)(env, env->pc,
+                                  is_exec ?
+                                  INSTR_PIF_ADDR_ERROR_CAUSE :
+                                  LOAD_STORE_PIF_ADDR_ERROR_CAUSE,
+                                  is_exec ? addr : cs->mem_io_vaddr);
+}
+
 static void tb_invalidate_virtual_addr(CPUXtensaState *env, uint32_t vaddr)
 {
     uint32_t paddr;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-01 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01 23:38 [Qemu-devel] [PATCH 0/2] target-xtensa: implement do_unassigned_access Max Filippov
2015-01-01 23:38 ` [Qemu-devel] [PATCH 1/2] hw/xtensa: allow reads/writes in the system I/O region Max Filippov
2015-01-01 23:38 ` [Qemu-devel] [PATCH 2/2] target-xtensa: implement do_unassigned_access callback Max Filippov

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.