All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>, Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 for-2.12 2/5] s390x/tcg: fix and cleanup mcck injection
Date: Tue, 5 Dec 2017 11:14:06 +0100	[thread overview]
Message-ID: <20171205111406.40602734.cohuck@redhat.com> (raw)
In-Reply-To: <bc52da4c-3122-2040-baec-ac50ede5da90@redhat.com>

On Mon, 4 Dec 2017 18:27:06 +0100
David Hildenbrand <david@redhat.com> wrote:

> On 04.12.2017 18:20, Cornelia Huck wrote:
> > On Mon,  4 Dec 2017 13:55:02 +0100
> > David Hildenbrand <david@redhat.com> wrote:
> >   
> >> The architecture mode indication wasn't stored. The split of certain
> >> 64bit fields was unnecessary. Also, the complete clock comparator, not
> >> just bit 0-55 (starting at byte 1) was stored.
> >>
> >> We now generate a proper MCIC via the same helper we use for KVM.
> >>
> >> While at it, also get rid of two local variables. There is be more to
> >> clean up, but we will change the other parts later on either way.
> >>
> >> Signed-off-by: David Hildenbrand <david@redhat.com>
> >> ---
> >>  target/s390x/excp_helper.c | 18 ++++++++----------
> >>  target/s390x/internal.h    |  6 +++---
> >>  2 files changed, 11 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
> >> index d831537544..840cf7641a 100644
> >> --- a/target/s390x/excp_helper.c
> >> +++ b/target/s390x/excp_helper.c
> >> @@ -369,7 +369,6 @@ static void do_io_interrupt(CPUS390XState *env)
> >>  static void do_mchk_interrupt(CPUS390XState *env)
> >>  {
> >>      S390CPU *cpu = s390_env_get_cpu(env);
> >> -    uint64_t mask, addr;
> >>      LowCore *lowcore;
> >>      MchkQueue *q;
> >>      int i;  
> > 
> > [BTW, there's also a CR 14 check in here that probably could use the
> > new #define.]  
> 
> Yes, will be gone with my floating IRQ rework, that's why I am not
> touching it here. (We will no longer track machine checks in a list but
> per cr14 sublcass - initially only crw).

Sounds good. So let's just do the minimum to get this going and wait
for the rework.

> 
> >   
> >> @@ -395,6 +394,9 @@ static void do_mchk_interrupt(CPUS390XState *env)
> >>  
> >>      lowcore = cpu_map_lowcore(env);
> >>  
> >> +    /* we are always in z/Architecture mode */
> >> +    lowcore->ar_access_id = 1;
> >> +
> >>      for (i = 0; i < 16; i++) {
> >>          lowcore->floating_pt_save_area[i] = cpu_to_be64(get_freg(env, i)->ll);
> >>          lowcore->gpregs_save_area[i] = cpu_to_be64(env->regs[i]);
> >> @@ -404,17 +406,12 @@ static void do_mchk_interrupt(CPUS390XState *env)
> >>      lowcore->prefixreg_save_area = cpu_to_be32(env->psa);
> >>      lowcore->fpt_creg_save_area = cpu_to_be32(env->fpc);
> >>      lowcore->tod_progreg_save_area = cpu_to_be32(env->todpr);
> >> -    lowcore->cpu_timer_save_area[0] = cpu_to_be32(env->cputm >> 32);
> >> -    lowcore->cpu_timer_save_area[1] = cpu_to_be32((uint32_t)env->cputm);
> >> -    lowcore->clock_comp_save_area[0] = cpu_to_be32(env->ckc >> 32);
> >> -    lowcore->clock_comp_save_area[1] = cpu_to_be32((uint32_t)env->ckc);
> >> +    lowcore->cpu_timer_save_area = cpu_to_be64(env->cputm);
> >> +    lowcore->clock_comp_save_area = cpu_to_be64(env->ckc >> 8);
> >>  
> >> -    lowcore->mcck_interruption_code[0] = cpu_to_be32(0x00400f1d);
> >> -    lowcore->mcck_interruption_code[1] = cpu_to_be32(0x40330000);
> >> +    lowcore->mcic = cpu_to_be64(s390_build_validity_mcic() | MCIC_SC_CP);  
> > 
> > Hm... I'm not sure that is a good idea (the nature of the helper, not
> > that you remove the magic values).
> > 
> > This function is called do_mchk_interrupt(), which sounds like a more
> > generic thing. Maybe we need to enhance the machine check code to save
> > the mcic etc. somewhere (after it has been generated) and just inject
> > it here? Similar to what the kernel does.
> > 
> > If you want to avoid rework, just add a TODO here?  
> 
> Will also be gone with my floating IRQ rework ;) I can add a TODO if
> that helps, but 99.99996% it will be gone within 2-4 weeks.

Whatever floats your interrupt.

> 
> >   
> >>      lowcore->mcck_old_psw.mask = cpu_to_be64(get_psw_mask(env));
> >>      lowcore->mcck_old_psw.addr = cpu_to_be64(env->psw.addr);
> >> -    mask = be64_to_cpu(lowcore->mcck_new_psw.mask);
> >> -    addr = be64_to_cpu(lowcore->mcck_new_psw.addr);
> >>  
> >>      cpu_unmap_lowcore(lowcore);
> >>    
> 
> 

  reply	other threads:[~2017-12-05 10:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 12:55 [Qemu-devel] [PATCH v1 for-2.12 0/5] s390x/tcg: CCW hotplug support David Hildenbrand
2017-12-04 12:55 ` [Qemu-devel] [PATCH v1 for-2.12 1/5] s390x/kvm: factor out build_channel_report_mcic() into cpu.h David Hildenbrand
2017-12-04 17:03   ` Cornelia Huck
2017-12-04 17:16     ` David Hildenbrand
2017-12-05 10:20       ` Cornelia Huck
2017-12-05 11:29         ` David Hildenbrand
2017-12-04 12:55 ` [Qemu-devel] [PATCH v1 for-2.12 2/5] s390x/tcg: fix and cleanup mcck injection David Hildenbrand
2017-12-04 17:20   ` Cornelia Huck
2017-12-04 17:27     ` David Hildenbrand
2017-12-05 10:14       ` Cornelia Huck [this message]
2017-12-05 15:53   ` Thomas Huth
2017-12-05 16:22     ` David Hildenbrand
2017-12-04 12:55 ` [Qemu-devel] [PATCH v1 for-2.12 3/5] s390x/tcg: implement SET CLOCK PROGRAMMABLE FIELD David Hildenbrand
2017-12-05 11:05   ` Cornelia Huck
2017-12-06 15:10   ` Thomas Huth
2017-12-06 15:15     ` David Hildenbrand
2017-12-04 12:55 ` [Qemu-devel] [PATCH v1 for-2.12 4/5] s390x/tcg: indicate value of TODPR in STCKE David Hildenbrand
2017-12-06 15:24   ` Thomas Huth
2017-12-04 12:55 ` [Qemu-devel] [PATCH v1 for-2.12 5/5] s390x/tcg: wire up STORE CHANNEL REPORT WORD David Hildenbrand
2017-12-04 17:22   ` Cornelia Huck
2017-12-04 17:34     ` David Hildenbrand
2017-12-04 17:53       ` Cornelia Huck
2017-12-04 17:56         ` David Hildenbrand
2017-12-04 17:58           ` Cornelia Huck
2017-12-04 18:37             ` David Hildenbrand
2017-12-05 10:04               ` Cornelia Huck
2017-12-06 15:40   ` Thomas Huth
2017-12-04 13:10 ` [Qemu-devel] [PATCH v1 for-2.12 0/5] s390x/tcg: CCW hotplug support no-reply
2017-12-04 13:21   ` David Hildenbrand
2017-12-04 13:35 ` no-reply
2017-12-04 16:56 ` Cornelia Huck
2017-12-04 17:00   ` 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=20171205111406.40602734.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.