Skip to contentSkip to conversation

Nios2 architecture support

PATCH New Marek Vasut 3 participants 13 messages Jan 18, 2017 – Feb 26, 2017

lore
Share & tools
lore
#0 lore raw

cover Nios2 architecture support

This patchset adds support for new Nios2 architecture as well as the initial set of models for hardware blocks and emulation of the Altera 10M50 GHRD devkit.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

Chris Wulff (3):
nios2: Add architecture emulation support
nios2: Add IIC interrupt controller emulation
nios2: Add periodic timer emulation

Marek Vasut (4):
nios2: Add disas entries
nios2: Add usermode binaries emulation
nios2: Add Altera 10M50 GHRD emulation
nios2: Add support for Nios-II R1

 MAINTAINERS                          |    8 +
 arch_init.c                          |    2 +
 configure                            |    5 +
 default-configs/nios2-linux-user.mak |    1 +
 default-configs/nios2-softmmu.mak    |    6 +
 disas/Makefile.objs                  |    1 +
 disas/nios2.c                        | 3534 ++++++++++++++++++++++++++++++++++
 hw/intc/Makefile.objs                |    1 +
 hw/intc/nios2_iic.c                  |  103 +
 hw/nios2/10m50_devboard.c            |  126 ++
 hw/nios2/Makefile.objs               |    1 +
 hw/nios2/boot.c                      |  223 +++
 hw/nios2/boot.h                      |   11 +
 hw/nios2/cpu_pic.c                   |   70 +
 hw/timer/Makefile.objs               |    1 +
 hw/timer/altera_timer.c              |  237 +++
 include/disas/bfd.h                  |    6 +
 include/elf.h                        |    2 +
 include/sysemu/arch_init.h           |    1 +
 linux-user/elfload.c                 |   57 +
 linux-user/main.c                    |  140 +-
 linux-user/nios2/syscall_nr.h        |  329 ++++
 linux-user/nios2/target_cpu.h        |   39 +
 linux-user/nios2/target_signal.h     |   26 +
 linux-user/nios2/target_structs.h    |   58 +
 linux-user/nios2/target_syscall.h    |   37 +
 linux-user/nios2/termbits.h          |  220 +++
 linux-user/signal.c                  |  238 ++-
 linux-user/syscall_defs.h            |    8 +-
 qemu-doc.texi                        |    3 +
 target/nios2/Makefile.objs           |    4 +
 target/nios2/cpu.c                   |  239 +++
 target/nios2/cpu.h                   |  272 +++
 target/nios2/helper.c                |  313 +++
 target/nios2/helper.h                |   27 +
 target/nios2/mmu.c                   |  296 +++
 target/nios2/mmu.h                   |   50 +
 target/nios2/monitor.c               |   35 +
 target/nios2/op_helper.c             |   47 +
 target/nios2/translate.c             |  958 +++++++++
 40 files changed, 7728 insertions(+), 7 deletions(-)
 create mode 100644 default-configs/nios2-linux-user.mak
 create mode 100644 default-configs/nios2-softmmu.mak
 create mode 100644 disas/nios2.c
 create mode 100644 hw/intc/nios2_iic.c
 create mode 100644 hw/nios2/10m50_devboard.c
 create mode 100644 hw/nios2/Makefile.objs
 create mode 100644 hw/nios2/boot.c
 create mode 100644 hw/nios2/boot.h
 create mode 100644 hw/nios2/cpu_pic.c
 create mode 100644 hw/timer/altera_timer.c
 create mode 100644 linux-user/nios2/syscall_nr.h
 create mode 100644 linux-user/nios2/target_cpu.h
 create mode 100644 linux-user/nios2/target_signal.h
 create mode 100644 linux-user/nios2/target_structs.h
 create mode 100644 linux-user/nios2/target_syscall.h
 create mode 100644 linux-user/nios2/termbits.h
 create mode 100644 target/nios2/Makefile.objs
 create mode 100644 target/nios2/cpu.c
 create mode 100644 target/nios2/cpu.h
 create mode 100644 target/nios2/helper.c
 create mode 100644 target/nios2/helper.h
 create mode 100644 target/nios2/mmu.c
 create mode 100644 target/nios2/mmu.h
 create mode 100644 target/nios2/monitor.c
 create mode 100644 target/nios2/op_helper.c
 create mode 100644 target/nios2/translate.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v5 3/7 nios2: Add usermode binaries emulation

