From patchwork Mon Apr 28 18:50:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 29269 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8CCF202FE for ; Mon, 28 Apr 2014 18:52:22 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id i8sf25953544qcq.4 for ; Mon, 28 Apr 2014 11:52:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=pMtLxN0QGJokgwOEBlnr0bRV2NHkceFVak3rJv0+jSk=; b=NI0P/XjYJ5Ds3QCKgOAgbBJszLRwAtnEbuHW5FBuez2O/CNgKMGZMldNNuNyIIT+Z8 BC9AFWNkk2x6e0522qQ1wnjlY9WnDG0pTJEOZBqZARdMhOjhNEcME9xckl2IWdTu5KOD pPHQ0EcF8HHfemy2sMVMCbkZ2UolKCjIbtskyg86VTv69H7MhLk2Rs3YQ7uEwbKLT8/c uUn1VgpZIn5HOJAsjV21oniCDid5FLuNNfPfQMuKaUH0BCCAP300wbU24RaL3mwBZy57 iXJypSN4DjNwOjRkYla/hWcu90Gk4buK1KHigKAMYJImxJeZiMOnnZhrwlIJHy93OVCo bJ2w== X-Gm-Message-State: ALoCoQlqqdVqu9/JUjep0O+DItEjaUfP5X51xYOsNPbnZVDaaJMT/3TQv3d8qB47THIJwUwK/wtv X-Received: by 10.236.117.80 with SMTP id i56mr11215044yhh.48.1398711142253; Mon, 28 Apr 2014 11:52:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.11 with SMTP id c11ls2622587qge.55.gmail; Mon, 28 Apr 2014 11:52:22 -0700 (PDT) X-Received: by 10.58.127.168 with SMTP id nh8mr1565623veb.44.1398711142040; Mon, 28 Apr 2014 11:52:22 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id 2si3860188vcd.203.2014.04.28.11.52.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 11:52:21 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so8657343vcb.16 for ; Mon, 28 Apr 2014 11:52:21 -0700 (PDT) X-Received: by 10.58.186.71 with SMTP id fi7mr2040445vec.32.1398711141634; Mon, 28 Apr 2014 11:52:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp139043vcb; Mon, 28 Apr 2014 11:52:21 -0700 (PDT) X-Received: by 10.140.82.7 with SMTP id g7mr33951439qgd.74.1398711141208; Mon, 28 Apr 2014 11:52:21 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id jl9si8297897qcb.0.2014.04.28.11.52.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Apr 2014 11:52:21 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1WeqdY-0005eb-MX; Mon, 28 Apr 2014 18:50:44 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WeqdV-0005aI-P7 for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 18:50:42 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.166]) by collaborate-mta1.arm.com (Postfix) with ESMTP id DE89313FFE6; Mon, 28 Apr 2014 13:50:06 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] arm64: fixmap: fix missing sub-page offset for earlyprintk Date: Mon, 28 Apr 2014 19:50:06 +0100 Message-Id: <1398711006-14943-1-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_115041_862672_30E8A219 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Catalin Marinas , Will Deacon , Mark Salter X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Commit d57c33c5daa4 (add generic fixmap.h) added (among other similar things) set_fixmap_io to deal with early ioremap of devices. More recently, commit bf4b558eba92 (arm64: add early_ioremap support) converted the arm64 earlyprintk to use set_fixmap_io. A side effect of this conversion is that my virtual machines have stopped booting when I pass "earlyprintk=uart8250-8bit,0x3f8" to the guest kernel. Turns out that the new earlyprintk code doesn't care at all about sub-page offsets, and just assumes that the earlyprintk device will be page-aligned. Obviously, that doesn't play well with the above example. Further investigation shows that set_fixmap_io uses __set_fixmap instead of __set_fixmap_offset. A fix is to introduce a set_fixmap_offset_io that uses the latter, and to remove the superflous call to fix_to_virt (which only returns the value that set_fixmap_io has already given us). With this applied, my VMs are back in business. Tested on a Cortex-A57 platform with kvmtool as platform emulation. Cc: Mark Salter Cc: Catalin Marinas Cc: Will Deacon Signed-off-by: Marc Zyngier Acked-by: Mark Salter --- arch/arm64/kernel/early_printk.c | 6 ++---- include/asm-generic/fixmap.h | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c index ffbbdde..2dc36d0 100644 --- a/arch/arm64/kernel/early_printk.c +++ b/arch/arm64/kernel/early_printk.c @@ -143,10 +143,8 @@ static int __init setup_early_printk(char *buf) } /* no options parsing yet */ - if (paddr) { - set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr); - early_base = (void __iomem *)fix_to_virt(FIX_EARLYCON_MEM_BASE); - } + if (paddr) + early_base = (void __iomem *)set_fixmap_offset_io(FIX_EARLYCON_MEM_BASE, paddr); printch = match->printch; early_console = &early_console_dev; diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index 5a64ca4..f23174f 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -93,5 +93,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) #define set_fixmap_io(idx, phys) \ __set_fixmap(idx, phys, FIXMAP_PAGE_IO) +#define set_fixmap_offset_io(idx, phys) \ + __set_fixmap_offset(idx, phys, FIXMAP_PAGE_IO) + #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_FIXMAP_H */