[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 13/17] pnv_phb4.h: turn phb into a pointer in struct PnvPhb4PecSt
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH 13/17] pnv_phb4.h: turn phb into a pointer in struct PnvPhb4PecStack |
Date: |
Tue, 28 Dec 2021 16:38:02 -0300 |
At this moment, stack->phb is the plain PnvPHB4 device itself instead
of a pointer to the device. This will present a problem when adding user
creatable devices because we can't deal with this struct and the
realize() callback from the user creatable device.
We can't get rid of this attribute, similar to what we did when enabling
pnv-phb3 user creatable devices, because pnv_phb4_update_regions() needs
to access stack->phb to do its job. This function is called twice in
pnv_pec_stk_update_map(), which is one of the nested xscom write
callbacks (via pnv_pec_stk_nest_xscom_write()). In fact,
pnv_pec_stk_update_map() code comment is explicit about how the order of
the unmap/map operations relates with the PHB subregions.
All of this indicates that this code is tied together in a way that we
either go on a crusade, featuring lots of refactories and redesign and
considerable pain, to decouple stack and phb mapping, or we allow stack
update_map operations to access the associated PHB as it is today even
after introducing pnv-phb4 user devices.
This patch chooses the latter. Instead of getting rid of stack->phb,
turn it into a PHB pointer. This will allow us to assign an user created
PHB to an existing stack later.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/pci-host/pnv_phb4.c | 2 +-
hw/pci-host/pnv_phb4_pec.c | 2 +-
include/hw/pci-host/pnv_phb4.h | 7 +++++--
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 31284e0460..5b2f644662 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1564,7 +1564,7 @@ type_init(pnv_phb4_register_types);
void pnv_phb4_update_regions(PnvPhb4PecStack *stack)
{
- PnvPHB4 *phb = &stack->phb;
+ PnvPHB4 *phb = stack->phb;
/* Unmap first always */
if (memory_region_is_mapped(&phb->mr_regs)) {
diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c
index 031e98f1f4..3797696e8f 100644
--- a/hw/pci-host/pnv_phb4_pec.c
+++ b/hw/pci-host/pnv_phb4_pec.c
@@ -592,7 +592,7 @@ static void pnv_pec_stk_realize(DeviceState *dev, Error
**errp)
PHB4_PEC_PCI_STK_REGS_COUNT);
/* PHB pass-through */
- pnv_phb4_set_stack_phb_props(stack, &stack->phb);
+ pnv_phb4_set_stack_phb_props(stack, stack->phb);
if (!sysbus_realize(SYS_BUS_DEVICE(&stack->phb), errp)) {
return;
}
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 0f6c81c9cb..d67e33924b 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -181,8 +181,11 @@ struct PnvPhb4PecStack {
/* The owner PEC */
PnvPhb4PecState *pec;
- /* The actual PHB */
- PnvPHB4 phb;
+ /*
+ * PHB4 pointer. pnv_phb4_update_regions() needs to access
+ * the PHB4 via a PnvPhb4PecStack pointer.
+ */
+ PnvPHB4 *phb;
};
struct PnvPhb4PecState {
--
2.33.1
- [PATCH 01/17] pnv_phb3.c: add unique chassis and slot for pnv_phb3_root_port, (continued)
- [PATCH 01/17] pnv_phb3.c: add unique chassis and slot for pnv_phb3_root_port, Daniel Henrique Barboza, 2021/12/28
- [PATCH 02/17] pnv_phb3.c: do not set 'root-bus' as bus name, Daniel Henrique Barboza, 2021/12/28
- [PATCH 06/17] pnv_phb4.c: attach default root port in phb4 realize(), Daniel Henrique Barboza, 2021/12/28
- [PATCH 04/17] pnv_phb4.c: add unique chassis and slot for pnv_phb4_root_port, Daniel Henrique Barboza, 2021/12/28
- [PATCH 07/17] pnv_phb4.c: check if root port exists in rc_config functions, Daniel Henrique Barboza, 2021/12/28
- [PATCH 03/17] pnv_phb3.h: change TYPE_PNV_PHB3_ROOT_BUS name, Daniel Henrique Barboza, 2021/12/28
- [PATCH 08/17] pnv_phb4.c: introduce pnv_phb4_set_stack_phb_props(), Daniel Henrique Barboza, 2021/12/28
- [PATCH 09/17] pnv_phb4_pec.c: move pnv_pec_phb_offset() to pnv_phb4.c, Daniel Henrique Barboza, 2021/12/28
- [PATCH 05/17] pnv.c: simplify pnv_phb_attach_root_port(), Daniel Henrique Barboza, 2021/12/28
- [PATCH 11/17] pnv_phb4_pec.c: use pnv_pec_get_phb_id() in pnv_pec_dt_xscom(), Daniel Henrique Barboza, 2021/12/28
- [PATCH 13/17] pnv_phb4.h: turn phb into a pointer in struct PnvPhb4PecStack,
Daniel Henrique Barboza <=
- [PATCH 14/17] Revert "ppc/pnv: Introduce support for user created PHB4 devices", Daniel Henrique Barboza, 2021/12/28
- [PATCH 15/17] ppc/pnv: Introduce user creatable pnv-phb4 devices, Daniel Henrique Barboza, 2021/12/28
- [PATCH 10/17] pnv_phb4.c: introduce pnv_pec_init_stack_xscom(), Daniel Henrique Barboza, 2021/12/28
- [PATCH 12/17] pnv_phb4_pec.c: use 'default_enabled()' to init stack->phb, Daniel Henrique Barboza, 2021/12/28
- [PATCH 16/17] pnv_phb4.c: do not set 'root-bus' as bus name, Daniel Henrique Barboza, 2021/12/28
- [PATCH 17/17] pnv_phb4.c: change TYPE_PNV_PHB4_ROOT_BUS name, Daniel Henrique Barboza, 2021/12/28