Add missing bits for qemu-user required for emulating Altera Nios2 userspace binaries.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 include/elf.h                     |   2 +
 linux-user/elfload.c              |  57 +++++++
 linux-user/main.c                 | 140 +++++++++++++++-
 linux-user/nios2/syscall_nr.h     | 329 ++++++++++++++++++++++++++++++++++++++
 linux-user/nios2/target_cpu.h     |  39 +++++
 linux-user/nios2/target_signal.h  |  26 +++
 linux-user/nios2/target_structs.h |  58 +++++++
 linux-user/nios2/target_syscall.h |  37 +++++
 linux-user/nios2/termbits.h       | 220 +++++++++++++++++++++++++
 linux-user/signal.c               | 238 ++++++++++++++++++++++++++-
 linux-user/syscall_defs.h         |   8 +-
 11 files changed, 1147 insertions(+), 7 deletions(-)
 create mode 100644 linux-user/nios2/syscall_nr.h
 create mode 100644 linux-user/nios2/target_cpu.h
 create mode 100644 linux-user/nios2/target_signal.h
 create mode 100644 linux-user/nios2/target_structs.h
 create mode 100644 linux-user/nios2/target_syscall.h
 create mode 100644 linux-user/nios2/termbits.h
include/elf.h +2 -0
index 1c2975dc82..0dbd3e968b 100644
@@ -126,6 +126,8 @@ typedef int64_t  Elf64_Sxword;
  */
 #define EM_S390_OLD     0xA390
 
+#define EM_ALTERA_NIOS2 113     /* Altera Nios II soft-core processor */
+
 #define EM_MICROBLAZE      189
 #define EM_MICROBLAZE_OLD  0xBAAB
 
linux-user/elfload.c +57 -0

63 lines not on this page · raw message

linux-user/main.c +138 -2

158 lines not on this page · raw message

linux-user/nios2/syscall_nr.h new file +329 -0

329 lines not on this page · raw message

linux-user/nios2/target_cpu.h new file +39 -0
new file mode 100644
index 0000000000..20ab4790a9
@@ -0,0 +1,39 @@
+/*
+ * Nios2 specific CPU ABI and functions for linux-user
+ *
+ * Copyright (c) 2016 Marek Vasut <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TARGET_CPU_H
+#define TARGET_CPU_H
+
+static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp)
+{
+    if (newsp) {
+        env->regs[R_SP] = newsp;
+    }
+    env->regs[R_RET0] = 0;
+}
+
+static inline void cpu_set_tls(CPUNios2State *env, target_ulong newtls)
+{
+    /*
+     * Linux kernel 3.10 does not pay any attention to CLONE_SETTLS
+     * in copy_thread(), so QEMU need not do so either.
+     */
+}
+
+#endif
linux-user/nios2/target_signal.h new file +26 -0
new file mode 100644
index 0000000000..23a8267696
@@ -0,0 +1,26 @@
+#ifndef TARGET_SIGNAL_H
+#define TARGET_SIGNAL_H
+
+#include "cpu.h"
+
+/* this struct defines a stack used during syscall handling */
+
+typedef struct target_sigaltstack {
+    abi_long ss_sp;
+    abi_ulong ss_size;
+    abi_long ss_flags;
+} target_stack_t;
+
+/* sigaltstack controls  */
+#define TARGET_SS_ONSTACK     1
+#define TARGET_SS_DISABLE     2
+
+#define TARGET_MINSIGSTKSZ    2048
+#define TARGET_SIGSTKSZ       8192
+
+static inline abi_ulong get_sp_from_cpustate(CPUNios2State *state)
+{
+    return state->regs[R_SP];
+}
+
+#endif /* TARGET_SIGNAL_H */
linux-user/nios2/target_structs.h new file +58 -0

58 lines not on this page · raw message

linux-user/nios2/target_syscall.h new file +37 -0
new file mode 100644
index 0000000000..ca6b7e69f6
@@ -0,0 +1,37 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+#define UNAME_MACHINE "nios2"
+#define UNAME_MINIMUM_RELEASE "3.19.0"
+
+struct target_pt_regs {
+    unsigned long  r8;    /* r8-r15 Caller-saved GP registers */
+    unsigned long  r9;
+    unsigned long  r10;
+    unsigned long  r11;
+    unsigned long  r12;
+    unsigned long  r13;
+    unsigned long  r14;
+    unsigned long  r15;
+    unsigned long  r1;    /* Assembler temporary */
+    unsigned long  r2;    /* Retval LS 32bits */
+    unsigned long  r3;    /* Retval MS 32bits */
+    unsigned long  r4;    /* r4-r7 Register arguments */
+    unsigned long  r5;
+    unsigned long  r6;
+    unsigned long  r7;
+    unsigned long  orig_r2;    /* Copy of r2 ?? */
+    unsigned long  ra;    /* Return address */
+    unsigned long  fp;    /* Frame pointer */
+    unsigned long  sp;    /* Stack pointer */
+    unsigned long  gp;    /* Global pointer */
+    unsigned long  estatus;
+    unsigned long  ea;    /* Exception return address (pc) */
+    unsigned long  orig_r7;
+};
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
linux-user/nios2/termbits.h new file +220 -0

220 lines not on this page · raw message

linux-user/signal.c +236 -2

256 lines not on this page · raw message

linux-user/syscall_defs.h +5 -3
index 0b15466743..b83e7a58c5 100644
@@ -70,7 +70,8 @@
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
     || defined(TARGET_M68K) || defined(TARGET_CRIS) \
     || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \
