From patchwork Sat Oct 5 20:05:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832992 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1338494wra; Sat, 5 Oct 2024 13:07:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVWn1JkUdqlN/JWiyahxPHXzMAvE7FEO+3pUKFaoG1MqF2XYW44aJmtYV0d4CkrtCpAmTxyWA==@linaro.org X-Google-Smtp-Source: AGHT+IHLV0xijXW7yvWG1fjljs0tk1Z3EqL6hnRZVsohsmPObYLN22/1uUruvG+Zr+6N/8CXHOQV X-Received: by 2002:a05:622a:148b:b0:458:4e4c:b692 with SMTP id d75a77b69052e-45d9ba7a0eamr105121291cf.36.1728158836568; Sat, 05 Oct 2024 13:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728158836; cv=none; d=google.com; s=arc-20240605; b=WK0F0JTHbhbWcUNB2a/p3z2Vtu5ftjxBQnU2TKNDQWoe8/JGUhwpXRbcdmQRZHMJBL H9ZE0v8mgQT0yJ3zjpZ7KMCZbjbKsTt9Bmt+ZjSqOai7nxERNZ7aI/rhf5grH61HzEH7 ZQyj1OYc4BGNL2dObFbIDl0VDIY3F1QHAWqLViaiPFSfIeHFHR/RMvnP8fobD076jvvp STvEKjzcdNgyUcTIkf/+Pj9msDvddGqSEsSisIosU6slmOqv8do4in33o2XAXhPqhFad pXhW4mxc8DLJMdfarudnVhH8xsnkgxNff6JPDUxYgZP6qaXdHXAoy5Yem5PumwOXRll9 5iqA== 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:cc:to :from:dkim-signature; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=bxvXfjNUPBGg3MCrXapJoS1p/jcPnJlCzq/CpoqZg55lQDi6vezDBCy5V8/YFkjBgV Gdf7rMYxgiF47Tv8eE0tlpQrzJzeUEykeBU0EHs4VvFBjQ1duuUoGL5PdRTBFjCrSxtP 8LbAIlYmvwz1wdpQESbI5NK/c82nCH3pHQhYavdv2hAWa/C3JC54WeZqTJe2wqBvy62t 5H+RwglISQxYjiwFB57m2fdobvKnmsoSDtu/ktX3yA6Yts7eU9hJkGSMF7sv8a9oPBTJ 1zE9KXDXIaxgdK4JKHB+PUUcrrXLg8xPSwC3YJtZA9geg+aWYGoL7YOmdLXtyO3P6igu /5bA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w7Ph5oXb; 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 d75a77b69052e-45da7699719si26773521cf.615.2024.10.05.13.07.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 13:07:16 -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=w7Ph5oXb; 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 1sxB2W-0006H3-Tv; Sat, 05 Oct 2024 16:06:08 -0400 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 1sxB2V-0006FZ-2v for qemu-devel@nongnu.org; Sat, 05 Oct 2024 16:06:07 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sxB2S-0001i2-V3 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 16:06:06 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20b7a4336easo23470725ad.3 for ; Sat, 05 Oct 2024 13:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158763; x=1728763563; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=w7Ph5oXbphrI33DJh2gZ+NAMDp1REDdK1OGGIscgeI+e64d8bFb0ckjv3N0yrc6uth g5soY0mosslNsohrW3QahAuWlAIZd7Sg4NjMFROQdBQlcmTYVxVdhI07BXg7Pbr9HZgk d3/HIh561IO/9bNT1aNkHzr2raI9fDldZHhIqFCvgRZztAoqu5V01U/AsgTvRY7WWqPi iI7zW4kZ2tlhxLc9OtgRLC0IFs/JKB+W+/Hs93o+dDVcvHOCrpaAvRvSTlAQFJBpv7ej PsUyDmNuiQqy6xNdpYr5i2eiP8XBkx7Ahof90gcjf/4SlZQrJdBtPU7jff4HLIKzOB1j O07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158763; x=1728763563; 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:message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=lFycWNK9abbL8kLJlG5ufkpcBqbrC13T53K3ZuL0uPZVQU6kmtPysHGSwHAA0CJgHz HCkQWZRkUWma8/3AXlUcabtfqv5T6fUtVEDkKGkwp0l1NZq9RbEsvHmwpQOsr7Vd1H3M WUNXFsgnks1Kpln1BceYLt9a9WqjJ9lg2poKHuKB5A3C3S46cPCL0ZfaDAb7xrW2zm6V wneCqoY2xxDrjRaul285eTJLvXDWHW2L6mGGjiwBQ2un1HzDOeluGjIvuCIBFHJKw8aJ qOFu18pJv/XcU6j3uenQnDy0elwqMcA/HTLoLTku+kLMlAet4MTMnLOCx0PvC9nLo9Yf QPCg== X-Gm-Message-State: AOJu0Yz4YaJWlceqtDSVXjj++Wgok5C3Ra46+A6q1dXxU9XqZHru3BwK AK2g5WtscgtlZqjb1Xr0PQYxc02oXuVY/Je5jpz69N2MkXGaeG6VS2VE7zJe5Q8dqG+v+O2gh8X U X-Received: by 2002:a17:902:e5c6:b0:20b:6ede:5b1c with SMTP id d9443c01a7336-20bfdfeef3cmr94363425ad.25.1728158763513; Sat, 05 Oct 2024 13:06:03 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 02/21] accel/tcg: Expand tlb_fill for 3 callers Date: Sat, 5 Oct 2024 13:05:41 -0700 Message-ID: <20241005200600.493604-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: Helge Deller Reviewed-by: Peter Maydell --- accel/tcg/cputlb.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd6459b695..58960969f4 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1220,25 +1220,6 @@ void tlb_set_page(CPUState *cpu, vaddr addr, prot, mmu_idx, size); } -/* - * Note: tlb_fill() can trigger a resize of the TLB. This means that all of the - * caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must - * be discarded and looked up again (e.g. via tlb_entry()). - */ -static void tlb_fill(CPUState *cpu, vaddr addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - bool ok; - - /* - * This is not a probe, so only valid return is success; failure - * should result in exception + longjmp to the cpu loop. - */ - ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); - assert(ok); -} - static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) @@ -1631,7 +1612,10 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, data->size, access_type, mmu_idx, ra); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, data->size, + access_type, mmu_idx, + false, ra); + assert(ok); maybe_resized = true; index = tlb_index(cpu, mmu_idx, addr); entry = tlb_entry(cpu, mmu_idx, addr); @@ -1833,8 +1817,10 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, size, - MMU_DATA_STORE, mmu_idx, retaddr); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, + MMU_DATA_STORE, mmu_idx, + false, retaddr); + assert(ok); index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); } @@ -1848,7 +1834,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read == -1)) { - tlb_fill(cpu, addr, size, MMU_DATA_LOAD, mmu_idx, retaddr); + cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, MMU_DATA_LOAD, + mmu_idx, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for