kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>, Janosch Frank <frankja@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	thuth@redhat.com, david@redhat.com, imbrenda@linux.ibm.com,
	mihajlov@linux.ibm.com, mimu@linux.ibm.com, gor@linux.ibm.com
Subject: Re: [RFC 02/37] s390/protvirt: introduce host side setup
Date: Mon, 4 Nov 2019 18:50:12 +0100	[thread overview]
Message-ID: <5a34febd-8abc-84f5-195e-43decbb366a5@de.ibm.com> (raw)
In-Reply-To: <20191104165427.0e5e6da4.cohuck@redhat.com>



On 04.11.19 16:54, Cornelia Huck wrote:
> On Thu, 24 Oct 2019 07:40:24 -0400
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> From: Vasily Gorbik <gor@linux.ibm.com>
>>
>> Introduce KVM_S390_PROTECTED_VIRTUALIZATION_HOST kbuild option for
>> protected virtual machines hosting support code.
>>
>> Add "prot_virt" command line option which controls if the kernel
>> protected VMs support is enabled at runtime.
>>
>> Extend ultravisor info definitions and expose it via uv_info struct
>> filled in during startup.
>>
>> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
>> ---
>>  .../admin-guide/kernel-parameters.txt         |  5 ++
>>  arch/s390/boot/Makefile                       |  2 +-
>>  arch/s390/boot/uv.c                           | 20 +++++++-
>>  arch/s390/include/asm/uv.h                    | 46 ++++++++++++++++--
>>  arch/s390/kernel/Makefile                     |  1 +
>>  arch/s390/kernel/setup.c                      |  4 --
>>  arch/s390/kernel/uv.c                         | 48 +++++++++++++++++++
>>  arch/s390/kvm/Kconfig                         |  9 ++++
>>  8 files changed, 126 insertions(+), 9 deletions(-)
>>  create mode 100644 arch/s390/kernel/uv.c
> 
> (...)
> 
>> diff --git a/arch/s390/boot/uv.c b/arch/s390/boot/uv.c
>> index ed007f4a6444..88cf8825d169 100644
>> --- a/arch/s390/boot/uv.c
>> +++ b/arch/s390/boot/uv.c
>> @@ -3,7 +3,12 @@
>>  #include <asm/facility.h>
>>  #include <asm/sections.h>
>>  
>> +#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
>>  int __bootdata_preserved(prot_virt_guest);
>> +#endif
>> +#ifdef CONFIG_KVM_S390_PROTECTED_VIRTUALIZATION_HOST
>> +struct uv_info __bootdata_preserved(uv_info);
>> +#endif
> 
> Two functions with the same name, but different signatures look really
> ugly.
> 
> Also, what happens if I want to build just a single kernel image for
> both guest and host?

This is not two functions with the same name. It is 2 variable declarations with
the __bootdata_preserved helper. We expect to have all distro kernels to enable
both. 

> 
>>  
>>  void uv_query_info(void)
>>  {
>> @@ -18,7 +23,20 @@ void uv_query_info(void)
>>  	if (uv_call(0, (uint64_t)&uvcb))
>>  		return;
>>  
>> -	if (test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list) &&
>> +	if (IS_ENABLED(CONFIG_KVM_S390_PROTECTED_VIRTUALIZATION_HOST)) {
> 
> Do we always have everything needed for a host if uv_call() is
> successful?

The uv_call is the query call. It will provide the list of features. We check that
later on.

> 
>> +		memcpy(uv_info.inst_calls_list, uvcb.inst_calls_list, sizeof(uv_info.inst_calls_list));
>> +		uv_info.uv_base_stor_len = uvcb.uv_base_stor_len;
>> +		uv_info.guest_base_stor_len = uvcb.conf_base_phys_stor_len;
>> +		uv_info.guest_virt_base_stor_len = uvcb.conf_base_virt_stor_len;
>> +		uv_info.guest_virt_var_stor_len = uvcb.conf_virt_var_stor_len;
>> +		uv_info.guest_cpu_stor_len = uvcb.cpu_stor_len;
>> +		uv_info.max_sec_stor_addr = ALIGN(uvcb.max_guest_stor_addr, PAGE_SIZE);
>> +		uv_info.max_num_sec_conf = uvcb.max_num_sec_conf;
>> +		uv_info.max_guest_cpus = uvcb.max_guest_cpus;
>> +	}
>> +
>> +	if (IS_ENABLED(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) &&
>> +	    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))
> 
> Especially as it looks like we need to test for those two commands to
> determine whether we have support for a guest.
> 
>>  		prot_virt_guest = 1;
>>  }
>> diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h
>> index ef3c00b049ab..6db1bc495e67 100644
>> --- a/arch/s390/include/asm/uv.h
>> +++ b/arch/s390/include/asm/uv.h
>> @@ -44,7 +44,19 @@ struct uv_cb_qui {
>>  	struct uv_cb_header header;
>>  	u64 reserved08;
>>  	u64 inst_calls_list[4];
>> -	u64 reserved30[15];
>> +	u64 reserved30[2];
>> +	u64 uv_base_stor_len;
>> +	u64 reserved48;
>> +	u64 conf_base_phys_stor_len;
>> +	u64 conf_base_virt_stor_len;
>> +	u64 conf_virt_var_stor_len;
>> +	u64 cpu_stor_len;
>> +	u32 reserved68[3];
>> +	u32 max_num_sec_conf;
>> +	u64 max_guest_stor_addr;
>> +	u8  reserved80[150-128];
>> +	u16 max_guest_cpus;
>> +	u64 reserved98;
>>  } __packed __aligned(8);
>>  
>>  struct uv_cb_share {
>> @@ -69,9 +81,21 @@ static inline int uv_call(unsigned long r1, unsigned long r2)
>>  	return cc;
>>  }
>>  
>> -#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
>> +struct uv_info {
>> +	unsigned long inst_calls_list[4];
>> +	unsigned long uv_base_stor_len;
>> +	unsigned long guest_base_stor_len;
>> +	unsigned long guest_virt_base_stor_len;
>> +	unsigned long guest_virt_var_stor_len;
>> +	unsigned long guest_cpu_stor_len;
>> +	unsigned long max_sec_stor_addr;
>> +	unsigned int max_num_sec_conf;
>> +	unsigned short max_guest_cpus;
>> +};
> 
> What is the main difference between uv_info and uv_cb_qui? The
> alignment of max_sec_stor_addr?

One is the hardware data structure for query, the other one is the Linux
internal state.

> 
>> +extern struct uv_info uv_info;
>>  extern int prot_virt_guest;
>>  
>> +#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
>>  static inline int is_prot_virt_guest(void)
>>  {
>>  	return prot_virt_guest;
>> @@ -121,11 +145,27 @@ static inline int uv_remove_shared(unsigned long addr)
>>  	return share(addr, UVC_CMD_REMOVE_SHARED_ACCESS);
>>  }
>>  
>> -void uv_query_info(void);
>>  #else
>>  #define is_prot_virt_guest() 0
>>  static inline int uv_set_shared(unsigned long addr) { return 0; }
>>  static inline int uv_remove_shared(unsigned long addr) { return 0; }
>> +#endif
>> +
>> +#ifdef CONFIG_KVM_S390_PROTECTED_VIRTUALIZATION_HOST
>> +extern int prot_virt_host;
>> +
>> +static inline int is_prot_virt_host(void)
>> +{
>> +	return prot_virt_host;
>> +}
>> +#else
>> +#define is_prot_virt_host() 0
>> +#endif
>> +
>> +#if defined(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) ||                          \
>> +	defined(CONFIG_KVM_S390_PROTECTED_VIRTUALIZATION_HOST)
>> +void uv_query_info(void);
>> +#else
>>  static inline void uv_query_info(void) {}
>>  #endif
> 
> (...)
> 
[...]


  reply	other threads:[~2019-11-04 17:50 UTC|newest]

