Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2819085ybc; Wed, 13 Nov 2019 22:46:37 -0800 (PST) X-Google-Smtp-Source: APXvYqz2/dLR9WXbftlLs2Z/FRncqAwTARmymgcZExCF5017Y94fdnbYjwGJQb4iYufDQbkyWtAr X-Received: by 2002:a17:906:f756:: with SMTP id jp22mr6698898ejb.234.1573713997560; Wed, 13 Nov 2019 22:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573713997; cv=none; d=google.com; s=arc-20160816; b=yeqh6YYqy6UTBEuy/EzoNqEiZo6zAo1+5yyucG9KDYzznLdQ8Fp6zGeF50oYszS8+0 HTiqIHjAZcPkHq148LEFLoGFncMmN9OKX51Byg2OLkXLq3fnj3QYyA5pfIn/eOwKtk9D lGfksBwMUHRrxsTG+fwUEZVmENwdzKzrpHhymMK+aBkSBbSzSyTQ6gdUnMy3JDajrVjS D2WGiHQfed57NONutG7jLPu0A/H12Apf2x/AO7nvfVPVj6c4l/K1pVYuBYWKsNLGd0B+ SmAVoYNK5/A4t5sFKveXPnCcW9Wc3FyITU0RnLwwP7LamtWTy0y/BX99yCzIenofVMnv fGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Y2cx9R640hbpF9UOy01OiXYU3FEYb/hb3QIGtEjnnF8=; b=QeeAnShM146T0BC/Q6zLkvDEIrediT8Srna+xDtC39ZXCatAWmMAxvTLxDOIsoNfBu tYmDovqCFm8VbgAh5XHOqfiD+RYIZvfFxCjN27FJxqdGLbdd4K5//9/o5PRplzJuULb6 0NxiAAtHYOHxOgMjVcKRTKiSdzemG6kZNgcuKLCK6pU6ALLmsuz1JeqwH3FiVoapeKue mtQEP11ysO/e0U49GDNKtQ++Ba+jiHeGp3tbz/em2K3iceSmlo3laqdFytLfvFowheET tN8hzg4TS0pusLmEZoUqnZU4o9645YxrZZ4OSHpUdJoYIIScxJT7kkg3oDc4ftU1gK98 g/sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ga20si2637429ejb.14.2019.11.13.22.46.12; Wed, 13 Nov 2019 22:46:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbfKNGp3 (ORCPT + 99 others); Thu, 14 Nov 2019 01:45:29 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:43136 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725807AbfKNGp3 (ORCPT ); Thu, 14 Nov 2019 01:45:29 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8463BDDCDDA6BFBF7016; Thu, 14 Nov 2019 14:45:26 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Thu, 14 Nov 2019 14:45:16 +0800 Subject: Re: [PATCH] ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100 To: "Rafael J. Wysocki" CC: , , , , "hushiyuan@huawei.com" , "linfeilong@huawei.com" References: <8bdc7a86-e464-9c46-3d40-4f3c75111ce6@huawei.com> <2931286.GRae9fBGx2@kreacher> From: Yunfeng Ye Message-ID: <2af56bf7-aff8-b4f5-b4cf-06743e906695@huawei.com> Date: Thu, 14 Nov 2019 14:45:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <2931286.GRae9fBGx2@kreacher> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/11/14 7:21, Rafael J. Wysocki wrote: > On Tuesday, November 5, 2019 3:35:25 PM CET Yunfeng Ye wrote: >> There are two problems after commit 0f27cff8597d ("ACPI: sysfs: Make >> ACPI GPE mask kernel parameter cover all GPEs"): >> >> 1. ACPI_MASKABLE_GPE_MAX is changed from 0x80 to 0xff, so the check >> condition "gpe > ACPI_MASKABLE_GPE_MAX" is not valid because the type of >> gpe is u8. >> >> 2. The size of bitmap is ACPI_MASKABLE_GPE_MAX, so it is not support the >> num 255 for gpe. >> >> Update the macro ACPI_MASKABLE_GPE_MAX to 0x100, and change the type of >> gpe to u32, also modify the checking condition for gpe. >> >> Bye the way, update the docs for kernel parameter acpi_mask_gpe. >> >> Fixes: 0f27cff8597d ("ACPI: sysfs: Make ACPI GPE mask kernel parameter cover all GPEs") >> Signed-off-by: Yunfeng Ye > > AFAICS this really is about supporting the masking of GPE 0xFF. >>> --- >> Documentation/admin-guide/kernel-parameters.txt | 1 + >> drivers/acpi/sysfs.c | 8 ++++---- >> 2 files changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt >> index a84a83f8881e..dd878e2491e1 100644 >> --- a/Documentation/admin-guide/kernel-parameters.txt >> +++ b/Documentation/admin-guide/kernel-parameters.txt >> @@ -114,6 +114,7 @@ >> This facility can be used to prevent such uncontrolled >> GPE floodings. >> Format: >> + Support masking of GPEs numbered from 0x00 to 0xff > > Why not just say "Format: " ? > ok, thanks. >> >> acpi_no_auto_serialize [HW,ACPI] >> Disable auto-serialization of AML methods >> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c >> index 75948a3f1a20..3c3302583d78 100644 >> --- a/drivers/acpi/sysfs.c >> +++ b/drivers/acpi/sysfs.c >> @@ -819,14 +819,14 @@ static ssize_t counter_set(struct kobject *kobj, >> * interface: >> * echo unmask > /sys/firmware/acpi/interrupts/gpe00 >> */ >> -#define ACPI_MASKABLE_GPE_MAX 0xFF >> +#define ACPI_MASKABLE_GPE_MAX 0x100 > > So this is the only change that's necessary AFAICS. > >> static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata; >> >> static int __init acpi_gpe_set_masked_gpes(char *val) >> { >> - u8 gpe; >> + u32 gpe; >> >> - if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX) > > And here you can drop the ACPI_MASKABLE_GPE_MAX check and the rest can remain > as is. > I will modify as your suggestion, thanks. >> + if (kstrtouint(val, 0, &gpe) || gpe >= ACPI_MASKABLE_GPE_MAX) >> return -EINVAL; >> set_bit(gpe, acpi_masked_gpes_map); >> >> @@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(void) >> { >> acpi_handle handle; >> acpi_status status; >> - u8 gpe; >> + u32 gpe; >> >> for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) { >> status = acpi_get_gpe_device(gpe, &handle); >> > > > > > > . >