kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Collin Walling <walling@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org
Cc: pbonzini@redhat.com, frankja@linux.ibm.com, david@redhat.com,
	cohuck@redhat.com, imbrenda@linux.ibm.com,
	heiko.carstens@de.ibm.com, gor@linux.ibm.com, thuth@redhat.com
Subject: Re: [PATCH v7 3/3] s390/kvm: diagnose 0x318 get/set handling
Date: Mon, 15 Jun 2020 12:55:15 +0200	[thread overview]
Message-ID: <96ba2e27-d7fd-f6f4-481b-46bf36907a7e@de.ibm.com> (raw)
In-Reply-To: <d1ef0fed-053c-8e95-f5a6-53423de27957@linux.ibm.com>



On 21.05.20 08:15, Collin Walling wrote:
> On 5/18/20 5:15 AM, Christian Borntraeger wrote:
>>
>>
>> On 16.05.20 00:19, Collin Walling wrote:
>>> DIAGNOSE 0x318 (diag 318) sets information regarding the environment
>>> the VM is running in (Linux, z/VM, etc) and is observed via
>>> firmware/service events.
>>>
>>> This is a privileged s390x instruction that must be intercepted by
>>> SIE. Userspace handling is required, so let's introduce some functions
>>> to communicate between userspace and KVM via ioctls. These will be used
>>> to get/set the diag 318 related information.
>>>
>>> The Control Program Name Code (CPNC) is stored in the SIE block. The
>>> CPNC along with the Control Program Version Code (CPVC) are stored in
>>> the kvm_arch struct.
>>>
>>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>>> ---
>>>  Documentation/virt/kvm/devices/vm.rst | 21 +++++++
>>>  arch/s390/include/asm/kvm_host.h      |  5 +-
>>>  arch/s390/include/uapi/asm/kvm.h      |  4 ++
>>>  arch/s390/kvm/kvm-s390.c              | 82 +++++++++++++++++++++++++++
>>>  arch/s390/kvm/vsie.c                  |  2 +
>>>  5 files changed, 113 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/virt/kvm/devices/vm.rst b/Documentation/virt/kvm/devices/vm.rst
>>> index 0aa5b1cfd700..52cc906dd7bd 100644
>>> --- a/Documentation/virt/kvm/devices/vm.rst
>>> +++ b/Documentation/virt/kvm/devices/vm.rst
>>> @@ -314,3 +314,24 @@ Allows userspace to query the status of migration mode.
>>>  	     if it is enabled
>>>  :Returns:   -EFAULT if the given address is not accessible from kernel space;
>>>  	    0 in case of success.
>>> +
>>> +6. GROUP: KVM_S390_VM_MISC
>>> +==========================
>>> +
>>> +:Architectures: s390
>>> +
>>> +6.1. KVM_S390_VM_MISC_DIAG_318 (r/w)
>>> +-----------------------------------
>>> +
>>> +Allows userspace to retrieve and set the DIAGNOSE 0x318 information,
>>> +which consists of a 1-byte "Control Program Name Code" and a 7-byte
>>> +"Control Program Version Code" (a 64 bit value all in all). This
>>> +information is set by the guest (usually during IPL). This interface is
>>> +intended to allow retrieving and setting it during migration; while no
>>> +real harm is done if the information is changed outside of migration,
>>> +it is strongly discouraged.
>>> +
>>> +:Parameters: address of a buffer in user space (u64), where the
>>> +	     information is read from or stored into
>>> +:Returns:    -EFAULT if the given address is not accessible from kernel space;
>>> +	     0 in case of success
>>
>>
>> An alternative would be a new sync_reg value + KVM capability.
>>
>>
> 
> I did some investigation into this (new grounds for me)
> 
> sync_reg would handle the migration part, and then we'd just need the
> ioctl so the diag instruction handler can set the data. Does that sound
> right?

We would not even need the ioctl. We could just export/import this all the
time. See the sync_regs and store_regs functions.

      reply	other threads:[~2020-06-15 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 22:19 [PATCH v7 0/3] Use DIAG318 to set Control Program Name & Version Codes Collin Walling
2020-05-15 22:19 ` [PATCH v7 1/3] s390/setup: diag 318: refactor struct Collin Walling
2020-05-15 22:19 ` [PATCH v7 2/3] s390: keep diag 318 variables consistent with the rest Collin Walling
2020-05-18  6:30   ` Thomas Huth
2020-05-18 14:46     ` Collin Walling
2020-05-15 22:19 ` [PATCH v7 3/3] s390/kvm: diagnose 0x318 get/set handling Collin Walling
2020-05-18  9:15   ` Christian Borntraeger
2020-05-21  6:15     ` Collin Walling
2020-06-15 10:55       ` Christian Borntraeger [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=96ba2e27-d7fd-f6f4-481b-46bf36907a7e@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    --cc=walling@linux.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).