From patchwork Thu Sep 15 08:22:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 114768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 35D64B6F9F for ; Thu, 15 Sep 2011 18:22:51 +1000 (EST) Received: from localhost ([::1]:59866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47DR-0000GD-7H for incoming@patchwork.ozlabs.org; Thu, 15 Sep 2011 04:22:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47DH-0000Fb-8s for qemu-devel@nongnu.org; Thu, 15 Sep 2011 04:22:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R47DE-0004SO-Pn for qemu-devel@nongnu.org; Thu, 15 Sep 2011 04:22:26 -0400 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:35937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R47DE-0004RV-Ee for qemu-devel@nongnu.org; Thu, 15 Sep 2011 04:22:24 -0400 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p8F8MLHx005513 for ; Thu, 15 Sep 2011 08:22:21 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8F8ML332592920 for ; Thu, 15 Sep 2011 09:22:21 +0100 Received: from d06av07.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8F8MKep012580 for ; Thu, 15 Sep 2011 02:22:20 -0600 Received: from [9.152.224.64] (dyn-9-152-224-64.boeblingen.de.ibm.com [9.152.224.64]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8F8MKOT012565; Thu, 15 Sep 2011 02:22:20 -0600 Message-ID: <4E71B5BB.7070503@de.ibm.com> Date: Thu, 15 Sep 2011 10:22:19 +0200 From: Christian Borntraeger User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13 MIME-Version: 1.0 To: Alexander Graf X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.162 Cc: Carsten Otte , qemu-devel@nongnu.org Subject: [Qemu-devel] PATCH: s390: fix reset hypercall to reset the status X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch fixes the reset hypercall which is supposed to also reset the device status in device memory. This fixes the following bug: [root@localhost driver]# echo virtio0 > unbind [ 35.056966] ------------[ cut here ]------------ [ 35.057054] kernel BUG at drivers/virtio/virtio.c:157! [ 35.057113] illegal operation: 0001 [#1] SMP [ 35.057181] Modules linked in: [ 35.057243] CPU: 0 Not tainted 3.0.0-rc1-00180-g0792644-dirty #51 [ 35.057323] Process bash (pid: 497, task: 000000003e58c538, ksp: 000000003ef43978) [ 35.057409] Krnl PSW : 0704100180000000 00000000003d46f8 (virtio_check_driver_offered_feature+0x0/0x38) [ 35.057528] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3 [ 35.057616] Krnl GPRS: 0000000000000000 0000000040000000 0000000000000007 0000000000000000 [ 35.057716] 00000000003b3be4 0000000000000001 000000003ef4d380 000000003f1cff00 [ 35.057805] 000000003ef43f18 00000000005ca620 0000000000000008 0000000000838e88 [ 35.057919] 000000000083c860 000000003f7c2e00 00000000003d46b0 000000003ef43d10 [ 35.058027] Krnl Code: 00000000003d46e8: f0b00004ebcf srp 4(12,%r0),3023(%r14),0 [ 35.058115] 00000000003d46ee: f0a0000407f4 srp 4(11,%r0),2036,0 [ 35.058207] 00000000003d46f4: a7f40001 brc 15,3d46f6 [ 35.058295] >00000000003d46f8: e31020900004 lg %r1,144(%r2) [ 35.058383] 00000000003d46fe: bf2f1080 icm %r2,15,128(%r1) [ 35.058470] 00000000003d4702: a784000d brc 8,3d471c [ 35.058557] 00000000003d4706: e32010780004 lg %r2,120(%r1) [ 35.058645] 00000000003d470c: 59302000 c %r3,0(%r2) [ 35.058748] Call Trace: [ 35.058777] ([<00000000003d469e>] virtio_dev_remove+0x36/0x90) [ 35.058852] [<00000000003f3a40>] __device_release_driver+0x7c/0xec [ 35.058936] [<00000000003f3ae8>] device_release_driver+0x38/0x48 [ 35.059023] [<00000000003f2a98>] driver_unbind+0xa4/0xc4 [ 35.059111] [<00000000002acb70>] sysfs_write_file+0xe8/0x19c [ 35.059226] [<000000000022e7a4>] vfs_write+0xb0/0x18c [ 35.059317] [<000000000022eb18>] SyS_write+0x58/0xb4 [ 35.059398] [<000000000057e674>] sysc_noemu+0x16/0x1c [ 35.059475] [<000003fffd44b6c0>] 0x3fffd44b6c0 [ 35.059531] Last Breaking-Event-Address: [ 35.059576] [<00000000003d46f4>] virtio_dev_remove+0x8c/0x90 [ 35.059646] [ 35.059661] ---[ end trace 9b1959188f21ee11 ]--- Signed-off-by: Christian Borntraeger --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -107,6 +107,7 @@ int s390_virtio_hypercall(CPUState *env, uint64_t mem, uint64_t hypercall) dev = s390_virtio_bus_find_mem(s390_bus, mem); virtio_reset(dev->vdev); + stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0); s390_virtio_device_sync(dev); break; }