From nobody Wed Oct 1 00:21:15 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548284588938219.79396912138964; Wed, 23 Jan 2019 15:03:08 -0800 (PST) Received: from localhost ([127.0.0.1]:43244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmRXl-0001Ul-RW for importer@patchew.org; Wed, 23 Jan 2019 18:02:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmRSy-0006EU-AE for qemu-devel@nongnu.org; Wed, 23 Jan 2019 17:57:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmRSl-0004LN-HV for qemu-devel@nongnu.org; Wed, 23 Jan 2019 17:57:43 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:33042) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gmRSl-0004BC-3Y for qemu-devel@nongnu.org; Wed, 23 Jan 2019 17:57:39 -0500 Received: by mail-pg1-x542.google.com with SMTP id z11so1765876pgu.0 for ; Wed, 23 Jan 2019 14:57:18 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id y9sm23858132pfi.74.2019.01.23.14.57.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Jan 2019 14:57:16 -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; bh=u1h6Y+1jeyggZCDYjdrFQDBu8S/E6FnZ3feRJf5H+uM=; b=VvEDyTbUP7hZA0BNgknITMAKGI2CfA1RhZPzIlOPa6CWZXT+i9N3vvrk8ga+JTiZAs hjNNsQjBV5RIIFSdzo7t4v2SsG7iry8hfY5PhtcNYxaDkD4TMkyxRhzdoh+/lItHbvH3 KFUEV3KTMrB3p1pdlACTPyhvbciz6ZBNA1y/g= 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=u1h6Y+1jeyggZCDYjdrFQDBu8S/E6FnZ3feRJf5H+uM=; b=Auv7DLZua7yPZKHcHH9lregHtrSPkoy3R77EmQ1xGKq5UwJoICje/bGjowwFe7HGQk x8JnbLa8eIvOgoJc1rZ9Mt78jizAsnkz5X1xCEdHmBnpw8f9Z63pAqdJ0KWfs8H+aTrn 7IL4lJugLmsKpZiQbC4huxwh3GV6DgiYXXITdBh7a03Ox8GwQIO30CO5QNw6ogkC+31d +jsLP50/GzpgfRoAXHU1mJj65SZn3ZLH3yDim7BIsgEJji2TISCXby5CTJrsBCDh+Wcl bJi6Adz5ZHZ80K5MO45SoJd8lRpjITLIV/2HtfCQr9saKlvBdMTYqoif+o1d+Ckzj3fi QfsA== X-Gm-Message-State: AJcUukdMQ2I3+ZO/ljKoWI6QDmnFzz/F7gKZoECAFlnghO1F12QQER2l ZiTVzRDo9dkbqJ9iAFHrlet4Dm0zw0A= X-Google-Smtp-Source: ALg8bN45dxQNoMQFPr3chMLNMMvpDG23RZ9LJzmRJOnTD9ZXOiYXfpDGc1uVtqN6PflDPY+zXgpluA== X-Received: by 2002:aa7:83c6:: with SMTP id j6mr3939855pfn.91.1548284236846; Wed, 23 Jan 2019 14:57:16 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 23 Jan 2019 14:56:59 -0800 Message-Id: <20190123225705.28963-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190123225705.28963-1-richard.henderson@linaro.org> References: <20190123225705.28963-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::542 Subject: [Qemu-devel] [PATCH 07/13] tcg/s390: enable dynamic TLB sizing 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: cota@braap.org, alex.bennee@linaro.org 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" Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.h | 2 +- tcg/s390/tcg-target.inc.c | 45 +++++++++++++++++---------------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index 394b545369..357528dd97 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -27,7 +27,7 @@ =20 #define TCG_TARGET_INSN_UNIT_SIZE 2 #define TCG_TARGET_TLB_DISPLACEMENT_BITS 19 -#define TCG_TARGET_IMPLEMENTS_DYN_TLB 0 +#define TCG_TARGET_IMPLEMENTS_DYN_TLB 1 =20 typedef enum TCGReg { TCG_REG_R0 =3D 0, diff --git a/tcg/s390/tcg-target.inc.c b/tcg/s390/tcg-target.inc.c index 39ecf609a1..7db90b3bae 100644 --- a/tcg/s390/tcg-target.inc.c +++ b/tcg/s390/tcg-target.inc.c @@ -1537,10 +1537,10 @@ static void tcg_out_qemu_st_direct(TCGContext *s, T= CGMemOp opc, TCGReg data, #if defined(CONFIG_SOFTMMU) #include "tcg-ldst.inc.c" =20 -/* We're expecting to use a 20-bit signed offset on the tlb memory ops. - Using the offset of the second entry in the last tlb table ensures - that we can index all of the elements of the first entry. */ -QEMU_BUILD_BUG_ON(offsetof(CPUArchState, tlb_table[NB_MMU_MODES - 1][1]) +/* We're expecting to use a 20-bit signed offset on the tlb memory ops. */ +QEMU_BUILD_BUG_ON(offsetof(CPUArchState, tlb_mask[NB_MMU_MODES - 1]) + > 0x7ffff); +QEMU_BUILD_BUG_ON(offsetof(CPUArchState, tlb_table[NB_MMU_MODES - 1]) > 0x7ffff); =20 /* Load and compare a TLB entry, leaving the flags set. Loads the TLB @@ -1552,48 +1552,41 @@ static TCGReg tcg_out_tlb_read(TCGContext* s, TCGRe= g addr_reg, TCGMemOp opc, unsigned a_bits =3D get_alignment_bits(opc); unsigned s_mask =3D (1 << s_bits) - 1; unsigned a_mask =3D (1 << a_bits) - 1; + int mask_off =3D offsetof(CPUArchState, tlb_mask[mem_index]); + int table_off =3D offsetof(CPUArchState, tlb_table[mem_index]); int ofs, a_off; uint64_t tlb_mask; =20 + tcg_out_sh64(s, RSY_SRLG, TCG_REG_R2, addr_reg, TCG_REG_NONE, + TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); + tcg_out_insn(s, RXY, NG, TCG_REG_R2, TCG_AREG0, TCG_REG_NONE, mask_off= ); + tcg_out_insn(s, RXY, AG, TCG_REG_R2, TCG_AREG0, TCG_REG_NONE, table_of= f); + /* For aligned accesses, we check the first byte and include the align= ment bits within the address. For unaligned access, we check that we do= n't cross pages using the address of the last byte of the access. */ a_off =3D (a_bits >=3D s_bits ? 0 : s_mask - a_mask); tlb_mask =3D (uint64_t)TARGET_PAGE_MASK | a_mask; - - if (s390_facilities & FACILITY_GEN_INST_EXT) { - tcg_out_risbg(s, TCG_REG_R2, addr_reg, - 64 - CPU_TLB_BITS - CPU_TLB_ENTRY_BITS, - 63 - CPU_TLB_ENTRY_BITS, - 64 + CPU_TLB_ENTRY_BITS - TARGET_PAGE_BITS, 1); - if (a_off) { - tcg_out_insn(s, RX, LA, TCG_REG_R3, addr_reg, TCG_REG_NONE, a_= off); - tgen_andi(s, TCG_TYPE_TL, TCG_REG_R3, tlb_mask); - } else { - tgen_andi_risbg(s, TCG_REG_R3, addr_reg, tlb_mask); - } + if ((s390_facilities & FACILITY_GEN_INST_EXT) && a_off =3D=3D 0) { + tgen_andi_risbg(s, TCG_REG_R3, addr_reg, tlb_mask); } else { - tcg_out_sh64(s, RSY_SRLG, TCG_REG_R2, addr_reg, TCG_REG_NONE, - TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); tcg_out_insn(s, RX, LA, TCG_REG_R3, addr_reg, TCG_REG_NONE, a_off); - tgen_andi(s, TCG_TYPE_I64, TCG_REG_R2, - (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS); tgen_andi(s, TCG_TYPE_TL, TCG_REG_R3, tlb_mask); } =20 if (is_ld) { - ofs =3D offsetof(CPUArchState, tlb_table[mem_index][0].addr_read); + ofs =3D offsetof(CPUTLBEntry, addr_read); } else { - ofs =3D offsetof(CPUArchState, tlb_table[mem_index][0].addr_write); + ofs =3D offsetof(CPUTLBEntry, addr_write); } if (TARGET_LONG_BITS =3D=3D 32) { - tcg_out_mem(s, RX_C, RXY_CY, TCG_REG_R3, TCG_REG_R2, TCG_AREG0, of= s); + tcg_out_insn(s, RX, C, TCG_REG_R3, TCG_REG_R2, TCG_REG_NONE, ofs); } else { - tcg_out_mem(s, 0, RXY_CG, TCG_REG_R3, TCG_REG_R2, TCG_AREG0, ofs); + tcg_out_insn(s, RXY, CG, TCG_REG_R3, TCG_REG_R2, TCG_REG_NONE, ofs= ); } =20 - ofs =3D offsetof(CPUArchState, tlb_table[mem_index][0].addend); - tcg_out_mem(s, 0, RXY_LG, TCG_REG_R2, TCG_REG_R2, TCG_AREG0, ofs); + tcg_out_insn(s, RXY, LG, TCG_REG_R2, TCG_REG_R2, TCG_REG_NONE, + offsetof(CPUTLBEntry, addend)); =20 if (TARGET_LONG_BITS =3D=3D 32) { tgen_ext32u(s, TCG_REG_R3, addr_reg); --=20 2.17.2