qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: Tony Krowiak <akrowiak@linux.vnet.ibm.com>,
	Halil Pasic <pasic@linux.ibm.com>,
	qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com, borntraeger@de.ibm.com,
	cohuck@redhat.com, david@redhat.com, bjsdjshi@linux.vnet.ibm.com,
	pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com,
	mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com,
	pasic@linux.vnet.ibm.com, eskultet@redhat.com,
	berrange@redhat.com, alex.williamson@redhat.com,
	eric.auger@redhat.com, pbonzini@redhat.com,
	peter.maydell@linaro.org, agraf@suse.de, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v5 4/6] s390x/vfio: ap: Introduce VFIO AP device
Date: Fri, 11 May 2018 11:02:56 +0200	[thread overview]
Message-ID: <369a35de-4313-ee41-bb11-634c6bc45a72@linux.ibm.com> (raw)
In-Reply-To: <1806faa3-dc46-f638-5c87-8a7415c9025a@linux.vnet.ibm.com>

On 10/05/2018 15:10, Tony Krowiak wrote:
> On 05/09/2018 10:28 AM, Halil Pasic wrote:
>>
>>
>> On 05/08/2018 02:25 PM, Tony Krowiak wrote:
>>> Introduces a VFIO based AP device. The device is defined via
>>> the QEMU command line by specifying:
>>>
>>>      -device vfio-ap,sysfsdev=<path-to-mediated-matrix-device>
>>>
>>> There may be only one vfio-ap device configured for a guest.
>>>
>>> The mediated matrix device is created by the VFIO AP device
>> [..]
>>> + * directory.
>>> + */
>>> +
>>> +#include <linux/vfio.h>
>>> +#include <sys/ioctl.h>
>>> +#include "qemu/osdep.h"
>>> +#include "qapi/error.h"
>>> +#include "hw/sysbus.h"
>>> +#include "hw/vfio/vfio.h"
>>> +#include "hw/vfio/vfio-common.h"
>>> +#include "hw/s390x/ap-device.h"
>>> +#include "qemu/error-report.h"
>>> +#include "qemu/queue.h"
>>> +#include "qemu/option.h"
>>> +#include "qemu/config-file.h"
>>> +#include "cpu.h"
>>> +#include "kvm_s390x.h"
>>> +#include "sysemu/sysemu.h"
>>> +
>>> +#define VFIO_AP_DEVICE_TYPE      "vfio-ap"
>>> +
>>> +typedef struct VFIOAPDevice {
>>> +    APDevice apdev;
>>> +    VFIODevice vdev;
>>> +    QTAILQ_ENTRY(VFIOAPDevice) sibling;
>>> +} VFIOAPDevice;
>>> +
>>> +VFIOAPDevice *vfio_apdev;
>>> +
>>> +static void vfio_ap_compute_needs_reset(VFIODevice *vdev)
>>> +{
>>> +    vdev->needs_reset = false;
>>> +}
>>> +
>>> +/*
>>> + * We don't need vfio_hot_reset_multi and vfio_eoi operations for
>>> + * vfio-ap-matrix device now.
>>> + */
>>> +struct VFIODeviceOps vfio_ap_ops = {
>>> +    .vfio_compute_needs_reset = vfio_ap_compute_needs_reset,
>>> +};
>>> +
>>
>> I'm not familiar with the vfio infrastructure, but AFAIR I
>> haven't seen any substantial reset handling (QEMU or kernel).
>> Did I miss something?
>
> No, you didn't miss anything, there is no reset handling.
>
>>
>> If I did not. I think this is a big problem. We need to at least
>> zeroize the queues (e.g. on system reset)  to avoid leaking
>> sensitive information. Without this, there is no sane way to use
>> ap-passthrough. Or am I wrong?
>
> I do not have a definitive answer, I will have to look into it.
> I'm thinking that since we are using ap-passthrough, the AP bus
> running on the guest would be responsible for handling reset possibly
> by resetting or zeroizing its queues. I'll get back to you on this.
>
>>
>> Regards,
>> Halil
>>
>
On the host, on system reset or subsystem reset, the queues are zeroized.

It means we must do the same for the guest and implement both cold and 
hot reset.

One of the patches in the interrupt handling serie I sent last wednesday 
zeroize
the queues on starting and stopping the guest so no data leak occurs 
between
host and guests or between guests.

However we should follow the machine specification and zeroize the 
queues between
two guest reset too. i.e. in the "reset" call back. and implement the 
VFIO_DEVICE_RESET
ioctl.


Regards,

Pierre

-- 
Pierre Morel
Linux/KVM/QEMU in Böblingen - Germany

  reply	other threads:[~2018-05-11  9:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 12:24 [Qemu-devel] [PATCH v5 0/6] s390x: vfio-ap: guest dedicated crypto adapters Tony Krowiak
2018-05-08 12:24 ` [Qemu-devel] [PATCH v5 1/6] linux-headers: linux header updates for AP support Tony Krowiak
2018-05-08 12:24 ` [Qemu-devel] [PATCH v5 2/6] s390x/ap: base Adjunct Processor (AP) object Tony Krowiak
2018-05-08 12:25 ` [Qemu-devel] [PATCH v5 3/6] s390x/cpumodel: Set up CPU model for AP device support Tony Krowiak
2018-05-15 12:00   ` Pierre Morel
2018-05-15 15:03     ` Tony Krowiak
2018-05-16  9:05       ` Pierre Morel
2018-05-16  9:23         ` David Hildenbrand
2018-05-16 10:41           ` Tony Krowiak
2018-05-08 12:25 ` [Qemu-devel] [PATCH v5 4/6] s390x/vfio: ap: Introduce VFIO AP device Tony Krowiak
2018-05-09 14:28   ` Halil Pasic
2018-05-10 13:10     ` Tony Krowiak
2018-05-11  9:02       ` Pierre Morel [this message]
2018-05-14 19:26         ` Tony Krowiak
2018-05-15  7:55           ` Pierre Morel
2018-05-15 15:09             ` Tony Krowiak
2018-05-16  9:09               ` Pierre Morel
2018-05-16 10:43                 ` Tony Krowiak
2018-05-11 10:29       ` Halil Pasic
2018-05-14 19:18         ` Tony Krowiak
2018-05-08 12:25 ` [Qemu-devel] [PATCH v5 5/6] s390: doc: detailed specifications for AP virtualization Tony Krowiak
2018-05-08 12:25 ` [Qemu-devel] [PATCH v5 6/6] MAINTAINERS: add entries for AP Tony Krowiak
2018-05-08 12:46   ` Cornelia Huck
2018-05-08 12:47     ` Cornelia Huck
2018-05-09 13:29       ` Tony Krowiak
2018-05-08 13:47     ` Halil Pasic
2018-05-09 13:30       ` Tony Krowiak
2018-05-09  3:46     ` Alexey Kardashevskiy
2018-05-09 13:28     ` Tony Krowiak
2018-05-08 12:48 ` [Qemu-devel] [PATCH v5 0/6] s390x: vfio-ap: guest dedicated crypto adapters no-reply

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=369a35de-4313-ee41-bb11-634c6bc45a72@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=agraf@suse.de \
    --cc=akrowiak@linux.vnet.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=berrange@redhat.com \
    --cc=bjsdjshi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=eskultet@redhat.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=mjrosato@linux.vnet.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pmorel@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).