Re: [PATCH 3/3] drivers: firmware: add ARM on s390 accelerator driver

From: Arnd Bergmann

Date: Fri Dec 04 2026 - 10:29:30 EST


On Fri, Dec 4, 2026, at 15:45, Sven Schnelle wrote:
> s390 support for ARM guests supports hardware acceleration for
> crypto and other functions. This is implemented by providing a special
> memory region that can be accessed via st64bv0. To allow userspace to
> utilize this functionality, add a driver to map the accelerator memory
> region into the userspace process. Note that the misc device files
> are created with permission 0666 so all userspace processes can use
> the driver without additional configuration.
>
> Signed-off-by: Sven Schnelle <svens@xxxxxxxxxxxxx>

Hi Sven,

I noticed a few details:

> +config PLATFORM_ACCEL
> + tristate "Acceleration driver for arm64"
> + depends on ARM64
> + select IOMMU_SVA

CONFIG_IOMMU_SVA depends on CONFIG_IOMMU_SUPPORT, so you need to
make this

depends on IOMMU_SUPPORT

Ideally it would also be 'depends on ARM64 || COMPILE_TEST' to
give it build test coverage on other architectures, but only
if you can easily make it compile portably.

> +static int platform_accel_mmap(struct file *filep, struct
> vm_area_struct *vma)

Lorenzo has been going through device drivers to convert the .mmap()
callback to .mmap_prepare(), see https://lore.kernel.org/all/?q=mmap_prepare
for recent patches. It's probably best to do the same thing here.

> +static int platform_accel_probe(struct platform_device *pdev)
> +{
> + struct platform_accel *dev;
> + int err;
> +
> + if (!system_supports_ls64_accdata())
> + return -ENODEV;

I think the system_supports_ls64_accdata() call is the only compile time
dependency on my "arm64: dynamically enable st64bv0 for SVA" patch, but it's
not actually a runtime dependency as the hypervisor platform should
only provide the device if it can be used, and the failure mode should
still be fine, as userspace should probably check the hwcap as well.

If you take out this call or open-code the check for ARM64_HAS_LS64_ACCDATA,
the series can be merged independently through another tree.

> + dev_info(&pdev->dev, "mmio at %pR\n", r);

I'd drop this from the production version, as working drivers are
supposed to be quiet.

> +#if IS_ENABLED(CONFIG_ACPI)
> +static const struct acpi_device_id platform_accel_acpi_match[] = {
> + { "IBM077A", (kernel_ulong_t)&platform_accel_dev_cpacf },
> + { "IBM077B", (kernel_ulong_t)&platform_accel_dev_dfltcc },
> + {},
> +};
> +MODULE_DEVICE_TABLE(acpi, platform_accel_acpi_match);
> +#endif

No need for the #if check here

> +#if IS_ENABLED(CONFIG_ACPI)
> + .acpi_match_table = ACPI_PTR(platform_accel_acpi_match),
> +#endif

or the ACPI_PTR() here, which just duplicates the #if check.
I would just always leave the .acpi_match_table entry and waste
a few bytes of .rodata in favor of readability.

Arnd