Thread overview: 213+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 11:40 [RFC 00/37] KVM: s390: Add support for protected VMs Janosch Frank
2019-10-24 11:40 ` [RFC 01/37] DOCUMENTATION: protvirt: Protected virtual machine introduction Janosch Frank
2019-11-01  8:18   ` Christian Borntraeger
2019-11-04 14:18   ` Cornelia Huck
2019-11-12 14:38     ` Janosch Frank
2019-10-24 11:40 ` [RFC 02/37] s390/protvirt: introduce host side setup Janosch Frank
2019-10-24 13:25   ` David Hildenbrand
2019-10-24 13:27     ` David Hildenbrand
2019-10-24 13:40       ` Christian Borntraeger
2019-10-24 15:52         ` David Hildenbrand
2019-10-24 16:30           ` Claudio Imbrenda
2019-10-24 16:54             ` David Hildenbrand
2019-10-28 14:54   ` Cornelia Huck
2019-10-28 20:20     ` Christian Borntraeger
2019-11-01  8:53   ` Christian Borntraeger
2019-11-04 14:26     ` Cornelia Huck
2019-11-12 14:47       ` Janosch Frank
2019-11-04 15:54   ` Cornelia Huck
2019-11-04 17:50     ` Christian Borntraeger [this message]
2019-11-05  9:26       ` Cornelia Huck
2019-11-08 12:14         ` Thomas Huth
2019-10-24 11:40 ` [RFC 03/37] s390/protvirt: add ultravisor initialization Janosch Frank
2019-10-25  9:21   ` David Hildenbrand
2019-10-28 15:48     ` Vasily Gorbik
2019-10-28 15:54       ` David Hildenbrand
2019-11-01 10:07   ` Christian Borntraeger
2019-11-07 15:28   ` Cornelia Huck
2019-11-07 15:32     ` Janosch Frank
2019-10-24 11:40 ` [RFC 04/37] KVM: s390: protvirt: Add initial lifecycle handling Janosch Frank
2019-10-25  8:58   ` David Hildenbrand
2019-10-25  9:02     ` David Hildenbrand
2019-11-04  8:18   ` Christian Borntraeger
2019-11-04  8:41     ` Janosch Frank
2019-11-07 16:29   ` Cornelia Huck
2019-11-08  7:36     ` Janosch Frank
2019-11-11 16:25       ` Cornelia Huck
2019-11-11 16:39         ` Janosch Frank
2019-11-11 16:54           ` Cornelia Huck
2019-11-13 10:05         ` Thomas Huth
2019-11-08 13:44   ` Thomas Huth
2019-11-13 10:28   ` Thomas Huth
2019-11-13 11:34     ` Janosch Frank
2019-11-13 14:03     ` [PATCH] Fix unpack Janosch Frank
2019-11-13 14:19       ` Thomas Huth
2019-11-13 14:36       ` Cornelia Huck
2019-11-13 11:48   ` [RFC 04/37] KVM: s390: protvirt: Add initial lifecycle handling Cornelia Huck
2019-10-24 11:40 ` [RFC 05/37] s390: KVM: Export PV handle to gmap Janosch Frank
2019-10-25  9:04   ` David Hildenbrand
2019-10-24 11:40 ` [RFC 06/37] s390: UV: Add import and export to UV library Janosch Frank
2019-10-25  8:31   ` David Hildenbrand
2019-10-25  8:39     ` Janosch Frank
2019-10-25  8:40       ` David Hildenbrand
2019-10-25  8:42         ` Janosch Frank
2019-11-01 11:26   ` Christian Borntraeger
2019-11-01 12:25     ` Janosch Frank
2019-11-01 12:39       ` Christian Borntraeger
2019-11-01 12:42   ` Christian Borntraeger
2019-11-11 16:40   ` Cornelia Huck
2019-11-11 16:56     ` Janosch Frank
2019-10-24 11:40 ` [RFC 07/37] KVM: s390: protvirt: Secure memory is not mergeable Janosch Frank
2019-10-24 16:07   ` David Hildenbrand
2019-10-24 16:33     ` Claudio Imbrenda
2019-10-24 16:49       ` David Hildenbrand
2019-10-25  7:18     ` Janosch Frank
2019-10-25  8:04       ` David Hildenbrand
2019-10-25  8:20         ` Janosch Frank
2019-10-25  7:46   ` David Hildenbrand
2019-10-25  8:24   ` [RFC v2] " Janosch Frank
2019-11-01 13:02     ` Christian Borntraeger
2019-11-04 14:32     ` David Hildenbrand
2019-11-04 14:36       ` Janosch Frank
2019-11-04 14:38         ` David Hildenbrand
2019-11-13 12:23     ` Thomas Huth
2019-11-13 15:54       ` Janosch Frank
2019-10-24 11:40 ` [RFC 08/37] KVM: s390: add missing include in gmap.h Janosch Frank
2019-10-25  8:24   ` David Hildenbrand
2019-11-13 12:27   ` Thomas Huth
2019-10-24 11:40 ` [RFC 09/37] KVM: s390: protvirt: Implement on-demand pinning Janosch Frank
2019-10-25  8:49   ` David Hildenbrand
2019-10-31 15:41     ` Christian Borntraeger
2019-10-31 17:30       ` David Hildenbrand
2019-10-31 20:57         ` Janosch Frank
2019-11-04 10:19           ` David Hildenbrand
2019-11-04 10:25             ` Janosch Frank
2019-11-04 10:27               ` David Hildenbrand
2019-11-04 13:58             ` Christian Borntraeger
2019-11-04 14:08               ` David Hildenbrand
2019-11-04 14:42                 ` David Hildenbrand
2019-11-04 17:17                   ` Cornelia Huck
2019-11-04 17:44                     ` David Hildenbrand
2019-11-04 18:38                     ` David Hildenbrand
2019-11-05  9:15                       ` Cornelia Huck
2019-11-01  8:50         ` Claudio Imbrenda
2019-11-04 10:22           ` David Hildenbrand
2019-11-02  8:53   ` Christian Borntraeger
2019-11-04 14:17   ` David Hildenbrand
2019-10-24 11:40 ` [RFC 10/37] s390: add (non)secure page access exceptions handlers Janosch Frank
2019-10-24 11:40 ` [RFC 11/37] DOCUMENTATION: protvirt: Interrupt injection Janosch Frank
2019-11-14 13:09   ` Cornelia Huck
2019-11-14 13:25     ` Claudio Imbrenda
2019-11-14 13:47       ` Cornelia Huck
2019-11-14 16:33         ` Janosch Frank
2019-10-24 11:40 ` [RFC 12/37] KVM: s390: protvirt: Handle SE notification interceptions Janosch Frank
2019-10-30 15:50   ` David Hildenbrand
2019-10-30 17:58     ` Janosch Frank
2019-11-05 18:04   ` Cornelia Huck
2019-11-05 18:15     ` Christian Borntraeger
2019-11-05 18:37       ` Cornelia Huck
2019-10-24 11:40 ` [RFC 13/37] KVM: s390: protvirt: Add interruption injection controls Janosch Frank
2019-10-30 15:53   ` David Hildenbrand
2019-10-31  8:48     ` Michael Mueller
2019-10-31  9:15       ` David Hildenbrand
2019-10-31 12:10         ` Michael Mueller
2019-11-05 17:51   ` Cornelia Huck
2019-11-07 12:42     ` Michael Mueller
2019-11-14 11:48   ` Thomas Huth
2019-10-24 11:40 ` [RFC 14/37] KVM: s390: protvirt: Implement interruption injection Janosch Frank
2019-11-04 10:29   ` David Hildenbrand
2019-11-04 14:05     ` Christian Borntraeger
2019-11-04 14:23       ` David Hildenbrand
2019-11-14 12:07   ` Thomas Huth
2019-10-24 11:40 ` [RFC 15/37] KVM: s390: protvirt: Add machine-check interruption injection controls Janosch Frank
2019-11-13 14:49   ` Thomas Huth
2019-11-13 15:57     ` Michael Mueller
2019-10-24 11:40 ` [RFC 16/37] KVM: s390: protvirt: Implement machine-check interruption injection Janosch Frank
2019-11-05 18:11   ` Cornelia Huck
2019-10-24 11:40 ` [RFC 17/37] DOCUMENTATION: protvirt: Instruction emulation Janosch Frank
2019-11-14 15:15   ` Cornelia Huck
2019-11-14 15:20     ` Claudio Imbrenda
2019-11-14 15:41       ` Cornelia Huck
2019-11-14 15:55         ` Janosch Frank
2019-11-14 16:03           ` Cornelia Huck
2019-11-14 16:18             ` Janosch Frank
2019-10-24 11:40 ` [RFC 18/37] KVM: s390: protvirt: Handle spec exception loops Janosch Frank
2019-11-14 14:22   ` Thomas Huth
2019-10-24 11:40 ` [RFC 19/37] KVM: s390: protvirt: Add new gprs location handling Janosch Frank
2019-11-04 11:25   ` David Hildenbrand
2019-11-05 12:01     ` Christian Borntraeger
2019-11-05 12:39       ` Janosch Frank
2019-11-05 13:55         ` David Hildenbrand
2019-11-05 14:11           ` Janosch Frank
2019-11-05 14:18             ` David Hildenbrand
2019-11-14 14:46               ` Thomas Huth
2019-11-14 14:44   ` Thomas Huth
2019-11-14 15:56     ` Janosch Frank
2019-10-24 11:40 ` [RFC 20/37] KVM: S390: protvirt: Introduce instruction data area bounce buffer Janosch Frank
2019-11-14 15:36   ` Thomas Huth
2019-11-14 16:04     ` Janosch Frank
2019-11-14 16:21     ` [PATCH] Fixup sida bouncing Janosch Frank
2019-11-15  8:19       ` Thomas Huth
2019-11-15  8:50         ` Janosch Frank
2019-11-15  9:21           ` Thomas Huth
2019-10-24 11:40 ` [RFC 21/37] KVM: S390: protvirt: Instruction emulation Janosch Frank
2019-11-14 15:38   ` Cornelia Huck
2019-11-14 16:00     ` Janosch Frank
2019-11-14 16:05       ` Cornelia Huck
2019-10-24 11:40 ` [RFC 22/37] KVM: s390: protvirt: Add SCLP handling Janosch Frank
2019-10-24 11:40 ` [RFC 23/37] KVM: s390: protvirt: Make sure prefix is always protected Janosch Frank
2019-11-18 16:39   ` Cornelia Huck
2019-11-19  8:11     ` Janosch Frank
2019-11-19  9:45       ` Cornelia Huck
2019-11-19 10:08         ` Janosch Frank
2019-11-19 10:18   ` David Hildenbrand
2019-11-19 11:36     ` Janosch Frank
2019-10-24 11:40 ` [RFC 24/37] KVM: s390: protvirt: Write sthyi data to instruction data area Janosch Frank
2019-11-15  8:04   ` Thomas Huth
2019-11-15 10:16     ` Janosch Frank
2019-11-15 10:21       ` Thomas Huth
2019-11-15 12:17         ` [PATCH] SIDAD macro fixup Janosch Frank
2019-10-24 11:40 ` [RFC 25/37] KVM: s390: protvirt: STSI handling Janosch Frank
2019-11-15  8:27   ` Thomas Huth
2019-10-24 11:40 ` [RFC 26/37] KVM: s390: protvirt: Only sync fmt4 registers Janosch Frank
2019-11-15  9:02   ` Thomas Huth
2019-11-15 10:01     ` Janosch Frank
2019-10-24 11:40 ` [RFC 27/37] KVM: s390: protvirt: SIGP handling Janosch Frank
2019-10-30 18:29   ` David Hildenbrand
2019-11-15 11:15   ` Thomas Huth
2019-10-24 11:40 ` [RFC 28/37] KVM: s390: protvirt: Add program exception injection Janosch Frank
2019-10-24 11:40 ` [RFC 29/37] KVM: s390: protvirt: Sync pv state Janosch Frank
2019-11-15  9:36   ` Thomas Huth
2019-11-15  9:59     ` Janosch Frank
2019-10-24 11:40 ` [RFC 30/37] DOCUMENTATION: protvirt: Diag 308 IPL Janosch Frank
2019-11-06 16:48   ` Cornelia Huck
2019-11-06 17:05     ` Janosch Frank
2019-11-06 17:37       ` Cornelia Huck
2019-11-06 21:02         ` Janosch Frank
2019-11-07  8:53           ` Cornelia Huck
2019-11-07  8:59             ` Janosch Frank
2019-10-24 11:40 ` [RFC 31/37] KVM: s390: protvirt: Add diag 308 subcode 8 - 10 handling Janosch Frank
2019-11-15 10:04   ` Thomas Huth
2019-11-15 10:20     ` Janosch Frank
2019-11-15 10:27       ` Thomas Huth
2019-11-15 11:29         ` Janosch Frank
2019-10-24 11:40 ` [RFC 32/37] KVM: s390: protvirt: UV calls diag308 0, 1 Janosch Frank
2019-11-15 10:07   ` Thomas Huth
2019-11-15 11:39     ` Janosch Frank
2019-11-15 13:30       ` Thomas Huth
2019-11-15 14:08         ` Janosch Frank
2019-10-24 11:40 ` [RFC 33/37] KVM: s390: Introduce VCPU reset IOCTL Janosch Frank
2019-11-15 10:47   ` Thomas Huth
2019-11-15 13:06     ` Janosch Frank
2019-11-15 13:18       ` Thomas Huth
2019-10-24 11:40 ` [RFC 34/37] KVM: s390: protvirt: Report CPU state to Ultravisor Janosch Frank
2019-10-24 11:40 ` [RFC 35/37] KVM: s390: Fix cpu reset local IRQ clearing Janosch Frank
2019-11-15 11:23   ` Thomas Huth
2019-11-15 11:37     ` Janosch Frank
2019-10-24 11:40 ` [RFC 36/37] KVM: s390: protvirt: Support cmd 5 operation state Janosch Frank
2019-11-15 11:25   ` Thomas Huth
2019-11-18 17:38   ` Cornelia Huck
2019-11-19  8:13     ` Janosch Frank
2019-11-19 10:23       ` Cornelia Huck
2019-11-19 11:40         ` Janosch Frank
2019-10-24 11:40 ` [RFC 37/37] KVM: s390: protvirt: Add UV debug trace Janosch Frank

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=5a34febd-8abc-84f5-195e-43decbb366a5@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=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mihajlov@linux.ibm.com \
    --cc=mimu@linux.ibm.com \
    --cc=thuth@redhat.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).