From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRHad-0004P1-Uw for qemu-devel@nongnu.org; Fri, 27 Feb 2015 04:52:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRHac-00074x-9X for qemu-devel@nongnu.org; Fri, 27 Feb 2015 04:52:11 -0500 MIME-Version: 1.0 In-Reply-To: <1425006675-19976-3-git-send-email-mdroth@linux.vnet.ibm.com> References: <1425006675-19976-1-git-send-email-mdroth@linux.vnet.ibm.com> <1425006675-19976-3-git-send-email-mdroth@linux.vnet.ibm.com> Date: Fri, 27 Feb 2015 15:22:09 +0530 Message-ID: From: Bharata B Rao Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v6 02/15] spapr_drc: initial implementation of sPAPRDRConnector device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aik@ozlabs.ru, Alexander Graf , "qemu-devel@nongnu.org" , ncmike@ncultra.org, "qemu-ppc@nongnu.org" , tyreld@linux.vnet.ibm.com, Nathan Fontenot , David Gibson On Fri, Feb 27, 2015 at 8:41 AM, Michael Roth wrote: > +static void attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, > + int fdt_start_offset, bool coldplug, Error **errp) > +{ > + DPRINTFN("drc: %x, attach", get_index(drc)); > + > + if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { > + error_setg(errp, "an attached device is still awaiting release"); > + return; > + } > + g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE); > + g_assert(fdt || coldplug); > + > + /* NOTE: setting initial isolation state to UNISOLATED means we can't > + * detach unless guest has a userspace/kernel that moves this state > + * back to ISOLATED in response to an unplug event, or this is done > + * manually by the admin prior. if we force things while the guest > + * may be accessing the device, we can easily crash the guest, so we > + * we defer completion of removal in such cases to the reset() hook. > + */ > + drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; > + drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; BTW shouldn't isolation_state and allocation_state be set to UNISOLATED and USABLE in response to guest's rtas-set-indicator calls ? At least, that is how it is done/expected for CPU hotplug case. Ref: kernel code arch/powerpc/platforms/pseries/dlpar.c: dlpar_acquire[release]_drc(). Same question for detach(). Regards, Bharata.