From patchwork Tue Jan 9 14:01:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 123968 Delivered-To: patches@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4056046qgn; Tue, 9 Jan 2018 06:01:58 -0800 (PST) X-Google-Smtp-Source: ACJfBovPo6AveIKHTROM3HT7fMW2k760pK17/F/u9nvTAhQZ0nG5dC5Gr7/brvmens7rdILsRsih X-Received: by 10.223.189.16 with SMTP id j16mr13084805wrh.52.1515506518080; Tue, 09 Jan 2018 06:01:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515506518; cv=none; d=google.com; s=arc-20160816; b=q1t9d88VOEW9hL1l31r8GUEDHVrE8iDKIoTy6RYu6uDVxC6dAc/H7F+GhWM1GAALBR xdf1RSkSPzqBvwucgZjhPxD8ll4UgIVQNDbnd16fB4WTHE6I19yZajMYoeJ9Ju8AUDqe kD2fo0vrrlzpSFZ1UtV+GxO6OcKAqySLMpsb+CNhPEJGIgg/dDYK6JVl+NfpHVkK2Cnu m7KJx2NoPQD+1BcTchwNJ9Y0S4skkAtJSGoWwKbuzmn06GohircySAS6n4eZRLZi/F6/ WI07/ed0XONFaS/TE7bJv7cx4DEwjs8YyTfp+dcBS8vPTaxMM3tNh62Rhc8mUi8c0H6R Qw9A== 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=J1ldDW2V7oPKtznNt7RCOwJyIeTQj2tkcROExEUA6RE=; b=BIqCOZt8WOnL4Ve9NlAKe4M95oHo9GlBprAo2Y9hKOv213P/Q668kkaOhQ6A5sN4Oy 6t4eDRWn/VoPQbS/jgY8e3Td+B81o+tCTVAq8YzQynUEOmBtxyh4PVbRsDqgs5Q40GE9 ySIltRkNFV2lxGXjUL6W0FPaK8nwRUpcZMJ992I5XvSMZE/DODms3cDKMV/Y74Au8OhL YAU+XdmVQCFzQdGKwOAtRR9xsyDNysDN7phNbzEd0MiK3fOcpjsZcdHUn3fdWYFdgzKZ fpQrHG9+PR6DnLIudIPHFgOcLJjgxyrOpEgoRd/wKnZ+kIXC+e+MqSlqy36Pa+k0W2QS Z44Q== 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 m70si9413420wma.241.2018.01.09.06.01.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 06:01:58 -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 1eYuTV-0003f0-C0; Tue, 09 Jan 2018 14:01:57 +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 4/4] hw/sd/omap_mmc: Reset SD card on controller reset Date: Tue, 9 Jan 2018 14:01:53 +0000 Message-Id: <1515506513-31961-5-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 omap_mmc 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 would mean that migration fails because it's only in sd_reset() that we set up the wpgrps_size field. Signed-off-by: Peter Maydell --- This one isn't cc-stable because the OMAP boards don't support migration at all anyway, being un-QOMified. --- hw/sd/omap_mmc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c index e934cd3..5b47cad 100644 --- a/hw/sd/omap_mmc.c +++ b/hw/sd/omap_mmc.c @@ -305,6 +305,12 @@ void omap_mmc_reset(struct omap_mmc_s *host) host->cdet_enable = 0; qemu_set_irq(host->coverswitch, host->cdet_state); host->clkdiv = 0; + + /* Since we're still using the legacy SD API the card is not plugged + * into any bus, and we must reset it manually. When omap_mmc is + * QOMified this must move into the QOM reset function. + */ + device_reset(DEVICE(host->card)); } static uint64_t omap_mmc_read(void *opaque, hwaddr offset, @@ -587,8 +593,6 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, s->lines = 1; /* TODO: needs to be settable per-board */ s->rev = 1; - omap_mmc_reset(s); - memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", 0x800); memory_region_add_subregion(sysmem, base, &s->iomem); @@ -598,6 +602,8 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, exit(1); } + omap_mmc_reset(s); + return s; } @@ -613,8 +619,6 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, s->lines = 4; s->rev = 2; - omap_mmc_reset(s); - memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); @@ -628,6 +632,8 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); sd_set_cb(s->card, NULL, s->cdet); + omap_mmc_reset(s); + return s; }