From patchwork Wed Nov 4 17:52:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 7552491 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99AB4BEEA4 for ; Wed, 4 Nov 2015 17:53:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE07920742 for ; Wed, 4 Nov 2015 17:53:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C18DC20519 for ; Wed, 4 Nov 2015 17:53:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752933AbbKDRxA (ORCPT ); Wed, 4 Nov 2015 12:53:00 -0500 Received: from e06smtp07.uk.ibm.com ([195.75.94.103]:37331 "EHLO e06smtp07.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752795AbbKDRw7 (ORCPT ); Wed, 4 Nov 2015 12:52:59 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Nov 2015 17:52:57 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Nov 2015 17:52:56 -0000 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: cornelia.huck@de.ibm.com X-IBM-RcptTo: kvm@vger.kernel.org;linux-s390@vger.kernel.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 30F441B0806B; Wed, 4 Nov 2015 17:53:10 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA4HquRB10092956; Wed, 4 Nov 2015 17:52:56 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA4HqsCX022661; Wed, 4 Nov 2015 10:52:55 -0700 Received: from gondolin (dyn-9-152-224-100.boeblingen.de.ibm.com [9.152.224.100]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tA4Hqs7p022641; Wed, 4 Nov 2015 10:52:54 -0700 Date: Wed, 4 Nov 2015 18:52:52 +0100 From: Cornelia Huck To: Andy Lutomirski Cc: Christian Borntraeger , Andy Lutomirski , Sebastian Ott , Paolo Bonzini , Christoph Hellwig , Benjamin Herrenschmidt , KVM , David Woodhouse , Joerg Roedel , Martin Schwidefsky , linux-s390 Subject: Re: [PATCH/RFC 0/4] dma ops and virtio Message-ID: <20151104185252.199973af.cornelia.huck@de.ibm.com> In-Reply-To: <20151104152923.6b60ce4c.cornelia.huck@de.ibm.com> References: <1445986131-239566-1-git-send-email-borntraeger@de.ibm.com> <5631629B.2050505@de.ibm.com> <20151030092548.7abd51e1.cornelia.huck@de.ibm.com> <20151102121658.11aa3375.cornelia.huck@de.ibm.com> <20151103185926.1442d0a8.cornelia.huck@de.ibm.com> <20151104152923.6b60ce4c.cornelia.huck@de.ibm.com> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; i686-pc-linux-gnu) Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15110417-0029-0000-0000-000004BB6842 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 4 Nov 2015 15:29:23 +0100 Cornelia Huck wrote: > I'm currently suspecting some endianness issues, probably with the ecw > accesses, which is why I'd be interested in your trace information (as > I currently don't have a LE test setup at hand.) I think I've got it. We have sense_data as a byte array, which implicitly makes it BE already. When we copy to the ecws while building the irb, the data ends up in 32 bit values. The conversion from host endianness to BE now treats them as LE on your system... Could you please give the following qemu patch a try? Tested-by: Andy Lutomirski --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/hw/s390x/css.c b/hw/s390x/css.c index c033612..a13494e 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -892,8 +892,16 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len) /* If a unit check is pending, copy sense data. */ if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) && (p->chars & PMCW_CHARS_MASK_CSENSE)) { + uint32_t ecw[8]; + int i; + irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL; - memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data)); + /* Attention: sense_data is already BE! */ + memset(ecw, 0, sizeof(ecw)); + memcpy(ecw, sch->sense_data, sizeof(sch->sense_data)); + for (i = 0; i < ARRAY_SIZE(ecw); i++) { + irb.ecw[i] = be32_to_cpu(ecw[i]); + } irb.esw[1] = 0x01000000 | (sizeof(sch->sense_data) << 8); } }