Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp745490ybm; Fri, 29 May 2020 11:08:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS3rJBrUvhYn+5DYGLBoNi8J37HjkqGiPRLK4saGImNBFb4bf+yFHqS/Uxr/NXXLTrmOoU X-Received: by 2002:a17:906:5e05:: with SMTP id n5mr4599820eju.278.1590775701676; Fri, 29 May 2020 11:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590775701; cv=none; d=google.com; s=arc-20160816; b=XdBh7Fqa5QDu+4FuekLlY8sQDwg/4zgq1tUQEXOZRGvBhiR4t7ht30tHIbcR3sC+bs 70m703GbLDQWt+DfwKoVeWQGKv55mGM5OllFdco9fBku7z2uw/lsGyAvTL/49HvNhvWy T+fnDu6KNQJRHC5Cwo7HQcyA+SjtKGaoW8No52ltXERvZpF7tR0NtxwFOsPlo+5JLWvY uOyVWCeYCQGAqTdbeuxAuEQb+TF4xhSdC8jBniLwP8Sfm4iXajEdY5CgRMK/FjNwCCXb cAg5psEfix11vNSqpbYe8TmDGJpv2zLgwerSmAiW4bYl0h7/NBOeyvRA60pSSEz5VR5n hHQw== 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:autocrypt:from:references:cc:to:subject:dkim-signature; bh=SiB7HET2dLvdlmmU4DX5gmb+mL1M6obOE7qdN1rHGNg=; b=QR2t4+eIzhzVWzDFgE1mXSvbIVWjfEyIctq2n3+x60pcFqWPyea/aXMydFQwb4N8VT wZ1YdX8he1NuriD3JXV0/Hz2EnQ+6q6amsh4afXdFxLKzND3JDJotZZTpsRgQ44SsJVu pKSulm6NTJg6k90vyqna+OhDLQyEYEdd573hDvJRjrMXTIiZLrddVpK7HNA5SNsbiIJ1 2e1IBpIl32c5eUeBd6cDzzoIEorIfklHrFiehk+OBOJnvcHfA6g9c5dHYWJoJGJIGGf8 1BgtJs2/QMlbPULJcYlNpMStZZpYAlP49PDO5Ljep8NlG1VEXCMc3O6qWYQf1vD9fdOJ BXxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g+JcM8es; 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 ci9si3661773ejb.218.2020.05.29.11.07.57; Fri, 29 May 2020 11:08:21 -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=g+JcM8es; 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 S1727112AbgE2SD4 (ORCPT + 99 others); Fri, 29 May 2020 14:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725808AbgE2SD4 (ORCPT ); Fri, 29 May 2020 14:03:56 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D80CBC03E969; Fri, 29 May 2020 11:03:55 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id be9so2417331edb.2; Fri, 29 May 2020 11:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SiB7HET2dLvdlmmU4DX5gmb+mL1M6obOE7qdN1rHGNg=; b=g+JcM8esIk55PDKHgHqGEM5/WOea6axPRjT/TyFWtQH74h7F/44gAtRFeRLdQv6t60 vIkf0wIjSsTGP/rlmlMelaPjtWGN5PLa14LT54AI3xBLGXmmixkmqXdefLForDXQH6Ia Lbc6l0VVpnjfj7Gm/OdnjnrtQ67JYXo62mtUW2XVxM+Dio4+NhuQsaGK05S1NmD2hmPZ AD5IZsqvgfYZ6eij0ie/rR4l52Y8lTGzV2eP0HoGebb9AUDG0IeNAq5HwhiGleVf8B9i IBxbveYCUrbKTOCuOmgsAQkwTFu5qqx8dPa6Hh8m11Cfu+1K6Y0JUCGmHXiwvAT8YjzU lrGg== 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:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=SiB7HET2dLvdlmmU4DX5gmb+mL1M6obOE7qdN1rHGNg=; b=A1CEfsUGgihFKwYaCNiKnKrxf2a+CPSqyELHRxX50Lj0s9sraTUhDdNgIQhK1gwaH5 XIC+NNCNj46xDM1hKbunlYO8+oNEdbrE9gS7LNWKHit35C/VBrGysx4duMJnFId2d1Z9 ImFz8vUnTr0uW8y+7/CDKTRZmnamn+I7XPeCr+qG24fRgBqwZW8RpKvVWvH6ei8gWUJk rrEKHwMxE7r/sUvuneWR8gZswy6a6k5F+4/bOL05st/u8DzH/FnJCPi8gwdeIXCtYc5+ ujl4Yvy5mjSGr6azd/2V+/nDYxxV7fmnjFoH+CaHUvieVwRMfQw50JY4FB4hkSRO18yj ejdg== X-Gm-Message-State: AOAM531ctOEXOOJfJoIwObIHz2CdGbPyeaq8SAQ2TaIZDt7/lgSrmxJD LRFwLjbcLNwtUmT1PLKYIfc3TF49 X-Received: by 2002:a05:6402:1cad:: with SMTP id cz13mr9717939edb.56.1590775433876; Fri, 29 May 2020 11:03:53 -0700 (PDT) Received: from [10.67.49.116] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id m3sm7514272ede.58.2020.05.29.11.03.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 May 2020 11:03:52 -0700 (PDT) Subject: Re: [PATCH] spi: bcm2835: Enable shared interrupt support To: Lukas Wunner Cc: Nicolas Saenz Julienne , Mark Brown , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Martin Sperl , linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20200528185805.28991-1-nsaenzjulienne@suse.de> <20200529174358.som3snunfxch6phi@wunner.de> <36dd65bb-18a9-9697-b9b6-76eaf8cbe45c@gmail.com> <20200529175350.2wtoqttipa354m2m@wunner.de> From: Florian Fainelli Autocrypt: addr=f.fainelli@gmail.com; prefer-encrypt=mutual; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4Z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/S8QUJHlwd3wAKCRBhV5kVtWN2Do+FAJ956xSz2XpDHql+Wg/2qv3b G10n8gCguORqNGMsVRxrlLs7/himep7MrCc= Message-ID: Date: Fri, 29 May 2020 11:03:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200529175350.2wtoqttipa354m2m@wunner.de> Content-Type: text/plain; charset=utf-8 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 5/29/20 10:53 AM, Lukas Wunner wrote: > On Fri, May 29, 2020 at 10:46:01AM -0700, Florian Fainelli wrote: >> On 5/29/20 10:43 AM, Lukas Wunner wrote: >>> On Thu, May 28, 2020 at 08:58:04PM +0200, Nicolas Saenz Julienne wrote: >>>> --- a/drivers/spi/spi-bcm2835.c >>>> +++ b/drivers/spi/spi-bcm2835.c >>>> @@ -379,6 +379,10 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) >>>> if (bs->tx_len && cs & BCM2835_SPI_CS_DONE) >>>> bcm2835_wr_fifo_blind(bs, BCM2835_SPI_FIFO_SIZE); >>>> >>>> + /* check if we got interrupt enabled */ >>>> + if (!(bcm2835_rd(bs, BCM2835_SPI_CS) & BCM2835_SPI_CS_INTR)) >>>> + return IRQ_NONE; >>>> + >>>> /* Read as many bytes as possible from FIFO */ >>>> bcm2835_rd_fifo(bs); >>>> /* Write as many bytes as possible to FIFO */ > [...] >>> Finally, it would be nice if the check would be optimized away when >>> compiling for pre-RasPi4 products, maybe something like: >>> >>> + if (IS_ENABLED(CONFIG_ARM_LPAE) && !(cs & BCM2835_SPI_CS_INTR)) >>> + return IRQ_NONE; >> >> Rather than keying this off ARM_LPAE or any other option, this should be >> keyed off a compatible string, that way we can even conditionally pass >> IRQF_SHARED to the interrupt handler if we care so much about performance. > > But a compatible string can't be checked at compile time, can it? No, but you can have a different interrupt handler that it set at runtime if you want to completely eliminate this comparison. My point is that CONFIG_ARM_LPAE is just too brittle, there is nothing that prevents you from using a non-LPAE kernel on the Pi 4, even PCIe could be made to work if using super section mappings to map the PCIe outbound space. Even on models with over 4GB of DRAM, if you are willing to lose some of it, it can work. > > The point is that at the least the Foundation compiles and ships a separate > kernel for each of the three platforms BCM2835, BCM2837, BCM2711. It's > unnecessary to check whether an interrupt was actually raised if we *know* > in advance that it's not shared (as is the case with kernels compiled for > BCM2835 and BCM2837). I am fine with any solution that does not involve keying off CONFIG_ARM_LPAE to discriminate 2711 from any other chip. -- Florian