public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel•org>
To: Yi-De Wu <yi-de.wu@mediatek•com>
Cc: Yingshiuan Pan <yingshiuan.pan@mediatek•com>,
	Ze-Yu Wang <ze-yu.wang@mediatek•com>,
	Rob Herring <robh@kernel•org>,
	Krzysztof Kozlowski <krzk+dt@kernel•org>,
	Conor Dooley <conor+dt@kernel•org>,
	Jonathan Corbet <corbet@lwn•net>,
	Catalin Marinas <catalin.marinas@arm•com>,
	Will Deacon <will@kernel•org>,
	Richard Cochran <richardcochran@gmail•com>,
	Matthias Brugger <matthias.bgg@gmail•com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora•com>,
	devicetree@vger•kernel.org, linux-kernel@vger•kernel.org,
	linux-doc@vger•kernel.org, linux-arm-kernel@lists•infradead.org,
	netdev@vger•kernel.org, linux-mediatek@lists•infradead.org,
	David Bradil <dbrazdil@google•com>,
	Trilok Soni <quic_tsoni@quicinc•com>,
	My Chuang <my.chuang@mediatek•com>,
	Shawn Hsiao <shawn.hsiao@mediatek•com>,
	PeiLun Suei <peilun.suei@mediatek•com>,
	Liju Chen <liju-clr.chen@mediatek•com>,
	Willix Yeh <chi-shen.yeh@mediatek•com>,
	Kevenny Hsieh <kevenny.hsieh@mediatek•com>
Subject: Re: [PATCH v10 06/21] virt: geniezone: Add set_user_memory_region for vm
Date: Mon, 15 Apr 2024 15:48:34 +0100	[thread overview]
Message-ID: <20240415144834.GC2320920@kernel.org> (raw)
In-Reply-To: <20240412065718.29105-7-yi-de.wu@mediatek.com>

On Fri, Apr 12, 2024 at 02:57:03PM +0800, Yi-De Wu wrote:
> From: "Yingshiuan Pan" <yingshiuan.pan@mediatek•com>
> 
> Direct use of physical memory from VMs is forbidden and designed to be
> dictated to the privilege models managed by GenieZone hypervisor for
> security reason. With the help of gzvm-ko, the hypervisor would be able
> to manipulate memory as objects. And the memory management is highly
> integrated with ARM 2-stage translation tables to convert VA to IPA to
> PA under proper security measures required by protected VMs.
> 
> Signed-off-by: Yingshiuan Pan <yingshiuan.pan@mediatek•com>
> Signed-off-by: Jerry Wang <ze-yu.wang@mediatek•com>
> Signed-off-by: Liju Chen <liju-clr.chen@mediatek•com>
> Signed-off-by: Yi-De Wu <yi-de.wu@mediatek•com>

...

> diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c

...

