From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: BALATON Zoltan <balaton@eik.bme.hu>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Nicholas Piggin" <npiggin@gmail.com>
Subject: Re: [PATCH 10/16] hw/pci-host/raven: Use correct parameter in direct access ops
Date: Tue, 3 Jun 2025 13:47:39 +0200 [thread overview]
Message-ID: <edea1739-3ac8-452d-b1f6-41196be2f37f@linaro.org> (raw)
In-Reply-To: <6205b7eb571626ccc7fb017132e705a49fa3a6ff.1746374076.git.balaton@eik.bme.hu>
On 4/5/25 18:01, BALATON Zoltan wrote:
> Instead of passing unneeded enclosing objects to the config direct
> access ops that only need the bus we can pass that directly thus
> simplifying the functions.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/pci-host/raven.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
> index d7a0bde382..c39e95b45f 100644
> --- a/hw/pci-host/raven.c
> +++ b/hw/pci-host/raven.c
> @@ -65,16 +65,12 @@ static inline uint32_t raven_idsel_to_addr(hwaddr addr)
> static void raven_mmcfg_write(void *opaque, hwaddr addr, uint64_t val,
> unsigned int size)
> {
> - PREPPCIState *s = opaque;
> - PCIHostState *phb = PCI_HOST_BRIDGE(s);
> - pci_data_write(phb->bus, raven_idsel_to_addr(addr), val, size);
Something like this is clearer IMHO:
PCIBus *hbus = opaque;
pci_data_write(hbus, raven_idsel_to_addr(addr), val, size);
> + pci_data_write(opaque, raven_idsel_to_addr(addr), val, size);
> }
>
> static uint64_t raven_mmcfg_read(void *opaque, hwaddr addr, unsigned int size)
> {
> - PREPPCIState *s = opaque;
> - PCIHostState *phb = PCI_HOST_BRIDGE(s);
> - return pci_data_read(phb->bus, raven_idsel_to_addr(addr), size);
Ditto.
> + return pci_data_read(opaque, raven_idsel_to_addr(addr), size);
> }
>
> static const MemoryRegionOps raven_mmcfg_ops = {
> @@ -233,7 +229,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
> "pci-conf-data", 4);
> memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem);
>
> - memory_region_init_io(&h->mmcfg, OBJECT(s), &raven_mmcfg_ops, s,
> + memory_region_init_io(&h->mmcfg, OBJECT(h), &raven_mmcfg_ops, h->bus,
> "pci-mmcfg", 0x00400000);
> memory_region_add_subregion(address_space_mem, 0x80800000, &h->mmcfg);
>
Casting the opaque:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2025-06-03 11:48 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 16:01 [PATCH 00/16] hw/pci-host/raven clean ups BALATON Zoltan
2025-05-04 16:01 ` [PATCH 01/16] hw/pci-host/raven: Remove is-legacy-prep property BALATON Zoltan
2025-06-03 11:31 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 02/16] hw/pci-host/raven: Revert "raven: Move BIOS loading from board code to PCI host" BALATON Zoltan
2025-06-03 11:37 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 03/16] hw/pci-host/raven: Simplify PCI facing part BALATON Zoltan
2025-06-03 11:41 ` Philippe Mathieu-Daudé
2025-06-03 13:41 ` BALATON Zoltan
2025-05-04 16:01 ` [PATCH 04/16] hw/pci-host/raven: Simplify host bridge type declaration BALATON Zoltan
2025-06-03 11:41 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 05/16] hw/pci-host/raven: Use DEFINE_TYPES macro BALATON Zoltan
2025-06-03 11:42 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 06/16] hw/pci-host/raven: Simplify PCI bus creation BALATON Zoltan
2025-05-04 16:01 ` [PATCH 07/16] hw/pci-host/raven: Simplify PCI interrupt routing BALATON Zoltan
2025-05-04 16:01 ` [PATCH 08/16] hw/pci-host/raven: Simplify direct config access address decoding BALATON Zoltan
2025-05-04 16:01 ` [PATCH 09/16] hw/pci-host/raven: Rename direct config access ops BALATON Zoltan
2025-05-04 16:01 ` [PATCH 10/16] hw/pci-host/raven: Use correct parameter in direct " BALATON Zoltan
2025-06-03 11:47 ` Philippe Mathieu-Daudé [this message]
2025-05-04 16:01 ` [PATCH 11/16] hw/pci-host/raven: Do not use parent object for mmcfg region BALATON Zoltan
2025-06-03 11:50 ` Philippe Mathieu-Daudé
2025-06-03 13:45 ` BALATON Zoltan
2025-05-04 16:01 ` [PATCH 12/16] hw/pci-host/raven: Fix PCI config direct access region BALATON Zoltan
2025-06-03 11:52 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 13/16] hw/pci-host/raven: Simpify discontiguous IO access BALATON Zoltan
2025-05-04 16:01 ` [PATCH 14/16] hw/pci-host/raven: Move bus master address space creation to one place BALATON Zoltan
2025-05-04 16:01 ` [PATCH 15/16] hw/pci-host/raven: Do not map regions in init method BALATON Zoltan
2025-06-03 11:54 ` Philippe Mathieu-Daudé
2025-06-03 13:50 ` BALATON Zoltan
2025-06-04 10:39 ` Philippe Mathieu-Daudé
2025-05-04 16:01 ` [PATCH 16/16] hw/ppc/prep: Fix non-contiguous IO control bit BALATON Zoltan
2025-05-22 22:31 ` [PATCH 00/16] hw/pci-host/raven clean ups BALATON Zoltan
2025-06-02 12:27 ` BALATON Zoltan
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=edea1739-3ac8-452d-b1f6-41196be2f37f@linaro.org \
--to=philmd@linaro.org \
--cc=atar4qemu@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=hpoussin@reactos.org \
--cc=npiggin@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).