[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z2QBPtRvnB3PGvMG@google.com>
Date: Thu, 19 Dec 2024 11:19:26 +0000
From: Mostafa Saleh <smostafa@...gle.com>
To: Quentin Perret <qperret@...gle.com>
Cc: iommu@...ts.linux.dev, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
catalin.marinas@....com, will@...nel.org, maz@...nel.org,
oliver.upton@...ux.dev, joey.gouly@....com, suzuki.poulose@....com,
yuzenghui@...wei.com, robdclark@...il.com, joro@...tes.org,
robin.murphy@....com, jean-philippe@...aro.org, jgg@...pe.ca,
nicolinc@...dia.com, vdonnefort@...gle.com, tabba@...gle.com,
danielmentz@...gle.com, tzukui@...gle.com
Subject: Re: [RFC PATCH v2 21/58] KVM: arm64: pkvm: Add
__pkvm_host_add_remove_page()
On Thu, Dec 19, 2024 at 11:10:23AM +0000, Quentin Perret wrote:
> On Thursday 12 Dec 2024 at 18:03:45 (+0000), Mostafa Saleh wrote:
> > From: Jean-Philippe Brucker <jean-philippe@...aro.org>
> > +/*
> > + * Temporarily unmap a page from the host stage-2, if @remove is true, or put it
> > + * back. After restoring the ownership to host, the page will be lazy-mapped.
> > + */
> > +int __pkvm_host_add_remove_page(u64 pfn, bool remove)
> > +{
> > + int ret;
> > + u64 host_addr = hyp_pfn_to_phys(pfn);
> > + u8 owner = remove ? PKVM_ID_HYP : PKVM_ID_HOST;
> > +
> > + host_lock_component();
> > + ret = host_stage2_set_owner_locked(host_addr, PAGE_SIZE, owner);
>
> Any reason why this can't be expressed using __pkvm_host_donate_hyp()
> and __pkvm_hyp_donate_host()?
That makes more sense, I will fix it.
>
> This doesn't check any state, so it feels like a dangerous primitive to
> have. Is the issue the overhead of mapping/unmapping into EL2 stage-1?
Powered by blists - more mailing lists