All of lore.kernel.org
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Tony Krowiak <akrowiak@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, freude@linux.ibm.com,
	borntraeger@de.ibm.com, cohuck@redhat.com, frankja@linux.ibm.com,
	david@redhat.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com, pmorel@linux.ibm.com,
	alex.williamson@redhat.com, kwankhede@nvidia.com
Subject: Re: [PATCH v2 7/8] s390: vfio-ap: handle bind and unbind of AP queue device
Date: Tue, 23 Apr 2019 15:54:58 +0200	[thread overview]
Message-ID: <20190423155458.65966ebf.pasic@linux.ibm.com> (raw)
In-Reply-To: <1555796980-27920-8-git-send-email-akrowiak@linux.ibm.com>

On Sat, 20 Apr 2019 17:49:39 -0400
Tony Krowiak <akrowiak@linux.ibm.com> wrote:

> +void vfio_ap_mdev_probe_queue(unsigned long apid, unsigned long apqi)
> +{
> +	struct ap_matrix_mdev *matrix_mdev;
> +
> +	matrix_mdev = vfio_ap_mdev_find_matrix_mdev(apid, apqi);
> +
> +	/*
> +	 * If the queue is assigned to the mdev device and the mdev device
> +	 * is in use by a guest
> +	 */
> +	if (matrix_mdev && matrix_mdev->kvm) {
> +		/* Plug the adapter into the guest */
> +		set_bit_inv(apid, matrix_mdev->shadow_crycb->apm);
> +
> +		/* Make sure the queue is also plugged in to the guest */
> +		if (!test_bit_inv(apqi, matrix_mdev->shadow_crycb->aqm))
> +			set_bit_inv(apqi, matrix_mdev->shadow_crycb->aqm);
> +
> +		vfio_ap_mdev_update_crycb(matrix_mdev);

With this you effectively grant access to all the assigned domains on
the AP identified by the apid, not only to the domain identified by
apqi! But some of these queues may still not be bound to the vfio_ap
driver.

IMHO you should only set the apid-th bit in apm if all queues (apid, q)
such that q-th bit is set in aqm are bound to the vfio_ap driver.

BTW a 'shadow' (or effective) apm would perfectly suffice. I don't think
you fiddle with shadow_crycb->a[qd]m, and if you do, I don't think that's
a good idea.

Regards,
Halil

> +	}
> +}


  parent reply	other threads:[~2019-04-23 13:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 21:49 [PATCH v2 0/8] s390: vfio-ap: dynamic configuration support Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 1/8] s390: vfio-ap: maintain a shadow of the CRYCB in use by a guest Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 2/8] s390: vfio-ap: sysfs interface to display guest CRYCB Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 3/8] s390: vfio-ap: allow assignment of unavailable AP resources to mdev device Tony Krowiak
2019-04-23 12:46   ` Pierre Morel
2019-04-23 13:19     ` Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 4/8] s390: vfio-ap: allow hot plug/unplug of AP resources using " Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 5/8] s390: vfio-ap: wait for queue empty on queue reset Tony Krowiak
2019-04-23 12:50   ` Pierre Morel
2019-04-23 13:28     ` Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 6/8] s390: kvm: test CRYCB masks before setting them Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 7/8] s390: vfio-ap: handle bind and unbind of AP queue device Tony Krowiak
2019-04-23 13:08   ` Pierre Morel
2019-04-23 13:36     ` Tony Krowiak
2019-04-23 13:38   ` Pierre Morel
2019-04-23 14:53     ` Tony Krowiak
2019-04-23 13:54   ` Halil Pasic [this message]
2019-04-23 15:27     ` Tony Krowiak
2019-04-20 21:49 ` [PATCH v2 8/8] s390: vfio-ap: update documentation Tony Krowiak

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=20190423155458.65966ebf.pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.