All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k
@ 2020-09-01 15:20 Thomas Huth
  2020-09-01 15:20 ` [PULL 1/8] configure: Fix atomic64 test for --enable-werror on macOS Thomas Huth
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

 Hi Peter,
 
the following changes since commit 2f4c51c0f384d7888a04b4815861e6d5fd244d75:

  Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200831-pull-request' into staging (2020-08-31 19:39:13 +0100)

are available in the Git repository at:

  https://gitlab.com/huth/qemu.git tags/pull-request-2020-09-01

for you to fetch changes up to df496fb0532758cffb5ad4075b4e60a43c723492:

  hw/m68k: QOMify the mcf5206 system integration module (2020-09-01 17:09:17 +0200)

----------------------------------------------------------------
- Cirrus-CI improvements and fixes (compile with -Werror & fix for 1h problem)
- Two build system fixes to fix some failures the CI
- One m68k QOMification patch
----------------------------------------------------------------

Gerd Hoffmann (1):
      meson: fix keymaps without qemu-keymap

Thomas Huth (7):
      configure: Fix atomic64 test for --enable-werror on macOS
      cirrus.yml: Compile FreeBSD with -Werror
      cirrus.yml: Compile macOS with -Werror
      cirrus.yml: Update the macOS jobs to Catalina
      cirrus.yml: Split FreeBSD job into two parts
      configure: Add system = 'linux' for meson when cross-compiling
      hw/m68k: QOMify the mcf5206 system integration module

 .cirrus.yml                 | 43 +++++++++++++++++++++++++++++++++----------
 configure                   | 13 ++++++++-----
 hw/m68k/an5206.c            | 14 ++++++++++++--
 hw/m68k/mcf5206.c           | 44 +++++++++++++++++++++++++++++++++++---------
 include/hw/m68k/mcf.h       |  3 +--
 pc-bios/keymaps/meson.build | 28 +++++++++++++++++++---------
 6 files changed, 108 insertions(+), 37 deletions(-)



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

* [PULL 1/8] configure: Fix atomic64 test for --enable-werror on macOS
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 2/8] cirrus.yml: Compile FreeBSD with -Werror Thomas Huth
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

When using --enable-werror for the macOS builders in the Cirrus-CI,
the atomic64 test is currently failing, and config.log shows a bunch
of error messages like this:

 config-temp/qemu-conf.c:6:7: error: implicit declaration of function
 '__atomic_load_8' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  y = __atomic_load_8(&x, 0);
      ^
 config-temp/qemu-conf.c:6:7: error: this function declaration is not a
 prototype [-Werror,-Wstrict-prototypes]

Seems like these __atomic_*_8 functions are available in one of the
libraries there, so that the test links and passes there when not
using --enable-werror. But there does not seem to be a valid prototype
for them in any of the header files, so that the test fails when using
--enable-werror.

Fix it by using the "official" built-in functions instead (see e.g.
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html).
We are not using the *_8 variants in QEMU anyway.

Suggested-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200728074405.13118-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 8dc981684b..59b7310e15 100755
--- a/configure
+++ b/configure
@@ -5780,11 +5780,11 @@ int main(void)
 {
   uint64_t x = 0, y = 0;
 #ifdef __ATOMIC_RELAXED
-  y = __atomic_load_8(&x, 0);
-  __atomic_store_8(&x, y, 0);
-  __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
-  __atomic_exchange_8(&x, y, 0);
-  __atomic_fetch_add_8(&x, y, 0);
+  y = __atomic_load_n(&x, __ATOMIC_RELAXED);
+  __atomic_store_n(&x, y, __ATOMIC_RELAXED);
+  __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+  __atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
+  __atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
 #else
   typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
   __sync_lock_test_and_set(&x, y);
-- 
2.18.2



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

* [PULL 2/8] cirrus.yml: Compile FreeBSD with -Werror
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
  2020-09-01 15:20 ` [PULL 1/8] configure: Fix atomic64 test for --enable-werror on macOS Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 3/8] cirrus.yml: Compile macOS " Thomas Huth
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

