[4/4] phb4: Fix M32 window mapping

Submitted by Russell Currey on April 10, 2017, 1:57 a.m.

Details

Message ID 20170410015737.9487-5-ruscur@russell.cc
State Superseded
Headers show

Commit Message

Russell Currey April 10, 2017, 1:57 a.m.
PHB4 is currently configured to use half the available PEs due to DD1
limitations, with windows configured to allocate two segments per PE.
phb4_map_pe_mmio_window() currently expects segment numbers to map one-to-one
with PE numbers, so correct it to use the two-to-one mapping.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 hw/phb4.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Michael Neuling April 13, 2017, 7:21 a.m.
> Re: [Skiboot] [PATCH 4/4] phb4: Fix M32 window mapping

Can you make this more descriptive and "Fix"? Maybe?

  phb4: Make M32 segment mappings two-to-one


On Mon, 2017-04-10 at 11:57 +1000, Russell Currey wrote:
> PHB4 is currently configured to use half the available PEs due to DD1
> limitations, with windows configured to allocate two segments per PE.
> phb4_map_pe_mmio_window() currently expects segment numbers to map one-to-one
> with PE numbers, so correct it to use the two-to-one mapping.

s/correct it/Correct phb4_map_pe_mmio_window()/

> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>
> ---
>  hw/phb4.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/phb4.c b/hw/phb4.c
> index 7a212809..767f3d38 100644
> --- a/hw/phb4.c
> +++ b/hw/phb4.c
> @@ -1164,7 +1164,7 @@ static int64_t phb4_map_pe_mmio_window(struct phb *phb,
>  				       uint16_t segment_num)
>  {
>  	struct phb4 *p = phb_to_phb4(phb);
> -	uint64_t mbt0, mbt1, mdt;
> +	uint64_t mbt0, mbt1, mdt0, mdt1;
>  
>  	if (pe_number >= p->num_pes)
>  		return OPAL_PARAMETER;
> @@ -1183,11 +1183,15 @@ static int64_t phb4_map_pe_mmio_window(struct phb
> *phb,
>  		if (window_num != 0 || segment_num >= p->max_num_pes)
>  			return OPAL_PARAMETER;
>  
> -		mdt = p->mdt_cache[segment_num];
> -		mdt = SETFIELD(IODA3_MDT_PE_A, mdt, pe_number);
> -		p->mdt_cache[segment_num] = mdt;
> -		phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num, false);
> -		out_be64(p->regs + PHB_IODA_DATA0, mdt);
> +		mdt0 = p->mdt_cache[segment_num << 1];
> +		mdt1 = p->mdt_cache[(segment_num << 1) + 1];
> +		mdt0 = SETFIELD(IODA3_MDT_PE_A, mdt0, pe_number);
> +		mdt1 = SETFIELD(IODA3_MDT_PE_A, mdt1, pe_number);
> +		p->mdt_cache[segment_num << 1] = mdt0;
> +		p->mdt_cache[(segment_num << 1) + 1] = mdt1;
> +		phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num << 1, true);
> +		out_be64(p->regs + PHB_IODA_DATA0, mdt0);
> +		out_be64(p->regs + PHB_IODA_DATA0, mdt1);
>  		break;
>  	case OPAL_M64_WINDOW_TYPE:
>  		if (window_num == 0 || window_num >= p->mbt_size)

Patch hide | download patch | download mbox

diff --git a/hw/phb4.c b/hw/phb4.c
index 7a212809..767f3d38 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1164,7 +1164,7 @@  static int64_t phb4_map_pe_mmio_window(struct phb *phb,
 				       uint16_t segment_num)
 {
 	struct phb4 *p = phb_to_phb4(phb);
-	uint64_t mbt0, mbt1, mdt;
+	uint64_t mbt0, mbt1, mdt0, mdt1;
 
 	if (pe_number >= p->num_pes)
 		return OPAL_PARAMETER;
@@ -1183,11 +1183,15 @@  static int64_t phb4_map_pe_mmio_window(struct phb *phb,
 		if (window_num != 0 || segment_num >= p->max_num_pes)
 			return OPAL_PARAMETER;
 
-		mdt = p->mdt_cache[segment_num];
-		mdt = SETFIELD(IODA3_MDT_PE_A, mdt, pe_number);
-		p->mdt_cache[segment_num] = mdt;
-		phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num, false);
-		out_be64(p->regs + PHB_IODA_DATA0, mdt);
+		mdt0 = p->mdt_cache[segment_num << 1];
+		mdt1 = p->mdt_cache[(segment_num << 1) + 1];
+		mdt0 = SETFIELD(IODA3_MDT_PE_A, mdt0, pe_number);
+		mdt1 = SETFIELD(IODA3_MDT_PE_A, mdt1, pe_number);
+		p->mdt_cache[segment_num << 1] = mdt0;
+		p->mdt_cache[(segment_num << 1) + 1] = mdt1;
+		phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num << 1, true);
+		out_be64(p->regs + PHB_IODA_DATA0, mdt0);
+		out_be64(p->regs + PHB_IODA_DATA0, mdt1);
 		break;
 	case OPAL_M64_WINDOW_TYPE:
 		if (window_num == 0 || window_num >= p->mbt_size)