Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anthony Krowiak" <akrowiak@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v10 14/15] s390/vfio-ap: Add 'migration' feature to sysfs 'features' attribute
Date: Fri, 23 Oct 2026 18:06:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-183040@kernel.org> (raw)
In-Reply-To: <20261023174349.3545941-15-akrowiak@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] s390/vfio-ap: features_show() uses guest-side ap_is_se_guest() on KVM host
--

commit 43fb24f8f56fe7dba5cb74bbc8da847cfac6779e
Author: Anthony Krowiak <akrowiak@linux.ibm.com>

s390/vfio-ap: Add 'migration' feature to sysfs 'features' attribute

This commit adds the migration feature string to the vfio_ap matrix sysfs
features attribute unless ap_is_se_guest() returns true.

> diff --git a/drivers/s390/crypto/vfio_ap_drv.c b/drivers/s390/crypto/vfio_ap_drv.c
> index 8e69ed286bb9c..c63a050a23569 100644
> --- a/drivers/s390/crypto/vfio_ap_drv.c
> +++ b/drivers/s390/crypto/vfio_ap_drv.c
> @@ -26,9 +26,21 @@ MODULE_LICENSE("GPL v2");
>  struct ap_matrix_dev *matrix_dev;
>  debug_info_t *vfio_ap_dbf_info;
>  
> +#define VFIO_AP_BASE_FEATURES	"guest_matrix hotplug ap_config"
> +#define VFIO_AP_SE_EXCLUDED_FEATURES "migration"
> +
>  static ssize_t features_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> -	return sysfs_emit(buf, "guest_matrix hotplug ap_config\n");
> +	/*
> +	 * SE guests do not support live guest migration; emit only the base
> +	 * feature set for them.
> +	 */
> +	if (ap_is_se_guest())
> +		return sysfs_emit(buf, "%s\n", VFIO_AP_BASE_FEATURES);
> +
> +	/* Non-SE: base features plus those not available on SE guests */
> +	return sysfs_emit(buf, "%s %s\n", VFIO_AP_BASE_FEATURES,
> +			  VFIO_AP_SE_EXCLUDED_FEATURES);

[Severity: Medium]
Can ap_is_se_guest() ever evaluate to true here on a KVM host?

Looking at drivers/s390/crypto/ap_bus.c:

bool ap_is_se_guest(void)
{
	return is_prot_virt_guest() && ap_sb_available();
}

and arch/s390/boot/uv.c:uv_query_info():

	if (test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list) &&
	    test_bit_inv(BIT_UVC_CMD_REMOVE_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list))
		prot_virt_guest = 1;

is_prot_virt_guest() checks whether the currently running kernel is itself a
protected virtualization guest, which is mutually exclusive with running as a
KVM host in is_prot_virt_host_capable().

Because vfio_ap runs on the KVM host, ap_is_se_guest() will always return
false in features_show(), as well as in the earlier patches in this series in
drivers/s390/crypto/vfio_ap_migration.c:

vfio_ap_mdev_probe() -> vfio_ap_setup_vfio_device_migration():
	if (ap_is_se_guest())
		return;

	matrix_mdev->vdev.migration_flags = VFIO_MIGRATION_STOP_COPY;
	matrix_mdev->vdev.mig_ops = &vfio_ap_migration_ops;

and vfio_ap_mdev_open_device() -> vfio_ap_init_migration_data():
	if (ap_is_se_guest())
		return 0;

Additionally, /sys/devices/vfio_ap/matrix/features is a host-wide attribute on
matrix_dev, whereas whether a KVM guest uses Secure Execution is a per-VM
runtime property (such as kvm_s390_pv_is_protected(matrix_mdev->kvm) after the
guest transitions into protected mode via KVM_PV_ENABLE), and a single host
can run both SE and non-SE guests simultaneously.

Should the SE guest migration restriction be enforced per guest or mdev using
host-side KVM protected virtualization state rather than ap_is_se_guest()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261023174349.3545941-1-akrowiak@linux.ibm.com?part=14

  reply	other threads:[~2026-10-23 18:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 17:43 [PATCH v10 00/15] s390/vfio-ap: Add live guest migration support Anthony Krowiak
2026-10-23 17:43 ` [PATCH v10 01/15] s390/vfio-ap: Provide function to get the number of queues assigned to mdev Anthony Krowiak
2026-10-23 18:01   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 02/15] s390/vfio-ap: Data structures for facilitating vfio device migration Anthony Krowiak
2026-10-23 17:57   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 03/15] s390/vfio-ap: Functions to initialize/release vfio device migration data Anthony Krowiak
2026-10-23 18:09   ` sashiko-bot
2026-10-24  7:11   ` kernel test robot
2026-10-23 17:43 ` [PATCH v10 04/15] s390/vfio-ap: Reset migration state in VFIO_DEVICE_RESET ioctl handler Anthony Krowiak
2026-10-23 17:59   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 05/15] s390/vfio-ap: Callback to get/set vfio device mig state during guest migration Anthony Krowiak
2026-10-23 18:13   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 06/15] s390/vfio-ap: Transition guest migration state from STOP to STOP_COPY Anthony Krowiak
2026-10-23 18:07   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 07/15] s390/vfio-ap: File ops called to save the vfio device migration state Anthony Krowiak
2026-10-23 18:10   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 08/15] s390/vfio-ap: Transition device migration state from STOP to RESUMING Anthony Krowiak
2026-10-23 18:00   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 09/15] s390/vfio-ap: Prepare lock helpers and matrix init for cross-file use Anthony Krowiak
2026-10-23 17:57   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 10/15] s390/vfio-ap: File ops called to resume the vfio device migration Anthony Krowiak
2026-10-23 18:15   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 11/15] s390/vfio-ap: Transition device migration state to from/to STOP Anthony Krowiak
2026-10-23 18:13   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 12/15] s390/vfio-ap: Callback to get the size of data to be migrated during guest migration Anthony Krowiak
2026-10-23 18:04   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 13/15] s390/vfio-ap: Set up for vfio-ap device migration Anthony Krowiak
2026-10-23 18:14   ` sashiko-bot
2026-10-23 17:43 ` [PATCH v10 14/15] s390/vfio-ap: Add 'migration' feature to sysfs 'features' attribute Anthony Krowiak
2026-10-23 18:06   ` sashiko-bot [this message]
2026-10-23 17:43 ` [PATCH v10 15/15] s390/vfio-ap: Add live guest migration chapter to vfio-ap.rst Anthony Krowiak
2026-10-23 18:09   ` sashiko-bot

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=sashiko-outbox-183040@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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