From nobody Wed Nov 5 18:23:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496599205150238.134777903349; Sun, 4 Jun 2017 11:00:05 -0700 (PDT) Received: from localhost ([::1]:57932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZop-0005rJ-S6 for importer@patchew.org; Sun, 04 Jun 2017 14:00:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHZRj-0007sm-8S for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHZRi-0003eE-7a for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:11 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:34663) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHZRi-0003do-2H for qemu-devel@nongnu.org; Sun, 04 Jun 2017 13:36:10 -0400 Received: by mail-pf0-x243.google.com with SMTP id w69so18143717pfk.1 for ; Sun, 04 Jun 2017 10:36:09 -0700 (PDT) Received: from bigtime.ASUS (cpe-98-155-27-246.hawaii.res.rr.com. [98.155.27.246]) by smtp.gmail.com with ESMTPSA id j191sm52854419pgc.53.2017.06.04.10.36.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 10:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MzN6WgQr71L2/xXK27EE1KtDv4KAeHjvgEGGF0GV0Sw=; b=aeXv9N8y2OarIp72DMGGHnHtB7cmGcWe0E+f09GK+CoS2+6AStbZ5RSnOwlzEHjyfs k3VeTQHnB3erxbZyEW32kABeXTjjC52lJAGr0//eJ9Npm5QMl4ZydmQ85OxVSDa4pzSO bP595O7t6XFNkaWSd29Z2FefC0QyZzq0wZsv585gP/wHzH2edkWZwzfMsZrSbFFqJ5Yp plA8IgPjYihKry1rBUAXisD6RgPztxjSH0guqfR1RY8OWjJdhOdq/cxqhGhwmxTKprNl pUrK9BVr9E/Vh+D9+gQymzgZpM7BtW3o5r3cDBcj2bmA1EIPbJTVZKEIaDMWjuje55/g kORA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=MzN6WgQr71L2/xXK27EE1KtDv4KAeHjvgEGGF0GV0Sw=; b=qxonrPgSIUqbvYFk0kF/ciBz3qKm7VmwulISBvHvbUZ9099uSb0dWL+HbnbYOfy4/b Ov6LQBNMUBpPDBzoU0fcTJ45CGaN14kikyIMt7ytLICFGoPLHj3WOHOVkyjBbkJr8yIZ VQlh4PxW4/ccgS7Cz49VLbmdknoYFyfN+eNMI4HIOz8jQ245ACUl9+w16vApYVuzLsQV HIrBB48JTO0RzxjX23M1Tsxd+EtpVZFkeUG5vlAl4D8QJXBmEfVffc1Vrlc0mY+8+XIy jzi/UbO6dSMEac4oN5UTkJpa1RfcKQoYAdJt4WYpQTKyJBfQVXml79cbbQcYfhrT7KFB v42g== X-Gm-Message-State: AODbwcCLcKB7sy4ss7R3uWgE+VIY5HAndLsgtdBwvTiZfuyy2TSXmT8A yC04VDcssVpzggUeNHU= X-Received: by 10.98.3.133 with SMTP id 127mr16395611pfd.172.1496597769002; Sun, 04 Jun 2017 10:36:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 4 Jun 2017 10:34:41 -0700 Message-Id: <20170604173509.29684-42-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170604173509.29684-1-rth@twiddle.net> References: <20170604173509.29684-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PULL 41/69] target/s390x: remove some Linux assumptions from IPTE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aurelien Jarno Signed-off-by: Aurelien Jarno Message-Id: <20170531220129.27724-3-aurelien@aurel32.net> Signed-off-by: Richard Henderson --- target/s390x/cpu.h | 2 ++ target/s390x/mem_helper.c | 17 ++++++++++------- target/s390x/mmu_helper.c | 2 -- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index fdb2f50..a4d31df 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -1035,6 +1035,8 @@ struct sysib_322 { #define _SEGMENT_ENTRY_RO 0x200 /* page protection bit = */ #define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry = */ =20 +#define VADDR_PX 0xff000 /* page index bits = */ + #define _PAGE_RO 0x200 /* HW read-only bit */ #define _PAGE_INVALID 0x400 /* HW invalid bit */ #define _PAGE_RES0 0x800 /* bit must be zero */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index e35571e..0ebd65d 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -1073,19 +1073,22 @@ uint32_t HELPER(mvcp)(CPUS390XState *env, uint64_t = l, uint64_t a1, uint64_t a2) } =20 /* invalidate pte */ -void HELPER(ipte)(CPUS390XState *env, uint64_t pte_addr, uint64_t vaddr) +void HELPER(ipte)(CPUS390XState *env, uint64_t pto, uint64_t vaddr) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); uint64_t page =3D vaddr & TARGET_PAGE_MASK; - uint64_t pte =3D 0; + uint64_t pte_addr, pte; =20 /* XXX broadcast to other CPUs */ =20 - /* XXX Linux is nice enough to give us the exact pte address. - According to spec we'd have to find it out ourselves */ - /* XXX Linux is fine with overwriting the pte, the spec requires - us to only set the invalid bit */ - stq_phys(cs->as, pte_addr, pte | _PAGE_INVALID); + /* Compute the page table entry address */ + pte_addr =3D (pto & _SEGMENT_ENTRY_ORIGIN); + pte_addr +=3D (vaddr & _VADDR_PX) >> 9; + + /* Mark the page table entry as invalid */ + pte =3D ldq_phys(cs->as, pte_addr); + pte |=3D _PAGE_INVALID; + stq_phys(cs->as, pte_addr, pte); =20 /* XXX we exploit the fact that Linux passes the exact virtual address here - it's not obliged to! */ diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 31eb9ef..501e390 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -143,8 +143,6 @@ static int mmu_translate_pte(CPUS390XState *env, target= _ulong vaddr, return 0; } =20 -#define VADDR_PX 0xff000 /* Page index bits */ - /* Decode segment table entry */ static int mmu_translate_segment(CPUS390XState *env, target_ulong vaddr, uint64_t asc, uint64_t st_entry, --=20 2.9.4