From nobody Fri Dec 19 06:17:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1567433246; cv=none; d=zoho.com; s=zohoarc; b=GPrs4OYwUnXAF9XUrZm7LTAjmNgrmYQ/YiCJ2AtB80xBR27hUO05Gi6DuxNmUbo2geSlkNbqdOKmL7yISCCPqxoHVcEmWhzzEJz1xToqe3f0PRs5ueqMr+YUvKYE8lrFUUF8w8bHXA6MfePl1y6kTbUrBpL/mcXuAPG/Mw0fskY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567433246; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8SLfw0/2Ku5X6IRqAPpVCtV652oy7jl6MOg915Zxv4E=; b=DN0SNow4LuQrIf1oZBtqiUPlkqvMK4HPixUksnmth5RASBrTzZeAZC7+Y+isy3S+JCYdXNbGU+ExeF2vHuQ6Zursm1zpdemW9rZF1Rf+BTIlmbiur+l1WsD6pTGmSLl4r8ZmWQYMlQOMj3QEeVVPfzo8I7iXKEOK0jmB6S63a8I= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567433246444858.7452472326784; Mon, 2 Sep 2019 07:07:26 -0700 (PDT) Received: from localhost ([::1]:36952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4mzL-00084N-7Q for importer@patchew.org; Mon, 02 Sep 2019 10:07:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55939) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i4mtv-0003Gl-KT for qemu-devel@nongnu.org; Mon, 02 Sep 2019 10:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i4mts-0007xU-UF for qemu-devel@nongnu.org; Mon, 02 Sep 2019 10:01:47 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:39708) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i4mts-0007wC-MY for qemu-devel@nongnu.org; Mon, 02 Sep 2019 10:01:44 -0400 Received: by mail-pf1-x443.google.com with SMTP id s12so2047915pfe.6 for ; Mon, 02 Sep 2019 07:01:44 -0700 (PDT) Received: from 8c859074c0ff.ant.amazon.com.com ([206.81.201.98]) by smtp.gmail.com with ESMTPSA id v18sm4562020pfn.24.2019.09.02.07.01.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Sep 2019 07:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8SLfw0/2Ku5X6IRqAPpVCtV652oy7jl6MOg915Zxv4E=; b=R1dsnpsSsSwIoD61ydf0yRNTjYBcqapusHTdszGZNkpjLgcgH+Potn8q72FfZ7IPXu rQZfnOPLnqAESR8guC2XnWiW6wKCh3oyPDGbaWlsVeksn28zfbck9gsKpaunl7jIcuPC u1Um7cuSSkbttXh9cKHNtdlC2m3O2hmrmHQz/kBOcb6hLetvX+ewRSbvRu4FzFl5I2j+ 4qSPND0M/GLsB921tRNbepUrynC3Usal8lLlAEjwMtIjClB4jNwZ6x0ODa6u37417Efl eAT9Mubc71HSqbYc6POXYrBLq2f8Euo4er6oV6mkYCNmhI0cc66O+Edrq1LprLK/JEO3 llnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8SLfw0/2Ku5X6IRqAPpVCtV652oy7jl6MOg915Zxv4E=; b=c4Q8CDP3RmqIm50BQkseQlrofPUsr2/6/ZBz3pA2sNaBDcgZ5Dqc+n6hTThspBV8vx KXBe0KFcNK2Em38oyHAYbYzq/GcbITzvhCUeZAooqaL4rmJcDYMNu/mVvq0wSo8Y1JI7 UCe5d4qQlRw3goLCItBouxtNR89Hm4mEvjvPS1g33c5oBP0DMPMWQ+OmuV+CWCdcMRTC BI0XQ4F/ObUi3lZ83+lQO6nFB2XJaPHj9ansuJG7F1z4C3inmc1Voqqp+sSSbwC1LD3B kRiGEW5ZuTRuVKWZpkAYws7mC78hHNWGNjoHqO5NvYhzFw5MyTr7b9G96p9CdXCOM9Qo p8yw== X-Gm-Message-State: APjAAAWPalI+DN/ME3qpdZm1lmau9w19glBhBH8PFqZDFS1/XLHyauZi 6ZDx37DsOgTqR8CKhs8hW2hyWz2ITmWA9WLX X-Google-Smtp-Source: APXvYqx23uSf8rVV3IbR5rNpnfXkYFYziN5aXNDPfmFamnClO/B/+kYzXEbSVKuie8cEDUOtOQ3OmQ== X-Received: by 2002:a17:90a:983:: with SMTP id 3mr3835750pjo.57.1567432903375; Mon, 02 Sep 2019 07:01:43 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Date: Mon, 2 Sep 2019 17:01:33 +0300 Message-Id: <20190902140134.74081-8-mrolnik@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20190902140134.74081-1-mrolnik@gmail.com> References: <20190902140134.74081-1-mrolnik@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v30 7/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, dovgaluk@ispras.ru, richard.henderson@linaro.org, Michael Rolnik , imammedo@redhat.com, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Michael Rolnik --- MAINTAINERS | 6 +++ arch_init.c | 2 + configure | 93 ++++++++++++++++++--------------- default-configs/avr-softmmu.mak | 5 ++ include/disas/dis-asm.h | 6 +++ include/sysemu/arch_init.h | 1 + qapi/machine.json | 3 +- target/avr/Makefile.objs | 33 ++++++++++++ tests/machine-none-test.c | 1 + 9 files changed, 106 insertions(+), 44 deletions(-) create mode 100644 default-configs/avr-softmmu.mak create mode 100644 target/avr/Makefile.objs diff --git a/MAINTAINERS b/MAINTAINERS index ef6c01084b..763370e6ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -163,6 +163,12 @@ S: Maintained F: hw/arm/smmu* F: include/hw/arm/smmu* =20 +AVR TCG CPUs +M: Michael Rolnik +S: Maintained +F: target/avr/ +F: hw/avr/ + CRIS TCG CPUs M: Edgar E. Iglesias S: Maintained diff --git a/arch_init.c b/arch_init.c index 0a1531124c..fb308aa802 100644 --- a/arch_init.c +++ b/arch_init.c @@ -85,6 +85,8 @@ int graphic_depth =3D 32; #define QEMU_ARCH QEMU_ARCH_UNICORE32 #elif defined(TARGET_XTENSA) #define QEMU_ARCH QEMU_ARCH_XTENSA +#elif defined(TARGET_AVR) +#define QEMU_ARCH QEMU_ARCH_AVR #endif =20 const uint32_t arch_type =3D QEMU_ARCH; diff --git a/configure b/configure index e44e454c43..b35a7cf214 100755 --- a/configure +++ b/configure @@ -2032,7 +2032,7 @@ EOF =20 if ! compile_prog "-Werror" "" ; then error_exit "Your compiler does not support the __thread specifier for = " \ - "Thread-Local Storage (TLS). Please upgrade to a version that does." + "Thread-Local Storage (TLS). Please upgrade to a version that does." fi =20 if test "$pie" =3D ""; then @@ -2820,7 +2820,7 @@ if test "$gnutls" !=3D "no"; then fi fi if test "$pass" =3D "no" && test "$gnutls" =3D "yes"; then - feature_not_found "gnutls" "Install gnutls devel >=3D 3.1.18" + feature_not_found "gnutls" "Install gnutls devel >=3D 3.1.18" else gnutls=3D"$pass" fi @@ -2852,16 +2852,16 @@ fi has_libgcrypt() { if ! has "libgcrypt-config" then - return 1 + return 1 fi =20 if test -n "$cross_prefix" then - host=3D$(libgcrypt-config --host) - if test "$host-" !=3D $cross_prefix - then - return 1 - fi + host=3D$(libgcrypt-config --host) + if test "$host-" !=3D $cross_prefix + then + return 1 + fi fi =20 maj=3D`libgcrypt-config --version | awk -F . '{print $1}'` @@ -3071,7 +3071,7 @@ EOF sdl_cflags=3D"$sdl_cflags $(aalib-config --cflags 2>/dev/null)" fi if compile_prog "$sdl_cflags" "$sdl_libs" ; then - : + : else sdl=3Dno fi @@ -3689,8 +3689,8 @@ EOF if ! compile_prog "$CFLAGS" "$LIBS" ; then error_exit "sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T."\ "You probably need to set PKG_CONFIG_LIBDIR"\ - "to point to the right pkg-config files for your"\ - "build target" + "to point to the right pkg-config files for your"\ + "build target" fi =20 # Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage @@ -4200,8 +4200,8 @@ if test "$glusterfs" !=3D "no" ; then int main(void) { - /* new glfs_ftruncate() passes two additional args */ - return glfs_ftruncate(NULL, 0, NULL, NULL); + /* new glfs_ftruncate() passes two additional args */ + return glfs_ftruncate(NULL, 0, NULL, NULL); } EOF if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then @@ -4218,9 +4218,9 @@ glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glf= s_stat *prestat, struct glf int main(void) { - glfs_io_cbk iocb =3D &glusterfs_iocb; - iocb(NULL, 0 , NULL, NULL, NULL); - return 0; + glfs_io_cbk iocb =3D &glusterfs_iocb; + iocb(NULL, 0 , NULL, NULL, NULL); + return 0; } EOF if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then @@ -4247,8 +4247,8 @@ cat > $TMPC << EOF int main(void) { - /* try to start inotify */ - return inotify_init(); + /* try to start inotify */ + return inotify_init(); } EOF if compile_prog "" "" ; then @@ -4921,8 +4921,8 @@ if test "$mingw32" =3D "yes" && test "$guest_agent" != =3D "no" && \ *\ *) # The SDK is installed in "Program Files" by default, but we can= not # handle path with spaces. So we symlink the headers into ".sdk/= vss". vss_win32_include=3D"-isystem $source_path/.sdk/vss" - symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" - ;; + symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" + ;; *) vss_win32_include=3D"-isystem $vss_win32_sdk" esac cat > $TMPC << EOF @@ -5643,7 +5643,7 @@ if test "$membarrier" =3D "yes"; then int main(void) { syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); - exit(0); + exit(0); } EOF if compile_prog "" "" ; then @@ -5720,7 +5720,7 @@ if test "$crypto_afalg" =3D "yes" then if test "$have_afalg" !=3D "yes" then - error_exit "AF_ALG requested but could not be detected" + error_exit "AF_ALG requested but could not be detected" fi fi =20 @@ -5908,18 +5908,18 @@ fi # check for libpmem =20 if test "$libpmem" !=3D "no"; then - if $pkg_config --exists "libpmem"; then - libpmem=3D"yes" - libpmem_libs=3D$($pkg_config --libs libpmem) - libpmem_cflags=3D$($pkg_config --cflags libpmem) - libs_softmmu=3D"$libs_softmmu $libpmem_libs" - QEMU_CFLAGS=3D"$QEMU_CFLAGS $libpmem_cflags" - else - if test "$libpmem" =3D "yes" ; then - feature_not_found "libpmem" "Install nvml or pmdk" - fi - libpmem=3D"no" - fi + if $pkg_config --exists "libpmem"; then + libpmem=3D"yes" + libpmem_libs=3D$($pkg_config --libs libpmem) + libpmem_cflags=3D$($pkg_config --cflags libpmem) + libs_softmmu=3D"$libs_softmmu $libpmem_libs" + QEMU_CFLAGS=3D"$QEMU_CFLAGS $libpmem_cflags" + else + if test "$libpmem" =3D "yes" ; then + feature_not_found "libpmem" "Install nvml or pmdk" + fi + libpmem=3D"no" + fi fi =20 ########################################## @@ -6643,10 +6643,10 @@ echo "CONFIG_AUDIO_DRIVERS=3D$audio_drv_list" >> $c= onfig_host_mak for drv in $audio_drv_list; do def=3DCONFIG_AUDIO_$(echo $drv | LC_ALL=3DC tr '[a-z]' '[A-Z]') case "$drv" in - alsa | oss | pa | sdl) - echo "$def=3Dm" >> $config_host_mak ;; - *) - echo "$def=3Dy" >> $config_host_mak ;; + alsa | oss | pa | sdl) + echo "$def=3Dm" >> $config_host_mak ;; + *) + echo "$def=3Dy" >> $config_host_mak ;; esac done echo "ALSA_LIBS=3D$alsa_libs" >> $config_host_mak @@ -7479,14 +7479,14 @@ TARGET_ABI_DIR=3D"" case "$target_name" in i386) mttcg=3D"yes" - gdb_xml_files=3D"i386-32bit.xml" + gdb_xml_files=3D"i386-32bit.xml" target_compiler=3D$cross_cc_i386 target_compiler_cflags=3D$cross_cc_ccflags_i386 ;; x86_64) TARGET_BASE_ARCH=3Di386 mttcg=3D"yes" - gdb_xml_files=3D"i386-64bit.xml" + gdb_xml_files=3D"i386-64bit.xml" target_compiler=3D$cross_cc_x86_64 ;; alpha) @@ -7510,6 +7510,10 @@ case "$target_name" in target_compiler=3D$cross_cc_aarch64 eval "target_compiler_cflags=3D\$cross_cc_cflags_${target_name}" ;; + avr) + gdb_xml_files=3D"avr-cpu.xml" + target_compiler=3D$cross_cc_avr + ;; cris) target_compiler=3D$cross_cc_cris ;; @@ -7790,6 +7794,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do disas_config "ARM_A64" fi ;; + avr) + disas_config "AVR" + ;; cris) disas_config "CRIS" ;; @@ -8003,10 +8010,10 @@ preserve_env() { =20 if test -n "$envval" then - echo "$envname=3D'$envval'" >> config.status - echo "export $envname" >> config.status + echo "$envname=3D'$envval'" >> config.status + echo "export $envname" >> config.status else - echo "unset $envname" >> config.status + echo "unset $envname" >> config.status fi } =20 diff --git a/default-configs/avr-softmmu.mak b/default-configs/avr-softmmu.= mak new file mode 100644 index 0000000000..d1e1c28118 --- /dev/null +++ b/default-configs/avr-softmmu.mak @@ -0,0 +1,5 @@ +# Default configuration for avr-softmmu + +# Boards: +# +CONFIG_AVR_SAMPLE=3Dy diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index e9c7dd8eb4..8bedce17ac 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -211,6 +211,12 @@ enum bfd_architecture #define bfd_mach_m32r 0 /* backwards compatibility */ bfd_arch_mn10200, /* Matsushita MN10200 */ bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_avr, /* Atmel AVR microcontrollers. */ +#define bfd_mach_avr1 1 +#define bfd_mach_avr2 2 +#define bfd_mach_avr3 3 +#define bfd_mach_avr4 4 +#define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */ #define bfd_mach_cris_v0_v10 255 #define bfd_mach_cris_v32 32 diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h index 62c6fe4cf1..893df26ce2 100644 --- a/include/sysemu/arch_init.h +++ b/include/sysemu/arch_init.h @@ -24,6 +24,7 @@ enum { QEMU_ARCH_NIOS2 =3D (1 << 17), QEMU_ARCH_HPPA =3D (1 << 18), QEMU_ARCH_RISCV =3D (1 << 19), + QEMU_ARCH_AVR =3D (1 << 20), }; =20 extern const uint32_t arch_type; diff --git a/qapi/machine.json b/qapi/machine.json index de5c742d72..afede0bc50 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -21,11 +21,12 @@ # is true even for "qemu-system-x86_64". # # ppcemb: dropped in 3.1 +# avr: sicne 4.2 # # Since: 3.0 ## { 'enum' : 'SysEmuTarget', - 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', + 'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386', 'lm= 32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', diff --git a/target/avr/Makefile.objs b/target/avr/Makefile.objs new file mode 100644 index 0000000000..2976affd95 --- /dev/null +++ b/target/avr/Makefile.objs @@ -0,0 +1,33 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2019 Michael Rolnik +# +# 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 +# +# + +DECODETREE =3D $(SRC_PATH)/scripts/decodetree.py +decode-y =3D $(SRC_PATH)/target/avr/insn.decode + +target/avr/decode_insn.inc.c: $(decode-y) $(DECODETREE) + $(call quiet-command, \ + $(PYTHON) $(DECODETREE) -o $@ --decode decode_insn --insnwidth 16 $<, \ + "GEN", $(TARGET_DIR)$@) + +target/avr/translate.o: target/avr/decode_insn.inc.c + +obj-y +=3D translate.o cpu.o helper.o +obj-y +=3D gdbstub.o +obj-$(CONFIG_SOFTMMU) +=3D machine.o diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c index 5953d31755..3e5c74e73e 100644 --- a/tests/machine-none-test.c +++ b/tests/machine-none-test.c @@ -27,6 +27,7 @@ static struct arch2cpu cpus_map[] =3D { /* tested targets list */ { "arm", "cortex-a15" }, { "aarch64", "cortex-a57" }, + { "avr", "avr6-avr-cpu" }, { "x86_64", "qemu64,apic-id=3D0" }, { "i386", "qemu32,apic-id=3D0" }, { "alpha", "ev67" }, --=20 2.17.2 (Apple Git-113)