-    || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)
+    || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
+    || defined(TARGET_NIOS2)
 
 #define TARGET_IOC_SIZEBITS	14
 #define TARGET_IOC_DIRBITS	2
@@ -417,7 +418,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
     || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
     || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
     || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
-    || defined(TARGET_TILEGX)
+    || defined(TARGET_TILEGX) || defined(TARGET_NIOS2)
 
 #if defined(TARGET_SPARC)
 #define TARGET_SA_NOCLDSTOP    8u
@@ -1974,7 +1975,8 @@ struct target_stat {
     abi_ulong  target_st_ctime_nsec;
     unsigned int __unused[2];
 };
-#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)
+#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \
+      defined(TARGET_NIOS2)
 
 /* These are the asm-generic versions of the stat and stat64 structures */
 
Signature · 1 line
2.11.0
#2 lore raw

PATCH v6 6/7 nios2: Add Altera 10M50 GHRD emulation

In reply to Marek Vasut

Add the Altera 10M50 Nios2 GHRD model. This allows emulating the 10M50 development kit with the Nios2 GHRD loaded in the FPGA. It is possible to boot Linux kernel and run userspace, thus far only from initrd as storage support is not yet implemented.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup, move cpu_pic.c here
V4: Add initrd DT address translation (thanks Guenter)
V5: Rebase on top of qemu/master
V6: Rebase on top of qemu/master

---
 hw/nios2/10m50_devboard.c | 126 ++++++++++++++++++++++++++
 hw/nios2/Makefile.objs    |   1 +
 hw/nios2/boot.c           | 223 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/nios2/boot.h           |  11 +++
 hw/nios2/cpu_pic.c        |  70 +++++++++++++++
 5 files changed, 431 insertions(+)
 create mode 100644 hw/nios2/10m50_devboard.c
 create mode 100644 hw/nios2/Makefile.objs
 create mode 100644 hw/nios2/boot.c
 create mode 100644 hw/nios2/boot.h
 create mode 100644 hw/nios2/cpu_pic.c
hw/nios2/10m50_devboard.c new file +126 -0
new file mode 100644
index 0000000000..62e5738b65
@@ -0,0 +1,126 @@
+/*
+ * Altera 10M50 Nios2 GHRD
+ *
+ * Copyright (c) 2016 Marek Vasut <[email protected]>
+ *
+ * Based on LabX device code
+ *
+ * Copyright (c) 2012 Chris Wulff <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
+
+#include "hw/sysbus.h"
+#include "hw/hw.h"
+#include "hw/char/serial.h"
+#include "sysemu/sysemu.h"
+#include "hw/boards.h"
+#include "exec/memory.h"
+#include "exec/address-spaces.h"
+#include "qemu/config-file.h"
+
+#include "boot.h"
+
+#define BINARY_DEVICE_TREE_FILE    "10m50-devboard.dtb"
+
+static void nios2_10m50_ghrd_init(MachineState *machine)
+{
+    Nios2CPU *cpu;
+    DeviceState *dev;
+    MemoryRegion *address_space_mem = get_system_memory();
+    MemoryRegion *phys_tcm = g_new(MemoryRegion, 1);
+    MemoryRegion *phys_tcm_alias = g_new(MemoryRegion, 1);
+    MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
+    MemoryRegion *phys_ram_alias = g_new(MemoryRegion, 1);
+    ram_addr_t tcm_base = 0x0;
+    ram_addr_t tcm_size = 0x1000;    /* 1 kiB, but QEMU limit is 4 kiB */
+    ram_addr_t ram_base = 0x08000000;
+    ram_addr_t ram_size = 0x08000000;
+    qemu_irq *cpu_irq, irq[32];
+    int i;
+
+    /* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */
+    memory_region_init_ram(phys_tcm, NULL, "nios2.tcm", tcm_size, &error_abort);
+    memory_region_init_alias(phys_tcm_alias, NULL, "nios2.tcm.alias",
+                             phys_tcm, 0, tcm_size);
+    vmstate_register_ram_global(phys_tcm);
+    memory_region_add_subregion(address_space_mem, tcm_base, phys_tcm);
+    memory_region_add_subregion(address_space_mem, 0xc0000000 + tcm_base,
+                                phys_tcm_alias);
+
+    /* Physical DRAM with alias at 0xc0000000 */
+    memory_region_init_ram(phys_ram, NULL, "nios2.ram", ram_size, &error_abort);
+    memory_region_init_alias(phys_ram_alias, NULL, "nios2.ram.alias",
+                             phys_ram, 0, ram_size);
+    vmstate_register_ram_global(phys_ram);
+    memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
+    memory_region_add_subregion(address_space_mem, 0xc0000000 + ram_base,
+                                phys_ram_alias);
+
+    /* Create CPU -- FIXME */
+    cpu = cpu_nios2_init("nios2");
+
+    /* Register: CPU interrupt controller (PIC) */
+    cpu_irq = nios2_cpu_pic_init(cpu);
+
+    /* Register: Internal Interrupt Controller (IIC) */
+    dev = qdev_create(NULL, "altera,iic");
+    qdev_prop_set_ptr(dev, "cpu", cpu);
+    qdev_init_nofail(dev);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);
+    for (i = 0; i < 32; i++) {
+        irq[i] = qdev_get_gpio_in(dev, i);
+    }
+
+    /* Register: Altera 16550 UART */
+    serial_mm_init(address_space_mem, 0xf8001600, 2, irq[1], 115200,
+                   serial_hds[0], DEVICE_NATIVE_ENDIAN);
+
+    /* Register: Timer sys_clk_timer  */
+    dev = qdev_create(NULL, "ALTR.timer");
+    qdev_prop_set_uint32(dev, "clock-frequency", 75 * 1000000);
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xf8001440);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[0]);
+
+    /* Register: Timer sys_clk_timer_1  */
+    dev = qdev_create(NULL, "ALTR.timer");
+    qdev_prop_set_uint32(dev, "clock-frequency", 75 * 1000000);
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xe0000880);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[5]);
+
+    /* Configure new exception vectors and reset CPU for it to take effect. */
+    cpu->reset_addr = 0xd4000000;
+    cpu->exception_addr = 0xc8000120;
+    cpu->fast_tlb_miss_addr = 0xc0000100;
+
+    nios2_load_kernel(cpu, ram_base, ram_size, machine->initrd_filename,
+                      BINARY_DEVICE_TREE_FILE, NULL);
+}
+
+static void nios2_10m50_ghrd_machine_init(struct MachineClass *mc)
+{
+    mc->desc = "Altera 10M50 GHRD Nios II design";
+    mc->init = nios2_10m50_ghrd_init;
+    mc->is_default = 1;
+}
+
+DEFINE_MACHINE("10m50-ghrd", nios2_10m50_ghrd_machine_init);
hw/nios2/Makefile.objs new file +1 -0
new file mode 100644
index 0000000000..6b5c421760
@@ -0,0 +1 @@
+obj-y = boot.o cpu_pic.o 10m50_devboard.o
hw/nios2/boot.c new file +223 -0

