From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>,
Pekka Enberg <penberg@kernel.org>
Cc: David Daney <ddaney.cavm@gmail.com>,
kvm@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [ÞATCH v2] kvmtool, mips: Support more than 256 MB guest memory
Date: Wed, 14 Jan 2015 11:08:32 +0800 [thread overview]
Message-ID: <54B5DDB0.9080702@intel.com> (raw)
In-Reply-To: <20150113101928.GA30360@alberich>
On 2015/1/13 18:19, Andreas Herrmann wrote:
> Two guest memory regions need to be defined and two "mem=" parameters
> need to be passed to guest kernel to support more than 256 MB.
>
> Cc: Chen, Tiejun <tiejun.chen@intel.com>
Looks fine to me.
Thanks
Tiejun
> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
> ---
> tools/kvm/mips/include/kvm/kvm-arch.h | 10 +++++++++
> tools/kvm/mips/kvm.c | 36 +++++++++++++++++++++++++++------
> 2 files changed, 40 insertions(+), 6 deletions(-)
>
> This version uses correct macros during calculation of memory
> parameters.
>
>
> Andreas
>
>
> diff --git a/tools/kvm/mips/include/kvm/kvm-arch.h b/tools/kvm/mips/include/kvm/kvm-arch.h
> index 7eadbf4..97bbf34 100644
> --- a/tools/kvm/mips/include/kvm/kvm-arch.h
> +++ b/tools/kvm/mips/include/kvm/kvm-arch.h
> @@ -1,10 +1,20 @@
> #ifndef KVM__KVM_ARCH_H
> #define KVM__KVM_ARCH_H
>
> +
> +/*
> + * Guest memory map is:
> + * 0x00000000-0x0fffffff : System RAM
> + * 0x10000000-0x1fffffff : I/O (defined by KVM_MMIO_START and KVM_MMIO_SIZE)
> + * 0x20000000- ... : System RAM
> + * See also kvm__init_ram().
> + */
> +
> #define KVM_MMIO_START 0x10000000
> #define KVM_PCI_CFG_AREA KVM_MMIO_START
> #define KVM_PCI_MMIO_AREA (KVM_MMIO_START + 0x1000000)
> #define KVM_VIRTIO_MMIO_AREA (KVM_MMIO_START + 0x2000000)
> +#define KVM_MMIO_SIZE 0x10000000
>
> /*
> * Just for reference. This and the above corresponds to what's used
> diff --git a/tools/kvm/mips/kvm.c b/tools/kvm/mips/kvm.c
> index fc0428b..1925f38 100644
> --- a/tools/kvm/mips/kvm.c
> +++ b/tools/kvm/mips/kvm.c
> @@ -22,11 +22,28 @@ void kvm__init_ram(struct kvm *kvm)
> u64 phys_start, phys_size;
> void *host_mem;
>
> - phys_start = 0;
> - phys_size = kvm->ram_size;
> - host_mem = kvm->ram_start;
> + if (kvm->ram_size <= KVM_MMIO_START) {
> + /* one region for all memory */
> + phys_start = 0;
> + phys_size = kvm->ram_size;
> + host_mem = kvm->ram_start;
>
> - kvm__register_mem(kvm, phys_start, phys_size, host_mem);
> + kvm__register_mem(kvm, phys_start, phys_size, host_mem);
> + } else {
> + /* one region for memory that fits below MMIO range */
> + phys_start = 0;
> + phys_size = KVM_MMIO_START;
> + host_mem = kvm->ram_start;
> +
> + kvm__register_mem(kvm, phys_start, phys_size, host_mem);
> +
> + /* one region for rest of memory */
> + phys_start = KVM_MMIO_START + KVM_MMIO_SIZE;
> + phys_size = kvm->ram_size - KVM_MMIO_START;
> + host_mem = kvm->ram_start + KVM_MMIO_START;
> +
> + kvm__register_mem(kvm, phys_start, phys_size, host_mem);
> + }
> }
>
> void kvm__arch_delete_ram(struct kvm *kvm)
> @@ -108,8 +125,15 @@ static void kvm__mips_install_cmdline(struct kvm *kvm)
> u64 argv_offset = argv_start;
> u64 argc = 0;
>
> - sprintf(p + cmdline_offset, "mem=0x%llx@0 ",
> - (unsigned long long)kvm->ram_size);
> +
> + if ((u64) kvm->ram_size <= KVM_MMIO_START)
> + sprintf(p + cmdline_offset, "mem=0x%llx@0 ",
> + (unsigned long long)kvm->ram_size);
> + else
> + sprintf(p + cmdline_offset, "mem=0x%llx@0 mem=0x%llx@0x%llx ",
> + (unsigned long long)KVM_MMIO_START,
> + (unsigned long long)kvm->ram_size - KVM_MMIO_START,
> + (unsigned long long)(KVM_MMIO_START + KVM_MMIO_SIZE));
>
> strcat(p + cmdline_offset, kvm->cfg.real_cmdline); /* maximum size is 2K */
>
>
prev parent reply other threads:[~2015-01-14 3:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 13:15 [ÞATCH] kvmtool, mips: Support more than 256 MB guest memory Andreas Herrmann
2015-01-06 13:15 ` Andreas Herrmann
2015-01-07 9:38 ` Chen, Tiejun
2015-01-07 14:06 ` Andreas Herrmann
2015-01-07 14:06 ` Andreas Herrmann
2015-01-13 10:19 ` [ÞATCH v2] " Andreas Herrmann
2015-01-13 10:19 ` Andreas Herrmann
2015-01-14 3:08 ` Chen, Tiejun [this message]
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=54B5DDB0.9080702@intel.com \
--to=tiejun.chen@intel.com \
--cc=andreas.herrmann@caviumnetworks.com \
--cc=ddaney.cavm@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=penberg@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