From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo7zG-0000xH-VN for qemu-devel@nongnu.org; Mon, 19 Oct 2015 06:48:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo7zC-0000Um-V7 for qemu-devel@nongnu.org; Mon, 19 Oct 2015 06:48:18 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo7zC-0000Ug-O2 for qemu-devel@nongnu.org; Mon, 19 Oct 2015 06:48:14 -0400 Received: by lfaz124 with SMTP id z124so108586104lfa.1 for ; Mon, 19 Oct 2015 03:48:14 -0700 (PDT) Sender: Paolo Bonzini References: <1445250224-5788-2-git-send-email-stefano.stabellini@eu.citrix.com> From: Paolo Bonzini Message-ID: <5624CA6B.2070001@redhat.com> Date: Mon, 19 Oct 2015 12:48:11 +0200 MIME-Version: 1.0 In-Reply-To: <1445250224-5788-2-git-send-email-stefano.stabellini@eu.citrix.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini , peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, Eduardo Habkost On 19/10/2015 12:23, Stefano Stabellini wrote: > The xen-platform code crashes on reset if the xen backend is not > initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform > won't be created without initializing the xen backend. > > The assert can't be triggered by the user because the device is not > hotpluggable, and the only code creating it (at pc_xen_hvm_init()) > already checks xen_enabled(). The device is not hotpluggable, but it is accessible with -device. This is by design because IIUC, we want -M xenfv to be phased out in favor of the PC machines plus -device xen-platform. Thus, k->init should be changed to k->realize instead. I guess it can be done on top of this pull request, so I'm not blocking it. Paolo > Signed-off-by: Eduardo Habkost > Reviewed-by: Stefano Stabellini > Signed-off-by: Stefano Stabellini > --- > hw/i386/xen/xen_platform.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c > index ee45f03..8682c42 100644 > --- a/hw/i386/xen/xen_platform.c > +++ b/hw/i386/xen/xen_platform.c > @@ -387,6 +387,9 @@ static int xen_platform_initfn(PCIDevice *dev) > PCIXenPlatformState *d = XEN_PLATFORM(dev); > uint8_t *pci_conf; > > + /* Device will crash on reset if xen is not initialized */ > + assert(xen_enabled()); > +