Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp665143pxk; Wed, 16 Sep 2020 13:48:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5Zsag3dFrO9BBr0wM8DoksgKecEz+OIiufWZrJu+WLB1nuvOh1C06GlPxuOkGnV34qNrk X-Received: by 2002:a17:906:1115:: with SMTP id h21mr28042151eja.273.1600289281620; Wed, 16 Sep 2020 13:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600289281; cv=none; d=google.com; s=arc-20160816; b=ecOmyWarPyPhrB5XaSZGHDTpsrhLe8F5M4vQe6l0C05Ybdmd00+yCGB+lyxCBHFl9H LsRhqelnuZTwXXvQP+heqe+BdUX970Mi2Q1F3OZGYT5Sw3EweQdirl5AkJK9nknnZowZ ivcp3WfwkUTF+FJVRhR3XXOxXgVVygyp3yw8moiHUKd6QfD0WIl5EwnBu0mqESTqGwdj kIAmgLJkTfZzms0p7zwc0AHMOgAIhgGcpZ4PuaiLPkTjdD6rufem5bFGev4YuO16oqDT ValD63WyuzOO0l38woLln3mS7pqCbNozeXKunK5AyyUfHAhJUe7MpqZDLAVq2tgpjayk q+UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=c2iDasbkZVNErFB79NZ2N/zPCxh2LDJWL0dq/+jc1FE=; b=ylZO7WSGHOh4IoN72aKR43d9F/x/SoVbbS4Wn2l17x0mYM5YJly867bDas5ylK5X9e jyHlMq8rQ64AsQ29g9BHtkXam6G5vVzhZITrbykIxNXNIh5ylOhkuJ8LXI9hMz2ge8ki t2tkeko9x7tDr5WtUPHateZDVS64fFtyJsyTCbn02N4yJgfWmfnG/2jowg815YG28oiv MkngCPg+kGyGnwNMdnmhi88QPZZWPBuRmpk8jfbmTLcb6rFDZLOYR0tVNPBOBvpURtsw hmZX9aHbevASJCSCmUUhXojQQfYKO9oZmbzDdnfD10jcPzETaBCEx8V0YUDLPsrn6RyU k2FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VFm5xthD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si12965505edq.190.2020.09.16.13.47.37; Wed, 16 Sep 2020 13:48:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VFm5xthD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726802AbgIPUqe (ORCPT + 99 others); Wed, 16 Sep 2020 16:46:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbgIPRBY (ORCPT ); Wed, 16 Sep 2020 13:01:24 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9422A22269; Wed, 16 Sep 2020 16:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600273332; bh=ofZ93zkuPA7HdZCkjida7JnI60DedvmWp5EJqE+bzso=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VFm5xthDXibPOv12hXwEKYdPy8HCGIhb7X5WnxZK7b/50VYnkKm6pDvH0Z+O8iXIn gzh+PjhDuqUyaZrC9fz5gGupgR5BeAaqmQ/cAHpBlSjMO7EIFEpQHc92QBJ0g94mRO CqaeUm/pkwnmWIFM9bHm/KemPiXRGe+iMKoQhfIA= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kIaCA-00CNeB-Mt; Wed, 16 Sep 2020 17:22:10 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 16 Sep 2020 17:22:10 +0100 From: Marc Zyngier To: Jon Hunter Cc: Sumit Garg , linus.walleij@linaro.org, Florian Fainelli , Russell King , Jason Cooper , Saravana Kannan , Andrew Lunn , Catalin Marinas , Gregory Clement , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Will Deacon , 'Linux Samsung SOC' , linux-tegra , Thomas Gleixner , kernel-team@android.com, Valentin Schneider , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Subject: Re: [PATCH v3 08/16] irqchip/gic: Configure SGIs as standard interrupts In-Reply-To: References: <20200901144324.1071694-1-maz@kernel.org> <20200901144324.1071694-9-maz@kernel.org> <933bc43e-3cd7-10ec-b9ec-58afaa619fb7@nvidia.com> <3378cd07b92e87a24f1db75f708424ee@kernel.org> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <13c096832bd923f956ddd7db7e337857@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: jonathanh@nvidia.com, sumit.garg@linaro.org, linus.walleij@linaro.org, f.fainelli@gmail.com, linux@arm.linux.org.uk, jason@lakedaemon.net, saravanak@google.com, andrew@lunn.ch, catalin.marinas@arm.com, gregory.clement@bootlin.com, b.zolnierkie@samsung.com, linux-kernel@vger.kernel.org, krzk@kernel.org, will@kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, tglx@linutronix.de, kernel-team@android.com, Valentin.Schneider@arm.com, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-16 16:58, Jon Hunter wrote: > On 16/09/2020 16:55, Marc Zyngier wrote: >> On 2020-09-16 16:46, Jon Hunter wrote: >>> On 16/09/2020 16:10, Marc Zyngier wrote: >>>> Hi Jon, >>>> >>>> +Linus, who is facing a similar issue. >>>> >>>> On 2020-09-16 15:16, Jon Hunter wrote: >>>>> Hi Marc, >>>>> >>>>> On 14/09/2020 14:06, Marek Szyprowski wrote: >>>>>> Hi Marc, >>>>>> >>>>>> On 01.09.2020 16:43, Marc Zyngier wrote: >>>>>>> Change the way we deal with GIC SGIs by turning them into proper >>>>>>> IRQs, and calling into the arch code to register the interrupt >>>>>>> range >>>>>>> instead of a callback. >>>>>>> >>>>>>> Reviewed-by: Valentin Schneider >>>>>>> Signed-off-by: Marc Zyngier >>>>>> This patch landed in linux next-20200914 as commit ac063232d4b0 >>>>>> ("irqchip/gic: Configure SGIs as standard interrupts"). Sadly it >>>>>> breaks >>>>>> booting of all Samsung Exynos 4210/4412 based boards (dual/quad >>>>>> ARM >>>>>> Cortex A9 based). Here are the last lines from the bootlog: >>>>> >>>>> I am observing the same thing on several Tegra boards (both arm and >>>>> arm64). Bisect is pointing to this commit. Reverting this alone >>>>> does >>>>> not >>>>> appear to be enough to fix the issue. >>>> >>>> Right, I am just massively by the GICv3 spec, and failed to remember >>>> that ye olde GIC exposes the source CPU in AIR *and* wants it back, >>>> while >>>> newer GICs deal with that transparently. >>>> >>>> Can you try the patch below and let me know? >>> >>> Yes will do. >>> >>>> @@ -365,14 +354,13 @@ static void __exception_irq_entry >>>> gic_handle_irq(struct pt_regs *regs) >>>>              smp_rmb(); >>>> >>>>              /* >>>> -             * Samsung's funky GIC encodes the source CPU in >>>> -             * GICC_IAR, leading to the deactivation to fail if >>>> -             * not written back as is to GICC_EOI.  Stash the >>>> -             * INTID away for gic_eoi_irq() to write back. >>>> -             * This only works because we don't nest SGIs... >>>> +             * The GIC encodes the source CPU in GICC_IAR, >>>> +             * leading to the deactivation to fail if not >>>> +             * written back as is to GICC_EOI.  Stash the INTID >>>> +             * away for gic_eoi_irq() to write back.  This only >>>> +             * works because we don't nest SGIs... >>>>               */ >>>> -            if (is_frankengic()) >>>> -                set_sgi_intid(irqstat); >>>> +            this_cpu_write(sgi_intid, intid); >>> >>> I assume that it should be irqstat here and not intid? >> >> Indeed. As you can tell, I haven't even tried to compile it, sorry >> about >> that. > > No worries, I got the gist. However, even with this change, it still > does not boot :-( Do you boot form EL2? If so, you'd also need this: static void gic_eoimode1_eoi_irq(struct irq_data *d) { + u32 hwirq = gic_irq(d); + /* Do not deactivate an IRQ forwarded to a vcpu. */ if (irqd_is_forwarded_to_vcpu(d)) return; + if (hwirq < 16) + hwirq = this_cpu_read(sgi_intid); + writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_DEACTIVATE); } If none of that works, we'll need some additional traces. On the other hand, I just booted this on a GICv2-based system, and it worked fine... M. -- Jazz is not dead. It just smells funny...