From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDD6CC4338F for ; Fri, 20 Aug 2021 13:36:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F3B260560 for ; Fri, 20 Aug 2021 13:36:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3F3B260560 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mH4gv-0006hk-1K for qemu-devel@archiver.kernel.org; Fri, 20 Aug 2021 09:36:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH4gE-0005xl-KJ for qemu-devel@nongnu.org; Fri, 20 Aug 2021 09:35:32 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:46048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mH4gC-0006zl-DA for qemu-devel@nongnu.org; Fri, 20 Aug 2021 09:35:29 -0400 Received: by mail-ej1-x636.google.com with SMTP id e21so4417686ejz.12 for ; Fri, 20 Aug 2021 06:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JfFMVdk/O9doC8hwVkbP4x7afoOO3wRuiwMkaptdrBE=; b=lXNRrjyE1hGBpK4fxLyphXOhiFXGFDx1Rnrqt5xtLd//GTKn9U81BPIuaJBEXIREzV KgDKg5qX1oje8l5EPbawmVzaaCDbqErhmBh/8kDqemwon0J+n3QNCgzBhR5e/e+vPR/C Kevj+YK1enNIBAHLwIgo335WuqTOCS7vHFnGs47rcBsw6ck1J+mHG8m6Hbo9t+MpU3c+ 7z2pUcZCZuqWyG/tMyQEgOJMMQlvl+ej/98ueRNR6LOdC1kq47XVhXulsp4hq/x3+5e/ o2cXYXLedTWYTbqSs+9FKThMwqMTEYxLhGSUhGp0aKayauDMWDQ0Kjo6w9GNxPXeYz69 0/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JfFMVdk/O9doC8hwVkbP4x7afoOO3wRuiwMkaptdrBE=; b=sQeGy087e8Fnm6pF08qvgguostek9iOnAbW0PHtmwllbUeDPMAjJ5+hxPI31TOHEo4 ok1uC9Ycw7rm9vEhMpkCqIcYid8dAyT4LtywhkPunbrrpycbbF+KTO2nNgR2+O5eHoYE vLaAIlmW5wFB1Ngz+lHNMUz//9gvwMKzWxBUBvhsa+FqLjCQUaOD4MKI4GKxMAqkqzjj es9vP+F5Mq7cx3XKFpm+3KE5DC5Dbka/J6WdWmyYGiPHiCj0Vos+96KhOT7VdzgO3aXP Quk6hHfBKFWgxR3TtMjABm1ahLNyFQiABGqAlwfuYblOPNy964Bri9W7woxjsFIVPi+n 60ng== X-Gm-Message-State: AOAM530JPnBMbwdyUf6JlBEYkfVHg8dBZZKPc6m8ZNpANxzC5SLovm+0 LHd1S/CBOWSPKrXEG2WeAP5/1dspsUQI0ktx+5jAAg== X-Google-Smtp-Source: ABdhPJzZlxQaXyjEUuUDLDRQMDinSaujTxb8NZHSO/BCi6sMIvuLwUngWdKxbu9nlDZTyjUbRqq1uh06uwcVx3C3dw4= X-Received: by 2002:a17:906:a108:: with SMTP id t8mr21692939ejy.407.1629466524734; Fri, 20 Aug 2021 06:35:24 -0700 (PDT) MIME-Version: 1.0 References: <20210818212912.396794-1-richard.henderson@linaro.org> <20210818212912.396794-7-richard.henderson@linaro.org> In-Reply-To: <20210818212912.396794-7-richard.henderson@linaro.org> From: Peter Maydell Date: Fri, 20 Aug 2021 14:34:38 +0100 Message-ID: Subject: Re: [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu To: Richard Henderson Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=peter.maydell@linaro.org; helo=mail-ej1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: QEMU Developers Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, 18 Aug 2021 at 22:32, Richard Henderson wrote: > > From armv6, the architecture supports unaligned accesses. > All we need to do is perform the correct alignment check > in tcg_out_tlb_read and not use LDRD/STRD when the access > is not aligned. > > Signed-off-by: Richard Henderson > @@ -1578,27 +1576,32 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg addrlo, TCGReg addrhi, > > /* > * Check alignment, check comparators. > - * Do this in no more than 3 insns. Use MOVW for v7, if possible, > + * Do this in 2-4 insns. Use MOVW for v7, if possible, > * to reduce the number of sequential conditional instructions. > * Almost all guests have at least 4k pages, which means that we need > * to clear at least 9 bits even for an 8-byte memory, which means it > * isn't worth checking for an immediate operand for BIC. > */ > + /* For unaligned accesses, test the page of the last byte. */ > + t_addr = addrlo; > + if (a_mask < s_mask) { > + t_addr = TCG_REG_R0; > + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, t_addr, > + addrlo, s_mask - a_mask); > + } I don't understand what this comment means or why we're doing the addition. If we know we need to check eg whether the address is 2-aligned, why aren't we just checking whether it's 2-aligned ? Could you expand on the explanation a bit? thanks -- PMM