Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Sven Schnelle" <svens@linux.ibm.com>,
	"Marc Zyngier" <maz@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Joerg Roedel" <joro@8bytes.org>, "Will Deacon" <will@kernel.org>
Cc: "Robin Murphy" <robin.murphy@arm.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Sudeep Holla" <sudeep.holla@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Hendrik Brueckner" <brueckner@linux.ibm.com>,
	"Ulrich Weigand" <Ulrich.Weigand@de.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH 3/3] drivers: firmware: add ARM on s390 accelerator driver
Date: Fri, 04 Dec 2026 16:28:27 +0100	[thread overview]
Message-ID: <bd827cbb-534a-4c5a-b4da-d6e126510700@app.fastmail.com> (raw)
In-Reply-To: <20261204144529.960326-4-svens@linux.ibm.com>

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@linux.ibm.com>

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


      reply	other threads:[~2026-12-04 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 14:45 [PATCH 0/3] Add arm on s390 accelerator driver Sven Schnelle
2026-12-04 14:45 ` [PATCH 1/3] iommu: sva: allow SVA without PASID Sven Schnelle
2026-12-04 14:45 ` [PATCH 2/3] dt-bindings: firmware: platform-accel: add yaml documentation Sven Schnelle
2026-12-04 14:45 ` [PATCH 3/3] drivers: firmware: add ARM on s390 accelerator driver Sven Schnelle
2026-12-04 15:28   ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd827cbb-534a-4c5a-b4da-d6e126510700@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=ardb@kernel.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox