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

[PATCH v4 0/5] x86/pvh: Support relocating dom0 kernel


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 25 Mar 2024 16:45:10 -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=BVIhZ2xHZdP1BNOcu89kmSvypYbpjEehnkVKCvRnSFQ=; b=kopnGztjHt91LuKWXajCm14mBDw6+OIM6ZhFdPlT0jnL38IGn39t4O5ioJZ3Q0aGqb8xOs9QVt0UsM9x+mHIUyBFRyJJLjqGV5C/fwe076RxXUwxi+CEhn4EKsISzb9pHOt1AM83CPUC9IIMP87cU0aaTUM+RI9asRkfVGGYlvRAzfvmZLjXFhlObj44Vvedny9bxKqXxzt1aAe/LFmSBbE+Dbkvc6FyOp7WCVIUXavrOR+qiAxqGa43qyRCAahRXv5yvdMPaU4AJaCEZBl2pQ2hQNarLZtCO8kp/dkaF9gJehHE7ZdFcDXfQW0dWLyWf/MxK2SG//kNJ4IHyCKnsw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d2H6DGwLWkgS9BpczdGu6La7aNft0ZYMWAobnXiG/YOR1wWF9jQdAHjKwZhRdjOcQ6aDWf16mDDnRMqTrygTdKRateLa19Y+fc5fyTtjI6EnKiIE9v4KDLFdoBPRRUwiYvuSMDLPvoRsKRbld48oewaVc7IvZdNFDTduIUQX2gqmAiycWbjIFa0kIjv2eEMeAXhf/gzQfpk29ETM9stjyNJjLJqVE+iM+lROj3QZEEatobRUcpj6KfgcVeTEYi/I9P/HnAJ7K8IZPfhBcJIkCaBWKCUVtxB8sIG2otRzyPs7cvitEVXjafBeYxemXqXJ2if/N8JU4AarQekO7x9aCA==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 25 Mar 2024 20:45:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Xen tries to load a PVH dom0 kernel at the fixed guest physical address
from the elf headers.  For Linux, this defaults to 0x1000000 (16MB), but
it can be configured.

Unfortunately there exist firmwares that have reserved regions at this
address, so Xen fails to load the dom0 kernel since it's not RAM.

The other issue is that the Linux PVH entry point is not
position-independent.  It expects to run at the compiled
CONFIG_PHYSICAL_ADDRESS.

This patch set expands the PVH dom0 builder to try to relocate the
kernel if needed and possible.  XEN_ELFNOTE_PHYS32_RELOC is added for
kernels to indicate they are relocatable and their acceptable address
range and alignment.

The first patch reverts "xen/x86: bzImage parse kernel_alignment" since
the alignment will be specified by the ELF note.

The second and third patches move MB/GB() to common-macros.h.

The fourth patch expands ELF note printing beyond just printing
integers and strings.

The fifth patch expands the pvh dom0 kernel placement code.

I'll post an additional patch showing the Linux changes to make PVH
relocatable.

Jason Andryuk (5):
  Revert "xen/x86: bzImage parse kernel_alignment"
  tools/init-xenstore-domain: Replace variable MB() usage
  tools: Move MB/GB() to common-macros.h
  libelf: Expand ELF note printing
  x86/PVH: Support relocatable dom0 kernels

 tools/firmware/hvmloader/util.h         |  3 -
 tools/helpers/init-xenstore-domain.c    | 11 ++-
 tools/include/xen-tools/common-macros.h |  4 +
 tools/libs/light/libxl_internal.h       |  4 -
 xen/arch/x86/bzimage.c                  |  4 +-
 xen/arch/x86/hvm/dom0_build.c           | 98 ++++++++++++++++++++++++-
 xen/arch/x86/include/asm/bzimage.h      |  2 +-
 xen/arch/x86/pv/dom0_build.c            |  2 +-
 xen/common/libelf/libelf-dominfo.c      | 97 ++++++++++++++++++------
 xen/common/libelf/libelf-private.h      |  1 +
 xen/include/public/elfnote.h            | 19 ++++-
 xen/include/xen/libelf.h                |  4 +
 12 files changed, 206 insertions(+), 43 deletions(-)

-- 
2.44.0




 


Rackspace

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