Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp184706pxb; Thu, 21 Jan 2021 04:48:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZdJdH9THE7wIMUsmyFPKqBGvLa1nBBQBIDbji20F9aM24dKmi3gC32vhjVXvWxyl5zV6V X-Received: by 2002:a05:6402:70a:: with SMTP id w10mr11239623edx.184.1611233332414; Thu, 21 Jan 2021 04:48:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611233332; cv=none; d=google.com; s=arc-20160816; b=sNnF1TA1Htp48N/dAPR2hadk7yWEIxpfF+5QGN/HK86m+EvTiUYhLkWSOiHvdF+meG Y/vEv7fYPLmutvuD/3+OR/XND0RsihOj8PVkXYK4V4OFxdMJ7fiBzXINWx8L1KrZOZIx f9Y+OBnenMtH+DMD/kvJabmE/z4Se58lQDCEdSknoirxkj8SOG9QIFQ9Uv9sYLLGGAb4 pPkKmLQI9Y7SDRSY0Lo9HB6EHeESz/KtneclERBwTNyPSPjMgzXIgIssJ8pQ+QzQnV5W wFTlX2JkVUzdwuht0TczkxGJSeIwvcZgm7WHo2iuiBC5i/CVSDPw4DvBYvjIDwUObQwA BuZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OKBReoQcJeXatuKO1lMcz8v9ry3QkXn57VFCaOYrU5E=; b=zi+LEQNc9u2lFp0nPKzNX+vZD41yP6+JVsFhgZSgKeMRR0UN6x5OoMFbG+5F8S/Osj sLvrIa+S3pDEy6+cOu40aeclpBTwhaiTR3QMEenDB4TzmF0uYJLrQZeHw37WY7iSxaI1 BNc3xAthlJahplhXzfF0xV15Y9DSoPEFwyZCIybzDxr4VApM7/Na6z469i6mu7YJBdkl FxyiAn9FdMjG28JaE991uGMbOZSApKPt6nT6OMUlTcJGVQzpkv7MMspYG/TuSa5sWsBO vQB9g1m/JJ2h2gUVpA0T3gX7lmK08u3y0d0v3twMcQ6QSl1CrgFVWpYkJYL5J9763XlZ IVTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TBr3PDGj; 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 e4si2127222edk.306.2021.01.21.04.48.28; Thu, 21 Jan 2021 04:48:52 -0800 (PST) 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=k20201202 header.b=TBr3PDGj; 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 S1731060AbhAUMru (ORCPT + 99 others); Thu, 21 Jan 2021 07:47:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:60288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731298AbhAUMpQ (ORCPT ); Thu, 21 Jan 2021 07:45:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3E20239FF for ; Thu, 21 Jan 2021 12:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611233074; bh=myULDxLA57azPbQV/b8fZy9KYbD60iB/nUkEu01fjvc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TBr3PDGjSGNlQHaYgWN56fsatwC3dfS9HVIUCDgezfKgOFXzA7Db3bxB6hvWkhee2 MMArq9NgrkuINVYKQ/26jtPQxWBoyHGrIGNcFBrD8B/5xV84ADsaJ60AXLu70T4Y9y ZsD+K0SexIZZ+Nd1zHQueQOOPa6TXYZzW8Km848tMlVlmM7DHj5X9WG2JIc3d2d/OG j+g2FwSUMXqjjUbzWyv1j5ZyDFQB8tc6Sq7VJJIq+b8DTG7vw1IxQqOmGDZFIiNSQm 21ogVXjQ6EIYcz90a+N2DWVDZDhc2ft0/0ln0MuoEqzGTm+VT5biJZ+vuqq2mV6qsG XJrd/Hp6sT7lA== Received: by mail-ot1-f48.google.com with SMTP id v1so1425970ott.10 for ; Thu, 21 Jan 2021 04:44:34 -0800 (PST) X-Gm-Message-State: AOAM530PHLc4rqr5/p01Dz4iz14MUfqdBvq9DwKQKn4AHUkMOHwWStvb yEjd/p77OH3jo26gw/9AiOjRL/95NpBcz1v30iI= X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr10307664otq.305.1611233073918; Thu, 21 Jan 2021 04:44:33 -0800 (PST) MIME-Version: 1.0 References: <20210120132717.395873-1-mohamed.mediouni@caramail.com> <20210120132717.395873-8-mohamed.mediouni@caramail.com> In-Reply-To: <20210120132717.395873-8-mohamed.mediouni@caramail.com> From: Arnd Bergmann Date: Thu, 21 Jan 2021 13:44:17 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 7/7] irqchip/apple-aic: add SMP support to the Apple AIC driver. To: Mohamed Mediouni Cc: Linux ARM , Mark Rutland , Catalin Marinas , Hector Martin , "linux-kernel@vger.kernel.org" , Marc Zyngier , Will Deacon , Stan Skowronek Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 2:27 PM Mohamed Mediouni wrote: > +#ifdef CONFIG_SMP > +static void apple_aic_ipi_send_mask(struct irq_data *d, > + const struct cpumask *mask) Not sure we care about the #ifdef here, given that arch/arm64 does not allow building a kernel without CONFIG_SMP. > + /* > + * Ensure that stores to Normal memory are visible to the > + * other CPUs before issuing the IPI. > + */ > + wmb(); > + > + for_each_cpu (cpu, mask) { > + smp_mb__before_atomic(); > + atomic_or(1u << irqnr, per_cpu_ptr(&aic_ipi_mask, cpu)); > + smp_mb__after_atomic(); > + lcpu = get_cpu(); > + if (aic.fast_ipi) { > + if ((lcpu >> 2) == (cpu >> 2)) > + write_sysreg(cpu & 3, SR_APPLE_IPI_LOCAL); > + else > + write_sysreg((cpu & 3) | ((cpu >> 2) << 16), > + SR_APPLE_IPI_REMOTE); > + } else > + writel(lcpu == cpu ? REG_IPI_FLAG_SELF : > + (REG_IPI_FLAG_OTHER << cpu), > + aic.base + REG_IPI_SET); > + put_cpu(); > + } > + > + /* Force the above writes to be executed */ > + if (aic.fast_ipi) > + isb(); > +} Since this just loops over all CPUs, I'd probably just turn it into an ipi_send_single() callback and have the caller do the loop for simplicity. I also have the feeling that splitting one hardware IPI into multiple logical interrupts, which are then all registered by the same irq handler adds a little more complexity than necessary. Changing this would of course require modifications to arch/arm64/kernel/smp.c, which is hardwired to use CONFIG_GENERIC_IRQ_IPI in smp_cross_call(), and allowing a different code path there may be worse than emulating an irqchip. > @@ -186,8 +325,11 @@ static int __init apple_aic_init(struct device_node *node, > if (WARN(!aic.base, "unable to map aic registers\n")) > return -EINVAL; > > + aic.fast_ipi = of_property_read_bool(node, "fast-ipi"); Where is this property documented, and what decides which one to use? Arnd