From nobody Sat Feb 7 05:59:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) client-ip=209.85.221.67; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f67.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602791216; cv=none; d=zohomail.com; s=zohoarc; b=Vp8wjx8+/j52zMOG5TZvnOQQreN7cFcfAgbMzDqmKjtciehtogRg5VsA0Binli3tdplZYe1cXgAjxBo5Xn48GqoJDWxa/mU+rynHE2XMajqp6ytT0J9WTcXl9i52BnbpSdIg1c92uuSMMCPG7n5tgIyGpkOtQXRzbEwC3tJ566M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602791216; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aVFMu/wF+Vu6mv+mAFU+nD/l20KT6wub6M7L5ocQ5W8=; b=EeQ2f3JrNK4n7it8wl94NAwyzSTFasUrUm5enIvnnF8aJVeQ0cGcrLz5LRPru/Z2ARp7I9vFChkQOw/Ua+am2b28muT5T2FBYb5sZebVNuBKga3XSHb+KFzPf7XZiV23VWwFG6wiikGpzuGm6uOLXcHCVR8i7g8uIVTM7eBSjEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.zohomail.com with SMTPS id 1602791216619350.05375505913446; Thu, 15 Oct 2020 12:46:56 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id t9so5083332wrq.11 for ; Thu, 15 Oct 2020 12:46:55 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id k5sm87341wmb.19.2020.10.15.12.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 12:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aVFMu/wF+Vu6mv+mAFU+nD/l20KT6wub6M7L5ocQ5W8=; b=NaNkP7I/TDkCThp5BRIqNCiws+uZHAZrKtFL+eyome1Pav207TMWhofDfPFK60S7DA tZ07VoC/a+ODZmnSun5vhfgnNbSH9KyNTxKQpIR94vvTjeOVV1m4qnyYny0BRRbWMwtY oOM/F75UiKAanX5ltjROz3E9120ri4lxq+mtjpWuSk94mefgW5l8qagTTvcMQ5FVvuQR IodStUoBC5RbrQ6+S2swdSHyWUh2gg5or91DEuNOtE97OwvWYt8ai6flQ/MZPGAxInBK KRsOxnnxfyBhJyWng8vobnwPaVv8M602vvz0oUS9/B08fNE5ERP6M3TVbg6hYoEOkD8O XWeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aVFMu/wF+Vu6mv+mAFU+nD/l20KT6wub6M7L5ocQ5W8=; b=skF3MTwbDCRB5S2VWuTq6bO7qNxPw0qbmCdAOf2F+Uyvds0C1QQ0Yw+rh1/qWFVTfg T7tt6hoSSzCQAB63kAI06TOviABOdqgXSVe6ChNWm91qouadYz9Zc5AKwyzRvFVnd5gI hkLdkgYAw+Tx1bBHcSRgFKsLoU2rqG7F987/JfNRk/Q0SCrFABbCSOs9xEI2DdlAkkMR xA3MQSiA7LsLk46NS+fnmC6hG9h7tumOM5zjnZyJJSdgBLSdROdlfq4noIjMaK33MuEA MAU+3STV9nT45gTdRc/4nfuraQqK/DNNIhizw51dhSkxM+n6G72LByejgNDFmMi0Hz4Q 8pvw== X-Gm-Message-State: AOAM533OGPbHw3Up2DCcks5tJt4dYBJ4jFHOjg2QM9+TAPt4TqmIKDcc CaRwh9+7YhCis7GxVyXvjaI= X-Google-Smtp-Source: ABdhPJx/yZElf7ti0YFAB7DKcv6IBAL8MkGE9D21Nd4QFQFzpSx9wRodbA74CGYgCJTrAz/GEoHsZA== X-Received: by 2002:adf:9461:: with SMTP id 88mr6044908wrq.307.1602791214660; Thu, 15 Oct 2020 12:46:54 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Artyom Tarasenko , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] hw/rtc/m48t59: Simplify m48t59_init() removing 'io_base' argument Date: Thu, 15 Oct 2020 21:46:46 +0200 Message-Id: <20201015194647.477252-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015194647.477252-1-f4bug@amsat.org> References: <20201015194647.477252-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) As the 'io_base' argument of m48t59_init() is unused (set to 0), remove it to simplify. To create a device on the ISA bus, m48t59_init_isa() is the preferred function to use. Acked-by: David Gibson Reviewed-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/rtc/m48t59.h | 3 +-- hw/ppc/ppc405_boards.c | 2 +- hw/rtc/m48t59.c | 6 +----- hw/sparc/sun4m.c | 2 +- hw/sparc64/sun4u.c | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/hw/rtc/m48t59.h b/include/hw/rtc/m48t59.h index 04abedf3b2b..d99dda2b7de 100644 --- a/include/hw/rtc/m48t59.h +++ b/include/hw/rtc/m48t59.h @@ -50,7 +50,6 @@ struct NvramClass { Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, int base_year, int type); Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, - uint32_t io_base, uint16_t size, int base_year, - int type); + uint16_t size, int base_year, int model); =20 #endif /* HW_M48T59_H */ diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 6198ec1035b..93ffee801a3 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -227,7 +227,7 @@ static void ref405ep_init(MachineState *machine) /* Register FPGA */ ref405ep_fpga_init(sysmem, 0xF0300000); /* Register NVRAM */ - m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8); + m48t59_init(NULL, 0xF0000000, 8192, 1968, 8); /* Load kernel */ linux_boot =3D (kernel_filename !=3D NULL); if (linux_boot) { diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index 6525206976b..8b02c2ec558 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -566,7 +566,7 @@ const MemoryRegionOps m48t59_io_ops =3D { =20 /* Initialisation routine */ Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, - uint32_t io_base, uint16_t size, int base_year, + uint16_t size, int base_year, int model) { DeviceState *dev; @@ -584,10 +584,6 @@ Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_connect_irq(s, 0, IRQ); - if (io_base !=3D 0) { - memory_region_add_subregion(get_system_io(), io_base, - sysbus_mmio_get_region(s, 1)); - } if (mem_base !=3D 0) { sysbus_mmio_map(s, 0, mem_base); } diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 54a2b2f9ef3..20c1fa41192 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -966,7 +966,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwd= ef, create_unimplemented_device("SUNW,sx", hwdef->sx_base, 0x2000); } =20 - nvram =3D m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 196= 8, 8); + nvram =3D m48t59_init(slavio_irq[0], hwdef->nvram_base, 0x2000, 1968, = 8); =20 slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_= irq, smp_cpus); =20 diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index ad5ca2472a4..6854522bbfa 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -671,7 +671,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, pci_ide_create_devs(pci_dev); =20 /* Map NVRAM into I/O (ebus) space */ - nvram =3D m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59); + nvram =3D m48t59_init(NULL, 0, NVRAM_SIZE, 1968, 59); s =3D SYS_BUS_DEVICE(nvram); memory_region_add_subregion(pci_address_space_io(ebus), 0x2000, sysbus_mmio_get_region(s, 0)); --=20 2.26.2 From nobody Sat Feb 7 05:59:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1602791221; cv=none; d=zohomail.com; s=zohoarc; b=g3JwMAN0ZGqgYPlHH6NQdLjBZI7kROqWYHApDS090xOIU2eNKi7vk297DIW4WtV98pkIFryULWvYj1yedxE7RiMfyDQYiJqw1/e5wg5nT92YX4e33tG0KUnUnoPQkLXOuXsHGTY9j/UByYWch+mIno6jNnqursVOGn4MOt0KjM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602791221; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BpLyEF4lsBlmsqCz036I9WHuVtmpK50cd9Lhjaym5ic=; b=ELS8Np1iqBsm/lFWoFMMwq6i5hJFS2v6gKPwSb0WhBs7tw0otMB98VqLygtR/j9vfD8PGuM3FCxOoXLwkL/ZZXO8U362q/N5kuNyIVCLTyVnAdePuUIhY4ZdDHxnmqVwg2LwwYWZPYJZH0drQbF9od9FrA5Xyl+hD/GDQxIIyt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 160279122126347.43029364350855; Thu, 15 Oct 2020 12:47:01 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id j136so254792wmj.2 for ; Thu, 15 Oct 2020 12:47:00 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id 205sm63372wme.38.2020.10.15.12.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 12:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BpLyEF4lsBlmsqCz036I9WHuVtmpK50cd9Lhjaym5ic=; b=rjRUqZRFdwHkaiqMXKbFjikxw2uKT/z/skHRNn66y5Ij4KSuzqClMvgsM8SV5E6Klr lMrmK6UL3N938pfaja+cI1iwxpVIu9Zo65bHn/LL2jqMXA6E6KgULduQt00D9bVnIwLk T5GLqYTxIIr1856PD1D5+5m2uT9+i8hBXkR5I6ZIGX8vPvrwsvKem3kj2OqrasAXV4EW Vg9/G6WPY9m+X7OY94K2lJ8VysFNlzblwIboZKbq2kNqCcTJESPntMUhBi1piLIecvHo G2qUqbXPJw2XZvC6gMZS3r8lWJFYM6weJ2Bd/8FEaztdaRAqhMW1R8lvOa5BHhsCYO9C KWdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BpLyEF4lsBlmsqCz036I9WHuVtmpK50cd9Lhjaym5ic=; b=lXyTjWcuwn9T6eR2atZldUI1ncLFMAEsxlsqjX0iQ0IhM4my0rt8tZLxyfV3Qeuv0g 3rHNS4LRWUgu++Ap30SFikf3gFtZGns8Jkj5qRlqSG2FzUfp47r0tQV4V/uTRDvdWVtm HqZfQz2MnzSCRWQfWs6Dn9MIH520H1FI1a2CRzlRcKigbsDnh6svsxrfpUI1NCEihfVD EZi5n/iIfGITxJrdonYqGBORt/XSTNGEik32RUL1zPii5J3rnmMGfYXTtfOlkpsrreCQ INl9RDVHRQDna3NLEq2GcKkkeCfjBtw+B2Rkbf0Wd582Vek/3A65rDY7AXC4IdxrAF+n 6B9Q== X-Gm-Message-State: AOAM533k/UYQ+Daci77gYxIozm4B9S63PjVIDgVyQogxn3OnMQy1viGv ZfoBC/FyKB/lDeVp1K99hmO6Rxl+okM= X-Google-Smtp-Source: ABdhPJwyYdDf4ugiKS5iqxNyAqLPXgnC4yHrPOAMGOOyc1Dd7OOAsP3eyaKJcuiGBqFcyHb44lJS9Q== X-Received: by 2002:a1c:3:: with SMTP id 3mr279581wma.14.1602791219298; Thu, 15 Oct 2020 12:46:59 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-trivial@nongnu.org, Artyom Tarasenko , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , David Gibson , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/2] hw/rtc/m48t59: Simplify m48t59_init() passing MemoryRegion argument Date: Thu, 15 Oct 2020 21:46:47 +0200 Message-Id: <20201015194647.477252-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201015194647.477252-1-f4bug@amsat.org> References: <20201015194647.477252-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) Pass a MemoryRegion* to m48t59_init(), directly call memory_region_add_subregion() instead of sysbus_mmio_map(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson --- include/hw/rtc/m48t59.h | 2 +- hw/ppc/ppc405_boards.c | 2 +- hw/rtc/m48t59.c | 10 +++------- hw/sparc/sun4m.c | 3 ++- hw/sparc64/sun4u.c | 7 ++----- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/include/hw/rtc/m48t59.h b/include/hw/rtc/m48t59.h index d99dda2b7de..3c337e8171c 100644 --- a/include/hw/rtc/m48t59.h +++ b/include/hw/rtc/m48t59.h @@ -49,7 +49,7 @@ struct NvramClass { =20 Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size, int base_year, int type); -Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, +Nvram *m48t59_init(MemoryRegion *mr, hwaddr mem_base, qemu_irq IRQ, uint16_t size, int base_year, int model); =20 #endif /* HW_M48T59_H */ diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 93ffee801a3..6ab1b860545 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -227,7 +227,7 @@ static void ref405ep_init(MachineState *machine) /* Register FPGA */ ref405ep_fpga_init(sysmem, 0xF0300000); /* Register NVRAM */ - m48t59_init(NULL, 0xF0000000, 8192, 1968, 8); + m48t59_init(get_system_memory(), 0xF0000000, NULL, 8192, 1968, 8); /* Load kernel */ linux_boot =3D (kernel_filename !=3D NULL); if (linux_boot) { diff --git a/hw/rtc/m48t59.c b/hw/rtc/m48t59.c index 8b02c2ec558..7ec4b241218 100644 --- a/hw/rtc/m48t59.c +++ b/hw/rtc/m48t59.c @@ -565,9 +565,8 @@ const MemoryRegionOps m48t59_io_ops =3D { }; =20 /* Initialisation routine */ -Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, - uint16_t size, int base_year, - int model) +Nvram *m48t59_init(MemoryRegion *mr, hwaddr mem_base, qemu_irq IRQ, + uint16_t size, int base_year, int model) { DeviceState *dev; SysBusDevice *s; @@ -584,10 +583,7 @@ Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_connect_irq(s, 0, IRQ); - if (mem_base !=3D 0) { - sysbus_mmio_map(s, 0, mem_base); - } - + memory_region_add_subregion(mr, mem_base, sysbus_mmio_get_region(s= , 0)); return NVRAM(s); } =20 diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 20c1fa41192..aebe9e0df3d 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -966,7 +966,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwd= ef, create_unimplemented_device("SUNW,sx", hwdef->sx_base, 0x2000); } =20 - nvram =3D m48t59_init(slavio_irq[0], hwdef->nvram_base, 0x2000, 1968, = 8); + nvram =3D m48t59_init(get_system_memory(), hwdef->nvram_base, slavio_i= rq[0], + 0x2000, 1968, 8); =20 slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_= irq, smp_cpus); =20 diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 6854522bbfa..4c975c25274 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -561,7 +561,6 @@ static void sun4uv_init(MemoryRegion *address_space_mem, SabreState *sabre; PCIBus *pci_bus, *pci_busA, *pci_busB; PCIDevice *ebus, *pci_dev; - SysBusDevice *s; DeviceState *iommu, *dev; FWCfgState *fw_cfg; NICInfo *nd; @@ -671,10 +670,8 @@ static void sun4uv_init(MemoryRegion *address_space_me= m, pci_ide_create_devs(pci_dev); =20 /* Map NVRAM into I/O (ebus) space */ - nvram =3D m48t59_init(NULL, 0, NVRAM_SIZE, 1968, 59); - s =3D SYS_BUS_DEVICE(nvram); - memory_region_add_subregion(pci_address_space_io(ebus), 0x2000, - sysbus_mmio_get_region(s, 0)); + nvram =3D m48t59_init(pci_address_space_io(ebus), 0x2000, NULL, + NVRAM_SIZE, 1968, 59); =20 initrd_size =3D 0; initrd_addr =3D 0; --=20 2.26.2