From patchwork Mon Mar 11 18:02:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Andryuk X-Patchwork-Id: 10847981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09495139A for ; Mon, 11 Mar 2019 18:17:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB5D328BA7 for ; Mon, 11 Mar 2019 18:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFA7628BDF; Mon, 11 Mar 2019 18:17:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8E79A28BDC for ; Mon, 11 Mar 2019 18:17:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:38144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3PU2-0004kx-Pc for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 Mar 2019 14:17:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3PHA-0003Af-40 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 14:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3PH8-0002gd-12 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 14:03:47 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:42651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3PH2-0002KB-PH for qemu-devel@nongnu.org; Mon, 11 Mar 2019 14:03:42 -0400 Received: by mail-qt1-x842.google.com with SMTP id u7so6108842qtg.9 for ; Mon, 11 Mar 2019 11:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rwip1nuAVYbjkkViy3FgTxhBpY/j8I1NfaRBBQVabgs=; b=VwCwJeIafO4nAvcQKFfc2AzaA5wwqab8jH4zLZlSuZdvNXg/F1CxhR01R8lnFNI4A3 GnAEowAlzUcy2JYbNIS+yLeZBX/bbANcu9hw/bok8PKXA9PLtFw+XgCYg77okGCxVqdI QqcOP08N82pV2A6bKWZJh7lqRmfk7uUQzBPMaD3nJlnqnwV+oEW27IMF0cidjg1M4TV2 WyyxRN1eLXQpOjtjT0kZupvESrGIci5dDAz86v+T90jHlGoh8qGp8nxQkqQlmSfzDkgq Fvv9SvagTFkWFUC1MMV4mF3addz0y+2DuNxTcMVBR4myKCnQrVm/5ct2d9mth6I1DUBT fIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rwip1nuAVYbjkkViy3FgTxhBpY/j8I1NfaRBBQVabgs=; b=s8oXZIVBV5VMS+HSCHD8JcY+9VV1i1WUstVvXN+ABMLabYWUPnYwGpdhHV552Fa9Gc UI/5zRRWxWQ24JJm+bA4elODAYLS6DX/lWSrxzagBUHLm6Vhpr7+Jh9Pxr8f9nMHwoqr ZP9CmHEtmssH/OSxmkmiteP7YllOwUs5eP5U8Gjbx7Wwz63YAinW7/Yabb6MtBi5ltdq rlwZI1U41ZVglFsqSojeMOBf1Y4DQNI9ZEGlcCuHjvJpPKRj2UiBR9pBIFJRBBX4z1Pa J6jalx2O/qCk0MaUnMNW+gunxzID1AoOwii7JBfZEb/Bko8Pf2/HR7xLasTbXTeW5cJ7 mXyQ== X-Gm-Message-State: APjAAAXSKYVypfT/o3CljG+vsRc/Vb4ubGPKAP9Nd9kfw0qfklvD5jRt ceqB6cilggwhrtzgLZN8NsK7SnR/Wg0= X-Google-Smtp-Source: APXvYqwrKt3z08h5bHbW1bhIc50/qVY3twfcUHF1yZBGMlFTbzS7/FCoaDkmdIsPVgLw8K7vwo88wA== X-Received: by 2002:a0c:987a:: with SMTP id e55mr27336202qvd.21.1552327398103; Mon, 11 Mar 2019 11:03:18 -0700 (PDT) Received: from pm2-ws13.praxislan02.com ([2001:470:8:67e:ba27:ebff:fee8:ce27]) by smtp.gmail.com with ESMTPSA id f126sm4687637qka.14.2019.03.11.11.03.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2019 11:03:17 -0700 (PDT) From: Jason Andryuk To: qemu-devel@nongnu.org Date: Mon, 11 Mar 2019 14:02:12 -0400 Message-Id: <20190311180216.18811-3-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190311180216.18811-1-jandryuk@gmail.com> References: <20190311180216.18811-1-jandryuk@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::842 Subject: [Qemu-devel] [PATCH 2/6] xen: Move xenstore initialization to common location X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Eduardo Habkost , Jason Andryuk , "Michael S. Tsirkin" , marmarek@invisiblethingslab.com, Paul Durrant , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For the xen stubdom case, we'll want xenstore initialized, but we'll want to skip the rest of xen_be_init. Move the initialization to xen_hvm_init so we can conditionalize calling xen_be_init. xs_domain_open() is deprecated for xs_open(0), so make the replacement as well. Signed-off-by: Jason Andryuk --- hw/i386/xen/xen-hvm.c | 8 ++++++++ hw/xen/xen-legacy-backend.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 2939122e7c..c20c4b27f6 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1487,6 +1487,14 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) xen_bus_init(); + xenstore = xs_open(0); + if (!xenstore) { + error_report("Can't connect to xenstored"); + goto err; + } + + qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL); + /* Initialize backend core & drivers */ if (xen_be_init() != 0) { error_report("xen backend core setup failed"); diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c index 36fd1e9b09..bdf2fa917f 100644 --- a/hw/xen/xen-legacy-backend.c +++ b/hw/xen/xen-legacy-backend.c @@ -683,14 +683,6 @@ int xen_be_init(void) { xengnttab_handle *gnttabdev; - xenstore = xs_daemon_open(); - if (!xenstore) { - xen_pv_printf(NULL, 0, "can't connect to xenstored\n"); - return -1; - } - - qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL); - if (xen_xc == NULL || xen_fmem == NULL) { /* Check if xen_init() have been called */ goto err;