Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp643785iob; Wed, 4 May 2022 05:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ+dWHyCn2Zrb5PRYwobYH55XVdsjEFpIDfUVB7ALYVxJhe6u0PO/BLR8dycw6lTbWRnHq X-Received: by 2002:a05:6402:54:b0:427:e432:14a5 with SMTP id f20-20020a056402005400b00427e43214a5mr8154281edu.124.1651666333594; Wed, 04 May 2022 05:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651666333; cv=none; d=google.com; s=arc-20160816; b=Uf1LmCCQVvGrzb61DojndgaMrq8cc9ldg3ZPpSUpsH7ZjEUhcCNMG9XGa/ZhzLyEtH y6d4rDTIkdOYJyI2TIuRiSlgFYn+5HnZCSzDP/TxIESnwBmu1POOqSLVlGRQgKxSLqCI jQeytqEKdmYIyPTMITudFxaRCosRUIpfDGDvrJWHWi/NMyoaTNAW2H5L3qcKzrg4LGee Ql4RNWmqPD8yegXvUt9U1yoonIbAl1zWTXt3GMAeeeCDNYk76XxefDY1+4RmvQLfHvg5 bALDML1hS2lSFA8Fi2QxtGYX0y9xQYiGBikluJLFMooknVHjNhUcMDCwyHcoejKVN+Ya y6NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:dkim-filter; bh=iBquoT+jDwBJYcEPiVkGfRjAfRfVGJM32W9U8uFQXHc=; b=AWxkFTzahQLqv3cCMIHw+GpOx2Kk6GRHzpTEQkq6ocq1+bOh+lfLg6uUuqXOL7d2pd ldjJ1rrKhtycoRpEFuVHVgLjhq56NJExh7K5DURye5oesSLmmDrdh8+OSsKyWYAivHxD XXLgEpWY/6z7VntSpUO8UyR4cvuUEy5HTuEdCW/7IVqRl3LKHtWAEcQKSTyuD3q+rvcm UhZP5OuK+hprmbN8T62AnyrKmNwWVwYWO9aITkkBCWIl4ksMy8HSXie3YRqppBANsm3w 2uC2A/35i1dHDR1W2jcf1BvABieZQdpkwSkxES9BNomAE8+vXEnW129hSWfdbPVU0oDx auyg== 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 u3-20020a17090617c300b006f3e875f480si13075117eje.288.2022.05.04.05.11.49; Wed, 04 May 2022 05:12:13 -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 S241746AbiECThB (ORCPT + 99 others); Tue, 3 May 2022 15:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbiECTg7 (ORCPT ); Tue, 3 May 2022 15:36:59 -0400 Received: from mxout03.lancloud.ru (mxout03.lancloud.ru [45.84.86.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E862E6BB; Tue, 3 May 2022 12:33:21 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru B5F5020FC81C Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: Re: [PATCH v3] sh: avoid using IRQ0 on SH3/4 From: Sergey Shtylyov To: Geert Uytterhoeven , Rob Landley CC: John Paul Adrian Glaubitz , Rich Felker , Linux-sh list , "Linux Kernel Mailing List" , Yoshinori Sato , Greg Kroah-Hartman References: <2584ba18-9653-9310-efc1-8b3b3e221eea@omp.ru> <11021433-66c0-3c56-42bd-207a5ae8d267@physik.fu-berlin.de> <2ebef1ac-e5c5-980c-9413-22a6cccdfa1d@landley.net> <59faed1d-3878-ce75-9f62-aaf4338d0ad1@omp.ru> Organization: Open Mobile Platform Message-ID: <520ab5ce-021a-bbd9-7303-3f7695631ba5@omp.ru> Date: Tue, 3 May 2022 22:33:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <59faed1d-3878-ce75-9f62-aaf4338d0ad1@omp.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 5/2/22 11:56 PM, Sergey Shtylyov wrote: [...] >>>>> Using IRQ0 by the platform devices is going to be disallowed soon (see [1]) >>>>> and even now, when IRQ0 is about to be returned by platfrom_get_irq(), you >>>>> see a big warning. The code supporting SH3/4 SoCs maps the IRQ #s starting >>>>> at 0 -- modify that code to start the IRQ #s from 16 instead. >>>>> >>>>> The patch should mostly affect the AP-SH4A-3A/AP-SH4AD-0A boards as they >>>>> indeed use IRQ0 for the SMSC911x compatible Ethernet chip... >> >>> As I told him in IRC, the problem is still that sh4 never gives me a shell >>> prompt with this patch applied. I just reconfirmed it against current git: >>> >>> Freeing unused kernel image (initmem) memory: 124K >>> This architecture does not have kernel memory protection. >>> Run /init as init process >>> mountpoint: dev/pts: No such file or directory >>> 8139cp 0000:00:02.0 eth0: link up, 100Mbps, full-duplex, lpa 0x05E1 >>> >>> It makes it partway through the init script, but it hangs with qemu-system-sh4 >>> stuck in a CPU-eating loop before finishing. Without the patch, I get a shell >>> prompt. >> >> I regularly test on qemu rts7751r2d, but couldn't produce your >> issue. Until I tried "ifconfig eth0 up", which causes a lock-up. >> Interestingly, the 8139 irq was 112 with and without Sergey's patch, >> so there must be an irq remapping missing. >> >> I also test regularly on landisk, where 8139 Ethernet works fine. >> Turns out landisk uses arch/sh/drivers/pci/fixups-landisk.c to fixup >> the irq... >> >> arch/sh/include/mach-common/mach/r2d.h has: >> #define R2D_FPGA_IRQ_BASE 100 >> Subtracting 16 here does not help. > > Why subtract when you contrariwise need to add? :-) > >> With this (gmail-whitespace-damaged) patch: >> >> --- a/arch/sh/drivers/pci/fixups-rts7751r2d.c >> +++ b/arch/sh/drivers/pci/fixups-rts7751r2d.c >> @@ -31,9 +31,9 @@ static char lboxre2_irq_tab[] = { >> int pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) >> { >> if (mach_is_lboxre2()) >> - return lboxre2_irq_tab[slot]; >> + return lboxre2_irq_tab[slot] - 16; > > This table contains the values #define'd via evt2irq(), so > shouldn't need to subtract anything... > >> else >> - return rts7751r2d_irq_tab[slot]; >> + return rts7751r2d_irq_tab[slot] - 16; > > How about + 16? > >> } >> >> int pci_fixup_pcic(struct pci_channel *chan) >> >> it no longer crashes, but ifconfig still fails: >> >> / # ifconfig eth0 up >> ifconfig: ioctl 0x8914 failed: Invalid argument > > I'm still not sure you used the correct IRQ #s... > >> Note that there are more implementations of pcibios_map_platform_irq() >> that do not use evt2irq(), and thus are probably broken by this patch. > > That doesn't sound encouraging... :-/ Actually, of those only Dreamcast didn't use evt2irq()... Now I'm wondering whether all #define *_IRQ_BASE should be visited as well... >> Gr{oetje,eeting}s, >> >> Geert MBR, Sergey