From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D477C433F5 for ; Mon, 27 Sep 2021 19:43:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E61AE60F41 for ; Mon, 27 Sep 2021 19:43:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236543AbhI0Tpa (ORCPT ); Mon, 27 Sep 2021 15:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhI0Tp3 (ORCPT ); Mon, 27 Sep 2021 15:45:29 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4270BC061575; Mon, 27 Sep 2021 12:43:51 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id on12-20020a17090b1d0c00b001997c60aa29so556450pjb.1; Mon, 27 Sep 2021 12:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0x+V42D6Bf0K2yZWxaHhVhsrmnmQNu3p4zZUp5NMctA=; b=PibCyo86mHii5K/AK9XV+KKAKC0dBj6/pduQ5cDs16CJnwJDoLbOjU6nqHzb+b5Elu tPjP1pLV+3t6rGLaF+JoXoIrDNw1HCo3U3LJn6F2G2hHbTIJEunAImPvHic8uVT+mIqi M9lbj69AEKQbP4fzAtg6pKE1jeEJLJG4zxpC3BaIHBpeKHaJlbHaHQThE30gWFDPSGW5 3SGEXQMbTLjnoy/PAnG+jiuM1L6ukTH8eXyA0LtilgHQUFULKCAesrW3hb+/+0zczPCW elFZoEHegN6ZbVzMZTpSj12JLZlonuf2WHzhW2yB4e5ospKCU6rA68ryzxXp4QlIFRRo wETg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0x+V42D6Bf0K2yZWxaHhVhsrmnmQNu3p4zZUp5NMctA=; b=J3p/w7H+OsVh1nVrhtTGrnO2EhQhXBgMmL6LsIym0JkpV9eeLcAUocYmAvIB+CTl+y XY6WXRZbfM7d5KaasJy0nPPRzqBG7YaSwuVphOH0wTlFWM+ygWGfIq0J9cQ0VuJxS3SW x84nxQW0CIydHhd8CcT0t2HBfRzihKDqSM4fs9nfPrVmVv6+hqpZLGdcQV6Ky3/OjFwm zzOvMqsV+kL2grqHcFF2DJ9gpnwy/87+1d7EM0igLzS9Rljae95PMnZDZOHB/Gz9XlD2 FOkS4o+ig/iBQEmyNAFQNTLuwW8Z+BV2qxS508jbszFufxd+ReacsX8NOLY6AqlhkIg8 kytQ== X-Gm-Message-State: AOAM531GwyBchY3wFuk2ZW4rh0eqh3dnjpbxYn09p/V5NY/9EG0qgRFc SmeA+Wug6iQ68cCTZ53lMrKBxHI+bNI= X-Google-Smtp-Source: ABdhPJxCD6ZuM4lslZgbWpZTP5mGztKXzC5w2f+4Nr7znYRkPYcaszyFAQD/qGur8+La8Z//mJilUA== X-Received: by 2002:a17:90a:190:: with SMTP id 16mr926669pjc.152.1632771830388; Mon, 27 Sep 2021 12:43:50 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id p48sm17918097pfw.160.2021.09.27.12.43.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 12:43:49 -0700 (PDT) Subject: Re: [PATCH 01/11] arch: Export cpu_logical_map to modules To: Rob Herring Cc: "linux-kernel@vger.kernel.org" , Russell King , Ray Jui , Scott Branden , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , Catalin Marinas , Will Deacon , Yoshinori Sato , Rich Felker , Thomas Gleixner , Marc Zyngier , Frank Rowand , Ard Biesheuvel , Mike Rapoport , Linus Walleij , Andrew Morton , Geert Uytterhoeven , Arnd Bergmann , Guenter Roeck , Kefeng Wang , Mark Rutland , Andrey Konovalov , Anshuman Khandual , Valentin Schneider , Ingo Molnar , Peter Zijlstra , "moderated list:ARM PORT" , "open list:SUPERH" , "open list:BROADCOM BMIPS MIPS ARCHITECTURE" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" References: <20210924170546.805663-1-f.fainelli@gmail.com> <20210924170546.805663-2-f.fainelli@gmail.com> From: Florian Fainelli Message-ID: <69444f17-91a7-69cc-14f8-7501443064ec@gmail.com> Date: Mon, 27 Sep 2021 12:43:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On 9/27/21 12:32 PM, Rob Herring wrote: > On Fri, Sep 24, 2021 at 12:06 PM Florian Fainelli wrote: >> >> In order to allow drivers/irqchip/irq-bcm7038-l1.c to be built as a >> module and usable in GKI, export cpu_logical_map or __cpu_logical_map >> towards the modules. > > This is the usage: > > #ifdef CONFIG_SMP > cpu = intc->cpus[cpu_logical_map(smp_processor_id())]; > #else > cpu = intc->cpus[0]; > #endif > > This is totally broken! cpu_logical_map() takes the logical cpu > number, 0-N, and returns the MPIDR which you then use as an array > index. There is no MPIDR on MIPS, which is where this code is being primarily used as-is. On ARM/ARM64 the driver is used as a second level interrupt controller with only a single "bank" of registers as opposed to one per-CPU, meaning that we would always use intc->cpus[0] because you cannot change the interrupt affinity of a second level interrupt controller AFAICT. Maybe the above deserves to be made CONFIG_SMP && CONFIG_MIPS somehow. -- Florian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CABBCC433EF for ; Mon, 27 Sep 2021 19:45:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89EC360F41 for ; Mon, 27 Sep 2021 19:45:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 89EC360F41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=M7Qqed/WCITRDHg/YPsb8ZAZSqyErKgd85dSAZ6PSS0=; b=KRZLv1ZHT6CPe8h1vP3G7luVQI j3Wsp/SiXrD0qGlFRrB53v8i7RSorANIVcFo5vIQvZiXbC0jQ54JDULga+QHPOUa0HA72EIrXiQWZ zNF3OCtSvdo5DSNXatiUx37ebzMROC1nOfMLx3biLuUhwNaQdCQVW/C9JHZLwoOGPuDtZdRW/p56/ 6XiYJZ8/ETbGmgJgZch+kTy1ndM/jci6ke8uM57rcru0ECp3zkAsrkpgloTnjiHYflJZD/FaPVlyv 46BlJybOLSw9fIoziRvJWw6oiO2NK5HTSAhvtw3sz5XquVg0RQWUeZlOUhh0HNKi6nqhK57EqMVL+ U/fJhQnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUwXd-0041Zp-PL; Mon, 27 Sep 2021 19:43:58 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUwXZ-0041Yk-WD for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 19:43:55 +0000 Received: by mail-pl1-x635.google.com with SMTP id x8so9689106plv.8 for ; Mon, 27 Sep 2021 12:43:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0x+V42D6Bf0K2yZWxaHhVhsrmnmQNu3p4zZUp5NMctA=; b=PibCyo86mHii5K/AK9XV+KKAKC0dBj6/pduQ5cDs16CJnwJDoLbOjU6nqHzb+b5Elu tPjP1pLV+3t6rGLaF+JoXoIrDNw1HCo3U3LJn6F2G2hHbTIJEunAImPvHic8uVT+mIqi M9lbj69AEKQbP4fzAtg6pKE1jeEJLJG4zxpC3BaIHBpeKHaJlbHaHQThE30gWFDPSGW5 3SGEXQMbTLjnoy/PAnG+jiuM1L6ukTH8eXyA0LtilgHQUFULKCAesrW3hb+/+0zczPCW elFZoEHegN6ZbVzMZTpSj12JLZlonuf2WHzhW2yB4e5ospKCU6rA68ryzxXp4QlIFRRo wETg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0x+V42D6Bf0K2yZWxaHhVhsrmnmQNu3p4zZUp5NMctA=; b=djRxa3DWe4Vq8MeumsqScdnZdts4YeKiojsZ7GSCMz3DYtlPLP5Q5N8X0T6ktg3/Mk PcRYaYQcUbBVsRqfva9aXfbVELwzV1ymKAA6m3yI6ISiA3uYD9+hM3mdZ4DMmI+513DU Ace3olWfGNGTJIMkbUiwdVAVrfYXJPMwBz5eySCAyV04VOAFTzXYxr+ydSXN14cEwDXZ SYvre3JJBc3jXfgPN4F6+GzBGI2SuhFdz8PxKU6r46yxcdaRWqCSeIGItYWIBP/QPfBG jSuQ6E2i8BeZ9YPMM1g2fvvbJ/J886MgzMMoDpDdSEtcXJm5cHi9e0jQ9Q4BiYDX1/Kr dtWg== X-Gm-Message-State: AOAM533QWxEWoH7uHW0FfUpG4On8ceXkjtu9pXPNXg2Ae+Xx/iKov40R v/048fZPjqFGbg3+b2pAZSY= X-Google-Smtp-Source: ABdhPJxCD6ZuM4lslZgbWpZTP5mGztKXzC5w2f+4Nr7znYRkPYcaszyFAQD/qGur8+La8Z//mJilUA== X-Received: by 2002:a17:90a:190:: with SMTP id 16mr926669pjc.152.1632771830388; Mon, 27 Sep 2021 12:43:50 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id p48sm17918097pfw.160.2021.09.27.12.43.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 12:43:49 -0700 (PDT) Subject: Re: [PATCH 01/11] arch: Export cpu_logical_map to modules To: Rob Herring Cc: "linux-kernel@vger.kernel.org" , Russell King , Ray Jui , Scott Branden , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , Catalin Marinas , Will Deacon , Yoshinori Sato , Rich Felker , Thomas Gleixner , Marc Zyngier , Frank Rowand , Ard Biesheuvel , Mike Rapoport , Linus Walleij , Andrew Morton , Geert Uytterhoeven , Arnd Bergmann , Guenter Roeck , Kefeng Wang , Mark Rutland , Andrey Konovalov , Anshuman Khandual , Valentin Schneider , Ingo Molnar , Peter Zijlstra , "moderated list:ARM PORT" , "open list:SUPERH" , "open list:BROADCOM BMIPS MIPS ARCHITECTURE" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" References: <20210924170546.805663-1-f.fainelli@gmail.com> <20210924170546.805663-2-f.fainelli@gmail.com> From: Florian Fainelli Message-ID: <69444f17-91a7-69cc-14f8-7501443064ec@gmail.com> Date: Mon, 27 Sep 2021 12:43:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_124354_073638_BE3AFE40 X-CRM114-Status: GOOD ( 19.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/27/21 12:32 PM, Rob Herring wrote: > On Fri, Sep 24, 2021 at 12:06 PM Florian Fainelli wrote: >> >> In order to allow drivers/irqchip/irq-bcm7038-l1.c to be built as a >> module and usable in GKI, export cpu_logical_map or __cpu_logical_map >> towards the modules. > > This is the usage: > > #ifdef CONFIG_SMP > cpu = intc->cpus[cpu_logical_map(smp_processor_id())]; > #else > cpu = intc->cpus[0]; > #endif > > This is totally broken! cpu_logical_map() takes the logical cpu > number, 0-N, and returns the MPIDR which you then use as an array > index. There is no MPIDR on MIPS, which is where this code is being primarily used as-is. On ARM/ARM64 the driver is used as a second level interrupt controller with only a single "bank" of registers as opposed to one per-CPU, meaning that we would always use intc->cpus[0] because you cannot change the interrupt affinity of a second level interrupt controller AFAICT. Maybe the above deserves to be made CONFIG_SMP && CONFIG_MIPS somehow. -- Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel