Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org,
	suzuki.poulose@arm.com, julien@xen.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, james.morse@arm.com
Subject: Re: [PATCH v4 kvmtool 04/12] builtin-run: Add arch hook to validate VM configuration
Date: Thu, 16 Jun 2022 18:07:07 +0100	[thread overview]
Message-ID: <20220616180707.53baeefe@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20220616134828.129006-5-alexandru.elisei@arm.com>

On Thu, 16 Jun 2022 14:48:20 +0100
Alexandru Elisei <alexandru.elisei@arm.com> wrote:

> Architectures are free to set their own command line options. Add an
> architecture specific hook to validate these options.
> 
> For now, the hook does nothing, but it will be used in later patches.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  Makefile          | 1 +
>  arm/aarch32/kvm.c | 5 +++++
>  arm/aarch64/kvm.c | 4 ++++
>  builtin-run.c     | 2 ++
>  include/kvm/kvm.h | 1 +
>  mips/kvm.c        | 4 ++++
>  powerpc/kvm.c     | 4 ++++
>  riscv/kvm.c       | 4 ++++
>  x86/kvm.c         | 4 ++++
>  9 files changed, 29 insertions(+)
>  create mode 100644 arm/aarch32/kvm.c
> 
> diff --git a/Makefile b/Makefile
> index 6464446a9f24..64bb9c95b6f6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -170,6 +170,7 @@ ifeq ($(ARCH), arm)
>  	OBJS		+= $(OBJS_ARM_COMMON)
>  	OBJS		+= arm/aarch32/arm-cpu.o
>  	OBJS		+= arm/aarch32/kvm-cpu.o
> +	OBJS		+= arm/aarch32/kvm.o
>  	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
>  	ARCH_INCLUDE	+= -Iarm/aarch32/include
>  	CFLAGS		+= -march=armv7-a
> diff --git a/arm/aarch32/kvm.c b/arm/aarch32/kvm.c
> new file mode 100644
> index 000000000000..ae33ac92479a
> --- /dev/null
> +++ b/arm/aarch32/kvm.c
> @@ -0,0 +1,5 @@
> +#include "kvm/kvm.h"
> +
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> diff --git a/arm/aarch64/kvm.c b/arm/aarch64/kvm.c
> index f3fe854e0b3f..ca348f118a56 100644
> --- a/arm/aarch64/kvm.c
> +++ b/arm/aarch64/kvm.c
> @@ -37,6 +37,10 @@ int vcpu_affinity_parser(const struct option *opt, const char *arg, int unset)
>  	return 0;
>  }
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> +
>  /*
>   * Return the TEXT_OFFSET value that the guest kernel expects. Note
>   * that pre-3.17 kernels expose this value using the native endianness
> diff --git a/builtin-run.c b/builtin-run.c
> index e1770b3c9df2..dcd08f739469 100644
> --- a/builtin-run.c
> +++ b/builtin-run.c
> @@ -531,6 +531,8 @@ static void kvm_run_validate_cfg(struct kvm *kvm)
>  				(unsigned long long)available_ram >> MB_SHIFT);
>  		}
>  	}
> +
> +	kvm__arch_validate_cfg(kvm);
>  }
>  
>  static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
> diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h
> index 7b14b33b50ca..9f7b2fb26e95 100644
> --- a/include/kvm/kvm.h
> +++ b/include/kvm/kvm.h
> @@ -187,6 +187,7 @@ int kvm__get_sock_by_instance(const char *name);
>  int kvm__enumerate_instances(int (*callback)(const char *name, int pid));
>  void kvm__remove_socket(const char *name);
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm);
>  void kvm__arch_set_cmdline(char *cmdline, bool video);
>  void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size);
>  void kvm__arch_delete_ram(struct kvm *kvm);
> diff --git a/mips/kvm.c b/mips/kvm.c
> index e668cbbefb25..cebec5ae0178 100644
> --- a/mips/kvm.c
> +++ b/mips/kvm.c
> @@ -13,6 +13,10 @@ struct kvm_ext kvm_req_ext[] = {
>  	{ 0, 0 }
>  };
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> +
>  void kvm__arch_read_term(struct kvm *kvm)
>  {
>  	virtio_console__inject_interrupt(kvm);
> diff --git a/powerpc/kvm.c b/powerpc/kvm.c
> index 702d67dca614..3215b579f5dc 100644
> --- a/powerpc/kvm.c
> +++ b/powerpc/kvm.c
> @@ -48,6 +48,10 @@ struct kvm_ext kvm_req_ext[] = {
>  	{ 0, 0 }
>  };
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> +
>  static uint32_t mfpvr(void)
>  {
>  	uint32_t r;
> diff --git a/riscv/kvm.c b/riscv/kvm.c
> index 84e02779a91c..7fb496282f4c 100644
> --- a/riscv/kvm.c
> +++ b/riscv/kvm.c
> @@ -13,6 +13,10 @@ struct kvm_ext kvm_req_ext[] = {
>  	{ 0, 0 },
>  };
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> +
>  bool kvm__arch_cpu_supports_vm(void)
>  {
>  	/* The KVM capability check is enough. */
> diff --git a/x86/kvm.c b/x86/kvm.c
> index 3e0f0b743f8c..6683a5c81d49 100644
> --- a/x86/kvm.c
> +++ b/x86/kvm.c
> @@ -35,6 +35,10 @@ struct kvm_ext kvm_req_ext[] = {
>  	{ 0, 0 }
>  };
>  
> +void kvm__arch_validate_cfg(struct kvm *kvm)
> +{
> +}
> +
>  bool kvm__arch_cpu_supports_vm(void)
>  {
>  	struct cpuid_regs regs;


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

  reply	other threads:[~2022-06-16 17:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 13:48 [PATCH v4 kvmtool 00/12] arm64: Allow the user to set RAM base address Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 01/12] Use MB for megabytes consistently Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 02/12] builtin-run: Always use RAM size in bytes Alexandru Elisei
2022-06-16 17:07   ` Andre Przywara
2022-06-16 13:48 ` [PATCH v4 kvmtool 03/12] builtin-run: Rework RAM size validation Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 04/12] builtin-run: Add arch hook to validate VM configuration Alexandru Elisei
2022-06-16 17:07   ` Andre Przywara [this message]
2022-06-16 13:48 ` [PATCH v4 kvmtool 05/12] arm/arm64: Fail if RAM size is too large for 32-bit guests Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 06/12] arm/arm64: Kill the ARM_MAX_MEMORY() macro Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 07/12] arm/arm64: Kill the ARM_HIMAP_MAX_MEMORY() macro Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 08/12] builtin_run: Allow standard size specifiers for memory Alexandru Elisei
2022-06-16 17:10   ` Andre Przywara
2022-06-16 13:48 ` [PATCH v4 kvmtool 09/12] kvm__arch_init: Remove hugetlbfs_path and ram_size as parameters Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 10/12] arm/arm64: Consolidate RAM initialization in kvm__init_ram() Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 11/12] Introduce kvm__arch_default_ram_address() Alexandru Elisei
2022-06-16 13:48 ` [PATCH v4 kvmtool 12/12] arm64: Allow the user to specify the RAM base address Alexandru Elisei
2022-06-21 17:03 ` [PATCH v4 kvmtool 00/12] arm64: Allow the user to set " Suzuki K Poulose
2022-06-22  9:27   ` Alexandru Elisei
2022-07-01 15:41 ` Will Deacon

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=20220616180707.53baeefe@donnerap.cambridge.arm.com \
    --to=andre.przywara@arm.com \
    --cc=alexandru.elisei@arm.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=julien@xen.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.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