Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1417425ybg; Thu, 4 Jun 2020 09:11:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeoYPhw/+4voqHjvSxte6d4/yeYcp3rrB2OH4oHmyahG7tJPJgrQZhqZfgXhyh/9FTTUDG X-Received: by 2002:a50:cc85:: with SMTP id q5mr4801493edi.62.1591287075119; Thu, 04 Jun 2020 09:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591287075; cv=none; d=google.com; s=arc-20160816; b=MKD2+2t4oA7oSyTNZtqyaG8KOk53jVQS3mVALFizfu9Pi47PkijkN1OF/ifpAPE+LK STLwfAcsgWbiQxE5hhmqmQm/vPzKxKMpZUNNh42m6SwRHoihclnn/3bSZhv8LXIYqZzi k1JtypYSi7dvU3Bm5dXblVmsqCgdNLce2f1t0JuN0hz3wqnQ5i4n+fgAvPz8seRPdNbU H011dxKx1AnEBe2bD1oO1GaFiaIlhQ8EGF5eqNzqnBp06y8ruouPvDlbf4cjrQ/BgFiL Wfd0+WZzmHnd/ltGo/TnRGsy6P5lV92fzpl6Wdt5fEGXcXN0ZoA0eI4sP+zeH+rCY02i 7FIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=HAWfVJ/MMzDDKipytKTsDnZ0G7qcc8KGtxLvXJOdNtk=; b=D0RIV3FAUGnOLPSD4shb2W+1zesPCbZW77qh8XyNqg2xDCKt/7u3ohwaTEFS2aXQd3 Zq/wb9BzzkHOGKdSFEzssk+u+LlrRKaIi6IIcY86E6CrzFOxBYlBD+0SxsiUWsnOBCak h8jJ2Lz5GKUQBmReA0SSosMpiatYMFPoTRAbz6QobdQZgY95AWLMpVJ+JqyxPto2WYVs d3IyCnDf0e1oJlstr8va2C07kYiTFZr9p5SZeOHX9uMi6DJ6A9sfwqkqRHuvDQ0cMwIR LHJOhjYZGzjkGlLDeiUU38U6oVL0hh2+NFNtyrOyw8IEft8TXK83z0ClIxMbyGkYaMu5 oxmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Vr/I6zf9"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt2si2342214ejc.596.2020.06.04.09.10.52; Thu, 04 Jun 2020 09:11:15 -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=@gmail.com header.s=20161025 header.b="Vr/I6zf9"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729681AbgFDQFv (ORCPT + 99 others); Thu, 4 Jun 2020 12:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgFDQFu (ORCPT ); Thu, 4 Jun 2020 12:05:50 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF0BC08C5C0; Thu, 4 Jun 2020 09:05:50 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id i12so1311929pju.3; Thu, 04 Jun 2020 09:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HAWfVJ/MMzDDKipytKTsDnZ0G7qcc8KGtxLvXJOdNtk=; b=Vr/I6zf9wpjvEwDaJRBX1+2aezi8wRyFreAa10APW8X1OHOEJVUF5Q7ARa3lfsQxV5 PonhEHPXMbOZ92Hv3xwguR8YsivIs6B6pm4J5X1yPTPMefCXweIlZEILCdduTmW+yxyw OhnEBT4jsdV70Qrr/oA/Ze0IpOOH9DdR2SA5hFnhkya/j7r/2psfkWCwVhcqQIt/xwQy shgoaSohosf7QXYHzM2Sp3IzNFwxzNG2HrlEmLya+hN+YPiSKSe2J76DTQQC9iYlPsjv N7o0wJbseIrr7hrSLutCvvD3KwHNTA/MPX1Ln8fg20ENbh/0qci1FwGRVgYfXf/irWnd uUeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HAWfVJ/MMzDDKipytKTsDnZ0G7qcc8KGtxLvXJOdNtk=; b=KXLP2vJl/fBSDRxvPujOop52zkcrCnQu4buv448yjXQJZ6alvaj4MoGWYBFWpljZSy +I2uT1214BZ0h6Xm+yr7tg3rOZbnbkIZ0Rhl0FkffL9SXNY9Tyb0nu1DGrABJl2N7FV8 4RNNkZpsnrk5cFJ9GgOSQOQ2Ln5f2s3oj9Vg/a5VRXW137E1O0quLAjc1kqsRykoAf2L gmQpTZAy60aeWS55kvQ98njQ9A+xWPYeHfh3W62yqaB9VRB36KdjIq6lyz0+/4ErUI8A 1DGsWwjG0pBl0+/ESv4AEA/Qkw0GELaxyloIBDJaVZz5BGCeUcYD3pXmhBjXsAutiF6m 2tGg== X-Gm-Message-State: AOAM532NjU0I5ExazNOQXGtNEvVtDAMdJancwdvnNbSYn/s9Icdxb3Hg sxUzi7BlZCloEvakxtAFiDc= X-Received: by 2002:a17:90a:5806:: with SMTP id h6mr7122674pji.66.1591286749669; Thu, 04 Jun 2020 09:05:49 -0700 (PDT) Received: from [10.230.188.43] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n8sm5559105pjq.49.2020.06.04.09.05.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jun 2020 09:05:48 -0700 (PDT) Subject: Re: [PATCH 3/3] spi: bcm2835: Enable shared interrupt support To: Mark Brown , Florian Fainelli Cc: linux-kernel@vger.kernel.org, Rob Herring , Nicolas Saenz Julienne , Ray Jui , Scott Branden , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , "open list:SPI SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Martin Sperl , lukas@wunner.de References: <20200604034655.15930-1-f.fainelli@gmail.com> <20200604034655.15930-4-f.fainelli@gmail.com> <20200604123220.GD6644@sirena.org.uk> From: Florian Fainelli Message-ID: <21772111-fa1f-7a50-aa92-e44b09cff4eb@gmail.com> Date: Thu, 4 Jun 2020 09:05:46 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200604123220.GD6644@sirena.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/2020 5:32 AM, Mark Brown wrote: > On Wed, Jun 03, 2020 at 08:46:55PM -0700, Florian Fainelli wrote: >> The SPI controller found in the BCM2711 and BCM7211 SoCs is instantiated >> 5 times, with all instances sharing the same interrupt line. We >> specifically match the two compatible strings here to determine whether >> it is necessary to request the interrupt with the IRQF_SHARED flag and >> to use an appropriate interrupt handler capable of returning IRQ_NONE. > >> For the BCM2835 case which is deemed performance critical, there is no >> overhead since a dedicated handler that does not assume sharing is used. > > This feels hacky - it's essentially using the compatible string to set a > boolean flag which isn't really about the IP but rather the platform > integration. It might cause problems if we do end up having to quirk > this version of the IP for some other reason. I am not sure why it would be a problem, when you describe a piece of hardware with Device Tree, even with the IP block being strictly the same, its very integration into a new SoC (with details like shared interrupt lines) do warrant a different compatible string. Maybe this is more of a philosophical question. > I'm also looking at the > code and wondering if the overhead of checking to see if the interrupt > is flagged is really that severe, it's just a check to see if a bit is > set in a register which we already read so should be a couple of > instructions (which disassembly seems to confirm). It *is* overhead so > there's some value in it, I'm just surprised that it's such a hot path > especially with a reasonably deep FIFO like this device has. If it was up to me, we would just add the check on BCM2835_SPI_CS_INTR not being set and return IRQ_NONE and be done with it. I appreciate that Lukas has spent some tremendous amount of time working on this controller driver and he has a sensitivity for performance. > > I guess ideally genirq would provide a way to figure out if an interrupt > is actually shared in the present system, and better yet we'd have a way > for drivers to say they aren't using the interrupt ATM, but that might > be more effort than it's really worth. If this is needed and there's no > better way of figuring out if the interrupt is really shared then I'd > suggest a boolean flag rather than a compatible string, it's still a > hack but it's less likely to store up trouble for the future. Instead of counting the number of SPI devices we culd request the interrupt first with flags = IRQF_PROBE_SHARED, if this works, good we have a single SPI master enabled, if it returns -EBUSY, try again with flags = IRQF_SHARED and set-up the bcm2835_spi_sh_interrupt interrupt handler to manage the sharing. This would not require DT changes, which is probably better anyway. -- Florian