Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2085963ybb; Fri, 29 Mar 2019 18:42:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDGj3AosIBnsLKJ7DY4XRXjag6IqCWIac2Jr0t8eCq40P8KMUo5VUB8RnGOkFY0CH/Rq4b X-Received: by 2002:a62:458a:: with SMTP id n10mr51452506pfi.136.1553910141322; Fri, 29 Mar 2019 18:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553910141; cv=none; d=google.com; s=arc-20160816; b=k7JkT4o9N+kMZB7ZEs7+Db3WsW6AlfzBGZ9xFV0550aKOra0RafnVt3ejk0PeLik2n e6c5WOAC/t7ge8663hjupSXJvXnyUa78TwDHjVdWQFpT4ttRRIHtojYxOfyxaxFQlw0x hKgV7LgLDv38o+2cB4C489XU+IkPeZlwUHAKqtdNRofTAUgfpAE8ecYD0Ee05z5VqJj0 Lp6Pj02elB2mXHP0nJtpjHV/zxwfQrtr02cPfnkPt2x6+a8uUIl6KJFcBPeC7e01saYu V/WTqg1z+SlUjb38yqrx6r9MSO42ue//s/p2kn56XT9SzHQLeUrF+pCWxfTR4vQGZySJ 0atQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FeAe8WPCi3Q+kCNPk45rpZg6YgxbUvBtvilVSVshl3Q=; b=zhVtPfITr01YXHCJBreG2iN8w92IXkti9MZxhMTjL9ngCgTdiE05NP3yt6s3rfGquZ Er8CRilwQ56/FjPHmDXFS6QH93wMSc3Q71OFjcT/SP4Wh/KxWVcIbgYaU0yH//1R4YPL 83oMhvWzskJf11+emBIwn2khTDFQWQ1BGBnM9gs1g62k5SF6lxLL66l36UCOn1C+tInR faVhaz45EKzTnJWb0cdRJylKDk6Rpc0/fxzRZffbfx+VykcOwb7hdkSJ2hImCKYW8WWc lTe8Jz/ULb7moY+TbfWhUhTBXvJbHkvIy3cVRRYG0PVW0JAGUhjecm8kvwUPrpo5xEfL 7Cew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=agvvKtcA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si3100684pfj.16.2019.03.29.18.42.06; Fri, 29 Mar 2019 18:42:21 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=agvvKtcA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731567AbfC3BkX (ORCPT + 99 others); Fri, 29 Mar 2019 21:40:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:36438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731024AbfC3B3e (ORCPT ); Fri, 29 Mar 2019 21:29:34 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 839D8218D3; Sat, 30 Mar 2019 01:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909373; bh=tsc0gpfCJ/ZaYKyu/6n6/Nf/Av+NTjAwJFS529r3d44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=agvvKtcAL5hsp7G2LtgocDk61vdds7bXxRH8RvE8dcA6qQqpUjSSpMPeRJDEAxDKN //FXD6ulWQqOHQtvYtRSwKlMG8rrXZkrqpSkvOlbiB4lB+7gpaHBOPMxEcecZ6ujgj BAHN/7n0MBUUAc4XKU1crcKHU5YuPt+3pJAvhTK0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Ronald=20Tschal=C3=A4r?= , "Rafael J . Wysocki" , Sasha Levin , linux-acpi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 18/57] ACPI / SBS: Fix GPE storm on recent MacBookPro's Date: Fri, 29 Mar 2019 21:28:11 -0400 Message-Id: <20190330012854.32212-18-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330012854.32212-1-sashal@kernel.org> References: <20190330012854.32212-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronald Tschalär [ Upstream commit ca1721c5bee77105829cbd7baab8ee0eab85b06d ] On Apple machines, plugging-in or unplugging the power triggers a GPE for the EC. Since these machines expose an SBS device, this GPE ends up triggering the acpi_sbs_callback(). This in turn tries to get the status of the SBS charger. However, on MBP13,* and MBP14,* machines, performing the smbus-read operation to get the charger's status triggers the EC's GPE again. The result is an endless re-triggering and handling of that GPE, consuming significant CPU resources (> 50% in irq). In the end this is quite similar to commit 3031cddea633 (ACPI / SBS: Don't assume the existence of an SBS charger), except that on the above machines a status of all 1's is returned. And like there, we just want ignore the charger here. Link: https://bugzilla.kernel.org/show_bug.cgi?id=198169 Signed-off-by: Ronald Tschalär Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/sbs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 295b59271189..96c5e27967f4 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -441,9 +441,13 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) /* * The spec requires that bit 4 always be 1. If it's not set, assume - * that the implementation doesn't support an SBS charger + * that the implementation doesn't support an SBS charger. + * + * And on some MacBooks a status of 0xffff is always returned, no + * matter whether the charger is plugged in or not, which is also + * wrong, so ignore the SBS charger for those too. */ - if (!((status >> 4) & 0x1)) + if (!((status >> 4) & 0x1) || status == 0xffff) return -ENODEV; sbs->charger_present = (status >> 15) & 0x1; -- 2.19.1