From patchwork Fri Jun 2 05:49:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 13264728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69EF7C77B7A for ; Fri, 2 Jun 2023 05:49:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.542925.847369 (Exim 4.92) (envelope-from ) id 1q4xfM-0004vA-GD; Fri, 02 Jun 2023 05:49:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 542925.847369; Fri, 02 Jun 2023 05:49:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q4xfM-0004v3-Dc; Fri, 02 Jun 2023 05:49:36 +0000 Received: by outflank-mailman (input) for mailman id 542925; Fri, 02 Jun 2023 05:49:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q4xfL-0004g6-LH for xen-devel@lists.xen.org; Fri, 02 Jun 2023 05:49:35 +0000 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [2607:f8b0:4864:20::534]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4070913b-0109-11ee-b231-6b7b168915f2; Fri, 02 Jun 2023 07:49:35 +0200 (CEST) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-51b4ef5378bso1532511a12.1 for ; Thu, 01 Jun 2023 22:49:35 -0700 (PDT) Received: from localhost ([122.172.87.195]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c11500b001ac94b33ab1sm352303pli.304.2023.06.01.22.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 22:49:33 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4070913b-0109-11ee-b231-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685684973; x=1688276973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jBN/RWcDvPOwXwPxKLJ7hwpbCSP4ps6soF57y3YX9cs=; b=LiRvyhpBsWDJitVSWNQaI/YdwbEFhNZ2v7osl22Vwh5mAvifREoEYlY5UW4Y/V6Vtv fF5uDnSA17Bo4PpIj9RtRPVPZxr14Ek8C52LRHpAiGqapviyDYvAoiugWbdVAe3adxwn yf63zomYB2e5c5KwG0z0iHzwr+Kf+qSNKi8qkFhdoOQhxGs3CmV1szqqUyhIdU1Slv26 7wxOzHlGAhiRi3j8OXXv51D22pAEOFmOzwev8pAtPqHR5qSMCs6q7eRsd6RwrspiPxpC gBfDLA5WVM5rtR57Jovt+zc26Rl2go16V138sZTQ8DfploIVOp9Nw8hF3H8TaPZDUMi6 9UqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685684973; x=1688276973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jBN/RWcDvPOwXwPxKLJ7hwpbCSP4ps6soF57y3YX9cs=; b=EVHqWinZQQhvugxJ4FM/taoT1YX8BglD7l2fAvYKyetSRvlBpwH33qNJYWsAxmVTP+ Vr/BauVPHb+zhOo8RXSmi/0/ni8t6mGVigrKffZMSTGA0VlT2nRtZItW1vqKE6HjgT3t D948Pijsul4Xew5AI5NQ01qy+c8wALh4mg1L+RKOfV2iPNjP7vZXhbU2HKClpcKoKCw5 TSZOUNdD8LpW7p32Qu1Km/wV6kL/Qn0r4g8h0UwKIF78locSwDbQsY9cpymM0SHLxMhe bz9RJSq+C0VUJz1S83Jnl5v090fm1yQzvwq5smRQq9a6I9MFJf9Br2Hrtftdy3+6PcNf jyVg== X-Gm-Message-State: AC+VfDywTQQkrz36/Wf7XxILCKudGIfs4WLB3JF14xxu1zKUoEudD8Fk PdKIUkjgs4Xe+QszTl7onGXsMZ4JcFuPs1vWh/0= X-Google-Smtp-Source: ACHHUZ6i8Yj/jn4nrWyKIq7yg+6FGl+3P9GNin6a55YolBhclgLGqi6thYCHu25BO4pR7fAOAlzXqA== X-Received: by 2002:a17:902:e5c4:b0:1af:981b:eeff with SMTP id u4-20020a170902e5c400b001af981beeffmr1424317plf.64.1685684973641; Thu, 01 Jun 2023 22:49:33 -0700 (PDT) From: Viresh Kumar To: xen-devel@lists.xen.org, Juergen Gross , Julien Grall , Anthony PERARD Cc: Viresh Kumar , Vincent Guittot , stratos-dev@op-lists.linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Mathieu Poirier , Oleksandr Tyshchenko , Erik Schilling Subject: [PATCH V3 2/3] libxl: Call libxl__virtio_devtype.set_default() early enough Date: Fri, 2 Jun 2023 11:19:08 +0530 Message-Id: <61727b8e00dd9acb0621e98528bd5051d3bd5c58.1685684586.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 The _setdefault() function for virtio devices is getting called after libxl__prepare_dtb(), which is late as libxl__prepare_dtb() expects the defaults to be already set by this time. Call libxl__virtio_devtype.set_default() from libxl__domain_config_setdefault(), in a similar way as other devices like disk, etc. Suggested-by: Anthony PERARD Signed-off-by: Viresh Kumar Reviewed-by: Anthony PERARD --- tools/libs/light/libxl_create.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c index ec8eab02c207..36770af6d4ff 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -1068,7 +1068,7 @@ int libxl__domain_config_setdefault(libxl__gc *gc, uint32_t domid /* for logging, only */) { libxl_ctx *ctx = libxl__gc_owner(gc); - int ret; + int ret, i; bool pod_enabled = false; libxl_domain_create_info *c_info = &d_config->c_info; @@ -1266,6 +1266,15 @@ int libxl__domain_config_setdefault(libxl__gc *gc, goto error_out; } + for (i = 0; i < d_config->num_virtios; i++) { + ret = libxl__virtio_devtype.set_default(gc, domid, + &d_config->virtios[i], false); + if (ret) { + LOGD(ERROR, domid, "Unable to set virtio defaults for device %d", i); + goto error_out; + } + } + ret = 0; error_out: return ret;