From 7920d73010346033ce74fc0bb5bb00dc2e7ddecb Mon Sep 17 00:00:00 2001 Message-Id: <7920d73010346033ce74fc0bb5bb00dc2e7ddecb.1349774430.git.minovotn@redhat.com> In-Reply-To: References: From: Luiz Capitulino Date: Fri, 5 Oct 2012 17:46:16 +0200 Subject: [PATCH 04/21] exec: add cpu_physical_memory_is_io() RH-Author: Luiz Capitulino Message-id: <1349459193-18226-3-git-send-email-lcapitulino@redhat.com> Patchwork-id: 42750 O-Subject: [RHEL6.4 qemu-kvm PATCH 02/19] exec: add cpu_physical_memory_is_io() Bugzilla: 832458 RH-Acked-by: Marcelo Tosatti RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini On upstream, the cpu_physical_memory_is_io() was added by commit 76f3553883b868e99c78212b9d12309e8e1e5d81. But as it uses the Memory API, it can't be backported as is. This commit uses an alternative implemention, written by Marcelo Tosatti, which uses the API present in RHEL6.3. Signed-off-by: Luiz Capitulino --- cpu-common.h | 4 ++++ exec.c | 11 +++++++++++ 2 files changed, 15 insertions(+) Signed-off-by: Michal Novotny --- cpu-common.h | 4 ++++ exec.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/cpu-common.h b/cpu-common.h index 8f1d8e4..b220da8 100644 --- a/cpu-common.h +++ b/cpu-common.h @@ -81,6 +81,10 @@ struct CPUPhysMemoryClient { QLIST_ENTRY(CPUPhysMemoryClient) list; }; +#ifndef CONFIG_USER_ONLY +bool cpu_physical_memory_is_io(target_phys_addr_t phys_addr); +#endif + void cpu_register_phys_memory_client(CPUPhysMemoryClient *); void cpu_unregister_phys_memory_client(CPUPhysMemoryClient *); diff --git a/exec.c b/exec.c index b401cdd..225f19c 100644 --- a/exec.c +++ b/exec.c @@ -4232,4 +4232,15 @@ void dump_exec_info(FILE *f, #undef env +bool cpu_physical_memory_is_io(target_phys_addr_t phys_addr) +{ + PhysPageDesc *p; + unsigned long pd; + + p = phys_page_find(phys_addr >> TARGET_PAGE_BITS); + pd = !p ? IO_MEM_UNASSIGNED : p->phys_offset; + + return (pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD); +} + #endif -- 1.7.11.4