223 lines not on this page · raw message

hw/nios2/boot.h new file +11 -0
new file mode 100644
index 0000000000..3116753818
@@ -0,0 +1,11 @@
+#ifndef NIOS2_BOOT_H
+#define NIOS2_BOOT_H
+
+#include "hw/hw.h"
+#include "cpu.h"
+
+void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base, uint32_t ramsize,
+                       const char *initrd_filename, const char *dtb_filename,
+                       void (*machine_cpu_reset)(Nios2CPU *));
+
+#endif /* NIOS2_BOOT_H */
hw/nios2/cpu_pic.c new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

PATCH v5 4/7 nios2: Add IIC interrupt controller emulation

In reply to Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera Nios2 internal interrupt controller model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 hw/intc/Makefile.objs |   1 +
 hw/intc/nios2_iic.c   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +1 -0
index 2f44a2da26..8948106ac4 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_S390_FLIC_KVM) += s390_flic_kvm.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_vic.o
 obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o
 obj-$(CONFIG_MIPS_CPS) += mips_gic.o
+obj-$(CONFIG_NIOS2) += nios2_iic.o
hw/intc/nios2_iic.c new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
2.11.0
#4 lore raw

Re: [Qemu-devel] [PATCH V5 4/7] nios2: Add IIC interrupt controller emulation

I know this has been committed already, but here goes anyway:

Quoted 94 lines · Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera Nios2 internal interrupt controller model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 hw/intc/Makefile.objs |   1 +
 hw/intc/nios2_iic.c   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +1 -0
index 2f44a2da26..8948106ac4 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_S390_FLIC_KVM) += s390_flic_kvm.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_vic.o
 obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o
 obj-$(CONFIG_MIPS_CPS) += mips_gic.o