Compiler warnings currently go unnoticed in our FreeBSD builds, since
-Werror is only enabled for Linux and MinGW builds by default. So let's
enable them here now, too.

Reviewed-by: Ed Maste <emaste@freebsd.org>
Message-Id: <20200728074405.13118-3-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index f287d23c5b..b50da72eec 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -12,7 +12,7 @@ freebsd_12_task:
   script:
     - mkdir build
     - cd build
-    - ../configure || { cat config.log; exit 1; }
+    - ../configure --enable-werror || { cat config.log; exit 1; }
     - gmake -j8
     - gmake V=1 check
 
-- 
2.18.2



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

* [PULL 3/8] cirrus.yml: Compile macOS with -Werror
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
  2020-09-01 15:20 ` [PULL 1/8] configure: Fix atomic64 test for --enable-werror on macOS Thomas Huth
  2020-09-01 15:20 ` [PULL 2/8] cirrus.yml: Compile FreeBSD with -Werror Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 4/8] cirrus.yml: Update the macOS jobs to Catalina Thomas Huth
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

Compiler warnings currently go unnoticed in our macOS builds, since -Werror
is only enabled for Linux and MinGW builds by default. So let's enable them
here now, too.
Unfortunately, the sasl header is marked as deprecated in the macOS headers
and thus generates a lot of deprecation warnings. Thus we have to also use
-Wno-error=deprecated-declarations to be able to compile the code here.

Message-Id: <20200728074405.13118-4-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .cirrus.yml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index b50da72eec..86a059c12f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -24,7 +24,9 @@ macos_task:
   script:
     - mkdir build
     - cd build
-    - ../configure --python=/usr/local/bin/python3 || { cat config.log; exit 1; }
+    - ../configure --python=/usr/local/bin/python3 --enable-werror
+                   --extra-cflags='-Wno-error=deprecated-declarations'
+                   || { cat config.log; exit 1; }
     - gmake -j$(sysctl -n hw.ncpu)
     - gmake check
 
@@ -37,6 +39,7 @@ macos_xcode_task:
   script:
     - mkdir build
     - cd build
-    - ../configure --cc=clang || { cat config.log; exit 1; }
+    - ../configure --extra-cflags='-Wno-error=deprecated-declarations'
+                   --enable-werror --cc=clang || { cat config.log; exit 1; }
     - gmake -j$(sysctl -n hw.ncpu)
     - gmake check
-- 
2.18.2



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

* [PULL 4/8] cirrus.yml: Update the macOS jobs to Catalina
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (2 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 3/8] cirrus.yml: Compile macOS " Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 5/8] cirrus.yml: Split FreeBSD job into two parts Thomas Huth
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

When looking at the CI jobs on cirrus-ci.com, it seems like the mojave-based
images have been decomissioned a while ago already, since apparently all our
jobs get automatically upgraded to catalina. So let's update our YML script
accordingly to avoid confusion.

Reviewed-by: Ed Maste <emaste@freebsd.org>
Message-Id: <20200728074405.13118-5-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .cirrus.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 86a059c12f..0742aaf8a3 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -18,7 +18,7 @@ freebsd_12_task:
 
 macos_task:
   osx_instance:
-    image: mojave-base
+    image: catalina-base
   install_script:
     - brew install pkg-config python gnu-sed glib pixman make sdl2 bash
   script:
@@ -33,7 +33,7 @@ macos_task:
 macos_xcode_task:
   osx_instance:
     # this is an alias for the latest Xcode
-    image: mojave-xcode
+    image: catalina-xcode
   install_script:
     - brew install pkg-config gnu-sed glib pixman make sdl2 bash
   script:
-- 
2.18.2



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

* [PULL 5/8] cirrus.yml: Split FreeBSD job into two parts
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (3 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 4/8] cirrus.yml: Update the macOS jobs to Catalina Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 6/8] meson: fix keymaps without qemu-keymap Thomas Huth
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

