From patchwork Tue Jul 18 14:25:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Grytsov X-Patchwork-Id: 9848521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDC96602C8 for ; Tue, 18 Jul 2017 14:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0BAE26E74 for ; Tue, 18 Jul 2017 14:27:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3C4228577; Tue, 18 Jul 2017 14:27:59 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E28426E74 for ; Tue, 18 Jul 2017 14:27:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXTRk-0002lV-V2; Tue, 18 Jul 2017 14:25:56 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXTRk-0002ij-98 for xen-devel@lists.xenproject.org; Tue, 18 Jul 2017 14:25:56 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id AC/57-03406-37A1E695; Tue, 18 Jul 2017 14:25:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVyMfS6k26xVF6 kwY51nBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bzml/sBUekKh5c+8jYwLhXpIuRi0NIYAaj xJfG+YwgDovASxaJo2+/soA4EgL9rBItW+cBZTiBnCSJPxf+sEPYJRLvz79iBrGFBOQlDrZcZ ocYNY1JYvXa6WwgCTYBLYn7t1eA2SICShL3Vk1mArGZBVIk9q5rAxrKwSEs4CtxqcsRJMwioC rx/HAbK4jNK+AosfzbSWaIXXISN891MoOUcwLFt84oh1jrIHGj9RX7BEaBBYwMqxg1ilOLylK LdI0M9JKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAgOLAQh2MP5aFnCIUZKDSUmU d/WB3EghvqT8lMqMxOKM+KLSnNTiQ4waHBwCP5/+bWGUYsnLz0tVkuBdJZEXKSRYlJqeWpGWm QMMfZhSCQ4eJRHefJA0b3FBYm5xZjpE6hSjJceVK+u+MHFMObAdSL6a8P8bkxDYPClxXgVJoA YBkIaM0jy4cbD4vMQoKyXMywh0rBBPQWpRbmYJqvwrRnEORiVh3r0ga3ky80rgtr4COogJ6CB h3xyQg0oSEVJSDYx8c75xnmnh+7fxmNYMTv1tFxP1L57Ldl855ymvYE8AV6dZicqystSym15m PxcqiTblZL2V43/Lv9T0QXJol47ooRlfA4ScJOXuLYkQ36ggNCVopbma2rwnb0zT/W4t2yf/s 6QpPOT/zFjuPb9Wu3smfVhz8LbaNidrtVuF2+esejZv09PTm0WVWIozEg21mIuKEwHEGMZXyg IAAA== X-Env-Sender: al1img@gmail.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1500387954!106930338!1 X-Originating-IP: [209.85.215.66] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31817 invoked from network); 18 Jul 2017 14:25:55 -0000 Received: from mail-lf0-f66.google.com (HELO mail-lf0-f66.google.com) (209.85.215.66) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Jul 2017 14:25:55 -0000 Received: by mail-lf0-f66.google.com with SMTP id w198so1438035lff.3 for ; Tue, 18 Jul 2017 07:25:55 -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; bh=ZtbbgF9AShpoH4LTJtDb5K//dR+cscMQH1nPiSfTBK8=; b=pKVS5v8L4n2Qn7IXkvLU6J9GO5FS5ndS+rMiPZBlHD9hK9gyjgyijLupULxb7Pc89n Mf8FqDCnX4N6mDhEcvaI2dif1Ch7tHylK/cWKn2gCzF4aqjHWNW4bhPSGgZS0n8LgrZh 3xQ6eE8wle/aIRWRFpmp8LmIwDvmFNGvv/RjuyK23x1QdpUIeLupxglhuw4bIck9nIO3 biuPFJJlZSCLBQACo6K/d0vnYCtpX8K/MDCTP07ypTZYY133WtedvpdNKJyyx72gCPzS 46Om6A6iRka1zlt3U0qDYTeQX4l4xQ2usnGJL+9RFnUP9ob1DziyEzaAMsoDOlE7qMap uKXw== 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; bh=ZtbbgF9AShpoH4LTJtDb5K//dR+cscMQH1nPiSfTBK8=; b=rOE7zk/HMCZY4GbRoGc2sbhB4Accd6tIcfBPE/HnC89Y80IKFP41V2wWZ6tWdiRvXM mI/KerV/EyMjKruKRYTAl+QWBYHzbW/J/h5tvO7t+Eoh86Eq7mHdATEK8a2TUmlmnbPl qybiyQ04YpswDNfzbQDcRO2dr98bcObTwiC4W0mI4aaDfKkDJaaQ2ekRgtqSRsYTh18E pRK9NpPrkCKAPpGpRPBV2lXHCpLFKwlq9Fmlnl7QS04rtDVIQGfKqg3h4NNNdgeHDdRS a/NZrZsQBHQzyP3AlPTvTBiuQ82vY3/xogZs12gSibKQ6JGDThEJxg8nDXAA6RcHLIQJ bxJw== X-Gm-Message-State: AIVw110mA0eF9kfMcqvmjHOkRTHW0+4s6uhggpLU4cxLYZ/bnFMbm7GL WkKR9R8XFNKpF5p846o= X-Received: by 10.46.87.7 with SMTP id l7mr828721ljb.83.1500387954056; Tue, 18 Jul 2017 07:25:54 -0700 (PDT) Received: from al1-pc.kyiv.epam.com (ll-58.209.223.85.sovam.net.ua. [85.223.209.58]) by smtp.gmail.com with ESMTPSA id s134sm620442lfe.27.2017.07.18.07.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 07:25:53 -0700 (PDT) From: Oleksandr Grytsov To: xen-devel@lists.xenproject.org Date: Tue, 18 Jul 2017 17:25:30 +0300 Message-Id: <1500387930-16317-14-git-send-email-al1img@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500387930-16317-1-git-send-email-al1img@gmail.com> References: <1500387930-16317-1-git-send-email-al1img@gmail.com> Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, Oleksandr Grytsov Subject: [Xen-devel] [PATCH v4 13/13] libxl: make pci and usb setdefault function generic X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Grytsov Due to changes in device framework setdefault function should have same format. Otherwise calling devicetype set_default causes segfault. Signed-off-by: Oleksandr Grytsov --- tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_pci.c | 5 +++-- tools/libxl/libxl_usb.c | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 5fd0356..e4799eb 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1242,7 +1242,6 @@ _hidden int libxl__domain_create_info_setdefault(libxl__gc *gc, libxl_domain_create_info *c_info); _hidden int libxl__domain_build_info_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info); -_hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci); _hidden void libxl__rdm_setdefault(libxl__gc *gc, libxl_domain_build_info *b_info); diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 159d046..fa86bcf 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1158,7 +1158,8 @@ static int libxl__device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned return -1; } -int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci) +static int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid, + libxl_device_pci *pci, bool hotplug) { /* We'd like to force reserve rdm specific to a device by default.*/ if (pci->rdm_policy == LIBXL_RDM_RESERVE_POLICY_INVALID) @@ -1214,7 +1215,7 @@ int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcide } } - rc = libxl__device_pci_setdefault(gc, pcidev); + rc = libxl__device_pci_setdefault(gc, domid, pcidev, false); if (rc) goto out; if (pcidev->seize && !pciback_dev_is_assigned(gc, pcidev)) { diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c index e526c08..9fdb284 100644 --- a/tools/libxl/libxl_usb.c +++ b/tools/libxl/libxl_usb.c @@ -39,7 +39,8 @@ static int usbback_is_loaded(libxl__gc *gc) } static int libxl__device_usbctrl_setdefault(libxl__gc *gc, uint32_t domid, - libxl_device_usbctrl *usbctrl) + libxl_device_usbctrl *usbctrl, + bool update_json) { int rc; libxl_domain_type domtype = libxl__domain_type(gc, domid); @@ -449,7 +450,7 @@ static void libxl__device_usbctrl_add(libxl__egc *egc, uint32_t domid, libxl__device *device; int rc; - rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl); + rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl, false); if (rc < 0) goto out; if (usbctrl->devid == -1) { @@ -1079,7 +1080,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc, GCNEW(usbctrl); libxl_device_usbctrl_init(usbctrl); - rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl); + rc = libxl__device_usbctrl_setdefault(gc, domid, usbctrl, update_json); if (rc < 0) goto out; if (usbctrl->devid == -1) {