Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp359623rdb; Thu, 19 Oct 2023 06:43:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHItGehcObK1XMYvwHeSFlA+a58R32ROOvK9BMhIH6KBcGd4e1HQLMYyfXl0LZBULSfL43h X-Received: by 2002:a17:902:cacc:b0:1ca:2c3b:7747 with SMTP id y12-20020a170902cacc00b001ca2c3b7747mr2045016pld.20.1697723018820; Thu, 19 Oct 2023 06:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697723018; cv=none; d=google.com; s=arc-20160816; b=TeeLlL8sRYt/6gNyeU2jTpG2jCJDQGLwzJoXga1bgU9HMgy5fujjv9GJOD8s8mWuR9 4WIwOuN+FGlKwkWO4rdv335gPIdy3RHh8lpzfoiXkL0bU9w5DwbAvBGe0YBewvuxTOJu nhkj4vdR3sWEagYDJXbO3GYf9z4INPXrcmMa9pGZhmBlcP62uw00p1tJgn/uVsHLP2wP TxGHPyRpjY15tEZ+5Z21i0F7pkFG31SU6NCU/FTTYIFS8Omh1ahWNvz8fD7G0J7YzGQC A64uzo6IhSPRapX27eb4O7K+dD5QA5Ag8+2hdXs/spB/tCE/91GMarOSLyEvPJlIZ4Ny SKgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=razMnh9Rs1eAuggmWt/P4RosUJ9WgLxdz50mf8Ps6Gs=; fh=tMdyZhaSnvgAzBzeiZFEu9kKQ/zRY7E0qVYDoRy+pvg=; b=NWRHZfTmtAkt8E5llJdLJs4nd74i8QIycAhGG/HFtP/pjiTG2Rxrf4dU1bQGsVtdyT x3+wtM8K5DgzalSrX49Do46LF4MvM0BGRfK5Es6kRqIu8GZH9W76DUVKKvjl16X4o97h Z2bxJoyUQ3AiUNjDYn9B8tvQps6xajCB3mLImFNnpuOqFATZvHNtb1iVe9vWRWA/GDwx pWdGp1YYDWNqnU4c9Hx5H1Jq04spSbCD50+eOKTxu8n5eD5nbjsmRVjkzQ7jq1JTxDvn 2KKY5ZxgbqzkFBquXQn5h5HlnNenh08mni1VY58AMnlmd5IMCHZKG2HszwjK4mbMSyAW TVmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gnP8+wBb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m11-20020a170902768b00b001ae40e07fb0si2147179pll.216.2023.10.19.06.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 06:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gnP8+wBb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EEFC7829C994; Thu, 19 Oct 2023 06:43:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345730AbjJSNnY (ORCPT + 99 others); Thu, 19 Oct 2023 09:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235400AbjJSNnX (ORCPT ); Thu, 19 Oct 2023 09:43:23 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF99124 for ; Thu, 19 Oct 2023 06:43:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3421C433C7; Thu, 19 Oct 2023 13:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697723001; bh=fNfzoqPWnxpHpfpwgiuXewdIuM9DFInylMJTHvvmILo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=gnP8+wBbAkOCOyn5Cg5KbPb8++KjWQ/7lQ8rMIHckwlmX3FAW8KMQ2GTkslW8Al6/ mmftTT6QyTe6Mjvc6xY6mrGooWm7sMVOQPZZCY5kuoW2yCsPjlS7krk1kygXEyjaXb S8oBOu+WISWZ+MQqb8+9fvujWdfgAiKfFr11gGqK4cSCWF/u0pkuHVszXHiBfRqhHN AtTEl6DdBvJC5vJn8aV+CyLDKQIG7ZueP/60QBRmneObNlEjVhAECF8e3NOoTEWbCG AXHggYFB9W9q81QusyURho5DJ5I/l3MQcc+ItbdFzGERTmDLY2hH0tbzgG/B/YxVuo KFtHBZjP8X8Gw== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Anup Patel , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley Cc: Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel Subject: Re: [PATCH v10 00/15] Linux RISC-V AIA Support In-Reply-To: <20231003044403.1974628-1-apatel@ventanamicro.com> References: <20231003044403.1974628-1-apatel@ventanamicro.com> Date: Thu, 19 Oct 2023 15:43:18 +0200 Message-ID: <87o7gu7mo9.fsf@all.your.base.are.belong.to.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 06:43:36 -0700 (PDT) Hi Anup, Anup Patel writes: > The RISC-V AIA specification is ratified as-per the RISC-V international > process. The latest ratified AIA specifcation can be found at: > https://github.com/riscv/riscv-aia/releases/download/1.0/riscv-interrupts= -1.0.pdf > > At a high-level, the AIA specification adds three things: > 1) AIA CSRs > - Improved local interrupt support > 2) Incoming Message Signaled Interrupt Controller (IMSIC) > - Per-HART MSI controller > - Support MSI virtualization > - Support IPI along with virtualization > 3) Advanced Platform-Level Interrupt Controller (APLIC) > - Wired interrupt controller > - In MSI-mode, converts wired interrupt into MSIs (i.e. MSI generator) > - In Direct-mode, injects external interrupts directly into HARTs Thanks for working on the AIA support! I had a look at the series, and have some concerns about interrupt ID abstraction. A bit of background, for readers not familiar with the AIA details. IMSIC allows for 2047 unique MSI ("msi-irq") sources per hart, and each MSI is dedicated to a certain hart. The series takes the approach to say that there are, e.g., 2047 interrupts ("lnx-irq") globally. Each lnx-irq consists of #harts * msi-irq -- a slice -- and in the slice only *one* msi-irq is acutally used. This scheme makes affinity changes more robust, because the interrupt sources on "other" harts are pre-allocated. On the other hand it requires to propagate irq masking to other harts via IPIs (this is mostly done up setup/tear down). It's also wasteful, because msi-irqs are hogged, and cannot be used. Contemporary storage/networking drivers usually uses queues per core (or a sub-set of cores). The current scheme wastes a lot of msi-irqs. If we instead used a scheme where "msi-irq =3D=3D lnx-irq", instead of "lnq-irq =3D {hart 0;msi-irq x , ... hart N;msi-irq x}", there would be a lot MSIs for other users. 1-1 vs 1-N. E.g., if a storage device would like to use 5 queues (5 cores) on a 128 core system, the current scheme would consume 5 * 128 MSIs, instead of just 5. On the plus side: * Changing interrupts affinity will never fail, because the interrupts on each hart is pre-allocated. On the negative side: * Wasteful interrupt usage, and a system can potientially "run out" of interrupts. Especially for many core systems. * Interrupt masking need to proagate to harts via IPIs (there's no broadcast csr in IMSIC), and a more complex locking scheme IMSIC Summary: The current series caps the number of global interrupts to maximum 2047 MSIs for all cores (whole system). A better scheme, IMO, would be to expose 2047 * #harts unique MSIs. I think this could simplify/remove(?) the locking as well. I realize that the series in v10, and coming with a change like this now might be a bit of a pain... Finally, another question related to APLIC/IMSIC. AFAIU the memory map of the IMSIC regions are constrained by the APLIC, which requires a certain layout for MSI forwarding (group/hart/guest bits). Say that a system doesn't have an APLIC, couldn't the layout requirement be simplified? Again, thanks for the hard work! Bj=C3=B6rn