On 03.12.20 13:48, Andrea Bastoni wrote: > On 03/12/2020 07:36, Jan Kiszka wrote: >> On 27.11.20 12:41, Andrea Bastoni wrote: >>> The SMMUv2 allows filtering bits when matching stream IDs before they're >>> passed to the TCU. In this way multiple streams legally get the same >>> translation. >>> >>> On boards such as the ZCU Ultrascale+, the master ID needed to identify >>> the corresponding SMMU stream ID may be dependent on a specific AXI ID >>> that is set by the PL (and could be IP specific). >>> >>> One single fixed mask to pass to the SMR to compact multiple stream IDs >>> before they "hit" the TCU is not flexible enough. The use-case is to >>> compact similar PL-originating masters and have the SMMU behaving the >>> same for them (e.g., they're assigned to the same inmate). At the >>> same time, one needs a full stream_id to assign e.g., different GEM >>> ethernets to different inmates. >>> >>> Update a stream_id to support two different interpretations: >>> - for the SMMUv2, provide an explicit mask + ID. >>> - for the SMMUv3, keep the current single ID. >>> >>> This commit updates the SMMUv2 / v3 --including configuration-- >>> accordingly. >> >> CC'ing Nikil and Peng on their affected code. >> >>> >>> Signed-off-by: Andrea Bastoni <[email protected]> >>> --- >>> configs/arm64/imx8qm-linux-demo.c | 7 ++- >>> configs/arm64/imx8qm.c | 16 +++++-- >>> configs/arm64/k3-j7200-evm-linux-demo.c | 2 +- >>> configs/arm64/k3-j7200-evm.c | 2 +- >>> configs/arm64/k3-j721e-evm-linux-demo.c | 2 +- >>> configs/arm64/k3-j721e-evm.c | 2 +- >>> configs/arm64/ultra96.c | 11 ++++- >>> configs/arm64/zynqmp-zcu102.c | 15 +++++- >>> hypervisor/arch/arm64/smmu-v3.c | 9 ++-- >>> hypervisor/arch/arm64/smmu.c | 64 ++++++++++++++++--------- >>> hypervisor/arch/arm64/ti-pvu.c | 21 ++++---- >>> include/jailhouse/cell-config.h | 18 ++++--- >>> 12 files changed, 114 insertions(+), 55 deletions(-) >>> >>> diff --git a/configs/arm64/imx8qm-linux-demo.c >>> b/configs/arm64/imx8qm-linux-demo.c >>> index f13ca7bc..e8e8b217 100644 >>> --- a/configs/arm64/imx8qm-linux-demo.c >>> +++ b/configs/arm64/imx8qm-linux-demo.c >>> @@ -19,7 +19,7 @@ struct { >>> struct jailhouse_memory mem_regions[18]; >>> struct jailhouse_irqchip irqchips[4]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[1]; >>> + union jailhouse_stream_id stream_ids[1]; >>> } __attribute__((packed)) config = { >>> .cell = { >>> .signature = JAILHOUSE_CELL_DESC_SIGNATURE, >>> @@ -194,6 +194,9 @@ struct { >>> }, >>> >>> .stream_ids = { >>> - 0x10, >>> + { >>> + .mmu500.mask = 0x7f8, >>> + .mmu500.id = 0x10, >> >> Would list id before the mask. >> >>> + }, >>> }, >>> }; >>> diff --git a/configs/arm64/imx8qm.c b/configs/arm64/imx8qm.c >>> index d63c73cf..2ec4f4dd 100644 >>> --- a/configs/arm64/imx8qm.c >>> +++ b/configs/arm64/imx8qm.c >>> @@ -20,7 +20,7 @@ struct { >>> struct jailhouse_memory mem_regions[15]; >>> struct jailhouse_irqchip irqchips[3]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[3]; >>> + union jailhouse_stream_id stream_ids[3]; >>> } __attribute__((packed)) config = { >>> .header = { >>> .signature = JAILHOUSE_SYSTEM_SIGNATURE, >>> @@ -54,7 +54,6 @@ struct { >>> .type = JAILHOUSE_IOMMU_ARM_MMU500, >>> .base = 0x51400000, >>> .size = 0x40000, >>> - .arm_mmu500.sid_mask = 0x7f80, >>> }, >>> }, >>> >>> @@ -209,6 +208,17 @@ struct { >>> }, >>> >>> .stream_ids = { >>> - 0x11, 0x12, 0x13, >>> + { >>> + .mmu500.mask = 0x7f8, >>> + .mmu500.id = 0x11, >>> + }, >>> + { >>> + .mmu500.mask = 0x7f8, >>> + .mmu500.id = 0x12, >>> + }, >>> + { >>> + .mmu500.mask = 0x7f8, >>> + .mmu500.id = 0x13, >>> + }, >>> }, >>> }; >>> diff --git a/configs/arm64/k3-j7200-evm-linux-demo.c >>> b/configs/arm64/k3-j7200-evm-linux-demo.c >>> index 90a0ce4c..ace9cd3a 100644 >>> --- a/configs/arm64/k3-j7200-evm-linux-demo.c >>> +++ b/configs/arm64/k3-j7200-evm-linux-demo.c >>> @@ -26,7 +26,7 @@ struct { >>> struct jailhouse_memory mem_regions[19]; >>> struct jailhouse_irqchip irqchips[3]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[1]; >>> + union jailhouse_stream_id stream_ids[1]; >>> } __attribute__((packed)) config = { >>> .cell = { >>> .signature = JAILHOUSE_CELL_DESC_SIGNATURE, >>> diff --git a/configs/arm64/k3-j7200-evm.c b/configs/arm64/k3-j7200-evm.c >>> index c3ac331d..d0c8aee3 100644 >>> --- a/configs/arm64/k3-j7200-evm.c >>> +++ b/configs/arm64/k3-j7200-evm.c >>> @@ -21,7 +21,7 @@ struct { >>> struct jailhouse_memory mem_regions[32]; >>> struct jailhouse_irqchip irqchips[6]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[1]; >>> + union jailhouse_stream_id stream_ids[1]; >>> } __attribute__((packed)) config = { >>> .header = { >>> .signature = JAILHOUSE_SYSTEM_SIGNATURE, >>> diff --git a/configs/arm64/k3-j721e-evm-linux-demo.c >>> b/configs/arm64/k3-j721e-evm-linux-demo.c >>> index 5b6aa82e..1b8b3c4c 100644 >>> --- a/configs/arm64/k3-j721e-evm-linux-demo.c >>> +++ b/configs/arm64/k3-j721e-evm-linux-demo.c >>> @@ -27,7 +27,7 @@ struct { >>> struct jailhouse_memory mem_regions[22]; >>> struct jailhouse_irqchip irqchips[4]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[2]; >>> + union jailhouse_stream_id stream_ids[2]; >>> } __attribute__((packed)) config = { >>> .cell = { >>> .signature = JAILHOUSE_CELL_DESC_SIGNATURE, >>> diff --git a/configs/arm64/k3-j721e-evm.c b/configs/arm64/k3-j721e-evm.c >>> index ab13fedd..aa5b47a9 100644 >>> --- a/configs/arm64/k3-j721e-evm.c >>> +++ b/configs/arm64/k3-j721e-evm.c >>> @@ -22,7 +22,7 @@ struct { >>> struct jailhouse_memory mem_regions[40]; >>> struct jailhouse_irqchip irqchips[6]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[30]; >>> + union jailhouse_stream_id stream_ids[30]; >>> } __attribute__((packed)) config = { >>> .header = { >>> .signature = JAILHOUSE_SYSTEM_SIGNATURE, >>> diff --git a/configs/arm64/ultra96.c b/configs/arm64/ultra96.c >>> index db65ae01..19be84ae 100644 >>> --- a/configs/arm64/ultra96.c >>> +++ b/configs/arm64/ultra96.c >>> @@ -21,7 +21,7 @@ struct { >>> struct jailhouse_memory mem_regions[11]; >>> struct jailhouse_irqchip irqchips[1]; >>> struct jailhouse_pci_device pci_devices[2]; >>> - __u32 stream_ids[2]; >>> + union jailhouse_stream_id stream_ids[2]; >>> } __attribute__((packed)) config = { >>> .header = { >>> .signature = JAILHOUSE_SYSTEM_SIGNATURE, >>> @@ -161,6 +161,13 @@ struct { >>> }, >>> >>> .stream_ids = { >>> - 0x870, 0x871 >>> + { >>> + .mmu500.mask = 0x0, >>> + .mmu500.id = 0x870, >>> + }, >>> + { >>> + .mmu500.mask = 0x0, >>> + .mmu500.id = 0x871, >> >> Only realizing now: That mask is an "ignore mask", right? Bits set there >> are NOT matched against the id. That's modeled after the hardware? Is >> this really intuitive? This one confused me at least. > > Yes, it is model after the hardware. Maybe "ignore_mask" or "imask" would be > better? >
...r invert it in SMR_GET_MASK? Not sure what is nicer. The latter has the disadvantage that you then always need to specify a non-zero mask. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/6c4ee376-6573-ecc7-2e50-f6a74156fd75%40siemens.com.
