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

Re: [PATCH v2 3/3] x86/PVH: Support relocatable dom0 kernels


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 14 Mar 2024 12:59:19 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com 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=wiNG0Ak7+U+SIt+PZ8WIA6lzrnMnIqjZFnuNRPS1Kek=; b=E1NRIY1s28M4KYgIz5EZsg5tAA7tJituL8pKYA4Ky1ROxHeo6ioYyehDAvih/8lw/pwGkTZPWObo/euHYkOP3Q/GHua9/g3nJPujyNSmTqh8HMcc0ptXQCD+b1aPi5htvhDNo98HbF3zz23jz1IXae69x4jiTH1J/VqwljPCua9jRkzz1ZA6B4D2E7NCMbqu3UmRCJSG8LDRtCX1zGGSHjeGELNF/fpMura6U6JBlCnyvTJSa1r9FNsFbPOmeV4Ujc9SdIj/ejOMLoYXBAIBl9SaPyEAvnWj7dRMKgJ6kbsI4EgwtMBDcyVTuBYRLRhB4PiJpJlj7gFz3cp4XyVaJg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZm0f1OsglXIhLirbMUs4HjIOtZA6h1TD03ux0JRagDYTuwd0fz8OI73OfdwejO1M13i0E0QQTHsg6jkXuVPxe4dRaJJeta8/mvo4NSsllLGXc7PpOOZ7UApXxtMTrtPJW0niUDDItMA5WQ92dU6NeT5UchSBea79JaUYdBS9YvGVcFDqBNmh5RO+vtDvHH+gd9h8g0OkNefaS8k0rJPdpE6ExRwQq2RC74NXupWLgPJ8KNpeZcuqemp+IWd4BtRlNFTxR1wpDzKsQGjD+40Jq+0aY16/Wh+XlzlJBPEMvLw0yV8T/v5tp5W6YFWRpE8ajptlQSeE2kDi+phjn27fQ==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 14 Mar 2024 16:59:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-03-14 11:30, Jan Beulich wrote:
On 14.03.2024 15:33, Roger Pau Monné wrote:
On Thu, Mar 14, 2024 at 09:51:22AM -0400, Jason Andryuk wrote:
On 2024-03-14 05:48, Roger Pau Monné wrote:
On Wed, Mar 13, 2024 at 03:30:21PM -0400, Jason Andryuk wrote:
@@ -234,6 +235,17 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
                   elf_note_numeric_array(elf, note, 8, 0),
                   elf_note_numeric_array(elf, note, 8, 1));
           break;
+
+    case XEN_ELFNOTE_PVH_RELOCATION:
+        if ( elf_uval(elf, note, descsz) != 3 * sizeof(uint64_t) )
+            return -1;
+
+        parms->phys_min = elf_note_numeric_array(elf, note, 8, 0);
+        parms->phys_max = elf_note_numeric_array(elf, note, 8, 1);
+        parms->phys_align = elf_note_numeric_array(elf, note, 8, 2);

Size for those needs to be 4 (32bits) as the entry point is in 32bit
mode?  I don't see how we can start past the 4GB boundary.

I specified the note as 3x 64bit values.  It seemed simpler than trying to
support both 32bit and 64bit depending on the kernel arch.  Also, just using
64bit provides room in case it is needed in the future.

Why do you say depending on the kernel arch?

PVH doesn't know the bitness of the kernel, as the kernel entry point
is always started in protected 32bit mode.  We should just support
32bit values, regardless of the kernel bitness, because that's the
only range that's suitable in order to jump into the entry point.

Note how XEN_ELFNOTE_PHYS32_ENTRY is also unconditionally a 32bit
integer.

Linux defines PHYS32_ENTRY with _ASM_PTR, so it's 32 or 64 bit to match how the kernel is compiled. The Xen code parses the integer according to the size of the note.

Do you want the note to be changed to 3x 32bit values?

Unless anyone objects, yes, that's would be my preference.

As mentioned elsewhere, unless the entire note is meant to be x86-specific,
this fixed-32-bit property then would want limiting to x86.

PVH is only implemented for x86 today. Are you saying that the comment should just specify the values are 32bit for x86? If the note is reused for other arches, then they can specify their usage?

If this note is to be a variably sized array of values, then the elements should be of fixed size. Otherwise parsing is ambiguous without, say, another field specifying element size.

Maybe XEN_ELFNOTE_PHYS32_RELOC would be a better name to complement the PHYS32_ENTRY?

Regards,
Jason



 


Rackspace

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