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

[PATCH v1 0/3] Remove mfn_to_gfn() on ARM


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <alejandro.garciavallejo@xxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Fri, 27 Mar 2026 15:50:22 +0800
  • 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=arcselector10001; 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=Sgxa1hhL2v18xuShfJSpsCGyXr9KnhiEWhnZC3mWhts=; b=DgeMjA/5nzeSXm0CQq/XtZaZAY+4jQGJWf9OX1pJMUWC3newDDpvzy2TTAFom2Ld06+6CbBKLg328DFPKrqKx6qi/sMAv0qT2kNZnReU8IIpdTYi64ennbeFpblVkXq9gPsTZlBkp6C6szf+Gj4ambOeeRcHC/gyHJ7p5zaUiENFEkaCDZn971mgltQee0dzjkaNbf4raLu9z4a6/Bp4H0cqwfUMXEfZWD9Z4h3pR2kNR1mT9ZiVDjW51ueRo9YJVWTonn9omWKBhxxqW+sUkGzUWIUjttJSaCsvN4XrwvMGxmJSW/63BERvdtse5Timz/ibnXL2AdGeB8sz3nOWVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pQhS1qfTjXprGLDvwRFogGr7m8DgcynhSvmahPqYgh7Lf4yA8tVoQDMLM1CczYCL144x5hRHX3MnoO7OA71k7NU9PWQsh9Ctpg2gw6WGdS/72NzxRJcfX6Ge4conxQ9A07LWd5aiibZxtY/EG/5902+IkLrzaIBguoh4ImvI0usHcNVRzPWvQ2GbusYtVT0ElDhnZE6kJ+xAgJV0vZvbn4Qi+b37V+oUJa9/oQwHGp++VpymZMDnScnZaRKN8fQnbOtKOV2QNuhTh7meKTcECmO2mI2m0JXkWFKUeSJRy6ugD2O6ZhG8LsJgOVwFviHasPzzVewfpkM3wNCDC47cyA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: <ray.huang@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 27 Mar 2026 07:56:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On ARM, mfn_to_gfn() is defined as an identity macro that unconditionally
returns the MFN as the GFN. This is incorrect for any non-direct-mapped domain.

It only has two call sites: getdomaininfo() and memory_exchange().
It causes getdomaininfo() to report the wrong shared_info_frame on ARM,
breaking any toolstack or test that relies on it. While as steal_page() is not
supported on arm, the error does not propagate to memory_exchange().

This series fixes the problem in the following steps:

- Generalize the existing per-page GFN storage in type_info so it is
  usable beyond xenheap pages.
- Introduce a shared_info_to_gfn() macro so getdomaininfo() switches to
  use page_get_xenheap_gfn() on ARM and still mfn_to_gfn() on x86
- Fix memory_exchange() to use page_set_gfn()/page_get_gfn(), which generalize
  the existing page_set_xenheap_gfn()/page_get_xenheap_gfn() from xenheap
  pages, instead of mfn_to_gfn() on ARM for stolen pages.

With all the above modification, we could remove the now-unused mfn_to_gfn()
macro on ARM.

Penny Zheng (3):
  xen/arm: generalize per-page GFN storage beyond xenheap pages
  xen: introduce shared_info_to_gfn()
  xen/arm: fix mfn_to_gfn() usage in memory_exchange()

 xen/arch/arm/include/asm/mm.h  | 40 +++++++++++++++++++++++-----------
 xen/arch/x86/include/asm/p2m.h |  3 +++
 xen/common/domctl.c            |  3 +--
 xen/common/memory.c            | 11 ++++++++++
 4 files changed, 42 insertions(+), 15 deletions(-)

-- 
2.34.1




 


Rackspace

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