From patchwork Tue Aug 3 04:13:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 490839 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp306326jap; Mon, 2 Aug 2021 21:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAj8CTI3BwsxtQvbn3xIC1lRTmegUP3BVjYYq3DN5mX847mTTZnFj4Tv3RTKd+YuoWsqpH X-Received: by 2002:a05:6e02:106d:: with SMTP id q13mr336780ilj.164.1627964240474; Mon, 02 Aug 2021 21:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627964240; cv=none; d=google.com; s=arc-20160816; b=MgwCVJpa9cq23uNAy+IR2zhpsTUWqKc2cRkdlDSAFcvxoWXeytFBGnGj1NOSEPiNsV xSK8slPsy2kmFu35mCQ1VRm/Mn6ogsqU84IYV0RFHxi+G2Rox6s1Iyuswx/Af9AwkK0I wREWwGWwCzI8x0WOwaptJn5ncDxSkfb6aNXTbU8/uwsjoIbfOyhq+5924fO9Krguf/R6 BmA/1Xxk9MOvM0Wr9OnYqdodb7677QL1+ptPYGZu8UGF+o/vFlNiv7BkJDkLXjUQcKWu L9CfzxclNEzfhS8aIj2Rteszs8S7T1j9pmcjPfZc+AzsjwWaso8HMI+7ylkMcauS1UWT F4OQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7BoflvIiTr+DU42vLyiBwzCwJSFt/BgPyqtUymU6fAw=; b=Ko9wKh/vs7Vzt/a85HbII/V2bj5xvQRReQFhyzltokDimz/PzRTV9n8J4ydTba/4oS 5RoF7/zwsSrFOOnmA580RM0gbCux70oUGLlitsdqjh0ubaXtgLct1K+IjcIf2YcIJJ9R 9JxcK9dPqh5xk5WE1eGkgi1AnOUug5rtLrWCPbxzjChOngSAFFQvX+kQXhlApPiUeiWW +jj8oatH+XdpBcX3A71TWdIO/6TKLy/sEUEGSaqWop1n7miAQoeiCFomKThae++eT3io v0qMKcVMIAxDRZANqqCB9oBdCsv9wzO9B5+6NAKqhU90QBnN3xywIr1y3darUQ/CWGmh nb+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7Tt0s21; 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=pass (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 187si14707489iow.86.2021.08.02.21.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 21:17:20 -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=pass header.i=@linaro.org header.s=google header.b=V7Tt0s21; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAlrj-0008HB-TS for patch@linaro.org; Tue, 03 Aug 2021 00:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAlpP-0002Z7-SF for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:14:55 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:37506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAlpO-00022X-9H for qemu-devel@nongnu.org; Tue, 03 Aug 2021 00:14:55 -0400 Received: by mail-pl1-x62b.google.com with SMTP id j3so7041480plx.4 for ; Mon, 02 Aug 2021 21:14:53 -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 :mime-version:content-transfer-encoding; bh=7BoflvIiTr+DU42vLyiBwzCwJSFt/BgPyqtUymU6fAw=; b=V7Tt0s21VAIBYaHH+80pWxF12LMv3C3S7TRjH2gha3nsvvWDtqoom5fXQu7WI1cVO5 JV5F5FLO7JBj8E7SfEgcKpiYRyUJTdMTUnIPQ8krwCCEhPolEUZ+u8cIrSdnMvcbSdTG 2ku+xrnfclVTAKUdVdUeiKUnQRJSMZ48iwAvnU10s+f0F+XJTH1ywS3+Kk89IfMYV8Mu oXgFsWBqHoqK32PXCUP4LDDq0+48XBYmG572xv/3587z2XoVoK5IeuI5366wnnJh5ygC f8n0+6T5J0HaVcA70uihIl4zPYqbxhtZOKND3ZqGmVPAKQUpfvlISsG00o8lBKn4FBeW o+hg== 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:mime-version:content-transfer-encoding; bh=7BoflvIiTr+DU42vLyiBwzCwJSFt/BgPyqtUymU6fAw=; b=GFwEHrbD2m8bteNmP9UVMLJaNfr7QavfPLOmJ64reLoY/hku0KLpMSsvfxmiXFrqMS sFM8BOYxw4+xDIK8KVq1Jjf4jyleKPsFyYZ2j272ykN8MO0kKAdD/6xYUYBjCb679otw rcoDXEqlSNPlgsXkRU3Xqjdyo7/Vy0UFbyjNi1UHnJFwSpIXvNtAZceKG7b9TfIH7MyB nKybNpg2YwjFmkunIBgVSrDYYTY4T7P/sPIpXAYUliBo8cYVygCnlbnOzHuSrhEQnZeN NWDaXCPwVSNf2tx3Z0dQtgjo3wy2P3+7YbptlcaihY2/OyezUm/lSDWcPJNgAhnIFE1x n1uQ== X-Gm-Message-State: AOAM53381jv/3fWZtRputH3RCEwiJeVJQR2dJnqv3vUkqcNLh7shYR2N esqDhQAPSu2P7czB6o9KrGESF53i8G4Atw== X-Received: by 2002:a65:63c1:: with SMTP id n1mr1326207pgv.398.1627964093018; Mon, 02 Aug 2021 21:14:53 -0700 (PDT) Received: from localhost.localdomain (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id c23sm13718532pfn.140.2021.08.02.21.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 21:14:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/55] target/microblaze: Do not set MO_ALIGN for user-only Date: Mon, 2 Aug 2021 18:13:54 -1000 Message-Id: <20210803041443.55452-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210803041443.55452-1-richard.henderson@linaro.org> References: <20210803041443.55452-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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: "Edgar E . Iglesias" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The kernel will fix up unaligned accesses, so emulate that by allowing unaligned accesses to succeed. Cc: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.25.1 Reviewed-by: Edgar E. Iglesias diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index a14ffed784..ef44bca2fd 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -727,6 +727,7 @@ static TCGv compute_ldst_addr_ea(DisasContext *dc, int ra, int rb) } #endif +#ifndef CONFIG_USER_ONLY static void record_unaligned_ess(DisasContext *dc, int rd, MemOp size, bool store) { @@ -739,6 +740,7 @@ static void record_unaligned_ess(DisasContext *dc, int rd, tcg_set_insn_start_param(dc->insn_start, 1, iflags); } +#endif static bool do_load(DisasContext *dc, int rd, TCGv addr, MemOp mop, int mem_index, bool rev) @@ -760,12 +762,19 @@ static bool do_load(DisasContext *dc, int rd, TCGv addr, MemOp mop, } } + /* + * For system mode, enforce alignment if the cpu configuration + * requires it. For user-mode, the Linux kernel will have fixed up + * any unaligned access, so emulate that by *not* setting MO_ALIGN. + */ +#ifndef CONFIG_USER_ONLY if (size > MO_8 && (dc->tb_flags & MSR_EE) && dc->cfg->unaligned_exceptions) { record_unaligned_ess(dc, rd, size, false); mop |= MO_ALIGN; } +#endif tcg_gen_qemu_ld_i32(reg_for_write(dc, rd), addr, mem_index, mop); @@ -906,12 +915,19 @@ static bool do_store(DisasContext *dc, int rd, TCGv addr, MemOp mop, } } + /* + * For system mode, enforce alignment if the cpu configuration + * requires it. For user-mode, the Linux kernel will have fixed up + * any unaligned access, so emulate that by *not* setting MO_ALIGN. + */ +#ifndef CONFIG_USER_ONLY if (size > MO_8 && (dc->tb_flags & MSR_EE) && dc->cfg->unaligned_exceptions) { record_unaligned_ess(dc, rd, size, true); mop |= MO_ALIGN; } +#endif tcg_gen_qemu_st_i32(reg_for_read(dc, rd), addr, mem_index, mop);