From patchwork Mon Apr 27 15:20:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 47625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F27DC20553 for ; Mon, 27 Apr 2015 15:27:45 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf27547075lab.1 for ; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=6rShHiFMcV7jFtnkY8hnQcM1DliDLjtXI69mrnvBoQY=; b=WKR3LdxM9zvhzEfbTrsrXiNw6AeLrlY9g02gY+WSJbTHZvHaNI5/NXcnebBHDsR2pV 2+VH3KuwAGzeOQDWYLiWns7OMxRg+Qxa/VwgTueqeonfeb+YxAdPhszlF1lzLrIzM7my Ep10494YEOa7YmfRVSbXa/Aiu9OJtXfXHIGoR4cw0IkNVx8uqyGXkuZatSc2bCG3G2MU J8llyTIhVDJRxIuvUAzxrOfDksXtwxkrkbexLOs9cCWlkVCixqGtl2O/t7Bv9ntHvPgL rds1Vj2NgFxbon6Z9uMq7gp/8FvgWXaXdoRJ/D+vNIhjbY2RVCTEQnSAopvV+42bqQlG Fm+g== X-Gm-Message-State: ALoCoQlEgt+Rav55WdreSPGEjJW7bwRrB+cSA990G4MkovGtnLA1kLYQwk/UWbH9IPSNrjJXDbHg X-Received: by 10.194.241.200 with SMTP id wk8mr7657496wjc.7.1430148464843; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.7 with SMTP id m7ls705103laj.70.gmail; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) X-Received: by 10.152.42.242 with SMTP id r18mr10621875lal.8.1430148464613; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id y1si14991777lae.68.2015.04.27.08.27.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 08:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laat2 with SMTP id t2so82688459laa.1 for ; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr10797353lab.35.1430148464492; Mon, 27 Apr 2015 08:27:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1343506lbt; Mon, 27 Apr 2015 08:27:43 -0700 (PDT) X-Received: by 10.55.24.169 with SMTP id 41mr12890636qky.35.1430148463320; Mon, 27 Apr 2015 08:27:43 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z13si16464986qkg.1.2015.04.27.08.27.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 27 Apr 2015 08:27:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:55801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymkwg-0007QB-EO for patch@linaro.org; Mon, 27 Apr 2015 11:27:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmkqB-0004C5-GC for qemu-devel@nongnu.org; Mon, 27 Apr 2015 11:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmkqA-0003cd-BX for qemu-devel@nongnu.org; Mon, 27 Apr 2015 11:20:59 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ymkq9-0003Ym-Tl for qemu-devel@nongnu.org; Mon, 27 Apr 2015 11:20:58 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Ymkpx-0008RR-Le for qemu-devel@nongnu.org; Mon, 27 Apr 2015 16:20:45 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 27 Apr 2015 16:20:33 +0100 Message-Id: <1430148045-32400-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1430148045-32400-1-git-send-email-peter.maydell@linaro.org> References: <1430148045-32400-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 05/17] exec.c: Convert subpage memory ops to _with_attrs 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Convert the subpage memory ops to _with_attrs; this will allow us to pass the attributes through to the underlying access functions. (Nothing uses the attributes yet.) Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini Reviewed-by: Edgar E. Iglesias --- exec.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/exec.c b/exec.c index 34dafd2..bba6f26 100644 --- a/exec.c +++ b/exec.c @@ -1941,8 +1941,8 @@ static const MemoryRegionOps watch_mem_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static uint64_t subpage_read(void *opaque, hwaddr addr, - unsigned len) +static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, + unsigned len, MemTxAttrs attrs) { subpage_t *subpage = opaque; uint8_t buf[8]; @@ -1951,23 +1951,29 @@ static uint64_t subpage_read(void *opaque, hwaddr addr, printf("%s: subpage %p len %u addr " TARGET_FMT_plx "\n", __func__, subpage, len, addr); #endif - address_space_read(subpage->as, addr + subpage->base, buf, len); + if (address_space_read(subpage->as, addr + subpage->base, buf, len)) { + return MEMTX_DECODE_ERROR; + } switch (len) { case 1: - return ldub_p(buf); + *data = ldub_p(buf); + return MEMTX_OK; case 2: - return lduw_p(buf); + *data = lduw_p(buf); + return MEMTX_OK; case 4: - return ldl_p(buf); + *data = ldl_p(buf); + return MEMTX_OK; case 8: - return ldq_p(buf); + *data = ldq_p(buf); + return MEMTX_OK; default: abort(); } } -static void subpage_write(void *opaque, hwaddr addr, - uint64_t value, unsigned len) +static MemTxResult subpage_write(void *opaque, hwaddr addr, + uint64_t value, unsigned len, MemTxAttrs attrs) { subpage_t *subpage = opaque; uint8_t buf[8]; @@ -1993,7 +1999,10 @@ static void subpage_write(void *opaque, hwaddr addr, default: abort(); } - address_space_write(subpage->as, addr + subpage->base, buf, len); + if (address_space_write(subpage->as, addr + subpage->base, buf, len)) { + return MEMTX_DECODE_ERROR; + } + return MEMTX_OK; } static bool subpage_accepts(void *opaque, hwaddr addr, @@ -2010,8 +2019,8 @@ static bool subpage_accepts(void *opaque, hwaddr addr, } static const MemoryRegionOps subpage_ops = { - .read = subpage_read, - .write = subpage_write, + .read_with_attrs = subpage_read, + .write_with_attrs = subpage_write, .impl.min_access_size = 1, .impl.max_access_size = 8, .valid.min_access_size = 1,