> +/* gzvm_vm_ioctl() - Ioctl handler of VM FD */
> +static long gzvm_vm_ioctl(struct file *filp, unsigned int ioctl,
> +			  unsigned long arg)
> +{
> +	long ret;
> +	void __user *argp = (void __user *)arg;
> +	struct gzvm *gzvm = filp->private_data;
> +
> +	switch (ioctl) {
> +	case GZVM_SET_USER_MEMORY_REGION: {
> +		struct gzvm_userspace_memory_region userspace_mem;
> +
> +		if (copy_from_user(&userspace_mem, argp, sizeof(userspace_mem)))
> +			return -EFAULT;
> +
> +		ret = gzvm_vm_ioctl_set_memory_region(gzvm, &userspace_mem);
> +		break;
> +	}
> +	default:
> +		ret = -ENOTTY;
> +	}
> +out:

nit: the out label as added here, but it does not seem to be used
     (until [PATCH v10 11/21] virt: geniezone: Add irqfd support).

     Although it probably isn't hurting anything - other than automated
     testing - it would be best to add as part of a patch that uses it.

Flagged by gcc-13 and clang-18 W=1 builds.

> +	return ret;
> +}
> +
>  static void gzvm_destroy_vm(struct gzvm *gzvm)
>  {
>  	pr_debug("VM-%u is going to be destroyed\n", gzvm->vm_id);

...

  reply	other threads:[~2024-04-15 14:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12  6:56 [PATCH v10 00/21] GenieZone hypervisor drivers Yi-De Wu
2024-04-12  6:56 ` [PATCH v10 01/21] virt: geniezone: enable gzvm-ko in defconfig Yi-De Wu
2024-04-12  6:56 ` [PATCH v10 02/21] docs: geniezone: Introduce GenieZone hypervisor Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 03/21] dt-bindings: hypervisor: Add MediaTek " Yi-De Wu
2024-04-15 17:03   ` Conor Dooley
2024-04-12  6:57 ` [PATCH v10 04/21] virt: geniezone: Add GenieZone hypervisor driver Yi-De Wu
2024-04-15 14:28   ` Simon Horman
2024-04-12  6:57 ` [PATCH v10 05/21] virt: geniezone: Add vm support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 06/21] virt: geniezone: Add set_user_memory_region for vm Yi-De Wu
2024-04-15 14:48   ` Simon Horman [this message]
2024-04-12  6:57 ` [PATCH v10 07/21] virt: geniezone: Add vm capability check Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 08/21] virt: geniezone: Optimize performance of protected VM memory Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 09/21] virt: geniezone: Add vcpu support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 10/21] virt: geniezone: Add irqchip support for virtual interrupt injection Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 11/21] virt: geniezone: Add irqfd support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 12/21] virt: geniezone: Add ioeventfd support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 13/21] virt: geniezone: Add memory region support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 14/21] virt: geniezone: Add dtb config support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 15/21] virt: geniezone: Add demand paging support Yi-De Wu
2024-04-15 14:52   ` Simon Horman
2024-04-12  6:57 ` [PATCH v10 16/21] virt: geniezone: Add block-based " Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 17/21] virt: geniezone: Add memory pin/unpin support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 18/21] virt: geniezone: Add memory relinquish support Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 19/21] virt: geniezone: Provide individual VM memory statistics within debugfs Yi-De Wu
2024-04-15 16:32   ` Simon Horman
2024-04-12  6:57 ` [PATCH v10 20/21] virt: geniezone: Add tracing support for hyp call and vcpu exit_reason Yi-De Wu
2024-04-12  6:57 ` [PATCH v10 21/21] virt: geniezone: Enable PTP for synchronizing time between host and guest VMs Yi-De Wu

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=20240415144834.GC2320920@kernel.org \
    --to=horms@kernel$(echo .)org \
    --cc=angelogioacchino.delregno@collabora$(echo .)com \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=chi-shen.yeh@mediatek$(echo .)com \
    --cc=conor+dt@kernel$(echo .)org \
    --cc=corbet@lwn$(echo .)net \
    --cc=dbrazdil@google$(echo .)com \
    --cc=devicetree@vger$(echo .)kernel.org \
    --cc=kevenny.hsieh@mediatek$(echo .)com \
    --cc=krzk+dt@kernel$(echo .)org \
    --cc=liju-clr.chen@mediatek$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-doc@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mediatek@lists$(echo .)infradead.org \
    --cc=matthias.bgg@gmail$(echo .)com \
    --cc=my.chuang@mediatek$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=peilun.suei@mediatek$(echo .)com \
    --cc=quic_tsoni@quicinc$(echo .)com \
    --cc=richardcochran@gmail$(echo .)com \
    --cc=robh@kernel$(echo .)org \
    --cc=shawn.hsiao@mediatek$(echo .)com \
    --cc=will@kernel$(echo .)org \
    --cc=yi-de.wu@mediatek$(echo .)com \
    --cc=yingshiuan.pan@mediatek$(echo .)com \
    --cc=ze-yu.wang@mediatek$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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