From patchwork Mon Dec 16 08:06:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 301517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1D2F52C007E for ; Mon, 16 Dec 2013 19:18:28 +1100 (EST) Received: from localhost ([::1]:54464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsTNg-0008TV-CU for incoming@patchwork.ozlabs.org; Mon, 16 Dec 2013 03:18:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsTMp-0007r9-Tn for qemu-devel@nongnu.org; Mon, 16 Dec 2013 03:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsTMj-0005qW-Lb for qemu-devel@nongnu.org; Mon, 16 Dec 2013 03:17:31 -0500 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:43493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsTMj-0005qO-5y for qemu-devel@nongnu.org; Mon, 16 Dec 2013 03:17:25 -0500 Received: by mail-pa0-f49.google.com with SMTP id kx10so2588261pab.8 for ; Mon, 16 Dec 2013 00:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=owkG30hlfTyF8rwX0Csj4yrcag9P5yaNu6Qm4sRmfyA=; b=AWU3o5JrL6u+7WY2kWcd47aTkiCx1OymOcQfuYiccLm98Fv1sbXcDVb0b/UfB9tDxE xvteHfCu604Jd2xqZQXfUbTkgGJm8Qb3vu5SNaKMSlupgfsDH9fvcUWrp3h7oBcvbvue qREyGnsXpCnWkAvr5JkrNqpAM+uTEp7eo/6NkhaRl8FTtUn8TB2+KanTMNfyyrJxKx/u D4n1EQNM9Cr4sLcsabm2+p+kg4S2nC8dKQ71JHLdpnRwtn/HIaq4Mi/FAcAnIVLWY1Xw gqDg4OXQn9X7VzoHduScXm2yWWRKf5Iqa0+9932aoPKI5iJEKGRDn6sUVIA8h+DqEWup HHRg== X-Received: by 10.67.3.3 with SMTP id bs3mr19006947pad.46.1387181844216; Mon, 16 Dec 2013 00:17:24 -0800 (PST) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id oj6sm33378185pab.9.2013.12.16.00.17.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 16 Dec 2013 00:17:23 -0800 (PST) From: edgar.iglesias@gmail.com To: qemu-devel@nongnu.org Date: Mon, 16 Dec 2013 18:06:06 +1000 Message-Id: <1387181170-23267-19-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387181170-23267-1-git-send-email-edgar.iglesias@gmail.com> References: <1387181170-23267-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::231 Cc: peter.maydell@linaro.org, blauwirbel@gmail.com, aliguori@amazon.com, pcrost@xilinx.com, pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH v1 18/22] exec: Make stb_phys input an AddressSpace X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Edgar E. Iglesias" Signed-off-by: Edgar E. Iglesias --- exec.c | 6 +++--- hw/net/vmware_utils.h | 2 +- hw/ppc/ppc405_uc.c | 10 +++++----- hw/ppc/spapr_hcall.c | 6 +++--- hw/s390x/s390-virtio-bus.c | 16 +++++++++++----- hw/s390x/s390-virtio.c | 2 +- hw/scsi/megasas.c | 6 ++++-- include/exec/cpu-common.h | 2 +- target-i386/svm_helper.c | 2 +- target-s390x/mem_helper.c | 2 +- target-sparc/ldst_helper.c | 6 +++--- 11 files changed, 34 insertions(+), 26 deletions(-) diff --git a/exec.c b/exec.c index cf35cd4..f027091 100644 --- a/exec.c +++ b/exec.c @@ -1609,7 +1609,7 @@ static void watch_mem_write(void *opaque, hwaddr addr, check_watchpoint(addr & ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_WRITE); switch (size) { case 1: - stb_phys(addr, val); + stb_phys(&address_space_memory, addr, val); break; case 2: stw_phys(&address_space_memory, addr, val); @@ -2582,10 +2582,10 @@ void stl_be_phys(AddressSpace *as, hwaddr addr, uint32_t val) } /* XXX: optimize */ -void stb_phys(hwaddr addr, uint32_t val) +void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val) { uint8_t v = val; - cpu_physical_memory_write(addr, &v, 1); + address_space_rw(as, addr, &v, 1, 1); } /* warning: addr must be aligned */ diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h index d8f734f..1099df6 100644 --- a/hw/net/vmware_utils.h +++ b/hw/net/vmware_utils.h @@ -74,7 +74,7 @@ static inline void vmw_shmem_st8(hwaddr addr, uint8_t value) { VMW_SHPRN("SHMEM store8: %" PRIx64 " (value 0x%X)", addr, value); - stb_phys(addr, value); + stb_phys(&address_space_memory, addr, value); } static inline uint32_t diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 4d22048..36a394b 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -62,27 +62,27 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd, stl_be_phys(env->as, bdloc + 0x1C, bd->bi_bootflags); stl_be_phys(env->as, bdloc + 0x20, bd->bi_ipaddr); for (i = 0; i < 6; i++) { - stb_phys(bdloc + 0x24 + i, bd->bi_enetaddr[i]); + stb_phys(env->as, bdloc + 0x24 + i, bd->bi_enetaddr[i]); } stw_be_phys(env->as, bdloc + 0x2A, bd->bi_ethspeed); stl_be_phys(env->as, bdloc + 0x2C, bd->bi_intfreq); stl_be_phys(env->as, bdloc + 0x30, bd->bi_busfreq); stl_be_phys(env->as, bdloc + 0x34, bd->bi_baudrate); for (i = 0; i < 4; i++) { - stb_phys(bdloc + 0x38 + i, bd->bi_s_version[i]); + stb_phys(env->as, bdloc + 0x38 + i, bd->bi_s_version[i]); } for (i = 0; i < 32; i++) { - stb_phys(bdloc + 0x3C + i, bd->bi_r_version[i]); + stb_phys(env->as, bdloc + 0x3C + i, bd->bi_r_version[i]); } stl_be_phys(env->as, bdloc + 0x5C, bd->bi_plb_busfreq); stl_be_phys(env->as, bdloc + 0x60, bd->bi_pci_busfreq); for (i = 0; i < 6; i++) { - stb_phys(bdloc + 0x64 + i, bd->bi_pci_enetaddr[i]); + stb_phys(env->as, bdloc + 0x64 + i, bd->bi_pci_enetaddr[i]); } n = 0x6A; if (flags & 0x00000001) { for (i = 0; i < 6; i++) - stb_phys(bdloc + n++, bd->bi_pci_enetaddr2[i]); + stb_phys(env->as, bdloc + n++, bd->bi_pci_enetaddr2[i]); } stl_be_phys(env->as, bdloc + n, bd->bi_opbfreq); n += 4; diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 520ffd5..5c0df80 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -369,7 +369,7 @@ static target_ulong register_vpa(CPUPPCState *env, target_ulong vpa) tmp = ldub_phys(env->as, env->vpa_addr + VPA_SHARED_PROC_OFFSET); tmp |= VPA_SHARED_PROC_VAL; - stb_phys(env->vpa_addr + VPA_SHARED_PROC_OFFSET, tmp); + stb_phys(env->as, env->vpa_addr + VPA_SHARED_PROC_OFFSET, tmp); return H_SUCCESS; } @@ -561,7 +561,7 @@ static target_ulong h_logical_store(PowerPCCPU *cpu, sPAPREnvironment *spapr, switch (size) { case 1: - stb_phys(addr, val); + stb_phys(cpu->env.as, addr, val); return H_SUCCESS; case 2: stw_phys(cpu->env.as, addr, val); @@ -624,7 +624,7 @@ static target_ulong h_logical_memop(PowerPCCPU *cpu, sPAPREnvironment *spapr, } switch (esize) { case 0: - stb_phys(dst, tmp); + stb_phys(cpu->env.as, dst, tmp); break; case 1: stw_phys(cpu->env.as, dst, tmp); diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index f05ca70..170d851 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -359,15 +359,21 @@ void s390_virtio_device_sync(VirtIOS390Device *dev) virtio_reset(dev->vdev); /* Sync dev space */ - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_TYPE, dev->vdev->device_id); + stb_phys(&address_space_memory, + dev->dev_offs + VIRTIO_DEV_OFFS_TYPE, dev->vdev->device_id); - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, s390_virtio_device_num_vq(dev)); - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN, dev->feat_len); + stb_phys(&address_space_memory, + dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, + s390_virtio_device_num_vq(dev)); + stb_phys(&address_space_memory, + dev->dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN, dev->feat_len); - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN, dev->vdev->config_len); + stb_phys(&address_space_memory, + dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN, dev->vdev->config_len); num_vq = s390_virtio_device_num_vq(dev); - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, num_vq); + stb_phys(&address_space_memory, + dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, num_vq); /* Sync virtqueues */ for (i = 0; i < num_vq; i++) { diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index 7adf92a..9eeda97 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -91,7 +91,7 @@ static int s390_virtio_hcall_reset(const uint64_t *args) return -EINVAL; } virtio_reset(dev->vdev); - stb_phys(dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0); + stb_phys(&address_space_memory, dev->dev_offs + VIRTIO_DEV_OFFS_STATUS, 0); s390_virtio_device_sync(dev); s390_virtio_reset_idx(dev); diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index e12f80c..59570e2 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -144,12 +144,14 @@ static bool megasas_is_jbod(MegasasState *s) static void megasas_frame_set_cmd_status(unsigned long frame, uint8_t v) { - stb_phys(frame + offsetof(struct mfi_frame_header, cmd_status), v); + stb_phys(&address_space_memory, + frame + offsetof(struct mfi_frame_header, cmd_status), v); } static void megasas_frame_set_scsi_status(unsigned long frame, uint8_t v) { - stb_phys(frame + offsetof(struct mfi_frame_header, scsi_status), v); + stb_phys(&address_space_memory, + frame + offsetof(struct mfi_frame_header, scsi_status), v); } /* diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index a02cc3b..20d3518 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -90,7 +90,7 @@ uint32_t ldl_le_phys(AddressSpace *as, hwaddr addr); uint32_t ldl_be_phys(AddressSpace *as, hwaddr addr); uint64_t ldq_le_phys(AddressSpace *as, hwaddr addr); uint64_t ldq_be_phys(AddressSpace *as, hwaddr addr); -void stb_phys(hwaddr addr, uint32_t val); +void stb_phys(AddressSpace *as, hwaddr addr, uint32_t val); void stw_le_phys(AddressSpace *as, hwaddr addr, uint32_t val); void stw_be_phys(AddressSpace *as, hwaddr addr, uint32_t val); void stl_le_phys(AddressSpace *as, hwaddr addr, uint32_t val); diff --git a/target-i386/svm_helper.c b/target-i386/svm_helper.c index 2475e4f..bb9cd3d 100644 --- a/target-i386/svm_helper.c +++ b/target-i386/svm_helper.c @@ -653,7 +653,7 @@ void helper_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1) env->vm_vmcb + offsetof(struct vmcb, save.dr7), env->dr[7]); stq_phys(env->as, env->vm_vmcb + offsetof(struct vmcb, save.dr6), env->dr[6]); - stb_phys(env->vm_vmcb + offsetof(struct vmcb, save.cpl), + stb_phys(env->as, env->vm_vmcb + offsetof(struct vmcb, save.cpl), env->hflags & HF_CPL_MASK); /* Reload the host state from vm_hsave */ diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c index 50cdba6..f147dec 100644 --- a/target-s390x/mem_helper.c +++ b/target-s390x/mem_helper.c @@ -984,7 +984,7 @@ static uint32_t mvc_asc(CPUS390XState *env, int64_t l, uint64_t a1, mvc_asc(env, l - i, a1 + i, mode1, a2 + i, mode2); break; } - stb_phys(dest + i, ldub_phys(env->as, src + i)); + stb_phys(env->as, dest + i, ldub_phys(env->as, src + i)); } return cc; diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index c814460..25f73b1 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -1010,7 +1010,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val, int asi, { switch (size) { case 1: - stb_phys(addr, val); + stb_phys(env->as, addr, val); break; case 2: stw_phys(env->as, addr, val); @@ -1029,7 +1029,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val, int asi, { switch (size) { case 1: - stb_phys((hwaddr)addr + stb_phys(env->as, (hwaddr)addr | ((hwaddr)(asi & 0xf) << 32), val); break; case 2: @@ -1807,7 +1807,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, { switch (size) { case 1: - stb_phys(addr, val); + stb_phys(env->as, addr, val); break; case 2: stw_phys(env->as, addr, val);