From patchwork Tue Jan 9 14:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 123969 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4056094qgn; Tue, 9 Jan 2018 06:02:00 -0800 (PST) X-Google-Smtp-Source: ACJfBovngQ0qs/F4aZCrEWgpRlMf5/kEndS2UhlzN7PWcrduBiA08gmLYEb6RoXumyciOuuOAm1k X-Received: by 10.98.55.5 with SMTP id e5mr13729188pfa.173.1515506519775; Tue, 09 Jan 2018 06:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515506519; cv=none; d=google.com; s=arc-20160816; b=RBXGnCftXq5bgZNhcbMsr6IDrXZtqeyAxiMYW1aReVcGDU4rPu1T/omRjCHZvfIQmv U/BZuKwEQbwlXqW+yfkBPsFoJTDk4xYE9ycQwPvbj0MHmlCW979HuIFd15DH4cnvy6Cq 0U8HqSL8QafNEh7HH8PXvodyG3vhzQJ7I1NEIvqSbYzxR8InnrbFfyMcdwcocMF/60lX vTBG9/9wZudB+5Y4aJHhcYDBMryC1Pcc8bjRynaKvx3PxZrSvwmF8An92yg2A0uWTZ52 ZIVuK8WgmgJqjORRvXM6lM2PFqUZCq5UsAH2W6h6ZpAzW/dfIH62SwvnUrbh40umrGrS u5kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ngh+zFvgxOPwUdKWF/Yp2pTDs524HEcljXaX6jfQyqM=; b=qTiQsTcN8umziQXuUU0LBQlen9V6bVSkFFqz1xnPqvYPe4b6BF26sQN+TwWI7FbC3Z Xchh6x11E3HXNeI8691OZp1jI4sNbWu8g/MK0dlGD9+cjlSHyZHCXGHg7/VgEQ4s/NXm wIgzh6thzfN9B6WCzgONpJcz2a45P9ptODoSsMqhRX3PIg4vBQjem3pYbCteQ/8DioVq k35NmjSsfCZF2OoQBl4w//ohb5109HvZksCy6XHmlGdnIUvS9pXw1fe+/kDb8FrL561u g1LdITy7LK5ygljT2Q9hl+8QAL3wvBRFNA3TrgVmm6fxLhaU10/y6QxVs38vM77XycTc AAbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id h4si10416798pln.668.2018.01.09.06.01.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 06:01:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eYuTT-0003eB-5y; Tue, 09 Jan 2018 14:01:55 +0000 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 1/4] hw/sd/pl181: Reset SD card on controller reset Date: Tue, 9 Jan 2018 14:01:50 +0000 Message-Id: <1515506513-31961-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515506513-31961-1-git-send-email-peter.maydell@linaro.org> References: <1515506513-31961-1-git-send-email-peter.maydell@linaro.org> Since pl181 is still using the legacy SD card API, the SD card created by sd_init() is not plugged into any bus. This means that the controller has to reset it manually. Failing to do this mostly didn't affect the guest since the guest typically does a programmed SD card reset as part of its SD controller driver initialization, but meant that migration failed because it's only in sd_reset() that we set up the wpgrps_size field. Cc: qemu-stable@nongnu.org Fixes: https://bugs.launchpad.net/qemu/+bug/1739378 Signed-off-by: Peter Maydell --- hw/sd/pl181.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 55c8098..3ba1f7d 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -480,6 +480,10 @@ static void pl181_reset(DeviceState *d) /* We can assume our GPIO outputs have been wired up now */ sd_set_cb(s->card, s->cardstatus[0], s->cardstatus[1]); + /* Since we're still using the legacy SD API the card is not plugged + * into any bus, and we must reset it manually. + */ + device_reset(DEVICE(s->card)); } static void pl181_init(Object *obj)