From patchwork Thu May 1 21:20:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 886387 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp519120wrq; Thu, 1 May 2025 14:22:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYV517YsPJAoEtBHqn1En4z3FqInBoZIz4cGGFhIf0nHKOPJwCCdBbUTuHEeMmWE5tTwbnrw==@linaro.org X-Google-Smtp-Source: AGHT+IEEQPLYQPRPDU9m8yjUM3vXA1iiEDJ3rDbK8pQCGreoS272QFGK+I3CKXtlzsqoz7FZE3bK X-Received: by 2002:a05:622a:5a8e:b0:476:c666:d003 with SMTP id d75a77b69052e-48c32fbb3a8mr8147181cf.43.1746134523009; Thu, 01 May 2025 14:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746134522; cv=none; d=google.com; s=arc-20240605; b=KwamDRTznzlvidGGteNgv1CmrzfVM8Ie9+U9QSk65jKvAE6Yhy+65uk2rKXqL22+EO i8HgkoY4r1vgRWvR7K8FiLQNyVXnYkmqBH9e2RoqYSvF0eOKhHRpL+NNj25qf868ssy+ 0WU6PbSk8Vwni1kcgyU5u3qfZn81JXpOjpp5lMyffI9sjNX9d7StN3+xYPVQfOwoN8se bP6iME0Gf+6c6wd0Z/qnA+/XleUa9FRBZIDiMxRBPShMS4mBQBBi5AiwAkQUGTltuEEL katInS3IeLcH2hsLam2YhlV9sdOd2AqUL87oQGQJHV86VQAN+8NgC9+h1P/hHR3ENMTS O29A== 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=NyHS8JhkVggJWYCLf21RFoGh3DyPnGZlHWJduulHrvM=; fh=i/pWNGcx7KiR3ewgypxpPkuORYlkCnVXLqKVm9/UgNc=; b=BPtOEfFwkdcv+p/QMXL9vGxVf4lVniIbdYJU39JI+mfUayUiJz4q29QXmFCCLvxSkp uKSM6PPJEZeFKOblZPoFCNau3qg6MFAwOaG8dMxVYt0s+nL85vsAclEGks71M2itp/55 2x385OF7VN8inauP2hIxahX+CHN/lj6jbC3KOgd/eokakI6IBvwPBjJX0c/uxpV+vM5h AU7TFPuYU4vxg2tVpKaGKnntChnPw4HbL22f5tNVmsqZ6X1bOaRpHUHQMrQrxsLyb9iM 1jNhOjxxs0QyfCbju8q+gVMYk3FZ9Cjt7Y70PTk2srlHH4xdm495NV5fmvF10Yl+gmfb WrmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RV95qriS; 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-48b98d11ecbsi14006251cf.545.2025.05.01.14.22.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 May 2025 14:22: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=RV95qriS; 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 1uAbLc-0000q1-TO; Thu, 01 May 2025 17:21:36 -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 1uAbLM-0000k7-Lk for qemu-devel@nongnu.org; Thu, 01 May 2025 17:21:21 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAbLJ-0001Qi-LP for qemu-devel@nongnu.org; Thu, 01 May 2025 17:21:20 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-301918a4e3bso1614363a91.3 for ; Thu, 01 May 2025 14:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746134476; x=1746739276; 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=NyHS8JhkVggJWYCLf21RFoGh3DyPnGZlHWJduulHrvM=; b=RV95qriSx30MWvHTFE+UBNYpRbsgNiP2BlxrrLRXBVro3YtxtOoZ/vQH6T0SR6kZw3 29b+E++cndCxvJ4eEap40VMHGvA2gUeGvpQJ64T9bDUIoVtqzdsi3YwfBEPHD/rt8e1z u2O26vWoIw2xKXKvbh+1VTZ4/iFxMAl2IF+aC0HPvX3YR9fWbiH9pYhWiZben4aWiFxY fLIFbTY4Z7FSHlZAiBnX9ijlcpEdP+OVuXN6A5d0Px3w+3gfOJFi6in9jKmRd8i6d2Jm 2WF1ZLyQSfWrZSWnnEK1Hhyq5iHXUNe47hAV7jVGkwn8T8XEg2vcx1N/qYRKtOi9/Xlx /06g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746134476; x=1746739276; 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=NyHS8JhkVggJWYCLf21RFoGh3DyPnGZlHWJduulHrvM=; b=pG9T9Jnv5D1Z7BBNanI0K+bt9XaY0MOy188nk11ivXMyFcCzQl9m5VFdo0IJGBw5BE ZkFJ4EoOblKfZZGFVbHme0K4CdnP0WhzD29OMeNVu8ZL+ofX4CWbgRaDOqOtlf9PFu0T IDWcvdjzxV4xEYVbYcnZg+J9NE5A2jqDlBogS5XM0KTFwaSu1YTV2t0yt1yl1u0qsmLT nSpc6AvFLOvvAnIWRi8gaRfddhP5kR0BOePPDtzf+ClS9YLFkI6gWYLEw7frZWizb/Tr 4olyu1DQJ1UCGZRqaqjZPZtBGXs0V9Ll4ziVxzo8LGOOUgEXgllWbOHxTG5ZZ56M5VbP IODQ== X-Gm-Message-State: AOJu0YzcgIYnAYl4+7f0tr2QulHd+IJ4IZ9to3EQZSgIDI+6P2VBtCM+ yrEZrLEqq62dkHToJrUr41sFoNAAu6ut6kNdU2g8udEBa/yA0aOKSFNSOLF/NCVQHUkBIsHiihU U X-Gm-Gg: ASbGncu4X/Jw/o3F928fXW/wD4DouW86MpPitXKiuJo3rytoatC2fYLy2gvS5g+hkH1 stNWdRgqV/9w12aeAT749znwekmTZZKBVaoNMGgJ+a8Yl5D68OMYU4vaAx7jOlDJUT8cDQ3JSCY Xk5YyC1LTp1cbuWgwNlFd56wF+P2SXItp+3R7ciZ5x9szWFB2eoB6ZJZqr1YAjk6oPIiwYSrfBs AQ6QikcLMVtsdv6aHax8Vz4VBHCQ4Avu210k2VM+s4SbP0OeLH8uD9gHRUI9sIAwldHHYNQF7g7 TKlmfdtQtv7uag7Cs8wqJyd1sMvBl9tUkMsN8cenXht3LLs+GfD9eFJXlrJ+sdHNBjtcVZI1Ows = X-Received: by 2002:a17:90b:53c7:b0:2ee:8427:4b02 with SMTP id 98e67ed59e1d1-30a4e69e8b9mr896905a91.28.1746134476100; Thu, 01 May 2025 14:21:16 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30a476267e0sm1384573a91.39.2025.05.01.14.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 14:21:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 02/59] accel/tcg: Add CPUState argument to tb_invalidate_phys_page_unwind Date: Thu, 1 May 2025 14:20:16 -0700 Message-ID: <20250501212113.2961531-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250501212113.2961531-1-richard.henderson@linaro.org> References: <20250501212113.2961531-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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 Replace existing usage of current_cpu. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/tb-internal.h | 3 ++- accel/tcg/tb-maint.c | 8 ++++---- accel/tcg/user-exec.c | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/accel/tcg/tb-internal.h b/accel/tcg/tb-internal.h index 08538e2896..1078de6c99 100644 --- a/accel/tcg/tb-internal.h +++ b/accel/tcg/tb-internal.h @@ -50,6 +50,7 @@ void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, uintptr_t retaddr); #endif /* CONFIG_SOFTMMU */ -bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); +bool tb_invalidate_phys_page_unwind(CPUState *cpu, tb_page_addr_t addr, + uintptr_t pc); #endif diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index d479f53ae0..714dcaedc9 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1045,7 +1045,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr) * TB (because it was modified by this store and the guest CPU has * precise-SMC semantics). */ -bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) +bool tb_invalidate_phys_page_unwind(CPUState *cpu, tb_page_addr_t addr, + uintptr_t pc) { TranslationBlock *current_tb; bool current_tb_modified; @@ -1083,15 +1084,14 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) * the CPU state. */ current_tb_modified = true; - cpu_restore_state_from_tb(current_cpu, current_tb, pc); + cpu_restore_state_from_tb(cpu, current_tb, pc); } tb_phys_invalidate__locked(tb); } if (current_tb_modified) { /* Force execution of one insn next time. */ - CPUState *cpu = current_cpu; - cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); + cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu); return true; } return false; diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 90b345a0cf..39b76d9654 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -749,7 +749,8 @@ int page_unprotect(CPUState *cpu, tb_page_addr_t address, uintptr_t pc) len = TARGET_PAGE_SIZE; prot = p->flags | PAGE_WRITE; pageflags_set_clear(start, start + len - 1, PAGE_WRITE, 0); - current_tb_invalidated = tb_invalidate_phys_page_unwind(start, pc); + current_tb_invalidated = + tb_invalidate_phys_page_unwind(cpu, start, pc); } else { start = address & -host_page_size; len = host_page_size; @@ -772,7 +773,7 @@ int page_unprotect(CPUState *cpu, tb_page_addr_t address, uintptr_t pc) * the corresponding translated code. */ current_tb_invalidated |= - tb_invalidate_phys_page_unwind(addr, pc); + tb_invalidate_phys_page_unwind(cpu, addr, pc); } } if (prot & PAGE_EXEC) {