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

[PATCH] x86/pvh: pass module command line to dom0


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 29 Jan 2021 10:05:51 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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-SenderADCheck; bh=lfK1gAKaxc06QxEGH4rsRQ2svR0t2dib7ZOV92E0sRA=; b=gI0llmaxQETsVYoBCMj6iWtIxA2RTbQhKWoIK3TvYapJKnGCfol+yn/zxwh6yDaO5Vs/fz0V4yJJMCfEQzMKZHf9DSZhWzYcDbsnjck/XwZBY4S1CpXXdbObuH+mDLdkhdtXNTlvnroPeee0OOK2HqAc2mRLvaZCBFjWmiCfU3Qjndg2fzqsYDgmnC2g9zNGJw4vtzrNp6zHkR+n2ArsmGjY0E8xmdTo+CDA+tsjQ/acKybe8o7BvhJj111fiONiU53kfmteeVm9+Hj/3KPQevIJQsAxUreqD8bKmruDClIslKHX/f5p6Kiq96ps0yfcHg7OPmGfNH6x4M5fSsxEyQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0g4Z/4WxR6LbWo0Ay5FT32P5bOtKHfoQpH1Q/otUUqOLx3fFXY2EIXSJ6ZghzsIb1qFvQPmLtXSdg/aso7zOG9v8u8g6K2OyVGQkfVFejJgwXAU9chKlT5o6Ij3jnx0zhc8K7sl8G0SYUVwjQsUN08E0lBp7DgORmHqSPlWElMSwKX8m4ULjRX0gtmzzEbFjdvJitHjvcm9aOkpyE2TaArJYeoP4epopQLu11p9Kr5cqzxi1RXCbwTFWKoH7P2SE0H2Br/gxOOeFsZlvrdGTJs0M/FjhbgEWdZwPQFsq/LeUL2Yg6sIbeXtyGWjOWLcSJCEh8X0p7APhxm99dLBtw==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 29 Jan 2021 09:06:04 +0000
  • Ironport-sdr: yUhqcFN9uStfSliSXHGpRcbe47B6ur7VzX8NTHdE1Ob1EM5WNWUWkcnMBw7EQKchV9o3r4gcEB Qh/4kOZuPEp7YI82GXXY1T60K6qKdxX4IY5ZNXczaUhdXsVBtX6bP6k22X39A9KLltKG7LKU6J OQi88AofkvXAr6PM768OLwPOvjYzEg2W2mTSTrkha3UDhQ8bSJFNhOh6CTRge/5Ey5KXUYU9Jq 8dnT3DBfx96bRcDJa7bXYmFfkcAxZS6Uxd70hhtg5xCUXqSO23qAGdiZvoRx5fVhlxbPbAK5Yh gu0=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Both the multiboot and the HVM start info structures allow passing a
string together with a module. Implement the missing support in
pvh_load_kernel so that module strings found in the multiboot
structure are forwarded to dom0.

Fixes: 62ba982424 ('x86: parse Dom0 kernel for PVHv2')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
NB: str cannot be made const because __hvm_copy buf parameter (that
maps to str in the added code) is bi-directional depending on the
flags passed to the function.
---
 xen/arch/x86/hvm/dom0_build.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index 12a82c9d7c..5f9281ce30 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -617,7 +617,21 @@ static int __init pvh_load_kernel(struct domain *d, const 
module_t *image,
 
         mod.paddr = last_addr;
         mod.size = initrd->mod_end;
-        last_addr += ROUNDUP(initrd->mod_end, PAGE_SIZE);
+        last_addr += ROUNDUP(initrd->mod_end, elf_64bit(&elf) ? 8 : 4);
+        if ( initrd->string )
+        {
+            char *str = __va(initrd->string);
+
+            rc = hvm_copy_to_guest_phys(last_addr, str, strlen(str) + 1, v);
+            if ( rc )
+            {
+                printk("Unable to copy module command line\n");
+                return rc;
+            }
+            mod.cmdline_paddr = last_addr;
+            last_addr += strlen(str) + 1;
+        }
+        last_addr = ROUNDUP(last_addr, PAGE_SIZE);
     }
 
     /* Free temporary buffers. */
-- 
2.29.2




 


Rackspace

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