From nobody Sat Nov 23 19:22:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731600827; cv=none; d=zohomail.com; s=zohoarc; b=YYciuVzyPVJumBTwHwMp/aeOGoT0kjcfh8H9TMEhyGm+90URmyYSiziX9yCJImZjrCF2pO/lQ2BHqeGxoGRqeixIY1KodQlBAbbSpxKZBSdUKNrdvYkJdbZDsQxeEfwoou53+LuwgdO6pJoIsjkJNyioQ+3DT1eyq/dwHB2/tew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731600827; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=Bj/Re7YaCahV1M4/AVlcGxlPUjwCTTqNcJS3jvHiVnM=; b=YUbHXUKBCcyqO65styM4/qz24b+8IVQv01heUMBQG5tAeAHtHlFnbe0sXCnb5b9RsyMI93dhhyNgrCDeWD1B0lDERm+sxZH4GesGhZBWEfZ7cAkuQuKL1RMVPlHbR6NtEEe+etZ8CDIKD5cCOzKIEbDhYoZA8OOtlAUJbJrs9oU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173160082744337.71139255648484; Thu, 14 Nov 2024 08:13:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBcO7-0004tS-BL; Thu, 14 Nov 2024 11:08:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBcLS-0001mS-M9 for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:05:27 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBcLO-00036c-Rd for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:05:21 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-724455f40a0so576984b3a.0 for ; Thu, 14 Nov 2024 08:05:18 -0800 (PST) Received: from stoup.. ([71.212.136.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7246a9bab70sm1417926b3a.152.2024.11.14.08.05.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 08:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731600317; x=1732205117; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Bj/Re7YaCahV1M4/AVlcGxlPUjwCTTqNcJS3jvHiVnM=; b=sm79gGcY8d7R9U9YKWSOalv1jMZv7UuBvgPq7cdJ6da+g9NKr/UziNuCvqYSNH47hQ Srumo0PlGl/nla/gilPMRIM9t8Hw6wjsiaasmqa56T5oP/fWWrXxaDgw8jRzRsdEhpYz chkQwvqcaOdeXA1ZHsQLlbHd1b4Rs8Y9QRulNIFardDgZ1giQmgWH5TeEdREBlCFoWoW 5RTXRSDjWbJwN/A9HKPFvLr6MjpR+e2fu65zGAZQh9OYTT4HtIvLnM11+0lMTHIBtSka JddtHbtV0kVwKYbmQ970agVARjrNylphT6XkzRbTMKvEgQQ8VVCpfbI+4DJYCa/uUasj lcYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731600317; x=1732205117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bj/Re7YaCahV1M4/AVlcGxlPUjwCTTqNcJS3jvHiVnM=; b=ZquKvEDMMsg5ky/ObvffKmMpE4Y6MSYA1gQ4yiLTwr2djc2X2798/9WqZkUi39MTZA G4h46Bl6eJsiOZcSVCWVRPQgP3ewoJSPVm8EeBKaGIKZd3uaKV1YS0BKESBMkNhLd61q beECbKUQM4XmkiMOF6rFeYJ6RwTZZZXq6YOydlJRt11Z9OtX+YJLWsev75RMSNyzQs+x rU9lvabAgLkrnCUOcMz+IjH6nGcuefSjbmP/HggxvA5u9N8n6bGLO6TY/9z3G2Qas/lk etyZ5D64ZdeeC1MS+djDk9COnKmEsc3tEKhmryqNZIzVagSSPVVPIaqs9JcRyoILhU8K Z1BA== X-Gm-Message-State: AOJu0YwsbDmsJL2N09nu7UqGN31CfvQUEBdBzeRAepFPxziNiHWNscSR unQcw+OW8BVT/RE6WWn5RLArVaHGR1/L+7YNcA9uO9NRx1eJjTeJOKmIXNMnZsS5MaHRaqkdwaD 0 X-Google-Smtp-Source: AGHT+IHHzrlH5cH6Mf/qYJuZTB1/8Ct1LLnp88Scf1vNvjfLmK/5f02XQ1P2dX3PBcxmhrvvqlLEOg== X-Received: by 2002:aa7:88c9:0:b0:71e:592d:6fa9 with SMTP id d2e1a72fcca58-7241327b6a4mr30110491b3a.1.1731600317101; Thu, 14 Nov 2024 08:05:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 50/54] target/xtensa: Convert to TCGCPUOps.tlb_fill_align Date: Thu, 14 Nov 2024 08:01:26 -0800 Message-ID: <20241114160131.48616-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241114160131.48616-1-richard.henderson@linaro.org> References: <20241114160131.48616-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731600827766116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/xtensa/cpu.h | 8 +++++--- target/xtensa/cpu.c | 2 +- target/xtensa/helper.c | 28 ++++++++++++++++++++-------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 77e48eef19..68c3d90d41 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -31,6 +31,7 @@ #include "cpu-qom.h" #include "qemu/cpu-float.h" #include "exec/cpu-defs.h" +#include "exec/memop.h" #include "hw/clock.h" #include "xtensa-isa.h" =20 @@ -580,9 +581,10 @@ struct XtensaCPUClass { }; =20 #ifndef CONFIG_USER_ONLY -bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); +bool xtensa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, + vaddr addr, MMUAccessType access_type, + int mmu_idx, MemOp memop, int size, + bool probe, uintptr_t retaddr); void xtensa_cpu_do_interrupt(CPUState *cpu); bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request); void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr= addr, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 6f9039abae..3e4ec97e0e 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -232,7 +232,7 @@ static const TCGCPUOps xtensa_tcg_ops =3D { .restore_state_to_opc =3D xtensa_restore_state_to_opc, =20 #ifndef CONFIG_USER_ONLY - .tlb_fill =3D xtensa_cpu_tlb_fill, + .tlb_fill_align =3D xtensa_cpu_tlb_fill_align, .cpu_exec_interrupt =3D xtensa_cpu_exec_interrupt, .cpu_exec_halt =3D xtensa_cpu_has_work, .do_interrupt =3D xtensa_cpu_do_interrupt, diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index ca214b948a..69b0e661c8 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -261,15 +261,26 @@ void xtensa_cpu_do_unaligned_access(CPUState *cs, addr); } =20 -bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool xtensa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, + vaddr address, MMUAccessType access_type, + int mmu_idx, MemOp memop, int size, + bool probe, uintptr_t retaddr) { CPUXtensaState *env =3D cpu_env(cs); uint32_t paddr; uint32_t page_size; unsigned access; - int ret =3D xtensa_get_physical_addr(env, true, address, access_type, + int ret; + + if (address & ((1 << memop_alignment_bits(memop)) - 1)) { + if (probe) { + return false; + } + xtensa_cpu_do_unaligned_access(cs, address, access_type, + mmu_idx, retaddr); + } + + ret =3D xtensa_get_physical_addr(env, true, address, access_type, mmu_idx, &paddr, &page_size, &acces= s); =20 qemu_log_mask(CPU_LOG_MMU, "%s(%08" VADDR_PRIx @@ -277,10 +288,11 @@ bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address,= int size, __func__, address, access_type, mmu_idx, paddr, ret); =20 if (ret =3D=3D 0) { - tlb_set_page(cs, - address & TARGET_PAGE_MASK, - paddr & TARGET_PAGE_MASK, - access, mmu_idx, page_size); + memset(out, 0, sizeof(*out)); + out->phys_addr =3D paddr; + out->prot =3D access; + out->lg_page_size =3D ctz32(page_size); + out->attrs =3D MEMTXATTRS_UNSPECIFIED; return true; } else if (probe) { return false; --=20 2.43.0