qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Alexander Graf <agraf@suse.com>, Alexander Graf <agraf@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-s390 <linux-s390@vger.kernel.org>,
	Michael Mueller <mimu@linux.vnet.ibm.com>,
	KVM <kvm@vger.kernel.org>,
	Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH/RFC] s390: Provide a configuration and control device
Date: Wed, 02 Apr 2014 10:54:00 +0200	[thread overview]
Message-ID: <533BD028.8060307@de.ibm.com> (raw)
In-Reply-To: <533BCCD4.3060601@suse.com>

On 02/04/14 10:39, Alexander Graf wrote:
> 
> On 02.04.14 10:31, Christian Borntraeger wrote:
>> On 01/04/14 16:47, Christian Borntraeger wrote:
>>> We want to configure several things in KVM that go beyond what
>>> ENABLE_CAP (we need payload) or ONE_REG (we need it for the VM
>>> and we need to do more complex actions) can provide. Instead of
>>> adding several s390 specific ioctls, lets provide a configuration
>>> and control device that encapsulates different commands into
>>> groups of the same area (MEMORY, CPU, ..)
>>>
>>> We also provide an initial nameless base group, with a simple first
>>> user to set the guest name. We need that name in the kernel for
>>> the emulation of STSI (which provides the guest name to the guest)
>>> but we need to implement the emulation in supervisor mode, as it
>>> also provides the underlying levels of hipervisors.
>>>
>>> Currently we have the following GROUPS and ATTRs pending, which
>>> configure some memory management related function or allow to set
>>> the guest facilities, cpuids etc:
>>>
>>> #define KVM_DEV_CONFIG_GROUP            0
>>> #define KVM_DEV_CONFIG_NAME             0
>>>
>>> #define KVM_DEV_CONFIG_GROUP_MEM        1
>>> #define KVM_DEV_CONFIG_MEM_ENABLE_CMMA  0
>>> #define KVM_DEV_CONFIG_MEM_CLR_CMMA     1
>>> #define KVM_DEV_CONFIG_MEM_CLR_PAGES    2
>>>
>>> #define KVM_DEV_CONFIG_GROUP_CPU        2
>>> #define KVM_DEV_CONFIG_CPU_TYPE         0
>>> #define KVM_DEV_CONFIG_CPU_FAC          1
>>> #define KVM_DEV_CONFIG_CPU_FAC_MASK     2
>>> #define KVM_DEV_CONFIG_CPU_IBC          3
>>> #define KVM_DEV_CONFIG_CPU_IBC_RANGE    4
>>>
>>>
>>>
>>> In addition other groups like
>>> #define KVM_DEV_CONFIG_GROUP_CRYPTO
>>> are under consideration to configure crypto acceleration.
>>>
>>> Unless there is a major concern, I will add this to the next
>>> s390 PULL requests for KVM.
>>>
>>> Christian
>>>
>> @Alex,
>>
>> regarding STSI, what about the following:
>>
>> The kernel will fill in every part of STSI as of now, but we will provide a CAP that qemu can enable which then tells the kernel to pass control to QEMU after it has filled in the data. QEMU can then do nothing (e.g. for stsi 111) or change
>> the information (e.g. for 322) and return to kernel. That would
>> a: cover the name aspect
>> b: will work with future enhancements for levels 1 and 2 since the kernel will still pass that through to the HW or LPAR
>> c: allows QEMU to override everything if necessary
> 
> I like that one, yes. Does the STSI payload fit into our exit payload union?

No, its up to 4k. So the STSI exit would need Function code, selector1, and selector2, as well as guest logical address.
So something like:

index a8f4ee5..3ea5727 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -297,6 +297,13 @@ struct kvm_run {
                        __u32 ipb;
                        __u8 dequeued;
                } s390_tsch;
+               /* KVM_EXIT_S390_STSI */
+               struct {
+                       __u64 addr;
+                       __u8 fc;
+                       __u8 sel1;
+                       __u16 sel2;
+               } s390_stsi;
                /* KVM_EXIT_EPR */
                struct {
                        __u32 epr;

 
>> @Paolo, Alex,
>>
>> I have several changes pending that will require new ioctls. I planned to use the config device to avoid creating new ioctls. Some option:
>> a: define new ioctls for these things (might end up with ~10 new ioctls)
>> b: allow GET_ATTR/SET_ATTR on the vm fd. We would define those as architecture specific attributes of the VM.
>> c: use a config device an anchor for GET_ATTR/SET_ATTR
>> d: any better idea
>>
>> This question is really a bike shed color discussion (which interface for specific thing between qemu/kvm is considered best), but it will be ABI. Paolo, do you have any preference?
>> I dont care about which solution we choose, but I obviously need a decision to rework pending patches.
> 
> I think it semantically makes a lot of sense to treat the VM fd as an "implements device" class :). So allowing GET_ATTR/SET_ATTR on the VM fd makes most sense to me.

Paolo, are you ok with allowing GET_ATTR/SET_ATTR/HAS_ATTR on the vm fd. All Attributes are then architecture specific. We might also reserve a group (e.g. 0) to be cross architecture.

 
> As for all the individual bits you need to set, I'd like to make sure we talk about them on a case-by-case basis. As you've seen with STSI, other solutions might be a better fit.

Absolutely. There is a reason why this patch has an RFC and not a PULL.

Christian

      reply	other threads:[~2014-04-02  8:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 14:47 [Qemu-devel] [PATCH/RFC] s390: Provide a configuration and control device Christian Borntraeger
2014-04-01 14:47 ` [Qemu-devel] [PATCH/RFC] KVM: s390: Add S390 configuration and control kvm device Christian Borntraeger
2014-04-01 14:58   ` Alexander Graf
2014-04-01 15:04     ` Christian Borntraeger
2014-04-01 15:12       ` Alexander Graf
2014-04-01 19:19         ` Christian Borntraeger
2014-04-01 19:36           ` Alexander Graf
2014-04-01 20:08             ` Christian Borntraeger
2014-04-01 19:37           ` Alexander Graf
2014-04-01 14:47 ` [Qemu-devel] [PATCH/RFC] s390x/kvm: implement and use QEMU config device for s390 Christian Borntraeger
2014-04-01 15:38   ` Paolo Bonzini
2014-04-01 18:56     ` Christian Borntraeger
2014-04-01 14:59 ` [Qemu-devel] [PATCH/RFC] s390: Provide a configuration and control device Alexander Graf
2014-04-01 19:23   ` Christian Borntraeger
2014-04-01 19:37     ` Alexander Graf
2014-04-02  8:31 ` Christian Borntraeger
2014-04-02  8:39   ` Alexander Graf
2014-04-02  8:54     ` 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=533BD028.8060307@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.com \
    --cc=agraf@suse.de \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tumanova@linux.vnet.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).