Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp705291ybh; Sat, 7 Mar 2020 08:15:57 -0800 (PST) X-Google-Smtp-Source: ADFU+vvZwrDnBbqQ6L2+rb3u0JUBcL2fceSI+6UntpdApx/gEGPK/Bjyne85vvy8tl25+P8vTS5q X-Received: by 2002:a9d:6f14:: with SMTP id n20mr6805904otq.271.1583597757729; Sat, 07 Mar 2020 08:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583597757; cv=none; d=google.com; s=arc-20160816; b=i3eVuo2MAQydVhi2wbRTN4bEIAhCW+Ku3T7fxZdptFdPW2yRWzWqcadELAgO4+8et+ ig5giu1+pEkOEoBB+VB1LqT8SWDZqz43KLZIoqpnxpXsZgyUQKBc0c4edq0+Ej3jsyyj QBIJv7dMgeQ3Z1A1U5eLX0DrUgK/pxNnf0EIvvqHYRSZQsCGh/LP7k1/8XCMqHdzPFwK quWfTHnJwK7o03W9cG9wEB2pdtNTJIvmTSX71UGJLb3OjPDGIoli78YDW39v9SEH3qjp RFrPDS2S1d3XiwnCedoDMnKtGoWl9+JiVhD37G1gXl8pcmje/+8s/HTt6bUxvflUfW8w EUZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1U0YgCr+EGBw/IqkeqO09b29EzFyV86+dz4snfxV0xY=; b=KNJ0JyU+kL//CxAnR9mf5pG3LQM0erQlqbIYVSMcgsPZRK+PBRert+onJGraWu6o81 LlFvEUkR3PaAXSHuwGa5sR45DLchy8oWKroghCZ17clkjVOpXwglvqFXr8FUXNZBiUp+ WqdoYcM5mx3mfDqIrqzBd/75kYwqcGxxjhV3pltfF8mIlxKlEd+GsCg7mL2r72YqxSR2 JhN+C5iE8tPiAkpTcRGckz7XTreuoI0i53SVSJJhO8oeLkDf2CY+3OoO8z134zXivovn GHXFCXry4fhQIvA60v6fbD5nu84Su6xam4oQEB639Ke+cWaJVz3nkf6JIcPiDmaDEKMX sUYw== 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 i131si1542603oib.6.2020.03.07.08.15.43; Sat, 07 Mar 2020 08:15:57 -0800 (PST) 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 S1726139AbgCGQOw (ORCPT + 99 others); Sat, 7 Mar 2020 11:14:52 -0500 Received: from asavdk4.altibox.net ([109.247.116.15]:49562 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbgCGQOw (ORCPT ); Sat, 7 Mar 2020 11:14:52 -0500 Received: from ravnborg.org (unknown [158.248.194.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id 03AA08050E; Sat, 7 Mar 2020 17:14:46 +0100 (CET) Date: Sat, 7 Mar 2020 17:14:45 +0100 From: Sam Ravnborg To: tang pengchuan Cc: Emil Velikov , Mark Rutland , Baolin Wang , Dave Airlie , Chunyan Zhang , "Linux-Kernel@Vger. Kernel. Org" , Rob Herring , ML dri-devel , Orson Zhai , Sean Paul Subject: Re: [PATCH RFC v4 4/6] drm/sprd: add Unisoc's drm display controller driver Message-ID: <20200307161445.GA7524@ravnborg.org> References: <1582710377-15489-1-git-send-email-kevin3.tang@gmail.com> <1582710377-15489-5-git-send-email-kevin3.tang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=XpTUx2N9 c=1 sm=1 tr=0 a=UWs3HLbX/2nnQ3s7vZ42gw==:117 a=UWs3HLbX/2nnQ3s7vZ42gw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=OIW1Wx_ocpC4raMFu88A:9 a=CjuIK1q_8ugA:10 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kevin > > > + > > > +ifdef CONFIG_ARM64 > > > +KBUILD_CFLAGS += -mstrict-align > > > > > > There are many other drivers that do not use readl/writel for register access, > > yet none has this workaround... Even those that they are exclusively ARM64. > > > > Have you tried that it's not a buggy version of GCC? At the very least, I'd > > encourage you to add a brief comment about the problem + setup. > > > > ... In general I think one should follow the suggestions from Rob Herring. > > > Yocto v2.5 > aarch64-linaro-linux-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011 > > Crash Stack: > /sprd/drv/dispc/dpu_r2p0.c:729 > 1796256 ffffff8008486650: f803c043 stur x3, [x2,#60] > =>Unhandled fault: alignment fault (0x96000061) at 0xffffff80098b883c > > 729 reg->mmu_min_ppn1 = 0; > 730 reg->mmu_ppn_range1 = 0xffff; > 731 reg->mmu_min_ppn2 = 0; > 732 reg->mmu_ppn_range2 = 0xffff; > > The above C code operation are continuous. The compiler may think that > the access can be completed by directly using two 64-bit assignment > operations, so it is optimized to 64-bit operation. What you see is a side-effect of using a sturct for register access. When you ave your code change to use readl()/writel() and friends this is no logner a problem, and you can drop the cc flag. Sam