From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAhV2-0005LV-C2 for qemu-devel@nongnu.org; Sun, 20 Dec 2015 12:10:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aAhV1-0005Ww-8v for qemu-devel@nongnu.org; Sun, 20 Dec 2015 12:10:24 -0500 Received: from mail-vk0-x232.google.com ([2607:f8b0:400c:c05::232]:33963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAhV1-0005Wb-5R for qemu-devel@nongnu.org; Sun, 20 Dec 2015 12:10:23 -0500 Received: by mail-vk0-x232.google.com with SMTP id j66so89833191vkg.1 for ; Sun, 20 Dec 2015 09:10:23 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20151219213830.GE4164@pcrost-box> References: <1449851831-4966-1-git-send-email-peter.maydell@linaro.org> <1449851831-4966-5-git-send-email-peter.maydell@linaro.org> <20151219213830.GE4164@pcrost-box> From: Peter Maydell Date: Sun, 20 Dec 2015 17:10:03 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 04/10] hw/sd: Add QOM bus which SD cards plug in to List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Kevin O'Connor , Peter Crosthwaite , Markus Armbruster , Patch Tracking , QEMU Developers , Alistair Francis , qemu-arm , Paolo Bonzini , "Edgar E. Iglesias" On 19 December 2015 at 21:38, Peter Crosthwaite wrote: > On Fri, Dec 11, 2015 at 04:37:05PM +0000, Peter Maydell wrote: >> +bool sdbus_get_inserted(SDBus *sdbus) >> +{ >> + SDState *card = get_card(sdbus); >> + >> + if (card) { >> + SDClass *sc = SD_GET_CLASS(card); >> + >> + return sc->get_inserted(card); >> + } >> + >> + return false; >> +} > > This I am not sure about. Realistically, the card has no self > awareness of its ejection state so it can't be polled for "are > you there". The card insertion switch is implemented as a > physical switch on the slot itself and a property of the bus. > > The absence on presence of a device should determine this, making me > think this should return !!card. > > Unfortunately, we have the case of the block UI being able to trigger a > card ejection from underneath the bus level. But since the SD card is already > using qdev_get_parent_bus() the removal from the bus can be managed at the > card level. For user-level back compat I think we need to retain "might have an sdcard object with no block backend, and that means 'no-card-present'". This is both for the user facing monitor commands to manipulate the sd card, and also for the not-yet-QOMified controllers, which will always create an sdcard object even if there's no block backend (which should continue to mean "no card"). thanks -- PMM