public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
	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
Subject: Re: [PATCH v9 2/2] s390/kvm: diagnose 0x318 sync and reset
Date: Tue, 23 Jun 2020 10:47:32 +0200	[thread overview]
Message-ID: <a1bcfa5a-368a-cdef-9681-aff2deee2a42@de.ibm.com> (raw)
In-Reply-To: <4387834c-7cd4-df50-294c-4f56aa14a089@de.ibm.com>



On 23.06.20 10:45, Christian Borntraeger wrote:
> 
> 
> On 23.06.20 10:42, Thomas Huth wrote:
>> On 22/06/2020 17.46, Collin Walling wrote:
>>> DIAGNOSE 0x318 (diag318) 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 handles the instruction as well as migration. Data
>>> is communicated via VCPU register synchronization.
>>>
>>> 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_vcpu_arch struct.
>>>
>>> This data is reset on load normal and clear resets.
>>>
>>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>>> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>>  arch/s390/include/asm/kvm_host.h |  4 +++-
>>>  arch/s390/include/uapi/asm/kvm.h |  5 ++++-
>>>  arch/s390/kvm/kvm-s390.c         | 11 ++++++++++-
>>>  arch/s390/kvm/vsie.c             |  1 +
>>>  include/uapi/linux/kvm.h         |  1 +
>>>  5 files changed, 19 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>>> index 3d554887794e..8bdf6f1607ca 100644
>>> --- a/arch/s390/include/asm/kvm_host.h
>>> +++ b/arch/s390/include/asm/kvm_host.h
>>> @@ -260,7 +260,8 @@ struct kvm_s390_sie_block {
>>>  	__u32	scaol;			/* 0x0064 */
>>>  	__u8	sdf;			/* 0x0068 */
>>>  	__u8    epdx;			/* 0x0069 */
>>> -	__u8    reserved6a[2];		/* 0x006a */
>>> +	__u8	cpnc;			/* 0x006a */
>>> +	__u8	reserved6b;		/* 0x006b */
>>>  	__u32	todpr;			/* 0x006c */
>>>  #define GISA_FORMAT1 0x00000001
>>>  	__u32	gd;			/* 0x0070 */
>>> @@ -745,6 +746,7 @@ struct kvm_vcpu_arch {
>>>  	bool gs_enabled;
>>>  	bool skey_enabled;
>>>  	struct kvm_s390_pv_vcpu pv;
>>> +	union diag318_info diag318_info;
>>>  };
>>>  
>>>  struct kvm_vm_stat {
>>> diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
>>> index 436ec7636927..2ae1b660086c 100644
>>> --- a/arch/s390/include/uapi/asm/kvm.h
>>> +++ b/arch/s390/include/uapi/asm/kvm.h
>>> @@ -231,11 +231,13 @@ struct kvm_guest_debug_arch {
>>>  #define KVM_SYNC_GSCB   (1UL << 9)
>>>  #define KVM_SYNC_BPBC   (1UL << 10)
>>>  #define KVM_SYNC_ETOKEN (1UL << 11)
>>> +#define KVM_SYNC_DIAG318 (1UL << 12)
>>>  
>>>  #define KVM_SYNC_S390_VALID_FIELDS \
>>>  	(KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \
>>>  	 KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \
>>> -	 KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN)
>>> +	 KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN | \
>>> +	 KVM_SYNC_DIAG318)
>>>  
>>>  /* length and alignment of the sdnx as a power of two */
>>>  #define SDNXC 8
>>> @@ -254,6 +256,7 @@ struct kvm_sync_regs {
>>>  	__u64 pft;	/* pfault token [PFAULT] */
>>>  	__u64 pfs;	/* pfault select [PFAULT] */
>>>  	__u64 pfc;	/* pfault compare [PFAULT] */
>>> +	__u64 diag318;	/* diagnose 0x318 info */
>>>  	union {
>>>  		__u64 vrs[32][2];	/* vector registers (KVM_SYNC_VRS) */
>>>  		__u64 fprs[16];		/* fp registers (KVM_SYNC_FPRS) */
>>
>> It's been a while since I touched kvm_sync_regs the last time ... but
>> can your really extend this structure right in the middle without
>> breaking older user spaces (ie. QEMUs) ? This is a uapi header ... so I
>> think you rather have to add this add the end or e.g. put it into the
>> padding2 region or something like that...? Or do I miss something?
> 
> Argh. You are right. It should go to the end and not in the middle. Will fixup.
> 

Something like this on top. 

diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index 2ae1b660086c..7a6b14874d65 100644
--- a/arch/s390/include/uapi/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -256,7 +256,6 @@ struct kvm_sync_regs {
        __u64 pft;      /* pfault token [PFAULT] */
        __u64 pfs;      /* pfault select [PFAULT] */
        __u64 pfc;      /* pfault compare [PFAULT] */
-       __u64 diag318;  /* diagnose 0x318 info */
        union {
                __u64 vrs[32][2];       /* vector registers (KVM_SYNC_VRS) */
                __u64 fprs[16];         /* fp registers (KVM_SYNC_FPRS) */
@@ -267,7 +266,8 @@ struct kvm_sync_regs {
        __u8 reserved2 : 7;
        __u8 padding1[51];      /* riccb needs to be 64byte aligned */
        __u8 riccb[64];         /* runtime instrumentation controls block */
-       __u8 padding2[192];     /* sdnx needs to be 256byte aligned */
+       __u64 diag318;          /* diagnose 0x318 info */
+       __u8 padding2[184];     /* sdnx needs to be 256byte aligned */
        union {
                __u8 sdnx[SDNXL];  /* state description annex */
                struct {

  reply	other threads:[~2020-06-23  8:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 15:46 [PATCH v9 0/2] Use DIAG318 to set Control Program Name & Version Codes Collin Walling
2020-06-22 15:46 ` [PATCH v9 1/2] s390/setup: diag 318: refactor struct Collin Walling
2020-06-22 15:46 ` [PATCH v9 2/2] s390/kvm: diagnose 0x318 sync and reset Collin Walling
2020-06-22 16:04   ` Cornelia Huck
2020-06-22 16:13     ` Collin Walling
2020-06-22 16:23       ` Collin Walling
2020-06-22 16:35         ` Cornelia Huck
2020-06-22 16:45           ` Collin Walling
2020-06-23  7:12   ` David Hildenbrand
2020-06-23  8:42   ` Thomas Huth
2020-06-23  8:45     ` Christian Borntraeger
2020-06-23  8:47       ` Christian Borntraeger [this message]
2020-06-23  8:58         ` Thomas Huth
2020-06-23  7:13 ` [PATCH v9 0/2] Use DIAG318 to set Control Program Name & Version Codes Christian Borntraeger
2020-06-23 14:38   ` Collin Walling

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=a1bcfa5a-368a-cdef-9681-aff2deee2a42@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