linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v3 3/7] virt: geniezone: Introduce GenieZone hypervisor support
       [not found] ` <20230512080405.12043-4-yi-de.wu@mediatek.com>
@ 2023-05-18  8:27   ` Marc Zyngier
  2023-05-22  5:37     ` Yi-De Wu (吳一德)
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2023-05-18  8:27 UTC (permalink / raw)
  To: Yi-De Wu
  Cc: Yingshiuan Pan, Ze-Yu Wang, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jonathan Corbet, Catalin Marinas, Will Deacon,
	Arnd Bergmann, Matthias Brugger, AngeloGioacchino Del Regno,
	devicetree, linux-kernel, linux-doc, linux-arm-kernel, linux-arch,
	linux-mediatek, Trilok Soni, David Bradil, Jade Shih, Miles Chen,
	Ivan Tseng, My Chuang, Shawn Hsiao, PeiLun Suei, Liju Chen

On Fri, 12 May 2023 09:04:01 +0100,
Yi-De Wu <yi-de.wu@mediatek.com> wrote:
> 
> From: "Yingshiuan Pan" <yingshiuan.pan@mediatek.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@mediatek.com>
> Signed-off-by: Yi-De Wu <yi-de.wu@mediatek.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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 3/7] virt: geniezone: Introduce GenieZone hypervisor support
  2023-05-18  8:27   ` [PATCH v3 3/7] virt: geniezone: Introduce GenieZone hypervisor support Marc Zyngier
@ 2023-05-22  5:37     ` Yi-De Wu (吳一德)
  0 siblings, 0 replies; 3+ messages in thread
From: Yi-De Wu (吳一德) @ 2023-05-22  5:37 UTC (permalink / raw)
  To: maz@kernel.org
  Cc: corbet@lwn.net, linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	angelogioacchino.delregno@collabora.com,
	linux-mediatek@lists.infradead.org, linux-arch@vger.kernel.org,
	MY Chuang (莊明躍), devicetree@vger.kernel.org,
	quic_tsoni@quicinc.com, Shawn Hsiao (蕭志祥),
	Miles Chen (陳民樺),
	PeiLun Suei (隋培倫),
	Liju-clr Chen (陳麗如),
	yi-de.wu@mediatek.corp-partner.google.com,
	Jades Shih (施向玨), catalin.marinas@arm.com,
	conor+dt@kernel.org, yipei.chang@gmail.com, dbrazdil@google.com,
	linux-arm-kernel@lists.infradead.org,
	Yingshiuan Pan (潘穎軒),
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	arnd@arndb.de, linux-doc@vger.kernel.org,
	Ze-yu Wang (王澤宇), will@kernel.org,
	Ivan Tseng (曾志軒)

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@mediatek.com> wrote:
> > 
> > From: "Yingshiuan Pan" <yingshiuan.pan@mediatek.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@mediatek.com>
> > Signed-off-by: Yi-De Wu <yi-de.wu@mediatek.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.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 2/7] dt-bindings: hypervisor: Add MediaTek GenieZone hypervisor
       [not found]   ` <20230512-kudos-stunt-489ee651bdd8@wendy>
@ 2023-06-08  6:11     ` Yi-De Wu (吳一德)
  0 siblings, 0 replies; 3+ messages in thread
From: Yi-De Wu (吳一德) @ 2023-06-08  6:11 UTC (permalink / raw)
  To: conor.dooley@microchip.com
  Cc: corbet@lwn.net, linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	angelogioacchino.delregno@collabora.com,
	linux-mediatek@lists.infradead.org, linux-arch@vger.kernel.org,
	MY Chuang (莊明躍), devicetree@vger.kernel.org,
	quic_tsoni@quicinc.com, Shawn Hsiao (蕭志祥),
	Miles Chen (陳民樺),
	PeiLun Suei (隋培倫),
	Liju-clr Chen (陳麗如),
	Jades Shih (施向玨), catalin.marinas@arm.com,
	conor+dt@kernel.org, yipei.chang@gmail.com, dbrazdil@google.com,
	linux-arm-kernel@lists.infradead.org,
	Yingshiuan Pan (潘穎軒),
	krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com,
	arnd@arndb.de, linux-doc@vger.kernel.org,
	Ze-yu Wang (王澤宇), will@kernel.org,
	Ivan Tseng (曾志軒)

On Fri, 2023-05-12 at 12:09 +0100, Conor Dooley wrote:
> On Fri, May 12, 2023 at 04:04:00PM +0800, Yi-De Wu wrote:
> > From: "Yingshiuan Pan" <yingshiuan.pan@mediatek.com>
> > 
> > Add documentation for GenieZone(gzvm) node. This node informs gzvm
> > driver to start probing if geniezone hypervisor is available and
> > able to do virtual machine operations.
> 
> Propagated from v2:
> > > Why can't the driver just try and do virtual machine operations
> > > to
> > > see
> > > if the hypervisor is there? IOW, make your software interfaces
> > > discoverable. DT is for non-discoverable hardware.
> > 
> > Can do, our hypervisor is discoverable through invoking probing
> > hypercall, and we use the device tree to prevent unnecessary module
> > loading on all systems.
> 
> Rob is out of office at the moment, but that appears to be a request
> to
> drop the use of devicetree entirely. Mainly re-posting so that that
> conversation appears on the latest version of the patchset, given you
> only replied to Rob today.
> 
> Thanks,
> Conor.

We will remove our dt here and use the discoverable way to initialize
our devices. V4 patches which contain the changes mentioned would be
submitted soon in recent days.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-08  6:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230512080405.12043-1-yi-de.wu@mediatek.com>
     [not found] ` <20230512080405.12043-4-yi-de.wu@mediatek.com>
2023-05-18  8:27   ` [PATCH v3 3/7] virt: geniezone: Introduce GenieZone hypervisor support Marc Zyngier
2023-05-22  5:37     ` Yi-De Wu (吳一德)
     [not found] ` <20230512080405.12043-3-yi-de.wu@mediatek.com>
     [not found]   ` <20230512-kudos-stunt-489ee651bdd8@wendy>
2023-06-08  6:11     ` [PATCH v3 2/7] dt-bindings: hypervisor: Add MediaTek GenieZone hypervisor Yi-De Wu (吳一德)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).