The FreeBSD jobs currently hit the 1h time limit in the Cirrus-CI.
We have to split the build targets here to make sure that the job
finishes in time again. According to the Cirrus-CI docs and some
tests that I did, it also seems like the total amount of CPUs that
can be used for FreeBSD jobs is limited to 8, so each job now only
gets 4 CPUs. That increases the compilation time of each job a little
bit, but it still seems to be better to run two jobs with 4 CPUs each
in parallel than to run two jobs with 8 CPUs sequentially.

Message-Id: <20200831154405.229706-1-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .cirrus.yml | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 0742aaf8a3..3dd9fcff7f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,20 +1,40 @@
 env:
   CIRRUS_CLONE_DEPTH: 1
 
-freebsd_12_task:
+freebsd_1st_task:
   freebsd_instance:
     image_family: freebsd-12-1
-    cpu: 8
-    memory: 8G
+    cpu: 4
+    memory: 4G
   install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y
     bash curl cyrus-sasl git glib gmake gnutls gsed
     nettle perl5 pixman pkgconf png usbredir
   script:
     - mkdir build
     - cd build
-    - ../configure --enable-werror || { cat config.log; exit 1; }
-    - gmake -j8
-    - gmake V=1 check
+    - ../configure --disable-user --target-list-exclude='alpha-softmmu
+        ppc64-softmmu ppc-softmmu riscv32-softmmu riscv64-softmmu s390x-softmmu
+        sparc64-softmmu sparc-softmmu x86_64-softmmu i386-softmmu'
+        --enable-werror || { cat config.log; exit 1; }
+    - gmake -j$(sysctl -n hw.ncpu)
+    - gmake -j$(sysctl -n hw.ncpu) check
+
+freebsd_2nd_task:
+  freebsd_instance:
+    image_family: freebsd-12-1
+    cpu: 4
+    memory: 4G
+  install_script: ASSUME_ALWAYS_YES=yes pkg bootstrap -f ; pkg install -y
+    bash curl cyrus-sasl git glib gmake gnutls gtk3 gsed libepoxy mesa-libs
+    nettle perl5 pixman pkgconf png SDL2 usbredir
+  script:
+    - ./configure --enable-werror --target-list='alpha-softmmu ppc64-softmmu
+        ppc-softmmu riscv32-softmmu riscv64-softmmu s390x-softmmu
+        sparc64-softmmu sparc-softmmu x86_64-softmmu i386-softmmu
+        sparc-bsd-user sparc64-bsd-user x86_64-bsd-user i386-bsd-user'
+        || { cat config.log; exit 1; }
+    - gmake -j$(sysctl -n hw.ncpu)
+    - gmake -j$(sysctl -n hw.ncpu) check
 
 macos_task:
   osx_instance:
-- 
2.18.2



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

* [PULL 6/8] meson: fix keymaps without qemu-keymap
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (4 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 5/8] cirrus.yml: Split FreeBSD job into two parts Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 7/8] configure: Add system = 'linux' for meson when cross-compiling Thomas Huth
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

From: Gerd Hoffmann <kraxel@redhat.com>

In case the qemu-keymap tool generating them is neither installed on the
system nor built from sources (due to xkbcommon not being available)
qemu will not find the keymaps when started directly from the build
tree,

This happens because commit ddcf607fa3d6 ("meson: drop keymaps symlink")
removed the symlink to the source tree, and the special handling for
install doesn't help in case we do not install qemu.

Lets fix that by simply copying over the file from the source tree as
fallback.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20200827102617.14448-1-kraxel@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 pc-bios/keymaps/meson.build | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
index b737c82230..e102dd56b4 100644
--- a/pc-bios/keymaps/meson.build
+++ b/pc-bios/keymaps/meson.build
@@ -38,19 +38,29 @@ if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in config_host
 else
   native_qemu_keymap = qemu_keymap
 endif
+
 t = []
 foreach km, args: keymaps
