All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Ilias Stamatis <ilstam@amazon.com>
Cc: <kvmarm@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
	<oliver.upton@linux.dev>, <joey.gouly@arm.com>,
	<suzuki.poulose@arm.com>, <yuzenghui@huawei.com>,
	<eric.auger@redhat.com>, <andre.przywara@arm.com>,
	<will@kernel.org>, <dwmw@amazon.co.uk>, <jgrall@amazon.co.uk>,
	<ugurus@amazon.co.uk>, <nh-open-source@amazon.com>
Subject: Re: [RFC] ARM vGIC-ITS tables serialization when running protected VMs
Date: Tue, 15 Apr 2025 09:35:40 +0100	[thread overview]
Message-ID: <867c3llt43.wl-maz@kernel.org> (raw)
In-Reply-To: <20250414111244.153528-1-ilstam@amazon.com>

On Mon, 14 Apr 2025 12:12:43 +0100,
Ilias Stamatis <ilstam@amazon.com> wrote:
> 
> # The problem
> 
> KVM's ARM Virtual Interrupt Translation Service (ITS) interface supports the
> KVM_DEV_ARM_ITS_SAVE_TABLES and KVM_DEV_ARM_ITS_RESTORE_TABLES operations.
> These operations save and restore a set of tables (Device Tables, Interrupt
> Translation Tables, Collection Table) to and from guest memory.
> 
> This can be a problem when running a protected VM on top of pKVM or another
> lowvisor since the host kernel (running at EL1) cannot access guest memory.
>

pKVM doesn't allow a guest to be saved/restored, full stop.

> # Page declassification and why ITTs are special
> 
> The Collection and Device tables are page aligned and their sizes must be a
> multiple of page size. If the lowvisor knows where these tables live, it is
> possible to "declassify" the corresponding pages and configure the MMU such as
> that the EL1 host can write to guest memory directly.
> 
> The ITTs (Interrupt Translation Tables) are different. They are NOT page
> aligned, they are 256 byte aligned and their size is variable. That means that
> the lowvisor can't declassify pages containing ITTs and configure the MMU
> giving the host direct access as above since those pages may contain unrelated
> data.

And it is the responsibility of the guest to make these page aligned
if it intend to let the hypervisor use them. To sum it up, the ITT
isn't special at all.

> 
> If the lowvisor knows where the ITTs live in guest memory it could instead
> perform the guest memory accesses on behalf of the host. I.e. the EL1 host
> would attempt to save the ITTs to guest memory like it does today, that would
> generate a data abort, and then the EL2 lowvisor could perform the copy after
> validating that the faulty address belongs to an ITT in guest memory.
> 
> One issue with the above is that the ITS save/restore happens at hypervisor
> live update which is a time sensitive operation and the extra traps (one per
> interrupt mapping?) can introduce significant additional overhead
> there.

I don't believe this for a second.

> 
> Another issue is that it's actually hard for the lowvisor to know where these
> tables live without trusting the EL1 host which virtualizes the ITS. It is
> especially hard knowing the locations of the ITTs (compared to
> Collection/Device tables) because that probably means having to parse the ITS
> command queue from EL2 which is complex and undesirable.
> 
> # An alternative: Serializing ITTs into a userspace buffer

NAK.

Share the page-aligned memory with the rest of the hypervisor, and use
the existing API.

	M.

-- 
Without deviation from the norm, progress is not possible.

  parent reply	other threads:[~2025-04-15  8:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 11:12 [RFC] ARM vGIC-ITS tables serialization when running protected VMs Ilias Stamatis
2025-04-14 11:12 ` [RFC PATCH 1/1] KVM: arm64: vgic-its: Add flag for saving ITTs in userspace buffer Ilias Stamatis
2025-04-15  8:35 ` Marc Zyngier [this message]
2025-04-15  9:44   ` [RFC] ARM vGIC-ITS tables serialization when running protected VMs David Woodhouse
2025-04-22 10:47     ` David Woodhouse
2025-04-27 16:43       ` Marc Zyngier
2025-06-26  6:22       ` David Woodhouse
2025-04-27 16:37     ` Marc Zyngier

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=867c3llt43.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=andre.przywara@arm.com \
    --cc=dwmw@amazon.co.uk \
    --cc=eric.auger@redhat.com \
    --cc=ilstam@amazon.com \
    --cc=jgrall@amazon.co.uk \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nh-open-source@amazon.com \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=ugurus@amazon.co.uk \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.