From patchwork Wed Aug 18 19:18:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 498943 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp976459jab; Wed, 18 Aug 2021 12:38:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZk7yxGD5ab2WjQe0fwylyq3opSnroMxZMTUfI4D/DgvXeNQJcmhvQKkSBBA50wxmS7Rkd X-Received: by 2002:ae9:ed53:: with SMTP id c80mr11538429qkg.402.1629315532381; Wed, 18 Aug 2021 12:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629315532; cv=none; d=google.com; s=arc-20160816; b=MIQX1+pcgGuOJM0hloMI/NVVcbHozI0nNsmKpOlgmRLmfef0Q+EMG18uTG/IQKsRaZ OJTyxUFToBf2cK4S4UKidoHJrdsLVCfQlcAVC2761B3EO1tT4rP47QkB4TWQfUefG6i6 bXs47qLbUGqRQI92uQI1ZtlGMiuWTPS+iLiCkRJVIENMDiMR2Uv+G+IZKbjNN/ehWVCe zZX9PM733x2krsXoAVdpAoT3qbgHrSv9Ln55DOKMeYFhiDpnO7PRcD4bA6Cd968mOScC fyPFCYtIzCRy3XeXD9EpJkJrvYcGRSMAPyf+D8bMQBWauAqwDb1ZEwUnfObr6jNxVkG5 ZsQA== 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=LEBOVW9O1dlBltQunJCEwMsScX5fXnJ/74StUxWznz4=; b=relICjYVygs4oZVFjqY5Oc271um1oTmuVtGljxstFSSsEBbhJUVfsAHvk6d2HuuhRp CHZQyKRC8QflkdnUq2cxIBsIPfh95iW3JKvcJHXJXKJKIwDUly70vrjxRAKNJDlxSmKH ahb8jD3FQYnJTdDPn7BHEeq9rUveA2HAaMdXUUaZHOV1ShDe95eQzJIIwj+W4afFMre/ CI/Sv/RP9SBa5bo/cz+AHBLljd4LtV9Ari0I1T7YX8NvgSDeRPRlyND32RWjvHsRW9Kf 2kfZqHaAacIwC5ZVWXh3pcdhKGMF0GirpDJnZyhvoAkCijUrvzKq/Lepi/7sqGvnLZ0R ZbMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vI/33+7C"; 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 n15si299162qkp.357.2021.08.18.12.38.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Aug 2021 12:38:52 -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="vI/33+7C"; 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]:39506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGROl-0007az-LO for patch@linaro.org; Wed, 18 Aug 2021 15:38:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGR6M-0000k0-Dc for qemu-devel@nongnu.org; Wed, 18 Aug 2021 15:19:52 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:38867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGR6K-00009i-NN for qemu-devel@nongnu.org; Wed, 18 Aug 2021 15:19:50 -0400 Received: by mail-pg1-x534.google.com with SMTP id w8so3308251pgf.5 for ; Wed, 18 Aug 2021 12:19:48 -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=LEBOVW9O1dlBltQunJCEwMsScX5fXnJ/74StUxWznz4=; b=vI/33+7Cidh3tYXuQV/ey5+ZPK/20bBumvcl8dWWac+C450GeI66i/XiSH2SeiykUI sOyWLIP3+EhqTntD/IwReC+ifYs8AUJPTiOHfMe/y7t4MsnO8CiERj1S3f29R//FsL8P jIq4Qn0bbKYawmgny6+r1+fLAkZ5d+0xJkyZggRmZzlNZdTA5kXSbeZ6zjCkQtf4JrH2 s4MYWzPyziARHPZpXc06xRXFf6EAdVZq4pCEANRwhzHe36lmAlKcwJ13c5UzQGbmeLTW PSXECzocOrZKpkzQdGFavaN94L6q08ld2TUY7S7tfM1uUaaSg4bH70v4qJYGStCDSh3B R8ZA== 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=LEBOVW9O1dlBltQunJCEwMsScX5fXnJ/74StUxWznz4=; b=oXc4F9VrL9WdWaboKVw8hYhMXZPduTChQc8pxRNRRXJCDpmMgVEk2g9KUxtNAqoMmw lrf3u72HhZGbdnronYIAJ0MLPGzQs8v3MyXUVuHoV+JEKwG0FqwYYZDdVqLoWATxE8/7 WsvFPtexYayYThP9dsTBVOGzhnBRiwDh3RK2LK7Tb/dJnvw1oVP1crETC1UpGKoVkQ// gvlgh7U7pDXYHSNGUFIWQAyzkirl/D+LYd58ttS+obzvWc6eJtN6NSxQ4Y5fO1hGefaY qfpbo/B3XU3I1Hc2YgCgixvRwZ0WkDqjo+S90HBq//sASOcf0Ft+UM3rSeR5UrxT0QW2 bq6w== X-Gm-Message-State: AOAM533koSkN8I87xOGDTGGagWDHmCPM2ya2vfVbDQNNl8YL2C26wLxW b+lWQ2wSJqxd4HpwkA1oMjkcUyfSEkf5EA== X-Received: by 2002:a05:6a00:2150:b029:399:711c:826f with SMTP id o16-20020a056a002150b0290399711c826fmr10792827pfk.14.1629314387467; Wed, 18 Aug 2021 12:19:47 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id a6sm524108pjs.40.2021.08.18.12.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 12:19:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 20/66] target/xtensa: Implement do_unaligned_access for user-only Date: Wed, 18 Aug 2021 09:18:34 -1000 Message-Id: <20210818191920.390759-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818191920.390759-1-richard.henderson@linaro.org> References: <20210818191920.390759-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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: Max Filippov , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Acked-by: Max Filippov Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 58ec3a0862..41816d91f6 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -195,11 +195,11 @@ static const struct TCGCPUOps xtensa_tcg_ops = { .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, .tlb_fill = xtensa_cpu_tlb_fill, .debug_excp_handler = xtensa_breakpoint_handler, + .do_unaligned_access = xtensa_cpu_do_unaligned_access, #ifndef CONFIG_USER_ONLY .do_interrupt = xtensa_cpu_do_interrupt, .do_transaction_failed = xtensa_cpu_do_transaction_failed, - .do_unaligned_access = xtensa_cpu_do_unaligned_access, #endif /* !CONFIG_USER_ONLY */ }; diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index f18ab383fd..a5296399c5 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -242,6 +242,21 @@ void xtensa_cpu_list(void) } } +void xtensa_cpu_do_unaligned_access(CPUState *cs, + vaddr addr, MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) +{ + XtensaCPU *cpu = XTENSA_CPU(cs); + CPUXtensaState *env = &cpu->env; + + assert(xtensa_option_enabled(env->config, + XTENSA_OPTION_UNALIGNED_EXCEPTION)); + cpu_restore_state(CPU(cpu), retaddr, true); + HELPER(exception_cause_vaddr)(env, + env->pc, LOAD_STORE_ALIGNMENT_CAUSE, + addr); +} + #ifdef CONFIG_USER_ONLY bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, @@ -263,21 +278,6 @@ bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, #else /* !CONFIG_USER_ONLY */ -void xtensa_cpu_do_unaligned_access(CPUState *cs, - vaddr addr, MMUAccessType access_type, - int mmu_idx, uintptr_t retaddr) -{ - XtensaCPU *cpu = XTENSA_CPU(cs); - CPUXtensaState *env = &cpu->env; - - assert(xtensa_option_enabled(env->config, - XTENSA_OPTION_UNALIGNED_EXCEPTION)); - cpu_restore_state(CPU(cpu), retaddr, true); - HELPER(exception_cause_vaddr)(env, - env->pc, LOAD_STORE_ALIGNMENT_CAUSE, - addr); -} - bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr)