From patchwork Wed Jul 31 16:06:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 170175 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4233047ile; Wed, 31 Jul 2019 09:26:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgv0NOj9Q7O0OlPw3UCEBPo0T1c+Ia/pJi7rZAZODE480rvhIJEpSDOLAxVrARm3d+rTb2 X-Received: by 2002:a17:906:5042:: with SMTP id e2mr93231480ejk.220.1564590365127; Wed, 31 Jul 2019 09:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564590365; cv=none; d=google.com; s=arc-20160816; b=mVNjBoYJn7Z0ivU1SwkQuIt6uR9+Q/3bCAXvgDzxVwyTmjAxpY45mjlcZcIIGhAG8g ThRVez7kX2gHBddp8qf2o8XoxJqAEPWfVyPJzQ3CK94WEIBpw8RtlqzDYVXOUaFvUrhw vM0NflvDfh4rU4pSKU49hsUy3D4ZLf+s4GbcWw6wirMZunPGhAEfLdtIQv2m+wOVzF/h Qx/FhsGxeTe645io+BDJu4/In2kjCw05NB6AMq3hJm1xJvnbThYZFyed9o+4+w7qUkQq ecnEUl0zAta/PMbOhE9CO48TqntgCllTo2Q2TI5ivSkcgH6Db42iPrUqsZJR6pp+ERtV TXag== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=xUIrrQym9hhHiF/ew6BTz6jTay6S+r9Vm5o3Xaev8Hs=; b=s6PoH5sZ+qxbqfh5ggclAYedEMAdVdYfGaMHIgtwUc5eZI3+FBwpoQyXIpj5otmjMl hL9Oc4zPNiYXIsRiq3HklHXT/szDLAts3WjxBDvTX7iICHcw4VU1v1JCzT6/xxlwRb+u 2oWfrsrzswfVc3iNnlyAKKkPw2jCbBLrjmV+rJF1nWVc2I7RoWK67Q4pSiuB/U0vuku7 2+qAK1/Emy0GPHa1BRS4cEEIfU1kySjI9sq4xcYdVhNXj8zlPpU4InHiBOc7JNd7nn9B D4g1xzHoBOLV0Vl4iRJ0PlDBZpsomlJlB3D77J03QrForoUJ/11+rDbVj95wsiZGRx/k rdzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pe5a9RDd; 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 z23si22931833edd.410.2019.07.31.09.26.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 09:26:05 -0700 (PDT) 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=pe5a9RDd; 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]:42654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrQS-0004mA-3C for patch@linaro.org; Wed, 31 Jul 2019 12:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45017) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrPg-0004jW-DD for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsrPf-0000Fh-8f for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:16 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:43122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsrPf-0000Eo-2W for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:15 -0400 Received: by mail-wr1-x442.google.com with SMTP id p13so70341376wru.10 for ; Wed, 31 Jul 2019 09:25:14 -0700 (PDT) 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=xUIrrQym9hhHiF/ew6BTz6jTay6S+r9Vm5o3Xaev8Hs=; b=pe5a9RDdmLDJXrO4vomLHcNnwWulzPfhQIU+Vx6E0POxF7lnvb/Ou387A0TG+PVU4+ DRj0bfJpQ71cW6V8rK0XPJOB0cKb7oLvEw8MXHQyACjIMVWbh/CMEXST0X7NIOmkTXZG ck59fQClGudA6f9TnBoQmZTutGPa7JTBQ4ajP1sTlmOs0tjsSNVUglGoLdzDsXNIxWES 7nE2nYjL7CmrUvzyVq3pXIaQovyuxXy5Z3UT8b1AJ5ksZQxm+Cqc1M37yhU+TOaP+WV1 W3Gnhl6m8cdl0erAvKk2BLTF2uqNyBkGI1GeLaZZAdmiY3EvcXVyRMt5WIw6wFnNFIwb D46Q== 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=xUIrrQym9hhHiF/ew6BTz6jTay6S+r9Vm5o3Xaev8Hs=; b=s35Iwh72qXfFusBXE9lt6ZCIKWxyvC70fBZAZHfpnrPRWiPNgehzqqvBREi1MxPSPK JkAyQSeShMnfO0SQ5Ij9XPURAAv14TrhO6FQKtVnfRji4t1XXUNgUus8EnX7TFqgJ89i bRvD85M8i36jHoQXNSE29rBQL6zBP2GBhmJd+RDCiX4qH4PkEIK7h/BoGKB4HAv0D11b 2b7N9iL9TOCbPEFf+7Wq9q8u0yZ+TGNYojENngnTJx+Rs6he6jQWdGPHe4Wro+G3r+TE NzrNEvXOX7aaSt7sIjt4Q3+SLHGlP9nGayYzgjgOx0nEGC6T8iLVbEp4AVvlJB84mdit 53Jw== X-Gm-Message-State: APjAAAUw048b9gZXNZQpbKKNtNbz+b2uHokW8RqHGXC360tUAuX9oZD4 JeT5m87it7xvYJqncydlVRWmNg== X-Received: by 2002:a5d:48cf:: with SMTP id p15mr87208181wrs.151.1564590313855; Wed, 31 Jul 2019 09:25:13 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id f70sm91237513wme.22.2019.07.31.09.25.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:25:12 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0747E1FF9F; Wed, 31 Jul 2019 17:07:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:06:42 +0100 Message-Id: <20190731160719.11396-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v4 17/54] cputlb: document get_page_addr_code 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: aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , bobby.prani@gmail.com, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Suggested-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée --- accel/tcg/cputlb.c | 5 ----- include/exec/exec-all.h | 24 +++++++++++++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index bffdb251580..a01e04c5416 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1015,11 +1015,6 @@ static bool victim_tlb_hit(CPUArchState *env, size_t mmu_idx, size_t index, victim_tlb_hit(env, mmu_idx, index, offsetof(CPUTLBEntry, TY), \ (ADDR) & TARGET_PAGE_MASK) -/* NOTE: this function can trigger an exception */ -/* NOTE2: the returned address is not exactly the physical address: it - * is actually a ram_addr_t (in system mode; the user mode emulation - * version of this function returns a guest virtual address). - */ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) { uintptr_t mmu_idx = cpu_mmu_index(env, true); diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 16034ee651e..8b1c3d5b9db 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -480,7 +480,15 @@ void mmap_lock(void); void mmap_unlock(void); bool have_mmap_lock(void); -static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) +/** + * get_page_addr_code() - user-mode version + * @env: CPUArchState + * @addr: guest virtual address of guest code + * + * Returns @addr. + */ +static inline tb_page_addr_t get_page_addr_code(CPUArchState *env, + target_ulong addr) { return addr; } @@ -488,8 +496,18 @@ static inline tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong static inline void mmap_lock(void) {} static inline void mmap_unlock(void) {} -/* cputlb.c */ -tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr); +/** + * get_page_addr_code() - full-system version + * @env: CPUArchState + * @addr: guest virtual address of guest code + * + * If we cannot translate and execute from the entire RAM page, or if + * the region is not backed by RAM, returns -1. Otherwise, returns the + * ram_addr_t corresponding to the guest code at @addr. + * + * Note: this function can trigger an exception. + */ +tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr); void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); void tlb_set_dirty(CPUState *cpu, target_ulong vaddr);