From patchwork Mon Sep 5 20:22:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602753 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3956321mae; Mon, 5 Sep 2022 13:24:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR61B4OUE5JwfE2UIiCWlLYu/HfZ72LQs53I38ZDuTGpWCHnO8kI490NhD3zN5t7Un6vS5j/ X-Received: by 2002:ac8:7f12:0:b0:344:799f:262 with SMTP id f18-20020ac87f12000000b00344799f0262mr41000212qtk.39.1662409488721; Mon, 05 Sep 2022 13:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409488; cv=none; d=google.com; s=arc-20160816; b=DZEAJDvO45oouJYaDPJgfEGyF4P+o9srwhDLO/KLR4L8+j6MdO7fKXqPGG0WjsJXSw mKW5WcPobN7HLUepYgoancIMkk3i7f3STC30jpbnHjQYZqvxdOERla1MdzTzpeMHrcTu 4mB+5Cwn3cAcRwhaxhNoCQ18D3C4kYLeh48JE5N0HzKwfIi6QdEggusDfjQjC+zt7FEw g4SYRXkW7ItBIHemyegzWkCxNGiEtFgwyFyeEjAzXyoegMFKMwZd9q1H/3dmTEhgfCa+ yZQHdhNf78F8gKTWuXjQNkQ0BR8+h6ZdF/dybqmsGw5ArtyyHGFBP9sRDI4TRxugPAnE NLqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=uv3AmsfqaiBxFKrD6o7IKN/LvALHRiu6GeaMCqWYFMA=; b=JKOD7Wd8E3g9VhnmtrD3Lb6XZp1exclLTBnWTxe2iuz7otLaW5Y/0wbgNQsZ83Q30H AVaprsgo3fLxsKbA0ihOwH3dyAzxpG6BJkFbWqDgvS4/VhtOZHNgXrlj5OIToSwdxZia CxYCJwPfl8JcXvFwiKdwGdHkFMjr9O4JA5ufLXF0gpCD2KDhZoFE17vPV3KVGSz0d1fk jVty8ELhlNUTOjWIsRc3RAuKqddvWkbINnXiRN9wJux4AM7KJpUwhkhRAQVv4/06NbUD 14ITb8JtZHuK9f6XC7evXaRMmI8iGXz1FAAEBEjDFolSWlEoKglbu2xegtMFlIbNUdAa Xlow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SFi3qY45; 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 gd9-20020a05622a5c0900b0034e100281fesi4492334qtb.91.2022.09.05.13.24.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:24:48 -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=SFi3qY45; 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]:58294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIeG-0007tW-7n for patch@linaro.org; Mon, 05 Sep 2022 16:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIch-00078n-EG for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:11 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:46957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIca-0004X7-Hl for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:11 -0400 Received: by mail-wm1-x336.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so6242807wms.5 for ; Mon, 05 Sep 2022 13:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=uv3AmsfqaiBxFKrD6o7IKN/LvALHRiu6GeaMCqWYFMA=; b=SFi3qY45XtIK+t7d/qdNmgjibWLyAxU7eBfpRWCZws3MoOuIz//f2dR+LFv6gcRcwC YMCqMW7BOzh/VdFLZa8m3G+shhZ0xG4f9C8Pd1RNGMSIEizLEfSlOuJzwcrj+dWp6qKZ gfRO05sXOuIkG3qG7uZExW12fZN8gk5HvO5fecgYhCTh45/SRfFPwY6bhd5vtGh/HfvL ou1MrPnwUvqeqWBkmjjTNC3shGHgWS+ghPxasrAn87TenW5yYpmHUHs/cLWvPBonYD9+ l+r3HxWXeB1ZTGwkoEbguHgfuaKklyhGdRZ2mHmH9gbd8D4qBpC+9ji8QJq252wuvABv McOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=uv3AmsfqaiBxFKrD6o7IKN/LvALHRiu6GeaMCqWYFMA=; b=J5oyEpjYTALLDOwKfPAp0SCrAtYzLkIqElVIc+Xd63wR2TKPJrE69Qa16n/5kWTWU5 ZLbaMbHdg0huGB6CoTkP9PWirg31pQOGpupsJwVDkCa1Xi8sy7SX0T3+/QFbibVdbrrW pLJlYj1Bf4IB7U/yX/Yjv7mkPrXg2v1qtnq2JFQJWhGO+LvlRUX6IEdSxKUximxM4xFs peXhJA0EByuGgo6t+6Tm3/h6xzAKpHEtrKVpb8tJQmdLjxbAaOLBgIurfvk45p/Oz4TD jR8rUs/P9loC3aJZepg4280A2TtVXHGkEfxrfku8DTiSnFVVrOqJfniEj0IOJgcMPGpN 3gaQ== X-Gm-Message-State: ACgBeo13ICjpjjWiPuMrysWUQWvkRzzhf2AsSf/k1mD/UoMphe44ZHv1 Zdt6+8CX+rPzCE5xhTtQQXpOkL87IMIxokfE X-Received: by 2002:a05:600c:1593:b0:3a6:36fc:842f with SMTP id r19-20020a05600c159300b003a636fc842fmr11921924wmf.52.1662409382763; Mon, 05 Sep 2022 13:23:02 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com Subject: [PATCH v3 1/6] accel/tcg: Rename CPUIOTLBEntry to CPUTLBEntryFull Date: Mon, 5 Sep 2022 21:22:54 +0100 Message-Id: <20220905202259.189852-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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" This structure will shortly contain more than just data for accessing MMIO. Rename the 'addr' member to 'xlat_section' to more clearly indicate its purpose. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/exec/cpu-defs.h | 22 ++++---- accel/tcg/cputlb.c | 102 +++++++++++++++++++------------------ target/arm/mte_helper.c | 14 ++--- target/arm/sve_helper.c | 4 +- target/arm/translate-a64.c | 2 +- 5 files changed, 73 insertions(+), 71 deletions(-) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index ba3cd32a1e..f70f54d850 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -108,6 +108,7 @@ typedef uint64_t target_ulong; # endif # endif +/* Minimalized TLB entry for use by TCG fast path. */ typedef struct CPUTLBEntry { /* bit TARGET_LONG_BITS to TARGET_PAGE_BITS : virtual address bit TARGET_PAGE_BITS-1..4 : Nonzero for accesses that should not @@ -131,14 +132,14 @@ typedef struct CPUTLBEntry { QEMU_BUILD_BUG_ON(sizeof(CPUTLBEntry) != (1 << CPU_TLB_ENTRY_BITS)); -/* The IOTLB is not accessed directly inline by generated TCG code, - * so the CPUIOTLBEntry layout is not as critical as that of the - * CPUTLBEntry. (This is also why we don't want to combine the two - * structs into one.) +/* + * The full TLB entry, which is not accessed by generated TCG code, + * so the layout is not as critical as that of CPUTLBEntry. This is + * also why we don't want to combine the two structs. */ -typedef struct CPUIOTLBEntry { +typedef struct CPUTLBEntryFull { /* - * @addr contains: + * @xlat_section contains: * - in the lower TARGET_PAGE_BITS, a physical section number * - with the lower TARGET_PAGE_BITS masked off, an offset which * must be added to the virtual address to obtain: @@ -146,9 +147,9 @@ typedef struct CPUIOTLBEntry { * number is PHYS_SECTION_NOTDIRTY or PHYS_SECTION_ROM) * + the offset within the target MemoryRegion (otherwise) */ - hwaddr addr; + hwaddr xlat_section; MemTxAttrs attrs; -} CPUIOTLBEntry; +} CPUTLBEntryFull; /* * Data elements that are per MMU mode, minus the bits accessed by @@ -172,9 +173,8 @@ typedef struct CPUTLBDesc { size_t vindex; /* The tlb victim table, in two parts. */ CPUTLBEntry vtable[CPU_VTLB_SIZE]; - CPUIOTLBEntry viotlb[CPU_VTLB_SIZE]; - /* The iotlb. */ - CPUIOTLBEntry *iotlb; + CPUTLBEntryFull vfulltlb[CPU_VTLB_SIZE]; + CPUTLBEntryFull *fulltlb; } CPUTLBDesc; /* diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 8fad2d9b83..4585d7c015 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -200,13 +200,13 @@ static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast, } g_free(fast->table); - g_free(desc->iotlb); + g_free(desc->fulltlb); tlb_window_reset(desc, now, 0); /* desc->n_used_entries is cleared by the caller */ fast->mask = (new_size - 1) << CPU_TLB_ENTRY_BITS; fast->table = g_try_new(CPUTLBEntry, new_size); - desc->iotlb = g_try_new(CPUIOTLBEntry, new_size); + desc->fulltlb = g_try_new(CPUTLBEntryFull, new_size); /* * If the allocations fail, try smaller sizes. We just freed some @@ -215,7 +215,7 @@ static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast, * allocations to fail though, so we progressively reduce the allocation * size, aborting if we cannot even allocate the smallest TLB we support. */ - while (fast->table == NULL || desc->iotlb == NULL) { + while (fast->table == NULL || desc->fulltlb == NULL) { if (new_size == (1 << CPU_TLB_DYN_MIN_BITS)) { error_report("%s: %s", __func__, strerror(errno)); abort(); @@ -224,9 +224,9 @@ static void tlb_mmu_resize_locked(CPUTLBDesc *desc, CPUTLBDescFast *fast, fast->mask = (new_size - 1) << CPU_TLB_ENTRY_BITS; g_free(fast->table); - g_free(desc->iotlb); + g_free(desc->fulltlb); fast->table = g_try_new(CPUTLBEntry, new_size); - desc->iotlb = g_try_new(CPUIOTLBEntry, new_size); + desc->fulltlb = g_try_new(CPUTLBEntryFull, new_size); } } @@ -258,7 +258,7 @@ static void tlb_mmu_init(CPUTLBDesc *desc, CPUTLBDescFast *fast, int64_t now) desc->n_used_entries = 0; fast->mask = (n_entries - 1) << CPU_TLB_ENTRY_BITS; fast->table = g_new(CPUTLBEntry, n_entries); - desc->iotlb = g_new(CPUIOTLBEntry, n_entries); + desc->fulltlb = g_new(CPUTLBEntryFull, n_entries); tlb_mmu_flush_locked(desc, fast); } @@ -299,7 +299,7 @@ void tlb_destroy(CPUState *cpu) CPUTLBDescFast *fast = &env_tlb(env)->f[i]; g_free(fast->table); - g_free(desc->iotlb); + g_free(desc->fulltlb); } } @@ -1219,7 +1219,7 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, /* Evict the old entry into the victim tlb. */ copy_tlb_helper_locked(tv, te); - desc->viotlb[vidx] = desc->iotlb[index]; + desc->vfulltlb[vidx] = desc->fulltlb[index]; tlb_n_used_entries_dec(env, mmu_idx); } @@ -1236,8 +1236,8 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, * subtract here is that of the page base, and not the same as the * vaddr we add back in io_readx()/io_writex()/get_page_addr_code(). */ - desc->iotlb[index].addr = iotlb - vaddr_page; - desc->iotlb[index].attrs = attrs; + desc->fulltlb[index].xlat_section = iotlb - vaddr_page; + desc->fulltlb[index].attrs = attrs; /* Now calculate the new entry */ tn.addend = addend - vaddr_page; @@ -1329,7 +1329,7 @@ static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, } } -static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, +static uint64_t io_readx(CPUArchState *env, CPUTLBEntryFull *full, int mmu_idx, target_ulong addr, uintptr_t retaddr, MMUAccessType access_type, MemOp op) { @@ -1341,9 +1341,9 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, bool locked = false; MemTxResult r; - section = iotlb_to_section(cpu, iotlbentry->addr, iotlbentry->attrs); + section = iotlb_to_section(cpu, full->xlat_section, full->attrs); mr = section->mr; - mr_offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr; + mr_offset = (full->xlat_section & TARGET_PAGE_MASK) + addr; cpu->mem_io_pc = retaddr; if (!cpu->can_do_io) { cpu_io_recompile(cpu, retaddr); @@ -1353,14 +1353,14 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, qemu_mutex_lock_iothread(); locked = true; } - r = memory_region_dispatch_read(mr, mr_offset, &val, op, iotlbentry->attrs); + r = memory_region_dispatch_read(mr, mr_offset, &val, op, full->attrs); if (r != MEMTX_OK) { hwaddr physaddr = mr_offset + section->offset_within_address_space - section->offset_within_region; cpu_transaction_failed(cpu, physaddr, addr, memop_size(op), access_type, - mmu_idx, iotlbentry->attrs, r, retaddr); + mmu_idx, full->attrs, r, retaddr); } if (locked) { qemu_mutex_unlock_iothread(); @@ -1370,8 +1370,8 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, } /* - * Save a potentially trashed IOTLB entry for later lookup by plugin. - * This is read by tlb_plugin_lookup if the iotlb entry doesn't match + * Save a potentially trashed CPUTLBEntryFull for later lookup by plugin. + * This is read by tlb_plugin_lookup if the fulltlb entry doesn't match * because of the side effect of io_writex changing memory layout. */ static void save_iotlb_data(CPUState *cs, hwaddr addr, @@ -1385,7 +1385,7 @@ static void save_iotlb_data(CPUState *cs, hwaddr addr, #endif } -static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, +static void io_writex(CPUArchState *env, CPUTLBEntryFull *full, int mmu_idx, uint64_t val, target_ulong addr, uintptr_t retaddr, MemOp op) { @@ -1396,9 +1396,9 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, bool locked = false; MemTxResult r; - section = iotlb_to_section(cpu, iotlbentry->addr, iotlbentry->attrs); + section = iotlb_to_section(cpu, full->xlat_section, full->attrs); mr = section->mr; - mr_offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr; + mr_offset = (full->xlat_section & TARGET_PAGE_MASK) + addr; if (!cpu->can_do_io) { cpu_io_recompile(cpu, retaddr); } @@ -1408,20 +1408,20 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, * The memory_region_dispatch may trigger a flush/resize * so for plugins we save the iotlb_data just in case. */ - save_iotlb_data(cpu, iotlbentry->addr, section, mr_offset); + save_iotlb_data(cpu, full->xlat_section, section, mr_offset); if (!qemu_mutex_iothread_locked()) { qemu_mutex_lock_iothread(); locked = true; } - r = memory_region_dispatch_write(mr, mr_offset, val, op, iotlbentry->attrs); + r = memory_region_dispatch_write(mr, mr_offset, val, op, full->attrs); if (r != MEMTX_OK) { hwaddr physaddr = mr_offset + section->offset_within_address_space - section->offset_within_region; cpu_transaction_failed(cpu, physaddr, addr, memop_size(op), - MMU_DATA_STORE, mmu_idx, iotlbentry->attrs, r, + MMU_DATA_STORE, mmu_idx, full->attrs, r, retaddr); } if (locked) { @@ -1468,9 +1468,10 @@ static bool victim_tlb_hit(CPUArchState *env, size_t mmu_idx, size_t index, copy_tlb_helper_locked(vtlb, &tmptlb); qemu_spin_unlock(&env_tlb(env)->c.lock); - CPUIOTLBEntry tmpio, *io = &env_tlb(env)->d[mmu_idx].iotlb[index]; - CPUIOTLBEntry *vio = &env_tlb(env)->d[mmu_idx].viotlb[vidx]; - tmpio = *io; *io = *vio; *vio = tmpio; + CPUTLBEntryFull *f1 = &env_tlb(env)->d[mmu_idx].fulltlb[index]; + CPUTLBEntryFull *f2 = &env_tlb(env)->d[mmu_idx].vfulltlb[vidx]; + CPUTLBEntryFull tmpf; + tmpf = *f1; *f1 = *f2; *f2 = tmpf; return true; } } @@ -1483,9 +1484,9 @@ static bool victim_tlb_hit(CPUArchState *env, size_t mmu_idx, size_t index, (ADDR) & TARGET_PAGE_MASK) static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, - CPUIOTLBEntry *iotlbentry, uintptr_t retaddr) + CPUTLBEntryFull *full, uintptr_t retaddr) { - ram_addr_t ram_addr = mem_vaddr + iotlbentry->addr; + ram_addr_t ram_addr = mem_vaddr + full->xlat_section; trace_memory_notdirty_write_access(mem_vaddr, ram_addr, size); @@ -1578,9 +1579,9 @@ int probe_access_flags(CPUArchState *env, target_ulong addr, /* Handle clean RAM pages. */ if (unlikely(flags & TLB_NOTDIRTY)) { uintptr_t index = tlb_index(env, mmu_idx, addr); - CPUIOTLBEntry *iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; + CPUTLBEntryFull *full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; - notdirty_write(env_cpu(env), addr, 1, iotlbentry, retaddr); + notdirty_write(env_cpu(env), addr, 1, full, retaddr); flags &= ~TLB_NOTDIRTY; } @@ -1605,19 +1606,19 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, if (unlikely(flags & (TLB_NOTDIRTY | TLB_WATCHPOINT))) { uintptr_t index = tlb_index(env, mmu_idx, addr); - CPUIOTLBEntry *iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; + CPUTLBEntryFull *full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; /* Handle watchpoints. */ if (flags & TLB_WATCHPOINT) { int wp_access = (access_type == MMU_DATA_STORE ? BP_MEM_WRITE : BP_MEM_READ); cpu_check_watchpoint(env_cpu(env), addr, size, - iotlbentry->attrs, wp_access, retaddr); + full->attrs, wp_access, retaddr); } /* Handle clean RAM pages. */ if (flags & TLB_NOTDIRTY) { - notdirty_write(env_cpu(env), addr, 1, iotlbentry, retaddr); + notdirty_write(env_cpu(env), addr, 1, full, retaddr); } } @@ -1674,7 +1675,7 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, target_ulong addr, * should have just filled the TLB. The one corner case is io_writex * which can cause TLB flushes and potential resizing of the TLBs * losing the information we need. In those cases we need to recover - * data from a copy of the iotlbentry. As long as this always occurs + * data from a copy of the CPUTLBEntryFull. As long as this always occurs * from the same thread (which a mem callback will be) this is safe. */ @@ -1689,11 +1690,12 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx, if (likely(tlb_hit(tlb_addr, addr))) { /* We must have an iotlb entry for MMIO */ if (tlb_addr & TLB_MMIO) { - CPUIOTLBEntry *iotlbentry; - iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; + CPUTLBEntryFull *full; + full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; data->is_io = true; - data->v.io.section = iotlb_to_section(cpu, iotlbentry->addr, iotlbentry->attrs); - data->v.io.offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr; + data->v.io.section = + iotlb_to_section(cpu, full->xlat_section, full->attrs); + data->v.io.offset = (full->xlat_section & TARGET_PAGE_MASK) + addr; } else { data->is_io = false; data->v.ram.hostaddr = (void *)((uintptr_t)addr + tlbe->addend); @@ -1801,7 +1803,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr, if (unlikely(tlb_addr & TLB_NOTDIRTY)) { notdirty_write(env_cpu(env), addr, size, - &env_tlb(env)->d[mmu_idx].iotlb[index], retaddr); + &env_tlb(env)->d[mmu_idx].fulltlb[index], retaddr); } return hostaddr; @@ -1909,7 +1911,7 @@ load_helper(CPUArchState *env, target_ulong addr, MemOpIdx oi, /* Handle anything that isn't just a straight memory access. */ if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { - CPUIOTLBEntry *iotlbentry; + CPUTLBEntryFull *full; bool need_swap; /* For anything that is unaligned, recurse through full_load. */ @@ -1917,20 +1919,20 @@ load_helper(CPUArchState *env, target_ulong addr, MemOpIdx oi, goto do_unaligned_access; } - iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; + full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; /* Handle watchpoints. */ if (unlikely(tlb_addr & TLB_WATCHPOINT)) { /* On watchpoint hit, this will longjmp out. */ cpu_check_watchpoint(env_cpu(env), addr, size, - iotlbentry->attrs, BP_MEM_READ, retaddr); + full->attrs, BP_MEM_READ, retaddr); } need_swap = size > 1 && (tlb_addr & TLB_BSWAP); /* Handle I/O access. */ if (likely(tlb_addr & TLB_MMIO)) { - return io_readx(env, iotlbentry, mmu_idx, addr, retaddr, + return io_readx(env, full, mmu_idx, addr, retaddr, access_type, op ^ (need_swap * MO_BSWAP)); } @@ -2245,12 +2247,12 @@ store_helper_unaligned(CPUArchState *env, target_ulong addr, uint64_t val, */ if (unlikely(tlb_addr & TLB_WATCHPOINT)) { cpu_check_watchpoint(env_cpu(env), addr, size - size2, - env_tlb(env)->d[mmu_idx].iotlb[index].attrs, + env_tlb(env)->d[mmu_idx].fulltlb[index].attrs, BP_MEM_WRITE, retaddr); } if (unlikely(tlb_addr2 & TLB_WATCHPOINT)) { cpu_check_watchpoint(env_cpu(env), page2, size2, - env_tlb(env)->d[mmu_idx].iotlb[index2].attrs, + env_tlb(env)->d[mmu_idx].fulltlb[index2].attrs, BP_MEM_WRITE, retaddr); } @@ -2314,7 +2316,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, /* Handle anything that isn't just a straight memory access. */ if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { - CPUIOTLBEntry *iotlbentry; + CPUTLBEntryFull *full; bool need_swap; /* For anything that is unaligned, recurse through byte stores. */ @@ -2322,20 +2324,20 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, goto do_unaligned_access; } - iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; + full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; /* Handle watchpoints. */ if (unlikely(tlb_addr & TLB_WATCHPOINT)) { /* On watchpoint hit, this will longjmp out. */ cpu_check_watchpoint(env_cpu(env), addr, size, - iotlbentry->attrs, BP_MEM_WRITE, retaddr); + full->attrs, BP_MEM_WRITE, retaddr); } need_swap = size > 1 && (tlb_addr & TLB_BSWAP); /* Handle I/O access. */ if (tlb_addr & TLB_MMIO) { - io_writex(env, iotlbentry, mmu_idx, val, addr, retaddr, + io_writex(env, full, mmu_idx, val, addr, retaddr, op ^ (need_swap * MO_BSWAP)); return; } @@ -2347,7 +2349,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, /* Handle clean RAM pages. */ if (tlb_addr & TLB_NOTDIRTY) { - notdirty_write(env_cpu(env), addr, size, iotlbentry, retaddr); + notdirty_write(env_cpu(env), addr, size, full, retaddr); } haddr = (void *)((uintptr_t)addr + entry->addend); diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index d11a8c70d0..fdd23ab3f8 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -106,7 +106,7 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, return tags + index; #else uintptr_t index; - CPUIOTLBEntry *iotlbentry; + CPUTLBEntryFull *full; int in_page, flags; ram_addr_t ptr_ra; hwaddr ptr_paddr, tag_paddr, xlat; @@ -129,7 +129,7 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, assert(!(flags & TLB_INVALID_MASK)); /* - * Find the iotlbentry for ptr. This *must* be present in the TLB + * Find the CPUTLBEntryFull for ptr. This *must* be present in the TLB * because we just found the mapping. * TODO: Perhaps there should be a cputlb helper that returns a * matching tlb entry + iotlb entry. @@ -144,10 +144,10 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, g_assert(tlb_hit(comparator, ptr)); } # endif - iotlbentry = &env_tlb(env)->d[ptr_mmu_idx].iotlb[index]; + full = &env_tlb(env)->d[ptr_mmu_idx].fulltlb[index]; /* If the virtual page MemAttr != Tagged, access unchecked. */ - if (!arm_tlb_mte_tagged(&iotlbentry->attrs)) { + if (!arm_tlb_mte_tagged(&full->attrs)) { return NULL; } @@ -181,7 +181,7 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, int wp = ptr_access == MMU_DATA_LOAD ? BP_MEM_READ : BP_MEM_WRITE; assert(ra != 0); cpu_check_watchpoint(env_cpu(env), ptr, ptr_size, - iotlbentry->attrs, wp, ra); + full->attrs, wp, ra); } /* @@ -202,11 +202,11 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int ptr_mmu_idx, tag_paddr = ptr_paddr >> (LOG2_TAG_GRANULE + 1); /* Look up the address in tag space. */ - tag_asi = iotlbentry->attrs.secure ? ARMASIdx_TagS : ARMASIdx_TagNS; + tag_asi = full->attrs.secure ? ARMASIdx_TagS : ARMASIdx_TagNS; tag_as = cpu_get_address_space(env_cpu(env), tag_asi); mr = address_space_translate(tag_as, tag_paddr, &xlat, NULL, tag_access == MMU_DATA_STORE, - iotlbentry->attrs); + full->attrs); /* * Note that @mr will never be NULL. If there is nothing in the address diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index d6f7ef94fe..9cae8fd352 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -5384,8 +5384,8 @@ bool sve_probe_page(SVEHostPage *info, bool nofault, CPUARMState *env, g_assert(tlb_hit(comparator, addr)); # endif - CPUIOTLBEntry *iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; - info->attrs = iotlbentry->attrs; + CPUTLBEntryFull *full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; + info->attrs = full->attrs; } #endif diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 163df8c615..b7787e7786 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14634,7 +14634,7 @@ static bool is_guarded_page(CPUARMState *env, DisasContext *s) * table entry even for that case. */ return (tlb_hit(entry->addr_code, addr) && - arm_tlb_bti_gp(&env_tlb(env)->d[mmu_idx].iotlb[index].attrs)); + arm_tlb_bti_gp(&env_tlb(env)->d[mmu_idx].fulltlb[index].attrs)); #endif } From patchwork Mon Sep 5 20:22:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602755 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3957796mae; Mon, 5 Sep 2022 13:28:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5TwkIx6a2xsB6u0MwFnnaaLVJV0g1T590GxcklZMSPnpfsc3a53Ofx9JVfOezFCPPFD0H4 X-Received: by 2002:ac8:7d84:0:b0:344:662d:278c with SMTP id c4-20020ac87d84000000b00344662d278cmr40106659qtd.513.1662409682185; Mon, 05 Sep 2022 13:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409682; cv=none; d=google.com; s=arc-20160816; b=TZ5sOo28oqf84iROIw/Kuq8gmn1k4OzkxyReHwbJfTpPG0gQ0eB+qbQEBfBMyihE5a CJ9oXG1T1tyZgtt7uwW1QnTaBM2AN8ZcV2rc3Qb5T4uVqKhFay7ynvkA3I0jsVoafZhF PyNJCoTI7LRkaf3XBzRgI+g6zfx32LySgm6fOQmm3/w6BJXVIsvmvJt1hWAC9goMdpHy JsbS0O+gTFuG+Ww08tJ6F4xQti5b72tTfUnscf9ppTF8QwuYH4QpvdT9wbDvfROoynH4 F8R3BbLkAKYsqdeGEgl3b67RtFWipuirBZg3bDHnVUpkvNE+cMb1AAOLqobqWMxO93qU AtRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=eGrlsO0BMtQ4NxQnZcrpPpgvXA47KiMUFyTlQ1QqPPg=; b=G/6XwUgkJ8UXtGGvMFGn9lmJuCPA5pjEMCxYk1jh0Wudm913+pegLBsafYUy5lfXT1 dIcWF7svZASrb2XgiKjm3oIEPi9cU7LqKJdb8OzCKuxGddUN2Ij1HLgvgXi4bgZBNPxx mzXBIcJKArAgKjuw1h4GvSTW6j14GphlzQEX822h5kGxbLJYWazCaEZEc+bS1cmih/AY qc2h5P0GTEHI3mJtvke5MbAXNBOtMwS2ncqB1MOmopHYFnH7QlLXJPIU99USzeCxpy5R hedzkQqCn6B5qCSyVkrBytboRs7lH6l7nR3ZurXeHaXS8JwuPBr5YBnff5htFb4Sgksb 3PWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LRp8+N3X; 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 k10-20020ac8074a000000b0031ef8371560si5592912qth.736.2022.09.05.13.28.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:28:02 -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=LRp8+N3X; 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]:38824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIhN-0004TM-P8 for patch@linaro.org; Mon, 05 Sep 2022 16:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIci-00079G-JT for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:12 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:38604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIcc-0004XN-Gy for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:11 -0400 Received: by mail-wr1-x436.google.com with SMTP id b5so12634517wrr.5 for ; Mon, 05 Sep 2022 13:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=eGrlsO0BMtQ4NxQnZcrpPpgvXA47KiMUFyTlQ1QqPPg=; b=LRp8+N3XL1ner0hOP84QK19qNd5NWTnug8fA2epM5FIjqPNiqDmJOIJ/Uh39TY1hWJ xA2llEheBoDn29HR7Ufg2ckrxaW/X0S1Jp1ugrkMKFdIZAtLBdyV7cXJJnFSmWU/aqHC ysgY7wWZocgSs+BqDMQA3l3+6NzmMII00vXVZZEiM+NXfO3cCvMOVxJVuNPng1E6Rg/Z haX6yDnXyntzVVd8uNU+CQTNzcDSIJxoJ0HedphCR5pp6jdgyUJAgSYiSZWwQ1Be79Jj WV/eSgQH2mPeOw9KKuJMfSCii6URm9FADwVYg2nOmUXPMFECrYe4KzTnXSYo+ycYumtd nugA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=eGrlsO0BMtQ4NxQnZcrpPpgvXA47KiMUFyTlQ1QqPPg=; b=dY0fDF+YpaQ3sy8usqIl+8SKrzrgRSRc1srchlIOKrDMP6JRwKBiDovoH24oLcQNqc 325zeIYv+JWV67oqISX3TRSweo08bcnVMtd0MmbInr7Sud8W4asLLUedAKSLD3q9xNOd 3p9s9Nul2Qlq1Uk1WQ+SbQlg6hBrhUhX4J33MZl8pkFctZxD7ONdpHRoh/txWo64jWMQ Q6qA/vdV1qhHjXQTHPPUMyLZNpCGMQEkQ8sfVhsK/KkSm6O2/9uDEa4Az2zeR3pvXnz7 hpmcQINx1oC10A4IIwkkgHyCHFoYci/D0oRc89rZzlCcH641SVTGz+/nP8KFrK+o+gfH 0xxg== X-Gm-Message-State: ACgBeo233OdeX660B4jMMqhqrRVoxOm63+T40/2AMGdwLB0Ma1yGccOY /Q/y07iFnvbkRQiPmI16oTqL0RDVYQ1Dn2PE X-Received: by 2002:adf:f8ca:0:b0:226:e456:1896 with SMTP id f10-20020adff8ca000000b00226e4561896mr753191wrq.177.1662409384140; Mon, 05 Sep 2022 13:23:04 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com Subject: [PATCH v3 2/6] accel/tcg: Drop addr member from SavedIOTLB Date: Mon, 5 Sep 2022 21:22:55 +0100 Message-Id: <20220905202259.189852-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-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, T_SCC_BODY_TEXT_LINE=-0.01 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" This field is only written, not read; remove it. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/hw/core/cpu.h | 1 - accel/tcg/cputlb.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 500503da13..9e47184513 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -218,7 +218,6 @@ struct CPUWatchpoint { * the memory regions get moved around by io_writex. */ typedef struct SavedIOTLB { - hwaddr addr; MemoryRegionSection *section; hwaddr mr_offset; } SavedIOTLB; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 4585d7c015..03395e725d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1374,12 +1374,11 @@ static uint64_t io_readx(CPUArchState *env, CPUTLBEntryFull *full, * This is read by tlb_plugin_lookup if the fulltlb entry doesn't match * because of the side effect of io_writex changing memory layout. */ -static void save_iotlb_data(CPUState *cs, hwaddr addr, - MemoryRegionSection *section, hwaddr mr_offset) +static void save_iotlb_data(CPUState *cs, MemoryRegionSection *section, + hwaddr mr_offset) { #ifdef CONFIG_PLUGIN SavedIOTLB *saved = &cs->saved_iotlb; - saved->addr = addr; saved->section = section; saved->mr_offset = mr_offset; #endif @@ -1408,7 +1407,7 @@ static void io_writex(CPUArchState *env, CPUTLBEntryFull *full, * The memory_region_dispatch may trigger a flush/resize * so for plugins we save the iotlb_data just in case. */ - save_iotlb_data(cpu, full->xlat_section, section, mr_offset); + save_iotlb_data(cpu, section, mr_offset); if (!qemu_mutex_iothread_locked()) { qemu_mutex_lock_iothread(); From patchwork Mon Sep 5 20:22:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602752 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3956130mae; Mon, 5 Sep 2022 13:24:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7UZgXoE2KaRXlKpD0+XBiv6w0lTFntKGnRmbxAwu3I9PYE+8WA6rpwoVvSs+Tw48G9zDM8 X-Received: by 2002:a05:620a:b99:b0:6c5:f912:6c2e with SMTP id k25-20020a05620a0b9900b006c5f9126c2emr6965354qkh.30.1662409465395; Mon, 05 Sep 2022 13:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409465; cv=none; d=google.com; s=arc-20160816; b=A7UmOwxvlabpgBhi44T3bAyHwnHsQucuX8Kar3mWd2v5T6RCh8tymsweamg1TF/hJm zHLPs1hhmVxj98aClo6UP64giwDqDkN5sgnIvzIFN3NsGC2cTV/CawaP4PfeBFClJBjK HLrGanChVkziwBPqjFyTcIANMCBDv10PqGLoc1ia1ZU/wJABy7yYoHfbGeT1LcPrEBtx eUPKELDRyOBEaCNEPH3Oyo4h9+h5GB2Ng6S27SX15z5dSFLwQTMlW6XIbVCnnvHJsRhn K0kxOgsmaeeIMEnXSKjaxNIfpj9zZbDsD4ikNN6vFhqNcEtHk65goAeLa765/oRyrNsb MOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=ID+SnhpEZx/BDqyhmU8JXjs9pMlZndn9aHrSLTIAUAA=; b=TiaNCr72tyfaxxRvxwvRG05yQGqm/63lKmSudXIF0+nCJq7XbSWaEkGfLedhjTlj65 PPPXm6t23b/RH2bxTV3RVBl3et2gtDex2wTE2UNQhre3TqQ0oiNCNZXx0VSuZGkV9+GW 50Ul6fHOySbLaSGbdPn9F7iD3VgAZ/Kv2K7CDhgT9RVXURE2kHySjvn4iC6EO6/erUUZ hJNyVyPANlT7K6HkjaBeFAKdQ1Oi1q62kb2uHNm9z9/WauBz7te15+swlYnwylKjdeYi Mis6AirbdBYEvLAMlSnKCXSNxgSeIRJYORl/FC8iTDlWlh1s3f3B2vcvY/3tNgp+Qmaj anJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oa78ED8J; 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 l5-20020ac81485000000b003450eaa86e4si5669091qtj.214.2022.09.05.13.24.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:24:25 -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=Oa78ED8J; 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]:43538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIds-0007CK-VX for patch@linaro.org; Mon, 05 Sep 2022 16:24:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIch-00079h-Nw for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:11 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:33627) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIcc-0004Xc-NK for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:11 -0400 Received: by mail-wr1-x42e.google.com with SMTP id k9so12668124wri.0 for ; Mon, 05 Sep 2022 13:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ID+SnhpEZx/BDqyhmU8JXjs9pMlZndn9aHrSLTIAUAA=; b=Oa78ED8JInHiSEiQGo4S4fRljhXgCC2CEjhG9gAkzV8h8fDk7VBjzhbIsW9nq/8aTv F3bURBIb/xjLv5i8e/K8TSmBzoNZnDD7IE9kf7ChzxGN7wL6wm4EDXZEAZvHvjzDgmPs VbaDrYA0rPF2VEhir0jMYN1Lv/udwnhXB1K3WFzDNrdKtLSgO2Vyex6DuSMwOiaBkayN bKfJDdYx+3L8l242XHvyU0OEjKMRuJr06a1fALqnXcoHHa45TejuR7qvwa08uL/J5NZF zadMS4Vn7aeTImXERz4Rfo/IU238f6U1gBTomrFZgERj8qSuFWq4DwAH0ofw877qwCSR AQmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ID+SnhpEZx/BDqyhmU8JXjs9pMlZndn9aHrSLTIAUAA=; b=dPa/t7w2tm02JO+jV5wgmzpPKi8pmWbFg/gMt04ioK9BkybwEafLOQJRLEhUbL4ba9 2ruJHcRV0Ot6r5NS5ftI9QWZE1VruYTZeHL16+yOzUqVdv+4TzTARoNc05gM6i5omufd T/HaB31eZegKwuIPW2+pjyGnSSTgXI52ujFEkTA1nXpPFhe5fkjKfHPo1VJ3Mj4zRBLt UcEiYjRBo+RuGp6LV0PEd8BXvY999+n/avx+xxKZmjMuDArtEOw1VlG1AdB86th3nD63 QCdx2bh1nekTIcTaqLt13bW0aQILYcdAU9wZUMng7bMK1ZzPF5QWPcAAC72aMJ8D4+vr cOOg== X-Gm-Message-State: ACgBeo2WhwXB8JsZpDSHqWN1S+yDX8Q8cy6SZp49pfBxX2xujaaNxSrK k+PwUgpQLLnNxHU3EvcK1pSAYs4kIzpI0FD4 X-Received: by 2002:a5d:6248:0:b0:222:cd3b:94c8 with SMTP id m8-20020a5d6248000000b00222cd3b94c8mr25862129wrv.97.1662409385452; Mon, 05 Sep 2022 13:23:05 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com, David Hildenbrand Subject: [PATCH v3 3/6] accel/tcg: Suppress auto-invalidate in probe_access_internal Date: Mon, 5 Sep 2022 21:22:56 +0100 Message-Id: <20220905202259.189852-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-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, T_SCC_BODY_TEXT_LINE=-0.01 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" When PAGE_WRITE_INV is set when calling tlb_set_page, we immediately set TLB_INVALID_MASK in order to force tlb_fill to be called on the next lookup. Here in probe_access_internal, we have just called tlb_fill and eliminated true misses, thus the lookup must be valid. This allows us to remove a warning comment from s390x. There doesn't seem to be a reason to change the code though. Cc: David Hildenbrand Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- accel/tcg/cputlb.c | 10 +++++++++- target/s390x/tcg/mem_helper.c | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 03395e725d..91f2b53142 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1535,6 +1535,7 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, } tlb_addr = tlb_read_ofs(entry, elt_ofs); + flags = TLB_FLAGS_MASK; page_addr = addr & TARGET_PAGE_MASK; if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(env, mmu_idx, index, elt_ofs, page_addr)) { @@ -1550,10 +1551,17 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, /* TLB resize via tlb_fill may have moved the entry. */ entry = tlb_entry(env, mmu_idx, addr); + + /* + * With PAGE_WRITE_INV, we set TLB_INVALID_MASK immediately, + * to force the next access through tlb_fill. We've just + * called tlb_fill, so we know that this entry *is* valid. + */ + flags &= ~TLB_INVALID_MASK; } tlb_addr = tlb_read_ofs(entry, elt_ofs); } - flags = tlb_addr & TLB_FLAGS_MASK; + flags &= tlb_addr; /* Fold all "mmio-like" bits into TLB_MMIO. This is not RAM. */ if (unlikely(flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY))) { diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index fc52aa128b..3758b9e688 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -148,10 +148,6 @@ static int s390_probe_access(CPUArchState *env, target_ulong addr, int size, #else int flags; - /* - * For !CONFIG_USER_ONLY, we cannot rely on TLB_INVALID_MASK or haddr==NULL - * to detect if there was an exception during tlb_fill(). - */ env->tlb_fill_exc = 0; flags = probe_access_flags(env, addr, access_type, mmu_idx, nonfault, phost, ra); From patchwork Mon Sep 5 20:22:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602757 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3958598mae; Mon, 5 Sep 2022 13:29:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+CFlp+7boErkUcGogddFXg4E048p6oVRYvb1g7BXsgzfnu9K3H9+ZOYPsluDNJqH2Csn1 X-Received: by 2002:a05:622a:15d4:b0:344:6a92:d8dc with SMTP id d20-20020a05622a15d400b003446a92d8dcmr40258134qty.114.1662409786009; Mon, 05 Sep 2022 13:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409786; cv=none; d=google.com; s=arc-20160816; b=ATf6roO0Nr504kr1iJsqOnp+7qOtfMtgg/blv6j8ATOf/StxXKu29QFaignErc4fk+ TCh6Jq2unbi37K3XH7Ryt6n2LoXaqt3IyOfNrZ6xBbdcTDlkVETwNzO4CY6Hqz7H5Bry FTsJPIOkBu87RZ6BxfGpZKobInO2qN6mmyq0CRoAvk9BcsYqpqRsFZU4IcmpYAN3iuEe kVIGCvrQQKT8pBWLeS1Sq05kpGp8Sbde3mKrpY2KWkLw+nC6UaoGyR/Rv3NOaABY/zg6 7QACK/gfHD/aUDkVT17gqkSQe2sMUhrCGuaUTWmLkGDti7PudO5CB0ChmgO6li5FHBUj uh5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=PThaj1MyA7vLZavcHQlAz4oEip5HVhIhx/+PfVUDTNU=; b=vagJPfEPkjwD7Cst7qir6sUAz83IF4hPNhwxlj4CmStjZL0Q5PJHBuUAbApo/LkENA PCD9vD7Tok4u+JQ41HXOmdWu+EplNermGL2NBSg4sJUzv/B98me1mv6R36BHedCTuK80 9Qy1YRA5tyPvOXA68TjlXaA4zwvC5tzqeJldpuIPxU6sAdVxIItzfjwGYqQmgIqCKCy6 0hT16haT3a0i0Mr+PAvoevusAKhq3l3TCHNLOj5UJCzzHIijwX8O1bVZtkYQiVs2hSUY fk4u2dvAozTXhLaieZcUYSB9Ce+4f2SuVLp3BPxgOuoZgkwpsPBPyLV424GXjV4B/cqS XoyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TxW/p4XN"; 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 14-20020a0562140d0e00b004a0a09dd520si3171214qvh.93.2022.09.05.13.29.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:29:46 -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="TxW/p4XN"; 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]:46508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIj3-0000G4-Jq for patch@linaro.org; Mon, 05 Sep 2022 16:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIcj-0007CJ-7L for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:13 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:43771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIce-0004Xv-Gi for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:12 -0400 Received: by mail-wr1-x433.google.com with SMTP id t7so7593242wrm.10 for ; Mon, 05 Sep 2022 13:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=PThaj1MyA7vLZavcHQlAz4oEip5HVhIhx/+PfVUDTNU=; b=TxW/p4XNvcAC57+1wggGYg38zrzkAdUnommWyvwSE90CGp6wE2VDmUxjkHgt/Np8Ac 6pAcEmBpy/oy1M5PNq9P31uJOcHHE0i8ikNVSbS0dH3xHdNmqf0DQWGCV/0FQynxpcBe qVpbyN1hZAEEDt/ZeqLkWmszbv1Vh2Ju0f8sWL2wOAA2C/p+a5Ap1O5YmE2U7mMw3rbP T2qGLxbUSOLDy2oCHpMZyx2gBqvP/WbXBiQIIAvDJcviLq2r9vepKNxVmNBE33JUaMFy EJawZS1hQF5T3AG6jgnERzTEcGMgQql28h2rtER/gftxObJ5KO2xfVrEFGtR0zmU7TtD 6AxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=PThaj1MyA7vLZavcHQlAz4oEip5HVhIhx/+PfVUDTNU=; b=ExuaUmCwCtmkz9QSkRzalzeXmFIdwuS5W8hTUCQ4RgJnJABMt4GIsCCainiJhe0V38 wQkGBcBr46l6c5CUs9tA4vIbD55TwUq8IkwEGsBboOnC27Tfe4Bo0DyR7FHtYYUYMLFQ c4rw9APqZpzcqSb4HstBBEfc1J6ZNn9sNa42fvUOXJNEPHQoKNyyWC92D62D5LMkgjHF YpruiJvheM9/OmSNJ+ekKbz3y7Z0pyiqN8sXSgaZbNfbjUwBhzSYC1M29w8VxqA+XvGG tOevpfMKsc90Ibhz+0RwK7y36Ofxm0Y+8ncOZlRcfnBHnXuLKzJyYvJSU6ksLHktoRvN HTdg== X-Gm-Message-State: ACgBeo3TF53KPB3hOHcyH2ULN6mhNs1jr1W0bQjl4ubnqUgCsQek+f7m A67AiG8t3kh30veVBUDvUKXAH6GHNKS6yAOj X-Received: by 2002:adf:d1c9:0:b0:225:f98:d602 with SMTP id b9-20020adfd1c9000000b002250f98d602mr25837061wrd.419.1662409386945; Mon, 05 Sep 2022 13:23:06 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com Subject: [PATCH v3 4/6] accel/tcg: Introduce probe_access_full Date: Mon, 5 Sep 2022 21:22:57 +0100 Message-Id: <20220905202259.189852-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Add an interface to return the CPUTLBEntryFull struct that goes with the lookup. The result is not intended to be valid across multiple lookups, so the user must use the results immediately. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/exec/exec-all.h | 11 ++++++++++ accel/tcg/cputlb.c | 47 +++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index bcad607c4e..758cf6bcc7 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -434,6 +434,17 @@ int probe_access_flags(CPUArchState *env, target_ulong addr, MMUAccessType access_type, int mmu_idx, bool nonfault, void **phost, uintptr_t retaddr); +#ifndef CONFIG_USER_ONLY +/** + * probe_access_full: + * Like probe_access_flags, except also return into @pfull. + */ +int probe_access_full(CPUArchState *env, target_ulong addr, + MMUAccessType access_type, int mmu_idx, + bool nonfault, void **phost, + CPUTLBEntryFull **pfull, uintptr_t retaddr); +#endif + #define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line */ /* Estimated block size for TB allocation. */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 91f2b53142..62159549f6 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1512,7 +1512,8 @@ static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, static int probe_access_internal(CPUArchState *env, target_ulong addr, int fault_size, MMUAccessType access_type, int mmu_idx, bool nonfault, - void **phost, uintptr_t retaddr) + void **phost, CPUTLBEntryFull **pfull, + uintptr_t retaddr) { uintptr_t index = tlb_index(env, mmu_idx, addr); CPUTLBEntry *entry = tlb_entry(env, mmu_idx, addr); @@ -1546,10 +1547,12 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, mmu_idx, nonfault, retaddr)) { /* Non-faulting page table read failed. */ *phost = NULL; + *pfull = NULL; return TLB_INVALID_MASK; } /* TLB resize via tlb_fill may have moved the entry. */ + index = tlb_index(env, mmu_idx, addr); entry = tlb_entry(env, mmu_idx, addr); /* @@ -1563,6 +1566,8 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, } flags &= tlb_addr; + *pfull = &env_tlb(env)->d[mmu_idx].fulltlb[index]; + /* Fold all "mmio-like" bits into TLB_MMIO. This is not RAM. */ if (unlikely(flags & ~(TLB_WATCHPOINT | TLB_NOTDIRTY))) { *phost = NULL; @@ -1574,37 +1579,44 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, return flags; } -int probe_access_flags(CPUArchState *env, target_ulong addr, - MMUAccessType access_type, int mmu_idx, - bool nonfault, void **phost, uintptr_t retaddr) +int probe_access_full(CPUArchState *env, target_ulong addr, + MMUAccessType access_type, int mmu_idx, + bool nonfault, void **phost, CPUTLBEntryFull **pfull, + uintptr_t retaddr) { - int flags; - - flags = probe_access_internal(env, addr, 0, access_type, mmu_idx, - nonfault, phost, retaddr); + int flags = probe_access_internal(env, addr, 0, access_type, mmu_idx, + nonfault, phost, pfull, retaddr); /* Handle clean RAM pages. */ if (unlikely(flags & TLB_NOTDIRTY)) { - uintptr_t index = tlb_index(env, mmu_idx, addr); - CPUTLBEntryFull *full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; - - notdirty_write(env_cpu(env), addr, 1, full, retaddr); + notdirty_write(env_cpu(env), addr, 1, *pfull, retaddr); flags &= ~TLB_NOTDIRTY; } return flags; } +int probe_access_flags(CPUArchState *env, target_ulong addr, + MMUAccessType access_type, int mmu_idx, + bool nonfault, void **phost, uintptr_t retaddr) +{ + CPUTLBEntryFull *full; + + return probe_access_full(env, addr, access_type, mmu_idx, + nonfault, phost, &full, retaddr); +} + void *probe_access(CPUArchState *env, target_ulong addr, int size, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { + CPUTLBEntryFull *full; void *host; int flags; g_assert(-(addr | TARGET_PAGE_MASK) >= size); flags = probe_access_internal(env, addr, size, access_type, mmu_idx, - false, &host, retaddr); + false, &host, &full, retaddr); /* Per the interface, size == 0 merely faults the access. */ if (size == 0) { @@ -1612,9 +1624,6 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, } if (unlikely(flags & (TLB_NOTDIRTY | TLB_WATCHPOINT))) { - uintptr_t index = tlb_index(env, mmu_idx, addr); - CPUTLBEntryFull *full = &env_tlb(env)->d[mmu_idx].fulltlb[index]; - /* Handle watchpoints. */ if (flags & TLB_WATCHPOINT) { int wp_access = (access_type == MMU_DATA_STORE @@ -1635,11 +1644,12 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr, MMUAccessType access_type, int mmu_idx) { + CPUTLBEntryFull *full; void *host; int flags; flags = probe_access_internal(env, addr, 0, access_type, - mmu_idx, true, &host, 0); + mmu_idx, true, &host, &full, 0); /* No combination of flags are expected by the caller. */ return flags ? NULL : host; @@ -1658,10 +1668,11 @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr, tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, target_ulong addr, void **hostp) { + CPUTLBEntryFull *full; void *p; (void)probe_access_internal(env, addr, 1, MMU_INST_FETCH, - cpu_mmu_index(env, true), false, &p, 0); + cpu_mmu_index(env, true), false, &p, &full, 0); if (p == NULL) { return -1; } From patchwork Mon Sep 5 20:22:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602756 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3958157mae; Mon, 5 Sep 2022 13:28:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR514xP9NSzGLyQzQR2Zl6znYiOqdAdA23foMtTK+ccYewr1GXDVpYS8I1OJdOzJSplIluAM X-Received: by 2002:ac8:594d:0:b0:343:713b:d266 with SMTP id 13-20020ac8594d000000b00343713bd266mr40191576qtz.295.1662409728013; Mon, 05 Sep 2022 13:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409728; cv=none; d=google.com; s=arc-20160816; b=wCDADJvqSbsyZ+VRYaWTYQWlCTG0bpOeNcZS4C+TmHLWqD9j03TWdffwis2KzsYNKA fDNB0rSFU82iGLev6Hs1FLUHwq1jikmU23g0lwknvhMz867r52Qh0eN8/B2tbg3Pxjdj LO4GrFv3Zg5cPmY7hlnKh7k20Q3uC0RlCaowSLueh6hgE3MijvlSqHVo4XrybzbnSAcb eJfV/lnqdJzuW9m/Cq1/bPQAsHJcf/5BEYpw4JMdxah2fY6daFNO0TOPyhpP1ioiJgK9 rylrdhlfUlSw2Ok4HYPtycG/mzH4aobjPOUGhTJugS5yN3E2dQ5G+gBHioNgETJvgkNn tapQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=nt1aL/S2kb9oWyxTHsH7QG5cEjvmgw/rl9aHHcIbwB4=; b=t1L/zt1TCqaw7Yv3lupOKgwgIgCa85czxBU5gxQM9OYwSqBhNFC5f+RkqLPeiSn976 jgBlSE31KEv0r3JsrmtKFus6h6wPThmpPn4Gj9jXcjlDbCoBa5q2/smSDvbXYRbo9WR0 EWIBZaMyz+RUYkGra+CZFe/Um+4xSKl3xKAQjRvLLep/a99dFuUYBQGKwW6sWfFFqI0g BgSre3qr3KlhVI8D1Hovrw0ORdxhs+ijJuEiNz3w+anebSxzgEPxvyb7XFBT8SQj9tZO 501neE7uDZgFrragIClBMjbVnrCZkQ7lNLxJK4PluK/Vp6AT0MnHEVOCE9qr5Kk7dsQ1 JP+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PJt/RvF2"; 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 l7-20020ac84a87000000b0034486432a00si5319055qtq.253.2022.09.05.13.28.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:28:48 -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="PJt/RvF2"; 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]:59466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIi7-00067B-IL for patch@linaro.org; Mon, 05 Sep 2022 16:28:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIcm-0007Jn-U7 for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:16 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:41836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIcg-0004ZE-TY for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:15 -0400 Received: by mail-wr1-x42b.google.com with SMTP id t14so5343687wrx.8 for ; Mon, 05 Sep 2022 13:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=nt1aL/S2kb9oWyxTHsH7QG5cEjvmgw/rl9aHHcIbwB4=; b=PJt/RvF2z0BkWHdDPwVfQsyTIFSGXnOdGIIjYJ+CNGGTLITGoN0COfUO8zD8CWUeex w8jaq/IgOlDVQX1gZNdKFbQWjw2V3j4AB2/DIsP03/MwBosvEbb/G/s5FIKenIcnoyns rfkVZ7Y3ek201JOCJd+sbRpeD+P6C9ycAnnBGgRg6ynPyav35VXUaxZAX0NJjiY4ZyVX 6Ahpi1HU3lC6EuWSExIMLA8obn8QzcnO1LP4reM79OHDJ6PWPNqYfLDOtDbkYdWMUNbF U7AAL+ixXqEuwzoFxfctAvY9vFJExH7eOqyA3LEn1Sai+6ubF596BbtipoXF67gzZsus 7h4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=nt1aL/S2kb9oWyxTHsH7QG5cEjvmgw/rl9aHHcIbwB4=; b=gEFXRU3CgtkrC97Gi9a2Er0/59hZVG5YObb8b31I7ischHMZgkhm59b6dXAltgPgAx z/3T+By35/JxCfs97MrM1ZuF744VgqT+t+/fvTT+TS8hQW2acSr3MyDLbTiJAOU97Gkx IxNX193dAhNbWB4ReM285yrX/Qr0dT+eTW+Tofj/UYtPp84oAsPTc4PswIR7iLu6Xa17 W66jpNbnlFP007AwpujdLlxuCb6sKocCNekl+rhODcDLOyZuJ/rrjYv9JN6moWutSScn 7nLMBwGRjuxaD5ijtD9aRFDvbj6npX6OLPcW24zXkCzRvZeuicxR3CcbZv7z0eFJK1lg /a+g== X-Gm-Message-State: ACgBeo3MDNPekki+GrBwO1swAdwaiLlCsTOiWT1IUxDU2hAcNxutQlDg ujY4mQr/wP1Ti017A/avvEuarricHkDxBwh9 X-Received: by 2002:adf:f085:0:b0:226:d6e4:58f5 with SMTP id n5-20020adff085000000b00226d6e458f5mr24162729wro.50.1662409388345; Mon, 05 Sep 2022 13:23:08 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com Subject: [PATCH v3 5/6] accel/tcg: Introduce tlb_set_page_full Date: Mon, 5 Sep 2022 21:22:58 +0100 Message-Id: <20220905202259.189852-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Now that we have collected all of the page data into CPUTLBEntryFull, provide an interface to record that all in one go, instead of using 4 arguments. This interface allows CPUTLBEntryFull to be extended without having to change the number of arguments. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/exec/cpu-defs.h | 14 ++++++++++ include/exec/exec-all.h | 22 +++++++++++++++ accel/tcg/cputlb.c | 62 ++++++++++++++++++++++++++++------------- 3 files changed, 78 insertions(+), 20 deletions(-) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index f70f54d850..5e12cc1854 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -148,7 +148,21 @@ typedef struct CPUTLBEntryFull { * + the offset within the target MemoryRegion (otherwise) */ hwaddr xlat_section; + + /* + * @phys_addr contains the physical address in the address space + * given by cpu_asidx_from_attrs(cpu, @attrs). + */ + hwaddr phys_addr; + + /* @attrs contains the memory transaction attributes for the page. */ MemTxAttrs attrs; + + /* @prot contains the complete protections for the page. */ + uint8_t prot; + + /* @lg_page_size contains the log2 of the page size. */ + uint8_t lg_page_size; } CPUTLBEntryFull; /* diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 758cf6bcc7..1a30c857f4 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -257,6 +257,28 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, uint16_t idxmap, unsigned bits); +/** + * tlb_set_page_full: + * @cpu: CPU context + * @mmu_idx: mmu index of the tlb to modify + * @vaddr: virtual address of the entry to add + * @full: the details of the tlb entry + * + * Add an entry to @cpu tlb index @mmu_idx. All of the fields of + * @full must be filled, except for xlat_section, and constitute + * the complete description of the translated page. + * + * This is generally called by the target tlb_fill function after + * having performed a successful page table walk to find the physical + * address and attributes for the translation. + * + * At most one entry for a given virtual address is permitted. Only a + * single TARGET_PAGE_SIZE region is mapped; @full->ld_page_size is only + * used by tlb_flush_page. + */ +void tlb_set_page_full(CPUState *cpu, int mmu_idx, target_ulong vaddr, + CPUTLBEntryFull *full); + /** * tlb_set_page_with_attrs: * @cpu: CPU to add this TLB entry for diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 62159549f6..3a3549ad4a 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1095,16 +1095,16 @@ static void tlb_add_large_page(CPUArchState *env, int mmu_idx, env_tlb(env)->d[mmu_idx].large_page_mask = lp_mask; } -/* Add a new TLB entry. At most one entry for a given virtual address +/* + * Add a new TLB entry. At most one entry for a given virtual address * is permitted. Only a single TARGET_PAGE_SIZE region is mapped, the * supplied size is only used by tlb_flush_page. * * Called from TCG-generated code, which is under an RCU read-side * critical section. */ -void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, - hwaddr paddr, MemTxAttrs attrs, int prot, - int mmu_idx, target_ulong size) +void tlb_set_page_full(CPUState *cpu, int mmu_idx, + target_ulong vaddr, CPUTLBEntryFull *full) { CPUArchState *env = cpu->env_ptr; CPUTLB *tlb = env_tlb(env); @@ -1117,35 +1117,36 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, CPUTLBEntry *te, tn; hwaddr iotlb, xlat, sz, paddr_page; target_ulong vaddr_page; - int asidx = cpu_asidx_from_attrs(cpu, attrs); - int wp_flags; + int asidx, wp_flags, prot; bool is_ram, is_romd; assert_cpu_is_self(cpu); - if (size <= TARGET_PAGE_SIZE) { + if (full->lg_page_size <= TARGET_PAGE_BITS) { sz = TARGET_PAGE_SIZE; } else { - tlb_add_large_page(env, mmu_idx, vaddr, size); - sz = size; + sz = (hwaddr)1 << full->lg_page_size; + tlb_add_large_page(env, mmu_idx, vaddr, sz); } vaddr_page = vaddr & TARGET_PAGE_MASK; - paddr_page = paddr & TARGET_PAGE_MASK; + paddr_page = full->phys_addr & TARGET_PAGE_MASK; + prot = full->prot; + asidx = cpu_asidx_from_attrs(cpu, full->attrs); section = address_space_translate_for_iotlb(cpu, asidx, paddr_page, - &xlat, &sz, attrs, &prot); + &xlat, &sz, full->attrs, &prot); assert(sz >= TARGET_PAGE_SIZE); tlb_debug("vaddr=" TARGET_FMT_lx " paddr=0x" TARGET_FMT_plx " prot=%x idx=%d\n", - vaddr, paddr, prot, mmu_idx); + vaddr, full->phys_addr, prot, mmu_idx); address = vaddr_page; - if (size < TARGET_PAGE_SIZE) { + if (full->lg_page_size < TARGET_PAGE_BITS) { /* Repeat the MMU check and TLB fill on every access. */ address |= TLB_INVALID_MASK; } - if (attrs.byte_swap) { + if (full->attrs.byte_swap) { address |= TLB_BSWAP; } @@ -1236,8 +1237,10 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, * subtract here is that of the page base, and not the same as the * vaddr we add back in io_readx()/io_writex()/get_page_addr_code(). */ + desc->fulltlb[index] = *full; desc->fulltlb[index].xlat_section = iotlb - vaddr_page; - desc->fulltlb[index].attrs = attrs; + desc->fulltlb[index].phys_addr = paddr_page; + desc->fulltlb[index].prot = prot; /* Now calculate the new entry */ tn.addend = addend - vaddr_page; @@ -1272,15 +1275,34 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, qemu_spin_unlock(&tlb->c.lock); } -/* Add a new TLB entry, but without specifying the memory - * transaction attributes to be used. - */ +void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, + hwaddr paddr, MemTxAttrs attrs, int prot, + int mmu_idx, target_ulong size) +{ + CPUTLBEntryFull full = { + .phys_addr = paddr, + .attrs = attrs, + .prot = prot, + .lg_page_size = ctz64(size) + }; + + assert(is_power_of_2(size)); + tlb_set_page_full(cpu, mmu_idx, vaddr, &full); +} + void tlb_set_page(CPUState *cpu, target_ulong vaddr, hwaddr paddr, int prot, int mmu_idx, target_ulong size) { - tlb_set_page_with_attrs(cpu, vaddr, paddr, MEMTXATTRS_UNSPECIFIED, - prot, mmu_idx, size); + CPUTLBEntryFull full = { + .phys_addr = paddr, + .attrs = MEMTXATTRS_UNSPECIFIED, + .prot = prot, + .lg_page_size = ctz64(size) + }; + + assert(is_power_of_2(size)); + tlb_set_page_full(cpu, mmu_idx, vaddr, &full); } /* From patchwork Mon Sep 5 20:22:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 602754 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp3956356mae; Mon, 5 Sep 2022 13:24:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4GvZnfQpXndt71x3Yw8mCIKIMUs5Z0ixaJ2Kkgi6gwNEXDHULIWTM3xTq5BAZ2Yj4THXNZ X-Received: by 2002:a05:6214:23ca:b0:474:8c8:4fdf with SMTP id hr10-20020a05621423ca00b0047408c84fdfmr41880521qvb.89.1662409493325; Mon, 05 Sep 2022 13:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662409493; cv=none; d=google.com; s=arc-20160816; b=eK3edAMHfUWbMP0NUOM5rWmqK0ZgRaZVBZtaTC8aCx7ZWarZ0ktQWDzfPYDz94X6Zy ak26+x6WPJ2pdPXVC+qPqj1VsKCO+X8pqbuqnEXAIN1eVk2qsa7AKuZfFOmt+JvFudCx TsQofjqcyroxJZV/WIp1yeNrS5JKNrZYdqUdWZPJv2sxuIjCCWyo9yawm9TydF7Eef/u NeHiL4IR+5XioAtMiu4xLPboYYteJ9GKOWmBKRQv47QIe+ulGkL83qNzsJaKLxeC/1Wu S4GDvV75n49FlcSDOqXIh0z5tkEIx/H6xzOv+qR25I48fDgOk2nSs/L+OHn8H1UR9PD7 RL1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:cc:to :from:dkim-signature; bh=L7q2sisR9jXPO2g1tObtbxm8Q6qrnHqWQnHO8ESVRzQ=; b=WGuClyLBqRyy64pUa3+7NCdmqNL1grX9ZrFGnLi7e1aXWd8gZMIvkZGbg0GmQrQL57 qK4mKwdiZFkD6soZAiM8cfYYTlhCf65njt9hkJECNglPiuHJTng/gtg6fNGLjqAEwwIy xvM7PvR1t5m6dCebdj+ddHGiSS6gF6IUSFMyZg7Q76oQUOBsFC62lHthtQw92rzEnTkn Y8YYquTjqmyWkXuWuT0RLJMmXMR+pThB3FX2t4aJ6s3MLGGONe12t0vGAlmMP7j6xrcX K9ezVOB9aDAK9SxBsxxEGgWd/1USIwVe1mhCgqxNBXWsgxCQD/Q2jOiWXZDGHBFiEm5H r2zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JoXyapuA; 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 x9-20020a05622a000900b003437389c5a0si7783054qtw.138.2022.09.05.13.24.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Sep 2022 13:24:53 -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=JoXyapuA; 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]:58298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVIeK-0008AZ-Us for patch@linaro.org; Mon, 05 Sep 2022 16:24:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVIck-0007Ez-VQ for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:15 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:39615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVIcg-0004ZN-Tg for qemu-devel@nongnu.org; Mon, 05 Sep 2022 16:23:13 -0400 Received: by mail-wr1-x432.google.com with SMTP id az27so12626588wrb.6 for ; Mon, 05 Sep 2022 13:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=L7q2sisR9jXPO2g1tObtbxm8Q6qrnHqWQnHO8ESVRzQ=; b=JoXyapuA2sOqdU7HqTp/qhFiVhAbSCT0vMPIZcZwJtUAU0dkCrZq3Ju+v7jAt4YCev E4x3Hh4CJujgjCy8pBZlFuGoGMwqe4WAhcoq0upcshS28OfCS76VXLQiyMsu93UrIpmN ZPlvJkUgzjIY7SIBKgskvJ6hBBN6p69tKezsBZycbVKxvC6wYom6HxgSk4nY1lsFMwLZ ZN21alsarhmSBc7CgjWjdDjG/Wj/hXyFs6o5+BStvuRWeD9cblICCYJbORP0FmughMLs wM2vCiyRLdBLsdff9BvpNesuxEwljmuqbH3N0HjkgfUg0ORSf7hU7SFMFuB/FQK9oWD7 H20A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=L7q2sisR9jXPO2g1tObtbxm8Q6qrnHqWQnHO8ESVRzQ=; b=KtI72QhEU9TFvNnGoha6NDg7+vxuewtRqtpDFE6xG3k+mGzCdcoUNZ52SJClCqNLip Qn/Sw62RhJksrKHRAF81FLiVuTQOJoCz7Cr1AZ6rlxtE9Y5SVjYhpRuSTpPMyiWcI9Vr /6jqMJbirfRZS3WIlCfU9Lx9DE+0h12njtkJecGvx63LYOAzPlCJDS1UaOzn21/CjP4R jGWAcYPy7mU1J6aMqpasO7a+2JnmR8IraGw+eJ1GkM8oCWUAwYs6YCj795G4ZABMedwd xMmbRCXLskCBa9asBcdmqDW6Cf9sIjdgeJ+45SvCv+o5Y6+fm5XsF/+k0Gule8cxcWJw hr9w== X-Gm-Message-State: ACgBeo16ZLiON4sI5aMcKTcrJUKefHyZdfxbsAfa99S1CER/JoEv17At tyjXUnQjxhsZODYvCTmf+tQ06uAla/0pwtj4 X-Received: by 2002:a5d:4d12:0:b0:226:d878:e096 with SMTP id z18-20020a5d4d12000000b00226d878e096mr23055546wrt.377.1662409389551; Mon, 05 Sep 2022 13:23:09 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:a5c0:5a80:d0ad:82b5:d7a4:c0a9]) by smtp.gmail.com with ESMTPSA id m14-20020a5d56ce000000b00226d238be98sm9472404wrw.82.2022.09.05.13.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 13:23:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: f4bug@amsat.org, qemu-arm@nongnu.org, pbonzini@redhat.com Subject: [PATCH v3 6/6] include/exec: Introduce TARGET_PAGE_ENTRY_EXTRA Date: Mon, 5 Sep 2022 21:22:59 +0100 Message-Id: <20220905202259.189852-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220905202259.189852-1-richard.henderson@linaro.org> References: <20220905202259.189852-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Allow the target to cache items from the guest page tables. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- include/exec/cpu-defs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index 5e12cc1854..67239b4e5e 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -163,6 +163,15 @@ typedef struct CPUTLBEntryFull { /* @lg_page_size contains the log2 of the page size. */ uint8_t lg_page_size; + + /* + * Allow target-specific additions to this structure. + * This may be used to cache items from the guest cpu + * page tables for later use by the implementation. + */ +#ifdef TARGET_PAGE_ENTRY_EXTRA + TARGET_PAGE_ENTRY_EXTRA +#endif } CPUTLBEntryFull; /*