Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3035735pxb; Fri, 5 Nov 2021 08:43:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxG7comeL0HVDpt7YntnLa1qx9ByzKVphmgD9GfYuhKADWgSfO8q2cn7e2vAoqnOEEX/x7M X-Received: by 2002:a02:cb50:: with SMTP id k16mr4696426jap.37.1636127015202; Fri, 05 Nov 2021 08:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636127015; cv=none; d=google.com; s=arc-20160816; b=h8y4T4vLhBa+3iHDmZBRzp9HcBDWgRKyG8tCoob72O4gD3J1DO41HKO+6joomXQ9bi +H3UJweuhLddl83rYpkuGv4vlG2+cLizTLnFgVE3hxyz1p0qM97C/OuoL1IheaUgf1nZ sItlLQOWRb6sk5g7JXrzpqS19uUTCwsK3aabwFWvrbqZBHq0dcPErFwikB3GPgrnEXZK rwPde6z7DvKJlVxzlz02T9BYXEDYJ/4M94FtWlWaZt/xMvQ69hg46ZnbjTOF3IpJOfw9 Q/0lKi13dOgJtu48HKCgpKspkyEKRuWR+eVKmh0xfwwG+rdVFIr9TjGpkShdum3MRuH6 WhUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=BW2rxoKLWekkvVwrL1DhFg3fP1kthaBhJdECxrV6wYI=; b=cpG3JQb15CGg+QXY5PWfYuF3HO+8xApLV3BWV7ktxB9DL6q4kCpSjD/Av+6mFzz8HH PVRHwZ9ijSQJbqIuuJkSlsekpWyUijB4wOdcN8xBNrWBtwwGDpzP/GuqI0JpC9FM6+5W WHsVFyK1Ns7W5S+KP9bU9l5Zt5aBxXHkQ8FyJeAHQX1ll+KsZIwLGzMngtUzqO0FMOo6 LFdAs9pRqTqPXYV4lzTFCUWYQWrzVBIbyRPPWCNjIYY8mQosEvczSqLHfJv0+4oyNrwA 1PwQIDZ3VjH3bOcX4sotkN9vJ9OMkZsbxyunbvHVDf/HES0d2K4NkeC/i0UFXeQmty4D 4Zkw== ARC-Authentication-Results: i=1; mx.google.com; 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 o7si13565764ilj.101.2021.11.05.08.43.10; Fri, 05 Nov 2021 08:43:35 -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; 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 S232600AbhKELi3 (ORCPT + 99 others); Fri, 5 Nov 2021 07:38:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:42354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbhKELi2 (ORCPT ); Fri, 5 Nov 2021 07:38:28 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDD23601FA; Fri, 5 Nov 2021 11:35:48 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mixVa-003e0A-O6; Fri, 05 Nov 2021 11:35:46 +0000 Date: Fri, 05 Nov 2021 11:35:46 +0000 Message-ID: <87zgqi96nh.wl-maz@kernel.org> From: Marc Zyngier To: Brad Larson Cc: Mark Rutland , Linux ARM , Arnd Bergmann , Linus Walleij , Bartosz Golaszewski , Mark Brown , Serge Semin , Adrian Hunter , Ulf Hansson , Olof Johansson , "open list:GPIO SUBSYSTEM" , linux-spi , linux-mmc , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List Subject: Re: [PATCH v3 11/11] arm64: dts: Add Pensando Elba SoC support In-Reply-To: References: <20211025015156.33133-1-brad@pensando.io> <20211025015156.33133-12-brad@pensando.io> <20211025091731.GA2001@C02TD0UTHF1T.local> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: brad@pensando.io, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, arnd@arndb.de, linus.walleij@linaro.org, bgolaszewski@baylibre.com, broonie@kernel.org, fancer.lancer@gmail.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, olof@lixom.net, linux-gpio@vger.kernel.org, linux-spi@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Brad, On Fri, 05 Nov 2021 00:02:04 +0000, Brad Larson wrote: > > Hi Marc, > > On Mon, Oct 25, 2021 at 4:15 AM Marc Zyngier wrote: > > > > On 2021-10-25 10:17, Mark Rutland wrote: > > > Hi, > > > > > > On Sun, Oct 24, 2021 at 06:51:56PM -0700, Brad Larson wrote: > > >> Add Pensando common and Elba SoC specific device nodes > > >> > > >> Signed-off-by: Brad Larson > > > > > > [...] > > >> + gic: interrupt-controller@800000 { > > >> + compatible = "arm,gic-v3"; > > >> + #interrupt-cells = <3>; > > >> + #address-cells = <2>; > > >> + #size-cells = <2>; > > >> + ranges; > > >> + interrupt-controller; > > >> + reg = <0x0 0x800000 0x0 0x200000>, /* GICD */ > > >> + <0x0 0xa00000 0x0 0x200000>; /* GICR */ > > > > This is missing the GICv2 compat regions that the CPUs implement. > > Is this what is described as optional in the GIC architecture specification > where a GICv3 system can run restricted GICv2 code? Yup, that. It is actually implemented by the CPU. > Can you point me in the right direction in the spec and example dts > node if needed. The Cortex-A72 TRM has everything you need [1]. And since you used the Synquacer as the model for this, you will see that it has the missing regions. Alternatively, rk3399.dtsi is a good example. > > >> + interrupts = ; > > >> + > > >> + gic_its: msi-controller@820000 { > > >> + compatible = "arm,gic-v3-its"; > > >> + msi-controller; > > >> + #msi-cells = <1>; > > >> + reg = <0x0 0x820000 0x0 0x10000>; > > >> + socionext,synquacer-pre-its = > > >> + <0xc00000 0x1000000>; > > >> + }; > > >> + }; > > > > > > Is there any shared lineage with Synquacer? The commit message didn't > > > describe this quirk. > > > > Funny, it looks like there is a sudden outburst of stupid copy/paste > > among HW designers. TI did the exact same thing recently. > > > > This totally negates all the advantages of having an ITS and makes > > sure that you have all the overhead. Facepalm... > > Some background may help explain. To generate an LPI a peripheral must > write to the GITS_TRANSLATER (a specific address). For the ITS to know > which translations apply to the generated interrupts, it must know which > peripheral performed the write. The ID of the peripheral is known as its > DeviceID, which is often carried along with the write as an AXI sideband > signal. Yes, I happen to be vaguely familiar with the GIC architecture. > The Elba SoC doesn't carry the DeviceID, so we have to conjure one up > between the peripheral and the ITS. Instead of telling a peripheral to target > the GITS_TRANSLATER directly, we instead direct it to a specific offset > within a pre-ITS address range (our own IP block). For writes that land in > that memory range, we derive the DeviceID from (offset >> 2). The pre-ITS > block then sends (DeviceID, data) to the GITS_TRANSLATER. > > The hardware designer came up with the Pre-ITS mechanism in Feb 2018. > When we looked at the upstream kernel later (we developed on 4.14) > we found that not only did it support something similar, it supported the > exact scheme we are using. And this scheme is totally wrong. It breaks interrupt isolation. Instead of having a single doorbell and getting the ITS to segregate between devices itself, you end-up with multiple ones, allowing a rogue device to impersonate another one by targeting another doorbell. You can't even use an SMMU to preserve some isolation, because all the doorbells are in the *same page*. Unmitigated disaster. At this stage, why did you bother having an ITS at all? You get none of the security features. Only the excess area, memory allocation, additional latency and complexity. All you get is a larger INTID space. This only shows that the hardware designer didn't understand the ITS at all. Which seems a common pattern, unfortunately. M. [1] https://developer.arm.com/documentation/100095/0003/Generic-Interrupt-Controller-CPU-Interface/GIC-functional-description/GIC-memory-map?lang=en#way1382452674438__CHDEBJAJ -- Without deviation from the norm, progress is not possible.