mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
To: gregkh@linuxfoundation.org, arnd@arndb.de
Cc: Cyprien Laplace <cyprien.laplace@broadcom.com>,
	Keerthana K <keerthana.kalyanasundaram@broadcom.com>,
	Jerrin Shaji George <jerrin.shaji-george@broadcom.com>,
	Ajay Kaher <ajay.kaher@broadcom.com>,
	Alexey Makhalov <alexey.makhalov@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
	x86@kernel.org
Subject: [PATCH v1 0/2] vmw_balloon: Add arm64 support
Date: Wed,  2 Dec 2026 21:38:19 +0000	[thread overview]
Message-ID: <20261202213821.22333-1-jerrin.shaji-george@broadcom.com> (raw)

VMware's hypervisor lets arm64 guests use the same I/O port based
backdoor interfaces as x86 guests by executing HVC #0x86, which asks
the hypervisor to emulate an x86 I/O port instruction. This series uses
that mechanism to run the VMware balloon driver in arm64 guests, so that
VMware can reclaim memory from them the way it already does for x86.

Patch 1 adds arch/arm64/include/asm/vmware.h with the definitions
needed to build the w7 value that tells the hypervisor which I/O
instruction to emulate. Patch 2 adds the arm64 transport and VMware
detection to the balloon driver.

The interface is as follows. Registers x0-x6 correspond to the x86
AX, BX, CX, DX, SI, DI and BP, and w7 describes the instruction to
emulate: bits [1:0] hold the access size, bit 2 selects IN rather than
OUT, and bit 3 says the port number is in DX rather than an immediate.
The balloon uses a 32-bit IN with the port in DX.

Notes on the design:

 - Only the single hypervisor call is architecture specific. The x86
   "inl" sequence moves into __vmballoon_call() and an arm64 variant is
   added next to it. The x86 behavior is unchanged.

 - The vmware_hypercall*() helpers in arch/x86/include/asm/vmware.h do
   not fit the balloon, which uses its own magic and port and needs
   full-width outputs, so the driver keeps a local call.

 - arm64 has no equivalent of x86_hyper_type, so the driver returns
   -ENODEV unless the SMCCC conduit is HVC and the DMI system vendor is
   "VMware, Inc.", which VMware's arm64 firmware reports in SMBIOS.

 - The hypervisor assumes 4 KiB pages, so on arm64 the driver depends
   on ARM64_4K_PAGES. Big-endian is excluded as well.

Testing:

 - Built with W=1 and KCFLAGS=-Werror on v7.4-rc4 with GCC 15.2.0:
   arm64 defconfig with VMWARE_BALLOON=m, and x86_64 defconfig with
   HYPERVISOR_GUEST and VMWARE_BALLOON=m.

 - Ran the driver in an arm64 guest with 4 KiB pages on ESX 9.1. The
   guest has 8 GiB of memory, about 6 GiB of it clean page cache. With
   a 5 GiB memory limit set on the VM, the balloon inflated to its
   target of 777216 pages (about 3 GiB), reclaiming the page cache.
   After the limit was removed it deflated back to 0 and free memory
   returned.

 - VMware's internal ESX balloon test group was also run against an
   arm64 guest with this series, and passed.

 - x86 was only build tested.

Origin: this is based on the VMware Photon OS arm64 patches by Cyprien
Laplace and Keerthana K, linked from the individual patches.

AI assistance: parts of this series were prepared with the help of LLM
coding assistants, namely porting the Photon patches to current
mainline, and reviewing the hypervisor call interface and register
usage. I have reviewed all of the code and take responsibility for it.

Jerrin Shaji George (2):
  arm64: Add VMware virtual I/O port definitions
  vmw_balloon: Add arm64 support

 MAINTAINERS                     |  1 +
 arch/arm64/include/asm/vmware.h | 26 +++++++++++
 drivers/misc/Kconfig            |  4 +-
 drivers/misc/vmw_balloon.c      | 82 +++++++++++++++++++++++++++------
 4 files changed, 98 insertions(+), 15 deletions(-)
 create mode 100644 arch/arm64/include/asm/vmware.h


base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
-- 
2.52.0


             reply	other threads:[~2026-12-02 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 21:38 Jerrin Shaji George [this message]
2026-12-02 21:38 ` [PATCH v1 1/2] arm64: Add VMware virtual I/O port definitions Jerrin Shaji George
2026-12-02 21:38 ` [PATCH v1 2/2] vmw_balloon: Add arm64 support Jerrin Shaji George
2026-12-03  6:55   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202213821.22333-1-jerrin.shaji-george@broadcom.com \
    --to=jerrin.shaji-george@broadcom.com \
    --cc=ajay.kaher@broadcom.com \
    --cc=alexey.makhalov@broadcom.com \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=catalin.marinas@arm.com \
    --cc=cyprien.laplace@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keerthana.kalyanasundaram@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=virtualization@lists.linux.dev \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®