ppc/pnv: Loop on the threads of the chip to find a matching NVT
CPU_FOREACH() loops on all the CPUs of the machine which is incorrect. Each XIVE Presenter should scan only the HW threads of the chip it belongs to. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20191125065820.927-5-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
		
				
					committed by
					
						
						David Gibson
					
				
			
			
				
	
			
			
			
						parent
						
							4fa28f2390
						
					
				
				
					commit
					feecc6a043
				
			@@ -377,34 +377,43 @@ static int pnv_xive_match_nvt(XivePresenter *xptr, uint8_t format,
 | 
				
			|||||||
                              bool cam_ignore, uint8_t priority,
 | 
					                              bool cam_ignore, uint8_t priority,
 | 
				
			||||||
                              uint32_t logic_serv, XiveTCTXMatch *match)
 | 
					                              uint32_t logic_serv, XiveTCTXMatch *match)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    CPUState *cs;
 | 
					    PnvXive *xive = PNV_XIVE(xptr);
 | 
				
			||||||
 | 
					    PnvChip *chip = xive->chip;
 | 
				
			||||||
    int count = 0;
 | 
					    int count = 0;
 | 
				
			||||||
 | 
					    int i, j;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CPU_FOREACH(cs) {
 | 
					    for (i = 0; i < chip->nr_cores; i++) {
 | 
				
			||||||
        PowerPCCPU *cpu = POWERPC_CPU(cs);
 | 
					        PnvCore *pc = chip->cores[i];
 | 
				
			||||||
        XiveTCTX *tctx = XIVE_TCTX(pnv_cpu_state(cpu)->intc);
 | 
					        CPUCore *cc = CPU_CORE(pc);
 | 
				
			||||||
        int ring;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*
 | 
					        for (j = 0; j < cc->nr_threads; j++) {
 | 
				
			||||||
         * Check the thread context CAM lines and record matches.
 | 
					            PowerPCCPU *cpu = pc->threads[j];
 | 
				
			||||||
         */
 | 
					            XiveTCTX *tctx;
 | 
				
			||||||
        ring = xive_presenter_tctx_match(xptr, tctx, format, nvt_blk, nvt_idx,
 | 
					            int ring;
 | 
				
			||||||
                                         cam_ignore, logic_serv);
 | 
					
 | 
				
			||||||
        /*
 | 
					            tctx = XIVE_TCTX(pnv_cpu_state(cpu)->intc);
 | 
				
			||||||
         * Save the context and follow on to catch duplicates, that we
 | 
					
 | 
				
			||||||
         * don't support yet.
 | 
					            /*
 | 
				
			||||||
         */
 | 
					             * Check the thread context CAM lines and record matches.
 | 
				
			||||||
        if (ring != -1) {
 | 
					             */
 | 
				
			||||||
            if (match->tctx) {
 | 
					            ring = xive_presenter_tctx_match(xptr, tctx, format, nvt_blk,
 | 
				
			||||||
                qemu_log_mask(LOG_GUEST_ERROR, "XIVE: already found a "
 | 
					                                             nvt_idx, cam_ignore, logic_serv);
 | 
				
			||||||
                              "thread context NVT %x/%x\n",
 | 
					            /*
 | 
				
			||||||
                              nvt_blk, nvt_idx);
 | 
					             * Save the context and follow on to catch duplicates, that we
 | 
				
			||||||
                return -1;
 | 
					             * don't support yet.
 | 
				
			||||||
 | 
					             */
 | 
				
			||||||
 | 
					            if (ring != -1) {
 | 
				
			||||||
 | 
					                if (match->tctx) {
 | 
				
			||||||
 | 
					                    qemu_log_mask(LOG_GUEST_ERROR, "XIVE: already found a "
 | 
				
			||||||
 | 
					                                  "thread context NVT %x/%x\n",
 | 
				
			||||||
 | 
					                                  nvt_blk, nvt_idx);
 | 
				
			||||||
 | 
					                    return -1;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                match->ring = ring;
 | 
				
			||||||
 | 
					                match->tctx = tctx;
 | 
				
			||||||
 | 
					                count++;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
            match->ring = ring;
 | 
					 | 
				
			||||||
            match->tctx = tctx;
 | 
					 | 
				
			||||||
            count++;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user