Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8801723rwr; Thu, 11 May 2023 06:29:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7soTdd10jCmcuo7noKdRvJxSdEuYPW1y05S5Ys9yS2n/lbp0gDRmw0XquLdp4YOywO+pqq X-Received: by 2002:a17:90b:2307:b0:24e:165d:8f65 with SMTP id mt7-20020a17090b230700b0024e165d8f65mr20499293pjb.5.1683811777873; Thu, 11 May 2023 06:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683811777; cv=none; d=google.com; s=arc-20160816; b=h67YI8kB0PadiuBeVe+BuFg3WF8esGvoCUKL4JI7oLk6mE0HTyFeJUN3UtxjXwS0zD wit5pAWPYeMTR2VkyhtdeJ3VgIgLybm3sHWLtBkn+URjcKATvw/P7oAx2Yz6MBDPjsp+ 3zcnEbkfxlexOdpWzFpds+1pr43kKZauecqmc4evT44QIPilYZ69fxqxiaH/hnQdGJwp G0gpSQ1mip9rrWJp4qTef3R9C2r8tDufAFR/5pFzOjYA5VOoRs7bCE0PLuPtyY9rUMCp cyWKZb+RmD/cTsxPdv3WKV6NRjaXc1O7L2NBG/PUq0oVTE+GiAS+5f0zx0Va29YWhp2P qdKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:references :in-reply-to:subject:cc:to:from:date:mime-version; bh=mPMS+rZhsp/oHVg5cPgaLgHy73NN1ETGgS6R/2/VCMk=; b=NM8KNxB80X8Ykms+qw1R8jE2DXTmw5hssS4QHJIM+V44NY5hBY+IHf1W5SCz5Qd5/X xW+W0X+gqdGNV9Lk5Aqz69Hz+PsJHUchyp5ZWSEvtqMRy1td2bo0k19Dsh0Jq6HbqvcW F+OaODCfKFHb7IkzQg6c3TFrAGPv00Z3jGqLXmk1dq57qS0iQIn8UuVMPtWlFMw+b7Ip 5YNQ7nOO9I/QiPbXqBfmviRSqtxZRZ6speXZeNjxhQ+fNF/IHr2fpHeH6uDEUmeTphlf Jhr2Fn6GOtPfZljuAaWwkIm5J+WpNk/fjyKu9kTGLplBeaSRcdq5lAKOdQW/a5pqAeMt EqWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na16-20020a17090b4c1000b00237155f2303si12056567pjb.136.2023.05.11.06.29.25; Thu, 11 May 2023 06:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237999AbjEKNZb (ORCPT + 99 others); Thu, 11 May 2023 09:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238285AbjEKNYZ (ORCPT ); Thu, 11 May 2023 09:24:25 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A0B11623; Thu, 11 May 2023 06:22:26 -0700 (PDT) Received: (Authenticated sender: contact@artur-rojek.eu) by mail.gandi.net (Postfix) with ESMTPA id AC3D220007; Thu, 11 May 2023 13:22:13 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 11 May 2023 15:22:13 +0200 From: Artur Rojek To: Geert Uytterhoeven Cc: Arnd Bergmann , Thomas Zimmermann , kernel test robot , Helge Deller , Javier Martinez Canillas , Daniel Vetter , Vineet Gupta , Huacai Chen , WANG Xuerui , "David S . Miller" , "James E . J . Bottomley" , Sam Ravnborg , suijingfeng@loongson.cn, oe-kbuild-all@lists.linux.dev, Linux-Arch , linux-fbdev@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-m68k@lists.linux-m68k.org, loongarch@lists.linux.dev, sparclinux@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 5/6] fbdev: Move framebuffer I/O helpers into In-Reply-To: References: <20230510110557.14343-6-tzimmermann@suse.de> <202305102136.eMjTSPwH-lkp@intel.com> <49684d58-c19d-b147-5e9f-2ac526dd50f0@suse.de> <743d2b1e-c843-4fb2-b252-0006be2e2bd8@app.fastmail.com> Message-ID: <9c4be198444e9987c826c87b592e9dc6@artur-rojek.eu> X-Sender: contact@artur-rojek.eu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-05-11 14:35, Geert Uytterhoeven wrote: > Hi Arnd, > > CC Artur, who's working on HP Jornada 680. Thanks for CC'ing me - I faced this exact issue while working on my (still not upstreamed) hd6446x PCMCIA controller driver. The PCMCIA subsystem uses `inb/outb`, which expect the `sh_io_port_base` to be set to something else than the default `-1`. At first I tried to set it to `0xa0000000`, so that all I/O goes through the fixed, non-cacheable P2 area. That however broke some other driver code (I had no time to debug which one). Eventually I ended up taking a suggestion from a MIPS PCMCIA driver [1] and simply substract the broken `sh_io_port_base` address from `HD64461_IOBASE`, as the base for `socket.io_offset`. This way all the PCMCIA `inb/outb` accesses are absolute, no matter what the `sh_io_port_base` is set to. This of course is a very ugly solution and we should instead fix the root cause of this mess. I will have a better look at this patch set and the problem at hand at a later date. Cheers, Artur [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pcmcia/db1xxx_ss.c?h=v6.4-rc1#n527 > > On Wed, May 10, 2023 at 5:55 PM Arnd Bergmann wrote: >> On Wed, May 10, 2023, at 16:27, Thomas Zimmermann wrote: >> > Am 10.05.23 um 16:15 schrieb Arnd Bergmann: >> >> On Wed, May 10, 2023, at 16:03, kernel test robot wrote: >> >> >> I think that's a preexisting bug and I have no idea what the >> >> correct solution is. Looking for HD64461 shows it being used >> >> both with inw/outw and readw/writew, so there is no way to have >> >> the correct type. The sh __raw_readw() definition hides this bug, >> >> but that is a problem with arch/sh and it probably hides others >> >> as well. >> > >> > The constant HD64461_IOBASE is defined as integer at >> > >> > >> > https://elixir.bootlin.com/linux/latest/source/arch/sh/include/asm/hd64461.h#L17 >> > >> > but fb_readw() expects a volatile-void pointer. I guess we could add a >> > cast somewhere to silence the problem. In the current upstream code, >> > that appears to be done by sh's __raw_readw() internally: >> > >> > >> > https://elixir.bootlin.com/linux/latest/source/arch/sh/include/asm/io.h#L35 >> >> Sure, that would make it build again, but that still doesn't make the >> code correct, since it's completely unclear what base address the >> HD64461_IOBASE is relative to. The hp6xx platform code only passes it >> through inw()/outw(), which take an offset relative to >> sh_io_port_base, >> but that is not initialized on hp6xx. I tried to find in the history >> when it broke, apparently that was in 2007 commit 34a780a0afeb ("sh: >> hp6xx pata_platform support."), which removed the custom inw/outw >> implementations. > > See also commit 4aafae27d0ce73f8 ("sh: hd64461 tidying."), which > claims they are no longer needed. > > Don't the I/O port macros just treat the port as an absolute base > address > when sh_io_port_base isn't set? > > Gr{oetje,eeting}s, > > Geert