Apple M1 (Pro/Max) NVMe driver
Subsystems (5)
v2 cover Apple M1 (Pro/Max) NVMe driver
Hi,
v1: https://lore.kernel.org/linux-nvme/[email protected]/T/
Thanks everyone for the reviews of v1! I've listed the changes in the individual commits to keep better track of them.
And here's the v1 cover letter as a reference as well:
This series includes everything[*] required to get NVMe up and running on Apple's M1, M1 Pro and M1 Max SoCs.
The NVMe controller on these machines is not attached to a PCI bus and this driver originally started out when Arnd added platform support to pci.c and I added the required Apple quirks. Christoph Hellwig stumbled upon an early version and suggested to instead rewrite it as a stand-alone driver since some of these quirks are rather awkward to implement and would affect the hot path otherwise [1].
Here's the first version that creates apple.c to handle these weird NVMe controllers. The following parts are included:
- Device tree bindings: Since this is the first and probably only SoC that has NVMe outside of a PCIe bus I've put them into soc/apple. The same bindings are also used by u-boot and OpenBSD already.
- SART address filter: Some of the buffers required by the NVMe controller sit behind a simple DMA address filter Apple calls SART. It allows to specify up to 16 physical address ranges that are allowed and will reject access to anything else. Unlike a real IOMMU there's no way to setup pagetables and also not all buffers are subject to this filtering. Most buffers used by the NVMe commands themselves use an integrated IOMMU instead.
- RTKit IPC protocol: The NVMe controller is running a proprietary RTOS Apple calls RTKit and we need to communicate with it in order to bring up and use the NVMe controller. This communication happens over a mailbox interface that is already upstream. This protocol is also used for various other drivers present on these SoCs (SMC, display controller, Thunderbolt/USB4).
- And finally the NVMe driver itself: The driver registers a platform device and is mainly based on pci.c with a few special Apple quirks. The biggest difference to normal NVMe (except for the missing PCI bus) is that command submission works differently: The SQ is replaced with a simple array and a command is triggered by writing its tag to a MMIO register. Additionally, the command must also be setup in the proprietary NVMMU before it can be submitted. There is some code duplication with pci.c for the setup of the PRPs. Depending on what you prefer this could be moved to a common file shared between pci.c and apple.c.
The hardware here is the same hardware that's already used in T2 Macs. The only difference is that the T2 chip itself initializes the controller, disable some quirks (the NVMMU and the weird submission array) and then exposes it over a PCIe interface.
The driver itself has been successfully used by multiple people as their daily driver for weeks at this point and no major issues have been reported.
A smaller issue is that flushes on the devices take *much* longer than expected. Jens Axboe has a workaround where the flushes are delayed but that one isn't ready for submission yet.
Best,
Sven
[1] https://lore.kernel.org/linux-nvme/[email protected]/
[*] The only missing part in this series are the device tree updates
but since these will go through arm-soc anyway I haven't included them here but will instead submit them once this series is in a shape where it can be merged.
Sven Peter (6):
dt-bindings: iommu: Add Apple SART DMA address filter
dt-bindings: nvme: Add Apple ANS NVMe
soc: apple: Always include Makefile
soc: apple: Add SART driver
soc: apple: Add RTKit IPC library
nvme-apple: Add initial Apple SoC NVMe driver
.../devicetree/bindings/iommu/apple,sart.yaml | 52 + .../bindings/nvme/apple,nvme-ans.yaml | 111 ++ MAINTAINERS | 4 + drivers/nvme/host/Kconfig | 13 + drivers/nvme/host/Makefile | 3 + drivers/nvme/host/apple.c | 1597 +++++++++++++++++ drivers/soc/Makefile | 2 +- drivers/soc/apple/Kconfig | 24 + drivers/soc/apple/Makefile | 6 + drivers/soc/apple/rtkit-crashlog.c | 154 ++ drivers/soc/apple/rtkit-internal.h | 62 + drivers/soc/apple/rtkit.c | 958 ++++++++++ drivers/soc/apple/sart.c | 327 ++++ include/linux/soc/apple/rtkit.h | 159 ++ include/linux/soc/apple/sart.h | 57 + 15 files changed, 3528 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iommu/apple,sart.yaml create mode 100644 Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml create mode 100644 drivers/nvme/host/apple.c create mode 100644 drivers/soc/apple/rtkit-crashlog.c create mode 100644 drivers/soc/apple/rtkit-internal.h create mode 100644 drivers/soc/apple/rtkit.c create mode 100644 drivers/soc/apple/sart.c create mode 100644 include/linux/soc/apple/rtkit.h create mode 100644 include/linux/soc/apple/sart.h
Signature · 1 line
2.25.1
PATCH v2 1/6 dt-bindings: iommu: Add Apple SART DMA address filter
Apple SoCs such as the M1 come with a simple DMA address filter called SART. Unlike a real IOMMU no pagetables can be configured but instead DMA transactions can be allowed for up to 16 paddr regions. The consumer also needs special support since not all DMA allocations have to be added to this filter.
---
v1 -> v2:
- Moved to bindings/iommu since it is "Close enough to an IOMMU in terms of its purpose" (Rob Herring)
.../devicetree/bindings/iommu/apple,sart.yaml | 52 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/apple,sart.yaml
Documentation/devicetree/bindings/iommu/apple,sart.yaml new file +52 -0
@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iommu/apple,sart.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple SART DMA address filter + +maintainers: + - Sven Peter <[email protected]> + +description: + Apple SART is a simple address filter for DMA transactions. Regions of + physical memory must be added to the SART's allow list before any + DMA can target these. Unlike a proper IOMMU no remapping can be done and + special support in the consumer driver is required since not all DMA + transactions of a single device are subject to SART filtering. + + SART1 has first been used since at least the A11 (iPhone 8 and iPhone X) + and allows 36 bit of physical address space and filter entries with sizes + up to 24 bit. + + SART2, first seen in A14 and M1, allows 36 bit of physical address space + and filter entry size up to 36 bit. + + SART3, first seen in M1 Pro/Max, extends both the address space and filter + entry size to 42 bit. + +properties: + compatible: + enum: + - apple,t6000-sart + - apple,t8103-sart + + reg: + maxItems: 1 + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + iommu@7bc50000 { + compatible = "apple,t8103-sart"; + reg = <0x7bc50000 0x4000>; + };
MAINTAINERS +1 -0
@@ -1836,6 +1836,7 @@ F: Documentation/devicetree/bindings/arm/apple/* F: Documentation/devicetree/bindings/clock/apple,nco.yaml F: Documentation/devicetree/bindings/i2c/apple,i2c.yaml F: Documentation/devicetree/bindings/interrupt-controller/apple,* +F: Documentation/devicetree/bindings/iommu/apple,sart.yaml F: Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml F: Documentation/devicetree/bindings/pci/apple,pcie.yaml F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
Signature · 1 line
2.25.1
Re: [PATCH v2 1/6] dt-bindings: iommu: Add Apple SART DMA address filter
Quoted 12 lines · Sven Peter
Apple SoCs such as the M1 come with a simple DMA address filter called SART. Unlike a real IOMMU no pagetables can be configured but instead DMA transactions can be allowed for up to 16 paddr regions. The consumer also needs special support since not all DMA allocations have to be added to this filter.
Signed-off-by Sven Peter <[email protected]>---
v1 -> v2:
- Moved to bindings/iommu since it is "Close enough to an IOMMU in terms of its purpose" (Rob Herring)
Quoted 5 lines
.../devicetree/bindings/iommu/apple,sart.yaml | 52 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/iommu/apple,sart.yaml
PATCH v2 2/6 dt-bindings: nvme: Add Apple ANS NVMe
In reply to Sven PeterApple SoCs such as the M1 come with an embedded NVMe coprocessor called ANS2.
---
v1 -> v2:
- Moved to bindings/nvme (Krzysztof Kozlowski)
- Added power-domains and power-domain-names min/maxItems (Krzysztof Kozlowski)
.../bindings/nvme/apple,nvme-ans.yaml | 111 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml new file +111 -0
@@ -0,0 +1,111 @@ +# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvme/apple,nvme-ans.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple ANS NVM Express host controller + +maintainers: + - Sven Peter <[email protected]> + +properties: + compatible: + items: + - enum: + - apple,t8103-nvme-ans2 + - apple,t6000-nvme-ans2 + - const: apple,nvme-ans2 + + reg: + items: + - description: NVMe and NVMMU registers + - description: ANS2 co-processor control registers + + reg-names: + items: + - const: nvme + - const: ans + + resets: + maxItems: 1 + + power-domains: + # two domains for t8103, three for t6000 + minItems: 2 + items: + - description: power domain for the NVMe controller. + - description: power domain for the first PCIe bus connecting the NVMe + controller to the storage modules. + - description: optional power domain for the second PCIe bus + connecting the NVMe controller to the storage modules. + + power-domain-names: + minItems: 2 + items: + - const: ans + - const: apcie0 + - const: apcie1 + + mboxes: + maxItems: 1 + description: Mailbox of the ANS2 co-processor + + interrupts: + maxItems: 1 + + apple,sart: + maxItems: 1 + $ref: /schemas/types.yaml#/definitions/phandle + description: | + Reference to the SART address filter. + + The SART address filter is documented in iommu/apple,sart.yaml. + +if: + properties: + compatible: + contains: + const: apple,t8103-nvme-ans2 +then: + properties: + power-domains: + maxItems: 2 + power-domain-names: + maxItems: 2 +else: + properties: + power-domains: + minItems: 3 + power-domain-names: + minItems: 3 + +required: + - compatible + - reg + - reg-names + - resets + - power-domains + - power-domain-names + - mboxes + - interrupts + - apple,sart + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/apple-aic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + nvme@7bcc0000 { + compatible = "apple,t8103-nvme-ans2", "apple,nvme-ans2"; + reg = <0x7bcc0000 0x40000>, <0x77400000 0x4000>; + reg-names = "nvme", "ans"; + interrupts = <AIC_IRQ 590 IRQ_TYPE_LEVEL_HIGH>; + mboxes = <&ans>; + apple,sart = <&sart>; + power-domains = <&ps_ans2>, <&ps_apcie_st>; + power-domain-names = "ans", "apcie0"; + resets = <&ps_ans2>; + };
MAINTAINERS +1 -0
@@ -1838,6 +1838,7 @@ F: Documentation/devicetree/bindings/i2c/apple,i2c.yaml F: Documentation/devicetree/bindings/interrupt-controller/apple,* F: Documentation/devicetree/bindings/iommu/apple,sart.yaml F: Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml +F: Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml F: Documentation/devicetree/bindings/pci/apple,pcie.yaml F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml F: Documentation/devicetree/bindings/power/apple*
Signature · 1 line
2.25.1
Re: [PATCH v2 2/6] dt-bindings: nvme: Add Apple ANS NVMe
Quoted 10 lines · Sven Peter
Apple SoCs such as the M1 come with an embedded NVMe coprocessor called ANS2.
Signed-off-by Sven Peter <[email protected]>---
v1 -> v2:
- Moved to bindings/nvme (Krzysztof Kozlowski)
- Added power-domains and power-domain-names min/maxItems (Krzysztof Kozlowski)
Quoted 5 lines
.../bindings/nvme/apple,nvme-ans.yaml | 111 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
PATCH v2 3/6 soc: apple: Always include Makefile
In reply to Sven PeterWe want to allow the code inside drivers/soc/apple to be compiled with COMPILE_TEST but this will currently result in linking errors because ARCH_APPLE is not set and make will never recurse into drivers/soc/apple.
Let's just unconditionally recurse into apple/ since all drivers in there are guarded by config options anyways.
--- drivers/soc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/Makefile +1 -1
@@ -4,7 +4,7 @@ # obj-$(CONFIG_ARCH_ACTIONS) += actions/ -obj-$(CONFIG_ARCH_APPLE) += apple/ +obj-y += apple/ obj-y += aspeed/ obj-$(CONFIG_ARCH_AT91) += atmel/ obj-y += bcm/
Signature · 1 line
2.25.1
PATCH v2 4/6 soc: apple: Add SART driver
In reply to Sven PeterThe NVMe co-processor on the Apple M1 uses a DMA address filter called SART for some DMA transactions. This adds a simple driver used to configure the memory regions from which DMA transactions are allowed.
Unlike a real IOMMU, SART does not support any pagetables and can't be implemented inside the IOMMU subsystem using iommu_ops.
It also can't be implemented using dma_map_ops since not all DMA transactions of the NVMe controller are filtered by SART. Instead, most buffers have to be registered using the integrated NVMe IOMMU and we can't have two separate dma_map_ops implementations for a single device.
---
v1 -> v2:
- Added explanation why this can't be an IOMMU or dma_map_ops implementation (Arnd Bergmann)
- Used non-relaxed accessors everwhere since the paths aren't performance critical (Arnd Bergmann)
- Fixed errno return values to be negative (Arnd Bergmann)
- apple_sart_get -> devm_apple_sart_get to add put_device
- Disallow using the interface without CONFIG_APPLE_SART and make all consumers hard-depend on that (Arnd Bergmann)
MAINTAINERS | 1 + drivers/soc/apple/Kconfig | 11 ++ drivers/soc/apple/Makefile | 3 + drivers/soc/apple/sart.c | 327 +++++++++++++++++++++++++++++++++ include/linux/soc/apple/sart.h | 57 ++++++ 5 files changed, 399 insertions(+) create mode 100644 drivers/soc/apple/sart.c create mode 100644 include/linux/soc/apple/sart.h
MAINTAINERS +1 -0
@@ -1855,6 +1855,7 @@ F: drivers/watchdog/apple_wdt.c F: include/dt-bindings/interrupt-controller/apple-aic.h F: include/dt-bindings/pinctrl/apple.h F: include/linux/apple-mailbox.h +F: include/linux/soc/apple/* ARM/ARTPEC MACHINE SUPPORT M: Jesper Nilsson <[email protected]>
drivers/soc/apple/Kconfig +11 -0
@@ -17,6 +17,17 @@ config APPLE_PMGR_PWRSTATE controls for SoC devices. This driver manages them through the generic power domain framework, and also provides reset support. +config APPLE_SART + tristate "Apple SART DMA address filter" + depends on ARCH_APPLE || COMPILE_TEST + default ARCH_APPLE + help + Apple SART is a simple DMA address filter used on Apple SoCs such + as the M1. It is usually required for the NVMe coprocessor which does + not use a proper IOMMU. + + Say 'y' here if you have an Apple SoC. + endmenu endif
drivers/soc/apple/Makefile +3 -0
@@ -1,2 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_APPLE_PMGR_PWRSTATE) += apple-pmgr-pwrstate.o + +obj-$(CONFIG_APPLE_SART) += apple-sart.o +apple-sart-y = sart.o
drivers/soc/apple/sart.c new file +327 -0
327 lines not on this page · raw message
include/linux/soc/apple/sart.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 5/6 soc: apple: Add RTKit IPC library
In reply to Sven PeterApple SoCs such as the M1 come with multiple embedded co-processors running proprietary firmware. Communication with those is established over a simple mailbox using the RTKit IPC protocol.
This cannot be implement inside the mailbox subsystem since on top of communication over channels we also need support for starting, hibernating and resetting these co-processors. We also need to handle shared memory allocations differently depending on the co-processor and don't want to split that across multiple drivers.
---
v1 -> v2:
- Replaced custom kthread with workqueue (Arnd Bergmann)
- Fixed indentation issues and un-exported apple_rtkit_init (Arnd Bergmann)
- Added explanation why this can't be easily implemented as a mailbox (Krzysztof Kozlowski)
- Removed redundant shmem_setup arguments (Arnd Bergmann)
- Removed custom rtk_{err,warn,...} macros (Arnd Bergmann)
- Disallow using the interface without CONFIG_APPLE_RTKIT and make all consumers hard-depend on that (Arnd Bergmann)
- Documented power states (Alyssa Rosenzweig)
- Made recv_message optional
- Added recv_message_early for clients that must handle messages inside atomic context
- Changed send_message to allow calling from atomic context
drivers/soc/apple/Kconfig | 13 + drivers/soc/apple/Makefile | 3 + drivers/soc/apple/rtkit-crashlog.c | 154 +++++ drivers/soc/apple/rtkit-internal.h | 62 ++ drivers/soc/apple/rtkit.c | 958 +++++++++++++++++++++++++++++ include/linux/soc/apple/rtkit.h | 159 +++++ 6 files changed, 1349 insertions(+) create mode 100644 drivers/soc/apple/rtkit-crashlog.c create mode 100644 drivers/soc/apple/rtkit-internal.h create mode 100644 drivers/soc/apple/rtkit.c create mode 100644 include/linux/soc/apple/rtkit.h
drivers/soc/apple/Kconfig +13 -0
@@ -17,6 +17,19 @@ config APPLE_PMGR_PWRSTATE controls for SoC devices. This driver manages them through the generic power domain framework, and also provides reset support. +config APPLE_RTKIT + tristate "Apple RTKit co-processor IPC protocol" + depends on MAILBOX + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) + default ARCH_APPLE + help + Apple SoCs such as the M1 come with various co-processors running + their proprietary RTKit operating system. This option enables support + for the protocol library used to communicate with those. It is used + by various client drivers. + + Say 'y' here if you have an Apple SoC. + config APPLE_SART tristate "Apple SART DMA address filter" depends on ARCH_APPLE || COMPILE_TEST
drivers/soc/apple/Makefile +3 -0
@@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_APPLE_PMGR_PWRSTATE) += apple-pmgr-pwrstate.o +obj-$(CONFIG_APPLE_RTKIT) += apple-rtkit.o +apple-rtkit-y = rtkit.o rtkit-crashlog.o + obj-$(CONFIG_APPLE_SART) += apple-sart.o apple-sart-y = sart.o
drivers/soc/apple/rtkit-crashlog.c new file +154 -0
154 lines not on this page · raw message
drivers/soc/apple/rtkit-internal.h new file +62 -0
62 lines not on this page · raw message
drivers/soc/apple/rtkit.c new file +958 -0
958 lines not on this page · raw message
include/linux/soc/apple/rtkit.h new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 6/6 nvme-apple: Add initial Apple SoC NVMe driver
In reply to Sven PeterApple SoCs such as the M1 come with an embedded NVMe controller that is not attached to any PCIe bus. Additionally, it doesn't conform to the NVMe specification and requires a bunch of changes to command submission and IOMMU configuration to work.
---
v1 -> v2:
- Used non-relaxed accessors everywhere since there's no performance difference (Arnd Bergmann)
- Added put_device/get_device to tie the nvme_ctrl device to the platform device (Christoph Hellwig)
- Removed unneccesary include and DEBUG #define (Christoph Hellwig)
- Use nvme_is_write instead of custom #defines (Christoph Hellwig)
- Squashed follow-up commits into this one (Christoph Hellwig)
- Initialize cq_phase during queue allocation already to make it's not interpreted as a full cq if anything before queue initialization fails.
MAINTAINERS | 1 + drivers/nvme/host/Kconfig | 13 + drivers/nvme/host/Makefile | 3 + drivers/nvme/host/apple.c | 1597 ++++++++++++++++++++++++++++++++++++ 4 files changed, 1614 insertions(+) create mode 100644 drivers/nvme/host/apple.c
MAINTAINERS +1 -0
@@ -1849,6 +1849,7 @@ F: drivers/i2c/busses/i2c-pasemi-core.c F: drivers/i2c/busses/i2c-pasemi-platform.c F: drivers/irqchip/irq-apple-aic.c F: drivers/mailbox/apple-mailbox.c +F: drivers/nvme/host/apple.c F: drivers/pinctrl/pinctrl-apple-gpio.c F: drivers/soc/apple/* F: drivers/watchdog/apple_wdt.c
drivers/nvme/host/Kconfig +13 -0
@@ -91,3 +91,16 @@ config NVME_TCP from https://github.com/linux-nvme/nvme-cli. If unsure, say N. + +config NVME_APPLE + tristate "Apple ANS2 NVM Express host driver" + depends on OF && BLOCK + depends on APPLE_RTKIT && APPLE_SART + depends on ARCH_APPLE || COMPILE_TEST + select NVME_CORE + help + This provides support for the NVMe controller embedded in Apple SoCs + such as the M1. + + To compile this driver as a module, choose M here: the + module will be called nvme-apple.
drivers/nvme/host/Makefile +3 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_NVME_FABRICS) += nvme-fabrics.o obj-$(CONFIG_NVME_RDMA) += nvme-rdma.o obj-$(CONFIG_NVME_FC) += nvme-fc.o obj-$(CONFIG_NVME_TCP) += nvme-tcp.o +obj-$(CONFIG_NVME_APPLE) += nvme-apple.o nvme-core-y := core.o ioctl.o constants.o nvme-core-$(CONFIG_TRACING) += trace.o
@@ -25,3 +26,5 @@ nvme-rdma-y += rdma.o nvme-fc-y += fc.o nvme-tcp-y += tcp.o + +nvme-apple-y += apple.o
drivers/nvme/host/apple.c new file +1597 -0
1,597 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
drivers/nvme/host/apple.c line 4
Quoted 6 lines · Sven Peter
+++
b/drivers/nvme/host/apple.cdrivers/nvme/host/apple.c new file +4
-0@@ -0,0 +1,1597 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Apple ANS NVM Express device driver +* Copyright The Asahi Linux Contributors
Is that actually a valid legal entity?
drivers/nvme/host/apple.c line 19
Quoted 1 line
drivers/nvme/host/apple.c new file +1
-0+#include <linux/io-64-nonatomic-lo-hi.h>
Does this controller still not support 64-bit MMIO accesses like the old Apple PCIe controllers or is this just a leftover?
The rest of the code looks fine to me:
Re: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
Quoted 9 lines · Christoph Hellwig
drivers/nvme/host/apple.c line 4
Quoted 6 lines · Sven Peter
+++
b/drivers/nvme/host/apple.cdrivers/nvme/host/apple.c new file +4
-0@@ -0,0 +1,1597 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Apple ANS NVM Express device driver +* Copyright The Asahi Linux Contributors Is that actually a valid legal entity?
It does not have to be. See here for the rationale behind this style of copyright line:
https://www.linuxfoundation.org/blog/copyright-notices-in-open-source-software-projects/
TL;DR name- and year-ful copyright lines are basically useless, as they become out of date almost immediately after they are applied. This way we acknowledge that the files have multiple contributors (and that the copyright line isn't trying to be an exhaustive list thereof). This style is so far rare, but not unheard of, in the kernel; there is prior art (e.g. grep for 'Chromium OS Authors').
(I get to re-tell this story every time we upstream to a new subsystem; I think it's the sixth time or so :-) )
Signature · 2 lines
Hector Martin ([email protected]) Public Key: https://mrcn.st/pub
Re: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
In reply to Christoph HellwigQuoted 10 lines · Christoph Hellwig
drivers/nvme/host/apple.c line 4
Quoted 6 lines · Sven Peter
+++
b/drivers/nvme/host/apple.cdrivers/nvme/host/apple.c new file +4
-0@@ -0,0 +1,1597 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Apple ANS NVM Express device driver +* Copyright The Asahi Linux Contributors Is that actually a valid legal entity?
Quoted 4 lines
drivers/nvme/host/apple.c line 19
Quoted 1 line
drivers/nvme/host/apple.c new file +1
-0+#include <linux/io-64-nonatomic-lo-hi.h> Does this controller still not support 64-bit MMIO accesses like the old Apple PCIe controllers or is this just a leftover?
I just checked again and 64-bit accesses seem to work fine. I'll remove the lo_hi_* calls and this include.
Quoted 4 lines
The rest of the code looks fine to me:
Reviewed-by Christoph Hellwig <[email protected]>
Thanks!
Sven
Re: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
Quoted 11 lines · Sven Peter
Quoted 10 lines · Christoph Hellwig
drivers/nvme/host/apple.c line 4
Quoted 6 lines · Sven Peter
+++
b/drivers/nvme/host/apple.cdrivers/nvme/host/apple.c new file +4
-0@@ -0,0 +1,1597 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Apple ANS NVM Express device driver +* Copyright The Asahi Linux Contributors Is that actually a valid legal entity?
Quoted 7 lines
Quoted 4 lines
drivers/nvme/host/apple.c line 19
Quoted 1 line
drivers/nvme/host/apple.c new file +1
-0+#include <linux/io-64-nonatomic-lo-hi.h> Does this controller still not support 64-bit MMIO accesses like the old Apple PCIe controllers or is this just a leftover?
I just checked again and 64-bit accesses seem to work fine. I'll remove the lo_hi_* calls and this include.
If you remove the #include, it is no longer possible to compile-test this on all 32-bit architectures, though that is probably fine as long as the Kconfig file has the right dependencies, like
depends on ARCH_APPLE || (COMPILE_TEST && 64BIT)
I'd prefer to keep the #include here, but I don't mind the dependency if Christoph prefers it that way.
Arnd
[email protected]
maintainerRe: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
Quoted 11 lines · Arnd Bergmann
Quoted 2 lines
I just checked again and 64-bit accesses seem to work fine. I'll remove the lo_hi_* calls and this include.
If you remove the #include, it is no longer possible to compile-test this on all 32-bit architectures, though that is probably fine as long as the
Kconfigfile has the right dependencies, likedepends on ARCH_APPLE || (COMPILE_TEST && 64BIT)I'd prefer to keep the #include here, but I don't mind the dependency if Christoph prefers it that way.
So thre's really two steps here:
1) stop uing lo_hi_readq diretly which forces 32-bit access even on 64-bit platforms
2) stop using the io-64-nonatomic headers entirely
I definitively want 1) done if the hardware does not require it. Trying to cater to 32-bit build tests on hardware that has no chance of ever being used there by including the header seems a bit silly, but if it makes folks happy I can live with it.
Quoted 2 lines
Arnd
---end quoted text---
Re: [PATCH v2 6/6] nvme-apple: Add initial Apple SoC NVMe driver
Quoted 13 lines · On Wed, Apr 20, 2022 at 6:34 AM [email protected] <[email protected]> wrote:
Quoted 11 lines · Arnd Bergmann
Quoted 2 lines
I just checked again and 64-bit accesses seem to work fine. I'll remove the lo_hi_* calls and this include.
If you remove the #include, it is no longer possible to compile-test this on all 32-bit architectures, though that is probably fine as long as the
Kconfigfile has the right dependencies, likedepends on ARCH_APPLE || (COMPILE_TEST && 64BIT)I'd prefer to keep the #include here, but I don't mind the dependency if Christoph prefers it that way.
Quoted 7 lines
So thre's really two steps here:
1) stop uing
lo_hi_readqdiretly which forces 32-bit access even on 64-bit platforms
2) stop using the io-64-nonatomic headers entirelyI definitively want 1) done if the hardware does not require it.
Yes, of cours.e
Quoted 3 lines
Trying to cater to 32-bit build tests on hardware that has no chance of ever being used there by including the header seems a bit silly, but if it makes folks happy I can live with it.
As I said, I don't have a strong opinion either, it's either a trivial change in Kconfig or a trivial header inclusion and I'd pick the header one because it's more obvious what this is for without adding a comment.
Arnd