+obj-$(CONFIG_NIOS2) += nios2_iic.o
hw/intc/nios2_iic.c new file +56 -0
new file mode 100644
index 0000000000..818ab1b315
@@ -0,0 +1,103 @@
+/*
+ * QEMU Altera Internal Interrupt Controller.
+ *
+ * Copyright (c) 2012 Chris Wulff <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qapi/error.h"
+
+#include "hw/sysbus.h"
+#include "cpu.h"
+
+#define TYPE_ALTERA_IIC "altera,iic"
+#define ALTERA_IIC(obj) \
+    OBJECT_CHECK(AlteraIIC, (obj), TYPE_ALTERA_IIC)
+
+typedef struct AlteraIIC {
+    SysBusDevice  parent_obj;
+    void         *cpu;
+    qemu_irq      parent_irq;
+} AlteraIIC;
+
+static void update_irq(AlteraIIC *pv)
+{
+    CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
+
+    qemu_set_irq(pv->parent_irq,
+                 env->regs[CR_IPENDING] & env->regs[CR_IENABLE]);
+}
+
+static void irq_handler(void *opaque, int irq, int level)
+{
+    AlteraIIC *pv = opaque;
+    CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
+
+    env->regs[CR_IPENDING] &= ~(1 << irq);
+    env->regs[CR_IPENDING] |= !!level << irq;
+
+    update_irq(pv);
+}
+

hw/intc/nios2_iic.c line 66

Quoted 10 lines
hw/intc/nios2_iic.c new file +10 -0
+static void altera_iic_init(Object *obj)
+{
+    AlteraIIC *pv = ALTERA_IIC(obj);
+
+    qdev_init_gpio_in(DEVICE(pv), irq_handler, 32);
+    sysbus_init_irq(SYS_BUS_DEVICE(obj), &pv->parent_irq);
+}
+
+static Property altera_iic_properties[] = {
+    DEFINE_PROP_PTR("cpu", AlteraIIC, cpu),

Could this be a QOM link instead?

We want to get rid of pointer properties. Commit d2fe4ec converts one to a link.

Quoted 37 lines
hw/intc/nios2_iic.c new file +37 -0
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void altera_iic_realize(DeviceState *dev, Error **errp)
+{
+    struct AlteraIIC *pv = ALTERA_IIC(dev);
+
+    if (!pv->cpu) {
+        error_setg(errp, "altera,iic: CPU not connected");
+        return;
+    }
+}
+
+static void altera_iic_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = altera_iic_properties;
+    /* Reason: pointer property "cpu" */
+    dc->cannot_instantiate_with_device_add_yet = true;
+    dc->realize = altera_iic_realize;
+}
+
+static TypeInfo altera_iic_info = {
+    .name          = "altera,iic",
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(AlteraIIC),
+    .instance_init = altera_iic_init,
+    .class_init    = altera_iic_class_init,
+};
+
+static void altera_iic_register(void)
+{
+    type_register_static(&altera_iic_info);
+}
+
+type_init(altera_iic_register)
#5 lore raw

Re: [Qemu-devel] [PATCH V5 4/7] nios2: Add IIC interrupt controller emulation

Quoted 111 lines · Markus Armbruster

I know this has been committed already, but here goes anyway:

Quoted 94 lines · Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera Nios2 internal interrupt controller model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 hw/intc/Makefile.objs |   1 +
 hw/intc/nios2_iic.c   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +1 -0
index 2f44a2da26..8948106ac4 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_S390_FLIC_KVM) += s390_flic_kvm.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_vic.o
 obj-$(CONFIG_ARM_GIC) += arm_gicv3_cpuif.o
 obj-$(CONFIG_MIPS_CPS) += mips_gic.o
