From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857772; cv=none; d=zohomail.com; s=zohoarc; b=CKoR8b5UOV2vxy3VNmcFTtxjib+mAIlPN1l5EQuR+Z50ohhi6Or9wHGuh6a60Phq8Ve2CuaAtjVQWdvdiyjc+6U+ZR99U6918OpEFAJQVos1UXrLFmrUeFHu5j+5Krg5hU7ypVNWX/BjnAeF8QyZQjQfMvIpWd22wM0Hd6noahs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857772; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S3nhJScpyOxwK6cYED3CCWJGrT05YK1NUQh3o/GeSgc=; b=UBtugLIm0vT2Vaez99Lrm0mG2wBXrq23Sdk15kAeczIvIO1BaaRSwkYxV3hGjy/hw38iZczw2UN3Weua7feUPaGVJ2Qci2QBgsPmPtkNYiE37rcS5uNL8z1qsjn5emuFUyzXwKJ/N3viUmTFiPXxQXhxgKRLQVsUaT9Mb/btHaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857772159914.4616253644683; Sun, 13 Oct 2024 15:16:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pO-00075z-Av; Sun, 13 Oct 2024 18:12:42 -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 1t06pM-00075c-RV for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:40 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pL-0000tJ-7s for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:40 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2e2eba31d3aso1725591a91.2 for ; Sun, 13 Oct 2024 15:12:38 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857557; x=1729462357; 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=S3nhJScpyOxwK6cYED3CCWJGrT05YK1NUQh3o/GeSgc=; b=ZRkXYAATbzk5Z/ls0O8pt41gPwPhD8HTRwldmJDy90KhT57aqOih1BNdt9GLcdX9EN nxyr8G3q4ieuoeB5Oo0eKZ3ySo6W7D9YvYO7zX7CAUxYFq6D5s3WsjLqG99Zm/wyO/vx +7DaXp0nKO2jr8PeHLwB5jEIqrc2h/yvtDQXJI6j0imH6RoHtxjpi2Q36DmdVb0CyayY Auzklo8IzQTMMoCV/weMYwSXH7OCT6HlyDGX/cAzB0e62/HfHEV4OIa3kOsZxzI03QYW Tw4h/SZiffCjfG9E+D7c3sXsvogl9+Nos7FgYE3LjXVcwYb4NejhfS/1YKRjYuGcimvW 5pPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857557; x=1729462357; 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=S3nhJScpyOxwK6cYED3CCWJGrT05YK1NUQh3o/GeSgc=; b=gOtxc5neBUZ3WuW2xJPo8DqvYxampjpYLyChIIM5g7+iMP0af6kKNxZ9mP1SghFAaa yE/Pk+TZs6B1h7fKjzbvcFBK2PvCT8936hjtyZ2Uh/yDIupJc4F1W9e9Ds7VAAuAVcUT uRriOpI2H0uyryri3vEKljgS16C46ggzSqkqlKU9k8P/0F8ao2OMc9qVcVAfGXVySR4J 34xm1gE6eAPP2vEDlnMt7ggcs4aIyW8PrrZe351TEGS1bnfUSb2H/vLt/iaxKihVUeoL Z7xS90N4VZC5NhWeAdP5OxEqxrpLzf9mZzs2de10VRVHIRQL9yjHtSS953zX5wvBH05c DzvA== X-Gm-Message-State: AOJu0YyqYGsRtqAba1L9T6ggC/qEU1hDB1nV1hpSevpEc5CNqnQdowVQ 4u+cO7zcDCyFrsoNihSJfkEVlfPAe5NqY3rd4cskoA8ppAzm2fhJ8/X5ZDrT0CnQ2FNFaTOKmpM H X-Google-Smtp-Source: AGHT+IEXQyFHIY9JFPHVYpiYRRu0cES1eWI2ueT2X08k0LPuxzR3Bh2Ut2TUHWXYxoxX3tBCsUTZag== X-Received: by 2002:a17:90b:46d4:b0:2e2:cef9:8f68 with SMTP id 98e67ed59e1d1-2e2f09ee5cemr12735384a91.4.1728857557511; Sun, 13 Oct 2024 15:12:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PULL 01/27] tcg: remove singlestep_enabled from DisasContextBase Date: Sun, 13 Oct 2024 15:12:09 -0700 Message-ID: <20241013221235.1585193-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857774138116600 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini It is used in a couple of places only, both within the same target. Those can use the cflags just as well, so remove the separate field. Signed-off-by: Paolo Bonzini Message-ID: <20241010083641.1785069-1-pbonzini@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 -- accel/tcg/translator.c | 1 - target/mips/tcg/translate.c | 5 +++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 25004dfb76..d8dcb77b5f 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -71,7 +71,6 @@ typedef enum DisasJumpType { * @is_jmp: What instruction to disassemble next. * @num_insns: Number of translated instructions (including current). * @max_insns: Maximum number of instructions to be translated in this TB. - * @singlestep_enabled: "Hardware" single stepping enabled. * @plugin_enabled: TCG plugin enabled in this TB. * @fake_insn: True if translator_fake_ldb used. * @insn_start: The last op emitted by the insn_start hook, @@ -86,7 +85,6 @@ struct DisasContextBase { DisasJumpType is_jmp; int num_insns; int max_insns; - bool singlestep_enabled; bool plugin_enabled; bool fake_insn; struct TCGOp *insn_start; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 113edcffe3..cbad00a517 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -129,7 +129,6 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, db->is_jmp =3D DISAS_NEXT; db->num_insns =3D 0; db->max_insns =3D *max_insns; - db->singlestep_enabled =3D cflags & CF_SINGLE_STEP; db->insn_start =3D NULL; db->fake_insn =3D false; db->host_addr[0] =3D host_pc; diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 333469b268..50d8537a3b 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -15362,7 +15362,8 @@ static void mips_tr_init_disas_context(DisasContext= Base *dcbase, CPUState *cs) * hardware does (e.g. if a delay slot instruction faults, the * reported PC is the PC of the branch). */ - if (ctx->base.singlestep_enabled && (ctx->hflags & MIPS_HFLAG_BMASK)) { + if ((tb_cflags(ctx->base.tb) & CF_SINGLE_STEP) && + (ctx->hflags & MIPS_HFLAG_BMASK)) { ctx->base.max_insns =3D 2; } =20 @@ -15445,7 +15446,7 @@ static void mips_tr_translate_insn(DisasContextBase= *dcbase, CPUState *cs) * together with its delay slot. */ if (ctx->base.pc_next - ctx->page_start >=3D TARGET_PAGE_SIZE - && !ctx->base.singlestep_enabled) { + && !(tb_cflags(ctx->base.tb) & CF_SINGLE_STEP)) { ctx->base.is_jmp =3D DISAS_TOO_MANY; } } --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857705; cv=none; d=zohomail.com; s=zohoarc; b=JD8oLqsKhY0YQh1e/gayynoEij0A/u5pxY07/mLwbqmmvBRjPTdC91BYqePDbFEkGchoMfy+KepGIAzYLlXytpcdEgeYzqA09w/3TEqJTDONxDCKrQyE/XqAPU6jaZvB6UmtHMgTG4v2vWNskJPKxlz6AWElVPgW7KE+U27N+0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857705; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nYSXn25U/DdvMWs7SvnxnC83hyNQjHsWrN+gaiP3cZI=; b=NbFcAx2p4doNwMImK2g123/Z8DX/IYqJDGv2R9bklV+3DmMBup8TylPOArp2c0FRYdNQng1tkBkCmhHWBK1GUwgEHIpEK0R9bZSmglPPtN5AJU0ZmWoKYTpJTZKxdtLTNiDFsxrzmzNLkULGk4jPCbtEXspzh2PKWw+yvVPg9As= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857705681713.3909051087977; Sun, 13 Oct 2024 15:15:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pP-00076x-UY; Sun, 13 Oct 2024 18:12:43 -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 1t06pN-00075l-Nc for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:41 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pL-0000tP-TH for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:41 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2e28b75dbd6so2583705a91.0 for ; Sun, 13 Oct 2024 15:12:39 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857558; x=1729462358; 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=nYSXn25U/DdvMWs7SvnxnC83hyNQjHsWrN+gaiP3cZI=; b=UV4A9fMgJH/jdrRHSRj8PwGHaoW3ecn5UDdiGCMiutCQ24/5si8HLA44cPyiDPxScT B9Q/3Hy2y2gaOV+WKee6YjWCfKVRm5JRJCUnFQ/YUvKqGF5TurWhO+tVpsq6JKJDoQjX 1JaEdXW3MWeaKv7A7bTh03Ql0BkDlmU1386qiBANR69g50Sfezqzt8VT18/jhmkvOH7V jv6yvzLp6r5bYQTdednxGLGwAsvmiZWhGZsE0tdnaUO2GKRAZsKzmQILrwWbSVkTUTZG cKRd5rzZjBTXxO7d7Gqv5oYvqd/F+GbsToxmiqiejLfMcG5QF0aVWuTO27H4p2/De1o0 20kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857558; x=1729462358; 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=nYSXn25U/DdvMWs7SvnxnC83hyNQjHsWrN+gaiP3cZI=; b=XhYb1MS/GdrnIiAEsj/s1KJTt5Rf35pQN1mNbIFTDKimXF06gL/GXPsKEy8nIoW2G9 AjqcWDCuQGruWnpt9kKEKWRS2jXtqq+eJikCzCvzS/t/fXldF4U8DOioBrFuoDZegNci C2RtAqDPX5wtScd7fWpmefahJEejf4+b0w4MFW38PLoTpCtxgtPQRVtk2lQyjptJ6yQR ynJgcPjrc+ihJE59lAfNClCKJpPd3PcDzorr2xzb2l04js1ZGnJCeStmgLF9WPLV1uRS o91sbcQUVYzR74850Ae4qkcuYTOLxa+soAdxEG9UWr6oB6/vJT4o6NQQDz+VZthS77/C 0Nfg== X-Gm-Message-State: AOJu0YwPROWWoPLIyrtTO5/n+SYcJWysBR97jufphgyxWlloCGl41TCe WkRmY1Y887TToXlet9IMmItYjPHZUKX03EiNEEmO7udNAw0MNjHtWcyevwZgW+Ed17UeJTML0yS 0 X-Google-Smtp-Source: AGHT+IE5+Grwiy+ST/5h5mjr6hl+1ON7WEkhh/uMXn2/NHYZUHnpujPHANZdm17PKAtec5QmcVtdmw== X-Received: by 2002:a17:90b:390a:b0:2e2:af0b:8f2d with SMTP id 98e67ed59e1d1-2e31536de5dmr7803911a91.26.1728857558447; Sun, 13 Oct 2024 15:12:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 02/27] include/exec: Introduce env_cpu_const() Date: Sun, 13 Oct 2024 15:12:10 -0700 Message-ID: <20241013221235.1585193-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857705857116600 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich It's the same as env_cpu(), but for const objects. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-ID: <20240912093012.402366-2-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 13 ++++++++++++- linux-user/elfload.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 2e1b499cb7..638dc806a5 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -238,6 +238,17 @@ static inline ArchCPU *env_archcpu(CPUArchState *env) return (void *)env - sizeof(CPUState); } =20 +/** + * env_cpu_const(env) + * @env: The architecture environment + * + * Return the CPUState associated with the environment. + */ +static inline const CPUState *env_cpu_const(const CPUArchState *env) +{ + return (void *)env - sizeof(CPUState); +} + /** * env_cpu(env) * @env: The architecture environment @@ -246,7 +257,7 @@ static inline ArchCPU *env_archcpu(CPUArchState *env) */ static inline CPUState *env_cpu(CPUArchState *env) { - return (void *)env - sizeof(CPUState); + return (CPUState *)env_cpu_const(env); } =20 #ifndef CONFIG_USER_ONLY diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 52c88a68a9..352960b771 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4314,7 +4314,7 @@ static int wmr_write_region(void *opaque, target_ulon= g start, */ static int elf_core_dump(int signr, const CPUArchState *env) { - const CPUState *cpu =3D env_cpu((CPUArchState *)env); + const CPUState *cpu =3D env_cpu_const(env); const TaskState *ts =3D (const TaskState *)get_task_state((CPUState *)= cpu); struct rlimit dumpsize; CountAndSizeRegions css; --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857613; cv=none; d=zohomail.com; s=zohoarc; b=Dv2pyPdYcY+gfHOSJlHSNFutuAqoMbrl04399uRLgGy5/jWa1JzgFNFJ857xOMdezsXA5cefjtOMDxjcFXtytLhy0tjurahTGm9uxevNzUHmQeUQpK/PWcVTPak26JUgoTeZsLCophUhXaOEcpbJZxqN7OBYEPy5RmSCWW1/O4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857613; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=P8UtO3iFeY9lIilr4u+dWsz4U2zyzDHMfO1R07G1hdY=; b=CtCufZ0VtpBxFOtCVQSUee2JCPYQ8OFJ4NXWUjmasYhRMbN0vgG9y0L/DO10Zau5KKMQwVnj/J05REKssxBRp4riLLjOKgnZsjDORI6Lt4vtjs0fpKYa/y0t5qSvMlFCL6bzd2VWT9j4NHD0P/6sSFahwnyZ6g16bamSH14uRmU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857613076299.92086835056296; Sun, 13 Oct 2024 15:13:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pP-00076v-O2; Sun, 13 Oct 2024 18:12:43 -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 1t06pO-00075y-7Z for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:42 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pM-0000tU-KT for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:41 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2e2ed2230d8so1716369a91.0 for ; Sun, 13 Oct 2024 15:12:40 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857559; x=1729462359; 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=P8UtO3iFeY9lIilr4u+dWsz4U2zyzDHMfO1R07G1hdY=; b=jRs7SHdqvx1EQKj0LQpWGCKvLcEyGNNTShyaLCjpyHi50E/OYZjTKxZucs302MTIux 8lPvYFhwo97usz6m3n56DgdW7swXWqYoar7s8ZhlpG2j/RjneFNablGy7CgIAoUewZsS S5jQV1V9FHZwsUE5GaXIfrc9lKWUNSTYHmxSN6Go71YDKrl3du7oPQeS1IwkiNIBYMOF RuLv0NVQTYahtt2BbIA1Tjfd/8VV2Su6yEqcNaRTv/l70dnYQHZVXwFU8W556YPHYe7I qYt/0TLpS7M11JY6Fov66kjjvzOYZf90wJEKqaWu/4Q0J1dA8B35gR8fPVmoaRjApb9/ a81A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857559; x=1729462359; 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=P8UtO3iFeY9lIilr4u+dWsz4U2zyzDHMfO1R07G1hdY=; b=D/OjQYlqwTjNIc1AyGHaKuihXzOBDjLNBviEZvvpcmPEtTG8XWanUTKil07D+EDUZp k7znVXiqGCgeubw706u/Vngg4DB5ZaBj34sTvBK4lwqvvRIbdqkutKOfbzFFDTGlxt+o +rYzmW0cZPcHR1HP3wIouvhQLabOgrihK02u6Ynv/0BrnnYLDHCOMGnZ4UltT/SNQmdy t3oxZBoo43aj5fr57nqFcij0LQUe6kKSdViSluXHw9zTBqfWBPYmZ+4oRunFwhuWwsYq LoPHdIkjoDTb/Emz9zMeSamfyNtLkhoi/aINxtNs8u2AIk/2Ie3THPzOHjSzTkW1xy7T OKXQ== X-Gm-Message-State: AOJu0YzpUBhxVM3GeNOwBstR7TVfQfVptbtcFbL5DQwOs88UFaqK8MV8 PkXZjwYHRPp50iIJ9PorUvKolcxbH3XngDtm6VmQLrpaGt94HrL9xbvxBZJh8jVgR5wlKKHhWvx T X-Google-Smtp-Source: AGHT+IGwAmG/FeJEzj828OJZ49kZ2mPr27NKZkudX36VAC1y4TS3nbdbRZ8jGUnUvzUQzmoVLmBSLA== X-Received: by 2002:a17:90a:7402:b0:2e2:b513:d534 with SMTP id 98e67ed59e1d1-2e31536f287mr8547619a91.37.1728857559254; Sun, 13 Oct 2024 15:12:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 03/27] linux-user/i386: Emulate orig_ax Date: Sun, 13 Oct 2024 15:12:11 -0700 Message-ID: <20241013221235.1585193-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857613767116600 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich The kernel uses orig_rax/orig_eax to store the syscall number before a syscall. One can see this value in core dumps and ptrace. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-ID: <20240912093012.402366-3-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- linux-user/qemu.h | 4 ++++ linux-user/elfload.c | 4 ++-- linux-user/i386/cpu_loop.c | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 98ad848ab2..895bdd722a 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -113,6 +113,10 @@ struct TaskState { struct target_vm86plus_struct vm86plus; uint32_t v86flags; uint32_t v86mask; +#endif +#if defined(TARGET_I386) + /* Last syscall number. */ + target_ulong orig_ax; #endif abi_ulong child_tidptr; #ifdef TARGET_M68K diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 352960b771..6cef8db3b5 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -203,7 +203,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *re= gs, const CPUX86State *en (*regs)[12] =3D tswapreg(env->regs[R_EDX]); (*regs)[13] =3D tswapreg(env->regs[R_ESI]); (*regs)[14] =3D tswapreg(env->regs[R_EDI]); - (*regs)[15] =3D tswapreg(env->regs[R_EAX]); /* XXX */ + (*regs)[15] =3D tswapreg(get_task_state(env_cpu_const(env))->orig_ax); (*regs)[16] =3D tswapreg(env->eip); (*regs)[17] =3D tswapreg(env->segs[R_CS].selector & 0xffff); (*regs)[18] =3D tswapreg(env->eflags); @@ -306,7 +306,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *re= gs, const CPUX86State *en (*regs)[8] =3D tswapreg(env->segs[R_ES].selector & 0xffff); (*regs)[9] =3D tswapreg(env->segs[R_FS].selector & 0xffff); (*regs)[10] =3D tswapreg(env->segs[R_GS].selector & 0xffff); - (*regs)[11] =3D tswapreg(env->regs[R_EAX]); /* XXX */ + (*regs)[11] =3D tswapreg(get_task_state(env_cpu_const(env))->orig_ax); (*regs)[12] =3D tswapreg(env->eip); (*regs)[13] =3D tswapreg(env->segs[R_CS].selector & 0xffff); (*regs)[14] =3D tswapreg(env->eflags); diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c index 92beb6830c..7a35215278 100644 --- a/linux-user/i386/cpu_loop.c +++ b/linux-user/i386/cpu_loop.c @@ -172,6 +172,7 @@ static void emulate_vsyscall(CPUX86State *env) /* * Perform the syscall. None of the vsyscalls should need restarting. */ + get_task_state(env_cpu(env))->orig_ax =3D syscall; ret =3D do_syscall(env, syscall, env->regs[R_EDI], env->regs[R_ESI], env->regs[R_EDX], env->regs[10], env->regs[8], env->regs[9], 0, 0); @@ -221,6 +222,7 @@ void cpu_loop(CPUX86State *env) case EXCP_SYSCALL: #endif /* linux syscall from int $0x80 */ + get_task_state(cs)->orig_ax =3D env->regs[R_EAX]; ret =3D do_syscall(env, env->regs[R_EAX], env->regs[R_EBX], @@ -239,6 +241,7 @@ void cpu_loop(CPUX86State *env) #ifdef TARGET_X86_64 case EXCP_SYSCALL: /* linux syscall from syscall instruction. */ + get_task_state(cs)->orig_ax =3D env->regs[R_EAX]; ret =3D do_syscall(env, env->regs[R_EAX], env->regs[R_EDI], --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857777; cv=none; d=zohomail.com; s=zohoarc; b=bAA3BePxWEbeISVkehIh9DXKurrPupYBL1eCCPIFIhb14rKNXlGLF5Qwnp4019FUqr3knwf3VdeolkZxmqJxhbCUvFXrrpgaqFRt6/cCL12hPbgSdb+Bn2CZoLma6+G+w+o1U7/y0MtpBVmVYtdnWbieAEYpqCkMENAF37yRda4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857777; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HvIjzJygM9GXaQbwvZ4DDVniWBW4y8rSWWHM++5r4d8=; b=Vd5je9dKIgyRqQ5KpagS46GPyyQEM4ctFp63hh2miDmzhk7y4qpG4awYxSTZ/eTA4jYAUxw0FhHRUGSIH0ctxkYZAQhzpuRKGRcxEVEf4PQ4lZK39+2iHIRYsmt5295BH/K98OOIMjbNG4AIE+Y8C6+RJYXQJgFiPSEP1DLlPUs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857777720340.9161588607319; Sun, 13 Oct 2024 15:16:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pQ-00077U-Gw; Sun, 13 Oct 2024 18:12:44 -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 1t06pP-00076X-4W for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:43 -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 1t06pN-0000ti-D4 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:42 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2e30fb8cb07so1074818a91.3 for ; Sun, 13 Oct 2024 15:12:41 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857560; x=1729462360; 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=HvIjzJygM9GXaQbwvZ4DDVniWBW4y8rSWWHM++5r4d8=; b=MCSbN0vGBpp39O4DbjSYZpKBpDQcdIUxsB8piL2aUmJt+Jn1qfzgSUYmP+I3QFWS2H R9n0o2U0Ll5buFKCAQJVSzYu+JGc6OMjHUp0Sw2haxOw8qysQ4cv7I06Yrvf7deHqDyf dptfoCo/yh3Ip+7KaCQFM7Hb59WWIHB3Eu4vh/vPsTXEVLe6w/3kChO7o9jOSAiJkY6T 0/sQ1qjnpMYBGbiDyv8f9Vkb9/L+Pq4Sfw0T6ECpI7J9V8g0EOaHQbYFlW9z3bRgw59c Q2Y/43zHQ1Uo9t2YrsYSXq6xIyg3DnbcUMiWp57D+SNWt0WWtVNc6zt112bR0cESv5i0 ieuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857560; x=1729462360; 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=HvIjzJygM9GXaQbwvZ4DDVniWBW4y8rSWWHM++5r4d8=; b=T2vGjS5b4smum3S0AEXwFxTpyXkvALM638hotJycYccVlb5P2avR560d4EJGcOKDa7 5zcXTVm5k4ZFoQWKGrJEotMi/OA9QorFm90u00YW48rXJJqRgukXD0t+JnrN7BaldED1 bWugWmjK5t/dSmRDnfQl5fmroFwX2yrDjopcbhsdhfWvvcfFBpGdpMkJaUQMOQAy0ZsD cDvIExnIXDmbS77bGg5FluPOTIPDi2PRYt0JYwwxIZ1xoFqzNpN3Dc6WyhgGCD1jZnfl lfy9FFzoaOqiFxe4YrNCjUyregCayaVUEbMjV5AA1vMxKspG6ehNSinaUW5bhL4Cw2gN mJZg== X-Gm-Message-State: AOJu0Yy85TmEGkgMGEmfaaOBaGsjEYOqIzqyrgVIUq0SjoGN2TZ4uR5B UnZpa+qlDmVDeyo6W0pi2Hujb/joKKyc+DqbOInsnslfrH6ryueS+G6uCQZTz9+wHHOXyZdsR4l i X-Google-Smtp-Source: AGHT+IGF7Q6fFVCU1niAkh2cLm+98BGwRlsq39FJzFy4TlrNYj7PVFe2vmGuoQNPXLYNnUyF4DqkWA== X-Received: by 2002:a17:90a:67c6:b0:2e0:f896:b806 with SMTP id 98e67ed59e1d1-2e2f0d7aa36mr12236464a91.27.1728857560094; Sun, 13 Oct 2024 15:12:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 04/27] target/i386/gdbstub: Factor out gdb_get_reg() and gdb_write_reg() Date: Sun, 13 Oct 2024 15:12:12 -0700 Message-ID: <20241013221235.1585193-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857778203116600 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich i386 gdbstub handles both i386 and x86_64. Factor out two functions for reading and writing registers without knowing their bitness. While at it, simplify the TARGET_LONG_BITS =3D=3D 32 case. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-ID: <20240912093012.402366-4-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- target/i386/gdbstub.c | 51 +++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index 4acf485879..cc5eceeb7e 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -96,6 +96,19 @@ static int gdb_write_reg_cs64(uint32_t hflags, uint8_t *= buf, target_ulong *val) return 4; } =20 +static int gdb_get_reg(CPUX86State *env, GByteArray *mem_buf, target_ulong= val) +{ + if (TARGET_LONG_BITS =3D=3D 64) { + if (env->hflags & HF_CS64_MASK) { + return gdb_get_reg64(mem_buf, val); + } else { + return gdb_get_reg64(mem_buf, val & 0xffffffffUL); + } + } else { + return gdb_get_reg32(mem_buf, val); + } +} + int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { X86CPU *cpu =3D X86_CPU(cs); @@ -137,15 +150,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray= *mem_buf, int n) } else { switch (n) { case IDX_IP_REG: - if (TARGET_LONG_BITS =3D=3D 64) { - if (env->hflags & HF_CS64_MASK) { - return gdb_get_reg64(mem_buf, env->eip); - } else { - return gdb_get_reg64(mem_buf, env->eip & 0xffffffffUL); - } - } else { - return gdb_get_reg32(mem_buf, env->eip); - } + return gdb_get_reg(env, mem_buf, env->eip); case IDX_FLAGS_REG: return gdb_get_reg32(mem_buf, env->eflags); =20 @@ -248,6 +253,21 @@ static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sr= eg, uint8_t *mem_buf) return 4; } =20 +static int gdb_write_reg(CPUX86State *env, uint8_t *mem_buf, target_ulong = *val) +{ + if (TARGET_LONG_BITS =3D=3D 64) { + if (env->hflags & HF_CS64_MASK) { + *val =3D ldq_p(mem_buf); + } else { + *val =3D ldq_p(mem_buf) & 0xffffffffUL; + } + return 8; + } else { + *val =3D (uint32_t)ldl_p(mem_buf); + return 4; + } +} + int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { X86CPU *cpu =3D X86_CPU(cs); @@ -288,18 +308,7 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *= mem_buf, int n) } else { switch (n) { case IDX_IP_REG: - if (TARGET_LONG_BITS =3D=3D 64) { - if (env->hflags & HF_CS64_MASK) { - env->eip =3D ldq_p(mem_buf); - } else { - env->eip =3D ldq_p(mem_buf) & 0xffffffffUL; - } - return 8; - } else { - env->eip &=3D ~0xffffffffUL; - env->eip |=3D (uint32_t)ldl_p(mem_buf); - return 4; - } + return gdb_write_reg(env, mem_buf, &env->eip); case IDX_FLAGS_REG: env->eflags =3D ldl_p(mem_buf); return 4; --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728858010; cv=none; d=zohomail.com; s=zohoarc; b=jmTKnxqpd1a6vb2/mWGTcGwX0rEtd/uQq+nouvKeERJG7Y1czPUsR3UdOZ21iZHrrGxufWhO0outUn77JLfwI2A0i9Bq8wkPs+SMqzb3TDPFVQ8ZtjFvqnl7KOBjnC2cyHtqSgXMaTjDJ9mtSkDlKS3ViYGjUG3nBF8BTfXrTOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728858010; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t8ym6NLxoNvu+SOj1YsRaeOvfI7iJrafTEN4muCnoIE=; b=DGhf3NLYFTlSVM60y026xnTUh9EOBtNo9Y2wQoC5RgLGImTv795fi3cd395bkbGTijbeNv8reGTnN7fQ36eCsH+jU+s3wFDAepNqGHVMM2EpNFV/lhszX1FQrfqBQPKb/3Rz3fsh4DbMmTRCIF78WmkfPTX8lADi/6HRIjmNrU4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728858010943737.3149312385467; Sun, 13 Oct 2024 15:20:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pR-00077k-2N; Sun, 13 Oct 2024 18:12:45 -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 1t06pQ-00077J-75 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:44 -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 1t06pO-0000tt-CK for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:43 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2e2a999b287so2850979a91.0 for ; Sun, 13 Oct 2024 15:12:42 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857561; x=1729462361; 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=t8ym6NLxoNvu+SOj1YsRaeOvfI7iJrafTEN4muCnoIE=; b=PqXzSt9nkLrEQLmFXdYaeSzAtNrSSJ9aM3c5+Ohl8HPp2NH/HPuI8xQuiKe6urdXr3 Y/859erIANdDpfnjIoD6pUf4VeuTNPYW5PSGoSViQqws/qNCYvBvef/4FD/6JmJbe8Mq HQa2++Y5ZxamOP5OZ/v8il+EU16xgZB1F9JYhA9jfUGhlYT+rPgyjXvDcxJA+tx5sa5D MPN4kGM6OePuxcQ6xmL2nCFaS/Tee+S6q1qlkpoWRlSQQ7fI+gF6BPLNNGDLFFsec75R J+kA9WaaB+kUxxlkncUeVSN1H7+9+fBcSemw/Vhx3RNpNGVShuLUvUN72yANFWIRBr2q ILRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857561; x=1729462361; 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=t8ym6NLxoNvu+SOj1YsRaeOvfI7iJrafTEN4muCnoIE=; b=JvP4+SiZI8eb71x82ddPeLzlK6glFbxa5z74ZJWBwo7Cr2wYglcy7+18YKjA16Vugr xsdXPjdih+gEDjEZ/JaDzz4g8ZEsgoz/XBCCizCkgNBZYBD8KSPmIfCnTzObX1V+PoFv hZQItCqecjiXBs1iprMQPXNxNb7cHi/v4pzBeyrdH0H+gcnH+UqX/Jz7goe/VIihlX7e 0UcBVMYcBWnFQs8FNKWSxxCXeQW7SKiMi/pCriiPeuxVVzbAsBH7toiutf4MOf2gt5T0 Bmd9YcCfTJybbeymySGDV48ARZ/cBWxFFdWl0cj9nGpPYzYahzpqafxLrFx4D4xfu6G1 2MTw== X-Gm-Message-State: AOJu0YxqWMLs1oJgnDfqvudmQqTSahPvQWrOqIWtuBTMdU9N+vQ423nA xRIxCukaEtMsCTpOFCeL/z0wLW9n4kSzlISZXJeJ7z8l4BWPwiJZmsjtOBjnia58BVREdEGgqnV 9 X-Google-Smtp-Source: AGHT+IHWnNiIXpnTD8cm8+35JeXmrYMBP90R1Lxi3XKuJdKRPVisipex8kl+OarBqksPeznQczuUnA== X-Received: by 2002:a17:90b:d97:b0:2e2:ebbb:7619 with SMTP id 98e67ed59e1d1-2e2f0ab98cfmr11287608a91.9.1728857561006; Sun, 13 Oct 2024 15:12:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 05/27] target/i386/gdbstub: Expose orig_ax Date: Sun, 13 Oct 2024 15:12:13 -0700 Message-ID: <20241013221235.1585193-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728858013160116600 Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich Copy XML files describing orig_ax from GDB and glue them with CPUX86State.orig_ax. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-ID: <20240912093012.402366-5-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- target/i386/cpu.h | 1 + target/i386/cpu.c | 1 + target/i386/gdbstub.c | 51 +++++++++++++++++++++++++++ configs/targets/i386-linux-user.mak | 2 +- configs/targets/x86_64-linux-user.mak | 2 +- gdb-xml/i386-32bit-linux.xml | 11 ++++++ gdb-xml/i386-64bit-linux.xml | 11 ++++++ 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 gdb-xml/i386-32bit-linux.xml create mode 100644 gdb-xml/i386-64bit-linux.xml diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 9c39384ac0..4c63e7b045 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2226,6 +2226,7 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int fl= ags); =20 int x86_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); +void x86_cpu_gdb_init(CPUState *cs); =20 void x86_cpu_list(void); int cpu_x86_support_mca_broadcast(CPUX86State *env); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ff227a8c5c..0d30191482 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7831,6 +7831,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) =20 mce_init(cpu); =20 + x86_cpu_gdb_init(cs); qemu_init_vcpu(cs); =20 /* diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index cc5eceeb7e..04c49e802d 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -18,8 +18,13 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "accel/tcg/vcpu-state.h" #include "cpu.h" +#include "exec/gdbstub.h" #include "gdbstub/helpers.h" +#ifdef CONFIG_LINUX_USER +#include "linux-user/qemu.h" +#endif =20 #ifdef TARGET_X86_64 static const int gpr_map[16] =3D { @@ -406,3 +411,49 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *= mem_buf, int n) /* Unrecognised register. */ return 0; } + +#ifdef CONFIG_LINUX_USER + +#define IDX_ORIG_AX 0 + +static int x86_cpu_gdb_read_linux_register(CPUState *cs, GByteArray *mem_b= uf, + int n) +{ + X86CPU *cpu =3D X86_CPU(cs); + CPUX86State *env =3D &cpu->env; + + switch (n) { + case IDX_ORIG_AX: + return gdb_get_reg(env, mem_buf, get_task_state(cs)->orig_ax); + } + return 0; +} + +static int x86_cpu_gdb_write_linux_register(CPUState *cs, uint8_t *mem_buf, + int n) +{ + X86CPU *cpu =3D X86_CPU(cs); + CPUX86State *env =3D &cpu->env; + + switch (n) { + case IDX_ORIG_AX: + return gdb_write_reg(env, mem_buf, &get_task_state(cs)->orig_ax); + } + return 0; +} + +#endif + +void x86_cpu_gdb_init(CPUState *cs) +{ +#ifdef CONFIG_LINUX_USER + gdb_register_coprocessor(cs, x86_cpu_gdb_read_linux_register, + x86_cpu_gdb_write_linux_register, +#ifdef TARGET_X86_64 + gdb_find_static_feature("i386-64bit-linux.xml= "), +#else + gdb_find_static_feature("i386-32bit-linux.xml= "), +#endif + 0); +#endif +} diff --git a/configs/targets/i386-linux-user.mak b/configs/targets/i386-lin= ux-user.mak index 5b2546a430..b72a156473 100644 --- a/configs/targets/i386-linux-user.mak +++ b/configs/targets/i386-linux-user.mak @@ -1,4 +1,4 @@ TARGET_ARCH=3Di386 TARGET_SYSTBL_ABI=3Di386 TARGET_SYSTBL=3Dsyscall_32.tbl -TARGET_XML_FILES=3D gdb-xml/i386-32bit.xml +TARGET_XML_FILES=3D gdb-xml/i386-32bit.xml gdb-xml/i386-32bit-linux.xml diff --git a/configs/targets/x86_64-linux-user.mak b/configs/targets/x86_64= -linux-user.mak index 9ceefbb615..86042814d3 100644 --- a/configs/targets/x86_64-linux-user.mak +++ b/configs/targets/x86_64-linux-user.mak @@ -2,4 +2,4 @@ TARGET_ARCH=3Dx86_64 TARGET_BASE_ARCH=3Di386 TARGET_SYSTBL_ABI=3Dcommon,64 TARGET_SYSTBL=3Dsyscall_64.tbl -TARGET_XML_FILES=3D gdb-xml/i386-64bit.xml +TARGET_XML_FILES=3D gdb-xml/i386-64bit.xml gdb-xml/i386-64bit-linux.xml diff --git a/gdb-xml/i386-32bit-linux.xml b/gdb-xml/i386-32bit-linux.xml new file mode 100644 index 0000000000..5ffe5616e6 --- /dev/null +++ b/gdb-xml/i386-32bit-linux.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/gdb-xml/i386-64bit-linux.xml b/gdb-xml/i386-64bit-linux.xml new file mode 100644 index 0000000000..0f26990d2f --- /dev/null +++ b/gdb-xml/i386-64bit-linux.xml @@ -0,0 +1,11 @@ + + + + + + + --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857623; cv=none; d=zohomail.com; s=zohoarc; b=SWJVFZ9A6gluuwlKNxpMdg14ssIQldVNBOKmivq73j3Q4+2e+fM6O7ax+ZtdWJ6+ikCey+JAaGiEYWElBdXE5gXoFVW91O28EbMF/un9ywXI7xrAn3WscLvJkodw1Jkl2IZcmRfotYVYQfnOZ31mi+RmEUseJVG88GtL5hYV70Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857623; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3HOyhUsp26UJ2J8SI14m1Cw+uj1HUsjO2JpGhjMl70Y=; b=jT5GDZlXfadAuelAHPEfq0vUYZoFv/nmLEUGtblR5b6r5bsp91xy9rjPK/+sn0mF+nBlZI6OakbFhpEKwvqJNEEDHT5BNnM6VTheqcuACtqH+VSUXD+Kflo0blj6KS2h+Y5LZ8AwcYArdHTIYHn/92rhLQvP9jO/q/p9YTfmw9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857623363937.6371448854115; Sun, 13 Oct 2024 15:13:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pS-00078N-RM; Sun, 13 Oct 2024 18:12:46 -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 1t06pQ-00077i-Tc for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:44 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pP-0000u8-Dv for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:44 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2e2ed2230d8so1716381a91.0 for ; Sun, 13 Oct 2024 15:12:43 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857562; x=1729462362; 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=3HOyhUsp26UJ2J8SI14m1Cw+uj1HUsjO2JpGhjMl70Y=; b=w5qjoMbXLUujZY1mYVUgnAHv2RtTWQpsoZBMdsLIQhkVkNg7mGOII+798J9D/vX3Ji wrtydsBjJeWxhmjnzcJ3xT5LQx0o68Zsy1Imr1b2oDYeE5HkWt9hxWUSSs4OvwXkeNa3 cu604Fr2eITPWydKeXbXonRCx+jDeyJOqEdEZfetpZgaMLpaUKsMj5AhIqhDT5BHam37 3Y+zfmeDy+UrioqAGgQsNkOPVYmJvHI11pM2OJT+NiR+Jvo8ULB5yiz1hZ0fet+zCG6j HRY6FrnLn+rtw3BPhjqQYXSdP9xynHAWo5UMQwsXWS45bygY2ZcCMGF01/mm0Eaig+Wm xpQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857562; x=1729462362; 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=3HOyhUsp26UJ2J8SI14m1Cw+uj1HUsjO2JpGhjMl70Y=; b=QyCQfjgS4izj7NNoNL94g2XHAHfXgqGQFsreFhJ4AYMJpgZdPKnoQHK2qXniW2vfXk S1ydEvQngfivcaT0ep9+uVQeGhs15FtyQRmnt+D5a4uXvppF9hIb3tr+/ZBp8LpqZuHk krOUNizb+ozzxCKbDy8/CHud7lN16tcYol4SP/PsX5+6hUnImBUkj4cxa3QPTIKom9bW Eol9hi4Q0GySU4PhINhZOPNpWQfioeBOQraA8r/5utxMWEQNM/O5A4KdW9uiAOi0Ti3v GSDyK8gjPTJiOGBB1Q8SUKnNgpckfTh+CETtvx3QmT2VQl9LeMI3MlW4wKksSpWB9j76 oEAg== X-Gm-Message-State: AOJu0YzAVuRVcyLNJ7M60yYB/MPGTFJpY6mPgvzINvYJuQbKWnoz0SXD HeWFo2gRDNOS5V0phdS6XRHwO9zYzSuk/+edr1BPvPOWXpvVLnOYLrPx5GW5HKT6pWNReaBi9e/ 0 X-Google-Smtp-Source: AGHT+IFlPncfg6JqrJUW8elanZXQlO0zL5/swqfalZAOpHj2x/fZlpjZ5kKYbQulAnTbLG6PyL6rsg== X-Received: by 2002:a17:90b:4c03:b0:2e2:ba35:356e with SMTP id 98e67ed59e1d1-2e3152e1be8mr8183825a91.17.1728857562030; Sun, 13 Oct 2024 15:12:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 06/27] tests/tcg: Run test-proc-mappings.py on i386 Date: Sun, 13 Oct 2024 15:12:14 -0700 Message-ID: <20241013221235.1585193-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857623607116600 From: Ilya Leoshkevich Now that orig_ax is exposed and GDB is happy, don't skip test-proc-mappings.py on i386. In fact, it's broken only on m68k now, so skip only this architecture. Acked-by: Alex Benn=C3=A9e Signed-off-by: Ilya Leoshkevich Message-ID: <20240912093012.402366-6-iii@linux.ibm.com> Signed-off-by: Richard Henderson --- .../tcg/multiarch/gdbstub/test-proc-mappings.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/= multiarch/gdbstub/test-proc-mappings.py index 564613fabf..0f687f3284 100644 --- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py @@ -8,17 +8,12 @@ =20 def run_test(): """Run through the tests one by one""" - try: - mappings =3D gdb.execute("info proc mappings", False, True) - except gdb.error as exc: - exc_str =3D str(exc) - if "Not supported on this target." in exc_str: - # Detect failures due to an outstanding issue with how GDB han= dles - # the x86_64 QEMU's target.xml, which does not contain the - # definition of orig_rax. Skip the test in this case. - print("SKIP: {}".format(exc_str)) - return - raise + if gdb.selected_inferior().architecture().name() =3D=3D "m68k": + # m68k GDB supports only GDB_OSABI_SVR4, but GDB_OSABI_LINUX is + # required for the info proc support (see set_gdbarch_info_proc()). + print("SKIP: m68k GDB does not support GDB_OSABI_LINUX") + exit(0) + mappings =3D gdb.execute("info proc mappings", False, True) report(isinstance(mappings, str), "Fetched the mappings from the infer= ior") # Broken with host page size > guest page size # report("/sha1" in mappings, "Found the test binary name in the mappi= ngs") --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857784; cv=none; d=zohomail.com; s=zohoarc; b=cUo5d5BlVfsDSMSwGnS7i3fAhV/MGilWvx9b9hlchh+9avuJsE+rJCH0ttD6x5cwsORdoo7zc+bTn1MRbnPiR4Y7Ap978WaNbLRyHwRpBx9gwGGNdQpik+Njn3ZxrHHjK0flqRZLqHz/9eHnxIeVR8nfMlJlyKKePelFvFcbE4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857784; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VpiQ0uRviqHvIpHCmWWiDcmFLJXAKpr3mqpGqdFoplg=; b=ESQ12BQ4MEoEic6pCGDBTyuI7QEsTrkpA1glHl2zazMQGz5hSEFTCMl7rcFvVXUJ5jZxJqLPjIRVWA/MCMSPG4r/Ces3mpCsLYhLB3sVqTRHe9AD6mEyxG5+XLLehRTo2Wvt4sGc01Uf9DrtUhsy8y05MSZDHyzcId/d8/B0U/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172885778469814.824228368824151; Sun, 13 Oct 2024 15:16:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pT-00078O-Dt; Sun, 13 Oct 2024 18:12:47 -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 1t06pR-00077w-NU for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:45 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pQ-0000uH-2M for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:45 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2e3010478e6so1785551a91.1 for ; Sun, 13 Oct 2024 15:12:43 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857563; x=1729462363; 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=VpiQ0uRviqHvIpHCmWWiDcmFLJXAKpr3mqpGqdFoplg=; b=G86hBLNpYpnqMRtqHvlKnQ//HyKlqxG/3z9vmFE5wy6nZMVeYqKlbUt6+ddasW+qiG 9V0uqDomRnPSRwILdaO5nEjQUufoapRkTJ4lYSjHg/11b+pW/U+WLDVQHTI5uYW1v8W3 ORM3T+iQii4iY5D5aQd+i7jxPXvuPrlh1Iy5E5RLvnFrCkfAuvYOlny/C7CXUOMqPFNu NNBDKvqqmuOy91f+23nrzeA3zZCcuOq4U3opSuE4kC1jEN8USnEEEUI6urTSYzE+sFbR hPHcRJhW6fAzhY/xbmF33ZKgfyKDRa4rvH/+AuU3f1nw54/VLCW7dgHWNX7IUHfJYxbA 5ACQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857563; x=1729462363; 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=VpiQ0uRviqHvIpHCmWWiDcmFLJXAKpr3mqpGqdFoplg=; b=C0Hgg+gTkURi1gB9cq4Kwe/oeA6Ru5S/qXuRqP6b9hU+YOm6hOQHpXTaIBFPSPBnHX ZdjMWowzrf1PKVJBhMFCFeEkuE8uYzBGUr8VdQKDFg3LzIquw5JYsOvfRbt0yviSaOR+ iVlpLHUz9bzQNMroGezFn2NxbmE6bnR20zhvkN0orgP4kzNtULTte/ls/4uRS8u5kL8F 6o7tNYkW4yTt5QiQ2pXhHGcEkhuB/G3YK5zsKbcPuzdYVxI60BSQNBfasGuJaJ8KNGxT 1JtIsJW3xaXQriLvYNQYavL0chCNgl1/R2PGhmHJPSG488f43SQqIBokZrTJcLThFLgx VSHg== X-Gm-Message-State: AOJu0Yx42U+Silbk9EYq1gu8w5/z4eAzKF/noBwg4KcodQS+r/SVVX8u PG2KE1Z7FYfJ/LvW5cp2L6JCKAkl08xEXr+oYw7idm9MVKxylNg4omZ2cm7uPX8UHLB2IXb5jo3 w X-Google-Smtp-Source: AGHT+IHvYIIJ1ucmCyt6EFJnUaMwH4fYafR4/sOHH3qTlUisimDefrvul389alAQeWksbl5X+tWZng== X-Received: by 2002:a17:90b:4a89:b0:2e2:d33b:cc with SMTP id 98e67ed59e1d1-2e3152e76admr8643704a91.21.1728857562747; Sun, 13 Oct 2024 15:12:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Thomas Huth , "Dr . David Alan Gilbert" Subject: [PULL 07/27] linux-user/vm86: Fix compilation with Clang Date: Sun, 13 Oct 2024 15:12:15 -0700 Message-ID: <20241013221235.1585193-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857786168116600 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since commit 95b9c27c81 ("linux-user: Remove unused handle_vm86_fault") a bunch of other "static inline" function are now unused, too. Clang warns about such unused "static inline" functions in .c files, so the build currently breaks when compiling with "--enable-werror". Remove the unused functions to get it going again. Fixes: 95b9c27c81 ("linux-user: Remove unused handle_vm86_fault") Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Reviewed-by: Dr. David Alan Gilbert Message-ID: <20241011161845.417342-1-thuth@redhat.com> Signed-off-by: Richard Henderson --- linux-user/vm86.c | 65 ----------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/linux-user/vm86.c b/linux-user/vm86.c index 31a2d707cf..5091d53fb8 100644 --- a/linux-user/vm86.c +++ b/linux-user/vm86.c @@ -47,30 +47,6 @@ static inline void vm_putw(CPUX86State *env, uint32_t se= gptr, cpu_stw_data(env, segptr + (reg16 & 0xffff), val); } =20 -static inline void vm_putl(CPUX86State *env, uint32_t segptr, - unsigned int reg16, unsigned int val) -{ - cpu_stl_data(env, segptr + (reg16 & 0xffff), val); -} - -static inline unsigned int vm_getb(CPUX86State *env, - uint32_t segptr, unsigned int reg16) -{ - return cpu_ldub_data(env, segptr + (reg16 & 0xffff)); -} - -static inline unsigned int vm_getw(CPUX86State *env, - uint32_t segptr, unsigned int reg16) -{ - return cpu_lduw_data(env, segptr + (reg16 & 0xffff)); -} - -static inline unsigned int vm_getl(CPUX86State *env, - uint32_t segptr, unsigned int reg16) -{ - return cpu_ldl_data(env, segptr + (reg16 & 0xffff)); -} - void save_v86_state(CPUX86State *env) { CPUState *cs =3D env_cpu(env); @@ -131,19 +107,6 @@ static inline void return_to_32bit(CPUX86State *env, i= nt retval) env->regs[R_EAX] =3D retval; } =20 -static inline int set_IF(CPUX86State *env) -{ - CPUState *cs =3D env_cpu(env); - TaskState *ts =3D get_task_state(cs); - - ts->v86flags |=3D VIF_MASK; - if (ts->v86flags & VIP_MASK) { - return_to_32bit(env, TARGET_VM86_STI); - return 1; - } - return 0; -} - static inline void clear_IF(CPUX86State *env) { CPUState *cs =3D env_cpu(env); @@ -162,34 +125,6 @@ static inline void clear_AC(CPUX86State *env) env->eflags &=3D ~AC_MASK; } =20 -static inline int set_vflags_long(unsigned long eflags, CPUX86State *env) -{ - CPUState *cs =3D env_cpu(env); - TaskState *ts =3D get_task_state(cs); - - set_flags(ts->v86flags, eflags, ts->v86mask); - set_flags(env->eflags, eflags, SAFE_MASK); - if (eflags & IF_MASK) - return set_IF(env); - else - clear_IF(env); - return 0; -} - -static inline int set_vflags_short(unsigned short flags, CPUX86State *env) -{ - CPUState *cs =3D env_cpu(env); - TaskState *ts =3D get_task_state(cs); - - set_flags(ts->v86flags, flags, ts->v86mask & 0xffff); - set_flags(env->eflags, flags, SAFE_MASK); - if (flags & IF_MASK) - return set_IF(env); - else - clear_IF(env); - return 0; -} - static inline unsigned int get_vflags(CPUX86State *env) { CPUState *cs =3D env_cpu(env); --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857772; cv=none; d=zohomail.com; s=zohoarc; b=GfjJcHKUDos1JSJIY7n44R0PlnM3ZD7L1a+qnnXIMeIH7pVPmVoLL/jKt5qxOkRwnlqqcxZpHV7RoAV31WM1oaPCot2ZLud3zyQKDCXD1eEGxoaBXZR980xKdPlU9ya0raEhU+3TqDLzqXiKYkQUW7qkYr8WV+Unq+ZaS8623gY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857772; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5sM2rASXzZfAaByCSG4X7yOvvA/fFZaOvGmejFsljDo=; b=eBVVpVRGMuEAIA3/VFe8k7FLoaYT8rfAI7JjhoksU19YWzAYa5FMtzGeFUW25p4tLkTTsLjVAKp3UOMDJVg+kAf45W9RUK/I9kmjDeWKR+7t7M84raGooeI3ofdH00l2lamnZYxSKUZPNW6GUMm3zZDDxER99bVww/dgR/lL+Hc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857772325352.5539649682579; Sun, 13 Oct 2024 15:16:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pa-0007AH-Mq; Sun, 13 Oct 2024 18:12:54 -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 1t06pT-00078Q-HR for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:47 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pS-0000uZ-1t for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:47 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2e2ed59a35eso2377336a91.0 for ; Sun, 13 Oct 2024 15:12:45 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857565; x=1729462365; 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=5sM2rASXzZfAaByCSG4X7yOvvA/fFZaOvGmejFsljDo=; b=bHUh/ahtyWr/9PjKNFVAJETPLg3uykNiwvNVeJlL1t958/vxKuLEnYXNG8WjEDh+Y2 SbC1mcsBMJammrPg2jHVHWwWIXMzJZXgAAKFM82Pgd1l7azeuK6hSRXFFg6d/RkCI6n1 eWuQipNKk9FCdEPO6gOm9MxKxPTSptXQZWYEBgmizmz05uaQ/oaeTm8VPUp7n6U4lHph J9lfLnhW72zWIFXnXhtSpKtGg69VSY3muMV1HxUw1oKDCjVUIrp9S+y6EvGPWD63nKGb 2WHGqfj0orADKPW10F3PKIuzpdXsIaVgeH9u0WZJj6qtclQ3YIYKlROpRYSpXO1l/2/n rnRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857565; x=1729462365; 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=5sM2rASXzZfAaByCSG4X7yOvvA/fFZaOvGmejFsljDo=; b=lYbOgK2B4mPZQywvJxJ6drgE5kWHlhScRDiUfvlqbskK7VTQ6yaKChWZkeGRJTZad7 KmDFC40yMjRFBMWIWZhVW5SolQy4a9tqpUzHCBA91VQbzrpYICTSAelrBnV+pVWBgdyJ du+7Ti2uZG1zL+M8v4pMrOBwfKoQPnJyPQAqxVEsD00LkUmXR9XFfBegqhBd6QP0NtXG mmW8+qQpl7HD/kpBBJdH2/2MrCqvvyG40Xqw1yEvgaoZdbMfgsM43epCA3R7NQWSN4sj 26kMWFKXfQw/RbTeA1wZ5iG6NDXHplVMPEtCCRpweRkLNJXbU7xSveaC7N78anLefTcM 5XpA== X-Gm-Message-State: AOJu0YyIqxjgf47RERqrW+wYDwtOkd3kTcDzC/J/GUaFdpZQF0KWMQaf 7lcyOdOKrCZsy42Z5vJsYZMDdN33QXpdmqExcKw0C5eUklLKlGUYnHEfiiKfeH+rjCBr0KmKVhi I X-Google-Smtp-Source: AGHT+IEhdVIv1IYvBtZa8N/hMCtkNnq/cd3OO14Urwgh/PkgCabwXsG2+Phzfp1rNratvIdtJJ2xpg== X-Received: by 2002:a17:90a:68cb:b0:2e2:d74f:65b6 with SMTP id 98e67ed59e1d1-2e2f0a6838bmr13199352a91.10.1728857564810; Sun, 13 Oct 2024 15:12:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , Peter Maydell Subject: [PULL 08/27] accel/tcg: Assert noreturn from write-only page for atomics Date: Sun, 13 Oct 2024 15:12:16 -0700 Message-ID: <20241013221235.1585193-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857774132116600 Content-Type: text/plain; charset="utf-8" There should be no "just in case"; the page is already in the tlb, and known to be not readable. Reviewed-by: Helge Deller Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 117b516739..fd6459b695 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1852,10 +1852,9 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr = addr, MemOpIdx oi, /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for - * write, this shouldn't ever return. But just in case, - * handle via stop-the-world. + * write, this shouldn't ever return. */ - goto stop_the_world; + g_assert_not_reached(); } /* Collect tlb flags for read. */ tlb_addr |=3D tlbe->addr_read; --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857865; cv=none; d=zohomail.com; s=zohoarc; b=YATq2WgBHDrFjCx+ZC9f25+LVzYavIofwMw85nwy0/aNOxK3TNHQTACmCB3hjXWHPKVTFrZzkDAD6NxTbV/DvX8eDWTH+GarsQUGUZPF6kpEDo+RxsrbZlOKlnkij0Ah5kW5sLKip5CcCZkIV1sy0HD4UjDVIKjlrOfLxH4AWj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857865; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=O9DVukvxY0Nz2lbOkkF1UGxIJ0HiyrlwFe+DiEN47Z4=; b=Ecpv4vheqhgrva+dAV2Xkw/xarsv/Hz4yiS5yJw25bOyKf3PF4nzNwNljRfsw2luir+Ljs2E1oqCO9y0kUUapjSw6sTRD6XoIlx1W/XJianRIkt9DOQP9Yf7k/hqs+UiWMZS54JOyTjP47pWMUMv/xTQVDo1aEUrG3h5TQmhXUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172885786490872.79536832219458; Sun, 13 Oct 2024 15:17:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pc-0007BF-FJ; Sun, 13 Oct 2024 18:12:56 -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 1t06pV-00079L-0u for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:50 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pT-0000ul-8D for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:48 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2e2e050b1c3so2089454a91.0 for ; Sun, 13 Oct 2024 15:12:46 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857566; x=1729462366; 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=O9DVukvxY0Nz2lbOkkF1UGxIJ0HiyrlwFe+DiEN47Z4=; b=iH5rXdJdPcYE0sn47jHeQjTuRFOOkDgVYZksCmJyz/8TpMj7e2+LPU6sYKJSscyUWl dK3+tg4coulBYnAHJRzGdmXcJFqne5ngK9EaaPTRopNSD9lixYlLSVtwRXFukGLLLdEv GnSXbwWIX+kiCKd8fuRegVC5aTNOw9uQ70ujrFA81r0WidjEQGFoLnI5/7BzKOuPj1tt IrstylEzK9LbVoLTeHgWftXM+XbLvYc5LhTxo6HOFux/nGmjpHPCRiIkSGQtpzfSRkjQ WC7rkkpv/OsZ2FyLwJP2CQA+ikM8cpWYmxDIrPKXEB8IT41QQ0s3XWSsHMDQWv4fYFF3 aH6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857566; x=1729462366; 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=O9DVukvxY0Nz2lbOkkF1UGxIJ0HiyrlwFe+DiEN47Z4=; b=lHxL2V/0+UoSQEL7MFjU6VSlq+/HVt1aUMrhfVeYglWnzwAgQqyksdmNUVIG0eCiHK X4OcxzOEMTwHx2L+fSgxrFFgS17N3ENX7AE/ZSorzpr5xIEM5hqb/rtGzi+J0xIobw33 G+BjYtkxSar3rKMo4tZrtx7DRk8e5BHBUtav0zzuHX437rQPmPw4idiJHF1662EMf+/s 5MnkrC92Lwf9LAn0Wrs3Q9YEsB2XBlxHxCamQAOV8ildMyJtKFMop1FYzweG3+Xmd6kp HXlnw4spaVaZua78f9bk07jgrH5ogE/7niVL7IwbkYDoTJlYhG3z3Wew/va2JhH4tTxf x6Qw== X-Gm-Message-State: AOJu0YxQGP7lQADbdTC+uUN4mcNPtaFUOZmEpc0GrWEQIJLJ9UuKcTA+ S5EPLl79fAyuGB2af4/DpQjeQZYkOgrqDI67gGLsEGwXa9/TBaWEvzPLUQl8c/yFNmZiRhWr8yJ R X-Google-Smtp-Source: AGHT+IGuiRjze4lqFtkMzr14k0zGiTnL2C1SICBCRKuMTrZX29aBstFP5CkdurapsUxG1UQfHPpiUw== X-Received: by 2002:a17:90b:3844:b0:2da:88b3:cff8 with SMTP id 98e67ed59e1d1-2e2f0aa5610mr14952048a91.6.1728857565706; Sun, 13 Oct 2024 15:12:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 09/27] include/exec/memop: Move get_alignment_bits from tcg.h Date: Sun, 13 Oct 2024 15:12:17 -0700 Message-ID: <20241013221235.1585193-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857866583116600 This function is specific to MemOp, not TCG in general. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/exec/memop.h | 23 +++++++++++++++++++++++ include/tcg/tcg.h | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index f881fe7af4..97720a8ee7 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -170,4 +170,27 @@ static inline bool memop_big_endian(MemOp op) return (op & MO_BSWAP) =3D=3D MO_BE; } =20 +/** + * get_alignment_bits + * @memop: MemOp value + * + * Extract the alignment size from the memop. + */ +static inline unsigned get_alignment_bits(MemOp memop) +{ + unsigned a =3D memop & MO_AMASK; + + if (a =3D=3D MO_UNALN) { + /* No alignment required. */ + a =3D 0; + } else if (a =3D=3D MO_ALIGN) { + /* A natural alignment requirement. */ + a =3D memop & MO_SIZE; + } else { + /* A specific alignment requirement. */ + a =3D a >> MO_ASHIFT; + } + return a; +} + #endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 21d5884741..824fb3560d 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -281,29 +281,6 @@ static inline int tcg_type_size(TCGType t) return 4 << i; } =20 -/** - * get_alignment_bits - * @memop: MemOp value - * - * Extract the alignment size from the memop. - */ -static inline unsigned get_alignment_bits(MemOp memop) -{ - unsigned a =3D memop & MO_AMASK; - - if (a =3D=3D MO_UNALN) { - /* No alignment required. */ - a =3D 0; - } else if (a =3D=3D MO_ALIGN) { - /* A natural alignment requirement. */ - a =3D memop & MO_SIZE; - } else { - /* A specific alignment requirement. */ - a =3D a >> MO_ASHIFT; - } - return a; -} - typedef tcg_target_ulong TCGArg; =20 /* Define type and accessor macros for TCG variables. --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857613; cv=none; d=zohomail.com; s=zohoarc; b=OUk9MUoVVVirONm4E5RdbOCPR/VyTK+tXqSmJUAUqbUUK7U1WZFsCwwsU8nplC1Cd54VYEOMXdC4N/wJUHLXqW/9Z7MWogXPHvpTmOJ5JDNX81HGRsIjvHNRg3a2yIXcHJKF/o5z4cJdNmzu429zROAr4PxYAo1+MeAaBIIhksE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857613; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VxQQDPF3XbwGQMMjEi8JT0LcRz4F5ymP0/tmO2RuJRo=; b=O0fIyCnRv+WUGcGWsevcYDNtgD5UYea/iZ5ayC+bbYsB7azjE/oiB4+RVcyhp/cy1CZuzUhZegI4N6al1vQTyaBkAyLM1vVjPfG8SS1QtVbnrYlcBA//hJIrAabP7NIAmAybUmDx5tlZKCIAHo8+5WvtFgWhUTRfs7kfv5p0tCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857613079307.0220734583287; Sun, 13 Oct 2024 15:13:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pc-0007BC-Fb; Sun, 13 Oct 2024 18:12:56 -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 1t06pX-00079v-Ap for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:53 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pU-0000ux-Q4 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:50 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7ea8c4ce232so174252a12.0 for ; Sun, 13 Oct 2024 15:12:47 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857567; x=1729462367; 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=VxQQDPF3XbwGQMMjEi8JT0LcRz4F5ymP0/tmO2RuJRo=; b=ONaBSjLgrd13zmFhvVFjMYqZjGYQTn4nKm1prv+AZq5H9lWeAJI+8Ptr/Cx/N4lKaa QKT6NNClF4vKZy57ptqjiEG0YsjH6pH1GMc3U8M7NaQ1apyxA6tXme9+xPXDVapqG3wi 22I15AmdkBqB1M4kmPTj0MQ3PFluCLVHsZt4ut5yWxZP1lcaC84XWRf467WRoFDclbPT d3mrEiW6Duw+jUSjSZvjaWAYl+R8Z9rM3WKCB2rpB8xU2z1B3sBPHVKwLRAdxqU3kD7w +Nx48QID0hltwSiIc5gyg+hUJ7sk8NO6mt9ApAjSx4FVhCXEDzt5/unJ5UCPVXvN1+g5 LquA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857567; x=1729462367; 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=VxQQDPF3XbwGQMMjEi8JT0LcRz4F5ymP0/tmO2RuJRo=; b=PIdwKH8vOLiWA4xNVr8WWPhWYQ8ohtObsm6HErUNSkZfC+Ols0mxeMMkeuCMYw0Es3 71ghtRSWrpgYQ5DEcTaC8W1ziiUAaoA0027uYNcMMromMPQFEKRz3EXvWQka0RHp4tUL 69J3Am8k6EJh1ldeNAGyA/h0jv3QIsVDRwE3944W3KmnQRpsLEzRviLsUWpJ5FdIrUHF nq/MAF6shHSTee4Wzc+pfIhMcE4c32EFMo/5jhy+J4By86hwIChVomtrHYdRmr6MG0jR SpojIfaCJCdqGsUnSHn7r6FSAklf6WPYa84wM/bgwR9ri/5pzdo9KfGAh6UNvT1qI6p9 LAow== X-Gm-Message-State: AOJu0Yz3lqJn2YOOc0xgfTghDePW2JJ/UWnTLecWEo99eMswwixlYD02 lF0UUludpafNMLWpdSGpiAzteVlHXvHSkFsz7DZmECQWSzW1IPL+FqkUflgDiy2boSPjcEbLtcH e X-Google-Smtp-Source: AGHT+IGPowYwaoawTjLXnJZj2jmig5ndMdIDsq5xhuFS5wUQFAJxS1q3dz2/FIs3frfa+ikQsVamwQ== X-Received: by 2002:a17:90b:1005:b0:2e2:e0c1:4452 with SMTP id 98e67ed59e1d1-2e31539036fmr7425969a91.41.1728857566627; Sun, 13 Oct 2024 15:12:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 10/27] include/exec/memop: Rename get_alignment_bits Date: Sun, 13 Oct 2024 15:12:18 -0700 Message-ID: <20241013221235.1585193-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857613827116600 Rename to use "memop_" prefix, like other functions that operate on MemOp. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/exec/memop.h | 4 ++-- accel/tcg/cputlb.c | 4 ++-- accel/tcg/user-exec.c | 4 ++-- target/arm/tcg/translate-a64.c | 4 ++-- target/xtensa/translate.c | 2 +- tcg/tcg-op-ldst.c | 6 +++--- tcg/tcg.c | 2 +- tcg/arm/tcg-target.c.inc | 4 ++-- tcg/sparc64/tcg-target.c.inc | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index 97720a8ee7..f53bf618c6 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -171,12 +171,12 @@ static inline bool memop_big_endian(MemOp op) } =20 /** - * get_alignment_bits + * memop_alignment_bits: * @memop: MemOp value * * Extract the alignment size from the memop. */ -static inline unsigned get_alignment_bits(MemOp memop) +static inline unsigned memop_alignment_bits(MemOp memop) { unsigned a =3D memop & MO_AMASK; =20 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd6459b695..a975fe5f89 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1709,7 +1709,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Mem= OpIdx oi, tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); =20 /* Handle CPU specific unaligned behaviour */ - a_bits =3D get_alignment_bits(l->memop); + a_bits =3D memop_alignment_bits(l->memop); if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } @@ -1797,7 +1797,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, MemOpIdx oi, { uintptr_t mmu_idx =3D get_mmuidx(oi); MemOp mop =3D get_memop(oi); - int a_bits =3D get_alignment_bits(mop); + int a_bits =3D memop_alignment_bits(mop); uintptr_t index; CPUTLBEntry *tlbe; vaddr tlb_addr; diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 11b6d45e90..51b2c16dbe 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -954,7 +954,7 @@ void page_reset_target_data(target_ulong start, target_= ulong last) { } static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr, MemOp mop, uintptr_t ra, MMUAccessType type) { - int a_bits =3D get_alignment_bits(mop); + int a_bits =3D memop_alignment_bits(mop); void *ret; =20 /* Enforce guest required alignment. */ @@ -1236,7 +1236,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, MemOpIdx oi, int size, uintptr_t retaddr) { MemOp mop =3D get_memop(oi); - int a_bits =3D get_alignment_bits(mop); + int a_bits =3D memop_alignment_bits(mop); void *ret; =20 /* Enforce guest required alignment. */ diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 071b6349fc..ec0b1ee252 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -294,7 +294,7 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, = TCGv_i64 addr, desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc =3D FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc =3D FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(memop= )); + desc =3D FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(mem= op)); desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, memop_size(memop) - 1); =20 ret =3D tcg_temp_new_i64(); @@ -326,7 +326,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr,= bool is_write, desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc =3D FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc =3D FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(singl= e_mop)); + desc =3D FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(sin= gle_mop)); desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); =20 ret =3D tcg_temp_new_i64(); diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 75b7bfda4c..f4da4a40f9 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -521,7 +521,7 @@ static MemOp gen_load_store_alignment(DisasContext *dc,= MemOp mop, mop |=3D MO_ALIGN; } if (!option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { - tcg_gen_andi_i32(addr, addr, ~0 << get_alignment_bits(mop)); + tcg_gen_andi_i32(addr, addr, ~0 << memop_alignment_bits(mop)); } return mop; } diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 23dc807f11..a318011229 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -45,7 +45,7 @@ static void check_max_alignment(unsigned a_bits) =20 static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st) { - unsigned a_bits =3D get_alignment_bits(op); + unsigned a_bits =3D memop_alignment_bits(op); =20 check_max_alignment(a_bits); =20 @@ -559,7 +559,7 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCG= Temp *addr, TCGv_i64 ext_addr =3D NULL; TCGOpcode opc; =20 - check_max_alignment(get_alignment_bits(memop)); + check_max_alignment(memop_alignment_bits(memop)); tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD); =20 /* In serial mode, reduce atomicity. */ @@ -676,7 +676,7 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCG= Temp *addr, TCGv_i64 ext_addr =3D NULL; TCGOpcode opc; =20 - check_max_alignment(get_alignment_bits(memop)); + check_max_alignment(memop_alignment_bits(memop)); tcg_gen_req_mo(TCG_MO_ST_LD | TCG_MO_ST_ST); =20 /* In serial mode, reduce atomicity. */ diff --git a/tcg/tcg.c b/tcg/tcg.c index 34e3056380..5decd83cf4 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -5506,7 +5506,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *= op) static TCGAtomAlign atom_and_align_for_opc(TCGContext *s, MemOp opc, MemOp host_atom, bool allow_two= _ops) { - MemOp align =3D get_alignment_bits(opc); + MemOp align =3D memop_alignment_bits(opc); MemOp size =3D opc & MO_SIZE; MemOp half =3D size ? size - 1 : 0; MemOp atom =3D opc & MO_ATOM_MASK; diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 3de5f50b62..56072d89a2 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1587,7 +1587,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, Mem= Op opc, TCGReg datalo, tcg_debug_assert((datalo & 1) =3D=3D 0); tcg_debug_assert(datahi =3D=3D datalo + 1); /* LDRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >=3D MO_64) { + if (memop_alignment_bits(opc) >=3D MO_64) { if (h.index < 0) { tcg_out_ldrd_8(s, h.cond, datalo, h.base, 0); break; @@ -1691,7 +1691,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, Mem= Op opc, TCGReg datalo, tcg_debug_assert((datalo & 1) =3D=3D 0); tcg_debug_assert(datahi =3D=3D datalo + 1); /* STRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >=3D MO_64) { + if (memop_alignment_bits(opc) >=3D MO_64) { if (h.index < 0) { tcg_out_strd_8(s, h.cond, datalo, h.base, 0); } else { diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index 176c98740b..32f9ec24b5 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -1133,7 +1133,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext= *s, HostAddress *h, * Otherwise, test for at least natural alignment and defer * everything else to the helper functions. */ - if (s_bits !=3D get_alignment_bits(opc)) { + if (s_bits !=3D memop_alignment_bits(opc)) { tcg_debug_assert(check_fit_tl(a_mask, 13)); tcg_out_arithi(s, TCG_REG_G0, addr_reg, a_mask, ARITH_ANDCC); =20 --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857638; cv=none; d=zohomail.com; s=zohoarc; b=REnaOIbrsAlZHJbPwf5wN62MzGIN7PiI0hn4/sH8JdYc0MBKZNg2jPx6CL4wj2AcK6+Z7mvr3p5QE64Nq1Lhase/oOooWAqn56og+qEB9p/WkmaHvABPAA5E3z0ZH8+awpdhn2TLOq7sr6GgHqvWNDuFQRANU9j8Hk8ZaQbc3Mk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857638; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H6LoCevcYPwKGPsieGU+G82S8Cv4YZiZPQ3U7O/YR2o=; b=anGp/l40xqbpDxq4C4FX3xX6wAwiMSX9yLWrEODGH+yxYY4n292z0SK0jPWAub/t4/LPygG7mGGmXA3X/MgWSa1R4uqKL/wydMe83DKAAWTsBSOlTgQXy1tfkDPRUDZMzbSvKJA9gpKn5SLlL3iJjjXwfjS9LJObzZPs82K85Wk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857638981479.60806808316227; Sun, 13 Oct 2024 15:13:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pg-0007Bk-Dx; Sun, 13 Oct 2024 18:13:01 -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 1t06pX-00079u-AO for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:52 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pU-0000v6-Rg for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:50 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2e30db524c2so1117338a91.1 for ; Sun, 13 Oct 2024 15:12:48 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857567; x=1729462367; 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=H6LoCevcYPwKGPsieGU+G82S8Cv4YZiZPQ3U7O/YR2o=; b=TJDEQQDgYv6ZUfEW9vKlPf9Oa4h55QPu1NcZP/GuQBD9CaXVhrAxOa45F5zNJD2ISZ 9TsVCXEdD5Q7BNQVhPDkZfO4VQ4l2Usv1vycjZu4+44p7+XKCxodQeT7D9DiItZ0/3oT 53kI9o89KeB9DUnn6/JJMOgjJwtXSFPFTX+ZFmwqyDY7fLY9cznJPrw3+gYD1nmWrWxf bZ6Wf2QO2ZS51LvkDJ0bEEQ2TSIRW+5FGn6hzT/9Xp8uxVqsoQ3Tnz52jEkENWGMgKbD JU7X1cGDTR6CBJg9IEyl6QQP8+hu0Y91J87aeK6+DScvcRETsK7uuxN86N1/yPgl1qUQ uGNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857567; x=1729462367; 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=H6LoCevcYPwKGPsieGU+G82S8Cv4YZiZPQ3U7O/YR2o=; b=xHd0ze6OGZRPngftxGG5Kxb1vJkh0zQL8aDekEteTKxMR1Je+4K1U0i2xEEg4wale1 cB7E98uDLV+gXhXpFAMGNd9csHIkz88XO6jh2dnLJroatqVoy888HE2L8I2YBsKngSSA SXpR4Fj7PZ8Ncr1i5s4bXUVj1isxX/pkkkgIAwb347vtacOwz7Qt597a+dAN8bMfb6Ng /vgy3cfZy9qDkpEgu3HIOSGfQZymvmBLP7iIsfsim/Iwh+kWkQSofmCPGd7A3AWoPqrM 9cu7dSJqPDZeGOoW7qEBco45RMfMYaW2Dez1O9M+2MKH8NGMGPdXs7RZZRKrFgqSLAxa bpwg== X-Gm-Message-State: AOJu0YzGYoRZNluRxK64s9iwgZqyJe3sgKY51HPQaB1ON8bZz5Wk4+W/ OyqqlKdmRsj68GqIwRjCD0mTYQ4b3EfR+cCcsNVRuhw1L+s+tpMbZaSY6JsOetzetLfllLTuRiJ F X-Google-Smtp-Source: AGHT+IFRwXQjbMEs2HpQZp3lgM9RpJ2g3mcFpaWb3rwdL4JCq9PacQviB8p0BKzR7ue2qZK+Ecrz5A== X-Received: by 2002:a17:90a:bd8d:b0:2e2:ebab:792d with SMTP id 98e67ed59e1d1-2e31538f0dbmr7407496a91.41.1728857567462; Sun, 13 Oct 2024 15:12:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/27] include/exec/memop: Introduce memop_atomicity_bits Date: Sun, 13 Oct 2024 15:12:19 -0700 Message-ID: <20241013221235.1585193-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857639659116600 Split out of mmu_lookup. Reviewed-by: Helge Deller Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/memop.h | 24 ++++++++++++++++++++++++ accel/tcg/cputlb.c | 16 ++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index f53bf618c6..b699bf7688 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -193,4 +193,28 @@ static inline unsigned memop_alignment_bits(MemOp memo= p) return a; } =20 +/* + * memop_atomicity_bits: + * @memop: MemOp value + * + * Extract the atomicity size from the memop. + */ +static inline unsigned memop_atomicity_bits(MemOp memop) +{ + unsigned size =3D memop & MO_SIZE; + + switch (memop & MO_ATOM_MASK) { + case MO_ATOM_NONE: + size =3D MO_8; + break; + case MO_ATOM_IFALIGN_PAIR: + case MO_ATOM_WITHIN16_PAIR: + size =3D size ? size - 1 : 0; + break; + default: + break; + } + return size; +} + #endif diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index a975fe5f89..35cda1e2b0 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1767,20 +1767,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Me= mOpIdx oi, * Device memory type require alignment. */ if (unlikely(flags & TLB_CHECK_ALIGNED)) { - MemOp size =3D l->memop & MO_SIZE; - - switch (l->memop & MO_ATOM_MASK) { - case MO_ATOM_NONE: - size =3D MO_8; - break; - case MO_ATOM_IFALIGN_PAIR: - case MO_ATOM_WITHIN16_PAIR: - size =3D size ? size - 1 : 0; - break; - default: - break; - } - if (addr & ((1 << size) - 1)) { + a_bits =3D memop_atomicity_bits(l->memop); + if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } } --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728858043; cv=none; d=zohomail.com; s=zohoarc; b=IS8vaeZxvddEuaM1Or6Y62ftm8MROn+03mbytO0Q23A2tKccxH/folPDMw4DmaK0dQ3XWnJcu7bKbA0fMzYcOahDVPhABZZ+s13ON0wT++GfButLmf0K1EXIgbI39aPm5pd+Wl0AJC6DuS9uCO2XMmLizXXW2xgDmbQz8REKZ7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728858043; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RgjF9MWTX9WVkUUJb/RiYkmVHDzeAEtDtYq3Lai+k+w=; b=Kh0/lkRIvmtLW8hqQr/d1mFU1BbqatF1KtArfHaJ3mmczb120ANmJCWGxmAsx7N/SnCKMwzbEA1b7gpatcYJwn/R3TV1une+X2O9JbuyVZ2gznN0vocZPWOIjJhnnTDLUwTAMp6zMUKFS0CshR4WraQ1RXM72RInNmax7/NOcaw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172885804350128.003126834749537; Sun, 13 Oct 2024 15:20:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pc-0007BE-FQ; Sun, 13 Oct 2024 18:12:56 -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 1t06pY-00079x-W0 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pW-0000vG-RC for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:52 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7db637d1e4eso2474319a12.2 for ; Sun, 13 Oct 2024 15:12:49 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857568; x=1729462368; 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=RgjF9MWTX9WVkUUJb/RiYkmVHDzeAEtDtYq3Lai+k+w=; b=vnJuaoA2IDm0kzoxKpCpuFWkoTe5F2Fek3+Plm0lu/o6uGhELFau2bA5axqsyc5yqe znFcaUifBZlc9cw7Xk+PUkDf3khFxRfYY7RKguWWcqROIi5tuLDVjafphd31TIauukwn 0NN5whNLUNBKCORTSPo9nVR/AcEycw1lR4wZ60Mr4okc6aW8kphpX1VXVW7XMx6mK8tL ThRGvD+6dmZOvntBrUQJdd3+20hrJtiLjHq2KnyKXSnTa8CXm6HuSseEJ0WOKH+heKO1 od8wtkpKuQ430AwOLLMsdNlaA0yP/obADWF2AJC6CE7gE7Ju1nW9pgTJ/emk40XaBunQ tPfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857568; x=1729462368; 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=RgjF9MWTX9WVkUUJb/RiYkmVHDzeAEtDtYq3Lai+k+w=; b=V/daUymmCmhdvdJjMZC62li8iAaAZKzgxYDf6GfU3KABaj7BvkLJuirtjfz7LEChkd DFkgzxrJhLx5wcE6Zm4vtwFvE9yWETkjITyaNp89nGsv6yQzEVvQTAjmicVoRHdtSSv7 Kvqwt/ubsJxt2XFBQxUfIJCG0/xVW3msU9N6qEJLCa0OVEmkPY1AxtAprKarWLiTl6Dq Y1oUrT2eD0ZE41NShmKplvoZLmVXl9KJhqkQYaeoVzhEf3zDH996DziZn3II8TIMDS9P 6NBnTbibVD0uZNrgJnAEi77GJenvU+V4jszQtFzxbSodJdyRHOmbuAOJWdY6MXiH/L3k SPKA== X-Gm-Message-State: AOJu0Yze1e53G7tnDf5XzF/OoHeYyUYx4cLqea4CxTvjyjWiwnSGJtLk 0F+c+7xEdwI3asrIe9GOhXeRx4AhNaOhi/9FYaKzcJrdTE38W/BQaUaLoaqaSf+9MNvfMq0u/rG 9 X-Google-Smtp-Source: AGHT+IFuAgqUImcufDPhNQv4l0lS9jLsvCkAbNeL7sItYiaU+WXXHRdP1eKYBPCU0eWoPkve+O+3Fg== X-Received: by 2002:a17:90b:f16:b0:2e2:a850:6921 with SMTP id 98e67ed59e1d1-2e2f0a49228mr12723574a91.1.1728857568482; Sun, 13 Oct 2024 15:12:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , Peter Maydell Subject: [PULL 12/27] accel/tcg: Add TCGCPUOps.tlb_fill_align Date: Sun, 13 Oct 2024 15:12:20 -0700 Message-ID: <20241013221235.1585193-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728858045628116600 Content-Type: text/plain; charset="utf-8" Add a new callback to handle softmmu paging. Return the page details directly, instead of passing them indirectly to tlb_set_page. Handle alignment simultaneously with paging so that faults are handled with target-specific priority. Route all calls of the two hooks through a tlb_fill_align function local to cputlb.c. As yet no targets implement the new hook. As yet cputlb.c does not use the new alignment check. Reviewed-by: Helge Deller Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 4 +-- include/hw/core/tcg-cpu-ops.h | 26 +++++++++++++++ include/qemu/typedefs.h | 1 + accel/tcg/cputlb.c | 61 ++++++++++++++++++++++------------- 4 files changed, 67 insertions(+), 25 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 04e9ad4996..d21a24c82f 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -205,7 +205,7 @@ struct CPUClass { * 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 CPUTLBEntryFull { +struct CPUTLBEntryFull { /* * @xlat_section contains: * - in the lower TARGET_PAGE_BITS, a physical section number @@ -261,7 +261,7 @@ typedef struct CPUTLBEntryFull { bool guarded; } arm; } extra; -} CPUTLBEntryFull; +}; =20 /* * Data elements that are per MMU mode, minus the bits accessed by diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 34318cf0e6..663efb9133 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -13,6 +13,7 @@ #include "exec/breakpoint.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" +#include "exec/memop.h" #include "exec/mmu-access-type.h" #include "exec/vaddr.h" =20 @@ -131,6 +132,31 @@ struct TCGCPUOps { * same function signature. */ bool (*cpu_exec_halt)(CPUState *cpu); + /** + * @tlb_fill_align: Handle a softmmu tlb miss + * @cpu: cpu context + * @out: output page properties + * @addr: virtual address + * @access_type: read, write or execute + * @mmu_idx: mmu context + * @memop: memory operation for the access + * @size: memory access size, or 0 for whole page + * @probe: test only, no fault + * @ra: host return address for exception unwind + * + * If the access is valid, fill in @out and return true. + * Otherwise if probe is true, return false. + * Otherwise raise an exception and do not return. + * + * The alignment check for the access is deferred to this hook, + * so that the target can determine the priority of any alignment + * fault with respect to other potential faults from paging. + * Zero may be passed for @memop to skip any alignment check + * for non-memory-access operations such as probing. + */ + bool (*tlb_fill_align)(CPUState *cpu, CPUTLBEntryFull *out, vaddr addr, + MMUAccessType access_type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t ra= ); /** * @tlb_fill: Handle a softmmu tlb miss * diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 9d222dc376..3d84efcac4 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -40,6 +40,7 @@ typedef struct ConfidentialGuestSupport ConfidentialGuest= Support; typedef struct CPUArchState CPUArchState; typedef struct CPUPluginState CPUPluginState; typedef struct CPUState CPUState; +typedef struct CPUTLBEntryFull CPUTLBEntryFull; typedef struct DeviceState DeviceState; typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot; typedef struct DisasContextBase DisasContextBase; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 35cda1e2b0..d72f454e9e 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1221,22 +1221,35 @@ void tlb_set_page(CPUState *cpu, vaddr addr, } =20 /* - * Note: tlb_fill() can trigger a resize of the TLB. This means that all o= f 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()). + * Note: tlb_fill_align() 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 ret= addr) +static bool tlb_fill_align(CPUState *cpu, vaddr addr, MMUAccessType type, + int mmu_idx, MemOp memop, int size, + bool probe, uintptr_t ra) { - bool ok; + const TCGCPUOps *ops =3D cpu->cc->tcg_ops; + CPUTLBEntryFull full; =20 - /* - * This is not a probe, so only valid return is success; failure - * should result in exception + longjmp to the cpu loop. - */ - ok =3D cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); - assert(ok); + if (ops->tlb_fill_align) { + if (ops->tlb_fill_align(cpu, &full, addr, type, mmu_idx, + memop, size, probe, ra)) { + tlb_set_page_full(cpu, mmu_idx, addr, &full); + return true; + } + } else { + /* Legacy behaviour is alignment before paging. */ + if (addr & ((1u << memop_alignment_bits(memop)) - 1)) { + ops->do_unaligned_access(cpu, addr, type, mmu_idx, ra); + } + if (ops->tlb_fill(cpu, addr, size, type, mmu_idx, probe, ra)) { + return true; + } + } + assert(probe); + return false; } =20 static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, @@ -1351,22 +1364,22 @@ static int probe_access_internal(CPUState *cpu, vad= dr addr, =20 if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, page_addr)) { - if (!cpu->cc->tcg_ops->tlb_fill(cpu, addr, fault_size, access_= type, - mmu_idx, nonfault, retaddr)) { + if (!tlb_fill_align(cpu, addr, access_type, mmu_idx, + 0, fault_size, nonfault, retaddr)) { /* Non-faulting page table read failed. */ *phost =3D NULL; *pfull =3D NULL; return TLB_INVALID_MASK; } =20 - /* TLB resize via tlb_fill may have moved the entry. */ + /* TLB resize via tlb_fill_align may have moved the entry. */ index =3D tlb_index(cpu, mmu_idx, addr); entry =3D tlb_entry(cpu, mmu_idx, addr); =20 /* * 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. + * to force the next access through tlb_fill_align. We've just + * called tlb_fill_align, so we know that this entry *is* vali= d. */ flags &=3D ~TLB_INVALID_MASK; } @@ -1613,7 +1626,7 @@ typedef struct MMULookupLocals { * * Resolve the translation for the one page at @data.addr, filling in * the rest of @data with the results. If the translation fails, - * tlb_fill will longjmp out. Return true if the softmmu tlb for + * tlb_fill_align will longjmp out. Return true if the softmmu tlb for * @mmu_idx may have resized. */ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, @@ -1631,7 +1644,8 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageD= ata *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); + tlb_fill_align(cpu, addr, access_type, mmu_idx, + 0, data->size, false, ra); maybe_resized =3D true; index =3D tlb_index(cpu, mmu_idx, addr); entry =3D tlb_entry(cpu, mmu_idx, addr); @@ -1821,8 +1835,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, 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); + tlb_fill_align(cpu, addr, MMU_DATA_STORE, mmu_idx, + 0, size, false, retaddr); index =3D tlb_index(cpu, mmu_idx, addr); tlbe =3D tlb_entry(cpu, mmu_idx, addr); } @@ -1836,7 +1850,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read =3D=3D -1)) { - tlb_fill(cpu, addr, size, MMU_DATA_LOAD, mmu_idx, retaddr); + tlb_fill_align(cpu, addr, MMU_DATA_LOAD, mmu_idx, + 0, size, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857640; cv=none; d=zohomail.com; s=zohoarc; b=nLH2dA1BY1NxoIve6mQGz3sACp7OFA3eaEQjk1QNisn3cpazWSWJXs2RVgGFEOiGCod2h7W0V0oKMcMDGwMrECSNptWHqjZhcbYGg2xjwJWFaG/0DMn2jHxOexfp9TJYVySoXwW9uUS/VjjJ8UWIoTeiEi+v5jf6vbBFhJpOWBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857640; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5umYHNvw5oCQCN5hr78TRmNHjTlt1NzNl+yfC2iTChU=; b=jrFYrP87NMbv/d+tPHr2Nnp4Ax1n/zl2ab0EQ3mIwVIfnbsvdaMqff4D9DBQMEpPB+HaxDszZ+IV96IdL4n2J93Ki4y7deNGEMzc5qlrdD+m4nGl1cFWpKSqH3gyOEaSxOfn6HC89UwqpVLyBxL6TI2JJAaGrCkyQNOUBawCuQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857639931687.8783284119152; Sun, 13 Oct 2024 15:13:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06ph-0007Bq-Km; Sun, 13 Oct 2024 18:13:02 -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 1t06pY-00079w-T9 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pW-0000vM-RL for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:52 -0400 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2e2c6bc4840so2545584a91.2 for ; Sun, 13 Oct 2024 15:12:50 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857569; x=1729462369; 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=5umYHNvw5oCQCN5hr78TRmNHjTlt1NzNl+yfC2iTChU=; b=efk/BcX8QqRO88zNDd7comPETxMTjg8NqYDtZMpVVEaZ6l9Jf3ueicHwPy39qWJt0m o5G+FLvLxB+ZrCVacbZ2aDLVpXJbB3wBDDHxwr8OUbsMWk5wioe2IEFwgLiCIQcM5Wqd 7s09wtMRmO6WmM0oeoWosQ7hcXg6Z39Ojs10CM5ed4Tm9voD+Xb9QdBkJ+ZdDrZOjq0O W89qRKJmhrVeCBIOiR24yVxKLko9QRhfLV2GmE+28w5xfY7OUH1WdPVkArwm2Tlf32Uz ovIID+6r+vZUi6KFakDP/JUh8L/jtzEp63YNBz1kDlJh/AvqQD5jXC6J4KyxaFHDfskP tHUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857569; x=1729462369; 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=5umYHNvw5oCQCN5hr78TRmNHjTlt1NzNl+yfC2iTChU=; b=g5XkyzCgRDir3Q19Oco/dTs7jPyJjYyZ2hnMBHukYWj7MucHTHtS7o8mjb4b2emSGL ydm3S64mgMm+sAuZbHMrNewtc07c6gZeubH6KtA2o5f9jbkOCuxR4Cp9cZ2KLJiLF3dk 3bISisLxiDXbHMlP1KAuETTXzgiiIuc6Y+7F4YTA63Y5zG7uSNDQ8efKjefU2qT4/P7c usMCA6p/UC5sDAXmuq3/7wSi6AlG0PwQaiVfa0azx/MCxlFszGGNSSPpEOfIB4VUrGZE Rrzk4nKAz2fpgnBOZIdNa11fq2+te0eJ3AW9gbO6D+u+7XOTn/KokV+A4ljDB1BPP8Pg PFeQ== X-Gm-Message-State: AOJu0YyWfNYkdlDzNH8q3tLb3bp+WHh2WikF0rI+/rFCffmmgwiiapAM oLHaJFhfiWI76KuKKw2GjyPIQysECgIjse6gojdDd5hqUicpG11hQfYp6Kl2Zr/n1fk34NpGXEL x X-Google-Smtp-Source: AGHT+IEKScPMy86/cul8Ye+qmFt//D6ZIb1vJEOvWyVkeXe2qHupSncCOPWZhdVmjeklAug5EE8HIQ== X-Received: by 2002:a17:90b:224c:b0:2c8:647:1600 with SMTP id 98e67ed59e1d1-2e3152bd105mr8235852a91.9.1728857569313; Sun, 13 Oct 2024 15:12:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 13/27] accel/tcg: Use the alignment test in tlb_fill_align Date: Sun, 13 Oct 2024 15:12:21 -0700 Message-ID: <20241013221235.1585193-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857641718116600 Content-Type: text/plain; charset="utf-8" When we have a tlb miss, defer the alignment check to the new tlb_fill_align hook. Move the existing alignment check so that we only perform it with a tlb hit. Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 88 ++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index d72f454e9e..b76a4eac4e 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1620,6 +1620,7 @@ typedef struct MMULookupLocals { * mmu_lookup1: translate one page * @cpu: generic cpu state * @data: lookup parameters + * @memop: memory operation for the access, or 0 * @mmu_idx: virtual address context * @access_type: load/store/code * @ra: return address into tcg generated code, or 0 @@ -1629,7 +1630,7 @@ typedef struct MMULookupLocals { * tlb_fill_align will longjmp out. Return true if the softmmu tlb for * @mmu_idx may have resized. */ -static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, +static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, MemOp memo= p, int mmu_idx, MMUAccessType access_type, uintptr_t = ra) { vaddr addr =3D data->addr; @@ -1645,7 +1646,7 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageD= ata *data, if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { tlb_fill_align(cpu, addr, access_type, mmu_idx, - 0, data->size, false, ra); + memop, data->size, false, ra); maybe_resized =3D true; index =3D tlb_index(cpu, mmu_idx, addr); entry =3D tlb_entry(cpu, mmu_idx, addr); @@ -1657,6 +1658,25 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPage= Data *data, flags =3D tlb_addr & (TLB_FLAGS_MASK & ~TLB_FORCE_SLOW); flags |=3D full->slow_flags[access_type]; =20 + if (likely(!maybe_resized)) { + /* Alignment has not been checked by tlb_fill_align. */ + int a_bits =3D memop_alignment_bits(memop); + + /* + * This alignment check differs from the one above, in that this is + * based on the atomicity of the operation. The intended use case = is + * the ARM memory type field of each PTE, where access to pages wi= th + * Device memory type require alignment. + */ + if (unlikely(flags & TLB_CHECK_ALIGNED)) { + int at_bits =3D memop_atomicity_bits(memop); + a_bits =3D MAX(a_bits, at_bits); + } + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_unaligned_access(cpu, addr, access_type, mmu_idx, ra); + } + } + data->full =3D full; data->flags =3D flags; /* Compute haddr speculatively; depending on flags it might be invalid= . */ @@ -1713,7 +1733,6 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULook= upPageData *data, static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, uintptr_t ra, MMUAccessType type, MMULookupLocals *= l) { - unsigned a_bits; bool crosspage; int flags; =20 @@ -1722,12 +1741,6 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Me= mOpIdx oi, =20 tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); =20 - /* Handle CPU specific unaligned behaviour */ - a_bits =3D memop_alignment_bits(l->memop); - if (addr & ((1 << a_bits) - 1)) { - cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); - } - l->page[0].addr =3D addr; l->page[0].size =3D memop_size(l->memop); l->page[1].addr =3D (addr + l->page[0].size - 1) & TARGET_PAGE_MASK; @@ -1735,7 +1748,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Mem= OpIdx oi, crosspage =3D (addr ^ l->page[1].addr) & TARGET_PAGE_MASK; =20 if (likely(!crosspage)) { - mmu_lookup1(cpu, &l->page[0], l->mmu_idx, type, ra); + mmu_lookup1(cpu, &l->page[0], l->memop, l->mmu_idx, type, ra); =20 flags =3D l->page[0].flags; if (unlikely(flags & (TLB_WATCHPOINT | TLB_NOTDIRTY))) { @@ -1754,8 +1767,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Mem= OpIdx oi, * Lookup both pages, recognizing exceptions from either. If the * second lookup potentially resized, refresh first CPUTLBEntryFul= l. */ - mmu_lookup1(cpu, &l->page[0], l->mmu_idx, type, ra); - if (mmu_lookup1(cpu, &l->page[1], l->mmu_idx, type, ra)) { + mmu_lookup1(cpu, &l->page[0], l->memop, l->mmu_idx, type, ra); + if (mmu_lookup1(cpu, &l->page[1], 0, l->mmu_idx, type, ra)) { uintptr_t index =3D tlb_index(cpu, l->mmu_idx, addr); l->page[0].full =3D &cpu->neg.tlb.d[l->mmu_idx].fulltlb[index]; } @@ -1774,19 +1787,6 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, Me= mOpIdx oi, tcg_debug_assert((flags & TLB_BSWAP) =3D=3D 0); } =20 - /* - * This alignment check differs from the one above, in that this is - * based on the atomicity of the operation. The intended use case is - * the ARM memory type field of each PTE, where access to pages with - * Device memory type require alignment. - */ - if (unlikely(flags & TLB_CHECK_ALIGNED)) { - a_bits =3D memop_atomicity_bits(l->memop); - if (addr & ((1 << a_bits) - 1)) { - cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); - } - } - return crosspage; } =20 @@ -1799,34 +1799,18 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr= addr, MemOpIdx oi, { uintptr_t mmu_idx =3D get_mmuidx(oi); MemOp mop =3D get_memop(oi); - int a_bits =3D memop_alignment_bits(mop); uintptr_t index; CPUTLBEntry *tlbe; vaddr tlb_addr; void *hostaddr; CPUTLBEntryFull *full; + bool did_tlb_fill =3D false; =20 tcg_debug_assert(mmu_idx < NB_MMU_MODES); =20 /* Adjust the given return address. */ retaddr -=3D GETPC_ADJ; =20 - /* Enforce guest required alignment. */ - if (unlikely(a_bits > 0 && (addr & ((1 << a_bits) - 1)))) { - /* ??? Maybe indicate atomic op to cpu_unaligned_access */ - cpu_unaligned_access(cpu, addr, MMU_DATA_STORE, - mmu_idx, retaddr); - } - - /* Enforce qemu required alignment. */ - if (unlikely(addr & (size - 1))) { - /* We get here if guest alignment was not requested, - or was not enforced by cpu_unaligned_access above. - We might widen the access and emulate, but for now - mark an exception and exit the cpu loop. */ - goto stop_the_world; - } - index =3D tlb_index(cpu, mmu_idx, addr); tlbe =3D tlb_entry(cpu, mmu_idx, addr); =20 @@ -1836,7 +1820,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr a= ddr, MemOpIdx oi, if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { tlb_fill_align(cpu, addr, MMU_DATA_STORE, mmu_idx, - 0, size, false, retaddr); + mop, size, false, retaddr); + did_tlb_fill =3D true; index =3D tlb_index(cpu, mmu_idx, addr); tlbe =3D tlb_entry(cpu, mmu_idx, addr); } @@ -1859,6 +1844,23 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr = addr, MemOpIdx oi, */ g_assert_not_reached(); } + + /* Enforce guest required alignment, if not handled by tlb_fill_align.= */ + if (!did_tlb_fill && (addr & ((1 << memop_alignment_bits(mop)) - 1))) { + cpu_unaligned_access(cpu, addr, MMU_DATA_STORE, mmu_idx, retaddr); + } + + /* Enforce qemu required alignment. */ + if (unlikely(addr & (size - 1))) { + /* + * We get here if guest alignment was not requested, or was not + * enforced by cpu_unaligned_access or tlb_fill_align above. + * We might widen the access and emulate, but for now + * mark an exception and exit the cpu loop. + */ + goto stop_the_world; + } + /* Collect tlb flags for read. */ tlb_addr |=3D tlbe->addr_read; =20 --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857673; cv=none; d=zohomail.com; s=zohoarc; b=W4LWyPjMb1f5gxEY3u02QoUr7wSGNEK0PiCS6dAe74BgSqe5VchFxjDRnz+IemvH2vAeTetRzdswCs9cR2HX+MKCXgHKrLxLfHO5J3An9mEm6csfpDmDNq290hi9yVKE/rT1aVrAWrspd2KWUIJaLEL8Xvc2YEs2iOz4S07YybM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857673; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZMaSkZRoz5YPXdGi4Fagk1yb2WqLYDqE0+TVeXDEoMY=; b=Bc3hTgs0RjdBDyIgsE1oT0U+KCbkxXcCqakrjrHiES9eF3W/KbUjDiBPT/6IpwpxGZz/bddvcHSzYscSUR9FCF8Fo3rD9qstTogVDP6v1Td8Mzkp+ZwF1FSjMruyOKAcz0aqe8hwT17s14pR8zuiPeh7eq36xRB1PsvK74EB8oM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857673157482.3201701006318; Sun, 13 Oct 2024 15:14:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pt-0007EG-93; Sun, 13 Oct 2024 18:13:13 -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 1t06pa-0007A5-84 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pX-0000vS-Gl for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2e2a999b287so2851014a91.0 for ; Sun, 13 Oct 2024 15:12:51 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857570; x=1729462370; 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=ZMaSkZRoz5YPXdGi4Fagk1yb2WqLYDqE0+TVeXDEoMY=; b=kgGX6F6ssMk35mDaCkohqGEJcxeX5pX5GsDM5PdmuWZCPMD/AONgTMlRnoOUmP5lDU vBAkg3gXWmN3+5vUzswQJg8oRKs3JhJh4pkV4lb/KrqyM2qNcI2JEdxRZVG1BJGAogyT 1Hz23YfRZjjk4cyCiFm2CWUEk/TzFcSl3hxtS8WoQ+TN4hefX3c5NoKncNtvNv00RTUu D3Nu1bd0wfT6LmW6nYVWAqelyGc0GwS8By3iKSF+itfqag+h0UgUky2wnwS5EHOzKLOc UEFbKHctScndKg349jeAvuOLBLWrA3gA9KFih8ypCN/ZYM5Pwvd/7W5VG57D4+DtEjNg Vstw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857570; x=1729462370; 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=ZMaSkZRoz5YPXdGi4Fagk1yb2WqLYDqE0+TVeXDEoMY=; b=APNcwKjvO5sI7X4uet1yo4bJYFjyHifFrVuzFADfzd2LyIZplbYrqn9R6E2qzZIPi5 dbYKVRXLdGjeAl7an67/BBbnQvYAPXLWR2ULTHE/InX6EimmGG77MP7qI2Fvn7u6nbrq P/5/aE7mMza+elnVhNP/DQGqVx4SpU7jp5kPzIOwxQf21SmiFuNLXSBg4qrb5YsR7gAi 4hGjxqHY+LXlFfsF9Yi8GRb7omYH4hNRP7SIcRZtjEklWMNNtzGW6HJJ6/VKlDNN6+hM bosT0njnsipL19F6QebGhfESXeGn8GROtBL8Mr5sKmCU9WB3zIdpWQnmCf4PcugTnjkP 6neg== X-Gm-Message-State: AOJu0YxwhueDad4nyjCSJY4veFeOCV9AsJ/1T/HqkUzbMeT/SRtBFEAW IWzUK0AwzH4wD3wfHKbBaodfttzUSTHOrdq/Won7J4whyzKFszr60bLkisTkzhVlVZRHarZ77zY a X-Google-Smtp-Source: AGHT+IGo7pss9kMdZe+q2Ka85FEDnS0gaetUuqIpkcmxME23Tv1LooQV/Bps5z1Bz1NwpQsBFEogZw== X-Received: by 2002:a17:90a:8cc:b0:2e2:c64c:a1c9 with SMTP id 98e67ed59e1d1-2e2f0b2b844mr11646356a91.24.1728857570248; Sun, 13 Oct 2024 15:12:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/27] target/hppa: Add MemOp argument to hppa_get_physical_address Date: Sun, 13 Oct 2024 15:12:22 -0700 Message-ID: <20241013221235.1585193-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857674012116600 Just add the argument, unused at this point. Zero is the safe do-nothing value for all callers. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 2 +- target/hppa/int_helper.c | 2 +- target/hppa/mem_helper.c | 9 +++++---- target/hppa/op_helper.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index f4e051f176..526855f982 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -369,7 +369,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int= size, void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot); + int type, MemOp mop, hwaddr *pphys, int *ppr= ot); void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index 391f32f27d..58695def82 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -167,7 +167,7 @@ void hppa_cpu_do_interrupt(CPUState *cs) =20 vaddr =3D hppa_form_gva_psw(old_psw, env->iasq_f, vadd= r); t =3D hppa_get_physical_address(env, vaddr, MMU_KERNEL= _IDX, - 0, &paddr, &prot); + 0, 0, &paddr, &prot); if (t >=3D 0) { /* We can't re-load the instruction. */ env->cr[CR_IIR] =3D 0; diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index b984f730aa..a386c80fa4 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -197,7 +197,7 @@ static int match_prot_id64(CPUHPPAState *env, uint32_t = access_id) } =20 int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot) + int type, MemOp mop, hwaddr *pphys, int *ppr= ot) { hwaddr phys; int prot, r_prot, w_prot, x_prot, priv; @@ -340,7 +340,7 @@ hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr= addr) mmu_idx =3D (cpu->env.psw & PSW_D ? MMU_KERNEL_IDX : cpu->env.psw & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); =20 - excp =3D hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, + excp =3D hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, 0, &phys, &prot); =20 /* Since we're translating for debugging, the only error that is a @@ -438,7 +438,8 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int si= ze, break; } =20 - excp =3D hppa_get_physical_address(env, addr, mmu_idx, a_prot, &phys, = &prot); + excp =3D hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + &phys, &prot); if (unlikely(excp >=3D 0)) { if (probe) { return false; @@ -678,7 +679,7 @@ target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulon= g addr) hwaddr phys; int prot, excp; =20 - excp =3D hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, + excp =3D hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, 0, &phys, &prot); if (excp >=3D 0) { if (excp =3D=3D EXCP_DTLB_MISS) { diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 7f79196fff..744325969f 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -334,7 +334,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ul= ong addr, } =20 mmu_idx =3D PRIV_P_TO_MMU_IDX(level, env->psw & PSW_P); - excp =3D hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot= ); + excp =3D hppa_get_physical_address(env, addr, mmu_idx, 0, 0, &phys, &p= rot); if (excp >=3D 0) { cpu_restore_state(env_cpu(env), GETPC()); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857793; cv=none; d=zohomail.com; s=zohoarc; b=UffPJ+bIrTDBUjOzin9MB/HbXgFcqlS8VmMu01ajnwzrwcoCCdLqokExQk/FwW5eCfH0yjfueKtLWT02XKbjc6Hr/Dv13H0b9AMgYGcwV/EtUA19/okTyEXHwBez/8k47CEYAP9pzPJk53HHSkeBmbgwbaJMP/W7numQcuGDIoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857793; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=O0PxQWrWMbnI/8y9eRSEVv66ihXD+2MZE25zJVTaxvm1hnxxWNsp7qEqr++AXFt0duCi+6hkSJPO1GMqFuUIcI0b1rA67mG9SeQPu8WS1KQC5I3CN7UszykmAS1HB9P0jUF/Bbf/uDsVmux0DmYRn1X/YkM2KBxK9XOCVvK9t80= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17288577938167.321801341202217; Sun, 13 Oct 2024 15:16:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pv-0007FK-Ll; Sun, 13 Oct 2024 18:13:15 -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 1t06pa-0007A4-4V for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pY-0000vf-EN for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:53 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2e2dcf4b153so2229771a91.1 for ; Sun, 13 Oct 2024 15:12:52 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857571; x=1729462371; 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=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=JSCedkKGgDGHqgNK74jdohI0C8V8sya4nAevMefTFc50RjPnlRxakv3Eg30hqfrkKQ iGZvwVjDdbmxLm5lpe3nkVaShs/th6XA9j72nnYBFnj3gmYW24HEMZ07isNXKiqPTx23 7r5YYAU3lVGzFM9wmkAOnBSQGinuq2+LSWRAffmg2TOx7bxkgFTfuq58KijYSjxuAppT KN4nmXWzMiSI5TPpiFCuDJ2Vf1t+pNaCPN9v8xHa7b82yWrwBrE8Fw/aoVqMrXuykAnl /D6gr6Vfod7kQ72QB06A2FD0tMo0ZW11Wf8WB+lzqtQkvy2hcM26PaIp8JHLYYm5RZoh hD7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857571; x=1729462371; 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=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=WcYsh71katJoaB35Xxgs6H6LfRS3Zr8k+1fugMYcnaJn1iSFogKIR/lnnL+bjDdFpc GTYJFViZA0wdev7z1HhnJ+z6Y5B8CFp2aP675+ByTfYv0X/E8CH49BnBQIHGwhp6aWxc PpsWTl61cVj2+34xutra/kGBLYedr4+VCMHjgnXBtGHtbttImHw6yTg+2HLkXIrvLdI5 X+TQdiNvC6bsRY+YQMU/boJRywwTXPJG3bdf20dnxM3e2mxXQgdIav9BgSOwZgcF0Ntt 7n4I9fBx0Ll/SEgHXpVNwlfTzNpV98dlMb0kfcRJ5434IGRfMf0Mvtg+7dpo/nENkpui g5lQ== X-Gm-Message-State: AOJu0YxAZP5zaI85wNgfk4vfaV0LQjTjbE13N3U0d86HQoeXGv5l7RV5 Y6YuYcwBQSurtT5VTsVmtj9KaIIGHyoBrKE2fym7xFhvSdwfzLCQ3tLbLw8nOP/vfCuSpSetKBz u X-Google-Smtp-Source: AGHT+IECTx8ryhMseFkj2tvyby8ENbkgmNVnh6fxEfbgPFbgAKOiVb2YSgmFlVGe65WZ1thAQ1tS6w== X-Received: by 2002:a17:90a:ee8f:b0:2d8:dd14:79ed with SMTP id 98e67ed59e1d1-2e2f0d7aa18mr11741015a91.31.1728857571226; Sun, 13 Oct 2024 15:12:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 15/27] target/hppa: Perform access rights before protection id check Date: Sun, 13 Oct 2024 15:12:23 -0700 Message-ID: <20241013221235.1585193-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857794151116600 Content-Type: text/plain; charset="utf-8" In Chapter 5, Interruptions, the group 3 exceptions lists "Data memory access rights trap" in priority order ahead of "Data memory protection ID trap". Swap these checks in hppa_get_physical_address. Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index a386c80fa4..f027c494e2 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -267,6 +267,12 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr= addr, int mmu_idx, goto egress; } =20 + if (unlikely(!(prot & type))) { + /* Not allowed -- Inst/Data Memory Access Rights Fault. */ + ret =3D (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; + goto egress; + } + /* access_id =3D=3D 0 means public page and no check is performed */ if (ent->access_id && MMU_IDX_TO_P(mmu_idx)) { int access_prot =3D (hppa_is_pa20(env) @@ -281,12 +287,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr= addr, int mmu_idx, prot &=3D access_prot; } =20 - if (unlikely(!(prot & type))) { - /* Not allowed -- Inst/Data Memory Access Rights Fault. */ - ret =3D (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; - goto egress; - } - /* * In priority order, check for conditions which raise faults. * Remove PROT bits that cover the condition we want to check, --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857839; cv=none; d=zohomail.com; s=zohoarc; b=IiDjl9uY4cK7Bg8kvWKWv4mL2ikpd4SS2ZwsYN5GyZ05wfuavOGdaLWykDv4qs3IungxINLWujNzzNwvRvpIIY23aUPK7jNSg2t1kanjcgFhsVszKYWO34y2bdqdarY2Zj8KdIbNwF2QPYc3z9GgUEF7xuTFKFBsNwXA4gTbV7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857839; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; b=bQhkejJQYHMit9m8/hM160vYDtyD+MUJrqA8jpI0GJ+yaOr+F9mO76n4zmGbSs/fg0ZlVW+lRbeQDp6ZOCdlHcvKxSjNtSKU1kmAfnit+9CTa+If6DEhFUZQ9GdnQZfmWCnpluSaZ/1I76QyIhA7iyTiPcoMTvudWzISaD1zL2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857839782361.61057409279624; Sun, 13 Oct 2024 15:17:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pw-0007Ff-B7; Sun, 13 Oct 2024 18:13:16 -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 1t06pa-0007Aw-VQ for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:55 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pZ-0000vo-Ey for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:54 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-2e1c91fe739so2833622a91.2 for ; Sun, 13 Oct 2024 15:12:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857572; x=1729462372; 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=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; b=E5L/rcVoQ2kC+KBc45Wp5IJ6j/8uSOfMR/nepeeRbYAbuVxyp66ZVy2CmqBRCmFRDJ fdUbDf8RQhgzRbAr3f30KgYd4SExq571QD1tiLgHIubD3Sk/8/4ZSgdKVDaISjTp3toB e2xuSMCUc6J/RvE4imHbS1BySroNbiwvhHjOxZvMdHMSv8e/wKOo4uajdolmULrOKUK2 14mlTwWPZn86ZPdNhPAcEVYx2K/+lR5TGRFkJqrKfnmecfdF28F2uVhqHGgosByC+GQz 4N0B+LoZv7KyQ2tRm3lXugNMh/AUNQuf4qL6uC2NqE5xpu4UrGka9eLiIXELlT6IZA7R shJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857572; x=1729462372; 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=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; b=ojRo/55gAZwskesAexCpQYvMC/DWMiOX0mFWfgMxmCZj6JMhNi1b8pYfrMHGHBnJ7y aXkeHcLf2ZUjPJGCO8wSwGZBgbp7WhAzguZVqLaNtWONJ50lYhK8KOQ+z6fa2HCKt6B/ oXZXB9PtfEtAMi0NgoF9SVOG+veGz6K+9mWgx9bDhMCkxncm+j051JpNJD+3PECszIAc iAfvEewIPBmVdXOAvhB3DjodsfeFNip7tcjobhLvt/Q8GReipw52lp1cu7Z9CD0GjIEl nI8fkmKCblIJou7eqM9t9qmhMHLf6WDjVhXLvebt83IboHSYEo/9teK+pGsea3J+UbOj 4NuA== X-Gm-Message-State: AOJu0Yxbl/SVZePqbtP5jfvyZF7A66zZzntSDw6FvgtPNzEgHB7sCBKx gIJTW5nrgKUm2vkUcTERNtnNnX7v+xs9QpU9G+BSkWQwGed6Id+emlOztsb95Ufd5Rl5TF+/juB z X-Google-Smtp-Source: AGHT+IEKxwEcWzmGsX/uP7Uq8DU08eQyVTTwfIk0h4URZUZzje7CFBA6yZkxG9wQrgFcugmom1ylKg== X-Received: by 2002:a17:90a:8c9:b0:2e2:8f39:98d9 with SMTP id 98e67ed59e1d1-2e2f0afd945mr11575250a91.18.1728857572135; Sun, 13 Oct 2024 15:12:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 16/27] target/hppa: Fix priority of T, D, and B page faults Date: Sun, 13 Oct 2024 15:12:24 -0700 Message-ID: <20241013221235.1585193-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857840336116600 Drop the 'else' so that ret is overridden with the highest priority fault. Fixes: d8bc1381250 ("target/hppa: Implement PSW_X") Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index f027c494e2..f71cedd7a9 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -288,7 +288,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr = addr, int mmu_idx, } =20 /* - * In priority order, check for conditions which raise faults. + * In reverse priority order, check for conditions which raise faults. * Remove PROT bits that cover the condition we want to check, * so that the resulting PROT will force a re-check of the * architectural TLB entry for the next access. @@ -299,13 +299,15 @@ int hppa_get_physical_address(CPUHPPAState *env, vadd= r addr, int mmu_idx, /* The T bit is set -- Page Reference Fault. */ ret =3D EXCP_PAGE_REF; } - } else if (!ent->d) { + } + if (unlikely(!ent->d)) { prot &=3D PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* The D bit is not set -- TLB Dirty Bit Fault. */ ret =3D EXCP_TLB_DIRTY; } - } else if (unlikely(ent->b)) { + } + if (unlikely(ent->b)) { prot &=3D PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857684; cv=none; d=zohomail.com; s=zohoarc; b=P9jO8R5m5SkaliqecFIHnvE9CiJPDctn1BXJNDjRyMeQXMpObFMODwNn1LxMR15h0DPcalpJ++G4BDxUbIANsDpaBq7S0Kk1wp3lfWfyyiER6EJFj/H4UL/fagfJwPtuHn4PaQiS7sy4u4U0PkNX+UWvAxGdu0VFqpf7iWdznI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857684; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xQhK8NjjgW/kNvx5X1m22TpA6VVxTZtyOqTVcWaZJho=; b=bvfS7S0SxqPQvGLLu3+CjWynmbiIFoVDT7s92sRqGYS2BGRGaPbwO0PxHXJ1cbGIZlhqGiBRASWV6aM4G5ovMy1t3xoaxopZ8cuzEe+o0/+FshE+BVGhTd6npxuD20TH61YgwobJZEMDCxpFfSOdsoIoewjk+X26LtRonoPT0Ig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857684206289.28947858065726; Sun, 13 Oct 2024 15:14:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06px-0007Fg-QZ; Sun, 13 Oct 2024 18:13:17 -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 1t06pb-0007BA-TH for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:55 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pa-0000w3-Bf for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:55 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2e30116efc9so1872749a91.2 for ; Sun, 13 Oct 2024 15:12:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857573; x=1729462373; 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=xQhK8NjjgW/kNvx5X1m22TpA6VVxTZtyOqTVcWaZJho=; b=OTdi2pZTE+Fn3O4JPFgZhKlCfD5zIAkUzIKSiUaGh9rC9Bwj4u4q4Y4KGkN2jOr9+e U34JHhzxBvLvRUSTHJ5IHBXwZaqvNVR4fub67YMKTD0kdi/2yp+bItc4iXevNM6Lfdea wsbLaNBPSTwOCHSVsLqvt4KU9OpIXbIx0SKMURfU3JsPlBc/CnSktiXWsrapbU0RlD9T tkfq2O5Ka6dmroLLNvppCDmHnL21hn4Fc60uQlhqnw09BvaItJgL4qOOaqXCMPsG6sPV +c+cKpJc7ffEeQ+gXwLY2rQpdbtoHA+G/U6/VrM4cc8zKrpOqPzSU0fyYdz8/bJFN9/B 23vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857573; x=1729462373; 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=xQhK8NjjgW/kNvx5X1m22TpA6VVxTZtyOqTVcWaZJho=; b=wJOCthiL7eP4cDARtcVXHtTJMlAXh8FCF4t6Frl6iGrFKYX9NPW9rqQxZONxIojMbN O9WnFlFlPFnPRkIDlA78AiJR2ZY5QztwBY11b783zHDTLiKF/XXyEJNfsY2Anvpe6twm sEaS89y59idhWrfgquX19PRwvjN/MDnpTNVX41xC93c4++i7y7LR58Z35SeZLA0CpfoV fPx2CfGm26TPQkJTAqHiyUEXJ2CBBJ9gEQctTGES7oNBPqVqz+YWXL4mCmiCcQ1MVC2P /YV/mDcA8SaCuff4W2jJOugchCSgazeU9tw5JiGYzZHs/V4SE+g7uVnEKkp/IdX9GJxn uJUw== X-Gm-Message-State: AOJu0Yzmc+iY2YII4arANBQ3gDMzksxHUT9gA7rceFRozuQa2kvQzVX9 1ooC6u2DvqAAaWUNsAgWt7Y3fohFKIUCf9q47oq6K78484QGHRW6XrUOGoLQpFr4WFGtHTis5wz Q X-Google-Smtp-Source: AGHT+IEgaK8a2Vo5XpPXWgoTsWI0uEazrqeO36i8Bvms9BIIf/O3KcC36AjePArD6VFLCm1TQIuryA== X-Received: by 2002:a17:90b:3015:b0:2e2:d434:8547 with SMTP id 98e67ed59e1d1-2e2f0a0f7a6mr12860504a91.7.1728857573108; Sun, 13 Oct 2024 15:12:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 17/27] target/hppa: Handle alignment faults in hppa_get_physical_address Date: Sun, 13 Oct 2024 15:12:25 -0700 Message-ID: <20241013221235.1585193-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857685782116600 Content-Type: text/plain; charset="utf-8" In Chapter 5, Interruptions, the group 3 exceptions lists "Unaligned data reference trap" has higher priority than "Data memory break trap". Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index f71cedd7a9..d38054da8a 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -221,7 +221,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr = addr, int mmu_idx, g_assert_not_reached(); } prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; - goto egress; + goto egress_align; } =20 /* Find a valid tlb entry that matches the virtual address. */ @@ -323,6 +323,11 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr= addr, int mmu_idx, } } =20 + egress_align: + if (addr & ((1u << memop_alignment_bits(mop)) - 1)) { + ret =3D EXCP_UNALIGN; + } + egress: *pphys =3D phys; *pprot =3D prot; --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728858045; cv=none; d=zohomail.com; s=zohoarc; b=es38dwBdtTvJoahY3TTYKQJ3CoM2//dvORIG7KQ9dx2LWwn+lWmiq3nQVtjaMrG8QzHTeQLKQc7EtrScsOVOBpBGs5hs6MAPRsGlmJK+HhQQov3RyDndNaSOTVENuu932sXnGQv+7HIT9OLpQ5D4Cmi2QDpw4f1iOD6Q9lO6BOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728858045; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qyIQGMW9LXzuIdZhtsfgRRXnueKIctdP5fxMu5c0xxA=; b=JPimHwXE5K7yqb3SZfx2h7Kw9T+witrpg6OvUafJeT5OlTcoS2NocERnLW9dtiNPJ1mwuwO4CUErXoDPaIBri78xMk1l7y5aqfgcwTwUjb+iPMzgP6G3C/js8L2/m69oflK2Yz0m1OVvGwhNv77jYeQGfu05Vt/ex/QoTlGtfmw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728858045338669.8594959345668; Sun, 13 Oct 2024 15:20:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06py-0007Fj-JL; Sun, 13 Oct 2024 18:13:18 -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 1t06pc-0007BM-UH for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:57 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pb-0000wH-4X for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:56 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2e2e88cb0bbso1768458a91.3 for ; Sun, 13 Oct 2024 15:12:54 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857574; x=1729462374; 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=qyIQGMW9LXzuIdZhtsfgRRXnueKIctdP5fxMu5c0xxA=; b=Ha8hBcWJZBqC0dqeRMt42qSIFViRbZwvlZJqcgb78f94Zwc5mRtwnEp12MP5RJTuH8 en2rp4MJQju5XVVGKAqPeAOV5OOyE4T4mP4wssthd3vyOlsaHtkHS0DBjGQ8cJvKb+z1 zrg8KRPmbysjfd/bCKDJaSZualYeNsCUxclkqExeREXFDlVGtQsjXm5UYXw1KixWX3d2 bvVOKq2ulGWx8hGtwJCkg9vV8xCpx7QEg7het7ECbIlIzQcdVAzJz//J0QD95Eh+/qbr bKI60w1if33ImZyOBd1aGTeD0g3ZZJm9Ep8aP3cXIFA5o7HhCZEZsIW1Ms7Vus2ue22b SjQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857574; x=1729462374; 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=qyIQGMW9LXzuIdZhtsfgRRXnueKIctdP5fxMu5c0xxA=; b=iFWKOSskvaDAsCkzVm3yo+b/TpoaRQ9a0BEq4/mpNN50RUJc3Pn7AEgMLUHa2MnrQs D7GojFfexhjeOjeCj+RXTGmZpUCWcHSOL7Rkd1S+4bHtC53bBU6fk2oVpm/h4Ar6tOFC N8hmKgwYyuESxEqxUjsnux4+FETz/4nRE6fP4tqWQib2+Wg/7q4j1YD3srY5Pp75Rr5z bNJKeyALjsI4N1bMfhLVqlHPXB7VZxG7ypx9LxPR3pDfqtelGAWblb3vOjdBVoeYWtdY 66TUpF9Y/xIGKpFHglv5Ut/yhWCELZWa5a6kPv/UTtA93XRLaXzpVoR/aTMO9V/Q1BCj l40A== X-Gm-Message-State: AOJu0YwLrcm2JJP00urSPLwNiW3Z605SrEQh+jIEU3ycRnvT44coQH3k ZGT5qwoj05E3rflII6O4DiQuHlUAf0Qdt6BQ0/i2zu3s2hV7BNHRA/ITbDGjm1QyydESFIrI62L D X-Google-Smtp-Source: AGHT+IGw5ei1TeTL1x5T8u6u4Ks7+rpPGkZB8Rw6zCGDuF6yYpXwTHw5uTtODfZt5x35gLBHvoxAeA== X-Received: by 2002:a17:90a:be08:b0:2e2:991c:d796 with SMTP id 98e67ed59e1d1-2e2f0aa561bmr12164691a91.9.1728857573821; Sun, 13 Oct 2024 15:12:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 18/27] target/hppa: Implement TCGCPUOps.tlb_fill_align Date: Sun, 13 Oct 2024 15:12:26 -0700 Message-ID: <20241013221235.1585193-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728858047291116600 Content-Type: text/plain; charset="utf-8" Convert hppa_cpu_tlb_fill to hppa_cpu_tlb_fill_align so that we can recognize alignment exceptions in the correct priority order. Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=3D219339 Tested-by: Helge Deller Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 6 +++--- target/hppa/cpu.c | 2 +- target/hppa/mem_helper.c | 21 ++++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 526855f982..e45ba50a59 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -363,9 +363,9 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, int); void hppa_ptlbe(CPUHPPAState *env); hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr); void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled= ); -bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); +bool hppa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr add= r, + MMUAccessType access_type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t = ra); void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 7cf2e2f266..c38439c180 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,7 +226,7 @@ static const TCGCPUOps hppa_tcg_ops =3D { .restore_state_to_opc =3D hppa_restore_state_to_opc, =20 #ifndef CONFIG_USER_ONLY - .tlb_fill =3D hppa_cpu_tlb_fill, + .tlb_fill_align =3D hppa_cpu_tlb_fill_align, .cpu_exec_interrupt =3D hppa_cpu_exec_interrupt, .cpu_exec_halt =3D hppa_cpu_has_work, .do_interrupt =3D hppa_cpu_do_interrupt, diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index d38054da8a..b8c3e55170 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -424,12 +424,11 @@ void hppa_cpu_do_transaction_failed(CPUState *cs, hwa= ddr physaddr, } } =20 -bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, - MMUAccessType type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool hppa_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr add= r, + MMUAccessType type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t = ra) { - HPPACPU *cpu =3D HPPA_CPU(cs); - CPUHPPAState *env =3D &cpu->env; + CPUHPPAState *env =3D cpu_env(cs); int prot, excp, a_prot; hwaddr phys; =20 @@ -445,7 +444,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int si= ze, break; } =20 - excp =3D hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + excp =3D hppa_get_physical_address(env, addr, mmu_idx, a_prot, memop, &phys, &prot); if (unlikely(excp >=3D 0)) { if (probe) { @@ -454,7 +453,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int si= ze, trace_hppa_tlb_fill_excp(env, addr, size, type, mmu_idx); =20 /* Failure. Raise the indicated exception. */ - raise_exception_with_ior(env, excp, retaddr, addr, + raise_exception_with_ior(env, excp, ra, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); } =20 @@ -468,8 +467,12 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int s= ize, * the large page protection mask. We do not require this, * because we record the large page here in the hppa tlb. */ - tlb_set_page(cs, addr & TARGET_PAGE_MASK, phys & TARGET_PAGE_MASK, - prot, mmu_idx, TARGET_PAGE_SIZE); + memset(out, 0, sizeof(*out)); + out->phys_addr =3D phys; + out->prot =3D prot; + out->attrs =3D MEMTXATTRS_UNSPECIFIED; + out->lg_page_size =3D TARGET_PAGE_BITS; + return true; } =20 --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857821; cv=none; d=zohomail.com; s=zohoarc; b=hun2fxVhmfJnvD1Sum+1Sm1pKc/aTBo3m78eAmrkZ+Q+k0u72/FcDumPIV8TIy1cvPX++P2QN9yIhVhWQgRq0y6amECWe+KZXr/QjiMfE8PJXLwQHjL2897VqUFGDmtIqRPOl7HLFWJklNgFr/myJsxgJcDL94gFQw1W4avMHz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857821; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; b=BqwJ6z8tVM64zbEA6GrlWiISoGBm5NosaMxUQd3BQsoTchJeD6caOyp92Kron/O8AQFdkANou7Pj2I/HRgXNlwjuoWlV/MKPcWM8HBOJ8sPOfWnQUxSmkoKkm6Ztc/K2Gppn7cHSRtQV/Jaz0wQ9cE/2L8YCoQUTDIA/1O9EKuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857821084838.3038325676704; Sun, 13 Oct 2024 15:17:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06ps-0007Dr-3g; Sun, 13 Oct 2024 18:13:12 -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 1t06pd-0007BO-Hn for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:58 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pb-0000wb-Sp for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:57 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2e2eb9dde40so2029066a91.0 for ; Sun, 13 Oct 2024 15:12:55 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857574; x=1729462374; 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=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; b=z2qlj6jVEtZytH6iGhGAM7nZJuSIBO4eJNb1VYC5ymPUUbepmgdMM3GQGaUI080Lhv jE7jZU7S0szKf/RuOAN9HRYo0aP6n50f10znxK8rCdj+4WQYIlO6C0GYEqtj6q8zX+hG 1o3d38pqSfVW+pXq1mLOddeOUq2JXQ1Hfw8U+/1xLCf2XJsezZF6jvn6gRZcVtJRPbnj fFp0EYEMctz+mvz/Isb9ih9DkEbQOc6+uwjaDw2/pbxD6hAPcA2G+DdNGW3/JBc/aTVH dEIvgWYhOmXfs9R+9xc52tUK8DfuJ+ZkZqQJYbq56DUW6iFqwadR11wd98f1syTjZ8mU B9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857574; x=1729462374; 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=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; b=pKkXeREz1mwi3n0W5L52uLvdZpMx97ttWPQ4BaiGnQAVIMGtcPrUUDRL3n7bpoRNFB ldN0Oge4gBiNB9wp2GIg+9RaBWNWTwo6ICDIlsj99+go6OSL2JldwyjhvVcrnlsyRhW0 wf22/RwA7UOVLSEoXOSx04lgeHubO7hGO7BCSuMUR3Ivw7lLFrDCewJNX5kPAqkgBvsX msgkVrqB4114epfcdULV6w3jRct4nF7yjAu7dgn/qmTYi1V7nOF1zN89Fy2VWeFLvF40 z+ZFMycfAvhptwFKrU8aAAT0NaTzNJIWheuuhhapwXyp++zbz+rrnCoXeQzUqJaO8Skv j2aA== X-Gm-Message-State: AOJu0Yw0QRzPP743Hw/j5Ldcx653KtFUGsSa0EYja/d1yD8SSkToYQcD vFRRz1woinGva/RzXX52zcOdoMYevJE85InbaNlVAGfZ70rCsb4MEn7ny8Cx3yUBcSORKItaeox O X-Google-Smtp-Source: AGHT+IHIeiU5NWTWsngP6F8QfuBcm9ufih7hM2/3rCztS4GNSuZBGeCdiazmtHRCzjUJ91VRtGDnTw== X-Received: by 2002:a17:90a:bf09:b0:2e0:d1fa:fdd7 with SMTP id 98e67ed59e1d1-2e2f0d8dd21mr11930248a91.27.1728857574639; Sun, 13 Oct 2024 15:12:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 19/27] target/arm: Pass MemOp to get_phys_addr Date: Sun, 13 Oct 2024 15:12:27 -0700 Message-ID: <20241013221235.1585193-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857822368116600 Zero is the safe do-nothing value for callers to use. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/internals.h | 3 ++- target/arm/ptw.c | 2 +- target/arm/tcg/m_helper.c | 8 ++++---- target/arm/tcg/tlb_helper.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 1e5da81ce9..2b16579fa5 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1432,6 +1432,7 @@ typedef struct GetPhysAddrResult { * @env: CPUARMState * @address: virtual address to get physical address for * @access_type: 0 for read, 1 for write, 2 for execute + * @memop: memory operation feeding this access, or 0 for none * @mmu_idx: MMU index indicating required translation regime * @result: set on translation success. * @fi: set to fault info if the translation fails @@ -1450,7 +1451,7 @@ typedef struct GetPhysAddrResult { * value. */ bool get_phys_addr(CPUARMState *env, vaddr address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_i= dx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) __attribute__((nonnull)); =20 diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 659855133c..373095a339 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3572,7 +3572,7 @@ bool get_phys_addr_with_space_nogpc(CPUARMState *env,= vaddr address, } =20 bool get_phys_addr(CPUARMState *env, vaddr address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_i= dx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { S1Translate ptw =3D { diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c index 23d7f73035..f7354f3c6e 100644 --- a/target/arm/tcg/m_helper.c +++ b/target/arm/tcg/m_helper.c @@ -222,7 +222,7 @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr,= uint32_t value, int exc; bool exc_secure; =20 - if (get_phys_addr(env, addr, MMU_DATA_STORE, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_STORE, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type =3D=3D ARMFault_QEMU_SFault) { if (mode =3D=3D STACK_LAZYFP) { @@ -311,7 +311,7 @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest,= uint32_t addr, bool exc_secure; uint32_t value; =20 - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_LOAD, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type =3D=3D ARMFault_QEMU_SFault) { qemu_log_mask(CPU_LOG_INT, @@ -2009,7 +2009,7 @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx= mmu_idx, bool secure, "...really SecureFault with SFSR.INVEP\n"); return false; } - if (get_phys_addr(env, addr, MMU_INST_FETCH, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_INST_FETCH, 0, mmu_idx, &res, &fi)) { /* the MPU lookup failed */ env->v7m.cfsr[env->v7m.secure] |=3D R_V7M_CFSR_IACCVIOL_MASK; armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM, env->v7m.secur= e); @@ -2045,7 +2045,7 @@ static bool v7m_read_sg_stack_word(ARMCPU *cpu, ARMMM= UIdx mmu_idx, ARMMMUFaultInfo fi =3D {}; uint32_t value; =20 - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_LOAD, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type =3D=3D ARMFault_QEMU_SFault) { qemu_log_mask(CPU_LOG_INT, diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 885bf4ec14..1d8b7bcaa2 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -344,7 +344,7 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int = size, * return false. Otherwise populate fsr with ARM DFSR/IFSR fault * register format, and signal the fault. */ - ret =3D get_phys_addr(&cpu->env, address, access_type, + ret =3D get_phys_addr(&cpu->env, address, access_type, 0, core_to_arm_mmu_idx(&cpu->env, mmu_idx), &res, fi); if (likely(!ret)) { --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857700; cv=none; d=zohomail.com; s=zohoarc; b=DvwFCg0/hsq77VkTU8gcuRCMag332qLnrfY3c9jxaPsk51a65BUR1fbiCfjln8B33+/zGj6yKEn79+kuaEgR3MSny7jYmmkRd06ebDjASmOlw5u3VhtTfzywq04QpUtGcbFsQUxU32DnMYvwHbCmFcxPTKLN9pbqPrR5ynfkVG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857700; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I928rOfU7rFS4/uAexBKDkmn1Lv4VMSl/VKyNRV9wmg=; b=TNBfn0aNFw/WzvwKbPCOCl0LfCm0PTBvJI4gfgVppcyha2QwAOOpGl9AfKNxmppdO/m37sFd/sUxOIF+B21DX91y7S/jHeRPKzpVWIz6Xb7Uc+yhcC9SZSu2zCikiLz8FP7Y9besoMXVJqof1Gk69JWmDS7MUT5OPSNdtcnAUFA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857700063537.6836425260984; Sun, 13 Oct 2024 15:15:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pv-0007F6-Ho; Sun, 13 Oct 2024 18:13:15 -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 1t06pe-0007Be-QC for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:00 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pc-0000wj-OO for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:58 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-207115e3056so29568475ad.2 for ; Sun, 13 Oct 2024 15:12:56 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857575; x=1729462375; 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=I928rOfU7rFS4/uAexBKDkmn1Lv4VMSl/VKyNRV9wmg=; b=sAJxY6ZNM4Ozdw1YVLNeEQrzzzcHGt94LRSfcAiEKvCEA6UUre+i+eAcwXZpJbR3CJ DDjriQKTAI7rqL0cKfVJxdcANpTk46An4lvhuvvT6nazG14ygf6GyviJESLyZ+b9Yusd Th6Gi4dqHTw/nt2Dz0axLHqQ7sVLOfCA2tvObXdjxGh2lalTc91Y6ia7z+gXVxbyI769 YXmDggeLfKI0SCI0vuztYcSVyKKnVSVnkYvRWzykO1AVC30cFbo0II5iTbFHCF0YQk+O b/VyXDF5AshVSv7iaeaVIAhOdNd/TwSrbCvu1F1EQrVRsJ01PqFL26xZWqmz8QCPdlA0 iQNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857575; x=1729462375; 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=I928rOfU7rFS4/uAexBKDkmn1Lv4VMSl/VKyNRV9wmg=; b=U92dzsQeMYvu1XbstfJUjfXWv+PtzanEKjQhrDbjMgvUksi+yfgre73gofhuLaDlVz OK48jYHy4NymKcJg/hEGWSF7UvWuxAU8hhhsYL4muGB/E3tKoLAdiI/NNbCBuWtZJWAi 0GYZJz8jVSR0k6tPX0Sp8XdY3lq6dcLjWqg0bbOwVAXZeBxUhopm1gFpyiDfEg3CPM47 jS5FeVXfrX9DuWOR8s7xFWR3vWkhQ/UyR0Gr3tQhQnT2GpvqjvcNMhfpHSoGF7n1XtY5 XfHrUx/9GIqwel6zFOD4/xwlLVMdCMqBt02ZPBqu+sclQaf5EPH1ab3UEQs1oHu/fL8j ohMw== X-Gm-Message-State: AOJu0Yx9HX3V2pxd+m1JV8psoDEtBTRlFZTAlnzyRb+oGSfxKLKfuAiY 0YwpqAh6i8kRqthvEmYgj31dEs9Hrthl2sfcjzArAbeTkfTLiBXVzlNDZWpGNg+vYhDF1QyEP0C U X-Google-Smtp-Source: AGHT+IGgt+5Nm7Ydmbtk8c4xRMgLKq5oCb042saoIkUCoMAaAfocbfXnTbZomqCDDE6sj4mVYiSKjw== X-Received: by 2002:a17:90b:4ad2:b0:2e2:e545:82c5 with SMTP id 98e67ed59e1d1-2e2f0a4d6c5mr11663640a91.3.1728857575344; Sun, 13 Oct 2024 15:12:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 20/27] target/arm: Pass MemOp to get_phys_addr_with_space_nogpc Date: Sun, 13 Oct 2024 15:12:28 -0700 Message-ID: <20241013221235.1585193-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857702149116600 Zero is the safe do-nothing value for callers to use. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 3 ++- target/arm/helper.c | 9 +++++---- target/arm/ptw.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 2b16579fa5..a6088d551c 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1461,6 +1461,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, * @env: CPUARMState * @address: virtual address to get physical address for * @access_type: 0 for read, 1 for write, 2 for execute + * @memop: memory operation feeding this access, or 0 for none * @mmu_idx: MMU index indicating required translation regime * @space: security space for the access * @result: set on translation success. @@ -1470,7 +1471,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, * a Granule Protection Check on the resulting address. */ bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, ARMSecuritySpace sp= ace, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f77b40734..0a731a38e8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3599,11 +3599,12 @@ static uint64_t do_ats_write(CPUARMState *env, uint= 64_t value, GetPhysAddrResult res =3D {}; =20 /* - * I_MXTJT: Granule protection checks are not performed on the final a= ddress - * of a successful translation. + * I_MXTJT: Granule protection checks are not performed on the final + * address of a successful translation. This is a translation not a + * memory reference, so "memop =3D none =3D 0". */ - ret =3D get_phys_addr_with_space_nogpc(env, value, access_type, mmu_id= x, ss, - &res, &fi); + ret =3D get_phys_addr_with_space_nogpc(env, value, access_type, 0, + mmu_idx, ss, &res, &fi); =20 /* * ATS operations only do S1 or S1+S2 translations, so we never diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 373095a339..9af86da597 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3559,7 +3559,7 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Tra= nslate *ptw, } =20 bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, ARMSecuritySpace sp= ace, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857751; cv=none; d=zohomail.com; s=zohoarc; b=gCZbyRaq9vazCnuGx2hlmUmsBebzDYfCmdT1cgQadoO/wEdkCuHPdmV6O595YWbm2i19iYQaWbJgufOP61hQfFf9iapWXXAMZXX/lDQWmCz1eMmUmLtB9Ws16im+DBA+1pyUPjym7vu05LGzmBSdyK3UGOzLaa2t7zDroseredk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857751; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=617h4byv7OP/ct3y2kJCr5k6Qy1wZsttJUBcCYmwvNQ=; b=ICQ3+1/AmPC/tf5KddNpk0bsRFHCPfw/+V2Hp4DX1pZKW/pXw272eViZNwQ84G9BfIE8wIBW7IkjfwshlD2Y9f4R+TgMpeIlnGjrdbHBzhDWsOPkoXDd8KNyn3BMQO4YBHOnkQxqdGUlpvZXrP/XyS2JsGKckmSZdkbrT2PyAOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857751346558.5468246212906; Sun, 13 Oct 2024 15:15:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06pz-0007GM-67; Sun, 13 Oct 2024 18:13:19 -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 1t06pf-0007Bl-10 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:00 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pd-0000wr-Cp for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:58 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7ea78037b7eso739984a12.0 for ; Sun, 13 Oct 2024 15:12:57 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857576; x=1729462376; 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=617h4byv7OP/ct3y2kJCr5k6Qy1wZsttJUBcCYmwvNQ=; b=S7/pl+SZlm/Jr7EDi9K8b6MvpZQu0oiS6LLIgBmHbnLP+HTVv2AdQKx/WWIskg/kRv lMsOLj+XnXpk+ExO48fJETZHBO6S47UTu3auEoP5sTOMqBqg4+OdxfqAnR0tCBcYKz4u ydv/T9AuewN/QRQdbK31fzbzaOkqlvG8w9S3HJBOGX0EZ1Q+F2QJKDttR51GYpvUpMIk xOqDLbbANdPOgdL/CS+vGbuaVEbutfByIIYTU0nNqKmE6jlCDprJ2A+HtwKpXZfvi5U4 mFTG38C1bdZ2E+aBeu3QXWTl46QHkVdEVuaGNr6zGS3GIpIdENXmahx/xfah80G0cfwJ R5aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857576; x=1729462376; 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=617h4byv7OP/ct3y2kJCr5k6Qy1wZsttJUBcCYmwvNQ=; b=kfDR16tN+wpT1X36C92u+sfJQw49Bdn2aJ9IWoyp+LOzyJNrsWnOZtDPQK0AvcqFIy W/05p5mVkI5mW7y2bPYZO+SuzIdbPkf2GTK/L5Rv0L5ClN0vkfx7upEOzeP/NYurQ36R H6jUZxG3KlxHOHa1TsxM/GwB4l46LsN7GuY40iBlwjVTHcmvKyN0EHBJp36u5pDMAegW 3fhbGSxUEQtRPN3MHre3PDiQRoN3nxx870e1SlK2vAwJ9kQ3K7YShltuYHPqpL2NOk1F To549NjjbsEbu94ge4cvzhubxqHkTT15YKTQ54xQ5AL3oYXwygD/A8r/x4HxwCUOVP/4 Uc8Q== X-Gm-Message-State: AOJu0YzrDFHZcHMFNyrgiembd23Z0zqIjL+KUGISWvo+64ZbGBPXfLGF LksiraTniUk1V6sTrebOGk/mQT3Ggh2vFwO9MbztLO6tMuWLWEjclNU1aXqPFsmHIm8G2uO2Ht5 j X-Google-Smtp-Source: AGHT+IHCMfP0iC9XhE4zqzCwrjlXAEwJsfkBayeYy0o/GQ2AmM8uNqokYJDfnVG3m3dndoGmWaSQVg== X-Received: by 2002:a17:90a:f40f:b0:2e2:e092:5323 with SMTP id 98e67ed59e1d1-2e2f0d8c914mr10886896a91.29.1728857576065; Sun, 13 Oct 2024 15:12:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 21/27] target/arm: Pass MemOp to get_phys_addr_gpc Date: Sun, 13 Oct 2024 15:12:29 -0700 Message-ID: <20241013221235.1585193-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857752267116600 Zero is the safe do-nothing value for callers to use. Pass the value through from get_phys_addr. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 9af86da597..e92537d8f2 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -81,7 +81,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Trans= late *ptw, =20 static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); =20 @@ -579,7 +579,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Transl= ate *ptw, }; GetPhysAddrResult s2 =3D { }; =20 - if (get_phys_addr_gpc(env, &s2ptw, addr, MMU_DATA_LOAD, &s2, fi)) { + if (get_phys_addr_gpc(env, &s2ptw, addr, MMU_DATA_LOAD, 0, &s2, fi= )) { goto fail; } =20 @@ -3543,7 +3543,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1T= ranslate *ptw, =20 static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3641,7 +3641,8 @@ bool get_phys_addr(CPUARMState *env, vaddr address, } =20 ptw.in_space =3D ss; - return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi); + return get_phys_addr_gpc(env, &ptw, address, access_type, + memop, result, fi); } =20 hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, @@ -3660,7 +3661,7 @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs= , vaddr addr, ARMMMUFaultInfo fi =3D {}; bool ret; =20 - ret =3D get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, &res, &fi); + ret =3D get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, 0, &res, &fi= ); *attrs =3D res.f.attrs; =20 if (ret) { --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857638; cv=none; d=zohomail.com; s=zohoarc; b=K4wz420Hg+shF1MXlWsFdD3cged/cUx9Fc24bRguon1ZG+qC1l+FBqcldFZOljE5KO0XQHzV2FvRJtdLnGBdIpxYyQiwhNziYsHPMVs8n2PmaLxF574+M+H5PuzOtG9GQ1CKZ9Jw6Ur00Q2SGOnQzFdF56TE7BtkxAmzWpD0McI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857638; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HpCts7Lc7po90jMJZMaWUdEUzHFwVBTsaL90Hh3zO7Y=; b=Nb8IWQkYk+mGx/eAy0a+yY6EKcl6aws8RaDyfcvwFWdGPnsJ5HTEnHIQhuLgM4tmOe5q3xZ1qwpoxL0HP0228m5nSD4A/P4NQ1wDGjXsk/NhxxzT7vPdOz9Kzs3WTIdFOAHzZootyRPovOcBG4UKFlZkOugLpcOIeVfV5U7jNsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857638413148.27240006859824; Sun, 13 Oct 2024 15:13:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06q0-0007H4-2m; Sun, 13 Oct 2024 18:13:20 -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 1t06pg-0007Bn-1j for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:00 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pe-0000x3-D0 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:12:59 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2e188185365so2840308a91.1 for ; Sun, 13 Oct 2024 15:12:57 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857577; x=1729462377; 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=HpCts7Lc7po90jMJZMaWUdEUzHFwVBTsaL90Hh3zO7Y=; b=bmn4ZD0zL7DMGm1gR5ZhLlqQKWHunczXtg3dfZsxXhUOibwP2yX/V9DYAXAVm1IRIm Bgv5eTzOucYoV5XPOcSMRzPIU5DdIB4iauLb5lg+aaioH7cbwUfRMCvboyPfpj2XqRZ2 bw4fNNimSKDqei0noKntm+TV0k0K0xZzrMomJwmBvEyPLYFJJNAUSLqoSjy0nzPDeXVt U5lfpvHzpHVRkGf/BWqHASDHebLCM5NcvRktt6Tdw3vQEbaoK24gSu9PronUgCqNXzAH hMa7zgVoFjPh5iNxxxIFxFUJoW1dSA/D/FOP9UESZDfIH4qOqyS2gk8mb03TsfgKFe1b L4aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857577; x=1729462377; 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=HpCts7Lc7po90jMJZMaWUdEUzHFwVBTsaL90Hh3zO7Y=; b=R4lKjWv+FR5WkMuQQuMuDIiQMc2XIlbudvEQSSjaUTpHlmqMFXm3WdDXYZT93WRb3h sNN2NocAXbJVvsQhPABGJxVmMvFMnweKGfx3r6m8tmfccfmNxhHJy5x7NqWCXKxgxPkt c5UXkn0w9taX0J8HzIu16P+3grrnONpBdVWlIMvzgZuBQnTeUjb7xOowIk7ZCljhbpgv I7B2+ggQJ9mUJezgY9uv68N80p9X9wSSmUyqjjrIbnRhpFgxQivsqT084k3/YvXEF3Xf TnKHLw7g+3074BTEZ+WWj1O78gOPSSCpyFdlCqrwRqojNwQ0SdAV9y3kWsGeaynzxitK iMEQ== X-Gm-Message-State: AOJu0YxD1ttK4xviU+ejuedInEJ6oP8DBRd9qES2HecJ5EKNHzmY8cgC WMObcRsU0SfxS1SeFl3PrDIuLUYDz80mHm7IEg7ZaDAMov7hUvkEnB1rkeQMjFRWLX2Fn1+WQ3L K X-Google-Smtp-Source: AGHT+IHghjQRIs6cYbA6rGD/3eMJOK5GrRxNGVSwN053wdDB52hhREw1yF2qF4gfA1sYfbpImFfvQQ== X-Received: by 2002:a17:90a:6886:b0:2e2:b21b:2247 with SMTP id 98e67ed59e1d1-2e2f0d80e8cmr11945651a91.27.1728857576996; Sun, 13 Oct 2024 15:12:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 22/27] target/arm: Pass MemOp to get_phys_addr_nogpc Date: Sun, 13 Oct 2024 15:12:30 -0700 Message-ID: <20241013221235.1585193-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857639708116600 Zero is the safe do-nothing value for callers to use. Pass the value through from get_phys_addr_gpc and get_phys_addr_with_space_nogpc. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index e92537d8f2..0445c3ccf3 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -75,7 +75,7 @@ typedef struct S1Translate { =20 static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); =20 @@ -3313,7 +3313,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, ARMSecuritySpace ipa_space; uint64_t hcr; =20 - ret =3D get_phys_addr_nogpc(env, ptw, address, access_type, result, fi= ); + ret =3D get_phys_addr_nogpc(env, ptw, address, access_type, 0, result,= fi); =20 /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3339,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, cacheattrs1 =3D result->cacheattrs; memset(result, 0, sizeof(*result)); =20 - ret =3D get_phys_addr_nogpc(env, ptw, ipa, access_type, result, fi); + ret =3D get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); fi->s2addr =3D ipa; =20 /* Combine the S1 and S2 perms. */ @@ -3406,7 +3406,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, =20 static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp mem= op, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3547,7 +3547,8 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Tra= nslate *ptw, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { - if (get_phys_addr_nogpc(env, ptw, address, access_type, result, fi)) { + if (get_phys_addr_nogpc(env, ptw, address, access_type, + memop, result, fi)) { return true; } if (!granule_protection_check(env, result->f.phys_addr, @@ -3568,7 +3569,8 @@ bool get_phys_addr_with_space_nogpc(CPUARMState *env,= vaddr address, .in_mmu_idx =3D mmu_idx, .in_space =3D space, }; - return get_phys_addr_nogpc(env, &ptw, address, access_type, result, fi= ); + return get_phys_addr_nogpc(env, &ptw, address, access_type, + memop, result, fi); } =20 bool get_phys_addr(CPUARMState *env, vaddr address, --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857890; cv=none; d=zohomail.com; s=zohoarc; b=b/VGfln8Od9ozajUnsR4NpzOfDa8/AqDYYJnK/zIb6bI77y4erxGK0Z0XxH8rb7z/6fiV87h93nLLOA52FCA2E3RaHg2oHMxLWX6tSWkeMk21U+6cOCeZRkAajocKUYFc9xLigHN4tyVqHJPkDe0dk+8D5/KUgdKgbdRKkr6nWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857890; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nPsGlRApUHllpr7HECmYu85LwKI3gq1PeB/gQzKhtMY=; b=E9gqv8ZgNa7sW7cEZJe+85/mesAGVBQiN8t+BATwAktTaqmGH8+kVEjcHkO4Noppm0cKImaGqMbRiNUEsRDvD7wo4rvQQuBfqTGljiRt/GBzK0Z+NUtT1Jn0UTtx+Sch2kjHIZ7sMx14e2nOjarp7bh0IA/Tl7IK+5nilm2/IJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857890197838.3857302648677; Sun, 13 Oct 2024 15:18:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06q1-0007HF-1T; Sun, 13 Oct 2024 18:13:21 -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 1t06pg-0007CP-Ok for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:01 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pf-0000xB-B2 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:00 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2e2a97c2681so2633640a91.2 for ; Sun, 13 Oct 2024 15:12:58 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857578; x=1729462378; 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=nPsGlRApUHllpr7HECmYu85LwKI3gq1PeB/gQzKhtMY=; b=a5eVqYWvGSmnfNWZMVOyApLbkdqJSqPmd1kq8lKCw8RJ4d15JR6JnZHiByyvEDEmXf N7768V2wn5RPh4kH0A0JLJSIskaQb+K9jUnHTscJTbDzmdTQ6UALuThB/GQ+8K7lrHti gcELCjrtYRmZuLhCbzCr+/bwfoWZfBm33wBXJhiMqfkdwHXQEnHq55AcPh6SsoNv+K6P 0YB7KCX4zAF1u4Wi6NmwZwaGrfXFBXXtq3fMluyaTjNjZYklKF7RWBJIh0rlrTXM4gYt /dg9MXsXkIDdt5sIK7jGfzlLo8bKiXJMS3BSG3cc1MVFVyhhcV4KdljPShLjm5PGqi/F o0aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857578; x=1729462378; 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=nPsGlRApUHllpr7HECmYu85LwKI3gq1PeB/gQzKhtMY=; b=W0u99OF+JTpmJQsZU2Uta0EVddGCtGudoEHxeMq/Ujz0IrxUqS1e/mxDoSUucf+YlG qH2+ouI1QvFZ8YonRKmePTxw7lSU1+hgw+gUYdBbCb1MACJ1rAlpUNBVzYfRK1Rru16R NDoCh/8qGZeaaRNnWpgrj1Q9SoGnAqB6uQ9EhFTf/J20WQi+CGzsvi9Gl3J/bkNCVC9Y Pi2lBeqsFuCZqZiBvEyhIpcNnvXi9BJXronFAKFyY/cQb2NffZXK74TJhgrbSLQD/DpX PL9O2mb+cX1v01mRjDxmNuzDYPYJSUccH70S8zMPKJsu4AAMZa60A7oW3BDoMzvTb934 Qt3A== X-Gm-Message-State: AOJu0YxnsKyxVS0jV/e0ZpBWWrZha6Zqo+PgoZPaR7TcGW/QY4XbALnq ycXwjXPfIVYiV+HARxqJu2dW0e3MDPm+YWXCypOBT9V1toBzHUlfVqEfLgsJ2uBpzPWNIpXS3a+ A X-Google-Smtp-Source: AGHT+IE4nIwz6w08ekeXRdEwDegLKka9MgNchvoOvimoEiuvQBp8xoACW+i9qBtGCwecY+miEzU6/w== X-Received: by 2002:a17:90b:1056:b0:2e0:db81:4f79 with SMTP id 98e67ed59e1d1-2e2f0a2fb2cmr11105444a91.2.1728857578022; Sun, 13 Oct 2024 15:12:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 23/27] target/arm: Pass MemOp through get_phys_addr_twostage Date: Sun, 13 Oct 2024 15:12:31 -0700 Message-ID: <20241013221235.1585193-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857890675116600 Pass memop through get_phys_addr_twostage with its recursion with get_phys_addr_nogpc. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 0445c3ccf3..f1fca086a4 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3301,7 +3301,7 @@ static bool get_phys_addr_disabled(CPUARMState *env, =20 static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3313,7 +3313,8 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, ARMSecuritySpace ipa_space; uint64_t hcr; =20 - ret =3D get_phys_addr_nogpc(env, ptw, address, access_type, 0, result,= fi); + ret =3D get_phys_addr_nogpc(env, ptw, address, access_type, + memop, result, fi); =20 /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3340,8 @@ static bool get_phys_addr_twostage(CPUARMState *env, = S1Translate *ptw, cacheattrs1 =3D result->cacheattrs; memset(result, 0, sizeof(*result)); =20 - ret =3D get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); + ret =3D get_phys_addr_nogpc(env, ptw, ipa, access_type, + memop, result, fi); fi->s2addr =3D ipa; =20 /* Combine the S1 and S2 perms. */ @@ -3469,7 +3471,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1T= ranslate *ptw, if (arm_feature(env, ARM_FEATURE_EL2) && !regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_sp= ace)) { return get_phys_addr_twostage(env, ptw, address, access_type, - result, fi); + memop, result, fi); } /* fall through */ =20 --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857685; cv=none; d=zohomail.com; s=zohoarc; b=ZtrhHHVSDHKIw5a4aqC5d1C2GaxJQL47X08p/fftuoEzj11nl2VDbc5Jsg+92VyCzy/S9m+JQojIvWrVgnZ/V3pa8mzpFKaFW7sO9fnmd3ZR46n3rnhtqlX7fFoWxUJbO0GB1UBebL2wG3lnn1A+92UCnifOMO6vuvx7AV1NFgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857685; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zDNpltdoK5BIHBCpA0bLYhC/fVRvo8Z+4KE41wqkR3g=; b=FVVybeZ3pPXtxqaPxSjvahXD6hXoqXNYZgNz4xIYJ068CgzpfC6wWhtoLJazunzRkHT8d1oGAhakkE7COyjMQZh/dP2fMmnY4+SmGDxobcTAzqbLYQQyD9pmyR8/SGnqPy276gOyI9lYflKlQPLyAIxT9MFWtnciXKbYUCcvyyc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857685143967.7015700721047; Sun, 13 Oct 2024 15:14:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06q2-0007Hb-8c; Sun, 13 Oct 2024 18:13:22 -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 1t06ph-0007Ce-Pq for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:02 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pg-0000xO-5A for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:01 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2e2ad9825a7so2480641a91.0 for ; Sun, 13 Oct 2024 15:12:59 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857579; x=1729462379; 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=zDNpltdoK5BIHBCpA0bLYhC/fVRvo8Z+4KE41wqkR3g=; b=A5xhuLMD5Tood3W5PdqLDsO5jGUdvunXfyte6dXi7/OMMEe2RDmbvVVa4GUjDgWy0p 9XrrUubZf++zN8lCnJYaktIx2mri71oNPUgRwqqMcYP4fgn+EYcyhKnBc0AGlgP+K+7H hw0buD0V2B7o1zCJpk8SwzNjl1gWU7Rdzis11S2IkX2vHgU8HLUmrE7z8wrBc66qF+0Z vmXxDfvq4L5LJfxXnpQ+RphquBtYduJXlN1HYqpOrvHL17+nF5FV3Wd9qktmYj0fez6f j+ydzszzlfsTPclsjiw1c/XW/5tT37HMwBj8g5h5bxQcOSrwZSwYTRsQWhaOkWTAbLzT 6Wyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857579; x=1729462379; 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=zDNpltdoK5BIHBCpA0bLYhC/fVRvo8Z+4KE41wqkR3g=; b=NhV+d/n8HhcR6SCA+Zx8yLtai+i9AwUjz6NzpGzemsXwbMgcujYPwmb8RMtr07OzA9 LRVoTg7NKRuYYvEbNtWJXxzphbcLyBHARO290jx0FANoll6Y5jbpTaRaAEnOOWUycZFE 55Dwg1Gho6AXeUBB3wYguJS6dV9p7UF2pjw7czEaJ+WlxLeIG8zBrOCsG1Fc+MuOOT44 PbmENYzuCFq1yXqBfKFQB4fVahbujFbUf8sn/A8AsNnLVAfSuDOYV1V4S1aetWN0Ne5R u/NBxOtpNh2I7M73UgMVDLH0G/1eN1ujxqfVilWPTWzceO80Wudt+2QjPaVZ9PI9tLS/ o2hQ== X-Gm-Message-State: AOJu0Yz4qttA0/tywgbFIQcrCDHbmEoxeUpdOiEhpzM0HD5tzLeuiztD QmMoe/Dednga6N4+BvYgOgbmLosCC5XMY2RUaD+wTk+sBb8UzAd7oSAIJdAbZSvbbW849Zswuz3 i X-Google-Smtp-Source: AGHT+IHQhpFnqbb7myorjPUSvjw1PQblrlzAOqaM2r9BRe6AvBH4FsPVJaWYqALyTW8PkJ1X3QoywA== X-Received: by 2002:a17:90a:e00e:b0:2e2:ede0:91c with SMTP id 98e67ed59e1d1-2e2f0dc2e8cmr13128374a91.36.1728857578911; Sun, 13 Oct 2024 15:12:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PULL 24/27] target/arm: Pass MemOp to get_phys_addr_lpae Date: Sun, 13 Oct 2024 15:12:32 -0700 Message-ID: <20241013221235.1585193-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857685815116600 Pass the value through from get_phys_addr_nogpc. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index f1fca086a4..238b2c92a9 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1684,12 +1684,13 @@ static bool nv_nv1_enabled(CPUARMState *env, S1Tran= slate *ptw) * @ptw: Current and next stage parameters for the walk. * @address: virtual address to get physical address for * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH + * @memop: memory operation feeding this access, or 0 for none * @result: set on translation success, * @fi: set to fault info if the translation fails */ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, uint64_t address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo = *fi) { ARMCPU *cpu =3D env_archcpu(env); @@ -3534,7 +3535,8 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1T= ranslate *ptw, } =20 if (regime_using_lpae_format(env, mmu_idx)) { - return get_phys_addr_lpae(env, ptw, address, access_type, result, = fi); + return get_phys_addr_lpae(env, ptw, address, access_type, + memop, result, fi); } else if (arm_feature(env, ARM_FEATURE_V7) || regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, ptw, address, access_type, result, fi= ); --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728858047; cv=none; d=zohomail.com; s=zohoarc; b=L1bLOmX5iCsHl1KOWd2qlUhVvjdybcc9XXVixjzTyphDgEyaLPnYp5l+vfgbmOweSbDnnptR7xfavS2DMudqTAJ60VDGSnFE3gj4niIQWAJ40kLxznJjuQLdjGFB9pO9o3W32WQD+8H/MEuTbT/F0jHkOt1GXtXl1eF5KkkydM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728858047; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oOELs1GBJLtlq8nQGFT7BbF8Y02om3aScvqBsVkX7+Q=; b=ggTFA2Eioup27OUvwIDMxPypPN+OmlNpNyycGhVPdyMfJsjOxCF8/WRfE12pdM+ZzF/ZpCx9hXeAXNNWSlRGC5UvnDnOi0MgoAxuY+DPPi5uvmuMuvPU9jr75TldTcs1i+3rPgOY5wHW1/T3I5H6eOrl3PH3BaD8grXgqg1+6wg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728858047576570.0482639377609; Sun, 13 Oct 2024 15:20:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06py-0007Fi-Je; Sun, 13 Oct 2024 18:13:18 -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 1t06pj-0007DC-2S for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:04 -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 1t06ph-0000xd-9H for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:02 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2e2a97c2681so2633649a91.2 for ; Sun, 13 Oct 2024 15:13:00 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857580; x=1729462380; 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=oOELs1GBJLtlq8nQGFT7BbF8Y02om3aScvqBsVkX7+Q=; b=t1H7PVN6m8eHoMXNAjpjy/tQ8bk4o7HLTHpxddvugB3HQPMP2Mq8g6jHVv3/BJHc7+ eWeXZM8KocZS538p/VDxpuMnbRG+bonTLKSDVizWsz1g1OAaU96W1Hzx6veysmLOoZzI rNWzzYG26m5AypyZszrmA+rfHoyZneOD5rrD0q0MNzD1Sb4Q6iNHJl9m+dz7UszaDPbV xWFZFxIVZGgBA9bbdtZAlFg1pudAtZM1aUnyul/QYw4MCw5h9RwFZXmk2H3aI5Urv9Aw nF0MpyGk+USkYm3zD9vV94VXNGQeovyJqCHwFwot0lyr4OrZdukt37qJeD3CbTmIhyfI 3Z9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857580; x=1729462380; 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=oOELs1GBJLtlq8nQGFT7BbF8Y02om3aScvqBsVkX7+Q=; b=PbRshuBM9p1rFctqMK+uu1wN7ZH8psHfwhQqeRd0QPpNciTzJSmBBgNCiZ4Ze6+taR yW6W6RM0NP4v1MY0OP9IurYVy5MjAfNp/Qr4KFP+76XPL6OA6kUti9j3r8HS0249PX17 xhomq9uArInV0TI5W05RjwQfbAWPbhrBbBdx+IBScTolGi6rL2PwlGPRiwtRS4VU+Kaq RygeULf7845YsmuOTR3BKdtaB5XbvYzg8WKudplfysZYME4gaMGy84hLL4DTmqq6sVsa C0efJPtM/ezYEeyV1tk36cGg8iEQ50aiWI8UKuIEASxZS3Hmg8x9TrZlIkl1akNCJo18 2VPg== X-Gm-Message-State: AOJu0YwyEMepyGH/olrI4XIbDX8Hjwz8FaVRQCz5OwjrdsoyF73PWxfs 5Tq0ZutblXfoOebEQHl4TN+AoJ2iMB6jFzoQNG5MgLsLYuEwwfipL7Ek0AjIgGdGDguwQr/EMGD / X-Google-Smtp-Source: AGHT+IGvF2YTqWLWFscInM+uhdd/nr1DtHKoPW8/pCJ3G3EGGnqFEvq0YbYJn8nIsX1MzrsqXiPPyA== X-Received: by 2002:a17:90b:2242:b0:2e2:a667:1a10 with SMTP id 98e67ed59e1d1-2e2f0f08c2emr11229279a91.38.1728857579842; Sun, 13 Oct 2024 15:12:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 25/27] target/arm: Move device detection earlier in get_phys_addr_lpae Date: Sun, 13 Oct 2024 15:12:33 -0700 Message-ID: <20241013221235.1585193-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728858049280116600 Content-Type: text/plain; charset="utf-8" Determine cache attributes, and thence Device vs Normal memory, earlier in the function. We have an existing regime_is_stage2 if block into which this can be slotted. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 238b2c92a9..0a1a820362 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2029,8 +2029,20 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, xn =3D extract64(attrs, 53, 2); result->f.prot =3D get_S2prot(env, ap, xn, ptw->in_s1_is_el0); } + + result->cacheattrs.is_s2_format =3D true; + result->cacheattrs.attrs =3D extract32(attrs, 2, 4); + /* + * Security state does not really affect HCR_EL2.FWB; + * we only need to filter FWB for aa32 or other FEAT. + */ + device =3D S2_attrs_are_device(arm_hcr_el2_eff(env), + result->cacheattrs.attrs); } else { int nse, ns =3D extract32(attrs, 5, 1); + uint8_t attrindx; + uint64_t mair; + switch (out_space) { case ARMSS_Root: /* @@ -2102,6 +2114,19 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, */ result->f.prot =3D get_S1prot(env, mmu_idx, aarch64, ap, xn, pxn, result->f.attrs.space, out_space); + + /* Index into MAIR registers for cache attributes */ + attrindx =3D extract32(attrs, 2, 3); + mair =3D env->cp15.mair_el[regime_el(env, mmu_idx)]; + assert(attrindx <=3D 7); + result->cacheattrs.is_s2_format =3D false; + result->cacheattrs.attrs =3D extract64(mair, attrindx * 8, 8); + + /* When in aarch64 mode, and BTI is enabled, remember GP in the TL= B. */ + if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { + result->f.extra.arm.guarded =3D extract64(attrs, 50, 1); /* GP= */ + } + device =3D S1_attrs_are_device(result->cacheattrs.attrs); } =20 if (!(result->f.prot & (1 << access_type))) { @@ -2131,30 +2156,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, result->f.attrs.space =3D out_space; result->f.attrs.secure =3D arm_space_is_secure(out_space); =20 - if (regime_is_stage2(mmu_idx)) { - result->cacheattrs.is_s2_format =3D true; - result->cacheattrs.attrs =3D extract32(attrs, 2, 4); - /* - * Security state does not really affect HCR_EL2.FWB; - * we only need to filter FWB for aa32 or other FEAT. - */ - device =3D S2_attrs_are_device(arm_hcr_el2_eff(env), - result->cacheattrs.attrs); - } else { - /* Index into MAIR registers for cache attributes */ - uint8_t attrindx =3D extract32(attrs, 2, 3); - uint64_t mair =3D env->cp15.mair_el[regime_el(env, mmu_idx)]; - assert(attrindx <=3D 7); - result->cacheattrs.is_s2_format =3D false; - result->cacheattrs.attrs =3D extract64(mair, attrindx * 8, 8); - - /* When in aarch64 mode, and BTI is enabled, remember GP in the TL= B. */ - if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { - result->f.extra.arm.guarded =3D extract64(attrs, 50, 1); /* GP= */ - } - device =3D S1_attrs_are_device(result->cacheattrs.attrs); - } - /* * Enable alignment checks on Device memory. * --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728857750; cv=none; d=zohomail.com; s=zohoarc; b=F9lQuQlgpWXLHNH17HbQNSKQETJkpgapODMsHzFJxNOSuh9gNwORs83KrN1IaCeNSjGp9FBihVcHeDuhddFOfImNI6DpjyC4iLNwkUKT4Qbb3baWDG1H1ChnjOKbKgRO8YVAAVQt3FN1D1Tt6FiCl2ss9J7QpuVdQ7TYrOipZLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728857750; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J+vEW0gmQhnEtA5RzJM7KFg+N4W9KtFO8BjH5/MF//A=; b=I11EpoO4zL/QD+ayWofcTgUvIWRX7Cb4AluoD+akPRwq7r6eTpFc0HbqAgopTag+eyk57HTLXxJnuaZi2W/9N5dl09F57A0hqpJf1Xk4/ViX6a24aBoaGNGErYRp0beh1qFqmbEJP/SWs0k8EfZXmd8XouovejXtutm/6d93Yuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728857750689746.9136604924645; Sun, 13 Oct 2024 15:15:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06q3-0007IQ-Jw; Sun, 13 Oct 2024 18:13:23 -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 1t06pj-0007DE-SC for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:04 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pi-0000xm-7w for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:03 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2e2a97c2681so2633652a91.2 for ; Sun, 13 Oct 2024 15:13:01 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857581; x=1729462381; 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=J+vEW0gmQhnEtA5RzJM7KFg+N4W9KtFO8BjH5/MF//A=; b=RN7KYxBg/ZwhFiFkBrMw7/CRWtFbJZtW8uVqqgpbpsfHFIg+dwX/qfgA+se5ks/5Ie qecyrVSfUvXdmhy7Z405NqpryT3nAnFwq1U6UgBenM5pPFHkBGdCM0E1evPTv70fuhcD g6vjtf5OYEgm2a4AfH7fgr/zQO7gHeHDYUd1Y1gKetyNARRojUDSGolEgXlQKdbPEbh+ rvFSfA8HEvS0oKvx/dwmnJ0qBRkkG/OJbISJVWMejoNcuSyNSNtW6XHevdBl6kHY2JwD Ugv5gjS3wXWBUPXj1bQKxrrPQuBbzniQp3jpIbbTJRiefkTABbP6P+XKTyyDPWVyvLJd 11ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857581; x=1729462381; 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=J+vEW0gmQhnEtA5RzJM7KFg+N4W9KtFO8BjH5/MF//A=; b=TGhkDLuNJuPiIj37AJaWopH5xYaxRpEEQHT8hL/g0nU2uU3dcyw7wN/bdpv0ZaPnTG +e+GE0nrSO4dFtT9naVrVEnA7XtOM3QvKOhyxV2f5mxdzb15citHDfOl9YfD8+gPZ5q0 8vka/9cTkJT2/bd/blEIv+0nRTtMiD8hQZ8+8G0ch4os/Ro+VVRuXL30YUpR4hVpkiCf I0Ht4Jdxvt9x0+v90HGdWUvn+A42dQEfO7fy2W71Bqb2LISH3OGDCCMZD7fskTSm9Skr QQC4pcG43HXZtBakKsOtC0wRkkQh45FBqPeFtAbTrB9KG+Bzib9RDCVcpMRp/o84OTvt 19Eg== X-Gm-Message-State: AOJu0YzAkXRkELdpxGGngShWhlK25Gvzl4TlEg1o8WNcjjEshoJRcTEe 3BagFZwt/zXs+dbKKGK+ZptcYR0cahYeWFxHo2fO8IdrMRcNe6kp58l/T8Gp8KJseOIxgQjbh3b 1 X-Google-Smtp-Source: AGHT+IE8odUALb7Bp2QQwhArRc/UPU6DqIBUaiM04O3oaTB/RMTGF0m2ka1YmYWXlv8f2srBYPTr3g== X-Received: by 2002:a17:90a:67c6:b0:2e0:f896:b806 with SMTP id 98e67ed59e1d1-2e2f0d7aa36mr12237239a91.27.1728857580881; Sun, 13 Oct 2024 15:13:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 26/27] target/arm: Implement TCGCPUOps.tlb_fill_align Date: Sun, 13 Oct 2024 15:12:34 -0700 Message-ID: <20241013221235.1585193-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728857752342116600 Content-Type: text/plain; charset="utf-8" Fill in the tlb_fill_align hook. Handle alignment not due to memory type, since that's no longer handled by generic code. Pass memop to get_phys_addr. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 6 ++--- target/arm/cpu.c | 2 +- target/arm/tcg/cpu-v7m.c | 2 +- target/arm/tcg/tlb_helper.c | 49 ++++++++++++++----------------------- 4 files changed, 24 insertions(+), 35 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index a6088d551c..299a96a81a 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -816,9 +816,9 @@ void arm_cpu_record_sigsegv(CPUState *cpu, vaddr addr, void arm_cpu_record_sigbus(CPUState *cpu, vaddr addr, MMUAccessType access_type, uintptr_t ra); #else -bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr); +bool arm_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr addr, + MMUAccessType access_type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t r= a); #endif =20 static inline int arm_to_core_mmu_idx(ARMMMUIdx mmu_idx) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 19191c2391..1320fd8c8f 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2663,7 +2663,7 @@ static const TCGCPUOps arm_tcg_ops =3D { .record_sigsegv =3D arm_cpu_record_sigsegv, .record_sigbus =3D arm_cpu_record_sigbus, #else - .tlb_fill =3D arm_cpu_tlb_fill, + .tlb_fill_align =3D arm_cpu_tlb_fill_align, .cpu_exec_interrupt =3D arm_cpu_exec_interrupt, .cpu_exec_halt =3D arm_cpu_exec_halt, .do_interrupt =3D arm_cpu_do_interrupt, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 5496f14dc1..58e54578d6 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -242,7 +242,7 @@ static const TCGCPUOps arm_v7m_tcg_ops =3D { .record_sigsegv =3D arm_cpu_record_sigsegv, .record_sigbus =3D arm_cpu_record_sigbus, #else - .tlb_fill =3D arm_cpu_tlb_fill, + .tlb_fill_align =3D arm_cpu_tlb_fill_align, .cpu_exec_interrupt =3D arm_v7m_cpu_exec_interrupt, .cpu_exec_halt =3D arm_cpu_exec_halt, .do_interrupt =3D arm_v7m_cpu_do_interrupt, diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 1d8b7bcaa2..8841f039bc 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -318,14 +318,13 @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwad= dr physaddr, arm_deliver_fault(cpu, addr, access_type, mmu_idx, &fi); } =20 -bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool arm_cpu_tlb_fill_align(CPUState *cs, CPUTLBEntryFull *out, vaddr addr= ess, + MMUAccessType access_type, int mmu_idx, + MemOp memop, int size, bool probe, uintptr_t r= a) { ARMCPU *cpu =3D ARM_CPU(cs); GetPhysAddrResult res =3D {}; ARMMMUFaultInfo local_fi, *fi; - int ret; =20 /* * Allow S1_ptw_translate to see any fault generated here. @@ -339,37 +338,27 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, in= t size, } =20 /* - * Walk the page table and (if the mapping exists) add the page - * to the TLB. On success, return true. Otherwise, if probing, - * return false. Otherwise populate fsr with ARM DFSR/IFSR fault - * register format, and signal the fault. + * Per R_XCHFJ, alignment fault not due to memory type has + * highest precedence. Otherwise, walk the page table and + * and collect the page description. */ - ret =3D get_phys_addr(&cpu->env, address, access_type, 0, - core_to_arm_mmu_idx(&cpu->env, mmu_idx), - &res, fi); - if (likely(!ret)) { - /* - * Map a single [sub]page. Regions smaller than our declared - * target page size are handled specially, so for those we - * pass in the exact addresses. - */ - if (res.f.lg_page_size >=3D TARGET_PAGE_BITS) { - res.f.phys_addr &=3D TARGET_PAGE_MASK; - address &=3D TARGET_PAGE_MASK; - } - + if (address & ((1 << memop_alignment_bits(memop)) - 1)) { + fi->type =3D ARMFault_Alignment; + } else if (!get_phys_addr(&cpu->env, address, access_type, memop, + core_to_arm_mmu_idx(&cpu->env, mmu_idx), + &res, fi)) { res.f.extra.arm.pte_attrs =3D res.cacheattrs.attrs; res.f.extra.arm.shareability =3D res.cacheattrs.shareability; - - tlb_set_page_full(cs, mmu_idx, address, &res.f); + *out =3D res.f; return true; - } else if (probe) { - return false; - } else { - /* now we have a real cpu fault */ - cpu_restore_state(cs, retaddr); - arm_deliver_fault(cpu, address, access_type, mmu_idx, fi); } + if (probe) { + return false; + } + + /* Now we have a real cpu fault. */ + cpu_restore_state(cs, ra); + arm_deliver_fault(cpu, address, access_type, mmu_idx, fi); } #else void arm_cpu_record_sigsegv(CPUState *cs, vaddr addr, --=20 2.43.0 From nobody Sat Nov 23 21:31:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728858044; cv=none; d=zohomail.com; s=zohoarc; b=W9BQ0C36P1nt/Duw42D+KD8jm7C+5KQFZF4c46W/lTCfChmustc8Lq3LawQA13W54BgoRHtJ5DnJ1iOGm2v6EXSTF9sTFzHUfbiDDinDgroe6g2i2Vjv49mCsUX/UUFpQrQNXZ0IKQtxL67kk6tkiPgL5XTFexzpCIcOFS2Ob20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728858044; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G2SEeBS4yBn5Ue1nQmA6MrWE5kNjL002NNNwwbKYNls=; b=Qmly6pnz7v7nBa8SESFJld/s7zKcklWdQ39RxfxM0+4LPno3G1wYK72HSLNawItwcu7eCPKO4FiWST56cWoTn9GaR7vAxR9hVJamqTUe2kKS6LIXU77Kc90gnz0fDPIIZuYRHxEr1Z/WwfzA08qbWVvET09EfuUnIDIgTM6Fa6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728858044351604.7790727351345; Sun, 13 Oct 2024 15:20:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t06q4-0007JD-PB; Sun, 13 Oct 2024 18:13:24 -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 1t06pl-0007Da-21 for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:06 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t06pj-0000xv-4M for qemu-devel@nongnu.org; Sun, 13 Oct 2024 18:13:04 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2e2e2d09decso2023061a91.1 for ; Sun, 13 Oct 2024 15:13:02 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5df1eebsm7271958a91.17.2024.10.13.15.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 15:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728857582; x=1729462382; 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=G2SEeBS4yBn5Ue1nQmA6MrWE5kNjL002NNNwwbKYNls=; b=r/EMBe5sOSc6hzF57LU7ISDDP5djrRFTqJiikhAFegYM+4TDDx9LHTkUNv9Jth07Sg Ff9ZqERL4RrjK2VKKtbk1htWhC/zLGbWLbUkZFFHJwMk4RnACYH+hzjLuX6ZjagAlQ9R Pd/LmwfnjriG7e+2GxH1VcYD5fmcitOySDshVK3f8KMIJ6BfsRk7b3v5rbX5MwonLNPp dDaDHbot8wxzARtPbW4VWX5ZTKlsiZAd9NnO4QDzmRhcZuRR8/+/AZndCF9FRlegUOaO 2spasXPNbg2X9Ky4+4COuuFKrQWu0MMJnglhDvFxC8J4HXJE1GPjCrBQrgT2EuA/kh35 samw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728857582; x=1729462382; 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=G2SEeBS4yBn5Ue1nQmA6MrWE5kNjL002NNNwwbKYNls=; b=vLr9XYnzMFtWVtIE+okFrbYvOUX6KYL/G4+zkCjcxa1Kj25w1fhMPnaMqT0twlV4xF 4pwma1psVtN8DGLIBzW6u/DG/a2lUuWDvxNj85UA5E9V+S4oxJDq2VHbi4pnEi7c9KjA FN4NFrS9Qa0tzRSgx51LYrRjYBwwz3/87scLKsNaBlwC45m6LL2E1j62JwP2tTk0pHfl kLcs8p9OPKkIFHsYSj7TWqJs4E63l2nGDENjBsuqY7L2Mm/wRSG3rQXWA+p2AOWnht9W bGLuXH+MBHP3l8krip4mmeUiciRNVubaKPZypmUN5a0H48GRrY6/KS+D/p49xWWEnfhf BX/A== X-Gm-Message-State: AOJu0YxZmOi/2cWkzbZkm7U1OuqQil+BEMGRT09gDMtBvXBOqb6kExZ2 vzyXOvmikruzeZ0sdjpWdmensQyr70F8+2YtXNTBEKwLZHwAKzY0nTLQb4zVXopmXwnED4OrVi8 6 X-Google-Smtp-Source: AGHT+IHDC4ts9ocHqy6SAH35JDroJhuKCs3Id7MttegPHlnoQZYJRRstopLO4gX+bU1U9JKIMGhs0Q== X-Received: by 2002:a17:90a:c2c6:b0:2e2:a5fd:7e4c with SMTP id 98e67ed59e1d1-2e2f0aa8b36mr14247839a91.8.1728857581678; Sun, 13 Oct 2024 15:13:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 27/27] target/arm: Fix alignment fault priority in get_phys_addr_lpae Date: Sun, 13 Oct 2024 15:12:35 -0700 Message-ID: <20241013221235.1585193-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241013221235.1585193-1-richard.henderson@linaro.org> References: <20241013221235.1585193-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728858045541116600 Content-Type: text/plain; charset="utf-8" Now that we have the MemOp for the access, we can order the alignment fault caused by memory type before the permission fault for the page. For subsequent page hits, permission and stage 2 checks are known to pass, and so the TLB_CHECK_ALIGNED fault raised in generic code is not mis-ordered. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/ptw.c | 51 ++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 0a1a820362..dd40268397 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2129,6 +2129,36 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, device =3D S1_attrs_are_device(result->cacheattrs.attrs); } =20 + /* + * Enable alignment checks on Device memory. + * + * Per R_XCHFJ, the correct ordering for alignment, permission, + * and stage 2 faults is: + * - Alignment fault caused by the memory type + * - Permission fault + * - A stage 2 fault on the memory access + * Perform the alignment check now, so that we recognize it in + * the correct order. Set TLB_CHECK_ALIGNED so that any subsequent + * softmmu tlb hit will also check the alignment; clear along the + * non-device path so that tlb_fill_flags is consistent in the + * event of restart_atomic_update. + * + * In v7, for a CPU without the Virtualization Extensions this + * access is UNPREDICTABLE; we choose to make it take the alignment + * fault as is required for a v7VE CPU. (QEMU doesn't emulate any + * CPUs with ARM_FEATURE_LPAE but not ARM_FEATURE_V7VE anyway.) + */ + if (device) { + unsigned a_bits =3D memop_atomicity_bits(memop); + if (address & ((1 << a_bits) - 1)) { + fi->type =3D ARMFault_Alignment; + goto do_fault; + } + result->f.tlb_fill_flags =3D TLB_CHECK_ALIGNED; + } else { + result->f.tlb_fill_flags =3D 0; + } + if (!(result->f.prot & (1 << access_type))) { fi->type =3D ARMFault_Permission; goto do_fault; @@ -2156,27 +2186,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1T= ranslate *ptw, result->f.attrs.space =3D out_space; result->f.attrs.secure =3D arm_space_is_secure(out_space); =20 - /* - * Enable alignment checks on Device memory. - * - * Per R_XCHFJ, this check is mis-ordered. The correct ordering - * for alignment, permission, and stage 2 faults should be: - * - Alignment fault caused by the memory type - * - Permission fault - * - A stage 2 fault on the memory access - * but due to the way the TCG softmmu TLB operates, we will have - * implicitly done the permission check and the stage2 lookup in - * finding the TLB entry, so the alignment check cannot be done sooner. - * - * In v7, for a CPU without the Virtualization Extensions this - * access is UNPREDICTABLE; we choose to make it take the alignment - * fault as is required for a v7VE CPU. (QEMU doesn't emulate any - * CPUs with ARM_FEATURE_LPAE but not ARM_FEATURE_V7VE anyway.) - */ - if (device) { - result->f.tlb_fill_flags |=3D TLB_CHECK_ALIGNED; - } - /* * For FEAT_LPA2 and effective DS, the SH field in the attributes * was re-purposed for output address bits. The SH attribute in --=20 2.43.0