Unverified Commit bdc33dad authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'asahi-soc-rtkit-sart-nvme-for-5.19' of...

Merge tag 'asahi-soc-rtkit-sart-nvme-for-5.19' of https://github.com/AsahiLinux/linux into arm/drivers

Apple SoC NVMe driver and dependencies:

  - RTKit IPC library required to boot and communicate with
    co-processors embedded inside Apple SoCs
  - SART DMA address filter required to allow some DMA transactions for
    the NVMe co-processor
  - NVMe platform driver

The following minor changes since v3 on the mailing list have been
folded in:

  - sart: %llx -> %pa for a phys_addr_t
  - rtkit:/sart: Drop IS_ENABLED inside headers
  - rtkit: Use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL
  - nvme: Set NVME_REQ_CANCELLED in the timeout handler
  - nvme: Use DEFINE_SIMPLE_DEV_PM_OPS instead of #ifdef CONFIG_PM_SLEEP

* tag 'asahi-soc-rtkit-sart-nvme-for-5.19' of https://github.com/AsahiLinux/linux:
  nvme-apple: Add initial Apple SoC NVMe driver
  dt-bindings: nvme: Add Apple ANS NVMe
  soc: apple: Add SART driver
  dt-bindings: iommu: Add Apple SART DMA address filter
  soc: apple: Add RTKit IPC library
  soc: apple: Always include Makefile

Link: https://lore.kernel.org/r/20220505154020.84638-1-sven@svenpeter.dev


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents dbdaca13 5bd2927a
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
# 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 <sven@svenpeter.dev>

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>;
    };
+111 −0
Original line number Diff line number Diff line
# 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 <sven@svenpeter.dev>

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>;
    };
+4 −0
Original line number Diff line number Diff line
@@ -1837,7 +1837,9 @@ 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/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*
@@ -1848,12 +1850,14 @@ 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
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 <jesper.nilsson@axis.com>
+13 −0
Original line number Diff line number Diff line
@@ -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.
+3 −0
Original line number Diff line number Diff line
@@ -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
Loading