arm: virt: add PMU property to mach-virt machine type
CPU vPMU is now turned ON by default, but this feature wasn't introduced until virt-2.7 machine type. To solve this problem, this patch adds a PMU option in machine state, which is used to control CPU's vPMU status. This PMU option is not exposed to command line and is turned off in virt-2.6 machine type. Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Wei Huang <wei@redhat.com> Message-id: 1477463301-17175-3-git-send-email-wei@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
		
							parent
							
								
									929e754d5a
								
							
						
					
					
						commit
						1141d1eb57
					
				| 
						 | 
					@ -85,6 +85,7 @@ typedef struct {
 | 
				
			||||||
    VirtBoardInfo *daughterboard;
 | 
					    VirtBoardInfo *daughterboard;
 | 
				
			||||||
    bool disallow_affinity_adjustment;
 | 
					    bool disallow_affinity_adjustment;
 | 
				
			||||||
    bool no_its;
 | 
					    bool no_its;
 | 
				
			||||||
 | 
					    bool no_pmu;
 | 
				
			||||||
} VirtMachineClass;
 | 
					} VirtMachineClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
| 
						 | 
					@ -1353,6 +1354,10 @@ static void machvirt_init(MachineState *machine)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
 | 
				
			||||||
 | 
					            object_property_set_bool(cpuobj, false, "pmu", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (object_property_find(cpuobj, "reset-cbar", NULL)) {
 | 
					        if (object_property_find(cpuobj, "reset-cbar", NULL)) {
 | 
				
			||||||
            object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
 | 
					            object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
 | 
				
			||||||
                                    "reset-cbar", &error_abort);
 | 
					                                    "reset-cbar", &error_abort);
 | 
				
			||||||
| 
						 | 
					@ -1592,5 +1597,7 @@ static void virt_machine_2_6_options(MachineClass *mc)
 | 
				
			||||||
    virt_machine_2_7_options(mc);
 | 
					    virt_machine_2_7_options(mc);
 | 
				
			||||||
    SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6);
 | 
					    SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6);
 | 
				
			||||||
    vmc->disallow_affinity_adjustment = true;
 | 
					    vmc->disallow_affinity_adjustment = true;
 | 
				
			||||||
 | 
					    /* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */
 | 
				
			||||||
 | 
					    vmc->no_pmu = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
DEFINE_VIRT_MACHINE(2, 6)
 | 
					DEFINE_VIRT_MACHINE(2, 6)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue