Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1426797imm; Thu, 5 Jul 2018 23:14:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIbj5RM3Jwq5cJ2MIdqUxL0VhveTfJZpwNYWOmYmr+fs1xsa6daRFWK6gCMEvAfw3C1dZ6 X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr2180551pge.248.1530857654650; Thu, 05 Jul 2018 23:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857654; cv=none; d=google.com; s=arc-20160816; b=D1tHCo9+Dyc0NsJ7MMyGxxJS1bg6Fa7e4L+WE6IeiWSvfjrahBcrzbfvrhdACswOG5 W04YkwVAMpEXU9QiaU2+MeePZ4J7TcF/u74nVl8CGdJ5y+1H9XSNVdxfeHt5SOhmrOyx J5WAkDaPMy7m53cBpnMJGRC2oD2lor8D4Te/7D/ylu8ryLCQFN6V6rEDRAdzvXv2Vx2S Dd7K5R3LI7psRGI3kiQbAIFs+jhyjkXhmgSlmNFMtT5AttBU7JyFX8IlqZ8wcoUPQCv5 W8av2lQW1lJD7zqhgHJnNK2KymKKHOHJ2+BFZ8xxOxL+dLavNHpQYZ8pLqweEo95OEzU hsdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JvstF8bswBB0ChTAae1R0zgQsiyj3ydoJshlE52VNXg=; b=y+As2uucqmEsSzCCFa3/MkuSr/NAmoSB/JLBhOUIjgcjiT8nImcCvmoHdFeJ1vPPTz 3ItmWsiqvVgnFUyXAMYAu86V+fhbN6bChOmHY9vCxiMP4nVDJqWMkNuBbefEKA6qB9zc E14X1Jze6+KRz5xH/Y5c8uMZ+4PLTieo8y3O83Tsl+0j7H9vKQ7BKtyeds8cEOjAyQOW VusDRdqA0OLR7aSaeTJ1eGk8SL6VkI2jCGWLbiGKtOMPEiuvRk1tW/z2ASy3x8Is+hSQ ZCVxyTBertur25XoNbCjX7IE5s5vBXPVukYGtkHf/Q2sWOUb84OSQhp7SEk2C3bEnw70 6SJA== 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 f21-v6si6964165pgl.235.2018.07.05.23.13.59; Thu, 05 Jul 2018 23:14:14 -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; 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 S932924AbeGFFrp (ORCPT + 99 others); Fri, 6 Jul 2018 01:47:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58640 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932898AbeGFFrk (ORCPT ); Fri, 6 Jul 2018 01:47:40 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0F78EBC1; Fri, 6 Jul 2018 05:47:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Heikki Krogerus Subject: [PATCH 4.17 07/46] usb: typec: ucsi: acpi: Workaround for cache mode issue Date: Fri, 6 Jul 2018 07:46:28 +0200 Message-Id: <20180706054524.958143727@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heikki Krogerus commit 1f9f9d168ce619608572b01771c47a41b15429e6 upstream. This fixes an issue where the driver fails with an error: ioremap error for 0x3f799000-0x3f79a000, requested 0x2, got 0x0 On some platforms the UCSI ACPI mailbox SystemMemory Operation Region may be setup before the driver has been loaded. That will lead into the driver failing to map the mailbox region, as it has been already marked as write-back memory. acpi_os_ioremap() for x86 uses ioremap_cache() unconditionally. When the issue happens, the embedded controller has a pending query event for the UCSI notification right after boot-up which causes the operation region to be setup before UCSI driver has been loaded. The fix is to notify acpi core that the driver is about to access memory region which potentially overlaps with an operation region right before mapping it. acpi_release_memory() will check if the memory has already been setup (mapped) by acpi core, and deactivate it (unmap) if it has. The driver is then able to map the memory with ioremap_nocache() and set the memtype to uncached for the region. Reported-by: Paul Menzel Fixes: 8243edf44152 ("usb: typec: ucsi: Add ACPI driver") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi_acpi.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -79,6 +79,11 @@ static int ucsi_acpi_probe(struct platfo return -ENODEV; } + /* This will make sure we can use ioremap_nocache() */ + status = acpi_release_memory(ACPI_HANDLE(&pdev->dev), res, 1); + if (ACPI_FAILURE(status)) + return -ENOMEM; + /* * NOTE: The memory region for the data structures is used also in an * operation region, which means ACPI has already reserved it. Therefore