From patchwork Tue Jan 9 14:01:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 857509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGDPK1ddQz9s7s for ; Wed, 10 Jan 2018 01:03:01 +1100 (AEDT) Received: from localhost ([::1]:54372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYuUV-0007LN-4x for incoming@patchwork.ozlabs.org; Tue, 09 Jan 2018 09:02:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYuTg-00079w-P3 for qemu-devel@nongnu.org; Tue, 09 Jan 2018 09:02:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYuTc-0001AT-Sl for qemu-devel@nongnu.org; Tue, 09 Jan 2018 09:02:08 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:45792) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eYuTV-000159-6l; Tue, 09 Jan 2018 09:01:57 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eYuTS-0003dy-E3; Tue, 09 Jan 2018 14:01:54 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Tue, 9 Jan 2018 14:01:49 +0000 Message-Id: <1515506513-31961-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 0/4] Reset SD cards attached to legacy-API controllers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org, patches@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It turns out that we don't reset the SD card model if it's attached to a legacy-API controller. For new-style controllers where the SD card object is attached to an SD_BUS, the generic qbus infrastructure takes care of ensuring that the card's DeviceState::reset method gets called. But for the legacy API where the card is created by calling sd_init(), the card object has no SD_BUS to plug into, and so the reset function must be called manually. This mostly had no ill effects because a guest OS will typically perform an SD reset command as part of its device driver init sequence. However it does mean that migration won't work, because it's in sd_reset() that we set up the wpgrps_size field, and without that the migration struct on reload won't match. This patchset fixes up the four legacy controllers to call reset on the SD card device in their controller reset functions. The first 3 are cc:stable as migration bugfixes. This fixes https://bugs.launchpad.net/qemu/+bug/1739378 Philippe: this probably clashes slightly with your sdcard patchsets (and where you've updated devices to the new APIs it becomes irrelevant), but I think we should apply these first so we can have a simple patch to backport to the stable tree. Notes: * OMAP doesn't migrate anyway, so isn't cc:stable * for vexpress-a15, you also need "-machine secure=off": a config with trustzone emulation enabled doesn't successfully migrate (haven't yet debugged why) thanks -- PMM Peter Maydell (4): hw/sd/pl181: Reset SD card on controller reset hw/sd/milkymist-memcard: Reset SD card on controller reset hw/sd/ssi-sd: Reset SD card on controller reset hw/sd/omap_mmc: Reset SD card on controller reset hw/sd/milkymist-memcard.c | 4 ++++ hw/sd/omap_mmc.c | 14 ++++++++++---- hw/sd/pl181.c | 4 ++++ hw/sd/ssi-sd.c | 24 +++++++++++++++++++++++- 4 files changed, 41 insertions(+), 5 deletions(-) Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé