[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 7/8] tools: Introduce the "xl dt-overlay {attach,detach}" commands


  • To: Henry Wang <xin.wang2@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 20 May 2024 15:41:21 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HpVi/t7xur6IAV/kp/Bqzy90KKAo4YAaYUnQfTVA5d4=; b=h+lREDkXJDghQVRkoULhJCzjM6ExmugOBfT5mJJgMjNTD0GRNjqEpZ4ZSmJIH52sZ4GG9gSeNYKB9Nt2LYIw2UZXm4kjG3my/PpeQQPt44YVdh+laV8xUqvIWZjZd46e1DZ/MCVMPiJq2oXFW36rEJTo43PtUB9oIe3J5ONQoXf4iVNeYqM4EYAQBi4g+0ISFqSdvXt4Oq0qpBz0CPpgOZ8j8T3v8N757ZdtnB7qW4k/DRDgFUm0x2uKuQA3febXiegc2Dg52f7IUYUkEPOiQ5E8ivb4cEXB5aMr49wHESLVGJhUJgEe1XJJhULb31wwGo0FTCVEZk+WrbknFqn8qg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KO9xZjlJUUrGjV65aWvIEgQhVmPDSW9u69t0phjRLDUl4M8JZxvapQUNC8NK4w2p5DXl1tCaDInvz8QwGaS79E3+BllY7/LlwWq67Oa6D5hOQjrSLqQgqNIqm5VEb2STDdm5/GEA1I+Uw3+vVW6oFu6CnJNd2YVu8MgIeV2gC0keQezTVD4O4907IrLUamB8bCApgGq6j8swy4WQM+qgBwLeCs9re80lCAlBw+JGszZ/lRhWtvYovMAOsm4gy8P83jafaxO44jQHATzi1klNuCtNOm9ETLwXlTOdhOETp5rWVo3ivBnk+kQAHPcTMKfEshcas6R9g1Q3akNt78N0Yw==
  • Cc: Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Mon, 20 May 2024 19:41:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-05-16 06:03, Henry Wang wrote:
With the XEN_DOMCTL_dt_overlay DOMCTL added, users should be able to
attach/detach devices from the provided DT overlay to domains.
Support this by introducing a new set of "xl dt-overlay" commands and
related documentation, i.e. "xl dt-overlay {attach,detach}". Slightly
rework the command option parsing logic.

Since the addition of these two commands modifies the existing libxl
API libxl_dt_overlay(), also provide the backward compatible for it.

Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
---
v2:
- New patch.

Mostly looks good.  One small thing below.

diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 02575d5d36..53d1fa3655 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -1268,32 +1268,43 @@ int main_create(int argc, char **argv)
  #ifdef LIBXL_HAVE_DT_OVERLAY
  int main_dt_overlay(int argc, char **argv)
  {
-    const char *overlay_ops = NULL;
      const char *overlay_config_file = NULL;
      void *overlay_dtb = NULL;
      int rc;
      uint8_t op;
      int overlay_dtb_size = 0;
-    const int overlay_add_op = 1;
-    const int overlay_remove_op = 2;
+    uint32_t domain_id = 0;
if (argc < 2) {
          help("dt-overlay");
          return EXIT_FAILURE;
      }
- overlay_ops = argv[1];
-    overlay_config_file = argv[2];
-
-    if (strcmp(overlay_ops, "add") == 0)
-        op = overlay_add_op;
-    else if (strcmp(overlay_ops, "remove") == 0)
-        op = overlay_remove_op;
+    if (strcmp(argv[optind], "add") == 0)
+        op = LIBXL_DT_OVERLAY_ADD;
+    else if (strcmp(argv[optind], "remove") == 0)
+        op = LIBXL_DT_OVERLAY_REMOVE;
+    else if (strcmp(argv[optind], "attach") == 0)
+        op = LIBXL_DT_OVERLAY_ATTACH;
+    else if (strcmp(argv[optind], "detach") == 0)
+        op = LIBXL_DT_OVERLAY_DETACH;
      else {
          fprintf(stderr, "Invalid dt overlay operation\n");
          return EXIT_FAILURE;
      }
+ overlay_config_file = argv[optind+1];
+
+    if (op == LIBXL_DT_OVERLAY_ATTACH || op == LIBXL_DT_OVERLAY_DETACH) {
+        if (argc <= optind + 2) {
+            fprintf(stderr, "Missing domain ID\n");
+            help("dt-overlay");
+            return EXIT_FAILURE;
+        } else {
+            domain_id = strtol(argv[optind+2], NULL, 10);

domain_id = find_domain(argv[optind+2]);

And you'll get name resolution, too.

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.