From patchwork Sat Dec 28 23:10:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 182500 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp4639317ild; Sat, 28 Dec 2019 15:11:57 -0800 (PST) X-Google-Smtp-Source: APXvYqywJqLTR9cLm4zwznGtt0yOyK7K60ceLAgS/X6KBC1Qu2SG+DOeFupH4qaWiiJq+rmNcZbk X-Received: by 2002:a05:6830:1e11:: with SMTP id s17mr62788356otr.343.1577574717363; Sat, 28 Dec 2019 15:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577574717; cv=none; d=google.com; s=arc-20160816; b=bUag2lDJcn7x9yJSODvTbBnv39yCjerKJ2cPCvi561nmh4MkA3y9fCjX7pYdgdIdgN ktAm0yoj4TOO3jNasx0ltkk1lKZdQfUaQtNap1zfVPVq1pdaVMI3ifqMmDJ+NTZPlXXi evd2TRIxnwHGqQ93GxsyKIedxlhLU5OxI/szqL7gDJ+/ky0UCLsMYKMr36T2FYD/RgUF LoYRurIYAyfJP/GoZc/T2i0sX3ubMfzXJcwJgktV9ljKYkRsmhLbhLLy/bijPwHXMpd1 RVoLfnxwk4pBNBBlPVKVJZFe99g/7EE1UTughvqsys0bHmlPn0FDn/MAq7Wligqvb1P0 /sfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iCXuMC6wO9f+VoJnhE3lUwa5BRgmWcB+z6z3m9aJPKQ=; b=kAht3V+Ac+EdUpPYZWYbKA/d5Uuiv550oVhWweI8k4KXVAkUWULGHhCv5FQCOSSjWD 19YXGfCrg0cEcWS+V3WY/Yfy3C7/BoSiQi4YsKTaTvYYK9+UO3KnzEpAoba0yzRU2Olg 1THClGqdXAD3oAMh7PfqQLxqRqbvx0OIBEkcZm+7OLT4pykwsTRJv7c3VMSCs5o4aHim iV0yYuRvsDQyfz8X6/vD5T2GU/LkFXMXbMPWNSU2izgE+jBPWKwQ9gFh+MWlOb9OF8vN e7qa9z9m4YD3BE//zkJZg87ecui2D9oMsbJC4iHhCDlUsHWnKBtxXy5JsAPQXmDuc+nw 3XJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="VccT/pFK"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v21si20729210otj.282.2019.12.28.15.11.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Dec 2019 15:11:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="VccT/pFK"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilLFU-0004JR-Bg for patch@linaro.org; Sat, 28 Dec 2019 18:11:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38976) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilLFI-0004Ga-LG for qemu-devel@nongnu.org; Sat, 28 Dec 2019 18:11:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilLFH-0003iD-0d for qemu-devel@nongnu.org; Sat, 28 Dec 2019 18:11:44 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:38320) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilLFG-0003eo-QV for qemu-devel@nongnu.org; Sat, 28 Dec 2019 18:11:42 -0500 Received: by mail-pg1-x542.google.com with SMTP id a33so16263971pgm.5 for ; Sat, 28 Dec 2019 15:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iCXuMC6wO9f+VoJnhE3lUwa5BRgmWcB+z6z3m9aJPKQ=; b=VccT/pFKYrNFJ3WEWmdpipPqoqHosL1A6LjVTQaN7FGNXJD16B1dqpHuAZgfkI+YBi sAqlfWglTg51sid7HvoGss4eTmmG+bMN2UqnqQZQvmy6Ora1CfeuP2G7Ab4YDKy/BWq3 zltK8VmCE2ymK4TJZ6KCfhsbHv+bwskwRBu7H3QId/v5y7nx083d8SqyVc9RhjfkDGJn IE+XKS0MWtn2/FvouFuBEz8DdxM7ga0FwKPbJI0rjfc1BKgqYN0JR/mL9YPgSfqntPbE 8RjEC+YdUwJthwW5Y7A8jqSOWAcZ17HOOi3ouavxS03avP+vinDF0AqRZc+4gj3+xBhW lSuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iCXuMC6wO9f+VoJnhE3lUwa5BRgmWcB+z6z3m9aJPKQ=; b=ZGjZBMZFHg+rfn9UOqBwA82BscLX44ywRdWiYEf4viQQGnDejqMmnBRbT5tt1EnAc+ siaPai5YMLuLu9qeDOjFCXm4k4a3IDAbrmTtJnAfrIKlcmlOmNAYJCAe7elSiZQHNNRf xj3Xhh8xZEjQzCERy8/bp6Jl/xr32Or+4psvD0t9vopQy3JQ9tUFNMmjxhciYjNstF6x UpogtvSeB4ZLhqJFJ9VJYdrFBotvaLL1Wb2EX+9bKzpPs61EX4WoncArlY39jncUuAcu jIo1SuMPxYBLuqWvfqt59CtdCMKKTUA3GylZpjaP+ZLEb+nVYAeng26xdci+K1UK1A4Q HwhQ== X-Gm-Message-State: APjAAAX8LwAKkP9Dp3ktHZnlK3mkqM3ynpEKHMYsysZZDUhtQzxe4QhV qx1ZaVF0fHjj+F8yUSxI8pUeLkDp9YQ= X-Received: by 2002:a63:5a64:: with SMTP id k36mr64306167pgm.323.1577574701551; Sat, 28 Dec 2019 15:11:41 -0800 (PST) Received: from localhost.localdomain (194-223-58-9.tpgi.com.au. [194.223.58.9]) by smtp.gmail.com with ESMTPSA id c18sm21077186pfr.40.2019.12.28.15.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2019 15:11:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/29] cputlb: Use trace_mem_get_info instead of trace_mem_build_info Date: Sun, 29 Dec 2019 10:10:57 +1100 Message-Id: <20191228231124.18307-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191228231124.18307-1-richard.henderson@linaro.org> References: <20191228231124.18307-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In the cpu_ldst templates, we already require a MemOp, and it is cleaner and clearer to pass that instead of 3 separate arguments describing the memory operation. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/cpu_ldst_template.h | 22 +++++++++++----------- include/exec/cpu_ldst_useronly_template.h | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) -- 2.20.1 diff --git a/include/exec/cpu_ldst_template.h b/include/exec/cpu_ldst_template.h index 54b5e858ce..0ad5de3ef9 100644 --- a/include/exec/cpu_ldst_template.h +++ b/include/exec/cpu_ldst_template.h @@ -86,9 +86,9 @@ glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, RES_TYPE res; target_ulong addr; int mmu_idx = CPU_MMU_INDEX; - TCGMemOpIdx oi; + MemOp op = MO_TE | SHIFT; #if !defined(SOFTMMU_CODE_ACCESS) - uint16_t meminfo = trace_mem_build_info(SHIFT, false, MO_TE, false, mmu_idx); + uint16_t meminfo = trace_mem_get_info(op, mmu_idx, false); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); #endif @@ -96,9 +96,9 @@ glue(glue(glue(cpu_ld, USUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, entry = tlb_entry(env, mmu_idx, addr); if (unlikely(entry->ADDR_READ != (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))))) { - oi = make_memop_idx(SHIFT, mmu_idx); + TCGMemOpIdx oi = make_memop_idx(op, mmu_idx); res = glue(glue(helper_ret_ld, URETSUFFIX), MMUSUFFIX)(env, addr, - oi, retaddr); + oi, retaddr); } else { uintptr_t hostaddr = addr + entry->addend; res = glue(glue(ld, USUFFIX), _p)((uint8_t *)hostaddr); @@ -125,9 +125,9 @@ glue(glue(glue(cpu_lds, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, int res; target_ulong addr; int mmu_idx = CPU_MMU_INDEX; - TCGMemOpIdx oi; -#if !defined(SOFTMMU_CODE_ACCESS) - uint16_t meminfo = trace_mem_build_info(SHIFT, true, MO_TE, false, mmu_idx); + MemOp op = MO_TE | MO_SIGN | SHIFT; +#ifndef SOFTMMU_CODE_ACCESS + uint16_t meminfo = trace_mem_get_info(op, mmu_idx, false); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); #endif @@ -135,7 +135,7 @@ glue(glue(glue(cpu_lds, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, entry = tlb_entry(env, mmu_idx, addr); if (unlikely(entry->ADDR_READ != (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))))) { - oi = make_memop_idx(SHIFT, mmu_idx); + TCGMemOpIdx oi = make_memop_idx(op & ~MO_SIGN, mmu_idx); res = (DATA_STYPE)glue(glue(helper_ret_ld, SRETSUFFIX), MMUSUFFIX)(env, addr, oi, retaddr); } else { @@ -167,9 +167,9 @@ glue(glue(glue(cpu_st, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, CPUTLBEntry *entry; target_ulong addr; int mmu_idx = CPU_MMU_INDEX; - TCGMemOpIdx oi; + MemOp op = MO_TE | SHIFT; #if !defined(SOFTMMU_CODE_ACCESS) - uint16_t meminfo = trace_mem_build_info(SHIFT, false, MO_TE, true, mmu_idx); + uint16_t meminfo = trace_mem_get_info(op, mmu_idx, true); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); #endif @@ -177,7 +177,7 @@ glue(glue(glue(cpu_st, SUFFIX), MEMSUFFIX), _ra)(CPUArchState *env, entry = tlb_entry(env, mmu_idx, addr); if (unlikely(tlb_addr_write(entry) != (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))))) { - oi = make_memop_idx(SHIFT, mmu_idx); + TCGMemOpIdx oi = make_memop_idx(op, mmu_idx); glue(glue(helper_ret_st, SUFFIX), MMUSUFFIX)(env, addr, v, oi, retaddr); } else { diff --git a/include/exec/cpu_ldst_useronly_template.h b/include/exec/cpu_ldst_useronly_template.h index dbdc7a845d..e5a3d1983a 100644 --- a/include/exec/cpu_ldst_useronly_template.h +++ b/include/exec/cpu_ldst_useronly_template.h @@ -70,8 +70,8 @@ glue(glue(cpu_ld, USUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) ret = glue(glue(ld, USUFFIX), _p)(g2h(ptr)); clear_helper_retaddr(); #else - uint16_t meminfo = trace_mem_build_info(SHIFT, false, MO_TE, false, - MMU_USER_IDX); + MemOp op = MO_TE | SHIFT; + uint16_t meminfo = trace_mem_get_info(op, MMU_USER_IDX, false); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); ret = glue(glue(ld, USUFFIX), _p)(g2h(ptr)); #endif @@ -102,8 +102,8 @@ glue(glue(cpu_lds, SUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr) ret = glue(glue(lds, SUFFIX), _p)(g2h(ptr)); clear_helper_retaddr(); #else - uint16_t meminfo = trace_mem_build_info(SHIFT, true, MO_TE, false, - MMU_USER_IDX); + MemOp op = MO_TE | MO_SIGN | SHIFT; + uint16_t meminfo = trace_mem_get_info(op, MMU_USER_IDX, false); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); ret = glue(glue(lds, SUFFIX), _p)(g2h(ptr)); qemu_plugin_vcpu_mem_cb(env_cpu(env), ptr, meminfo); @@ -131,8 +131,8 @@ static inline void glue(glue(cpu_st, SUFFIX), MEMSUFFIX)(CPUArchState *env, abi_ptr ptr, RES_TYPE v) { - uint16_t meminfo = trace_mem_build_info(SHIFT, false, MO_TE, true, - MMU_USER_IDX); + MemOp op = MO_TE | SHIFT; + uint16_t meminfo = trace_mem_get_info(op, MMU_USER_IDX, true); trace_guest_mem_before_exec(env_cpu(env), ptr, meminfo); glue(glue(st, SUFFIX), _p)(g2h(ptr), v); qemu_plugin_vcpu_mem_cb(env_cpu(env), ptr, meminfo);