-  t += custom_target(km,
-                     build_by_default: true,
-                     output: km,
-                     command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
-                     install_dir: config_host['qemu_datadir'] / 'keymaps')
+  if native_qemu_keymap.found()
+    # generate with qemu-kvm
+    t += custom_target(km,
+                       build_by_default: true,
+                       output: km,
+                       command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
+                       install_dir: config_host['qemu_datadir'] / 'keymaps')
+  else
+    # copy from source tree
+    t += custom_target(km,
+                       build_by_default: true,
+		       input: km,
+                       output: km,
+                       command: ['cp', '@INPUT@', '@OUTPUT@'],
+                       install_dir: config_host['qemu_datadir'] / 'keymaps')
+  endif
 endforeach
-if t.length() > 0
+
+if native_qemu_keymap.found()
   alias_target('update-keymaps', t)
-else
-  # install from the source tree
-  install_data(keymaps.keys(), install_dir: config_host['qemu_datadir'] / 'keymaps')
 endif
 
 install_data(['sl', 'sv'], install_dir: config_host['qemu_datadir'] / 'keymaps')
-- 
2.18.2



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

* [PULL 7/8] configure: Add system = 'linux' for meson when cross-compiling
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (5 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 6/8] meson: fix keymaps without qemu-keymap Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-01 15:20 ` [PULL 8/8] hw/m68k: QOMify the mcf5206 system integration module Thomas Huth
  2020-09-02 12:56 ` [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Peter Maydell
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

Meson needs the "system = xyz" line when cross-compiling. We are already
adding a "system = 'windows'" for the MinGW cross-compilation case here,
so let's add a "system = 'linux'" now for Linux hosts, too.

Message-Id: <20200823111757.72002-2-thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index 59b7310e15..85461976b5 100755
--- a/configure
+++ b/configure
@@ -8194,6 +8194,9 @@ if test -n "$cross_prefix"; then
             ?:*) pre_prefix=/ ;;
         esac
     fi
+    if test "$linux" = "yes" ; then
+        echo "system = 'linux'" >> $cross
+    fi
     case "$ARCH" in
         i386|x86_64)
             echo "cpu_family = 'x86'" >> $cross
-- 
2.18.2



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

