From patchwork Tue Sep 3 16:08:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172882 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp107245ily; Tue, 3 Sep 2019 09:51:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVjJ0vkgAiirzdphm/TV/lMsMlkPNigS1Prf6jVnxr3GfTeqKbgv7+PazqDO6bnt5OK2NA X-Received: by 2002:a37:b001:: with SMTP id z1mr33931496qke.383.1567529466302; Tue, 03 Sep 2019 09:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567529466; cv=none; d=google.com; s=arc-20160816; b=WkK+931OKgta3YGPJFNPaSHD66TuoJvU6oBCEtiTkpDoPGuS8N+PVfUxhegf2O9I7d K1/YnIlaAooLSa8vR3/OKzlwLhHRQbxJP+axd/DjwHY3WqvtRpbOWe7NpXv9rwPAUXw5 8oSHt2gJU4akGTncpzn5icbma+sd+cyAsioBT06f2ZuRb6JxtsG5KxzP3U3TxkFMyn9O HgMCvzbolrSgx0+lXQk2OdjKOQuLDLKKIKs9ZWTvP36EBs/WuMoLS50/c1lBITwjW6Mg MivECpt0nnDAnJWljs35AcNm6fHVLWQ/5pZo4GJOoCeThh7xRS1tKbHMOdEwfypRrTW3 sQUw== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=7AiiEg4xJiOqmmYYjoxw79QoYQMGZfk7FrNe3RqLABM=; b=yBafPTUYfTYCnBZNGL7DndqChNDgtUGwzNgjVpsfWvBGh7RdqJDSZWb4dXqT/xhqDz tA3P7wD1MfkdTm2X2J/bKrMoVN/w65rBQPiAeFPuQWqo5FQRnJIT+bKlsQffh0bOtAbe nReOlEti0Okd9CDXFSmAe9U6cvSnOq87ho3SrPtAKXV6V2bMmS8+dPGHcm4Au+eetkRe oWsU2H3Qjpf5Xu/fD/vdbdL9GPHTxggZlwX/J/L51cIpvcA2V73nNUJqrraH4n+zKOa4 yloSeqvGzHaYcY+sOjG0uIT/Pw2ol5vo9b0N1aD8uXcA1BL76TGRmpZQ14TKwhYNoz0z r2mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AXdCSoED; 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 128si13299825qkd.55.2019.09.03.09.51.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 09:51:06 -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=AXdCSoED; 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]:49326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5C1J-0007IB-H9 for patch@linaro.org; Tue, 03 Sep 2019 12:51:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37449) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BND-0001fd-MJ for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5BNC-00040x-Cg for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:39 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:38881) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5BNC-000405-6n for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:38 -0400 Received: by mail-pf1-x42c.google.com with SMTP id h195so4519430pfe.5 for ; Tue, 03 Sep 2019 09:09:38 -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; bh=7AiiEg4xJiOqmmYYjoxw79QoYQMGZfk7FrNe3RqLABM=; b=AXdCSoED4045SCexaDvftDHizMTfRMOzM2xBMi29VKAzpIIA7iRVER8jpoIjNcZJBe hk4Jsi4/ob7oICO/dWc6NlMQu42qqXX7RzVlFqpsrGKClWrEYlrK6BLAIlDY64kXwNst sSTtji3LUfDFluySHvLRZhK2Up0sRfMoMM4K2Ps5EMpU5aCkclGYqNv7jyvcAKiMnQsT np9LFcm97chTCIB04tIkckLTtE9OnbBhwQk2urslYvhmOtO8P4ghuPFYPRmULmO+j7Tu cL8+EhmSkCfNWQFj3m431jR9fITOYnkVdYeMHJbU4P0mMT7CfC7CCRk3djnHSF6u5507 HVvw== 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; bh=7AiiEg4xJiOqmmYYjoxw79QoYQMGZfk7FrNe3RqLABM=; b=AS8p14hudP/pEt8nHU7sPe0c5BRCcpe/uy5DbygDV7xw/o+GEejLdx3osqMNZ1FqFx GzjuUAUs2GbKNIR58ItFx7ih6LN2rPhH36PRDcJmFdCG6RPs9Egyqjar1owxoSgawnWZ 7G38slujCfBcL0LCDQMhTle8enhb64NW7EAleifWU5ddgxwrFRaHHi3QqRtyetcfgMsc VxEIXeIXXWgsW4AzEpyT6czrrnkj3E1eHdg85MOGpqxx2pfrnhPOk4xpq0P/7ad+Hb5l 5nJ1Ojilk6WYR8LTw1/lvldkUWlJUWzL6/hUH6R0q5ID3o1lmFhzWBAdywougdTwmoOH AvzQ== X-Gm-Message-State: APjAAAUxUI5iGm8uOSk1hcjpCChLrAZkVTL59Dbe6bzNlPV4PUM3ssB/ d4ZC4Ng2so9Q+Wo8nOQ1/oBvj6skJec= X-Received: by 2002:a62:60c7:: with SMTP id u190mr41656514pfb.54.1567526976905; Tue, 03 Sep 2019 09:09:36 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 127sm28089711pfy.56.2019.09.03.09.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:09:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 09:08:52 -0700 Message-Id: <20190903160858.5296-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903160858.5296-1-richard.henderson@linaro.org> References: <20190903160858.5296-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42c Subject: [Qemu-devel] [PATCH 30/36] tcg: Factor out CONFIG_USER_ONLY probe_write() from s390x 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: peter.maydell@linaro.org, David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Factor it out into common code. Similar to the !CONFIG_USER_ONLY variant, let's not allow to cross page boundaries. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20190826075112.25637-4-david@redhat.com> [rth: Move cpu & cc variables inside if block.] Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 4 ++-- accel/tcg/user-exec.c | 14 ++++++++++++++ target/s390x/mem_helper.c | 7 ------- 3 files changed, 16 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 135aeaab0d..cbcc85add3 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -260,8 +260,6 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, void tlb_set_page(CPUState *cpu, target_ulong vaddr, hwaddr paddr, int prot, int mmu_idx, target_ulong size); -void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, - uintptr_t retaddr); #else static inline void tlb_init(CPUState *cpu) { @@ -312,6 +310,8 @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu, { } #endif +void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, + uintptr_t retaddr); #define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line */ diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 897d1571c4..86e6827201 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -188,6 +188,20 @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info, g_assert_not_reached(); } +void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx, + uintptr_t retaddr) +{ + if (!guest_addr_valid(addr) || + page_check_range(addr, size, PAGE_WRITE) < 0) { + CPUState *cpu = env_cpu(env); + CPUClass *cc = CPU_GET_CLASS(cpu); + + cc->tlb_fill(cpu, addr, size, MMU_DATA_STORE, MMU_USER_IDX, false, + retaddr); + g_assert_not_reached(); + } +} + #if defined(__i386__) #if defined(__NetBSD__) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 4b43440e89..fdff60ce5d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -2615,12 +2615,6 @@ uint32_t HELPER(cu42)(CPUS390XState *env, uint32_t r1, uint32_t r2, uint32_t m3) void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, uintptr_t ra) { -#ifdef CONFIG_USER_ONLY - if (!guest_addr_valid(addr) || !guest_addr_valid(addr + len - 1) || - page_check_range(addr, len, PAGE_WRITE) < 0) { - s390_program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO, ra); - } -#else /* test the actual access, not just any access to the page due to LAP */ while (len) { const uint64_t pagelen = -(addr | TARGET_PAGE_MASK); @@ -2630,7 +2624,6 @@ void probe_write_access(CPUS390XState *env, uint64_t addr, uint64_t len, addr = wrap_address(env, addr + curlen); len -= curlen; } -#endif } void HELPER(probe_write_access)(CPUS390XState *env, uint64_t addr, uint64_t len)