qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin O'Connor <kevin@koconnor.net>
To: Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Patch Tracking <patches@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] hw/sd/pxa2xx_mmci: convert to SysBusDevice object
Date: Mon, 7 Dec 2015 01:11:14 -0500	[thread overview]
Message-ID: <20151207061114.GA29495@morn.lan> (raw)
In-Reply-To: <CAPokK=qshv+StXP2T_+xCSZtn2rfazQcUYyeVC1exaCrfWukkA@mail.gmail.com>

On Sun, Dec 06, 2015 at 04:02:14PM -0800, Peter Crosthwaite wrote:
> On Fri, Dec 4, 2015 at 11:24 AM, Kevin O'Connor <kevin@koconnor.net> wrote:
> > On Fri, Dec 04, 2015 at 10:50:21AM -0800, Peter Crosthwaite wrote:
> >> > FWIW, I don't think the SD card will be qdevified because it doesn't
> >> > need a bus.  It's similar indeed to SerialState, which was supposed to
> >> > be the poster child of QOM embedding and never got QOMified.
> >>
> >> SD is a bus in its own right and should be busified and QOMified IMO.
> >> SDHCI can talk to non-sd cards (SDIO). There is also a range of
> >> incompatible cards that you can talk to - MMC/eMMC/SD(H|S|X)C. I think
> >> anything that couples the controller to an SD card is a bug, the card
> >> and device should be arranged as separate devices.
> >>
> >> > A host controller controls exactly one SD card, the SSI bridge is also
> >> > for exactly one SD card, etc.
> >>
> >> I think you can RYO chip selects with a GPIO and control multiple SD
> >> cards with one SDHCI.
> >
> > In practice, the SDHCI controllers are one-to-one with cards.  This is
> > codified in the sdhci spec as it has a "card present" bit and "port
> > location" information that is per controller.
> >
> 
> But SDHCI is only one SD controller implementation. Other SD
> controllers may easily implement the SDIO bus as non 1:1. I also don't
> see why a 1:1 bus should have a completely different implementation
> that propagates through to UI level issues. SD is a bus like any other
> IMO.
> 
> > I suppose in theory, one could put an SDHCI contoller into SPI
> > compatibility mode and "hot wire" it into a bus, but qemu doesn't
> > support that anyway, and it is a lot of complexity for something that
> > is not done in practice.
> >
> 
> Note that the chip selects for SD are on the copper interface as well,
> so you can easily implement multi-device SD bus on the level above
> SDHCI. SPI mode should not required.

The "card select" line becomes a data line (DAT3) when not in SPI
mode.  That said, the MMC specs do define a convoluted mechanism for
assigning unique ids to each card so that a bus could be implemented.
(Which doesn't apply to SD cards, by my read of the SD specs.)

>Even if SDHCI does have
> card-detection CS control logic this can be demultiplexed to multiple
> cards by extra logic. We also have precedent of implementers of SDHCI
> opting-out of features like power control, and assumptions about how
> SDHCI is wired have already led to bugs like this:
> 
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg338495.html
> 
> We don't need to be implementing the multi CS logic today, but making
> UI level decisions based on this 1:1 assumption seems wrong.

I have no objection to a different internal or external represention
to the SD cards.  However, the immiediate choice seems to be whether
to disable pci-sdhci or not.  It seems unfortunate to me that it would
be disabled.  The QEMU SD code (beyond just the sdhci controller) is
not organized as a bus, and it's not clear to me that there are real
world gains to be had by modeling it as a bus.

My interest in the sd cards is for testing purposes.  Several recent
Intel chipsets include multiple sdhci controllers on them, and several
currently shipping devices use them for both eMMC storage and for
external SD card ports - in particular several of the Chromebooks have
them.  Being able to perform simple sanity checks in QEMU is helpful.

Cheers,
-Kevin

  reply	other threads:[~2015-12-07  6:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 14:15 [Qemu-devel] [PATCH 0/3] hw/sd/pxa2xx_mmci: convert to sysbus and vmstate Peter Maydell
2015-08-11 14:15 ` [Qemu-devel] [PATCH 1/3] hw/sd/pxa2xx_mmci: convert to SysBusDevice object Peter Maydell
2015-09-07 16:40   ` Markus Armbruster
2015-09-07 16:42     ` Peter Maydell
2015-09-07 16:57       ` Markus Armbruster
2015-12-03 21:20         ` Peter Maydell
2015-12-04  7:30           ` Markus Armbruster
2015-12-04 11:00             ` Peter Maydell
2015-12-04 12:50               ` Markus Armbruster
2015-12-04 12:55                 ` Peter Maydell
2015-12-04 13:04                   ` Markus Armbruster
2015-12-04 18:49                   ` Kevin O'Connor
2015-12-04 16:42               ` Paolo Bonzini
2015-12-04 18:50                 ` Peter Crosthwaite
2015-12-04 19:24                   ` Kevin O'Connor
2015-12-07  0:02                     ` Peter Crosthwaite
2015-12-07  6:11                       ` Kevin O'Connor [this message]
2015-12-07  8:50                         ` Markus Armbruster
2015-12-07  9:58                           ` Paolo Bonzini
2015-12-07 10:31                             ` Markus Armbruster
2015-12-07 14:32                               ` Peter Maydell
2015-09-07 18:39       ` Peter Crosthwaite
2015-08-11 14:15 ` [Qemu-devel] [PATCH 2/3] hw/sd/pxa2xx_mmci: Convert to VMStateDescription Peter Maydell
2015-08-11 14:15 ` [Qemu-devel] [PATCH 3/3] hw/sd/pxa2xx_mmci: Add reset function Peter Maydell
2015-09-07 15:34 ` [Qemu-devel] [PATCH 0/3] hw/sd/pxa2xx_mmci: convert to sysbus and vmstate Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151207061114.GA29495@morn.lan \
    --to=kevin@koconnor.net \
    --cc=armbru@redhat.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).