mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ACPI: sysfs: Make ACPI GPE mask kernel parameter cover all GPEs
The acpi_mask_gpe= kernel parameter documentation states that the range
of mask is 128 GPEs (0x00 to 0x7F).  The acpi_masked_gpes mask is a u64 so
only 64 GPEs (0x00 to 0x3F) can really be masked.
Use a bitmap of size 0xFF instead of a u64 for the GPE mask so 256
GPEs can be masked.
Fixes: 9c4aa1eecb (ACPI / sysfs: Provide quirk mechanism to prevent GPE flooding)
Signed-off-by: Prarit Bharava <prarit@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									50c4c4e268
								
							
						
					
					
						commit
						0f27cff859
					
				
					 2 changed files with 8 additions and 19 deletions
				
			
		| 
						 | 
					@ -114,7 +114,6 @@
 | 
				
			||||||
			This facility can be used to prevent such uncontrolled
 | 
								This facility can be used to prevent such uncontrolled
 | 
				
			||||||
			GPE floodings.
 | 
								GPE floodings.
 | 
				
			||||||
			Format: <int>
 | 
								Format: <int>
 | 
				
			||||||
			Support masking of GPEs numbered from 0x00 to 0x7f.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	acpi_no_auto_serialize	[HW,ACPI]
 | 
						acpi_no_auto_serialize	[HW,ACPI]
 | 
				
			||||||
			Disable auto-serialization of AML methods
 | 
								Disable auto-serialization of AML methods
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -816,14 +816,8 @@ static ssize_t counter_set(struct kobject *kobj,
 | 
				
			||||||
 * interface:
 | 
					 * interface:
 | 
				
			||||||
 *   echo unmask > /sys/firmware/acpi/interrupts/gpe00
 | 
					 *   echo unmask > /sys/firmware/acpi/interrupts/gpe00
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					#define ACPI_MASKABLE_GPE_MAX	0xFF
 | 
				
			||||||
/*
 | 
					static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata;
 | 
				
			||||||
 * Currently, the GPE flooding prevention only supports to mask the GPEs
 | 
					 | 
				
			||||||
 * numbered from 00 to 7f.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define ACPI_MASKABLE_GPE_MAX	0x80
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static u64 __initdata acpi_masked_gpes;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init acpi_gpe_set_masked_gpes(char *val)
 | 
					static int __init acpi_gpe_set_masked_gpes(char *val)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -831,7 +825,7 @@ static int __init acpi_gpe_set_masked_gpes(char *val)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX)
 | 
						if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	acpi_masked_gpes |= ((u64)1<<gpe);
 | 
						set_bit(gpe, acpi_masked_gpes_map);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -843,10 +837,7 @@ void __init acpi_gpe_apply_masked_gpes(void)
 | 
				
			||||||
	acpi_status status;
 | 
						acpi_status status;
 | 
				
			||||||
	u8 gpe;
 | 
						u8 gpe;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (gpe = 0;
 | 
						for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
 | 
				
			||||||
	     gpe < min_t(u8, ACPI_MASKABLE_GPE_MAX, acpi_current_gpe_count);
 | 
					 | 
				
			||||||
	     gpe++) {
 | 
					 | 
				
			||||||
		if (acpi_masked_gpes & ((u64)1<<gpe)) {
 | 
					 | 
				
			||||||
		status = acpi_get_gpe_device(gpe, &handle);
 | 
							status = acpi_get_gpe_device(gpe, &handle);
 | 
				
			||||||
		if (ACPI_SUCCESS(status)) {
 | 
							if (ACPI_SUCCESS(status)) {
 | 
				
			||||||
			pr_info("Masking GPE 0x%x.\n", gpe);
 | 
								pr_info("Masking GPE 0x%x.\n", gpe);
 | 
				
			||||||
| 
						 | 
					@ -854,7 +845,6 @@ void __init acpi_gpe_apply_masked_gpes(void)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void acpi_irq_stats_init(void)
 | 
					void acpi_irq_stats_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue