[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eebbda6330367957ea1bd082fd8a775389688bf0.camel@mediatek.com>
Date: Mon, 22 May 2023 05:37:16 +0000
From: Yi-De Wu (吳一德) <Yi-De.Wu@...iatek.com>
To: "maz@...nel.org" <maz@...nel.org>
CC: "corbet@....net" <corbet@....net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
MY Chuang (莊明躍) <MY.Chuang@...iatek.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"quic_tsoni@...cinc.com" <quic_tsoni@...cinc.com>,
Shawn Hsiao (蕭志祥)
<shawn.hsiao@...iatek.com>,
Miles Chen (陳民樺)
<Miles.Chen@...iatek.com>,
PeiLun Suei (隋培倫)
<PeiLun.Suei@...iatek.com>,
Liju-clr Chen (陳麗如)
<Liju-clr.Chen@...iatek.com>,
"yi-de.wu@...iatek.corp-partner.google.com"
<yi-de.wu@...iatek.corp-partner.google.com>,
Jades Shih (施向玨)
<jades.shih@...iatek.com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"conor+dt@...nel.org" <conor+dt@...nel.org>,
"yipei.chang@...il.com" <yipei.chang@...il.com>,
"dbrazdil@...gle.com" <dbrazdil@...gle.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Yingshiuan Pan (潘穎軒)
<Yingshiuan.Pan@...iatek.com>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"arnd@...db.de" <arnd@...db.de>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
Ze-yu Wang (王澤宇)
<Ze-yu.Wang@...iatek.com>, "will@...nel.org" <will@...nel.org>,
Ivan Tseng (曾志軒)
<ivan.tseng@...iatek.com>
Subject: Re: [PATCH v3 3/7] virt: geniezone: Introduce GenieZone hypervisor
support
On Thu, 2023-05-18 at 09:27 +0100, Marc Zyngier wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Fri, 12 May 2023 09:04:01 +0100,
> Yi-De Wu <yi-de.wu@...iatek.com> wrote:
> >
> > From: "Yingshiuan Pan" <yingshiuan.pan@...iatek.com>
> >
> > GenieZone is MediaTek hypervisor solution, and it is running in EL2
> > stand alone as a type-I hypervisor. This patch exports a set of
> > ioctl
> > interfaces for userspace VMM (e.g., crosvm) to operate guest VMs
> > lifecycle (creation and destroy) on GenieZone.
> >
> > Signed-off-by: Yingshiuan Pan <yingshiuan.pan@...iatek.com>
> > Signed-off-by: Yi-De Wu <yi-de.wu@...iatek.com>
>
> [...]
>
> > +/**
> > + * gzvm_gfn_to_pfn_memslot() - Translate gfn (guest ipa) to pfn
> > (host pa),
> > + * result is in @pfn
> > + *
> > + * Leverage KVM's gfn_to_pfn_memslot(). Because
> > gfn_to_pfn_memslot() needs
> > + * kvm_memory_slot as parameter, this function populates necessary
> > fileds
> > + * for calling gfn_to_pfn_memslot().
> > + *
> > + * Return:
> > + * * 0 - Succeed
> > + * * -EFAULT - Failed to convert
> > + */
> > +static int gzvm_gfn_to_pfn_memslot(struct gzvm_memslot *memslot,
> > u64 gfn, u64 *pfn)
> > +{
> > + hfn_t __pfn;
> > + struct kvm_memory_slot kvm_slot = {0};
> > +
> > + kvm_slot.base_gfn = memslot->base_gfn;
> > + kvm_slot.npages = memslot->npages;
> > + kvm_slot.dirty_bitmap = NULL;
> > + kvm_slot.userspace_addr = memslot->userspace_addr;
> > + kvm_slot.flags = memslot->flags;
> > + kvm_slot.id = memslot->slot_id;
> > + kvm_slot.as_id = 0;
> > +
> > + __pfn = gfn_to_pfn_memslot(&kvm_slot, gfn);
> > + if (is_error_noslot_pfn(__pfn)) {
> > + *pfn = 0;
> > + return -EFAULT;
> > + }
>
> I have commented on this before: there is absolutely *no way* that
> you
> can use KVM as the unwilling helper for your stuff. You are passing
> uninitialised data to the core KVM, completely ignoring the semantics
> of all the other fields.
>
> More importantly, you are now holding us responsible for any breakage
> that would be caused to your code if we change the internals of this
> *PRIVATE FUNCTION*.
>
> Do you see Xen or Hyper-V using KVM's internals as some sort of
> backend to make their life easier? No, because they understand that
> this is off-limits, and creates an unhealthy dependency for both
> hypervisors.
>
> So this is a strong NAK. And you can trust me to keep voicing my
> opposition to this sort of horror, wherever I will see these patches.
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.
Noted and fully understood. The patch for this bug fix using our own
implementation would be submitted soon.
Powered by blists - more mailing lists