From patchwork Tue Jan 9 14:01:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 123967 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4056026qgn; Tue, 9 Jan 2018 06:01:57 -0800 (PST) X-Google-Smtp-Source: ACJfBouV2a1xIDC73eIswWWJjHV6w93q7hxPi8l1/1RfmT+6ouH7PBjdX/QFa9iQWg6QRY6s/+CN X-Received: by 10.46.101.90 with SMTP id z87mr9190790ljb.112.1515506517101; Tue, 09 Jan 2018 06:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515506517; cv=none; d=google.com; s=arc-20160816; b=GiIAFrTfSEH796rXQUpjKAcoJHAL9i7dUD2BRAfu+zDT2QRWfiTIcWBobJuHPKVP5j PVK1jqiz9DeGqrtxzK8+3UOxisnmzYhveYutznUvR8JPdKb5caChscLU38JY+cqd0QyG TwIPbAhRm3AWOh7jl2WWzqzzqFiz/Qu6w58iMXWpWtF2AawerQ1uUvA1aw2xJ1xTMK62 0srTspdUWEBDP9dv/N0UdV3XkpAznSsmpsVCtQO51AtvIts9AKYFOxkRs6AHJL/dFnE3 sMj0H1hI2tiEZ/E7VovjtkP9Xar+jGGUXTxjXb1OYF6x9ZauhTte0w0AMv1cedHTn6Lb /+Hw== 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=e8D3c+rvhcxq/fooYISPPiT34fPHUsEnaEB+nUHnzr4=; b=hcmUuFILqfECGZ1l8P7ndDmwaLlU9tk/6sHKy1A5Ld33wOTtJT/T1BoNFHSQMCDKMd 88NNuYUseRdxNyNRLaI0/4EGJl0KMwIC7H9Ye9+9dWBz82Vu+8p58CvpZRapyA+ez7xm B4KypAO2Lzh7RhQKmJuUjFD8TvBAgsO5P77ZlwI0UWJ7ttUbWd58ztb847tLPir1a2YY hsdSBuZoHeMmW9GK1vF7kdE/wTGSe3yUx3XtnyjuR30qNO6I7FRU4AWYXWrjUDsBBI9f jxFruj3ZXPnbxng+kI2pBGXWVc0Iv5oazp68yVu22ckm06ifCIy3j6SUd8tItCZfyMxO 3Wrg== 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 28si5643704ljz.386.2018.01.09.06.01.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 06:01:56 -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-0003eT-S4; 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 2/4] hw/sd/milkymist-memcard: Reset SD card on controller reset Date: Tue, 9 Jan 2018 14:01:51 +0000 Message-Id: <1515506513-31961-3-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 Signed-off-by: Peter Maydell --- hw/sd/milkymist-memcard.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 4008c81..341da88 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -248,6 +248,10 @@ static void milkymist_memcard_reset(DeviceState *d) for (i = 0; i < R_MAX; i++) { s->regs[i] = 0; } + /* 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 int milkymist_memcard_init(SysBusDevice *dev)