+obj-$(CONFIG_NIOS2) += nios2_iic.o
hw/intc/nios2_iic.c new file +56 -0
new file mode 100644
index 0000000000..818ab1b315
@@ -0,0 +1,103 @@
+/*
+ * QEMU Altera Internal Interrupt Controller.
+ *
+ * Copyright (c) 2012 Chris Wulff <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qapi/error.h"
+
+#include "hw/sysbus.h"
+#include "cpu.h"
+
+#define TYPE_ALTERA_IIC "altera,iic"
+#define ALTERA_IIC(obj) \
+    OBJECT_CHECK(AlteraIIC, (obj), TYPE_ALTERA_IIC)
+
+typedef struct AlteraIIC {
+    SysBusDevice  parent_obj;
+    void         *cpu;
+    qemu_irq      parent_irq;
+} AlteraIIC;
+
+static void update_irq(AlteraIIC *pv)
+{
+    CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
+
+    qemu_set_irq(pv->parent_irq,
+                 env->regs[CR_IPENDING] & env->regs[CR_IENABLE]);
+}
+
+static void irq_handler(void *opaque, int irq, int level)
+{
+    AlteraIIC *pv = opaque;
+    CPUNios2State *env = &((Nios2CPU *)(pv->cpu))->env;
+
+    env->regs[CR_IPENDING] &= ~(1 << irq);
+    env->regs[CR_IPENDING] |= !!level << irq;
+
+    update_irq(pv);
+}
+

hw/intc/nios2_iic.c line 66

Quoted 10 lines
hw/intc/nios2_iic.c new file +10 -0
+static void altera_iic_init(Object *obj)
+{
+    AlteraIIC *pv = ALTERA_IIC(obj);
+
+    qdev_init_gpio_in(DEVICE(pv), irq_handler, 32);
+    sysbus_init_irq(SYS_BUS_DEVICE(obj), &pv->parent_irq);
+}
+
+static Property altera_iic_properties[] = {
+    DEFINE_PROP_PTR("cpu", AlteraIIC, cpu),

Could this be a QOM link instead?

Quoted 2 lines

We want to get rid of pointer properties. Commit d2fe4ec converts one to a link.

By all means, yes. Can you send a patch ? I can help testing it. Otherwise I can cook one up, but it might take a few days.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

Re: [Qemu-devel] [PATCH V5 4/7] nios2: Add IIC interrupt controller emulation

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Markus Armbruster

I know this has been committed already, but here goes anyway:

Quoted 27 lines · Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera Nios2 internal interrupt controller model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 hw/intc/Makefile.objs |   1 +
 hw/intc/nios2_iic.c   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +0 -0
index 2f44a2da26..8948106ac4 100644

[...]

Quoted 10 lines
Quoted 7 lines

hw/intc/Makefile.objs

Quoted 2 lines
hw/intc/Makefile.objs +2 -0
+static Property altera_iic_properties[] = {
+    DEFINE_PROP_PTR("cpu", AlteraIIC, cpu),

Could this be a QOM link instead?

We want to get rid of pointer properties. Commit d2fe4ec converts one to a link.

By all means, yes. Can you send a patch ? I can help testing it. Otherwise I can cook one up, but it might take a few days.

I'm in a bit of a time squeeze right now, and I'd be grateful if you could do it. A few days sounds great to me.

#7 lore raw

Re: [Qemu-devel] [PATCH V5 4/7] nios2: Add IIC interrupt controller emulation

Quoted 40 lines · Markus Armbruster
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Markus Armbruster

I know this has been committed already, but here goes anyway:

Quoted 27 lines · Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera Nios2 internal interrupt controller model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master

---
 hw/intc/Makefile.objs |   1 +
 hw/intc/nios2_iic.c   | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 hw/intc/nios2_iic.c
hw/intc/Makefile.objs +0 -0
index 2f44a2da26..8948106ac4 100644

[...]

Quoted 5 lines
Quoted 5 lines

hw/intc/Makefile.objs

Quoted 2 lines
hw/intc/Makefile.objs +2 -0
+static Property altera_iic_properties[] = {
+    DEFINE_PROP_PTR("cpu", AlteraIIC, cpu),

Could this be a QOM link instead?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

We want to get rid of pointer properties. Commit d2fe4ec converts one to a link.

By all means, yes. Can you send a patch ? I can help testing it. Otherwise I can cook one up, but it might take a few days.

I'm in a bit of a time squeeze right now, and I'd be grateful if you could do it. A few days sounds great to me.

Heh, tell me about this time squeeze ...

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH v6 7/7 nios2: Add support for Nios-II R1

In reply to Marek Vasut

Add remaining bits of the Altera NiosII R1 support into qemu, which is documentation, MAINTAINERS file entry, configure bits, arch_init and configuration files for both linux-user (userland binaries) and softmmu (hardware emulation).

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: Rebase on top of qemu/master
V6: Pathname change in MAINTAINERS

---
 MAINTAINERS                          | 8 ++++++++
 arch_init.c                          | 2 ++
 configure                            | 5 +++++
 default-configs/nios2-linux-user.mak | 1 +
 default-configs/nios2-softmmu.mak    | 6 ++++++
 include/sysemu/arch_init.h           | 1 +
 qemu-doc.texi                        | 3 +++
 7 files changed, 26 insertions(+)
 create mode 100644 default-configs/nios2-linux-user.mak
 create mode 100644 default-configs/nios2-softmmu.mak
MAINTAINERS +8 -0
index 1444b26dc0..515f9fd31a 100644
@@ -181,6 +181,14 @@ F: disas/moxie.c
 F: hw/moxie/
 F: default-configs/moxie-softmmu.mak
 
+NiosII
+M: Chris Wulff <[email protected]>
+M: Marek Vasut <[email protected]>
+S: Maintained
+F: target/nios2/
+F: hw/nios2/
+F: disas/nios2.c
+
 OpenRISC
 M: Jia Liu <[email protected]>
 S: Maintained
arch_init.c +2 -0
index 5cc58b2c35..20d83ff5c0 100644
@@ -64,6 +64,8 @@ int graphic_depth = 32;
 #define QEMU_ARCH QEMU_ARCH_MIPS
 #elif defined(TARGET_MOXIE)
 #define QEMU_ARCH QEMU_ARCH_MOXIE
+#elif defined(TARGET_NIOS2)
+#define QEMU_ARCH QEMU_ARCH_NIOS2
 #elif defined(TARGET_OPENRISC)
 #define QEMU_ARCH QEMU_ARCH_OPENRISC
 #elif defined(TARGET_PPC)
configure +5 -0
index 86f5214dd0..48e7088948 100755
@@ -5935,6 +5935,8 @@ case "$target_name" in
   ;;
   moxie)
   ;;
+  nios2)
+  ;;
   or32)
     TARGET_ARCH=openrisc
     TARGET_BASE_ARCH=openrisc
@@ -6128,6 +6130,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
   moxie*)
     disas_config "MOXIE"
   ;;
+  nios2)
+    disas_config "NIOS2"
+  ;;
   or32)
     disas_config "OPENRISC"
   ;;
default-configs/nios2-linux-user.mak new file +1 -0
new file mode 100644
index 0000000000..5be3eb795d
@@ -0,0 +1 @@
+# Default configuration for nios2-linux-user
default-configs/nios2-softmmu.mak new file +6 -0
new file mode 100644
index 0000000000..74dc70caae
@@ -0,0 +1,6 @@
+# Default configuration for nios2-softmmu
+
+CONFIG_NIOS2=y
+CONFIG_SERIAL=y
+CONFIG_PTIMER=y
+CONFIG_ALTERA_TIMER=y
include/sysemu/arch_init.h +1 -0
index 1c9dad1b72..fe60e114b3 100644
@@ -23,6 +23,7 @@ enum {
     QEMU_ARCH_UNICORE32 = (1 << 14),
     QEMU_ARCH_MOXIE = (1 << 15),
     QEMU_ARCH_TRICORE = (1 << 16),
+    QEMU_ARCH_NIOS2 = (1 << 17),
 };
 
 extern const uint32_t arch_type;
qemu-doc.texi +3 -0
index 02cb39d430..672ed3a1dd 100644
@@ -2891,6 +2891,9 @@ The binary format is detected automatically.
 @command{qemu-mips} TODO.
 @command{qemu-mipsel} TODO.
 
+@cindex user mode (NiosII)
+@command{qemu-nios2} TODO.
+
 @cindex user mode (PowerPC)
 @command{qemu-ppc64abi32} TODO.
 @command{qemu-ppc64} TODO.
Signature · 1 line
2.11.0
#9 lore raw

PATCH v5 5/7 nios2: Add periodic timer emulation

In reply to Marek Vasut

From: Chris Wulff <[email protected]>

Add the Altera timer model.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Checkpatch cleanup
V4: Rebase on top of qemu/master
V5: - Rebase on top of qemu/master
- Drop the addr &= 0x7 , which is now deemed obsolete.

---
 hw/timer/Makefile.objs  |   1 +
 hw/timer/altera_timer.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 238 insertions(+)
 create mode 100644 hw/timer/altera_timer.c
hw/timer/Makefile.objs +1 -0
index 7ba8c23c75..0867a64754 100644
@@ -18,6 +18,7 @@ common-obj-$(CONFIG_IMX) += imx_gpt.o
 common-obj-$(CONFIG_LM32) += lm32_timer.o
 common-obj-$(CONFIG_MILKYMIST) += milkymist-sysctl.o
 
+obj-$(CONFIG_ALTERA_TIMER) += altera_timer.o
 obj-$(CONFIG_EXYNOS4) += exynos4210_mct.o
 obj-$(CONFIG_EXYNOS4) += exynos4210_pwm.o
 obj-$(CONFIG_EXYNOS4) += exynos4210_rtc.o
hw/timer/altera_timer.c new file +237 -0

237 lines not on this page · raw message

Signature · 1 line
2.11.0
#10 lore raw

PATCH v10 2/7 nios2: Add architecture emulation support

In reply to Marek Vasut

From: Chris Wulff <[email protected]>

Add support for emulating Altera NiosII R1 architecture into qemu. This patch is based on previous work by Chris Wulff from 2012 and updated to latest mainline QEMU.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V3: Thorough cleanup, deal with the review comments all over the place
V4: - Use extract32()
- Fix gen_goto_tb() , suppress tcg_gen_goto_tb()
- Clean up gen_check_supervisor() helper
- Use TCGMemOp type for flags
- Drop jump labels from wrctl/rdctl
- More TCG cleanup
V5: - Simplify load/store handling
- Handle loads into R_ZERO from protected page, add comment
V6: - Fix division opcode handling
- Add missing disas handling
- V5 review comments cleanup
V7: - Drop newline at the end of file
V8: - Rebase on top of qemu/master
V9: - Rebase on top of qemu/master
- Init CR_STATUS in nios2_cpu_reset to 0 for start in kernel mode
- Split mmu_read helper into mmu_read_debug helper which produces MMU debug output only if MMU debugging is enabled and standard tcg_gen_mov_tl() which facilitates the MMU register read itself.
- Turn MMU settings of the CPU into QoM properties
V10: - Replace imm5+32 with imm5+CR_BASE
- Make regnames const char * const []
- Rename "reserved" regs to "reservedN"
- Don't increment num_insns twice
- Use qemu_log_lock() around disas logging

---
 target/nios2/Makefile.objs |   4 +
 target/nios2/cpu.c         | 239 +++++++++++
 target/nios2/cpu.h         | 272 +++++++++++++
 target/nios2/helper.c      | 313 +++++++++++++++
 target/nios2/helper.h      |  27 ++
 target/nios2/mmu.c         | 296 ++++++++++++++
 target/nios2/mmu.h         |  50 +++
 target/nios2/monitor.c     |  35 ++
 target/nios2/op_helper.c   |  47 +++
 target/nios2/translate.c   | 958 +++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 2241 insertions(+)
 create mode 100644 target/nios2/Makefile.objs
 create mode 100644 target/nios2/cpu.c
 create mode 100644 target/nios2/cpu.h
 create mode 100644 target/nios2/helper.c
 create mode 100644 target/nios2/helper.h
 create mode 100644 target/nios2/mmu.c
 create mode 100644 target/nios2/mmu.h
 create mode 100644 target/nios2/monitor.c
 create mode 100644 target/nios2/op_helper.c
 create mode 100644 target/nios2/translate.c
target/nios2/Makefile.objs new file +4 -0
new file mode 100644
index 0000000000..2a11c5ce08
@@ -0,0 +1,4 @@
+obj-y += translate.o op_helper.o helper.o cpu.o mmu.o
+obj-$(CONFIG_SOFTMMU) += monitor.o
+
+$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
target/nios2/cpu.c new file +239 -0

239 lines not on this page · raw message

target/nios2/cpu.h new file +272 -0

272 lines not on this page · raw message

target/nios2/helper.c new file +313 -0

313 lines not on this page · raw message

target/nios2/helper.h new file +27 -0
new file mode 100644
index 0000000000..b0cb9146a5
@@ -0,0 +1,27 @@
+/*
+ * Altera Nios II helper routines header.
+ *
+ * Copyright (c) 2012 Chris Wulff <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/lgpl-2.1.html>
+ */
+
+DEF_HELPER_2(raise_exception, void, env, i32)
+
+#if !defined(CONFIG_USER_ONLY)
+DEF_HELPER_2(mmu_read_debug, void, env, i32)
+DEF_HELPER_3(mmu_write, void, env, i32, i32)
+DEF_HELPER_1(check_interrupts, void, env)
+#endif
target/nios2/mmu.c new file +296 -0

