All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, qemu-s390x@nongnu.org,
	qemu-block@nongnu.org, qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"LIU Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Frédéric Barrat" <fbarrat@linux.ibm.com>
Subject: [PULL 27/46] hw/ppc/pnv: Do not use SysBus API to map local MMIO region
Date: Thu, 19 Oct 2023 23:17:52 +0200	[thread overview]
Message-ID: <20231019211814.30576-28-philmd@linaro.org> (raw)
In-Reply-To: <20231019211814.30576-1-philmd@linaro.org>

There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Transformation done using the following coccinelle script:

  @@
  expression sbdev;
  expression index;
  expression addr;
  expression subregion;
  @@
  -    sysbus_init_mmio(sbdev, subregion);
       ... when != sbdev
  -    sysbus_mmio_map(sbdev, index, addr);
  +    memory_region_add_subregion(get_system_memory(), addr, subregion);

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20231019131647.19690-6-philmd@linaro.org>
---
 hw/ppc/pnv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 10158f7684..c0e34fffbc 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1217,10 +1217,9 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp)
 
     name = g_strdup_printf("icp-%x", chip->chip_id);
     memory_region_init(&chip8->icp_mmio, OBJECT(chip), name, PNV_ICP_SIZE);
-    sysbus_init_mmio(SYS_BUS_DEVICE(chip), &chip8->icp_mmio);
     g_free(name);
-
-    sysbus_mmio_map(SYS_BUS_DEVICE(chip), 1, PNV_ICP_BASE(chip));
+    memory_region_add_subregion(get_system_memory(), PNV_ICP_BASE(chip),
+                                &chip8->icp_mmio);
 
     /* Map the ICP registers for each thread */
     for (i = 0; i < chip->nr_cores; i++) {
-- 
2.41.0



  parent reply	other threads:[~2023-10-19 21:23 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 21:17 [PULL 00/46] Misc HW/UI patches for 2023-10-19 Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 01/46] mailmap: update email addresses for Luc Michel Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 02/46] MAINTAINERS: Split vt82c686 out of fuloong2e Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 03/46] MAINTAINERS: Add hw/input/lasips2.c to the HPPA machine section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 04/46] MAINTAINERS: Add include/hw/intc/loongson_liointc.h to the Loongson-3 virt section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 05/46] MAINTAINERS: Add include/hw/openrisc/ to the OpenRISC section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 06/46] cutils: Fix get_relocated_path on Windows Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 07/46] buildsys: Only display Objective-C information when Objective-C is used Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 08/46] memory: drop needless argument Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 09/46] memory: follow Error API guidelines Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 10/46] hw/sd/sdhci: Block Size Register bits [14:12] is lost Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 11/46] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 12/46] hw/mips: Merge 'hw/mips/cpudevs.h' with 'target/mips/cpu.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 13/46] hw/misc/mips_itu: Declare itc_reconfigure() in 'hw/misc/mips_itu.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 14/46] hw/misc/mips_itu: Make MIPSITUState target agnostic Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 15/46] hw/pci-host/sh_pcic: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 16/46] hw/pci-host/sh_pcic: Correct PCI host / devfn#0 function names Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 17/46] hw/pci-host/sh_pcic: Replace magic value by proper definition Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 18/46] hw/sparc64/ebus: Access memory regions via pci_address_space_io() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 19/46] hw/acpi/pcihp: Clean up global variable shadowing in acpi_pcihp_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 20/46] hw/pci: Clean up global variable shadowing of address_space_io variable Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 21/46] hw/s390x: Clean up global variable shadowing in quiesce_powerdown_req() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 22/46] hw/intc/apic: Use ERRP_GUARD() in apic_common_realize() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 23/46] hw/ppc/spapr_vio: Realize SPAPR_VIO_BRIDGE device before accessing it Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 24/46] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 25/46] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 26/46] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:17 ` Philippe Mathieu-Daudé [this message]
2023-10-19 21:17 ` [PULL 28/46] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 29/46] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 30/46] hw/audio/pcspk: Inline pcspk_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 31/46] hw/i386/amd_iommu: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 32/46] hw/i386/intel_iommu: " Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 33/46] hw/misc/allwinner-dramc: Move sysbus_mmio_map call from init -> realize Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 34/46] hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 35/46] hw/pci-host/bonito: " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 36/46] hw/acpi: Realize ACPI_GED sysbus device before accessing it Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 37/46] hw/arm/virt: Realize ARM_GICV2M " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 38/46] hw/isa: Realize ISA bridge " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 39/46] hw/s390x/css-bridge: Realize sysbus " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 40/46] hw/virtio/virtio-pmem: Replace impossible check by assertion Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 41/46] hw/block/vhost-user-blk: Use DEVICE() / VIRTIO_DEVICE() macros Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 42/46] hw/display/virtio-gpu: Use VIRTIO_DEVICE() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 43/46] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 44/46] hw/dma: Declare link using static DEFINE_PROP_LINK() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 45/46] hw/net: " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 46/46] ui/input: Constify QemuInputHandler structure Philippe Mathieu-Daudé
2023-10-20 10:04 ` [PULL 00/46] Misc HW/UI patches for 2023-10-19 Philippe Mathieu-Daudé
2023-10-20 16:06 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019211814.30576-28-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=clg@kaod.org \
    --cc=fbarrat@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.