mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	Fix ACPI processor power block initialization
Properly clear the memory, and set "pr->flags.power" only if a C2 or deeper state is valid (to make the code match both the comment and previous behaviour). This fixes a boot-time lockup reported by Maneesh Soni when using "maxcpus=1". Acked-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
		
							parent
							
								
									2656c076e3
								
							
						
					
					
						commit
						2203d6ed44
					
				
					 1 changed files with 4 additions and 10 deletions
				
			
		| 
						 | 
					@ -514,8 +514,6 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 | 
					static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt");
 | 
						ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!pr)
 | 
						if (!pr)
 | 
				
			||||||
| 
						 | 
					@ -524,8 +522,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 | 
				
			||||||
	if (!pr->pblk)
 | 
						if (!pr->pblk)
 | 
				
			||||||
		return_VALUE(-ENODEV);
 | 
							return_VALUE(-ENODEV);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
 | 
						memset(pr->power.states, 0, sizeof(pr->power.states));
 | 
				
			||||||
		memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* if info is obtained from pblk/fadt, type equals state */
 | 
						/* if info is obtained from pblk/fadt, type equals state */
 | 
				
			||||||
	pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
 | 
						pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
 | 
				
			||||||
| 
						 | 
					@ -555,13 +552,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
 | 
					static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
 | 
						ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
 | 
						memset(pr->power.states, 0, sizeof(pr->power.states));
 | 
				
			||||||
		memset(&(pr->power.states[i]), 0,
 | 
					 | 
				
			||||||
		       sizeof(struct acpi_processor_cx));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* if info is obtained from pblk/fadt, type equals state */
 | 
						/* if info is obtained from pblk/fadt, type equals state */
 | 
				
			||||||
	pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
 | 
						pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
 | 
				
			||||||
| 
						 | 
					@ -873,6 +866,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
 | 
				
			||||||
	for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
 | 
						for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
 | 
				
			||||||
		if (pr->power.states[i].valid) {
 | 
							if (pr->power.states[i].valid) {
 | 
				
			||||||
			pr->power.count = i;
 | 
								pr->power.count = i;
 | 
				
			||||||
 | 
								if (pr->power.states[i].type >= ACPI_STATE_C2)
 | 
				
			||||||
				pr->flags.power = 1;
 | 
									pr->flags.power = 1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue