Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1410654imm; Thu, 5 Jul 2018 22:52:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe/IhAAv1i4rEVfX6GkIpFLUzI4OsvG5KEG6sGVx2wQYYh7i7VpgadspF7JGcQNrctlmzrn X-Received: by 2002:a17:902:301:: with SMTP id 1-v6mr8894885pld.127.1530856333146; Thu, 05 Jul 2018 22:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856333; cv=none; d=google.com; s=arc-20160816; b=OTWKM+UZJP/Hy/Jdm+5E47CyALJX5nCXoXMfKJZdvBjyHytYBYWaqIxlsHaqAbdyNB jOpYJ4Fg68FIWOvQ9I1sJCIIFCfZ2CX7MXSuDt7eb98ct+PCxMvweQ8jx0qXdq12nfIY 1W1+IJyFee41WEtJY14hv/d5QUSE7o40uHht9Y4jVciQsOtkWS+/IGyx7XHQIBeRF2Ak 8baPfJDFwlbVDnS5e4xe7UnG9U7XuREBaU4P3XfGUf9HpgBJWFQeS57z8h4mru9RjkCC /4hK8xqSH89/GeWOxeEDDQwKWFmjyGCc1LFvr3FtFg860Pj2mixkl7HkOk3Ueq/HnMvV geIw== 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=oiZTUZbJA0CgFNr/rrO5ZoqOFfBwPK/I19wMP/ddjOg=; b=AZHu0oujip/XLavfRjA1FGLvqENr7Wj3H9vnnwkdYrky3ru2CrwMgkpVe0k0KI+f1o bQno1mL47w5VfCHKd9u8fIePMsh1tTCcq+pv1ipwhYTTU+YHL8dTWO75F9XdjrWHcfSz 6uvK5h8XOPLyDphRor/Nx5TpuyRwqM/fGoqa4kw1PNm+nZvBvy5B4namFcwZOONKBfWI qJMzFcZoP7CH4iZSxGxnrx+UIYZ+/E/fgB5cyrgq8Lji0nBTFrYNrpDG6EJxhRT2U9sc pDVhO74iCJePjOeMMPgUvmTwgyxoy9ojmXGmQdrsf2rcDaGV31LUbZk22doz2utYH8JM BgXw== 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 a10-v6si7458783pff.304.2018.07.05.22.51.59; Thu, 05 Jul 2018 22:52:13 -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 S933284AbeGFFuC (ORCPT + 99 others); Fri, 6 Jul 2018 01:50:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60438 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933733AbeGFFuA (ORCPT ); Fri, 6 Jul 2018 01:50:00 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 19A9886A; Fri, 6 Jul 2018 05:49:59 +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.14 06/61] usb: typec: ucsi: acpi: Workaround for cache mode issue Date: Fri, 6 Jul 2018 07:46:30 +0200 Message-Id: <20180706054712.576584253@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@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.14-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 @@ -82,6 +82,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