* [PULL 8/8] hw/m68k: QOMify the mcf5206 system integration module
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (6 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 7/8] configure: Add system = 'linux' for meson when cross-compiling Thomas Huth
@ 2020-09-01 15:20 ` Thomas Huth
  2020-09-02 12:56 ` [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Peter Maydell
  8 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-01 15:20 UTC (permalink / raw)
  To: qemu-devel, Peter Maydell; +Cc: Ed Maste, Li-Wen Hsu

From: Thomas Huth <huth@tuxfamily.org>

The mcf5206 system integration module should be a proper device.
Let's finally QOMify it.

Signed-off-by: Thomas Huth <huth@tuxfamily.org>
Message-Id: <20200819065201.4045-1-huth@tuxfamily.org>
---
 hw/m68k/an5206.c      | 14 ++++++++++++--
 hw/m68k/mcf5206.c     | 44 ++++++++++++++++++++++++++++++++++---------
 include/hw/m68k/mcf.h |  3 +--
 3 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index 846f4e40c6..673898b0ea 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -21,7 +21,17 @@
 #define AN5206_MBAR_ADDR 0x10000000
 #define AN5206_RAMBAR_ADDR 0x20000000
 
-/* Board init.  */
+static void mcf5206_init(MemoryRegion *sysmem, uint32_t base)
+{
+    DeviceState *dev;
+    SysBusDevice *s;
+
+    dev = qdev_new(TYPE_MCF5206_MBAR);
+    s = SYS_BUS_DEVICE(dev);
+    sysbus_realize_and_unref(s, &error_fatal);
+
+    memory_region_add_subregion(sysmem, base, sysbus_mmio_get_region(s, 0));
+}
 
 static void an5206_init(MachineState *machine)
 {
@@ -51,7 +61,7 @@ static void an5206_init(MachineState *machine)
     memory_region_init_ram(sram, NULL, "an5206.sram", 512, &error_fatal);
     memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
 
-    mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu);
+    mcf5206_init(address_space_mem, AN5206_MBAR_ADDR);
 
     /* Load kernel.  */
     if (!kernel_filename) {
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index 94a37a1a46..51d2e0da1c 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -15,6 +15,7 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "sysemu/sysemu.h"
+#include "hw/sysbus.h"
 
 /* General purpose timer module.  */
 typedef struct {
@@ -159,6 +160,8 @@ static m5206_timer_state *m5206_timer_init(qemu_irq irq)
 /* System Integration Module.  */
 
 typedef struct {
+    SysBusDevice parent_obj;
+
     M68kCPU *cpu;
     MemoryRegion iomem;
     m5206_timer_state *timer[2];
@@ -174,6 +177,8 @@ typedef struct {
     uint8_t uivr[2];
 } m5206_mbar_state;
 
+#define MCF5206_MBAR(obj) OBJECT_CHECK(m5206_mbar_state, (obj), TYPE_MCF5206_MBAR)
+
 /* Interrupt controller.  */
 
 static int m5206_find_pending_irq(m5206_mbar_state *s)
@@ -257,8 +262,10 @@ static void m5206_mbar_set_irq(void *opaque, int irq, int level)
 
 /* System Integration Module.  */
 
-static void m5206_mbar_reset(m5206_mbar_state *s)
+static void m5206_mbar_reset(DeviceState *dev)
 {
+    m5206_mbar_state *s = MCF5206_MBAR(dev);
+
     s->scr = 0xc0;
     s->icr[1] = 0x04;
     s->icr[2] = 0x08;
@@ -578,24 +585,43 @@ static const MemoryRegionOps m5206_mbar_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, M68kCPU *cpu)
+static void mcf5206_mbar_realize(DeviceState *dev, Error **errp)
 {
-    m5206_mbar_state *s;
+    m5206_mbar_state *s = MCF5206_MBAR(dev);
     qemu_irq *pic;
 
-    s = g_new0(m5206_mbar_state, 1);
-
     memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s,
                           "mbar", 0x00001000);
-    memory_region_add_subregion(sysmem, base, &s->iomem);
+    sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
 
     pic = qemu_allocate_irqs(m5206_mbar_set_irq, s, 14);
     s->timer[0] = m5206_timer_init(pic[9]);
     s->timer[1] = m5206_timer_init(pic[10]);
     s->uart[0] = mcf_uart_init(pic[12], serial_hd(0));
     s->uart[1] = mcf_uart_init(pic[13], serial_hd(1));
-    s->cpu = cpu;
+    s->cpu = M68K_CPU(qemu_get_cpu(0));
+}
+
+static void mcf5206_mbar_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
-    m5206_mbar_reset(s);
-    return pic;
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+    dc->desc = "MCF5206 system integration module";
+    dc->realize = mcf5206_mbar_realize;
+    dc->reset = m5206_mbar_reset;
 }
+
+static const TypeInfo mcf5206_mbar_info = {
+    .name          = TYPE_MCF5206_MBAR,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(m5206_mbar_state),
+    .class_init    = mcf5206_mbar_class_init,
+};
+
+static void mcf5206_mbar_register_types(void)
+{
+    type_register_static(&mcf5206_mbar_info);
+}
+
+type_init(mcf5206_mbar_register_types)
diff --git a/include/hw/m68k/mcf.h b/include/hw/m68k/mcf.h
index 0db49c5e60..decf17ce42 100644
--- a/include/hw/m68k/mcf.h
+++ b/include/hw/m68k/mcf.h
@@ -18,7 +18,6 @@ qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem,
                         M68kCPU *cpu);
 
 /* mcf5206.c */
-qemu_irq *mcf5206_init(struct MemoryRegion *sysmem,
-                       uint32_t base, M68kCPU *cpu);
+#define TYPE_MCF5206_MBAR "mcf5206-mbar"
 
 #endif
-- 
2.18.2



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

* Re: [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k
  2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
                   ` (7 preceding siblings ...)
  2020-09-01 15:20 ` [PULL 8/8] hw/m68k: QOMify the mcf5206 system integration module Thomas Huth
@ 2020-09-02 12:56 ` Peter Maydell
  2020-09-02 14:13   ` Thomas Huth
  8 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2020-09-02 12:56 UTC (permalink / raw)
  To: Thomas Huth; +Cc: Ed Maste, QEMU Developers, Li-Wen Hsu

On Tue, 1 Sep 2020 at 16:21, Thomas Huth <thuth@redhat.com> wrote:
>
>  Hi Peter,
>
> the following changes since commit 2f4c51c0f384d7888a04b4815861e6d5fd244d75:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200831-pull-request' into staging (2020-08-31 19:39:13 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/huth/qemu.git tags/pull-request-2020-09-01
>
> for you to fetch changes up to df496fb0532758cffb5ad4075b4e60a43c723492:
>
>   hw/m68k: QOMify the mcf5206 system integration module (2020-09-01 17:09:17 +0200)
>
> ----------------------------------------------------------------
> - Cirrus-CI improvements and fixes (compile with -Werror & fix for 1h problem)
> - Two build system fixes to fix some failures the CI
> - One m68k QOMification patch
> ----------------------------------------------------------------

Hi -- this has a conflict in pc-bios/keymaps/meson.build (probably
a clash with Paolo's series I just merged). Could you rebase and
resend, please?

thanks
-- PMM


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

* Re: [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k
  2020-09-02 12:56 ` [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Peter Maydell
@ 2020-09-02 14:13   ` Thomas Huth
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2020-09-02 14:13 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Ed Maste, QEMU Developers, Li-Wen Hsu

On 02/09/2020 14.56, Peter Maydell wrote:
> On Tue, 1 Sep 2020 at 16:21, Thomas Huth <thuth@redhat.com> wrote:
>>
>>  Hi Peter,
>>
>> the following changes since commit 2f4c51c0f384d7888a04b4815861e6d5fd244d75:
>>
>>   Merge remote-tracking branch 'remotes/kraxel/tags/usb-20200831-pull-request' into staging (2020-08-31 19:39:13 +0100)
>>
>> are available in the Git repository at:
>>
>>   https://gitlab.com/huth/qemu.git tags/pull-request-2020-09-01
>>
>> for you to fetch changes up to df496fb0532758cffb5ad4075b4e60a43c723492:
>>
>>   hw/m68k: QOMify the mcf5206 system integration module (2020-09-01 17:09:17 +0200)
>>
>> ----------------------------------------------------------------
>> - Cirrus-CI improvements and fixes (compile with -Werror & fix for 1h problem)
>> - Two build system fixes to fix some failures the CI
>> - One m68k QOMification patch
>> ----------------------------------------------------------------
> 
> Hi -- this has a conflict in pc-bios/keymaps/meson.build (probably
> a clash with Paolo's series I just merged). Could you rebase and
> resend, please?

Sure, will do.

 Thomas



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

end of thread, other threads:[~2020-09-02 14:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 15:20 [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Thomas Huth
2020-09-01 15:20 ` [PULL 1/8] configure: Fix atomic64 test for --enable-werror on macOS Thomas Huth
2020-09-01 15:20 ` [PULL 2/8] cirrus.yml: Compile FreeBSD with -Werror Thomas Huth
2020-09-01 15:20 ` [PULL 3/8] cirrus.yml: Compile macOS " Thomas Huth
2020-09-01 15:20 ` [PULL 4/8] cirrus.yml: Update the macOS jobs to Catalina Thomas Huth
2020-09-01 15:20 ` [PULL 5/8] cirrus.yml: Split FreeBSD job into two parts Thomas Huth
2020-09-01 15:20 ` [PULL 6/8] meson: fix keymaps without qemu-keymap Thomas Huth
2020-09-01 15:20 ` [PULL 7/8] configure: Add system = 'linux' for meson when cross-compiling Thomas Huth
2020-09-01 15:20 ` [PULL 8/8] hw/m68k: QOMify the mcf5206 system integration module Thomas Huth
2020-09-02 12:56 ` [PULL 0/8] Cirrus-CI improvements, and other CI-related fixes, m68k Peter Maydell
2020-09-02 14:13   ` Thomas Huth

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.