296 lines not on this page · raw message

target/nios2/mmu.h new file +50 -0

50 lines not on this page · raw message

target/nios2/monitor.c new file +35 -0
new file mode 100644
index 0000000000..422c81656a
@@ -0,0 +1,35 @@
+/*
+ * QEMU monitor
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "monitor/monitor.h"
+#include "monitor/hmp-target.h"
+#include "hmp.h"
+
+void hmp_info_tlb(Monitor *mon, const QDict *qdict)
+{
+    CPUArchState *env1 = mon_get_cpu_env();
+
+    dump_mmu((FILE *)mon, (fprintf_function)monitor_printf, env1);
+}
target/nios2/op_helper.c new file +47 -0

47 lines not on this page · raw message

target/nios2/translate.c new file +958 -0

958 lines not on this page · raw message

Signature · 1 line
2.11.0
#11 lore raw

PATCH v4 1/7 nios2: Add disas entries

In reply to Marek Vasut

Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:

include/opcode/nios2.h
include/opcode/nios2r1.h
include/opcode/nios2r2.h
opcodes/nios2-opc.c
opcodes/nios2-dis.c

Checkpatch says total: 114 errors, 0 warnings, 3609 lines checked , which is caused by a different coding style in those files. These warnings and errors are not addressed To let these files be easily synchronized between binutils and qemu.

Cc Chris Wulff <[email protected]>
Cc Jeff Da Silva <[email protected]>
Cc Ley Foon Tan <[email protected]>
Cc Sandra Loosemore <[email protected]>
Cc Yves Vandervennet <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Richard Henderson <[email protected]>

---
V2: Replace the nios2.c with GPL2 licensed version
V3: Rebase on top of qemu/master
V4: Rebase on top of qemu/master

---
 disas/Makefile.objs |    1 +
 disas/nios2.c       | 3534 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/disas/bfd.h |    6 +
 3 files changed, 3541 insertions(+)
 create mode 100644 disas/nios2.c
disas/Makefile.objs +1 -0
index 09bc992883..ac79d165c1 100644
@@ -14,6 +14,7 @@ common-obj-$(CONFIG_IA64_DIS) += ia64.o
 common-obj-$(CONFIG_M68K_DIS) += m68k.o
 common-obj-$(CONFIG_MICROBLAZE_DIS) += microblaze.o
 common-obj-$(CONFIG_MIPS_DIS) += mips.o
+common-obj-$(CONFIG_NIOS2_DIS) += nios2.o
 common-obj-$(CONFIG_MOXIE_DIS) += moxie.o
 common-obj-$(CONFIG_PPC_DIS) += ppc.o
 common-obj-$(CONFIG_S390_DIS) += s390.o
disas/nios2.c new file +3534 -0

2,993 lines not on this page · raw message

include/disas/bfd.h +6 -0
index 8a3488c2c5..0435b8c9f9 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.11.0

Part of the diff is not shown here. View the raw message.

Reviewed-by on v4 1/7
#12 lore raw

Re: [Qemu-devel] [PATCH V4 1/7] nios2: Add disas entries

Quoted 10 lines · Marek Vasut

Add nios2 disassembler support. This patch is composed from binutils files from commit "Opcodes and assembler support for Nios II R2". The files from binutils used in this patch are:

include/opcode/nios2.h
include/opcode/nios2r1.h
include/opcode/nios2r2.h
opcodes/nios2-opc.c
opcodes/nios2-dis.c

Quoted 4 lines

Checkpatch says total: 114 errors, 0 warnings, 3609 lines checked , which is caused by a different coding style in those files. These warnings and errors are not addressed To let these files be easily synchronized between binutils and qemu.

r~