From patchwork Thu Nov 14 16:01:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 843155 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp365181wrc; Thu, 14 Nov 2024 08:10:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXHaHXgmAEm3nWAJg6i32bUbPSOWZWuYN1gbCHSo2XpykPaoGweGW17XOdvTMiCoJSQaN+sHw==@linaro.org X-Google-Smtp-Source: AGHT+IEYuPg38wH4e5ca+DKjjLKqU/RCSrwYZ2kUIvAkSf4E84Rp2xxbyVRXcb5fIsLjdL00mmCt X-Received: by 2002:a05:6122:8283:b0:50d:6cfc:ac4d with SMTP id 71dfb90a1353d-5146514242dmr4016275e0c.5.1731600652725; Thu, 14 Nov 2024 08:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731600652; cv=none; d=google.com; s=arc-20240605; b=bhKA7VvrHJYZOKROAkB+fo8MWUXdFGuCZGuSxk8sc7vn5OOnNaqjeswYSaxAa7kQDn G08WUSRzxh698TcjBDbZIXotxSqyWJ1QPPpUyeFK7c4o98DbnbBX3HAcAdKBa5Q1mW/k +9o9Vng5c7Hvf9n026ogykJngHirixoudzEedZ4HWD6FxWm171qQdLUH/hHlnrxYY5gu kAOU6J4aTdZ+gkhSninJ7bWFTf6j0pq/aCZOGQdvJougOWjEFn40bcZjZQao2z2INJOl 0UIh4LRG4snKbxB28FBxKIlI+B5vNTyVTE/shOK8Jfy6cVV/jQHG4QNp0VUoy5kqekt/ Uegw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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=/iKuhhsqlR0EuYEh+MzJkcjXdpnBDTTasC9nFU82FI0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=ZYOKg5ccPHrhGauV5f06RI0+zQ8a8Ko8fXp+p/Ku2/hOpYlRC2kZ9kDa4n5EzwLqlL 14A0FyUnmAQft9x3zjqKLMiyhM37jpjoHQ2mKZ9r6R/3UdhfM1ttZ+Lo3a2GFlwsdIUM RYgO7wiWA46BH0rgugTSUgtgSfZeUWINbz/FV74ZTjjhmd/kQN8GMgVLii13KjLpMzwY 3M6IHwtt2wB+Q4TavA/TkrtCsm3OmVMcHYuoL+2KUcfwmyElcciF0tZ8m6/xTBcayjYm 8CrO4Bi3Tof6YpqTo2OCHkJMye6qSn7QFPUpBooBuuCV5A/MuhF6K0VC6XLmF44vGI4h Z6jA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHW9UMAK; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-5146af9ac83si447243e0c.178.2024.11.14.08.10.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 08:10:52 -0800 (PST) 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=GHW9UMAK; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBcNJ-0003lS-Et; Thu, 14 Nov 2024 11:07:17 -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 1tBcLQ-0001mE-UB for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:05:27 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBcLO-00036L-9s for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:05:20 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-71e681bc315so597778b3a.0 for ; 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=1731600315; x=1732205115; 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=/iKuhhsqlR0EuYEh+MzJkcjXdpnBDTTasC9nFU82FI0=; b=GHW9UMAK3ncz9iOPZ/c7Cn+L/0cTqVzgbQ3pJHQ25HdofRMzr79EY69TN84A+J+0vm XTOHFd+bkF6XzQ5sbLvIq9xzPjXRoNvyzct59Jlxlyu+BACLUaXFBpy06+63b3IevLh/ ox8v6XPCW1UXd2r0teyFhE6S1lYkWvCVNG/gSeVqDRpuEb9P3DySJYYnT4OBOsIdalsT xUMuLf/EoZBW6XseLaKyFpc3fZAu6oWVOJNGXkJMoMf1O+4zk7LHWPlsOXTnp4ffHwkV pV2f8Svr/lX/UBQ8DBXREmV/I0kxnIfiBIPakuJZKWvkcEZOoimGWuMqZXXeTBx8razC ce+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731600315; x=1732205115; 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=/iKuhhsqlR0EuYEh+MzJkcjXdpnBDTTasC9nFU82FI0=; b=bAOk9aE6BA6YvgJqaD/W5+rKDjVkSUUHSnuKPRkupd79cKQEIDVNbSyQ3Aam2Oqle/ +QaPcmSBWDncmj2tryoOxdWyjJzyIGoonU5hnZCE3vR/0Jass7uVZi6Zit7OG/NV65g1 HP4yYX9Ve43wGt0Mxl3FZ6/rA1HRQ5DBRtqNY/zvZDUOEvMp16EWQxLMNGlgMASBEIwB zJ99u4MJkzUQksajcHuDUL9JWfrMqi6UgDUYPAjgtvOa321ZsfZKPX1M7O5XA+/14AJq dRY2EzLnHsWZQ8247pbA/oRXh3tF06VYXAVSs1WRCMd3XfJExAUOtTGIPhzue5DP8CGo JoAA== X-Gm-Message-State: AOJu0YwD5DGnycTU5wlD5np3aNOc21q6Kpe17ODNj8Kfa+Dji/Yo36Wg l0bzErJ7FNLSxVmg7hwhKT8QykdzprA0T4KlnYNoOIcrJlaeatmPqZl1jsb4GXGh49F2qZ3NyAp m X-Received: by 2002:a05:6a00:3bf4:b0:724:6804:d663 with SMTP id d2e1a72fcca58-7246804d6ddmr4556490b3a.1.1731600314704; Thu, 14 Nov 2024 08:05:14 -0800 (PST) Received: from stoup.. ([71.212.136.242]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7246a9bab70sm1417926b3a.152.2024.11.14.08.05.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 08:05:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 47/54] target/sh4: Convert to TCGCPUOps.tlb_fill_align Date: Thu, 14 Nov 2024 08:01:23 -0800 Message-ID: <20241114160131.48616-48-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/sh4/cpu.h | 8 +++++--- target/sh4/cpu.c | 2 +- target/sh4/helper.c | 24 +++++++++++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index d928bcf006..161efdefcf 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -22,6 +22,7 @@ #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "exec/memop.h" #include "qemu/cpu-float.h" /* CPU Subtypes */ @@ -251,9 +252,10 @@ void sh4_translate_init(void); #if !defined(CONFIG_USER_ONLY) hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); -bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); +bool superh_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 superh_cpu_do_interrupt(CPUState *cpu); bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req); void cpu_sh4_invalidate_tlb(CPUSH4State *s); diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 8f07261dcf..8ca8b90e3c 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -252,7 +252,7 @@ static const TCGCPUOps superh_tcg_ops = { .restore_state_to_opc = superh_restore_state_to_opc, #ifndef CONFIG_USER_ONLY - .tlb_fill = superh_cpu_tlb_fill, + .tlb_fill_align = superh_cpu_tlb_fill_align, .cpu_exec_interrupt = superh_cpu_exec_interrupt, .cpu_exec_halt = superh_cpu_has_work, .do_interrupt = superh_cpu_do_interrupt, diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 9659c69550..543ac1b843 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -792,22 +792,32 @@ bool superh_cpu_exec_interrupt(CPUState *cs, int interrupt_request) return false; } -bool superh_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool superh_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) { CPUSH4State *env = cpu_env(cs); int ret; - target_ulong physical; int prot; + if (address & ((1 << memop_alignment_bits(memop)) - 1)) { + if (probe) { + return false; + } + superh_cpu_do_unaligned_access(cs, address, access_type, + mmu_idx, retaddr); + } + ret = get_physical_address(env, &physical, &prot, address, access_type); if (ret == MMU_OK) { - address &= TARGET_PAGE_MASK; - physical &= TARGET_PAGE_MASK; - tlb_set_page(cs, address, physical, prot, mmu_idx, TARGET_PAGE_SIZE); + memset(out, 0, sizeof(*out)); + out->phys_addr = physical; + out->prot = prot; + out->lg_page_size = TARGET_PAGE_BITS; + out->attrs = MEMTXATTRS_UNSPECIFIED; return true; } if (probe) {