From a4764614a7ae93c736c424c6daa13014ba3abf94 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 17 Nov 2018 18:06:28 +0000 Subject: [PATCH] Fix WiFi on Raspberry Pi 3 on aarch64 (rhbz 1649344), Fixes for Raspberry Pi hwmon driver and firmware interface --- ...ve-firmware-loading-code-duplication.patch | 603 +++--------------- hwmon-rpi-Fix-initial-notify.patch | 112 ++++ kernel.spec | 10 + ...ix-firmware-calls-with-large-buffers.patch | 245 +++++++ 4 files changed, 462 insertions(+), 508 deletions(-) create mode 100644 hwmon-rpi-Fix-initial-notify.patch create mode 100644 raspberrypi-Fix-firmware-calls-with-large-buffers.patch diff --git a/brcmfmac-Remove-firmware-loading-code-duplication.patch b/brcmfmac-Remove-firmware-loading-code-duplication.patch index 724ad1699..eb7903eee 100644 --- a/brcmfmac-Remove-firmware-loading-code-duplication.patch +++ b/brcmfmac-Remove-firmware-loading-code-duplication.patch @@ -1,71 +1,7 @@ -From patchwork Wed Oct 10 11:00:58 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634355 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 176D8679F - for ; - Wed, 10 Oct 2018 11:01:11 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 130EB29A62 - for ; - Wed, 10 Oct 2018 11:01:10 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 05F4129AD0; Wed, 10 Oct 2018 11:01:10 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6244B29A5D - for ; - Wed, 10 Oct 2018 11:01:09 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726568AbeJJSWo (ORCPT - ); - Wed, 10 Oct 2018 14:22:44 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:41994 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726022AbeJJSWo (ORCPT ); - Wed, 10 Oct 2018 14:22:44 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id 66FEBA4D29; - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 8A0D658772; - Wed, 10 Oct 2018 11:01:05 +0000 (UTC) +From 76202e874f06ab641fbe1caaddd4cfcf7158f174 Mon Sep 17 00:00:00 2001 From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 1/6] brcmfmac: Remove firmware-loading code duplication Date: Wed, 10 Oct 2018 13:00:58 +0200 -Message-Id: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 1/5] brcmfmac: Remove firmware-loading code duplication brcmf_fw_request_next_item and brcmf_fw_request_done both have identical code to complete the fw-request depending on the item-type. @@ -165,78 +101,14 @@ index 9095b830ae4d..784c84f0e9e7 100644 goto fail; do { +-- +2.19.1 -From patchwork Wed Oct 10 11:00:59 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634357 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA07F933 - for ; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9109229A3C - for ; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 851B229A62; Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D41829A3C - for ; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726617AbeJJSWt (ORCPT - ); - Wed, 10 Oct 2018 14:22:49 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:46618 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726022AbeJJSWt (ORCPT ); - Wed, 10 Oct 2018 14:22:49 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id B5295307D912; - Wed, 10 Oct 2018 11:01:12 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id A3EDA44FBF; - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) +From a3c4b522bff976360fb21c9205fcb37a121d4074 Mon Sep 17 00:00:00 2001 From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 2/6] brcmfmac: Remove recursion from firmware load error - handling Date: Wed, 10 Oct 2018 13:00:59 +0200 -Message-Id: <20181010110103.21857-2-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); - Wed, 10 Oct 2018 11:01:13 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 2/5] brcmfmac: Remove recursion from firmware load error + handling Before this commit brcmf_fw_request_done would call brcmf_fw_request_next_item to load the next item, which on an error would @@ -360,78 +232,14 @@ index 784c84f0e9e7..08aaf99fee34 100644 return 0; } +-- +2.19.1 -From patchwork Wed Oct 10 11:01:00 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634359 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25C2D69B4 - for ; - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A0EE29A3C - for ; - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 0E72C29A62; Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6B3D29A3C - for ; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726647AbeJJSWw (ORCPT - ); - Wed, 10 Oct 2018 14:22:52 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:35014 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSWw (ORCPT ); - Wed, 10 Oct 2018 14:22:52 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id C2E0030820D3; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 0495169608; - Wed, 10 Oct 2018 11:01:12 +0000 (UTC) +From c2c41d3f837ed492369607940af950ef554b8685 Mon Sep 17 00:00:00 2001 From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 3/6] brcmfmac: Add support for first trying to get a board - specific nvram file Date: Wed, 10 Oct 2018 13:01:00 +0200 -Message-Id: <20181010110103.21857-3-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); - Wed, 10 Oct 2018 11:01:15 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 3/5] brcmfmac: Add support for first trying to get a board + specific nvram file The nvram files which some brcmfmac chips need are board-specific. To be able to distribute these as part of linux-firmware, so that devices with @@ -507,78 +315,14 @@ index 2893e56910f0..a0834be8864e 100644 struct brcmf_fw_item items[0]; }; +-- +2.19.1 -From patchwork Wed Oct 10 11:01:01 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634361 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE2A514DB - for ; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E298329A3C - for ; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id D5CD929A62; Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E6F329A3C - for ; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726689AbeJJSWy (ORCPT - ); - Wed, 10 Oct 2018 14:22:54 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:32633 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSWy (ORCPT ); - Wed, 10 Oct 2018 14:22:54 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id D2E7630DF6F1; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 0DBC544FBF; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 4/6] brcmfmac: Set board_type used for nvram file selection - to machine-compatible -Date: Wed, 10 Oct 2018 13:01:01 +0200 -Message-Id: <20181010110103.21857-4-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +From 282477a8e4034ee2ea906d2eb234ce9c86f5685f Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sat, 17 Nov 2018 15:18:35 +0000 +Subject: [PATCH 4/5] brcmfmac: Set board_type used for nvram file selection to + machine-compatible For of/devicetree using machines, set the board_type used for nvram file selection to the first string listed in the top-level's node compatible @@ -589,169 +333,16 @@ a board-specific name so that we can ship files for each supported board in linux-firmware. Signed-off-by: Hans de Goede ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/common.h | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 11 ++++++++++- - .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + - .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + - 4 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -index a34642cb4d2f..e63a273642e9 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -59,6 +59,7 @@ struct brcmf_mp_device { - bool iapp; - bool ignore_probe_fail; - struct brcmfmac_pd_cc *country_codes; -+ const char *board_type; - union { - struct brcmfmac_sdio_pd sdio; - } bus; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -index aee6e5937c41..84e3373289eb 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, - struct brcmf_mp_device *settings) - { - struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; -- struct device_node *np = dev->of_node; -+ struct device_node *root, *np = dev->of_node; -+ struct property *prop; - int irq; - u32 irqf; - u32 val; - -+ /* Set board-type to the first string of the machine compatible prop */ -+ root = of_find_node_by_path("/"); -+ if (root) { -+ prop = of_find_property(root, "compatible", NULL); -+ settings->board_type = of_prop_next_string(prop, NULL); -+ of_node_put(root); -+ } -+ - if (!np || bus_type != BRCMF_BUSTYPE_SDIO || - !of_device_is_compatible(np, "brcm,bcm4329-fmac")) - return; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -index 4fffa6988087..b12f3e0ee69c 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) - fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; - fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -+ fwreq->board_type = devinfo->settings->board_type; - /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ - fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; - fwreq->bus_nr = devinfo->pdev->bus->number; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -index a907d7b065fa..3dbbbb117563 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4177,6 +4177,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) - - fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ fwreq->board_type = bus->sdiodev->settings->board_type; - - return fwreq; - } - -From patchwork Wed Oct 10 11:01:02 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634363 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CCB3679F - for ; - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CFFD29A3C - for ; - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 0058529A62; Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CC2D29A3C - for ; - Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726712AbeJJSW4 (ORCPT - ); - Wed, 10 Oct 2018 14:22:56 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:25991 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSW4 (ORCPT ); - Wed, 10 Oct 2018 14:22:56 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id DCA9130821FF; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 1EAEF2E03B; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 5/6] brcmfmac: Set board_type from DMI on x86 based - machines -Date: Wed, 10 Oct 2018 13:01:02 +0200 -Message-Id: <20181010110103.21857-5-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); - Wed, 10 Oct 2018 11:01:19 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP - -For x86 based machines, set the board_type used for nvram file selection -based on the DMI sys-vendor and product-name strings. - -Since on some models these strings are too generic, this commit also adds -a quirk table overriding the strings for models listed in that table. - -The board_type setting is used to load the board-specific nvram file with -a board-specific name so that we can ship files for each supported board -in linux-firmware. - -Signed-off-by: Hans de Goede ---- -Changes in v2: --Use full ISC text for now instead of SPDX tag, because the ISC is not - yet listed under LICENSES +Signed-off-by: Peter Robinson --- .../broadcom/brcm80211/brcmfmac/Makefile | 2 + .../broadcom/brcm80211/brcmfmac/common.c | 3 +- - .../broadcom/brcm80211/brcmfmac/common.h | 7 ++ + .../broadcom/brcm80211/brcmfmac/common.h | 8 ++ .../broadcom/brcm80211/brcmfmac/dmi.c | 116 ++++++++++++++++++ - 4 files changed, 127 insertions(+), 1 deletion(-) + .../wireless/broadcom/brcm80211/brcmfmac/of.c | 11 +- + .../broadcom/brcm80211/brcmfmac/pcie.c | 1 + + .../broadcom/brcm80211/brcmfmac/sdio.c | 1 + + 7 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile @@ -765,25 +356,32 @@ index 1f5a9b948abf..22fd95a736a8 100644 +brcmfmac-$(CONFIG_DMI) += \ + dmi.o diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -index cd3651069d0c..a4bcbd1a57ac 100644 +index cd3651069d0c..b93b1e797333 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -450,8 +450,9 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, +@@ -450,7 +450,8 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, } } if (!found) { - /* No platform data for this device, try OF (Open Firwmare) */ + /* No platform data for this device, try OF and DMI data */ - brcmf_of_probe(dev, bus_type, settings); + brcmf_dmi_probe(settings, chip, chiprev); + brcmf_of_probe(dev, bus_type, settings); } return settings; - } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -index e63a273642e9..4ce56be90b74 100644 +index a34642cb4d2f..4ce56be90b74 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -75,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param); +@@ -59,6 +59,7 @@ struct brcmf_mp_device { + bool iapp; + bool ignore_probe_fail; + struct brcmfmac_pd_cc *country_codes; ++ const char *board_type; + union { + struct brcmfmac_sdio_pd sdio; + } bus; +@@ -74,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param); /* Sets dongle media info (drv_version, mac address). */ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); @@ -917,77 +515,63 @@ index 000000000000..51d76ac45075 + settings->board_type = dmi_board_type; + } +} +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +index aee6e5937c41..84e3373289eb 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, + struct brcmf_mp_device *settings) + { + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; +- struct device_node *np = dev->of_node; ++ struct device_node *root, *np = dev->of_node; ++ struct property *prop; + int irq; + u32 irqf; + u32 val; + ++ /* Set board-type to the first string of the machine compatible prop */ ++ root = of_find_node_by_path("/"); ++ if (root) { ++ prop = of_find_property(root, "compatible", NULL); ++ settings->board_type = of_prop_next_string(prop, NULL); ++ of_node_put(root); ++ } ++ + if (!np || bus_type != BRCMF_BUSTYPE_SDIO || + !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + return; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index 4fffa6988087..b12f3e0ee69c 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) + fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; + fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; ++ fwreq->board_type = devinfo->settings->board_type; + /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ + fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; + fwreq->bus_nr = devinfo->pdev->bus->number; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index a907d7b065fa..3dbbbb117563 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4177,6 +4177,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) + + fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->board_type = bus->sdiodev->settings->board_type; + + return fwreq; + } +-- +2.19.1 -From patchwork Wed Oct 10 11:01:03 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede -X-Patchwork-Id: 10634365 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9513614DB - for ; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 873E929A3C - for ; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 7B56829A62; Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312D329A3C - for ; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726721AbeJJSW6 (ORCPT - ); - Wed, 10 Oct 2018 14:22:58 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:50166 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSW6 (ORCPT ); - Wed, 10 Oct 2018 14:22:58 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id E53875F793; - Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 274442E199; - Wed, 10 Oct 2018 11:01:19 +0000 (UTC) +From 6351ca678eb1391129cf5afccab518f376d57596 Mon Sep 17 00:00:00 2001 From: Hans de Goede -To: Arend van Spriel , - Franky Lin , - Hante Meuleman , - Kalle Valo , - Chi-Hsien Lin , - Wright Feng -Cc: Hans de Goede , - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 6/6] brcmfmac: Cleanup brcmf_fw_request_done() Date: Wed, 10 Oct 2018 13:01:03 +0200 -Message-Id: <20181010110103.21857-6-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 5/5] brcmfmac: Cleanup brcmf_fw_request_done() The "cur" variable is now only used for a debug print and we already print the same info from brcmf_fw_complete_request(), so the debug print @@ -1026,3 +610,6 @@ index 6755b2388fbc..b38c4b40b235 100644 brcmf_fw_free_request(fwctx->req); fwctx->req = NULL; } +-- +2.19.1 + diff --git a/hwmon-rpi-Fix-initial-notify.patch b/hwmon-rpi-Fix-initial-notify.patch new file mode 100644 index 000000000..eb6ad7c78 --- /dev/null +++ b/hwmon-rpi-Fix-initial-notify.patch @@ -0,0 +1,112 @@ +From patchwork Sun Nov 11 12:01:11 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Stefan Wahren +X-Patchwork-Id: 10677591 +Return-Path: +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1554014DB + for ; + Sun, 11 Nov 2018 12:02:21 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF81F2AAE1 + for ; + Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id DD04A2AAF4; Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, + RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 +Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F86D2AAE1 + for ; + Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1727510AbeKKVum (ORCPT + ); + Sun, 11 Nov 2018 16:50:42 -0500 +Received: from mout.kundenserver.de ([212.227.17.13]:56911 "EHLO + mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S1727492AbeKKVum (ORCPT + ); + Sun, 11 Nov 2018 16:50:42 -0500 +Received: from localhost.localdomain ([37.4.249.153]) by + mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) + id 1N5W0q-1fPBCS2EFm-016xot; Sun, 11 Nov 2018 13:01:38 +0100 +From: Stefan Wahren +To: Eric Anholt , + Florian Fainelli , + Jean Delvare , + Guenter Roeck , + Greg Kroah-Hartman +Cc: linux-rpi-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, + linux-kernel@vger.kernel.org, + Stefan Wahren +Subject: [PATCH] hwmon: rpi: Fix initial notify +Date: Sun, 11 Nov 2018 13:01:11 +0100 +Message-Id: <1541937671-26385-1-git-send-email-stefan.wahren@i2se.com> +X-Mailer: git-send-email 2.7.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +X-Provags-ID: V03:K1:HEVIdEl0kizgBdNf0M5wstvyz7s6HdToU1mddQPsbGgHjkiBWSZ + SKazwNvgO6cbViYoUW17vGwM+wtH3UvfMleX6l3XXOJUwGoJIZP7C9iMFyqzOhl1AlaWRQ+ + nGjpMnsO6ZoiSjYhxMPB911ALciozsvmmLqnauqOofp2A/Y1/Tcfzfrv2IhQJICMhDSNaco + akAN1etmFdi29Cdupykhw== +X-UI-Out-Filterresults: notjunk:1;V01:K0:tzezqudV+18=:I+avf+CPQCA+RPEHvwv55R + iJN07WrrHGCkxDyTa1k+J8anYCg6oDlByPsB4O51GNXOi1XH2wPejZd6QJflDwV0IjWsd1mfU + xmQwbUh5YsPt6czgCadtNhv89tCiiHGxGyLiNjZpXICCRYxcY9szc+T27wAi6tAeQsahSk7Zc + P7+RqK/K3qtckuZiInGDWLzDvbMkItVWmxB/86m6NH4QbXCqJo/m0F6yZWCq1t/ocW/NmK9nH + 3sFSBLGNA+DGHqRLq1Tp+a+Xf1XuQlWwVYusgY3z9tNBdbTG9fQhBwac+oBJ+ZnF8S5WtdcSk + T31iv44dd2DkPTXqRuzSBWKnMQIZbabtWOYI9paJgywle7kdbJJlWx/kHONkEeKdjM7+MCUVn + 9iAWGJiu9tZ+i+FxYqUlLGOlZZW/sJiXzizD+WQYXdDiNh9lU2926j9Ydc+vF5fF1DzwaLsTf + 7cvqwTu8gBFVOffZhsHT5+loV6D5WvJjY3JUPmhraz4ioeagBG6+s34gN3LtPYnUYNJO/Cd3Z + CLnkDRAoKUNCeqhqsifSzcy49XV5h8YPrkSBWWBek7gAzU/DVI1mXLgcESMoe77NdlLeCqLUm + 0W+phul1X1/9/WPqPkr6j9E7MjgIbo7XcPtmy+treFmpnZWz5766NVHRJ+RPCN9RVFocCcILy + +n2ryGG9Llo5cGCbUU+eSWsigfVGTGmQzvatSRpt262UKg3EyZrqtedY+GLnKMMvAqra/GKvs + 0SObqg+2lnFLxgOSq/dM7hz7QuKk2JFmfuuXu0T+aMTpc9ZZx90sE6kMjBz8cF+hBFutqehUk + 10cHzngQFaS21pN/PQ2gpU1ZlGFfqQ3gEjQz8zF7KGhTS5FiYY= +Sender: linux-hwmon-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-hwmon@vger.kernel.org +X-Virus-Scanned: ClamAV using ClamSMTP + +In case an under-voltage happens before probing the driver wont +write the critical warning into the kernel log. So don't init +of last_throttled during probe and fix this issue. + +Fixes: 74d1e007915f ("hwmon: Add support for RPi voltage sensor") +Reported-by: "Noralf Trønnes" +Signed-off-by: Stefan Wahren +--- + drivers/hwmon/raspberrypi-hwmon.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c +index be5ba46..0d04572 100644 +--- a/drivers/hwmon/raspberrypi-hwmon.c ++++ b/drivers/hwmon/raspberrypi-hwmon.c +@@ -115,7 +115,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + struct rpi_hwmon_data *data; +- int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) +@@ -124,11 +123,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + /* Parent driver assure that firmware is correct */ + data->fw = dev_get_drvdata(dev->parent); + +- /* Init throttled */ +- ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED, +- &data->last_throttled, +- sizeof(data->last_throttled)); +- + data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt", + data, + &rpi_chip_info, diff --git a/kernel.spec b/kernel.spec index 3e4396663..7dea9cfb7 100644 --- a/kernel.spec +++ b/kernel.spec @@ -581,6 +581,12 @@ Patch330: bcm2835-cpufreq-add-CPU-frequency-control-driver.patch Patch331: bcm283x-drm-vc4-set-is_yuv-to-false-when-num_planes-1.patch +# https://patchwork.kernel.org/patch/10686407/ +Patch332: raspberrypi-Fix-firmware-calls-with-large-buffers.patch + +# https://patchwork.kernel.org/patch/10677591/ +Patch333: hwmon-rpi-Fix-initial-notify.patch + # Patches enabling device specific brcm firmware nvram # https://www.spinics.net/lists/linux-wireless/msg178827.html Patch340: brcmfmac-Remove-firmware-loading-code-duplication.patch @@ -1872,6 +1878,10 @@ fi # # %changelog +* Sat Nov 17 2018 Peter Robinson +- Fix WiFi on Raspberry Pi 3 on aarch64 (rhbz 1649344) +- Fixes for Raspberry Pi hwmon driver and firmware interface + * Fri Nov 16 2018 Hans de Goede - Enable a few modules needed for accelerometer and other sensor support on some HP X2 2-in-1s diff --git a/raspberrypi-Fix-firmware-calls-with-large-buffers.patch b/raspberrypi-Fix-firmware-calls-with-large-buffers.patch new file mode 100644 index 000000000..79421d616 --- /dev/null +++ b/raspberrypi-Fix-firmware-calls-with-large-buffers.patch @@ -0,0 +1,245 @@ +From patchwork Fri Nov 16 14:39:07 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: James Hughes +X-Patchwork-Id: 10686407 +Return-Path: + +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BA9C3CF1 + for ; + Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C992D04D + for ; + Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 7C6802D0B5; Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 02F272D0B9 + for ; + Fri, 16 Nov 2018 14:40:19 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: + Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: + Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: + References:List-Owner; bh=q+rr6CTCNe7Aj9DWt6k8ZBDJfuNlw6LK4NEqho/OsL8=; b=slV + BxeOcHW4UYDgm2VXfNMIZb+/8LPmzjGPpBpBe5IaMR/NthCsM9AL2A1aGdlPRKp8j/Oimcml9ytBG + vy3/u46ZlKFd5bAYEl5veGalWXzUg1KN7UhADmXD9fmMOzkFD4fMChA8+g2qK83F6SfqDM0VS3i14 + /ubAQ9CUdaFi4Vr7F4EZtPdbPmSm76Rm9H8sWxWe6seIEmsL6VMpLVzRLAA0zvX5nslXgUPvDLEZj + uk7BIzGfdWU1oB15xwTu8kyp24WrC2Xd/DNCrrIlvBJ6Vn4lvfdqwPT+Xg59IAaibUhoj/fq1HNet + QenokEPTxg7SS3FsAKl96cR5mWeudtg==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfI9-0007DF-JA; Fri, 16 Nov 2018 14:40:17 +0000 +Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfI4-00075P-2l + for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Nov 2018 14:40:12 +0000 +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: + Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: + Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: + Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: + List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; b=SCmdpUIYIRr3Gb8eXMDGHl/os + AVmLBMIQEbA1mUB4WPQJlUjz7NKtNXgtLQxSY+yiwIb+LrripAgbQ6yK1Vkn+4bmhtSkb97glmraT + bMOZKrRj/cPhxW5osOa0o2BJQRqWqignWxy8539dbxXbpAAKW+12jA+dOqrjOFUftFH7geD4Ttwis + y/j75BOi7ObkcK1mBDyJDNuSEt2CZutCNZ+A7v7/zqkxnhS3hS7Y9hUD81+J+cIu5x103POH6i7FC + 7JazaqnBZYtl66kXXPOs62v3HA96/QLz7CxmdsnNQvw28MNKsxLw5TKnXJUDJmDCybQ5FL6k6Xomg + T9PDZO9+g==; +Received: from mx08-00252a01.pphosted.com ([91.207.212.211]) + by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfHz-0006AE-RY + for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 14:40:09 +0000 +Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) + by mx08-00252a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id + wAGEcLBT000897 + for ; Fri, 16 Nov 2018 14:39:55 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; + h=from : to : cc : subject : date : message-id; s=pp; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=ynWh6Gt8VRIRTTbVy4Q9U7IsJWRMWYUNzTD1MYt8M2mcj01ElaCuktcZdGoRxGBJXjLU + CYJP75gWsuHHvbSWSSn2l+qpGuEHm+ddFXuMB4nxC5VmQokt/Z0KPScc4Na2IOOU1Ci/ + wUg2tPdhfupkGIPzTt32SXu3pQX4aAYqx0AEaeJ3ptU/223MOj2Z40HZui1SL0yHxdsT + 283+7DokK0bontWXs0j69cFVklLF+txi0untOXTxGuvtbzj0vu6uMErB9qhph6HVKlnH + kwaoGLPYrc0JnmZt1Kx7nmAQ+xxE3RaNA7E/IisHqX9m5C57JAMtN6WdWUTaLjWeIs8n 2Q== +Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com + [209.85.128.70]) + by mx08-00252a01.pphosted.com with ESMTP id 2nr7cnhbky-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) + for ; Fri, 16 Nov 2018 14:39:55 +0000 +Received: by mail-wm1-f70.google.com with SMTP id d26-v6so24770633wmb.4 + for ; + Fri, 16 Nov 2018 06:39:55 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=raspberrypi.org; s=google; + h=from:to:cc:subject:date:message-id; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=TFhWj6OD0WYvVWhFc0RE+UyQKaAMuO0Da2ahzvPlkfTJj3d26Mf15Ai4ipbfJy4x9d + RLlgEH8Vj457x2kK3QmlXDC5Cy+kzp6FiZi2aFSBinKjY06Dmt4LElzlaye8szk/IuJ/ + f6HdjG3Rmt6Ys/Kx8fct+p87NyvHNe/yfCGnUj5k1nz7+m2eApkvTkGxzYe5SXn5s1Jp + nv/30o4+CcPFK3SqAWo+GkWgD/Uae+4gCP38KxLx6dsYxCS7/kqIF46ac9WmAx9k44Jz + Wt18Pe1A7rIj38vRwLv2JuwUkZrOlAhav52EyDM/03QbgRKzEM9En5DYV2GFAqR1Xc3w + qLzw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=gFrGygir8lioHrOeF0abzZ3xbTuyQEnk7F/vaRJmx5SyMuxe5SQqcM/PozflvPaB4w + wHeng0ewo0t6S/xfZo9EpTKB19L5L5XnrxLoseo+tagkZJkCH2Bcw7dsBzALR2upGwrT + SfHywXMeCKH9fRAu3/Hj0W934lZDwMG3xqmWWebQ/wqDBE41Nk/dl9iHnGKp9QN61uee + Qv0jpp3sglzprI5CIEQqkElIXAF/jjnPqbknf+5nUyH4xUoe+CzTaEldVeHFc4iTerOZ + b48uPgriPJVTq7Gr7L8qWJ5yLZWqenG4sAIpLbanD8Mkw8ogaybVfIZyzrSKoTbtBiSa + oOEg== +X-Gm-Message-State: AA+aEWaOCOYCkmegm7N2wWsL8XdrnmJenH+HXps2b21WEUnrWH3tCofP + O07nsIq/s30FFJwtMB9dMCaWwCmc2iSWxn7hnqFhagZMyuYFYcJ1Zs5caqAV/LcSS/BBriTI4M7 + 4RALk0oVU/TiJvemnTTRSwFul6+hCHLFRxRM= +X-Received: by 2002:a1c:1cc4:: with SMTP id + c187-v6mr2937585wmc.75.1542379194749; + Fri, 16 Nov 2018 06:39:54 -0800 (PST) +X-Google-Smtp-Source: + AFSGD/XjyVsHsmDi+oKxMsFZ/hLG36TQdg1uDC2wO1upiuvyI+72rZz3AeAffzu3LWvkW8xxAI1e0w== +X-Received: by 2002:a1c:1cc4:: with SMTP id + c187-v6mr2937565wmc.75.1542379194454; + Fri, 16 Nov 2018 06:39:54 -0800 (PST) +Received: from jamesh-VirtualBox.pitowers.org + ([2a00:2381:fdf7:14:4419:8784:6076:3820]) + by smtp.gmail.com with ESMTPSA id a7sm26247594wrx.26.2018.11.16.06.39.53 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 16 Nov 2018 06:39:53 -0800 (PST) +From: James Hughes +To: eric@anholt.net, stefan.wahren@i2se.com, + linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org +Subject: [PATCH v3] firmware: raspberrypi: Fix firmware calls with large + buffers +Date: Fri, 16 Nov 2018 14:39:07 +0000 +Message-Id: <20181116143907.6149-1-james.hughes@raspberrypi.org> +X-Mailer: git-send-email 2.17.1 +X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , + definitions=2018-11-16_09:, , signatures=0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20181116_144007_971248_9AC931E8 +X-CRM114-Status: GOOD ( 21.12 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: +List-Unsubscribe: + , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: + , + +Cc: James Hughes +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +Commit a1547e0bca51 ("firmware: raspberrypi: Remove VLA usage") +moved away from VLA's to a fixed maximum size for mailbox data. +However, some mailbox calls use larger data buffers +than the maximum allowed in that change. This fix therefor +moves from using fixed buffers to kmalloc to ensure all sizes +are catered for. + +There is some documentation, which is somewhat out of date, +on the mailbox calls here : +https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface + +Fixes: a1547e0bca51 ("firmware: raspberrypi: Remove VLA usage") + +Signed-off-by: James Hughes +Reviewed-by: Eric Anholt +--- + drivers/firmware/raspberrypi.c | 35 +++++++++++++++++----------------- + 1 file changed, 18 insertions(+), 17 deletions(-) + +v2: Changes to commit message and format only. No code change. +v3: Moved declaration of header back to original position + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index a200a2174611..44eb99807e33 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +@@ -21,8 +22,6 @@ + #define MBOX_DATA28(msg) ((msg) & ~0xf) + #define MBOX_CHAN_PROPERTY 8 + +-#define MAX_RPI_FW_PROP_BUF_SIZE 32 +- + static struct platform_device *rpi_hwmon; + + struct rpi_firmware { +@@ -144,28 +143,30 @@ EXPORT_SYMBOL_GPL(rpi_firmware_property_list); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *tag_data, size_t buf_size) + { +- /* Single tags are very small (generally 8 bytes), so the +- * stack should be safe. +- */ +- u8 data[sizeof(struct rpi_firmware_property_tag_header) + +- MAX_RPI_FW_PROP_BUF_SIZE]; +- struct rpi_firmware_property_tag_header *header = +- (struct rpi_firmware_property_tag_header *)data; ++ struct rpi_firmware_property_tag_header *header; + int ret; + +- if (WARN_ON(buf_size > sizeof(data) - sizeof(*header))) +- return -EINVAL; ++ /* Some mailboxes can use over 1k bytes. Rather than checking ++ * size and using stack or kmalloc depending on requirements, ++ * just use kmalloc. Mailboxes don't get called enough to worry ++ * too much about the time taken in the allocation. ++ */ ++ void *data = kmalloc(sizeof(*header) + buf_size, GFP_KERNEL); + ++ if (!data) ++ return -ENOMEM; ++ ++ header = data; + header->tag = tag; + header->buf_size = buf_size; + header->req_resp_size = 0; +- memcpy(data + sizeof(struct rpi_firmware_property_tag_header), +- tag_data, buf_size); ++ memcpy(data + sizeof(*header), tag_data, buf_size); ++ ++ ret = rpi_firmware_property_list(fw, data, buf_size + sizeof(*header)); ++ ++ memcpy(tag_data, data + sizeof(*header), buf_size); + +- ret = rpi_firmware_property_list(fw, &data, buf_size + sizeof(*header)); +- memcpy(tag_data, +- data + sizeof(struct rpi_firmware_property_tag_header), +- buf_size); ++ kfree(data); + + return ret; + }