From: Andre Przywara <andre.przywara@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Will Deacon <will@kernel.org>,
Alexandru Elisei <alexandru.elisei@arm.com>
Subject: Re: [PATCH 1/3] kvmtool: Abstract KVM_VM_TYPE into a weak function
Date: Thu, 18 Mar 2021 10:20:38 +0000 [thread overview]
Message-ID: <20210318102038.5011ed03@slackpad.fritz.box> (raw)
In-Reply-To: <20210309163909.822149-2-maz@kernel.org>
On Tue, 9 Mar 2021 16:39:07 +0000
Marc Zyngier <maz@kernel.org> wrote:
> Most architectures pass a fixed value for their VM type. However,
> arm64 uses it as a parameter describing the size of the guest's
> physical address space.
>
> In order to support this, introduce a kvm__get_vm_type() helper
> that only returns KVM_VM_TYPE for now.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> ---
> include/kvm/kvm.h | 1 +
> kvm.c | 7 ++++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h
> index 53373b0..72a42e8 100644
> --- a/include/kvm/kvm.h
> +++ b/include/kvm/kvm.h
> @@ -100,6 +100,7 @@ int kvm__init(struct kvm *kvm);
> struct kvm *kvm__new(void);
> int kvm__recommended_cpus(struct kvm *kvm);
> int kvm__max_cpus(struct kvm *kvm);
> +int kvm__get_vm_type(struct kvm *kvm);
> void kvm__init_ram(struct kvm *kvm);
> int kvm__exit(struct kvm *kvm);
> bool kvm__load_firmware(struct kvm *kvm, const char *firmware_filename);
> diff --git a/kvm.c b/kvm.c
> index e327541..5bc66c8 100644
> --- a/kvm.c
> +++ b/kvm.c
> @@ -428,6 +428,11 @@ int kvm__max_cpus(struct kvm *kvm)
> return ret;
> }
>
> +int __attribute__((weak)) kvm__get_vm_type(struct kvm *kvm)
> +{
> + return KVM_VM_TYPE;
> +}
> +
> int kvm__init(struct kvm *kvm)
> {
> int ret;
> @@ -461,7 +466,7 @@ int kvm__init(struct kvm *kvm)
> goto err_sys_fd;
> }
>
> - kvm->vm_fd = ioctl(kvm->sys_fd, KVM_CREATE_VM, KVM_VM_TYPE);
> + kvm->vm_fd = ioctl(kvm->sys_fd, KVM_CREATE_VM, kvm__get_vm_type(kvm));
> if (kvm->vm_fd < 0) {
> pr_err("KVM_CREATE_VM ioctl");
> ret = kvm->vm_fd;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-18 10:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 16:39 [PATCH 0/3] kvmtool: Limit IPA space to what is actually required Marc Zyngier
2021-03-09 16:39 ` [PATCH 1/3] kvmtool: Abstract KVM_VM_TYPE into a weak function Marc Zyngier
2021-03-18 10:20 ` Andre Przywara [this message]
2021-03-09 16:39 ` [PATCH 2/3] kvmtool: arm64: Use the maximum supported IPA size when creating the VM Marc Zyngier
2021-03-18 10:21 ` Andre Przywara
2021-03-18 14:06 ` Marc Zyngier
2021-03-09 16:39 ` [PATCH 3/3][Do not merge] kvmtool: arm64: Configure VM with the minimal required IPA space Marc Zyngier
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=20210318102038.5011ed03@slackpad.fritz.box \
--to=andre.przywara@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--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).