From 76c7367ad0a861557a50a19be2ee32a16df22170 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 8 Feb 2019 12:48:23 +0000 Subject: [PATCH] Minor Arm fixes --- ...d-DMA-optimization-for-ARM-and-arm64.patch | 196 ++++++++++++++++++ kernel.spec | 6 + wlcore-sdio-Fixup-power-on-off-sequence.patch | 161 ++++++++++++++ 3 files changed, 363 insertions(+) create mode 100644 drm-enable-uncached-DMA-optimization-for-ARM-and-arm64.patch create mode 100644 wlcore-sdio-Fixup-power-on-off-sequence.patch diff --git a/drm-enable-uncached-DMA-optimization-for-ARM-and-arm64.patch b/drm-enable-uncached-DMA-optimization-for-ARM-and-arm64.patch new file mode 100644 index 000000000..5e151ce57 --- /dev/null +++ b/drm-enable-uncached-DMA-optimization-for-ARM-and-arm64.patch @@ -0,0 +1,196 @@ +From patchwork Thu Jan 24 12:06:58 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Ard Biesheuvel +X-Patchwork-Id: 10778815 +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 B27A191E + for ; + Thu, 24 Jan 2019 12:07:20 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFBE72EC6C + for ; + Thu, 24 Jan 2019 12:07:17 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id D30BC2ECE2; Thu, 24 Jan 2019 12:07: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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 C03122EC6C + for ; + Thu, 24 Jan 2019 12:07:16 +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:Cc:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=xo5AgoUtS0FBdf9ZXAO75L7eu+GEGqebznBMcwnNXS0=; b=EUK2XskaTLLGNd + PLBm/AVgfZr2j3GzaOOAh6rJqVHuQ4k98saArkFu8aSFtVkvkSPF3PKCDKnV+7mZibl17Kqiup2Cv + HsRzfxwZzeksoNjDcZMYK82pttYA+iizpIYq16Wp+SXMzm6HRuku9XhW7tygG9zNr+cUVzaN6QU6b + mO5CAPgeGsluExNwC+4i4fRNqtN4z7rTMPuHkZ6jSy6tTy/OyKUApjhrgphDWEjtelAKeqn8Jwg+i + YnZQMi8l6B4Ffn7IlU2wHVKU7/yk9hO46AC+uKKYTV5RmcC0xFqKNK0TnBQzum5FdK2/h7h/3f0CA + GflIczkPfOItaFoJvs3g==; +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 1gmdmr-0000p2-1K; Thu, 24 Jan 2019 12:07:13 +0000 +Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gmdmm-0000oP-Sk + for linux-arm-kernel@lists.infradead.org; Thu, 24 Jan 2019 12:07:11 +0000 +Received: by mail-wm1-x341.google.com with SMTP id b11so2875125wmj.1 + for ; + Thu, 24 Jan 2019 04:07:07 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id:mime-version + :content-transfer-encoding; + bh=GsPSU83pbk1uWSobF359Hmb25tSiPCSXYSiAdhiX2K0=; + b=MVHv9eioSsA83BVb2J9fi21oGdNAhe8L5mYX67nd+XBNW59IxbYWyPCjLtaUXXFxQx + C8eDCimc2jtV5LiHYUHkJKhoQYN40/4u2K6EOoUunE10yy3C+J6aGY9JX5gh7mgstcNp + Dvdm9CHYXs35/N3s4bzP1fUHVnLbpVKVammw0= +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:mime-version + :content-transfer-encoding; + bh=GsPSU83pbk1uWSobF359Hmb25tSiPCSXYSiAdhiX2K0=; + b=DtNKUeOnwDAjpgolmP7hnQugxkX3XqgSxg6WUAlVeQyxIk+8QlEAWLNFtKPL57EnLP + G9R1qiTnF1TI4PM8DFH+URNkVNcI9hvhGKtO4fya+BjPd6dqPJVwct1+KZWM8lTJfDX+ + pMKL1ZiDeYMlHAMkd2CfCckaEptq5FjtvwJ8pyPbdN5qNxVJ6CEPIl9HORWWMuwrsxaj + xo5MK/UpOqhomOXRe5WxGor2JPNit68hT1PvHQwqNXCoRRTtCUANoV7s1nJ2Ad+pkhV7 + FW5IV/JnVetKbeCIhe2I/m6VlJ+6x3wPOpiWN/Fd8z5tYX0zI0vjKqdjdfr/QJCNF69Z + +cuw== +X-Gm-Message-State: AJcUukcCDAeH11orvgS33hS4OKLhp1Vglp0ChrGS5Ol91KaBPDqURaLX + WKQRIEAwB4phU3pS/I/nkTBzdQ== +X-Google-Smtp-Source: + ALg8bN55gm82WRKfoWS5g8dy3rATbR8W4MaKwupN1EALKBkI9t9KdMSE60V2HSnI4wy7yU44++cGoA== +X-Received: by 2002:a1c:bdc5:: with SMTP id n188mr2530824wmf.69.1548331626262; + Thu, 24 Jan 2019 04:07:06 -0800 (PST) +Received: from localhost.localdomain + (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) + by smtp.gmail.com with ESMTPSA id t12sm98842348wrr.65.2019.01.24.04.07.04 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 24 Jan 2019 04:07:05 -0800 (PST) +From: Ard Biesheuvel +To: linux-kernel@vger.kernel.org +Subject: [PATCH] drm: enable uncached DMA optimization for ARM and arm64 +Date: Thu, 24 Jan 2019 13:06:58 +0100 +Message-Id: <20190124120658.30288-1-ard.biesheuvel@linaro.org> +X-Mailer: git-send-email 2.20.1 +MIME-Version: 1.0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20190124_040708_952827_D4810358 +X-CRM114-Status: GOOD ( 13.64 ) +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: David Zhou , + Maxime Ripard , + Benjamin Herrenschmidt , + Carsten Haitzler , + Ard Biesheuvel , David Airlie , + Maarten Lankhorst , + dri-devel , + Michel Daenzer , Robin Murphy , + Will Deacon , Christoph Hellwig , + Junwei Zhang , Huang Rui , + amd-gfx list , + Daniel Vetter , + Michael Ellerman , + Alex Deucher , Sean Paul , + Christian Koenig , + linux-arm-kernel@lists.infradead.org +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 + +The DRM driver stack is designed to work with cache coherent devices +only, but permits an optimization to be enabled in some cases, where +for some buffers, both the CPU and the GPU use uncached mappings, +removing the need for DMA snooping and allocation in the CPU caches. + +The use of uncached GPU mappings relies on the correct implementation +of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU +will use cached mappings nonetheless. On x86 platforms, this does not +seem to matter, as uncached CPU mappings will snoop the caches in any +case. However, on ARM and arm64, enabling this optimization on a +platform where NoSnoop is ignored results in loss of coherency, which +breaks correct operation of the device. Since we have no way of +detecting whether NoSnoop works or not, just disable this +optimization entirely for ARM and arm64. + +Cc: Christian Koenig +Cc: Alex Deucher +Cc: David Zhou +Cc: Huang Rui +Cc: Junwei Zhang +Cc: Michel Daenzer +Cc: David Airlie +Cc: Daniel Vetter +Cc: Maarten Lankhorst +Cc: Maxime Ripard +Cc: Sean Paul +Cc: Michael Ellerman +Cc: Benjamin Herrenschmidt +Cc: Will Deacon +Cc: Christoph Hellwig +Cc: Robin Murphy +Cc: amd-gfx list +Cc: dri-devel +Reported-by: Carsten Haitzler +Signed-off-by: Ard Biesheuvel +Reviewed-by: Alex Deucher +--- + include/drm/drm_cache.h | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h +index bfe1639df02d..97fc498dc767 100644 +--- a/include/drm/drm_cache.h ++++ b/include/drm/drm_cache.h +@@ -47,6 +47,24 @@ static inline bool drm_arch_can_wc_memory(void) + return false; + #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3) + return false; ++#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) ++ /* ++ * The DRM driver stack is designed to work with cache coherent devices ++ * only, but permits an optimization to be enabled in some cases, where ++ * for some buffers, both the CPU and the GPU use uncached mappings, ++ * removing the need for DMA snooping and allocation in the CPU caches. ++ * ++ * The use of uncached GPU mappings relies on the correct implementation ++ * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU ++ * will use cached mappings nonetheless. On x86 platforms, this does not ++ * seem to matter, as uncached CPU mappings will snoop the caches in any ++ * case. However, on ARM and arm64, enabling this optimization on a ++ * platform where NoSnoop is ignored results in loss of coherency, which ++ * breaks correct operation of the device. Since we have no way of ++ * detecting whether NoSnoop works or not, just disable this ++ * optimization entirely for ARM and arm64. ++ */ ++ return false; + #else + return true; + #endif diff --git a/kernel.spec b/kernel.spec index 205bc9da4..217598379 100644 --- a/kernel.spec +++ b/kernel.spec @@ -576,6 +576,12 @@ Patch305: qcom-msm89xx-fixes.patch # https://patchwork.kernel.org/project/linux-mmc/list/?submitter=71861 Patch306: arm-sdhci-esdhc-imx-fixes.patch +# https://patchwork.kernel.org/patch/10765783/ +Patch307: wlcore-sdio-Fixup-power-on-off-sequence.patch + +# https://patchwork.kernel.org/patch/10778815/ +Patch308: drm-enable-uncached-DMA-optimization-for-ARM-and-arm64.patch + # Initall support for the 3A+ Patch330: bcm2837-dts-add-Raspberry-Pi-3-A.patch diff --git a/wlcore-sdio-Fixup-power-on-off-sequence.patch b/wlcore-sdio-Fixup-power-on-off-sequence.patch new file mode 100644 index 000000000..6b42a5fec --- /dev/null +++ b/wlcore-sdio-Fixup-power-on-off-sequence.patch @@ -0,0 +1,161 @@ +From patchwork Wed Jan 16 11:37:23 2019 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Ulf Hansson +X-Patchwork-Id: 10765783 +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 956256C2 + for ; + Wed, 16 Jan 2019 11:37:39 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 860D62D08C + for ; + Wed, 16 Jan 2019 11:37:39 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 7A4732DBF8; Wed, 16 Jan 2019 11:37:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI + autolearn=unavailable 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 86DFA2D579 + for ; + Wed, 16 Jan 2019 11:37:37 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S2389465AbfAPLhg (ORCPT + ); + Wed, 16 Jan 2019 06:37:36 -0500 +Received: from mail-lj1-f195.google.com ([209.85.208.195]:46058 "EHLO + mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S2389488AbfAPLhg (ORCPT + ); Wed, 16 Jan 2019 06:37:36 -0500 +Received: by mail-lj1-f195.google.com with SMTP id s5-v6so5113775ljd.12 + for ; + Wed, 16 Jan 2019 03:37:34 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; + h=from:to:cc:subject:date:message-id; + bh=G4uWfUBdfRWJ7ooa2ukqyMzWYVfm+tWSAZRULgvNQ08=; + b=DqdSNsfGTw5APfw140m3LimoqimPBt+dTkOxqu/2bQyXk7S9f23O7PxiN3oFynlZKr + SASxPUZ8sG4xbfOK9h8FHLlWWFpRIZSahu+mE0EseqtvBLV4sdCnBwOS8M3gko6ngb7C + i176BhDXn0+wm8tZGD3yN7Qp96KnQZ3Sv/tjk= +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=G4uWfUBdfRWJ7ooa2ukqyMzWYVfm+tWSAZRULgvNQ08=; + b=a7MooeHuGM0cTZPVwhtKcW1jg4pqdeIMk6f7/zUrRv+SoOb7Vnw9KEGP3KU5lDSMo5 + fdJcqriPtpflqlW2b23HNJ2gVIYbySV3bmkiu2AKTwNWCFTkIS2ortWV4MES6WsAsR7G + SJBjNOxj2qAxl8qauqOq0X2TNOhKQXtXsfOZ+d5pkSB1+/BBEcxtWLRHwsnMQW5GjawC + DICSSEnG7V41Nz/GwJN/YMZ5mDDoTgm5E0w5FUpgIsWkaZ3EwXNfATg7MrYDRaaP8D+y + Bc3D5LBTeGf5Ka2znrkAwm5UNG0ACbfhyC051z0Pt/8c0dPIdccFOYiaQId02Kxg6z3K + O1Tw== +X-Gm-Message-State: AJcUukfOVkWnN7bzdpLCd5T4eBBp4b+eeSeNmP9oASomJxjWdmE2FFn/ + FXErvZDhVCsQSfNn/eJnmK5Zq0rkuSY= +X-Google-Smtp-Source: + ALg8bN4GExvNSUhrn1ThdHo4TWGq9deM7EiNDhwBHUXk+6BhziaXs9EaV54O4+YG3vKLHV5hZLkJyg== +X-Received: by 2002:a2e:6503:: with SMTP id + z3-v6mr6194730ljb.153.1547638653812; + Wed, 16 Jan 2019 03:37:33 -0800 (PST) +Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. + [158.174.22.210]) + by smtp.gmail.com with ESMTPSA id + f11sm1144237lfi.12.2019.01.16.03.37.32 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Wed, 16 Jan 2019 03:37:33 -0800 (PST) +From: Ulf Hansson +To: Kalle Valo , + Tony Lindgren , Eyal Reizer , + linux-wireless@vger.kernel.org +Cc: Ricardo Salveti , + Kishon Vijay Abraham I , + Anders Roxell , + John Stultz , + Jan Kiszka , + Ulf Hansson , + linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org +Subject: [PATCH V2] wlcore: sdio: Fixup power on/off sequence +Date: Wed, 16 Jan 2019 12:37:23 +0100 +Message-Id: <20190116113723.15668-1-ulf.hansson@linaro.org> +X-Mailer: git-send-email 2.17.1 +Sender: linux-omap-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-omap@vger.kernel.org +X-Virus-Scanned: ClamAV using ClamSMTP + +During "wlan-up", we are programming the FW into the WiFi-chip. However, +re-programming the FW doesn't work, unless a power cycle of the WiFi-chip +is made in-between the programmings. + +To conform to this requirement and to fix the regression in a simple way, +let's start by allowing that the SDIO card (WiFi-chip) may stay powered on +(runtime resumed) when wl12xx_sdio_power_off() returns. The intent with the +current code is to treat this scenario as an error, but unfortunate this +doesn't work as expected, so let's fix this. + +The other part is to guarantee that a power cycle of the SDIO card has been +completed when wl12xx_sdio_power_on() returns, as to allow the FW +programming to succeed. However, relying solely on runtime PM to deal with +this isn't sufficient. For example, userspace may prevent runtime suspend +via sysfs for the device that represents the SDIO card, leading to that the +mmc core also keeps it powered on. For this reason, let's instead do a +brute force power cycle in wl12xx_sdio_power_on(). + +Fixes: 728a9dc61f13 ("wlcore: sdio: Fix flakey SDIO runtime PM handling") +Signed-off-by: Ulf Hansson +Tested-by: Tony Lindgren +Tested-by: Anders Roxell +Signed-off-by: Ulf Hansson +--- + +Changes in v2: + - Keep the SDIO host claimed when calling mmc_hw_reset(). + - Add a fixes tag. +--- + drivers/net/wireless/ti/wlcore/sdio.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c +index bd10165d7eec..4d4b07701149 100644 +--- a/drivers/net/wireless/ti/wlcore/sdio.c ++++ b/drivers/net/wireless/ti/wlcore/sdio.c +@@ -164,6 +164,12 @@ static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) + } + + sdio_claim_host(func); ++ /* ++ * To guarantee that the SDIO card is power cycled, as required to make ++ * the FW programming to succeed, let's do a brute force HW reset. ++ */ ++ mmc_hw_reset(card->host); ++ + sdio_enable_func(func); + sdio_release_host(func); + +@@ -174,20 +180,13 @@ static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) + { + struct sdio_func *func = dev_to_sdio_func(glue->dev); + struct mmc_card *card = func->card; +- int error; + + sdio_claim_host(func); + sdio_disable_func(func); + sdio_release_host(func); + + /* Let runtime PM know the card is powered off */ +- error = pm_runtime_put(&card->dev); +- if (error < 0 && error != -EBUSY) { +- dev_err(&card->dev, "%s failed: %i\n", __func__, error); +- +- return error; +- } +- ++ pm_runtime_put(&card->dev); + return 0; + } +