From nobody Mon Feb 9 11:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) client-ip=209.85.128.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1637341931; cv=none; d=zohomail.com; s=zohoarc; b=MTAUoinMkbDrDMY3CXufR0ZPYHu8xOgrePy9+Z6TomKDHIf+RlOr14u9HUXrT8p1Z3gbNMsUHzdoR6BW+YLLR7DCjrIE73V25dSlogTV/Th9/nFR2U/XV8qGF5ikIsGYJYXidtkkImZUTWQXPQx/zBZeM0whRTBRSZ9l8p4217A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637341931; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LxzL38s3i1AAXjqxVDHxZy+6zklNakdLnL3NVaE6p/A=; b=NNAGzlQjdFNk7WZhn6bxpHDHYeMCoqH4wvxZ0Ec72nZL7KdqDICX3oErOLtLK8Kiqk3kascKjzFZ2Z8yvnjPhzDzUsGaRpYJyXp3Z74oTGbvuNqWc2y7HsFzkmjP6As+ITMnDC7gD+RDxQzTRAs7sErdCpYFb7MKB7uV09zMBjc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.zohomail.com with SMTPS id 1637341931549397.55795913613235; Fri, 19 Nov 2021 09:12:11 -0800 (PST) Received: by mail-wm1-f47.google.com with SMTP id k37-20020a05600c1ca500b00330cb84834fso11012909wms.2 for ; Fri, 19 Nov 2021 09:12:11 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id a141sm12107817wme.37.2021.11.19.09.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 09:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LxzL38s3i1AAXjqxVDHxZy+6zklNakdLnL3NVaE6p/A=; b=dKD/gw3acY/L6H5ff2pP4SXTZYt+iBDRZKdbp/vM6eH4q0C1j5ozCwVZHt91tKmAtO 9RNsx+H30ipOej82snAKXNWLHQTdQLsvE5eMnHzcc/c33txs/kq7bNrJrtWU2IyW9mAy 6RtcpbnesluBNwI6fnUdnjFn8ZA0erFUKhIcQDgketlR10xFkVBb7REhsTyhOe5Aekcb mGQlrdhuX+CbTHscribuZOkMr+0N9x/M2qfD4sIlkhiUIPJn/WZ3corHc7JNoYYLC0Ya dAc0UXoBcjwUgNWOpwv5sbDr3I7HnfiQ5VMHSsJdHnpwcEhpJD+9rSiJzpaLCXjG+XsH PyBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LxzL38s3i1AAXjqxVDHxZy+6zklNakdLnL3NVaE6p/A=; b=CR3lNggt6KjQAYR2cu1oyWJZui6YhrpGdqV+IEuYpMXjkuoLcOJH/qEufBTu2UUcyH E3QOADHatpf0EMW9E7JudyQFPSm3/HyqvAbVLUBId47d8ZUYl+oyDUr/BTT4lB5PuPLo X7Z7FgPL45T2U78/x4RsKmqIr3ahZcF5IKxCflmhnhr0fw9TJI0xYcfO/QzQIgOBcu3Q NwY00azqAt06fKDA+5uSscmAkko6PM3yP0Sk0bExvbF2ucdUmwIeAXpPOv71dqT8fee6 0I3NPSvmvMV7vQDQ0lThozs/HIzjW0tVYnrhLoE91l2fR/Sw7qUbrdH/DkjNJPPQSAZF e3wQ== X-Gm-Message-State: AOAM5334v4DLgbxE1XliKSaS2+M0m3bjhSQDdeHWA141vUYsKECdHK7Z YRWiyyWQ8YEHsegrUoj0Oh0vzhc+gi0= X-Google-Smtp-Source: ABdhPJyxj1X7BOACa/4u2AFR+B6rHjlLtrS1sK5KF/DiXeb2HH1ekBJ2g5XoUC8PDrCF034On6gm1Q== X-Received: by 2002:a05:600c:34c2:: with SMTP id d2mr1531250wmq.102.1637341929644; Fri, 19 Nov 2021 09:12:09 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-7.0 1/5] hw/display: Rename VGA_ISA_MM -> VGA_MMIO Date: Fri, 19 Nov 2021 18:11:58 +0100 Message-Id: <20211119171202.458919-2-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119171202.458919-1-f4bug@amsat.org> References: <20211119171202.458919-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1637341933376100001 There is no ISA bus part in the MMIO VGA device, so rename: * hw/display/vga-isa-mm.c -> hw/display/vga-mmio.c * CONFIG_VGA_ISA_MM -> CONFIG_VGA_MMIO * ISAVGAMMState -> VGAMmioState * isa_vga_mm_init() -> vga_mmio_init() Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: BALATON Zoltan Reviewed-by: Thomas Huth --- configs/devices/mips-softmmu/common.mak | 2 +- include/hw/display/vga.h | 2 +- hw/display/{vga-isa-mm.c =3D> vga-mmio.c} | 16 ++++++++-------- hw/mips/jazz.c | 2 +- hw/display/Kconfig | 2 +- hw/display/meson.build | 2 +- hw/mips/Kconfig | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) rename hw/display/{vga-isa-mm.c =3D> vga-mmio.c} (93%) diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips= -softmmu/common.mak index 752b62b1e63..d2202c839e0 100644 --- a/configs/devices/mips-softmmu/common.mak +++ b/configs/devices/mips-softmmu/common.mak @@ -7,7 +7,7 @@ CONFIG_ISA_BUS=3Dy CONFIG_PCI=3Dy CONFIG_PCI_DEVICES=3Dy CONFIG_VGA_ISA=3Dy -CONFIG_VGA_ISA_MM=3Dy +CONFIG_VGA_MMIO=3Dy CONFIG_VGA_CIRRUS=3Dy CONFIG_VMWARE_VGA=3Dy CONFIG_SERIAL=3Dy diff --git a/include/hw/display/vga.h b/include/hw/display/vga.h index 5f7825e0e36..03c65a14218 100644 --- a/include/hw/display/vga.h +++ b/include/hw/display/vga.h @@ -24,7 +24,7 @@ enum vga_retrace_method { =20 extern enum vga_retrace_method vga_retrace_method; =20 -int isa_vga_mm_init(hwaddr vram_base, +int vga_mmio_init(hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space); =20 diff --git a/hw/display/vga-isa-mm.c b/hw/display/vga-mmio.c similarity index 93% rename from hw/display/vga-isa-mm.c rename to hw/display/vga-mmio.c index 7321b7a06d5..8aaf44e7b1d 100644 --- a/hw/display/vga-isa-mm.c +++ b/hw/display/vga-mmio.c @@ -1,5 +1,5 @@ /* - * QEMU ISA MM VGA Emulator. + * QEMU MMIO VGA Emulator. * * Copyright (c) 2003 Fabrice Bellard * @@ -32,15 +32,15 @@ =20 #define VGA_RAM_SIZE (8 * MiB) =20 -typedef struct ISAVGAMMState { +typedef struct VGAMmioState { VGACommonState vga; int it_shift; -} ISAVGAMMState; +} VGAMmioState; =20 /* Memory mapped interface */ static uint64_t vga_mm_read(void *opaque, hwaddr addr, unsigned size) { - ISAVGAMMState *s =3D opaque; + VGAMmioState *s =3D opaque; =20 return vga_ioport_read(&s->vga, addr >> s->it_shift) & MAKE_64BIT_MASK(0, size * 8); @@ -49,7 +49,7 @@ static uint64_t vga_mm_read(void *opaque, hwaddr addr, un= signed size) static void vga_mm_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { - ISAVGAMMState *s =3D opaque; + VGAMmioState *s =3D opaque; =20 vga_ioport_write(&s->vga, addr >> s->it_shift, value & MAKE_64BIT_MASK(0, size * 8)); @@ -65,7 +65,7 @@ static const MemoryRegionOps vga_mm_ctrl_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void vga_mm_init(ISAVGAMMState *s, hwaddr vram_base, +static void vga_mm_init(VGAMmioState *s, hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space) { @@ -91,11 +91,11 @@ static void vga_mm_init(ISAVGAMMState *s, hwaddr vram_b= ase, memory_region_set_coalescing(vga_io_memory); } =20 -int isa_vga_mm_init(hwaddr vram_base, +int vga_mmio_init(hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space) { - ISAVGAMMState *s; + VGAMmioState *s; =20 s =3D g_malloc0(sizeof(*s)); =20 diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index f5a26e174d5..8f345afd137 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -274,7 +274,7 @@ static void mips_jazz_init(MachineState *machine, } break; case JAZZ_PICA61: - isa_vga_mm_init(0x40000000, 0x60000000, 0, get_system_memory()); + vga_mmio_init(0x40000000, 0x60000000, 0, get_system_memory()); break; default: break; diff --git a/hw/display/Kconfig b/hw/display/Kconfig index a2306b67d87..a1b159becd7 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -49,7 +49,7 @@ config VGA_ISA depends on ISA_BUS select VGA =20 -config VGA_ISA_MM +config VGA_MMIO bool select VGA =20 diff --git a/hw/display/meson.build b/hw/display/meson.build index 861c43ff984..adc53dd8b6c 100644 --- a/hw/display/meson.build +++ b/hw/display/meson.build @@ -18,7 +18,7 @@ =20 softmmu_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('vga-pci.c')) softmmu_ss.add(when: 'CONFIG_VGA_ISA', if_true: files('vga-isa.c')) -softmmu_ss.add(when: 'CONFIG_VGA_ISA_MM', if_true: files('vga-isa-mm.c')) +softmmu_ss.add(when: 'CONFIG_VGA_MMIO', if_true: files('vga-mmio.c')) softmmu_ss.add(when: 'CONFIG_VMWARE_VGA', if_true: files('vmware_vga.c')) softmmu_ss.add(when: 'CONFIG_BOCHS_DISPLAY', if_true: files('bochs-display= .c')) =20 diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig index b4c5549ce84..725525358d9 100644 --- a/hw/mips/Kconfig +++ b/hw/mips/Kconfig @@ -16,7 +16,7 @@ config JAZZ select I8254 select I8257 select PCSPK - select VGA_ISA_MM + select VGA_MMIO select G364FB select DP8393X select ESP --=20 2.31.1 From nobody Mon Feb 9 11:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) client-ip=209.85.128.48; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f48.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1637341936; cv=none; d=zohomail.com; s=zohoarc; b=BiEgni32q7pG2SVglaDQoxolHe4iB0y1yKh+MKwaN7lq/nGPIxR1CX+owalh/qxs6KdxL9+sjFiuNmYl22IvDo+8CE5Ft/MYW4wWvk5WiCP0I6iv+JXgspIenr6+jiPBTvNFFF20fl04GrYnqNS9mAN2GEDUeDX3CoUbvFBf4l4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637341936; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZHCEhn6PI0jEPNaBscG3od0nMbxmuG7wPeTVim4TAJw=; b=L8NZ4ejueoc79HYcchVJ6Lj8mzqKpxmVy4BLUEjJVJLyGoPIYYNJGEjufREv3lVD8pKsbhKprxGkw3PiRzqYHvHGGo/sIpOnB/1oBQNTIySWGg0WRatp2LM+jmBrPpunQc4Ii4wU5kNbZlqyRCAmtWsZTPojFsBLx8LW3j8BXuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.zohomail.com with SMTPS id 1637341936246281.77627695356284; Fri, 19 Nov 2021 09:12:16 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so3132889wmj.5 for ; Fri, 19 Nov 2021 09:12:15 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id be3sm12384948wmb.1.2021.11.19.09.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 09:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZHCEhn6PI0jEPNaBscG3od0nMbxmuG7wPeTVim4TAJw=; b=A9ZmrFMRh665OwWuOKxRRDyIsLEpA8Zj7qbknL9H8g8+X9fP1DadhI3ZNcOLeTxSOj NZ8dvn/brifUrUl6TIA5RRP7ofRzepO2IBa3fbl8mirNxZ2T7WetfP47cxFc1KgJK/Q/ 2v8akLpW4RCUMzeHHDYSLQwj1E6zL0QUN2vk15m4vWDikAlg8RkOrUaUuokg9fNY1Rr0 YQDJd1wZQS7JKZO8ksCKVCI5/8ujwbVleste2O8UsHUc55j0iCQ9SOGrs0Oz5Hv6P0oq bGW6OajDLDTNBF/ue8YG9qm+ZP9GGohG2hhrvVTPrcYLyfeAQkQoES1TYRECHfo+i5mx vM7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ZHCEhn6PI0jEPNaBscG3od0nMbxmuG7wPeTVim4TAJw=; b=JV3/fDLv6QMGLb174AyIM4lnAtROTkD3YP7HlDvHyBmODCS7qIuYaKDX+EF2E6ilLV orpj5KpIjkJmQroiftLfWXAuMwko1kgy/8QCkuxRdPy4TluEeTQOHkU53Q7/hD5vVrBB yDCjjmvdXYf70Agt05rLZDCWBxInnCT79W3Uy9IvHZNg9SAHvG96u9RWU8LWsCXXIdqh W6ArqD6Bt8uuoPRN/CH7DOCcUmwF4kjtKLbLjpm78zB8c70kJ9ZNQtchm3k4BdoXfWfy fx5kQXuZ7am8Hs8qNNhsIL6QRHK2YVL+KW299R+KqfY5GxugSRiijPE/absGQg4qnw5i PMWQ== X-Gm-Message-State: AOAM533COsMY1RL4jo8i63TmmE6N2fE4UuNr9mtfQkdFxYbHz+T8oQ8T uSmCackcDGTtp9KShzZMke4= X-Google-Smtp-Source: ABdhPJxciEIeb/JWdRbjE8tRo5Y2MEwumyIAE4hxP+NVwrtwzAY6Ve7Y3pnhOMPuzZmfLsIIqK+eqQ== X-Received: by 2002:a1c:8002:: with SMTP id b2mr1560819wmd.2.1637341934483; Fri, 19 Nov 2021 09:12:14 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-7.0 2/5] hw/display/vga-mmio: Inline vga_mm_init() Date: Fri, 19 Nov 2021 18:11:59 +0100 Message-Id: <20211119171202.458919-3-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119171202.458919-1-f4bug@amsat.org> References: <20211119171202.458919-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1637341938585100001 Inline vga_mm_init() in vga_mmio_init() to simplify the next patch review. Kind of. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: BALATON Zoltan Reviewed-by: Thomas Huth --- hw/display/vga-mmio.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/hw/display/vga-mmio.c b/hw/display/vga-mmio.c index 8aaf44e7b1d..0aefbcf53a0 100644 --- a/hw/display/vga-mmio.c +++ b/hw/display/vga-mmio.c @@ -65,12 +65,19 @@ static const MemoryRegionOps vga_mm_ctrl_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void vga_mm_init(VGAMmioState *s, hwaddr vram_base, - hwaddr ctrl_base, int it_shift, - MemoryRegion *address_space) +int vga_mmio_init(hwaddr vram_base, + hwaddr ctrl_base, int it_shift, + MemoryRegion *address_space) { + VGAMmioState *s; MemoryRegion *s_ioport_ctrl, *vga_io_memory; =20 + s =3D g_malloc0(sizeof(*s)); + + s->vga.vram_size_mb =3D VGA_RAM_SIZE / MiB; + s->vga.global_vmstate =3D true; + vga_common_init(&s->vga, NULL); + s->it_shift =3D it_shift; s_ioport_ctrl =3D g_malloc(sizeof(*s_ioport_ctrl)); memory_region_init_io(s_ioport_ctrl, NULL, &vga_mm_ctrl_ops, s, @@ -89,20 +96,6 @@ static void vga_mm_init(VGAMmioState *s, hwaddr vram_bas= e, memory_region_add_subregion(address_space, vram_base + 0x000a0000, vga_io_memory); memory_region_set_coalescing(vga_io_memory); -} - -int vga_mmio_init(hwaddr vram_base, - hwaddr ctrl_base, int it_shift, - MemoryRegion *address_space) -{ - VGAMmioState *s; - - s =3D g_malloc0(sizeof(*s)); - - s->vga.vram_size_mb =3D VGA_RAM_SIZE / MiB; - s->vga.global_vmstate =3D true; - vga_common_init(&s->vga, NULL); - vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space); =20 s->vga.con =3D graphic_console_init(NULL, 0, s->vga.hw_ops, s); =20 --=20 2.31.1 From nobody Mon Feb 9 11:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) client-ip=209.85.128.52; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f52.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1637341941; cv=none; d=zohomail.com; s=zohoarc; b=MPyYrPaY+B2NB317tou0h7TquVNiOmQ0C41f3kiq5602Bizy01JpWT6BJTwrwOE1eWQKHdVbY9Q+ibLgwfE+bPQi4IKhUUlgtTKKfCnKAdFRSnQfrba9ncxIWge3xRaKaROGmCEtN4gEbPR3NUNgao5rjMQz7fumKuQvRwd5snM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637341941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Mt9b+5cqbBIgzp6O9dytn7/9Xl0Ujk3opErV/gQqZLs=; b=Q/HtOhhtJvHeADcHLOGKZF2/g4xzcTSQAYvmG9abHsRkoaScp3t96Ged4zuiMqUKAlLGlfGcBtM5YvfmO4/+X0dIfVYPoYcJl2+g+3W0PR+hvF56fzXPCJRKfS2cISA+gwz0PUmE+9SS6wbVV7RnPNPU7R7kDOcutLpLwFrWsAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.52 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.zohomail.com with SMTPS id 1637341941037737.4278837076145; Fri, 19 Nov 2021 09:12:21 -0800 (PST) Received: by mail-wm1-f52.google.com with SMTP id z1-20020a05600c220100b00337f97d2464so8100372wml.1 for ; Fri, 19 Nov 2021 09:12:20 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id s13sm13170110wmc.47.2021.11.19.09.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 09:12:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Mt9b+5cqbBIgzp6O9dytn7/9Xl0Ujk3opErV/gQqZLs=; b=QvKRb7k4cg3krRjLg5rfJHieJhIouk97Bd0HMqBWG8+AMfSynuHdKM3kCu3V4RvII8 32ZhWMtegJj4z1G6m5LCQUWGyxlXmjwC22I1h1nliHT8AFWl3fQqgHPUOoNjEOM+8YM9 nnqWSfgzRRj3wd/Dig5cJRJHQYexuI8QzNp+IIiq2zkl2wi2fWDkyE7nmU6KeMYf0fcJ ZpobR4u4Cxh2Q4pgGQpJt7nCDncUNQG01vTtEPyvh7ipEB5ve7lV5JpWy4qSkl1sXVMR AOX0v/AG6KXFK7bJGvSF6XTbfTI5b/htEprJ5+9ogx3VWwlsQRiDceO7VtkO4S3snZXB QsEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Mt9b+5cqbBIgzp6O9dytn7/9Xl0Ujk3opErV/gQqZLs=; b=HOPd8+mgFHJ/vHVaXp0bjnu24AB+Zi1Jdt1epZHYgdNEx8Ok9BA732D0DiM80g1wNR 4cM1EmfQjXZT5PTpq3NfHj7gF2+PzcSWTI0MbgjpeM2aiU++lCiUZQHtdDRqnEaSqweL 3+wPg6pGfD+Sc7HL+ErWOXeFPc7ohMjqxP0ST5YGjGm9PWs5C72fWuk4tB9ueWktCPcO hclPz2OgPE9kkcMKgIHiH50XJGzjHCCz0Ky8kPixVQSwmxNNLGwgrzPS4RntnskXuOrC qFGCXvMLvkm2/ZR4WE1RIRQKOj5w7gDcEuPbpE7ZpxiTzbl/RMy9x1iR3neHTExIDVhJ Kh7w== X-Gm-Message-State: AOAM530rYXWuEb91J66szn2snRjtOGTtQb8ClpPjI9af7xVekrvUFm2k AMDHnszgLuOZo+ZCDqhMf6o= X-Google-Smtp-Source: ABdhPJxSYvg82L4HMFpad2FMKqLnfaD1/mG9Bv+O7ymoAbs19NX9KZtZx4qRWoUrDcEcNrpe5rX3DA== X-Received: by 2002:a1c:6a13:: with SMTP id f19mr1430453wmc.89.1637341939121; Fri, 19 Nov 2021 09:12:19 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-7.0 3/5] hw/display/vga-mmio: QOM'ify vga_mmio_init() as TYPE_VGA_MMIO Date: Fri, 19 Nov 2021 18:12:00 +0100 Message-Id: <20211119171202.458919-4-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119171202.458919-1-f4bug@amsat.org> References: <20211119171202.458919-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1637341943214100001 Introduce TYPE_VGA_MMIO, a sysbus device. While there is no change in the vga_mmio_init() interface, this is a migration compatibility break of the MIPS Acer Pica 61 Jazz machine (pica61). Suggested-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: BALATON Zoltan --- hw/display/vga-mmio.c | 134 +++++++++++++++++++++++++++++------------- 1 file changed, 94 insertions(+), 40 deletions(-) diff --git a/hw/display/vga-mmio.c b/hw/display/vga-mmio.c index 0aefbcf53a0..d1c5f31c134 100644 --- a/hw/display/vga-mmio.c +++ b/hw/display/vga-mmio.c @@ -2,6 +2,7 @@ * QEMU MMIO VGA Emulator. * * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2021 Philippe Mathieu-Daud=C3=A9 * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -23,21 +24,34 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/bitops.h" -#include "qemu/units.h" -#include "migration/vmstate.h" +#include "qapi/error.h" #include "hw/display/vga.h" +#include "hw/sysbus.h" +#include "hw/qdev-properties.h" #include "vga_int.h" -#include "ui/pixel_ops.h" =20 -#define VGA_RAM_SIZE (8 * MiB) +/* + * QEMU interface: + * + sysbus MMIO region 0: VGA I/O registers + * + sysbus MMIO region 1: VGA MMIO registers + * + sysbus MMIO region 2: VGA memory + */ =20 -typedef struct VGAMmioState { +#define TYPE_VGA_MMIO "vga-mmio" +OBJECT_DECLARE_SIMPLE_TYPE(VGAMmioState, VGA_MMIO) + +struct VGAMmioState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ VGACommonState vga; - int it_shift; -} VGAMmioState; + MemoryRegion iomem; + MemoryRegion lowmem; + + uint8_t it_shift; +}; =20 -/* Memory mapped interface */ static uint64_t vga_mm_read(void *opaque, hwaddr addr, unsigned size) { VGAMmioState *s =3D opaque; @@ -65,43 +79,83 @@ static const MemoryRegionOps vga_mm_ctrl_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 +static void vga_mmio_reset(DeviceState *dev) +{ + VGAMmioState *d =3D VGA_MMIO(dev); + VGACommonState *s =3D &d->vga; + + vga_common_reset(s); +} + int vga_mmio_init(hwaddr vram_base, hwaddr ctrl_base, int it_shift, MemoryRegion *address_space) { - VGAMmioState *s; - MemoryRegion *s_ioport_ctrl, *vga_io_memory; + DeviceState *dev; + SysBusDevice *s; =20 - s =3D g_malloc0(sizeof(*s)); + dev =3D qdev_new(TYPE_VGA_MMIO); + qdev_prop_set_uint8(dev, "it_shift", it_shift); + s =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(s, &error_fatal); =20 - s->vga.vram_size_mb =3D VGA_RAM_SIZE / MiB; - s->vga.global_vmstate =3D true; - vga_common_init(&s->vga, NULL); - - s->it_shift =3D it_shift; - s_ioport_ctrl =3D g_malloc(sizeof(*s_ioport_ctrl)); - memory_region_init_io(s_ioport_ctrl, NULL, &vga_mm_ctrl_ops, s, - "vga-mm-ctrl", 0x100000); - memory_region_set_flush_coalesced(s_ioport_ctrl); - - vga_io_memory =3D g_malloc(sizeof(*vga_io_memory)); - /* XXX: endianness? */ - memory_region_init_io(vga_io_memory, NULL, &vga_mem_ops, &s->vga, - "vga-mem", 0x20000); - - vmstate_register(NULL, 0, &vmstate_vga_common, s); - - memory_region_add_subregion(address_space, ctrl_base, s_ioport_ctrl); - s->vga.bank_offset =3D 0; - memory_region_add_subregion(address_space, - vram_base + 0x000a0000, vga_io_memory); - memory_region_set_coalescing(vga_io_memory); - - s->vga.con =3D graphic_console_init(NULL, 0, s->vga.hw_ops, s); - - memory_region_add_subregion(address_space, - VBE_DISPI_LFB_PHYSICAL_ADDRESS, - &s->vga.vram); + sysbus_mmio_map(s, 0, ctrl_base); + sysbus_mmio_map(s, 1, vram_base + 0x000a0000); + sysbus_mmio_map(s, 2, VBE_DISPI_LFB_PHYSICAL_ADDRESS); =20 return 0; } + +static void vga_mmio_realizefn(DeviceState *dev, Error **errp) +{ + VGAMmioState *s =3D VGA_MMIO(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + + memory_region_init_io(&s->iomem, OBJECT(dev), &vga_mm_ctrl_ops, s, + "vga-mmio", 0x100000); + memory_region_set_flush_coalesced(&s->iomem); + sysbus_init_mmio(sbd, &s->iomem); + + /* XXX: endianness? */ + memory_region_init_io(&s->lowmem, OBJECT(dev), &vga_mem_ops, &s->vga, + "vga-lowmem", 0x20000); + memory_region_set_coalescing(&s->lowmem); + sysbus_init_mmio(sbd, &s->lowmem); + + s->vga.bank_offset =3D 0; + s->vga.global_vmstate =3D true; + vga_common_init(&s->vga, OBJECT(dev)); + sysbus_init_mmio(sbd, &s->vga.vram); + s->vga.con =3D graphic_console_init(dev, 0, s->vga.hw_ops, &s->vga); +} + +static Property vga_mmio_properties[] =3D { + DEFINE_PROP_UINT8("it_shift", VGAMmioState, it_shift, 0), + DEFINE_PROP_UINT32("vgamem_mb", VGAMmioState, vga.vram_size_mb, 8), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vga_mmio_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D vga_mmio_realizefn; + dc->reset =3D vga_mmio_reset; + dc->vmsd =3D &vmstate_vga_common; + device_class_set_props(dc, vga_mmio_properties); + set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); +} + +static const TypeInfo vga_mmio_info =3D { + .name =3D TYPE_VGA_MMIO, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(VGAMmioState), + .class_init =3D vga_mmio_class_initfn, +}; + +static void vga_mmio_register_types(void) +{ + type_register_static(&vga_mmio_info); +} + +type_init(vga_mmio_register_types) --=20 2.31.1 From nobody Mon Feb 9 11:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) client-ip=209.85.221.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1637341945; cv=none; d=zohomail.com; s=zohoarc; b=VqfZZXjcheUs47CtKBvgLBvSqvPgoRFJhgOt30EslwYki6PuCWYQ1eMH/W5MH1cMvjtsTJm3xXAJ5pbsBbRHfYwUa0IXGDE0Qq6CnD/fwZxYxQOhlFPsW1gOpCW/zpJQwLpfn/Xj3NZ0coCh9ju8OW2FnGVRMgfIDseH9OgNaSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637341945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=L/CC3I2TBV/ZdA0Br80pFCsNnb1lQ9G4hQuRebB0TTw=; b=M0V749EGfdEni0T0y2b5hvG07aJzr8h4jL79BVy2c8fgMu9RoUhC17QLQzrWF/smixQpWkzhYsk8jvdgeuotvHPxfWat79BXOKyRrdfY7ju+LUwJHE9To91DxllnN6hllryK+NyhFHZeiRbc9JSnl51mRYab9i0Tq/bCWAs6rDI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.zohomail.com with SMTPS id 1637341945723630.6705541889982; Fri, 19 Nov 2021 09:12:25 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id d27so19312197wrb.6 for ; Fri, 19 Nov 2021 09:12:25 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id o12sm510061wrc.85.2021.11.19.09.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 09:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L/CC3I2TBV/ZdA0Br80pFCsNnb1lQ9G4hQuRebB0TTw=; b=XJJoc84RDmhstokLaNYqA67+k1GSj04TrY4fvspn6lIgT6KFo4RfuxePUi9PvpN/Og ShtLiMcvHHFxkLemM6Ig6ik+//qZhM1bXvD2KFsdwOGYJTfFYJWoEKhqsEAdcvQMLhaz 135mdpNoeW+3AnR0RZ6ol8Q/P8yMllzx9hejlWh9zbz6Te8QjdHN7nR4jacMJhSAcqRz PqbiFVWiaeKZAkdK1ywGz/J44ZpMlIGI/4Kson1sgUbKYQkFdNLijE6FANTdSZ6Z2cVT sF0Kl6fjoadjkwn5FqWkJChhf+YiN8MsCioTq3tskQYfuWQj/VuMOVTq4Mh88c1kSmfW ZfXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=L/CC3I2TBV/ZdA0Br80pFCsNnb1lQ9G4hQuRebB0TTw=; b=OSg2LsL0ytASOIg0OOpar1dvdznoF5+e3NnF13qk19ht03WfbaIl5d3gpteCdmTZyk zTWkNxMJdp6Swhn6AER8pPYXG8W+YqPSFh+sGpwGKQdBttGfi8HMjimeo0IOGga0Qvo0 sGlBro42G7JjunwD8GreZfrs1n7dyMqusqF1JEi3JtCjnnE9PjwIkTjiZrJtPlXakL8p qxBOhgauxUKy03b7NTYmbhRL2IayuuGU9AhES2HggUcQrYruz3ono54NFJiQmO+ugmml 7exHPIwZXXSN0yTwJG56wsoHsi0dFmIBKZSLNgEqCpBCd4s+vbRdjnE38CpsX1ZhSvfD SX2w== X-Gm-Message-State: AOAM532Udx80P+OXMWc/F4Nr4ZsYbikpiN3y7CRcxp96gkcF4QWBjkmb J3B86A7leLM2BezDkBZzp06rPWXsZ9E= X-Google-Smtp-Source: ABdhPJyAZRYVkHItd/wIhSdc35V3BXNTEYUIUBLuAlp00W6042VtGY69SkjmJRUo5G7Hs1oaZbbK5Q== X-Received: by 2002:a5d:47c7:: with SMTP id o7mr9662363wrc.204.1637341943937; Fri, 19 Nov 2021 09:12:23 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH-for-7.0 4/5] hw/mips/jazz: Inline vga_mmio_init() and remove it Date: Fri, 19 Nov 2021 18:12:01 +0100 Message-Id: <20211119171202.458919-5-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119171202.458919-1-f4bug@amsat.org> References: <20211119171202.458919-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1637341945980100001 vga_mmio_init() is used only one time and not very helpful, inline and remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: BALATON Zoltan --- include/hw/display/vga.h | 6 ------ hw/display/vga-mmio.c | 20 -------------------- hw/mips/jazz.c | 9 ++++++++- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/include/hw/display/vga.h b/include/hw/display/vga.h index 03c65a14218..451e4c9898c 100644 --- a/include/hw/display/vga.h +++ b/include/hw/display/vga.h @@ -9,8 +9,6 @@ #ifndef QEMU_HW_DISPLAY_VGA_H #define QEMU_HW_DISPLAY_VGA_H =20 -#include "exec/hwaddr.h" - /* * modules can reference this symbol to avoid being loaded * into system emulators without vga support @@ -24,8 +22,4 @@ enum vga_retrace_method { =20 extern enum vga_retrace_method vga_retrace_method; =20 -int vga_mmio_init(hwaddr vram_base, - hwaddr ctrl_base, int it_shift, - MemoryRegion *address_space); - #endif diff --git a/hw/display/vga-mmio.c b/hw/display/vga-mmio.c index d1c5f31c134..af9229794c9 100644 --- a/hw/display/vga-mmio.c +++ b/hw/display/vga-mmio.c @@ -25,7 +25,6 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "hw/display/vga.h" #include "hw/sysbus.h" #include "hw/qdev-properties.h" #include "vga_int.h" @@ -87,25 +86,6 @@ static void vga_mmio_reset(DeviceState *dev) vga_common_reset(s); } =20 -int vga_mmio_init(hwaddr vram_base, - hwaddr ctrl_base, int it_shift, - MemoryRegion *address_space) -{ - DeviceState *dev; - SysBusDevice *s; - - dev =3D qdev_new(TYPE_VGA_MMIO); - qdev_prop_set_uint8(dev, "it_shift", it_shift); - s =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(s, &error_fatal); - - sysbus_mmio_map(s, 0, ctrl_base); - sysbus_mmio_map(s, 1, vram_base + 0x000a0000); - sysbus_mmio_map(s, 2, VBE_DISPI_LFB_PHYSICAL_ADDRESS); - - return 0; -} - static void vga_mmio_realizefn(DeviceState *dev, Error **errp) { VGAMmioState *s =3D VGA_MMIO(dev); diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 8f345afd137..bd9815c773e 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -43,6 +43,7 @@ #include "hw/rtc/mc146818rtc.h" #include "hw/timer/i8254.h" #include "hw/display/vga.h" +#include "hw/display/bochs-vbe.h" #include "hw/audio/pcspk.h" #include "hw/input/i8042.h" #include "hw/sysbus.h" @@ -274,7 +275,13 @@ static void mips_jazz_init(MachineState *machine, } break; case JAZZ_PICA61: - vga_mmio_init(0x40000000, 0x60000000, 0, get_system_memory()); + dev =3D qdev_new("vga-mmio"); + qdev_prop_set_uint8(dev, "it_shift", 0); + sysbus =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(sysbus, &error_fatal); + sysbus_mmio_map(sysbus, 0, 0x60000000); + sysbus_mmio_map(sysbus, 1, 0x400a0000); + sysbus_mmio_map(sysbus, 2, VBE_DISPI_LFB_PHYSICAL_ADDRESS); break; default: break; --=20 2.31.1 From nobody Mon Feb 9 11:08:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) client-ip=209.85.128.49; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f49.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1637341950; cv=none; d=zohomail.com; s=zohoarc; b=TQzMs70V3xoKb5iYbTq8IrHp9widFZm3wSllfLJn8JKZgY6c5bnJ1Suih7yBm1NeWZa4D7fQdk6B3csZdWQjYUgtpE5qFacvzvlZLEvR2X+xkvwJCs9Eb0KtnB7jeOxwJYX1tFob0+tpKGIrTJfHHUGOg2zNZIfihhHbYle4e2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637341950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yKHiWsNR0W++K0Ck4B1IBleMBkNdeLmDWfP2xP1p/hE=; b=cCXnE7uj42gEipEWdQsLsRj0vrhpXzRwD7NdW4d24iLuhpStJ+OZ19YFQPljrEzKvttHUzhFQzKt7irZCLqbH5NktOPRTI6xxaReNsE5qP8qTB52ujtZHNNkI3OhX73FUVf+ABFjWtbaUctp5NPxZvg86MCZjnFElpacYQ5YaBg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.zohomail.com with SMTPS id 1637341950701444.54524212529975; Fri, 19 Nov 2021 09:12:30 -0800 (PST) Received: by mail-wm1-f49.google.com with SMTP id p18so9134500wmq.5 for ; Fri, 19 Nov 2021 09:12:30 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id a12sm303368wrm.62.2021.11.19.09.12.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 09:12:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yKHiWsNR0W++K0Ck4B1IBleMBkNdeLmDWfP2xP1p/hE=; b=PetEfr7DyTFftf2v4UA+fEQWvLKUzirQcNZ+TehjAomflof6vQIRsEQfqohrHwLmYd rrt/jvC8FfABvv4X5l3/XqmcSvcyWjVD+Fqm3idPNjqGE7vFi0nvQ6j8tjzL65csfAEi SoUyZmD+xRI5tAEVfVPaXvHb9aW71pnbzwaHKon1PLQmsv/2ZmxrBXj8vwtXyykhMQhF Y4tc/0FQteeVI4CqSfoKuT0djSbTCM1sVDJKerHiJ3JwxMG9G4649sh18iNBjoA64jUi FhJJzmYwlZf8x7ahsKfqRWlF3P7ZzjXl/IqlNFogLsZF6Bukdo6mZBp5MtmxtVCxKfuD j3dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yKHiWsNR0W++K0Ck4B1IBleMBkNdeLmDWfP2xP1p/hE=; b=HqpmvkRnf0sO59QtGvxnU5/CCdGFolH8rjL1B/GqjYTIzN3Sl1ROj4vfeR35hHPHgO 5VcizCaszal4E+OOTowsUi2OEO6w6GdZ4NEFn2xbE7kQD6CZJilhh4esSf0lY6egRxVC GpBj8jbG8HMdw9ruro8oWsslX1k8erZi3SyjOugT2hzS7/tHSLOlKzlU0Agx/YNCb4Fx Mh6XXbLK5k3CIHEJgotbiuFR/LYl6td7xvjimH0dX7oaTqk98lGuhifkUv9i1s2rCNpE 0Bqb5NmaFQCt4N9ObTwE+cIfDWwMMGpKZQlU3UZ/PF4VCBU+CrRhXDUTBfGWfM1CyaiB o/eQ== X-Gm-Message-State: AOAM532T2/rD4pyZQoaQ+tZhCfdmEO/e+wNtBJSisComz3DZKDThnO02 aaO1JfwmT7CEO8C7l0vOnYt2ySTv7pw= X-Google-Smtp-Source: ABdhPJx7ak6zBMYzt3QvOzUzjRs1kRST8o1Kt33RKaZVKSLnPNzyDIaGdTyGdJrE5pUKeJkxnp0rXw== X-Received: by 2002:a1c:7910:: with SMTP id l16mr1588737wme.36.1637341948803; Fri, 19 Nov 2021 09:12:28 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Finn Thain , Mark Cave-Ayland Subject: [NOTFORMERGE PATCH 5/5] tests/avocado: Test NetBSD 9.2 on the Jazz Magnum machine Date: Fri, 19 Nov 2021 18:12:02 +0100 Message-Id: <20211119171202.458919-6-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119171202.458919-1-f4bug@amsat.org> References: <20211119171202.458919-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1637341952821100001 Test NetBSD 9.2 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as: $ NTPROM_BIN_PATH=3D/path/to/ntprom.bin \ avocado --show=3Dapp,console \ run -t machine:magnum tests/avocado/ Fetching asset from tests/avocado/machine_mips_jazz.py:MipsJazz.test_magn= um_netbsd_9_2 (1/1) tests/avocado/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_9_2: console: EISA Bus 0 Initialization In Progress... Direct Memory Access (D= MA) System Control Port B Timer 1 OK. console: ARC Multiboot Version 174 (SGI Version 2.6) console: Copyright (c) 1991,1992 Microsoft Corporation console: Actions: console: Start Windows NT console: Run a program console: Run setup console: Use the arrow keys to select. console: Press Enter to choose. console: Program to run: console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd console: NetBSD/arc Bootstrap, Revision 1.1 (Wed May 12 13:15:55 UTC 2021) console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd console: NetBSD 9.2 (RAMDISK) #0: Wed May 12 13:15:55 UTC 2021 console: MIPS Magnum console: total memory =3D 128 MB console: avail memory =3D 117 MB console: mainbus0 (root) console: cpu0 at mainbus0: MIPS R4000 CPU (0x400) Rev. 0.0 with MIPS R401= 0 FPC Rev. 0.0 console: cpu0: 8KB/16B direct-mapped L1 Instruction cache, 48 TLB entries console: cpu0: 8KB/16B direct-mapped write-back L1 Data cache console: jazzio0 at mainbus0 console: timer0 at jazzio0 addr 0xe0000228 console: mcclock0 at jazzio0 addr 0xe0004000: mc146818 compatible time-of= -day clock console: LPT1 at jazzio0 addr 0xe0008000 intr 0 not configured console: fdc0 at jazzio0 addr 0xe0003000 intr 1 console: fd0 at fdc0 drive 1: 1.44MB, 80 cyl, 2 head, 18 sec console: MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured console: VXL at jazzio0 addr 0xe0800000 intr 3 not configured console: sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet console: sn0: Ethernet address 00:00:00:00:00:00 console: asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, 25MHz, SCSI ID= 7 console: scsibus0 at asc0: 8 targets, 8 luns per target console: pckbc0 at jazzio0 addr 0xe0005000 intr 6 console: pckbd0 at pckbc0 (kbd slot) console: wskbd0 at pckbd0 (mux ignored) console: pms at jazzio0 addr 0xe0005000 intr 7 not configured console: com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo console: com0: txfifo disabled console: com0: console console: com1 at jazzio0 addr 0xe0007000 intr 9: ns16550a, working fifo console: com1: txfifo disabled console: jazzisabr0 at mainbus0 console: isa0 at jazzisabr0 console: isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support console: scsibus0: waiting 2 seconds for devices to settle... console: cd0 at scsibus0 target 2 lun 0: cdrom = removable console: boot device: console: root on md0a dumps on md0b console: root file system type: ffs console: WARNING: preposterous TOD clock time console: WARNING: using filesystem time console: WARNING: CHECK AND RESET THE DATE! console: erase ^H, werase ^W, kill ^U, intr ^C, status ^T console: Terminal type? [vt100] console: Erase is backspace. console: S console: (I)nstall, (S)hell or (H)alt ? console: # console: # ifconfig console: sn0: flags=3D0x8802 mtu 1500 console: ec_capabilities=3D1 console: ec_enabled=3D0 console: address: 00:00:00:02:03:04 console: lo0: flags=3D0x8048 mtu 33160 console: # console: # ifconfig sn0 10.0.2.3/24 console: # console: # ping -c 3 10.0.2.2 console: PING 10.0.2.2 (10.0.2.2): 56 data bytes console: 64 bytes from 10.0.2.2: icmp_seq=3D0 ttl=3D255 time=3D12.526 ms console: 64 bytes from 10.0.2.2: icmp_seq=3D1 ttl=3D255 time=3D2.324 ms console: 64 bytes from 10.0.2.2: icmp_seq=3D2 ttl=3D255 time=3D0.608 ms console: ----10.0.2.2 PING Statistics---- console: 3 packets transmitted, 3 packets received, 0.0% packet loss console: # shutdown -r now console: round-trip min/avg/max/stddev =3D 0.608/5.153/12.526/6.443 ms console: # Shutdown NOW! console: shutdown: [pid 14] console: # sh: /usr/bin/wall: not found console: reboot by root: console: System shutdown time has arrived console: About to run shutdown hooks... console: .: Can't open /etc/rc.shutdown console: Done running shutdown hooks. console: syncing disks... done console: unmounting file systems... done console: rebooting... PASS (49.27 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | = CANCEL 0 JOB TIME : 49.70 s Inspired-by: Herv=C3=A9 Poussineau Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Willian Rampazzo --- v2: - Test NetBSD 9.2 (Finn, Mark) - Drop '-global ds1225y.size=3D8200' (Mark) - Mention "Run a program" option (Mark) - Check ARP (Finn) Not for merge until nvram.bin is generated. Cc: Finn Thain Cc: Mark Cave-Ayland --- .../avocado/machine_mips_jazz.d/nvram.bin.xz | Bin 0 -> 700 bytes tests/avocado/machine_mips_jazz.py | 99 ++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 tests/avocado/machine_mips_jazz.d/nvram.bin.xz create mode 100644 tests/avocado/machine_mips_jazz.py diff --git a/tests/avocado/machine_mips_jazz.d/nvram.bin.xz b/tests/avocado= /machine_mips_jazz.d/nvram.bin.xz new file mode 100644 index 0000000000000000000000000000000000000000..4648bb31a75bd1a6ee06818a1bf= 0f2109203ced3 GIT binary patch literal 700 zcmV;t0z>`%H+ooF000E$*0e?f03iV!0000G&sfah5B~ysT>t=3DTewJhU2JbgNgw@93 z9ne@Of$dv11>H(&qfaP~{?QVNDD*)y9o<}llIpWo;zi4K%|O3oZX7;e0I%^w=3D#ho% zm*3>5KcVeDb)hM{s=3D^@xl3*6CLiEr>=3Do;i$-UTTwy=3D`4vF_aQ@AM-}hS_gfV?dXL~ zr6}Ck7jr0Pd6X49Gycxm@5wylC8aWC%NAZ^DQmjk9v0R)a7u1hsY5)le9~S_G;wnI zNEhT-#4+m{FhwCCTK#>itkJ+zGLq(>iH&;ourQ75=3D5X0GCmKgT34hXv`!lNS@Vv~9 z#dTZb1?DkCrj z^?l-ksd=3D`Q%7w&-3CkM)A-1nkM@y=3D-6N=3DHiA4b +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os +import lzma +import shutil + +from avocado import skipUnless +from avocado_qemu import QemuSystemTest +from avocado_qemu import exec_command +from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import interrupt_interactive_console_until_pattern +from avocado_qemu import wait_for_console_pattern + +from tesseract_utils import tesseract_available, tesseract_ocr + +class MipsJazz(QemuSystemTest): + + timeout =3D 60 + + @skipUnless(os.getenv('NTPROM_BIN_PATH'), 'NTPROM_BIN_PATH not availab= le') + def test_magnum_netbsd_9_2(self): + """ + :avocado: tags=3Darch:mips64el + :avocado: tags=3Dmachine:magnum + :avocado: tags=3Dos:netbsd + :avocado: tags=3Ddevice:sonic + :avocado: tags=3Ddevice:esp + """ + drive_url =3D ('http://cdn.netbsd.org/pub/NetBSD/' + 'NetBSD-9.2/images/NetBSD-9.2-arc.iso') + drive_hash =3D '409c61aee5459e762cdb120d2591ed2e' + drive_path =3D self.fetch_asset(drive_url, asset_hash=3Ddrive_hash, + algorithm=3D'md5') + ntprom_hash =3D '316de17820192c89b8ee6d9936ab8364a739ca53' + ntprom_path =3D self.fetch_asset('file://' + os.getenv('NTPROM_BIN= _PATH'), + asset_hash=3Dntprom_hash, algorithm= =3D'sha1') + nvram_size =3D 8200 + nvram_path =3D 'nvram.bin' + nvram_xz_hash =3D '3d4565124ff2369706b97e1d0ef127a68c23d418' + nvram_xz_path =3D os.path.dirname(os.path.abspath(__file__)) \ + + '/machine_mips_jazz.d/nvram.bin.xz' + nvram_xz_path =3D self.fetch_asset('file://' + nvram_xz_path, + asset_hash=3Dnvram_xz_hash, + algorithm=3D'sha1') + mac =3D '00:00:00:02:03:04' + + with lzma.open(nvram_xz_path, 'rb') as f_in: + with open(nvram_path, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + f_out.seek(nvram_size) + f_out.write(b'\0') + + self.vm.set_console() + self.vm.add_args('-bios', ntprom_path, + '-drive', 'if=3Dscsi,unit=3D2,media=3Dcdrom,forma= t=3Draw,file=3D' + + drive_path, + '-global', 'ds1225y.filename=3D' + nvram_path, + '-nic', 'user,model=3Ddp83932,mac=3D' + mac) + self.vm.launch() + + console_pattern =3D 'ARC Multiboot Version 174 (SGI Version 2.6)' + wait_for_console_pattern(self, console_pattern) + + wait_for_console_pattern(self, 'Use the arrow keys to select.') + + # Press cursor control 'Down' to select the "Run a program" menu + exec_command(self, '\x1b[B') + + program =3D 'scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)ne= tbsd' + exec_command(self, program) + wait_for_console_pattern(self, 'NetBSD/arc Bootstrap, Revision 1.1= ') + + # Terminal type? [vt100] + console_pattern =3D 'erase ^H, werase ^W, kill ^U, intr ^C, status= ^T' + wait_for_console_pattern(self, console_pattern) + + # (I)nstall, (S)hell or (H)alt + exec_command_and_wait_for_pattern(self, '', 'Erase is backspace.') + exec_command(self, 'S') + interrupt_interactive_console_until_pattern(self, '#') + + exec_command_and_wait_for_pattern(self, 'ifconfig', 'address: ' + = mac) + interrupt_interactive_console_until_pattern(self, '#') + + exec_command(self, 'ifconfig sn0 10.0.2.3/24') + interrupt_interactive_console_until_pattern(self, '#') + + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + '3 packets transmitted, 3 packets received, 0.0% packet lo= ss') + + exec_command_and_wait_for_pattern(self, 'shutdown -r now', + 'rebooting...') --=20 2.31.1