diff mbox series

[v2] phb4: Enable PHB MMIO-0/1 Bars only when mmio window exists

Message ID 20180823100749.32699-1-vaibhav@linux.ibm.com
State Accepted
Headers show
Series [v2] phb4: Enable PHB MMIO-0/1 Bars only when mmio window exists | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/make_check success Test make_check on branch master

Commit Message

Vaibhav Jain Aug. 23, 2018, 10:07 a.m. UTC
Presently phb4_probe_stack() will always enable PHB MMIO0/1 windows
even if they doesn't exist in phy_map. Hence we do some minor shuffling
in the phb4_probe_stack() so that MMIO-0/1 Bars are only enabled if
there corresponding MMIO window exists in the phy_map. In case phy_map
for an mmio window is '0' we set the corresponding BAR register to
'0'.

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
Change-log

v2	-> Re-factored the patch to make sure bar registers are set to
	'0' if the corresponding mmio window doesn't exist. [Oliver]
---
 hw/phb4.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Oliver O'Halloran Aug. 31, 2018, 6:49 a.m. UTC | #1
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>

On Thu, Aug 23, 2018 at 8:07 PM, Vaibhav Jain <vaibhav@linux.ibm.com> wrote:
> Presently phb4_probe_stack() will always enable PHB MMIO0/1 windows
> even if they doesn't exist in phy_map. Hence we do some minor shuffling
> in the phb4_probe_stack() so that MMIO-0/1 Bars are only enabled if
> there corresponding MMIO window exists in the phy_map. In case phy_map
> for an mmio window is '0' we set the corresponding BAR register to
> '0'.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> Change-log
>
> v2      -> Re-factored the patch to make sure bar registers are set to
>         '0' if the corresponding mmio window doesn't exist. [Oliver]
> ---
>  hw/phb4.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/phb4.c b/hw/phb4.c
> index d1245dce..2ecd80e7 100644
> --- a/hw/phb4.c
> +++ b/hw/phb4.c
> @@ -5537,7 +5537,7 @@ static void phb4_probe_stack(struct dt_node *stk_node, uint32_t pec_index,
>         uint32_t pci_stack, nest_stack, etu_base, gcid, phb_num, stk_index;
>         uint64_t val, phb_bar = 0, irq_bar = 0, bar_en;
>         uint64_t mmio0_bar = 0, mmio0_bmask, mmio0_sz;
> -       uint64_t mmio1_bar, mmio1_bmask, mmio1_sz;
> +       uint64_t mmio1_bar = 0, mmio1_bmask, mmio1_sz;
>         uint64_t reg[4];
>         void *foo;
>         uint64_t mmio_win[4];
> @@ -5587,7 +5587,6 @@ static void phb4_probe_stack(struct dt_node *stk_node, uint32_t pec_index,
>         mmio1_bmask =  (~(mmio1_sz - 1)) & 0x00FFFFFFFFFFFFFFULL;
>         xscom_write(gcid, nest_stack + XPEC_NEST_STK_MMIO_BAR1, mmio1_bar << 8);
>         xscom_write(gcid, nest_stack + XPEC_NEST_STK_MMIO_BAR1_MASK, mmio1_bmask << 8);
> -       bar_en |= XPEC_NEST_STK_BAR_EN_MMIO0 | XPEC_NEST_STK_BAR_EN_MMIO1;
>
>         /* Build MMIO windows list */
>         mmio_win_sz = 0;
> --
> 2.17.1
>
Stewart Smith Oct. 16, 2018, 7:51 a.m. UTC | #2
Vaibhav Jain <vaibhav@linux.ibm.com> writes:

> Presently phb4_probe_stack() will always enable PHB MMIO0/1 windows
> even if they doesn't exist in phy_map. Hence we do some minor shuffling
> in the phb4_probe_stack() so that MMIO-0/1 Bars are only enabled if
> there corresponding MMIO window exists in the phy_map. In case phy_map
> for an mmio window is '0' we set the corresponding BAR register to
> '0'.
>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>

Thanks, merged to master as of c8e1d61ae2c94d3ac5d4598800f793b313726b2a.
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index d1245dce..2ecd80e7 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -5537,7 +5537,7 @@  static void phb4_probe_stack(struct dt_node *stk_node, uint32_t pec_index,
 	uint32_t pci_stack, nest_stack, etu_base, gcid, phb_num, stk_index;
 	uint64_t val, phb_bar = 0, irq_bar = 0, bar_en;
 	uint64_t mmio0_bar = 0, mmio0_bmask, mmio0_sz;
-	uint64_t mmio1_bar, mmio1_bmask, mmio1_sz;
+	uint64_t mmio1_bar = 0, mmio1_bmask, mmio1_sz;
 	uint64_t reg[4];
 	void *foo;
 	uint64_t mmio_win[4];
@@ -5587,7 +5587,6 @@  static void phb4_probe_stack(struct dt_node *stk_node, uint32_t pec_index,
 	mmio1_bmask =  (~(mmio1_sz - 1)) & 0x00FFFFFFFFFFFFFFULL;
 	xscom_write(gcid, nest_stack + XPEC_NEST_STK_MMIO_BAR1, mmio1_bar << 8);
 	xscom_write(gcid, nest_stack + XPEC_NEST_STK_MMIO_BAR1_MASK, mmio1_bmask << 8);
-	bar_en |= XPEC_NEST_STK_BAR_EN_MMIO0 | XPEC_NEST_STK_BAR_EN_MMIO1;
 
 	/* Build MMIO windows list */
 	mmio_win_sz = 0;