From: Jan Kiszka <jan.kiszka@web.de>
To: Glauber Costa <gcosta@redhat.com>
Cc: kvm@vger.kernel.org, avi@qumranet.com, aliguori@us.ibm.com,
Glauber Costa <glommer@redhat.com>
Subject: Re: [PATCH] remove KVM_CAP_USER_MEMORY reference from qemu-kvm.c
Date: Wed, 10 Sep 2008 21:23:18 +0200 [thread overview]
Message-ID: <48C81EA6.10307@web.de> (raw)
In-Reply-To: <1220902221-7536-5-git-send-email-gcosta@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3414 bytes --]
Glauber Costa wrote:
> From: Glauber Costa <glommer@redhat.com>
>
> kvm_cpu_register_physical_memory() is its only user. Remove it.
>
> Signed-off-by: Glauber Costa <glommer@redhat.com>
> ---
> qemu/qemu-kvm.c | 52 +++++++++++++++++++++-------------------------------
> 1 files changed, 21 insertions(+), 31 deletions(-)
>
> diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
> index 8d366e5..f0ef21e 100644
> --- a/qemu/qemu-kvm.c
> +++ b/qemu/qemu-kvm.c
> @@ -775,42 +775,32 @@ void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr,
> unsigned long size,
> unsigned long phys_offset)
> {
> -#ifdef KVM_CAP_USER_MEMORY
> int r = 0;
> -
> - r = kvm_check_extension(kvm_context, KVM_CAP_USER_MEMORY);
> - if (r) {
> - if (!(phys_offset & ~TARGET_PAGE_MASK)) {
> - r = kvm_is_allocated_mem(kvm_context, start_addr, size);
> - if (r)
> - return;
> - r = kvm_is_intersecting_mem(kvm_context, start_addr);
> - if (r)
> - kvm_create_mem_hole(kvm_context, start_addr, size);
> - r = kvm_register_userspace_phys_mem(kvm_context, start_addr,
> - phys_ram_base + phys_offset,
> - size, 0);
> - }
> - if (phys_offset & IO_MEM_ROM) {
> - phys_offset &= ~IO_MEM_ROM;
> - r = kvm_is_intersecting_mem(kvm_context, start_addr);
> - if (r)
> - kvm_create_mem_hole(kvm_context, start_addr, size);
> - r = kvm_register_userspace_phys_mem(kvm_context, start_addr,
> - phys_ram_base + phys_offset,
> - size, 0);
> - }
> - if (r < 0) {
> - printf("kvm_cpu_register_physical_memory: failed\n");
> - exit(1);
> - }
> - return;
> + if (!(phys_offset & ~TARGET_PAGE_MASK)) {
> + r = kvm_is_allocated_mem(kvm_context, start_addr, size);
> + if (r)
> + return;
> + r = kvm_is_intersecting_mem(kvm_context, start_addr);
> + if (r)
> + kvm_create_mem_hole(kvm_context, start_addr, size);
> + r = kvm_register_userspace_phys_mem(kvm_context, start_addr,
> + phys_ram_base + phys_offset,
> + size, 0);
> }
> -#endif
> if (phys_offset & IO_MEM_ROM) {
At this chance: Shouldn't this become 'else if'?
> phys_offset &= ~IO_MEM_ROM;
> - memcpy(phys_ram_base + start_addr, phys_ram_base + phys_offset, size);
> + r = kvm_is_intersecting_mem(kvm_context, start_addr);
> + if (r)
> + kvm_create_mem_hole(kvm_context, start_addr, size);
> + r = kvm_register_userspace_phys_mem(kvm_context, start_addr,
> + phys_ram_base + phys_offset,
> + size, 0);
> + }
> + if (r < 0) {
> + printf("kvm_cpu_register_physical_memory: failed\n");
> + exit(1);
> }
> + return;
> }
>
> int kvm_setup_guest_memory(void *area, unsigned long size)
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2008-09-10 19:23 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-08 19:30 [PATCH 0/12] Get rid of kernel memory allocation Glauber Costa
2008-09-08 19:30 ` [PATCH] start removing kernel memory functions Glauber Costa
2008-09-08 19:30 ` [PATCH] remove tests of user memory from vl.c Glauber Costa
2008-09-08 19:30 ` [PATCH] coalesce memory allocation Glauber Costa
2008-09-08 19:30 ` [PATCH] remove KVM_CAP_USER_MEMORY reference from qemu-kvm.c Glauber Costa
2008-09-08 19:30 ` [PATCH] remove KVM_CAP_USER_MEMORY from libkvm.c Glauber Costa
2008-09-08 19:30 ` [PATCH] remove create_kernel_phys_mem Glauber Costa
2008-09-08 19:30 ` [PATCH] get rid of kvm_create_userspace_phys_mem Glauber Costa
2008-09-08 19:30 ` [PATCH] remove user_alloc field from slot representation Glauber Costa
2008-09-08 19:30 ` [PATCH] merge destroy phys mem functions Glauber Costa
2008-09-08 19:30 ` [PATCH] rename kvm_register_userspace_phys_mem Glauber Costa
2008-09-08 19:30 ` [PATCH] remove kernel memory code from hw/pc.c Glauber Costa
2008-09-08 19:30 ` [PATCH] remove kernel memory allocation code from ipf.c Glauber Costa
2008-09-10 19:23 ` Jan Kiszka [this message]
2008-09-10 19:37 ` [PATCH] remove KVM_CAP_USER_MEMORY reference from qemu-kvm.c Glauber Costa
2008-09-10 19:59 ` Jan Kiszka
2008-09-09 14:25 ` [PATCH 0/12] Get rid of kernel memory allocation Avi Kivity
2008-09-09 14:57 ` Glauber Costa
2008-09-09 15:01 ` Avi Kivity
2008-09-10 19:20 ` [PATCH 0/12] get rid of kernel memory registration Glauber Costa
2008-09-11 8:59 ` Avi Kivity
2008-09-10 19:20 ` [PATCH 01/12] start removing kernel memory functions Glauber Costa
2008-09-10 19:20 ` [PATCH 02/12] remove tests of user memory from vl.c Glauber Costa
2008-09-10 19:20 ` [PATCH 03/12] coalesce memory allocation Glauber Costa
2008-09-10 19:20 ` [PATCH 04/12] remove KVM_CAP_USER_MEMORY reference from qemu-kvm.c Glauber Costa
2008-09-10 19:20 ` [PATCH 05/12] remove KVM_CAP_USER_MEMORY from libkvm.c Glauber Costa
2008-09-10 19:21 ` [PATCH 06/12] remove create_kernel_phys_mem Glauber Costa
2008-09-10 19:21 ` [PATCH 07/12] get rid of kvm_create_userspace_phys_mem Glauber Costa
2008-09-10 19:21 ` [PATCH 08/12] remove user_alloc field from slot representation Glauber Costa
2008-09-10 19:21 ` [PATCH 09/12] merge destroy phys mem functions Glauber Costa
2008-09-10 19:21 ` [PATCH 10/12] rename kvm_register_userspace_phys_mem Glauber Costa
2008-09-10 19:21 ` [PATCH 11/12] remove kernel memory code from hw/pc.c Glauber Costa
2008-09-10 19:21 ` [PATCH 12/12] remove kernel memory allocation code from ipf.c Glauber Costa
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=48C81EA6.10307@web.de \
--to=jan.kiszka@web.de \
--cc=aliguori@us.ibm.com \
--cc=avi@qumranet.com \
--cc=gcosta@redhat.com \
--cc=glommer@redhat.com \
--cc=kvm@vger.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