From patchwork Mon Feb 15 11:32:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 61927 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1014028lbl; Mon, 15 Feb 2016 03:40:08 -0800 (PST) X-Received: by 10.98.66.81 with SMTP id p78mr22685316pfa.43.1455536407011; Mon, 15 Feb 2016 03:40:07 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ah10si42924239pad.118.2016.02.15.03.40.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Feb 2016 03:40:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVHPG-0001tn-DR; Mon, 15 Feb 2016 11:33:30 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVHOp-0001Ri-Ou for linux-arm-kernel@lists.infradead.org; Mon, 15 Feb 2016 11:33:05 +0000 Received: by mail-wm0-x22e.google.com with SMTP id g62so104594944wme.0 for ; Mon, 15 Feb 2016 03:32:42 -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:in-reply-to:references; bh=yb8JYU7NMpjb2dys4Up8DkNGCI24KSdt6OS4ZMQNInc=; b=eEhVs8V8Ug4bcWZULTX2GQJFpIn+LvtBkxvwCC/bKZ682DjgIIx/lX/VqJK+W2CNgO kUYBBEQLzxdmk8Yh2RCH1iqg7Kr/zMiGnKLj2pSpJDnt+Q/abl3cc2BCZvobcbqilawA xqbgewVKG4iIQMsk4Oq0KrK42shPxAG2kM28g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yb8JYU7NMpjb2dys4Up8DkNGCI24KSdt6OS4ZMQNInc=; b=RQuJrknaLXz+AjCBdFbPQZwbuv5TmkC3SMsO0a8HszM3zDAs67oXRI2gqhiJWbJnJF YDZaFa1tj7jh/1BLd2BCZMRe/xw3QItOPaFRUpWFSzzLT/jx5hngG0iTWmhuc2fwvXZA 5uocUg9KKHA5clqY9zcWPc1M+DslCxQManpbSRHpDmX1Sh53trEGDRFnD1cHrK8W2Uto slcEZ35IzxCfRm2Myil3le1UIzUhBpbQKmTiz/ccOuSzkG7AZ4XaOR+4N/1rzV4EjWxy NdAqpUmXJ7khM7FkWA7I4PvgBnCqra5YazRNljlIwbVVnt3N2DAtQh53OBaXCGh31O7w 2ctw== X-Gm-Message-State: AG10YOSZSmq0R9Ur1kv1SR2t8T6XAMygQ1tKIymk1+FE3h8jFEa44ob07UYblXma8LQ10rgh X-Received: by 10.28.51.74 with SMTP id z71mr11640860wmz.15.1455535961729; Mon, 15 Feb 2016 03:32:41 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id 73sm15215449wmy.22.2016.02.15.03.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 03:32:40 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, leif.lindholm@linaro.org, matt@codeblueprint.co.uk, mark.rutland@arm.com, pjones@redhat.com, tbaicar@codeaurora.org Subject: [PATCH v2 1/2] efi: esrt: use memremap not ioremap to access ESRT table in memory Date: Mon, 15 Feb 2016 12:32:32 +0100 Message-Id: <1455535953-5056-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455535953-5056-1-git-send-email-ard.biesheuvel@linaro.org> References: <1455535953-5056-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160215_033304_106682_EA85978C X-CRM114-Status: GOOD ( 15.30 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org On ARM and arm64, ioremap() and memremap() are not interchangeable like on x86, and the use of ioremap() on ordinary RAM is typically flagged as an error if the memory region being mapped is also covered by the linear mapping, since that would lead to aliases with conflicting cacheability attributes. Since what we are dealing with is not an I/O region with side effects, using ioremap() here is arguably incorrect anyway, so let's replace it with memremap instead. Also add a missing unmap on the success path, and drop a memblock_remove() call which does not belong here, this far into the boot sequence. Cc: Peter Jones Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/esrt.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index 22c5285f7705..f096a0a26dbd 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -385,15 +386,15 @@ static void cleanup_entry_list(void) static int __init esrt_sysfs_init(void) { int error; - struct efi_system_resource_table __iomem *ioesrt; + struct efi_system_resource_table *memesrt; pr_debug("esrt-sysfs: loading.\n"); if (!esrt_data || !esrt_data_size) return -ENOSYS; - ioesrt = ioremap(esrt_data, esrt_data_size); - if (!ioesrt) { - pr_err("ioremap(%pa, %zu) failed.\n", &esrt_data, + memesrt = memremap(esrt_data, esrt_data_size, MEMREMAP_WB); + if (!memesrt) { + pr_err("memremap(%pa, %zu, MEMREMAP_WB) failed.\n", &esrt_data, esrt_data_size); return -ENOMEM; } @@ -401,11 +402,12 @@ static int __init esrt_sysfs_init(void) esrt = kmalloc(esrt_data_size, GFP_KERNEL); if (!esrt) { pr_err("kmalloc failed. (wanted %zu bytes)\n", esrt_data_size); - iounmap(ioesrt); + memunmap(memesrt); return -ENOMEM; } - memcpy_fromio(esrt, ioesrt, esrt_data_size); + memcpy(esrt, memesrt, esrt_data_size); + memunmap(memesrt); esrt_kobj = kobject_create_and_add("esrt", efi_kobj); if (!esrt_kobj) { @@ -432,8 +434,6 @@ static int __init esrt_sysfs_init(void) if (error) goto err_cleanup_list; - memblock_remove(esrt_data, esrt_data_size); - pr_debug("esrt-sysfs: loaded.\n"); return 0;