From: "Liju-clr Chen (陳麗如)" <Liju-clr.Chen@mediatek.com>
To: "horms@kernel.org" <horms@kernel.org>
Cc: "corbet@lwn.net" <corbet@lwn.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Ze-yu Wang (王澤宇)" <Ze-yu.Wang@mediatek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"Chi-shen Yeh (葉奇軒)" <Chi-shen.Yeh@mediatek.com>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"quic_tsoni@quicinc.com" <quic_tsoni@quicinc.com>,
"dbrazdil@google.com" <dbrazdil@google.com>,
"PeiLun Suei (隋培倫)" <PeiLun.Suei@mediatek.com>,
"Kevenny Hsieh (謝宜芸)" <Kevenny.Hsieh@mediatek.com>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"richardcochran@gmail.com" <richardcochran@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"Yingshiuan Pan (潘穎軒)" <Yingshiuan.Pan@mediatek.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"Shawn Hsiao (蕭志祥)" <shawn.hsiao@mediatek.com>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
"will@kernel.org" <will@kernel.org>
Subject: Re: [PATCH v11 08/21] virt: geniezone: Add vcpu support
Date: Mon, 29 Jul 2024 03:35:57 +0000 [thread overview]
Message-ID: <6ea77f032fc0f2df5ca76d89e88acec3cc8d37c1.camel@mediatek.com> (raw)
In-Reply-To: <20240531203612.GU491852@kernel.org>
On Fri, 2024-05-31 at 21:36 +0100, Simon Horman wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> On Wed, May 29, 2024 at 04:42:26PM +0800, Liju-clr Chen wrote:
> > From: Yi-De Wu <yi-de.wu@mediatek.com>
> >
> > From: "Yingshiuan Pan" <yingshiuan.pan@mediatek.com>
>
> nit: I think there should be at most one From line,
> denoting the author of the patch. Based on the Signed-off-by
> lines I assume that is Yingshiuan Pan.
>
> If there are multiple authors perhaps
> the Co-developed-by tag should be used below.
>
> And on that note, it's not clear to me what the significance
> of the Signed-off-by lines, other than that of
> Yingshiuan Pan (presumed author) and Liju Chen (sender) are.
> I'd suggest deleting them unless they are
> accompanied by Co-developed-by tags.
>
> And, lastly, the sender's signed-off-by line should come last.
>
> See:
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
Hi Simon,
Thank you for your review. I will update it in next version.
>
> >
> > VMM use this interface to create vcpu instance which is a fd, and
> this
> > fd will be for any vcpu operations, such as setting vcpu registers
> and
> > accepts the most important ioctl GZVM_VCPU_RUN which requests
> GenieZone
> > hypervisor to do context switch to execute VM's vcpu context.
> >
> > Signed-off-by: Yingshiuan Pan <yingshiuan.pan@mediatek.com>
> > Signed-off-by: Jerry Wang <ze-yu.wang@mediatek.com>
> > Signed-off-by: kevenny hsieh <kevenny.hsieh@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/Makefile
> b/drivers/virt/geniezone/Makefile
> > index 25614ea3dea2..9cc453c0819b 100644
> > --- a/drivers/virt/geniezone/Makefile
> > +++ b/drivers/virt/geniezone/Makefile
> > @@ -6,4 +6,5 @@
> >
> > GZVM_DIR ?= ../../../drivers/virt/geniezone
> >
> > -gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o
> > +gzvm-y := $(GZVM_DIR)/gzvm_main.o $(GZVM_DIR)/gzvm_vm.o \
> > + $(GZVM_DIR)/gzvm_vcpu.o
> > diff --git a/drivers/virt/geniezone/gzvm_vcpu.c
> b/drivers/virt/geniezone/gzvm_vcpu.c
> > new file mode 100644
> > index 000000000000..1aca13fef422
> > --- /dev/null
> > +++ b/drivers/virt/geniezone/gzvm_vcpu.c
> > @@ -0,0 +1,249 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2023 MediaTek Inc.
> > + */
> > +
> > +#include <asm/sysreg.h>
>
> nit: It's not clear to me that sysreg.h needs to be included in this
> file.
Ok. I will update it in next version.
>
> > +#include <linux/anon_inodes.h>
> > +#include <linux/device.h>
> > +#include <linux/file.h>
> > +#include <linux/mm.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +#include <linux/soc/mediatek/gzvm_drv.h>
> > +
> > +/* maximum size needed for holding an integer */
> > +#define ITOA_MAX_LEN 12
> > +
> > +static long gzvm_vcpu_update_one_reg(struct gzvm_vcpu *vcpu,
> > + void __user *argp,
> > + bool is_write)
> > +{
> > +struct gzvm_one_reg reg;
> > +void __user *reg_addr;
> > +u64 data = 0;
> > +u64 reg_size;
> > +long ret;
> > +
> > +if (copy_from_user(®, argp, sizeof(reg)))
> > +return -EFAULT;
> > +
> > +reg_addr = (void __user *)reg.addr;
>
> nit: Perhaps u64_to_user_ptr() is appropriate here.
>
> Also in gzvm_vm_ioctl_create_device() in patch 09/21.
Ok. I will update it in next version.
Thanks,
Liju
>
> > +reg_size = (reg.id & GZVM_REG_SIZE_MASK) >> GZVM_REG_SIZE_SHIFT;
> > +reg_size = BIT(reg_size);
> > +
> > +if (reg_size != 1 && reg_size != 2 && reg_size != 4 && reg_size !=
> 8)
> > +return -EINVAL;
> > +
> > +if (is_write) {
> > +/* GZ hypervisor would filter out invalid vcpu register access */
> > +if (copy_from_user(&data, reg_addr, reg_size))
> > +return -EFAULT;
> > +} else {
> > +return -EOPNOTSUPP;
> > +}
> > +
> > +ret = gzvm_arch_vcpu_update_one_reg(vcpu, reg.id, is_write,
> &data);
> > +
> > +if (ret)
> > +return ret;
> > +
> > +return 0;
> > +}
>
> ...
next prev parent reply other threads:[~2024-07-29 3:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 8:42 [PATCH v11 00/21] GenieZone hypervisor drivers Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 01/21] virt: geniezone: enable gzvm-ko in defconfig Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 02/21] docs: geniezone: Introduce GenieZone hypervisor Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 03/21] dt-bindings: hypervisor: Add MediaTek " Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 04/21] virt: geniezone: Add GenieZone hypervisor driver Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 05/21] virt: geniezone: Add vm support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 06/21] virt: geniezone: Add set_user_memory_region for vm Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 07/21] virt: geniezone: Add vm capability check Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 08/21] virt: geniezone: Add vcpu support Liju-clr Chen
2024-05-31 20:36 ` Simon Horman
2024-07-29 3:35 ` Liju-clr Chen (陳麗如) [this message]
2024-05-29 8:42 ` [PATCH v11 09/21] virt: geniezone: Add irqchip support for virtual interrupt injection Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 10/21] virt: geniezone: Add irqfd support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 11/21] virt: geniezone: Add ioeventfd support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 12/21] virt: geniezone: Add memory region purpose for hypervisor Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 13/21] virt: geniezone: Add dtb config support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 14/21] virt: geniezone: Optimize performance of protected VM memory Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 15/21] virt: geniezone: Add memory pin/unpin support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 16/21] virt: geniezone: Add demand paging support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 17/21] virt: geniezone: Add block-based " Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 18/21] virt: geniezone: Add memory relinquish support Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 19/21] virt: geniezone: Provide individual VM memory statistics within debugfs Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 20/21] virt: geniezone: Add tracing support for hyp call and vcpu exit_reason Liju-clr Chen
2024-05-29 8:42 ` [PATCH v11 21/21] virt: geniezone: Enable PTP for synchronizing time between host and guest VMs Liju-clr Chen
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=6ea77f032fc0f2df5ca76d89e88acec3cc8d37c1.camel@mediatek.com \
--to=liju-clr.chen@mediatek.com \
--cc=Chi-shen.Yeh@mediatek.com \
--cc=Kevenny.Hsieh@mediatek.com \
--cc=PeiLun.Suei@mediatek.com \
--cc=Yingshiuan.Pan@mediatek.com \
--cc=Ze-yu.Wang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=dbrazdil@google.com \
--cc=devicetree@vger.kernel.org \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthias.bgg@gmail.com \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quic_tsoni@quicinc.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=rostedt@goodmis.org \
--cc=shawn.hsiao@mediatek.com \
--cc=will@kernel.org \
/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 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).