Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp573482lqp; Wed, 12 Jun 2024 09:40:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXglb43hetq622C3wfJ8HeRgjIioro0K4CY7m7aJrJwJyXmYO10Iwwhv7lOr25qQNJ6Z6uGzpIIqSfujVn4zQWnOJfHlRB8ZobYGd1nEw== X-Google-Smtp-Source: AGHT+IEXjeWlxvz7MGJdDTdxHHpfWr0RzWmHygmMMXbPhcbQFX6b0Ez2c/kgoLqKnt9Lczf8U4k3 X-Received: by 2002:a17:903:2344:b0:1f5:e635:2212 with SMTP id d9443c01a7336-1f83b22d0cemr28548055ad.0.1718210457795; Wed, 12 Jun 2024 09:40:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718210457; cv=pass; d=google.com; s=arc-20160816; b=rKeW6F7sGBnweUWesVAW35PVeq4BEc4scsd3NKgA4vUkZz0Cpu4gPqonGRc3mHiiTX GY579DX3DsDYq33k+w1PQTJn7+k27JDh4ceHIEIe2Q+Wks7s5T15vsR4Iek166odmDwI 6+0Azy16eTm0LnPRHOijDYaiZa5ebqjfAYOSzJLzi5r3MUFs0LGDHsOl4C8aecHTJQ8k Su9JjXFh0M3kmxNdxRNVlzgbIRgOhEMeuJhlaYEQj+ZuHpKSsvduFohNwyB9uZAmbz3A bMA8WNVybfRYqbyz707I50ARsxMIC751nOkNfcsg+ZJXh7PjmdwSF9Orf50iE+0W31dC +CVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=XXwatvCZK75+gyfT5QGM1hr1TmWbqnnUzJVbqygrw14=; fh=oNF/pI2V8RGu4dLP5pvDGyeEgLT287hqozDdG4DcLoY=; b=a6ku3c3eAmiQKAuocH75mmtaOFWMNAeK64WZIn7gHhV0TSPkCykb+fhxDTtbvAx/UY xCr0VxNUrIKsJ3khkXOxLa1j6/9Xv6hhYHleoh1B1ZgzM2UCQ7TqjGiCjFNcTekHqsCi Ymg/Lcviiq3In3JS8pqCG7yAoC+roHQqMHcBy7y41PptMKwJ1akM+Vr+1VT7K8Gb0fnk mQr+V+pKNUeusRKSysf41eR/zjXxuZQRfWYzqn4n/Q0b+EB0bXsx1VYjx8GKWb+8ZT3a +nXGyhKZCKFZjhCQUuN4UGCtbOYQodppNO6ST/usUY5+Lspr1579NfUUNGQRGfadCKci 6KKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6f2e5c588si81133835ad.566.2024.06.12.09.40.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 09:40:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C696DB22C65 for ; Wed, 12 Jun 2024 16:13:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A1D7180A9D; Wed, 12 Jun 2024 16:13:09 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7795C17B516; Wed, 12 Jun 2024 16:13:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718208788; cv=none; b=NDzsKsB38T0QrdqwQwJMyW2/7ka0iteQrYkywM64PoBtqjR3G2m1Tu9tWAB+qNBXyvNFSnLsBBjqTAKnCRZ6HK1ce0MkRk00AGIjR2tEuAqNMr9HP74+Y2f+PlH3VkQhhJqahsxdzfYb8ddUYJCKyHKFmvsPE7zMZdjbVQdYCCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718208788; c=relaxed/simple; bh=TqdikSL4T/F8T6RVHBxSBxob3KUr7m3yyjdVJKKjxEk=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=Je5XNbSZWJWWwo29ArSZN2PE0A1gZnqwobNYVKaxG21bbbRWVKSI6Oyl/xj1S7VylUgqv8TFkhf3KA7XBf5p+fv7RKuAUhMLiboSSrzp1Q6/CePdNDc0coEH8ImXca45HH7ROe3gR9W/fvwh974przTzlTRWL1+CrdBP/ahJKuE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 33ACD1042; Wed, 12 Jun 2024 09:13:30 -0700 (PDT) Received: from [192.168.20.22] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E7B443F73B; Wed, 12 Jun 2024 09:13:04 -0700 (PDT) Message-ID: Date: Wed, 12 Jun 2024 11:10:14 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Raspberry Pi5 - RP1 driver - RFC Content-Language: en-US To: Stefan Wahren , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Dave Ertman , Lizhi Hou , clement.leger@bootlin.com References: From: Jeremy Linton In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, On 6/11/24 14:05, Stefan Wahren wrote: > Hi Andrea, > > i added Jeremy, because AFAIK he was deeply involved in ACPI > implementation of the RPi 4. I'm not sure what to add here, the RPi4 work was done as an example of using firmware standards to boot multiple OSs with a single boot/firmware interface. Which means ACPI. Alternatively, the PCIe/SMCCC might be able to make this device look more regular, by putting everything on separate PCIe functions. OTOH, I don't think this device is particularly special, except maybe to the extent that it doubles down on ideas regarded as best left in the 1990's. The kernel documents how to handle these cases with ACPI _ADR(). A PCI device can create the _ADR nodes by injecting an SSDT into the ACPI namespace via the PCI option ROMs if the platform firmware doesn't provide them. Should it though? If I were doing it I might be tempted to configure the root port in early firmware and hide it from the OS, claiming instead a bunch of platform devices. IMHO, DT/Linux platforms should probably do something similar to _ADR() for consistency rather than requiring the EP driver to get involved. Further, mixing DT's into a possible ACPI platform is really the worst of both. Even worse if it requires further distro dracut/initrd/grub/etc one off hacking or polluting the initrd or ESP of non RPi platforms to handle the overlay. So, a custom EP/bus driver option solves the problem on linux for both DT and ACPI implementations if the device type/offsets are hard coded into it. And presumably if there is a follow on device, it would use multiple PCIe functions to avoid all these problems, the ones around securing the platform with an IOMMU, enabling VFIO, and everything else one gets for "free" with a proper PCIe EP. PS: The PCIe/SMCC API could probably make all these devices appear as PCIe functions avoiding the need for a monolithic bus or DT/ACPI description to handle it. But that will likely break the second this device is plugged into something with an SMMU (this platform doesn't have one, correct?), and of course if would require all the firmware configured BAR mappings to remain static, which isn't a problem if its presented as an integrated endpoint. If someone is interested in doing it that way then we should talk. > > Am 11.06.24 um 17:39 schrieb Andrea della Porta: >> Hi, >> I'm on the verge of reworking the RP1 driver from downstream in order >> for it to be >> in good shape for upstream inclusion. >> RP1 is an MFD chipset that acts as a south-bridge PCIe endpoint >> sporting a pletora >> of subdevices (i.e.  Ethernet, USB host controller, I2C, PWM, etc.) >> whose registers >> are all reachable starting from an offset from the BAR address. >> The main point here is that while the RP1 as an endpoint itself is >> discoverable via >> usual PCI enumeraiton, the devices it contains are not discoverable >> and must be >> declared e.g. via the devicetree. This is an RFC about the correct >> approach to use >> in integrating the driver and registering the subdevices. >> > I cannot provide much input into the technical discussion, but i would > prefer an approach which works good with DT and ACPI. > > Best regards > Stefan >> >> Link: >> - [1]: >> https://github.com/raspberrypi/linux/blob/rpi-6.6.y/arch/arm/boot/dts/broadcom/rp1.dtsi >> - [2]: >> https://github.com/raspberrypi/linux/blob/rpi-6.6.y/drivers/mfd/rp1.c >> - [3]: >> https://lpc.events/event/17/contributions/1421/attachments/1337/2680/LPC2023%20Non-discoverable%20devices%20in%20PCI.pdf >> - [4]: >> https://lore.kernel.org/lkml/20230419231155.GA899497-robh@kernel.org/t/ >> - [5]: https://lore.kernel.org/lkml/Y862WTT03%2FJxXUG8@kroah.com/ >