qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>
Cc: thuth@redhat.com, pmorel@linux.ibm.com, david@redhat.com,
	qemu-devel@nongnu.org, borntraeger@de.ibm.com,
	qemu-s390x@nongnu.org, mihajlov@linux.ibm.com
Subject: Re: [PATCH v2 06/13] s390x: protvirt: KVM intercept changes
Date: Fri, 6 Dec 2019 10:08:21 +0100	[thread overview]
Message-ID: <20191206100821.06b933e8.cohuck@redhat.com> (raw)
In-Reply-To: <c7490fc2-e706-bf51-9979-559a90c65f6c@linux.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3731 bytes --]

On Fri, 6 Dec 2019 09:45:41 +0100
Janosch Frank <frankja@linux.ibm.com> wrote:

> On 12/6/19 9:29 AM, Cornelia Huck wrote:
> > On Fri, 6 Dec 2019 08:44:52 +0100
> > Janosch Frank <frankja@linux.ibm.com> wrote:
> >   
> >> On 12/5/19 6:46 PM, Cornelia Huck wrote:  
> >>> On Thu, 5 Dec 2019 18:34:32 +0100
> >>> Janosch Frank <frankja@linux.ibm.com> wrote:
> >>>     
> >>>> On 12/5/19 6:15 PM, Cornelia Huck wrote:    
> >>>>> On Fri, 29 Nov 2019 04:48:02 -0500
> >>>>> Janosch Frank <frankja@linux.ibm.com> wrote:
> >>>>>       
> >>>>>> Secure guests no longer intercept with code 4 for an instruction
> >>>>>> interception. Instead they have codes 104 and 108 for secure
> >>>>>> instruction interception and secure instruction notification
> >>>>>> respectively.
> >>>>>>
> >>>>>> The 104 mirrors the 4 interception.
> >>>>>>
> >>>>>> The 108 is a notification interception to let KVM and QEMU know that
> >>>>>> something changed and we need to update tracking information or
> >>>>>> perform specific tasks. It's currently taken for the following
> >>>>>> instructions:
> >>>>>>
> >>>>>> * stpx (To inform about the changed prefix location)
> >>>>>> * sclp (On incorrect SCCB values, so we can inject a IRQ)
> >>>>>> * sigp (All but "stop and store status")
> >>>>>> * diag308 (Subcodes 0/1)
> >>>>>>
> >>>>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> >>>>>> ---
> >>>>>>  target/s390x/kvm.c | 6 ++++++
> >>>>>>  1 file changed, 6 insertions(+)
> >>>>>>    
> >>>     
> >>>>>> @@ -1664,6 +1668,8 @@ static int handle_intercept(S390CPU *cpu)
> >>>>>>              (long)cs->kvm_run->psw_addr);
> >>>>>>      switch (icpt_code) {
> >>>>>>          case ICPT_INSTRUCTION:
> >>>>>> +        case ICPT_PV_INSTR:
> >>>>>> +        case ICPT_PV_INSTR_NOTIFICATION:
> >>>>>>              r = handle_instruction(cpu, run);      
> >>>>>
> >>>>> I'm still a bit uneasy about going through the same path for both 104
> >>>>> and 108. How does the handler figure out whether it should emulate an
> >>>>> instruction, or just process a notification? Is it guaranteed that a
> >>>>> given instruction is always showing up as either a 104 or a 108, so
> >>>>> that the handler can check the pv state?      
> >>>>
> >>>> diag 308 subcode 0/1 are 108, but all other subcodes are defined as a
> >>>> 104 (if they are an exit at all)...    
> >>>
> >>> I think that's a reason to really split 108 from 4/104, or at least add
> >>> an parameter...    
> >>
> >> And still call the diag 308 handler or have separate handlers?  
> > 
> > I'd probably split it into a "normal" one and one for pv special
> > handling... does that make sense?
> >   
> IMHO: not really
> We still need to do ipa/ipb parsing for both paths, which will result in
> code duplication. Looking at diag308 subcode 4, we would have a code 4
> one which just does the device resets and reboots and one which does all
> that, plus the teardown of the protected guest.
> 
> I tried to inline as much as possible to have as little changes as
> possible. Notable exception is sclp, which has more checks than
> emulation code...

Fair enough.

But taking a step back: What's the purpose of the new exits, then?
IIUC, we have the following cases:

- code 4: normal guest, nothing special
- code 104: protected guest, emulate the instruction
- code 108: protected guest, notification for the instruction

The backend code can figure out what to do simply by checking whether
the guest is protected or not (as whatever needs to be done is simply
determined by that anyway).

Are we overlooking something? Or is the information contained in the
different exits simply redundant?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-12-06 14:15 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29  9:47 [PATCH v2 00/13] s390x: Protected Virtualization support Janosch Frank
2019-11-29  9:47 ` [PATCH v2 01/13] s390x: protvirt: Add diag308 subcodes 8 - 10 Janosch Frank
2019-11-29 10:09   ` David Hildenbrand
2019-11-29 11:18     ` Janosch Frank
2019-11-29 11:41       ` Cornelia Huck
2019-11-29 12:40   ` Thomas Huth
2019-11-29 14:08     ` Janosch Frank
2019-12-02  9:20       ` Cornelia Huck
2019-11-29  9:47 ` [PATCH v2 02/13] Header sync protvirt Janosch Frank
2019-11-29  9:47 ` [PATCH v2 03/13] s390x: protvirt: Support unpack facility Janosch Frank
2019-11-29 10:19   ` David Hildenbrand
2019-12-04 10:48   ` Thomas Huth
2019-12-04 11:32     ` Janosch Frank
2019-12-04 11:34       ` Thomas Huth
2019-12-04 11:46         ` Janosch Frank
2019-11-29  9:48 ` [PATCH v2 04/13] s390x: protvirt: Handle diag 308 subcodes 0,1,3,4 Janosch Frank
2019-11-29 10:23   ` David Hildenbrand
2019-11-29  9:48 ` [PATCH v2 05/13] s390x: protvirt: Add pv state to cpu env Janosch Frank
2019-11-29 10:30   ` David Hildenbrand
2019-11-29 11:22     ` Janosch Frank
2019-12-06  9:50     ` Janosch Frank
2019-12-06  9:56       ` David Hildenbrand
2019-11-29  9:48 ` [PATCH v2 06/13] s390x: protvirt: KVM intercept changes Janosch Frank
2019-11-29 10:34   ` David Hildenbrand
2019-12-05 17:15   ` Cornelia Huck
2019-12-05 17:34     ` Janosch Frank
2019-12-05 17:46       ` Cornelia Huck
2019-12-06  7:44         ` Janosch Frank
2019-12-06  8:29           ` Cornelia Huck
2019-12-06  8:45             ` Janosch Frank
2019-12-06  9:08               ` Cornelia Huck [this message]
2019-12-06  9:30                 ` Janosch Frank
2019-11-29  9:48 ` [PATCH v2 07/13] s390x: protvirt: SCLP interpretation Janosch Frank
2019-11-29 10:43   ` David Hildenbrand
2019-11-29 11:15     ` Janosch Frank
2019-11-29 11:27       ` David Hildenbrand
2019-11-29  9:48 ` [PATCH v2 08/13] s390x: protvirt: Add new VCPU reset functions Janosch Frank
2019-11-29 10:47   ` David Hildenbrand
2019-11-29 11:21     ` Janosch Frank
2019-11-29 11:24       ` David Hildenbrand
2019-12-04 11:58   ` Thomas Huth
2019-12-04 12:44     ` Janosch Frank
2019-11-29  9:48 ` [PATCH v2 09/13] s390x: Exit on vcpu reset error Janosch Frank
2019-11-29  9:48 ` [PATCH v2 10/13] s390x: protvirt: Set guest IPL PSW Janosch Frank
2019-11-29 11:30   ` David Hildenbrand
2019-11-29 11:47   ` David Hildenbrand
2019-11-29  9:48 ` [PATCH v2 11/13] s390x: protvirt: Move diag 308 data over SIDAD Janosch Frank
2019-11-29 11:34   ` David Hildenbrand
2019-11-29  9:48 ` [PATCH v2 12/13] s390x: protvirt: Disable address checks for PV guest IO emulation Janosch Frank
2019-11-29 11:42   ` David Hildenbrand
2019-12-04 12:16   ` Thomas Huth
2019-12-05 17:44   ` Cornelia Huck
2019-11-29  9:48 ` [PATCH v2 13/13] s390x: protvirt: Handle SIGP store status correctly Janosch Frank
2019-11-29 11:04   ` Thomas Huth
2019-11-29 11:08     ` David Hildenbrand

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=20191206100821.06b933e8.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=mihajlov@linux.ibm.com \
    --cc=pmorel@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --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).