Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2083762ybb; Fri, 29 Mar 2019 18:37:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPpKvc6pkYovOWFiE999SmVDgbufA6bOYFNLJlk5XKxnVD5fNA7LcimQIvdg4Qi3z7hgZd X-Received: by 2002:a63:5452:: with SMTP id e18mr49393797pgm.386.1553909879264; Fri, 29 Mar 2019 18:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553909879; cv=none; d=google.com; s=arc-20160816; b=kyvJOGmhB+z5Fog3JI/PytMAmAXpX2p/cyOQs/4lIgfwWrowUakXrWcKnTQydtktEL U1IxIyYjGmuE+Rz/FUh+YW12Nu/XCuzfe/HvZOR/s8uP/8RFs3NPZv6He/zYe6pIgBPA NSbly6qCwezkKV2qebklM8GYFBgN58xYFjm2kupoHsYm8E1l3a/kMslf+arBYFN30VoF FU9yuxcw9xF2Vsts/O2xlgC5kZY4arqTrBagtKxhJO4UtvD4lwT7zfpY1dyl2pNlDTFe aX2rsZ5GK9P2wzclEtclkmrPhiu5jlEuv+Fjn1EdXpNqtRZYM0pXwom73ZsbcFsMTwll YE4A== 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=WVKGW8nSQtmuwIuK4gQmukk3ECDGva5hIB2V8N83aEA=; b=GErhf3qBUxYg0YtCbHmHcuzZs5+6sjKhIwIjgjhdeHwms3jBIPvaBksE+GH8RXIDDn 5/sdPKXFtWhzr7+rOJjuORl/ok/M5b979pBYSNMvR7dUA+l/5Bk02m8TWv8UBS1qbZPJ 73SbzoWhYEjfkwBqUdewwQ4LpqrHBn0xiNKoF191Y7S+H4ZIylxIyd6GH2Kr7A4lilbp RB21E3t6uKbNkpzB0HumPgZqJn5KTP/NEFPENAO/GnhhbHjfPOiikLrpsDTvzuFBYWw7 tNy+3NLqEHj2pD9g4i4pupne9tZEfWPSiiYE+j1Ip+tbZPybPoUnvUJChpNl1Qx9dyX3 4NFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0zzlRneX; 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 e71si3224937pgc.593.2019.03.29.18.37.44; Fri, 29 Mar 2019 18:37:59 -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=0zzlRneX; 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 S1731788AbfC3Ba5 (ORCPT + 99 others); Fri, 29 Mar 2019 21:30:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:38156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731766AbfC3Bay (ORCPT ); Fri, 29 Mar 2019 21:30:54 -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 69BD2218D3; Sat, 30 Mar 2019 01:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553909453; bh=WCfCXrQQ2e9scIAqUXj4AtNrE87eEeJaP0MtVF3EAEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0zzlRneXzDFWiLJj2h/CqsvRTByg0/jxuBfMh8vW/6LBpZRQ5zAa+Gh6VnSlPj9PK 6WjESb/bM+DW3dcFulDM2lTLvwztLxw6OZWz9obfOtqt0pWNXWgY9knYsS1pcFlHzG 4kRWGjLgcliSLhNnz3ZROH3KQDtVx7bEGtiN/AuI= 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.14 13/37] ACPI / SBS: Fix GPE storm on recent MacBookPro's Date: Fri, 29 Mar 2019 21:29:56 -0400 Message-Id: <20190330013020.379-13-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190330013020.379-1-sashal@kernel.org> References: <20190330013020.379-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 a2428e9462dd..3c092f07d7e3 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