From nobody Sat Apr 5 01:21:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1567529515; cv=none; d=zoho.com; s=zohoarc; b=IToP5uf+YSxIalPNaQPTAp4wRxc4J2QG3WwTyI3S92f0uuE9m0l6Kt5kboRH5wnFVF0UeAMwTHpkJSf7Jb3Mr0JI8/mLqEMDGgZQhAjTQbsCC8uDJ7JfRntPMCzyt0TMQ5X9xcNrR2sO60njOg5ScwoVPP1Wt7WJ2EwL2mHwfiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567529515; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7AiiEg4xJiOqmmYYjoxw79QoYQMGZfk7FrNe3RqLABM=; b=Mu5n9RPWBVyzx1/Luitsr0xkeA4i9CGteE2gbh0QL6JMvzKOM/p49l66zRWJ+kNYf80FyLDP68zSD2w8MLXqhWg0Nqd8orz5hfpX68nrHNyl6O+/3rLhNofLpZKz88kdPmnYah56+meur+dr3ub2++BK7WAzS0FAb5END1hgXuw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567529515150440.52040558832766; Tue, 3 Sep 2019 09:51:55 -0700 (PDT) Received: from localhost ([::1]:49358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5C25-0008Ev-UX for importer@patchew.org; Tue, 03 Sep 2019 12:51:53 -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) 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) 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-Google-Smtp-Source: APXvYqwk+STxX87GZZBa0ONUSTcIxO0BCnF6D1jPi89kUaMUJxpXXMaAEol9j4eRnkEkY35XP0OTRg== X-Received: by 2002:a62:60c7:: with SMTP id u190mr41656514pfb.54.1567526976905; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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(-) 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_ulon= g 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_i= dx, - 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_i= dx, + uintptr_t retaddr); =20 #define CODE_GEN_ALIGN 16 /* must be >=3D of the size of a icach= e line */ =20 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, sigi= nfo_t *info, g_assert_not_reached(); } =20 +void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_i= dx, + uintptr_t retaddr) +{ + if (!guest_addr_valid(addr) || + page_check_range(addr, size, PAGE_WRITE) < 0) { + CPUState *cpu =3D env_cpu(env); + CPUClass *cc =3D 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__) =20 #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 r= 1, 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 =3D -(addr | TARGET_PAGE_MASK); @@ -2630,7 +2624,6 @@ void probe_write_access(CPUS390XState *env, uint64_t = addr, uint64_t len, addr =3D wrap_address(env, addr + curlen); len -=3D curlen; } -#endif } =20 void HELPER(probe_write_access)(CPUS390XState *env, uint64_t addr, uint64_= t len) --=20 2.17.1