mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Yi-De Wu <yi-de.wu@mediatek.com>,
	Yingshiuan Pan <yingshiuan.pan@mediatek.com>,
	Ze-Yu Wang <ze-yu.wang@mediatek.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Conor Dooley <conor.dooley@microchip.com>,
	Conor Dooley <conor+dt@kernel.org>,
	Trilok Soni <quic_tsoni@quicinc.com>,
	David Bradil <dbrazdil@google.com>,
	Jade Shih <jades.shih@mediatek.com>,
	Miles Chen <miles.chen@mediatek.com>,
	Ivan Tseng <ivan.tseng@mediatek.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>
Subject: Re: [PATCH v4 7/9] virt: geniezone: Add memory region support
Date: Mon, 12 Jun 2023 10:01:31 +0200	[thread overview]
Message-ID: <92b1c382-7428-5428-c8b1-e252ad3f81c1@collabora.com> (raw)
In-Reply-To: <20230609085214.31071-8-yi-de.wu@mediatek.com>

Il 09/06/23 10:52, Yi-De Wu ha scritto:
> From: "Jerry Wang" <ze-yu.wang@mediatek.com>
> 
> Hypervisor might need to know the precise purpose of each memory
> region, so that it can provide specific memory protection. We add a new
> uapi to pass address and size of a memory region and its purpose.
> 
> Signed-off-by: Jerry Wang <ze-yu.wang@mediatek.com>
> Signed-off-by: Liju-clr Chen <liju-clr.chen@mediatek.com>
> Signed-off-by: Yi-De Wu <yi-de.wu@mediatek.com>
> ---
>   arch/arm64/geniezone/gzvm_arch_common.h | 2 ++
>   arch/arm64/geniezone/vm.c               | 9 +++++++++
>   drivers/virt/geniezone/gzvm_vm.c        | 1 +
>   include/linux/gzvm_drv.h                | 2 ++
>   4 files changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/geniezone/gzvm_arch_common.h b/arch/arm64/geniezone/gzvm_arch_common.h
> index 5affa28b935a..5cfeb4df84c5 100644
> --- a/arch/arm64/geniezone/gzvm_arch_common.h
> +++ b/arch/arm64/geniezone/gzvm_arch_common.h
> @@ -23,6 +23,7 @@ enum {
>   	GZVM_FUNC_CREATE_DEVICE,
>   	GZVM_FUNC_PROBE,
>   	GZVM_FUNC_ENABLE_CAP,
> +	GZVM_FUNC_MEMREGION_PURPOSE,
>   	NR_GZVM_FUNC
>   };
>   
> @@ -46,6 +47,7 @@ enum {
>   #define MT_HVC_GZVM_CREATE_DEVICE	GZVM_HCALL_ID(GZVM_FUNC_CREATE_DEVICE)
>   #define MT_HVC_GZVM_PROBE		GZVM_HCALL_ID(GZVM_FUNC_PROBE)
>   #define MT_HVC_GZVM_ENABLE_CAP		GZVM_HCALL_ID(GZVM_FUNC_ENABLE_CAP)
> +#define MT_HVC_GZVM_MEMREGION_PURPOSE	GZVM_HCALL_ID(GZVM_FUNC_MEMREGION_PURPOSE)
>   #define GIC_V3_NR_LRS			16
>   
>   /**
> diff --git a/arch/arm64/geniezone/vm.c b/arch/arm64/geniezone/vm.c
> index 9f1f14f71b99..e19a66d6a75d 100644
> --- a/arch/arm64/geniezone/vm.c
> +++ b/arch/arm64/geniezone/vm.c
> @@ -97,6 +97,15 @@ int gzvm_arch_destroy_vm(gzvm_id_t vm_id)
>   				    0, 0, &res);
>   }
>   
> +int gzvm_arch_memregion_purpose(struct gzvm *gzvm, struct gzvm_userspace_memory_region *mem)
> +{
> +	struct arm_smccc_res res;
> +
> +	return gzvm_hypcall_wrapper(MT_HVC_GZVM_MEMREGION_PURPOSE, gzvm->vm_id,
> +				    mem->guest_phys_addr, mem->memory_size,
> +				    mem->flags, 0, 0, 0, &res);
> +}
> +
>   static int gzvm_vm_arch_enable_cap(struct gzvm *gzvm, struct gzvm_enable_cap *cap,
>   				   struct arm_smccc_res *res)
>   {
> diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c
> index ba5412acfa7d..3b1cb715ef34 100644
> --- a/drivers/virt/geniezone/gzvm_vm.c
> +++ b/drivers/virt/geniezone/gzvm_vm.c
> @@ -248,6 +248,7 @@ gzvm_vm_ioctl_set_memory_region(struct gzvm *gzvm,
>   	memslot->vma = vma;
>   	memslot->flags = mem->flags;
>   	memslot->slot_id = mem->slot;
> +	gzvm_arch_memregion_purpose(gzvm, mem);

ret = gzvm_arch_memregion_purpose(...)
if (ret)
	......

>   	return register_memslot_addr_range(gzvm, memslot);
>   }
>   

Regards,
Angelo


  reply	other threads:[~2023-06-12  8:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  8:52 [PATCH v4 0/9] GenieZone hypervisor drivers Yi-De Wu
2023-06-09  8:52 ` [PATCH v4 1/9] docs: geniezone: Introduce GenieZone hypervisor Yi-De Wu
2023-06-15 11:47   ` kernel test robot
2023-06-09  8:52 ` [PATCH v4 2/9] virt: geniezone: Add GenieZone hypervisor support Yi-De Wu
2023-06-09 15:22   ` Krzysztof Kozlowski
2023-07-21  8:46     ` Yi-De Wu (吳一德)
2023-07-22  1:29       ` Trilok Soni
2023-06-09  8:52 ` [PATCH v4 3/9] virt: geniezone: Add vcpu support Yi-De Wu
2023-06-09  8:52 ` [PATCH v4 4/9] virt: geniezone: Add irqchip support for virtual interrupt injection Yi-De Wu
2023-06-12  7:49   ` AngeloGioacchino Del Regno
2023-06-09  8:52 ` [PATCH v4 5/9] virt: geniezone: Add irqfd support Yi-De Wu
2023-06-12  7:57   ` AngeloGioacchino Del Regno
     [not found]     ` <6120750daede4eb40fb4d44ed68ba58e5716e038.camel@mediatek.com>
2023-06-27  9:27       ` Arnd Bergmann
2023-06-27  9:29   ` Arnd Bergmann
2023-06-09  8:52 ` [PATCH v4 6/9] virt: geniezone: Add ioeventfd support Yi-De Wu
2023-06-09  8:52 ` [PATCH v4 7/9] virt: geniezone: Add memory region support Yi-De Wu
2023-06-12  8:01   ` AngeloGioacchino Del Regno [this message]
2023-06-09  8:52 ` [PATCH v4 8/9] virt: geniezone: Add dtb config support Yi-De Wu
2023-06-12  8:02   ` AngeloGioacchino Del Regno
2023-06-09  8:52 ` [PATCH v4 9/9] virt: geniezone: Add virtual timer support 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=92b1c382-7428-5428-c8b1-e252ad3f81c1@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=chi-shen.yeh@mediatek.com \
    --cc=conor+dt@kernel.org \
    --cc=conor.dooley@microchip.com \
    --cc=corbet@lwn.net \
    --cc=dbrazdil@google.com \
    --cc=ivan.tseng@mediatek.com \
    --cc=jades.shih@mediatek.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=liju-clr.chen@mediatek.com \
    --cc=linux-arch@vger.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=matthias.bgg@gmail.com \
    --cc=miles.chen@mediatek.com \
    --cc=my.chuang@mediatek.com \
    --cc=peilun.suei@mediatek.com \
    --cc=quic_tsoni@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=shawn.hsiao@mediatek.com \
    --cc=will@kernel.org \
    --cc=yi-de.wu@mediatek.com \
    --cc=yingshiuan.pan@mediatek.com \
    --cc=ze-yu.wang@mediatek.com \
    /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

all inboxes | Powered by JetHome®