From patchwork Thu Apr 7 10:54:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 90159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 69333B6F1E for ; Thu, 7 Apr 2011 20:57:20 +1000 (EST) Received: from localhost ([127.0.0.1]:57901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7mtm-0006hB-I4 for incoming@patchwork.ozlabs.org; Thu, 07 Apr 2011 06:57:14 -0400 Received: from [140.186.70.92] (port=49120 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7mrG-000615-CW for qemu-devel@nongnu.org; Thu, 07 Apr 2011 06:54:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7mrE-0007T8-1C for qemu-devel@nongnu.org; Thu, 07 Apr 2011 06:54:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7mrD-0007SI-Hd for qemu-devel@nongnu.org; Thu, 07 Apr 2011 06:54:35 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p37AsXx6002071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Apr 2011 06:54:33 -0400 Received: from redhat.com (vpn-200-170.tlv.redhat.com [10.35.200.170]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p37AsV3u021431; Thu, 7 Apr 2011 06:54:32 -0400 Date: Thu, 7 Apr 2011 13:54:16 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <0fd542fb7d13ddf12f897bb27c5950f31638b1df.1302173640.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Subject: [Qemu-devel] [PATCH 1/5] cpu: add set_memory flag to request dirty logging X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Pass the flag to all cpu notifiers, doing nothing at this point. Will be used by follow-up patches. Signed-off-by: Michael S. Tsirkin --- cpu-common.h | 22 +++++++++++++++++----- exec.c | 14 ++++++++------ hw/vhost.c | 3 ++- kvm-all.c | 3 ++- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/cpu-common.h b/cpu-common.h index ef4e8da..c239cc0 100644 --- a/cpu-common.h +++ b/cpu-common.h @@ -34,10 +34,21 @@ typedef unsigned long ram_addr_t; typedef void CPUWriteMemoryFunc(void *opaque, target_phys_addr_t addr, uint32_t value); typedef uint32_t CPUReadMemoryFunc(void *opaque, target_phys_addr_t addr); -void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, - ram_addr_t size, - ram_addr_t phys_offset, - ram_addr_t region_offset); +void cpu_register_physical_memory_log(target_phys_addr_t start_addr, + ram_addr_t size, + ram_addr_t phys_offset, + ram_addr_t region_offset, + bool log_dirty); + +static inline void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, + ram_addr_t size, + ram_addr_t phys_offset, + ram_addr_t region_offset) +{ + cpu_register_physical_memory_log(start_addr, size, phys_offset, + region_offset, false); +} + static inline void cpu_register_physical_memory(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset) @@ -91,7 +102,8 @@ struct CPUPhysMemoryClient { void (*set_memory)(struct CPUPhysMemoryClient *client, target_phys_addr_t start_addr, ram_addr_t size, - ram_addr_t phys_offset); + ram_addr_t phys_offset, + bool log_dirty); int (*sync_dirty_bitmap)(struct CPUPhysMemoryClient *client, target_phys_addr_t start_addr, target_phys_addr_t end_addr); diff --git a/exec.c b/exec.c index 964ce31..d1a066c 100644 --- a/exec.c +++ b/exec.c @@ -1711,11 +1711,12 @@ static QLIST_HEAD(memory_client_list, CPUPhysMemoryClient) memory_client_list static void cpu_notify_set_memory(target_phys_addr_t start_addr, ram_addr_t size, - ram_addr_t phys_offset) + ram_addr_t phys_offset, + bool log_dirty) { CPUPhysMemoryClient *client; QLIST_FOREACH(client, &memory_client_list, list) { - client->set_memory(client, start_addr, size, phys_offset); + client->set_memory(client, start_addr, size, phys_offset, log_dirty); } } @@ -1755,7 +1756,7 @@ static void phys_page_for_each_1(CPUPhysMemoryClient *client, for (i = 0; i < L2_SIZE; ++i) { if (pd[i].phys_offset != IO_MEM_UNASSIGNED) { client->set_memory(client, pd[i].region_offset, - TARGET_PAGE_SIZE, pd[i].phys_offset); + TARGET_PAGE_SIZE, pd[i].phys_offset, false); } } } else { @@ -2600,10 +2601,11 @@ static subpage_t *subpage_init (target_phys_addr_t base, ram_addr_t *phys, start_addr and region_offset are rounded down to a page boundary before calculating this offset. This should not be a problem unless the low bits of start_addr and region_offset differ. */ -void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, +void cpu_register_physical_memory_log(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset, - ram_addr_t region_offset) + ram_addr_t region_offset, + bool log_dirty) { target_phys_addr_t addr, end_addr; PhysPageDesc *p; @@ -2611,7 +2613,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, ram_addr_t orig_size = size; subpage_t *subpage; - cpu_notify_set_memory(start_addr, size, phys_offset); + cpu_notify_set_memory(start_addr, size, phys_offset, log_dirty); if (phys_offset == IO_MEM_UNASSIGNED) { region_offset = start_addr; diff --git a/hw/vhost.c b/hw/vhost.c index 14b571d..dc3d0e2 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -300,7 +300,8 @@ static int vhost_verify_ring_mappings(struct vhost_dev *dev, static void vhost_client_set_memory(CPUPhysMemoryClient *client, target_phys_addr_t start_addr, ram_addr_t size, - ram_addr_t phys_offset) + ram_addr_t phys_offset, + bool log_dirty) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK; diff --git a/kvm-all.c b/kvm-all.c index 1d7e8ea..1647e1a 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -625,7 +625,8 @@ static void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, static void kvm_client_set_memory(struct CPUPhysMemoryClient *client, target_phys_addr_t start_addr, - ram_addr_t size, ram_addr_t phys_offset) + ram_addr_t size, ram_addr_t phys_offset, + bool log_dirty) { kvm_set_phys_mem(start_addr, size, phys_offset); }