From nobody Sat Nov 23 21:39:42 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=1728432396; cv=none; d=zohomail.com; s=zohoarc; b=Ryg/Xjkrw96OGbOL87tA9XEre6CQ4xg/nVS+GuY+Ka5zcsHaD74OB1QX34VP8YUNIaDnsQXTU3HH7YKB3rhFIaP9bbLNkExomE2hIy7c2dWy8ADtgP3QCkEoVOpapmc2Hh4ZFPNjiv8lSuA6hhEKpTX9hCWMEOmPuhamad4B0Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432396; 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=gGqng9uDR9xMR73cJW0CNyrBWcoH8Uf9ru5X6EZ5zNUhEv6a/6g2xklj2DwK/zgKSbEzN36tZdLlJ83nAtODV+59HyrHss2z5nqXCjwLnjK7s1Ul9ehY6al22Vwzr8htVrbGC9uviuf7rb8xZZrHt2mz3GJFyeis/DIJzfr3no0= 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 1728432396735284.5540231294698; Tue, 8 Oct 2024 17:06:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCM-0004Ba-1B; Tue, 08 Oct 2024 20:05: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 1syKCJ-0004A9-DY for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:04:59 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCH-0002di-Ri for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:04:59 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20c56b816faso12428875ad.2 for ; Tue, 08 Oct 2024 17:04:57 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432296; x=1729037096; 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=nZv6tFi4WdYRsBEvStKzqOAg0typjQrlacmlxt7xUML2/TmWLU4TibE5wB5SE9AW6W tZdhQRufXAw4yCGUhmXoE8A1DS4VhhGWoBaO3O2MoQclktPU0IGTgxm8NczbV+IVtYZ9 aPtheu1Y0a2vJKnghysimaj454JmmclgNh09YYYF46U2TJUzc3LesvZeZtEctIWHMO/+ 8a+rbPkreTq81q490I24GMOp1NFzcsOdXXJPA0uGKe2PTm/AoO+iYGNfMrIAiFvN0wIk iRhi3ksOJYJibWJYSoXzvu7hP2ZNvnaN0EQiatWHJ93EvwyaTP1ZNVNag/3h9yauOCmg 8q+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432296; x=1729037096; 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=jvCrEZi+pfAb2GWj22OA9GUDBUNq2tfnNJyP4hi+Hq3CrsztB160Q/sYyHH3Xqf1yX py1Y5mHIm9Q7MlvPU/hq0x6TeAo0iQ5Zh3l99gmb5Dp07ojtJMe8ln9BKg8AhCqyT85T mzX5odJgBD6zyRXXrRz0f9mP55dw3RQIybIHN5trVu0qO0Wy2KLwGeRCPZQOmmt8DXI6 V383hPHSUa3k6YSuJijsc2fxT6STnR7A6+NETwa5kowzZAUB3JEp/0znAb19/4wNqvqP JxZiKC2yyeq2z75+ywMoSaCb2430IGEDk3jYY/uvDshzDseIZW+Q6LUGz0wqnYghLwAb wDrg== X-Gm-Message-State: AOJu0Yx74jMig4UC4ZtszAscXRR9VKcF7HLPCIEe2N1N7kkEXmn8TPUi Nyy3fkq60M0aEMLS+XSdFpPFQYA4V3aluQfrYvKVfVLlSKHjkBFpz/BPja0k+5rElR8QeLfmlNU 5 X-Google-Smtp-Source: AGHT+IH2ZvMU4bGuSg+tDG+ztb5xg61iiZPQqytdtvNBcTuZ+zmK3VvxDZbtlEMK7wthugBWGqHljQ== X-Received: by 2002:a17:902:f685:b0:20c:5c37:e2c6 with SMTP id d9443c01a7336-20c6375b1ecmr12035995ad.11.1728432296270; Tue, 08 Oct 2024 17:04:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller Subject: [PATCH v3 01/20] accel/tcg: Assert noreturn from write-only page for atomics Date: Tue, 8 Oct 2024 17:04:34 -0700 Message-ID: <20241009000453.315652-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: 1728432398919116600 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:39:42 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=1728432444; cv=none; d=zohomail.com; s=zohoarc; b=Z3mjRU0Gk98OCAYjUMjNpSa8tbpRApSIlFbun0uo7xb9f0RZUUwP6F+BlStvF8F25fQ7SdYQenSUOoAeoTBNAqd7tcGKkTtP2gGSMQK6nfydF8tbFaIIwmZ4k4czwQX/XOYvYTZaA1lJbpHR7y0C1xptUWoZaorW/YYGlnxGY9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432444; 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=CnLU0Z7dyXNxaqtjRNfPLsnl9dQCWKftNcSuCM2G8KnjfjX+CtCOTLjrrrXIoup88wysq8IduVk/6skgF4GRvHH+DzXrcDXyLnV7lUidtKXFfcP62gaSaNirzUiSz2ZdjD0Z6SeNXcj56v3AYbbx6LBrRPQkyCLHmEIct/avFM4= 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 1728432444939284.11585885653164; Tue, 8 Oct 2024 17:07:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCM-0004Cm-Pv; Tue, 08 Oct 2024 20:05: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 1syKCK-0004Ay-QH for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:00 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCI-0002dy-Oj for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:00 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b86298710so53278845ad.1 for ; Tue, 08 Oct 2024 17:04:58 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432297; x=1729037097; 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=HlZTf1MwHzSnBNjJ8f++lS5BBrVXyYw6+YKEWJSbB3YURcVLpjWueYhAT3Ihz0g2a4 w7zJ48GaD1b4akJhQlWwayw+D134lR2t1OFEn3tnNslKh3hWFyA/UuVAVpzTTNMOUY/s NXt9HXr9GQc8jQ4wDfTfVx3Ns+71wVMcjN2GeE2deYLWNzxrgZlsegAdBpeNJ5+BKPEH GkXJHHxyqWi8XuBknoaJZDHKtGNoOAWNIkzrF5xMzmzALeVJB90Q5VHuBgD7xq9GcbTF PJ0us3nr0kyCdAM6AznB+D9oC7yHqRGS5V1y9iDRuksCJ/jNTdgjFAH8AluxFhrh1FKB KLVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432297; x=1729037097; 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=HMnEni/f1Dbg7s6BtEkCqM3LE+UIQXZKzDzi3sSM4X8T8lr/MWg4rqRBF/RYWAG4os 0+y8FWEZs+XhkLu8l/T/U3Ek5R58grLNxomPtW3e99/Sf+p0YqJWftOXlugpzYMo4E9E w9bdWoEgThSlQW0rWTphhKJBg0ikMUKMvIcf0wGNmxNpTuMjTlEOFt+OgJjIFHglgbep sH1fh7dyMf7yae22JgKo3MsPjfgwN99PwMYF1BXFdwrzkcFUfgOO+4Prkzvywuq0KRCs GwN5yICHpSHItuLCMKocWSYtNfjkCgl+vQvIEnpgXr5OS8Osr4EWJ0fIlj+taIUMA8C9 aTOg== X-Gm-Message-State: AOJu0YwzK9ni7pZqQWvpxpXK8Lf7nqevQWNOsDcRdU3UFMhkjenlYIiO CCNnpHqzzHG5Ss/rxYhBQTUH/ZeoojFPrPHrA2vDYsgWGNRs6z4SzVWb9RSpS0WNiXWd+4AihSY W X-Google-Smtp-Source: AGHT+IELfN0bakgT3mk/GTecwW46dkwTT2ygCiT/BAX/1818Ov/crY2+v9Y6lIuiJxQlQfEPFhy1uA== X-Received: by 2002:a17:902:c40b:b0:20b:bf17:e497 with SMTP id d9443c01a7336-20c63780107mr10371935ad.46.1728432297083; Tue, 08 Oct 2024 17:04:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 02/20] include/exec/memop: Move get_alignment_bits from tcg.h Date: Tue, 8 Oct 2024 17:04:35 -0700 Message-ID: <20241009000453.315652-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432447283116600 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:39:42 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=1728432412; cv=none; d=zohomail.com; s=zohoarc; b=mR30zZV+QDF+KZkdz4j/LWRw2PlG0mB7pCs5KrvZm6OYhWx8h0A8M72RQ6OQRnkmL1QR6kf0MvBz7hu+Pgn//NQonvotC2HVEYz7LIqrW5qqE2BW8I0mtiMwJPo+qIRygpfD7TGoq1W9XE3xLHikNorVnFeKBpvQ3KXqSj6OccY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432412; 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=9LebsJbt4uExwr4Anb+4jbY7Oq0PbwNNghgu5qGnqlk=; b=VqwG3foFVBLaH6JPwZmFHHJmL/+J8y/1BcBYJBURmwi930J1FPwINCzaog+B9FI3YLmdQiTtVNjg5O7Y+YgsYS7CWJg3SBTLshPQuuCeHHkpP/alslm8RGilhk79La1w/Wn+3has36b9EjcV0jQ1zkIJD2j7r/xF2xnicbZIxqM= 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 1728432412407757.1755855381303; Tue, 8 Oct 2024 17:06:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCO-0004ES-BB; Tue, 08 Oct 2024 20:05:04 -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 1syKCL-0004BZ-FC for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:01 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCJ-0002eK-FT for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:01 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20c544d345cso2599225ad.1 for ; Tue, 08 Oct 2024 17:04:59 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432298; x=1729037098; 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=9LebsJbt4uExwr4Anb+4jbY7Oq0PbwNNghgu5qGnqlk=; b=esXxkkH3GgEWyPfW504SwtOcO9jaKgOgjveWvGPCxUOi5V1DphIuNrIbTkFI2to/Vn 9HTogTE3my8nVP0WHXgKPh2Y+wPdXj7KWZgR6ajm2jQnRInBXNfEafc/ZUAZ7pb0gUGP p+NJoXGIiiUGFZU3SxQIISf/ETHNUKboUyDsd0T2+HfNTBq1jqkkWlGf+x8iGwMYa1vK qlKmZX8IKDwpFzsWPO2HP47Ad19lBgHzQPALtRuAd4Qk9+8VWAYrVYgv0xJ97jElL/v7 v62c2zcYhkCt4hbGGAgeJNHgSu6L88PA8sqcJN+nWyw6W4lcpG5C6QCOn4kV8gDlBz6J SubQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432298; x=1729037098; 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=9LebsJbt4uExwr4Anb+4jbY7Oq0PbwNNghgu5qGnqlk=; b=nVZOp+BBB2NPa3Ed6Isg4/G0Gm7h1PTFmf+rjzJK3oW+q8reMED0YVk+Da37Dq+sW3 JYgdpyQMy8ABL3sp/ORsKZy91mAabIActGogsTPD4BWyGc8HyU2TfaRJs4yx7Cai1iow 66h9X8tc8vB26Uu2UdMK9YSqt0t4OSuizYh1bhfe3EQTPHWNkVouYyYvjmdqQ4jVsGT/ gCTNCVWTC2YjCm/pT22miD/KGRk8vXNh3ApsCxBVFQONkWW8x26noErovQzO+HS42YQc KFZSJAKj2FlTbvLqM5ZMdxAVjiFe3Ov5zNiV3ExXma7Uih8YoIqPO9oT2GfN+wes7/No JT3Q== X-Gm-Message-State: AOJu0YyKlqIwpM+Mf7LPYqP1jpcQf2/pD4JK33OfOnL8/fRIQMivAPyq LYRWADqCCpuOV3dP9WSAs5rhhzkIKgOvQ3gBVXtZxjIIi2BVQPBMhdtKbqkjSadOucEU4utkQ/h H X-Google-Smtp-Source: AGHT+IFrjf/KG6jW0dXe87Xq6SyttisiiLp3ocVOdfABD+rqesa5TS+vrbt3d454eeR29R+9AWd9wA== X-Received: by 2002:a17:903:41cc:b0:206:b5b8:25dd with SMTP id d9443c01a7336-20c6352cdd6mr12193455ad.23.1728432298141; Tue, 08 Oct 2024 17:04:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 03/20] include/exec/memop: Rename get_alignment_bits Date: Tue, 8 Oct 2024 17:04:36 -0700 Message-ID: <20241009000453.315652-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: 1728432412975116600 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 7ddc47b0ba..08a6df9987 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -959,7 +959,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. */ @@ -1241,7 +1241,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:39:42 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=1728432366; cv=none; d=zohomail.com; s=zohoarc; b=O897Vwn7G7EqVtu/eOewSM+8DF1HHIei68DfOoUnnU9Hty5m086SnR66d/XE69xf6cdWGYpT84kWhXesrAx5f47yKbP9Xm3H88j9qAI4qnK5JtU6dxZ3+/xXcCdXFlzFo1u0XQVrTUWWwIFPOZkg7IHhipEjalWCXwXnngLFIh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432366; 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=hoQpjuwa20HwjACHrMlYHXe57YCg2K0w30eV5HVGvRc=; b=KjIX3C/4Rkpz2OmNsWUkeLKgkVZb4h3cbxNKwdpi8DAd454YNcqdJuYmR3YtNST30rDIqDg7lMW+tuVtRiZmvVS91lfaFt6+GJchroXdhXBb2ch/0OqYI25X/KKYXQTOqXRIdkCkt0cSXkBol4qwgk/mWXjSu8XmWJBYqbwMjRg= 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 1728432366290188.70369332756047; Tue, 8 Oct 2024 17:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCN-0004DN-PP; Tue, 08 Oct 2024 20:05:03 -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 1syKCM-0004Cf-Jy for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:02 -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 1syKCK-0002es-K2 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:02 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so5232425a12.3 for ; Tue, 08 Oct 2024 17:05:00 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432299; x=1729037099; 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=hoQpjuwa20HwjACHrMlYHXe57YCg2K0w30eV5HVGvRc=; b=SYMsuIHGwC3Jq0/0Pvmcsj3PZYiJvofyiTMeXa6wy1V4+xxh0iiVUrT5x9nn/v0Ku4 ppDaVI/KHL1NyHPEIDt6ohL4heMcs/GpggyciFeTocF59b4RGdaQTJlnmY82WW/UGx+X A2M6MYoWfFqKrrz1O0A11iliqbKEvQoHcIow3OulRB6qBzUt32zGwi2xCyJYrvxZniDG sSYoDastUSdctof8CANvFalV5LIAwKQNIcFB4aqFy+rPXkmMRoHVuKdDa8X6e9F1I544 QY4d7OwaJgRw7ew9OjedISxQpI1CKhe0U5y48z/ZqdvhnEDBOwCQJleqBova2n6YTyo2 btbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432299; x=1729037099; 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=hoQpjuwa20HwjACHrMlYHXe57YCg2K0w30eV5HVGvRc=; b=T40pB3/0ggjazjzR1GSLLtdsigSXxuxtyxI5t8NXYrn9D1rjZ83NDvQmL969y0aIwg C1qjGXI6bLXpetmbFDVbfcB2lohoGn5nodXuHR1MhRw5IdfMTc78StHTfbmI30saGFmf WZN4unQKQHykON1AnsQma8M03nb+XzdlNMpaVA14LEXX4Nofqh8nOg563QbokGWsLbff Nmr3yq4XbWMMiYAnbv7uf9ypti2O2lFQ320/EZIjdAEBvXf3kGZgzb5Gf8pl8N002uE5 8PU6cpMX/FnKTHm5B9coRYeXU9x3f1Qo7n5toU86IStEgkfxyRWc/TyHET1TrLSsPgoE ZPng== X-Gm-Message-State: AOJu0YxtyoN4zlQ7oVC6M3uxHb8iUdyX3rIp7HZAN+JgybytIx8XgJUO uwApPIpevQUDOictMEP1M6Ym4XpNuWcdjTKHcuMfslp8YS8oYJckk9A7IFqu69oho3SNNo1yQql s X-Google-Smtp-Source: AGHT+IEeu9+lnXWIBhz7pgvstBsOBX6KI79/ZD6KPp8fSOXLhjN4UEVyBQB1oHIG/Wwjwoi0un6x8Q== X-Received: by 2002:a17:903:2b05:b0:20b:6d8c:463 with SMTP id d9443c01a7336-20c637557d0mr12308135ad.35.1728432299121; Tue, 08 Oct 2024 17:04:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller Subject: [PATCH v3 04/20] include/exec/memop: Introduce memop_atomicity_bits Date: Tue, 8 Oct 2024 17:04:37 -0700 Message-ID: <20241009000453.315652-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::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: 1728432367159116600 Content-Type: text/plain; charset="utf-8" Split out of mmu_lookup. Reviewed-by: Helge Deller Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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:39:42 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=1728432445; cv=none; d=zohomail.com; s=zohoarc; b=bx8pC6w5GsgsBxrmDmbh0cRTNiX1ft/d+UT1lULMLnz3Xw0MtPTo3Z0KttUY/pfNyMQTf3wwjI6eKuckT3g4f33IfXTKXvoOLTCI3URSUMXJcvRqq7uxg+MLDhMZna+T8N0ZYjo9+5Yw+QFRzjU7lahwEv3oFYyj6MwBD5PlL/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432445; 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=KRlC3mms3e9Sb+Qb/UGEoW53IughvKHiILVrUessrrs=; b=cCNaxn/d0BZOAbLWO3PiYQfzBAUXNOY67s/L3Q55mnHTwGmTfDourhBDeWyllf3czAOhicux9kL/m/r+RMIaxcVTI7rhpi5vSD8J8QMRHvJr7GcA/XR6RHo2D5c7jKC7ChGvi7nGXCW7E9pjS1yfTbD8SHpvkUsLFL9/NV4r4YQ= 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 1728432445460976.3249841546282; Tue, 8 Oct 2024 17:07:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCP-0004Gf-Ql; Tue, 08 Oct 2024 20:05:05 -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 1syKCN-0004DY-Ps for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:03 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCL-0002fG-Hp for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:03 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20c5a7b2908so9763565ad.1 for ; Tue, 08 Oct 2024 17:05:01 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432300; x=1729037100; 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=KRlC3mms3e9Sb+Qb/UGEoW53IughvKHiILVrUessrrs=; b=Cq0JQAO1GBTJ0yQ/WQW6q0qXX0jv04gk0dKDdyo6qhz5pBfEysoqDDBIvhtPnJ8ZUc WOEggWFVZsEsC4wpVhrp9RLZRXZAti6JG0ZVi7rCC7T+mYxHK+BIB5uKrctWsy/OI+HO cXrqia7Z5/yNTxeWsmaXm5i6f4ff2QlHn6zcmvS2OBt0XZdjDx8mtTC+5IQYnjr0ke7T kF72lKbCPW4eUJGuhcaCmxp3DbYcexZi3QWE974swsmdZiZwaOEZGxiPfrjslFbMQm0Y O5evQku6P5cMWM6PGs6Lo8WrGaEbA+cWnYErTWaWlKRvDwwurS4dq4tziLfZxcbfo+Dt K5Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432300; x=1729037100; 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=KRlC3mms3e9Sb+Qb/UGEoW53IughvKHiILVrUessrrs=; b=d/Y1oc6ohYwZR467uAFIn+QvBDKl0YoTt7GQasfhwUij9z48EGE57OcWn6GVgwaeiD sO/MkjZ4pPK9nRR5rdWiTykBkgwj3omFLxDF9zF+PwFSqjf88qB60202FSBZTkmr67sr VJDKDkkMcP5yLYJlXxO9k3a5dgLZhKkilZl1gKJxuus9EM8xBpywAQi86Rvol21jVe2q eySLPDEN0P3Cn8kp37bJAH+sNbfX4h2v5JEhxp+rl+DoAnlh/CiqRviLPI1liwm3Cyq8 CpXB5kzZmvROG2Yk32qbbfiksxhcshhxMkll82Yao/6+CpyHnMgvhR+Kc+IO9rosSx1w 614Q== X-Gm-Message-State: AOJu0Yxb4M3NVd2mRVmjmyAOiK5iQ2uF0y1bzeFIxKoJhfMRjAjtYcCV eRdBuNubBJmc7DCZBaQQbrxSPjyamqsVE+A2ffAk5RvOBWDdufnjtRy01/uteatiZL/AQobEMdC C X-Google-Smtp-Source: AGHT+IFCFvVKxRyLlvfGXYLtSu9ozN9PdneS174Hz9Cj7lMpmt/cbo6+LfjS0UmFUu6tz4mWEHkH6A== X-Received: by 2002:a17:903:98b:b0:208:b468:db21 with SMTP id d9443c01a7336-20c63748357mr13630815ad.30.1728432299990; Tue, 08 Oct 2024 17:04:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 05/20] accel/tcg: Add TCGCPUOps.tlb_fill_align Date: Tue, 8 Oct 2024 17:04:38 -0700 Message-ID: <20241009000453.315652-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432447418116600 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 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. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- 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..c932690621 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 and 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:39:42 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=1728432366; cv=none; d=zohomail.com; s=zohoarc; b=kGtOoJFS1UktN0aU/P7yDJm3Gsrg0vRH2vahDK+kLZX45nkM0QqPLmWfxypIcvJhAcCOeeHLAeZDeoK0QP6stQxeNs1kkfS6B7gSevMCJLaTwvvd2FLjk2TnoFGzlLX5YcXwhpyGpUafdfNYygLOub8d4hV40cqU5v5r5iE6Bn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432366; 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=/dFojoXE4+jjskAlQVsQMp2S+E0WFZ4r9iQmpRIn1e0=; b=LJwBZ6oqYg1AzLsQoVJaKC0tXt4L6rMPvTOJKsAXhK8pncNyR7xYrSdMcSlWFsZBof/E6t3zUJ+BvaQA1nrkJi7xgtXp4NJ7dSToROmSgIEqDcClXdlfQOjIkIjfiqMCYKEEsyyf62Ocs+2urKE0vSgBAaV1YGbk6QMczK+65G4= 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 1728432366762698.6627937309272; Tue, 8 Oct 2024 17:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCS-0004If-8Y; Tue, 08 Oct 2024 20:05:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syKCP-0004GM-Gd for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:05 -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 1syKCN-0002g3-5A for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:05 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-20bb610be6aso68588525ad.1 for ; Tue, 08 Oct 2024 17:05:02 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432301; x=1729037101; 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=/dFojoXE4+jjskAlQVsQMp2S+E0WFZ4r9iQmpRIn1e0=; b=iAL7m1sBK0N70WzMaB1IB1mvtCJpbirxIHr5B/ntk7nUztdpUtX3LD2zALB7pD/08r O9i0A1O8nugtY+qW1WKZdviGktCElrf7MJrmLd7N0glKb7ImYrgp9jGkqirbn7jXW5k0 tFEkAxfGnba0yWfzLMz+8q8zbhKpPIB/JWdnWwCyaM+NCGT6Cjd8S9XukYo5hGv/ZSw8 2hksjJD+D8YDYuB/xQny0cFbxKXdnnsGdpDI18jxTytPNyBg3zbe7ZkBNtNr+2aEWim7 XuSi6LGLepbq7n+A2b41SC7vFZRnTXXGyLnxGC1AfNkc3al577WM0ivyXKM5nhlnKBkh HJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432301; x=1729037101; 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=/dFojoXE4+jjskAlQVsQMp2S+E0WFZ4r9iQmpRIn1e0=; b=jN7ALLvC75QeklQv7cC3LBVAWB05FNZJNZSCFoZ+e1yKRnY+Cs1CwSbu3KYYWWuYUD 7iZ9SeGyaRbh+p89DseUauwxs2HFPV38xK05DmxWJV0mNutrxVdL8Xgvu10BlexWSHxK 01x6PU7huSwg14CETnTLKEd0H+OeRyWS5/RuF/NcW/A7YoxpMCKgjq/N9kskPrPJKdNY /Dd+WSam5dcrZrJAl8CB7CX7Wxs5Q76NwgcWlLgcsRl1Jo/MMEsmVax1W6h3XKF0knKK 0JjYeWarmgTWdFXX7aFHbnOHIzsibRnjDoGNiMWxF7hU4rgb2E64acoeu3Oj/qPWHM+L bPUQ== X-Gm-Message-State: AOJu0YwtN6rJFRlXBG+HQBOx+0e0Xt4NLwonus1i6QQnk40WLByN8J2P hJ0lyTwrNR1wl6Zwaukd9DMT9rY9Jl/BwP73pxBfUCeOJdAknICWJLxGdT3MmKaUFdFLuzYUcQM y X-Google-Smtp-Source: AGHT+IEqHXg8mWURHcAfVqAuEFw3SPebibRlwH8KpqMvpctboOYhLIxxyQyaRkxFDrswJJ24vV5qqA== X-Received: by 2002:a17:903:32d0:b0:205:810a:190a with SMTP id d9443c01a7336-20c636f44famr10016545ad.2.1728432301297; Tue, 08 Oct 2024 17:05:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 06/20] accel/tcg: Use the alignment test in tlb_fill_align Date: Tue, 8 Oct 2024 17:04:39 -0700 Message-ID: <20241009000453.315652-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::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: 1728432368889116600 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. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- 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:39:42 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=1728432384; cv=none; d=zohomail.com; s=zohoarc; b=SGw9EN93w86CgRn4JOioAT+TWgvTFPBz/puxKUHeWFAvdmr9RAW6NqjrvVGT8uwMQCL8Xou1mNWPjuwV00upwgh/ZLIHQLQBNbKpUwTwMRVDqJA4FufRSfgrMpE3zODH65/zCs9tJWyRzgm6QQOPysIAQEYkNiAgzG0X2/JPFdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432384; 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=JL6n7HgRp+L3kxmkE4dX2a5iQWZyS+5JV10lguOEbceqrs9v5ZKQgCWdlpsZNzsnPk4h7pCEXsUeKxG/sP44dF6phjZq+xx9obm2EMOUgT17p/iBioYye7dYg1VFCJ4lEUsyqh8zkCfC5UXjf7h+TGtovhTeoAV6htRY1MMFkKY= 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 1728432384106925.9992062186723; Tue, 8 Oct 2024 17:06:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCT-0004LT-LE; Tue, 08 Oct 2024 20:05:09 -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 1syKCP-0004Gk-St for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:05 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCN-0002gh-Q0 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:05 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-20b5affde14so45286485ad.3 for ; Tue, 08 Oct 2024 17:05:03 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432302; x=1729037102; 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=IzYQGvb67muLzWl9axxKoEmUVOIB98dwkIiWwVc+CtnuHIrmfEse0w0f43TtSo9+rt eICVhEIlpyC0agnscpAVQPgr97bs90aZ5BLeMaLLui7vdqP5m6vu3zsf9ZUNcSzu+7ql GlKgsun00ujfZA3V6l9tvsNng4YSkNwlf30aTKQSudbkXkxNkoUjWhUHdA90NON6B75s cpjLfLjRE3N55Q9BtTt/M+W1lA8F0uFrRT5G5WA6r2gCX8g0H/napOzzDCZKU5I1K8ir Fr0f/Re58kKG0RiPE8j3bPNTwlrzRhMrg052qYkV01v7Zi4BVsAIyNwQqqpo/+O7NSDZ QaTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432302; x=1729037102; 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=fMcsJHQUQBSuXfC8yMlP+43IB14L59Kvm0YItWDqcFAvInnRfQt/D9S6vqhIKp16u6 0Gx8KqCRWoeswTcpprQwLq3513BRPJx8HaXDb8C7544pAjoDMLm6vAYdeoev+hi20wOB C2ktU930Ym1soYRJtuHyukMC4PqoYf985LIUnNAQfdz+Jf7RBdPrGnzGWF9EnkaRRmkZ TU09Jxt+SQgWYVmzd93DpnksZ4l4OoX7akfaLC2A+3DePjAqjXRPoyah/GZw98zi3yP2 LuJ+3Uoo63hLFcZaLc/les1W7OFbqL31LrKGhZti2zBV8wH0kYCJDrwpQpK+LiNJPmRN 3U9Q== X-Gm-Message-State: AOJu0YxsH/93IlughEv1vmyiKMqhs47HP9biETa14LdsX3u9zpHWlrmc QpQXtHcvmsIspB6keNOcQNLopQcXimKa4q9wxHE1PhHKqiwSxhaNFqnlsVUDr5dBhoAJDyET99x N X-Google-Smtp-Source: AGHT+IH7ittC4fNcWZZnvUvR2MzaRIxXqIaW0oGTZ44MyvMuTJp+JuwMH0O7T03auchaNuRqnZyQ0w== X-Received: by 2002:a17:902:f54c:b0:20b:79cb:492f with SMTP id d9443c01a7336-20c63780152mr9718395ad.43.1728432302402; Tue, 08 Oct 2024 17:05:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 07/20] target/hppa: Add MemOp argument to hppa_get_physical_address Date: Tue, 8 Oct 2024 17:04:40 -0700 Message-ID: <20241009000453.315652-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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: 1728432384825116600 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:39:42 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=1728432366; cv=none; d=zohomail.com; s=zohoarc; b=iz0z96oK1WGX76CZ2+YzHfctpVKKmKGrtkeWWg9dlTdyvDIKIgObWj1YsjLOoN5Hy1V6KGKnJ7iX9hKzsC3aSWqwMpW+BxOtoDbMBljODwh2Q75qk7eG/fgkm2KPoIZ5jYh+7AnPUHr9e8QI7SZBsMDQZjAfcwd87mbTIemVLXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432366; 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=L6Kx1xZE0GtMcEU2O8ea1zr86nztTNOhfHDg8U1azQVwAcxQyK7Iz6wb7xw9vZi1SMoM+oG9RtcII+MBCR3exvfyHhJRkmqNRXmgIw1FOaBKf5HO+Ef/yMvTQvKFDJIZqZb1JcEU5ln7Tc0YFhUXdQ53+rgdJJoHOTwUMV9mLQE= 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 1728432366416992.6278172317507; Tue, 8 Oct 2024 17:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCT-0004Lo-Vo; Tue, 08 Oct 2024 20:05:10 -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 1syKCQ-0004HI-Td for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:06 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCO-0002nt-R7 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:06 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b49ee353cso58170055ad.2 for ; Tue, 08 Oct 2024 17:05:04 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432303; x=1729037103; 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=vxSzVVqeKiEtpkgnsEzyp53JDmmebK62JIP6+ye7ruN0cRnveuXcbPeqSnlR30qXgP YxdpRhZqkKKxnc0lsXkXaPGwZKRSHcKOVEzMDBiCkpHForCKCimsq0bFuc29M/ZC4za1 OJnrgSKvtpBR6tuT+PELxBN5SeX9YswGfl3bhS4AJy0JpPfK/9SGiCCAmI/kghx7gIzQ 6xjvebnXS+/Ocg6kxIl9KdH75JJn/Gn4saqa+wnB63DjYAAjJtR+GeY9dKE4xf4oTNUO CoRNMEAA8t7CCUEoLOcOTcr4ztHNUjsl38vnmoio4YmGHu0s4wcR3NS0DIiGzR5txpcB xh6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432303; x=1729037103; 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=apEaePGClXcPENwePxgnEOSTDX8mxET7ziVI4zGfGUdlEHkfNJcAFyMkOJ/tmXZGxk tNfu9ON1VERAHUG3hl3oF6uZWojn/se1Ac0rmz9YsAWfELM8TO/PleSR2pqebH59NKh2 QXMcqOm5RAyd1k68Z4VH58Fs0tGqSUd8Yo49kOirj+KvrsZVT534L+vbUCgJt610XZ90 3vRLOiAVK0UyQMdcwC9q9fqWblw7fi8eunmZ12sUuz/GJZmHQobPiScm4OkFpSmBaQZN B12P1j8ZxZHx3q68bOcesSV0LFJqjRpGgkY5B15/L+MnIdrn2MMoyxzN4nVA1pzvllO7 nzQQ== X-Gm-Message-State: AOJu0Yw/slmfnzedW5ftQMoYQukQjNZtnirwqkiEVJSbGRrSLRcmqRAS IyzanmKOZx1yMBYGGCjpikSvyQw4BsQ/EpZ3P5CUTzXmZ5X49ql0MS/EXmVrxzoL2wmCmSDfXPk O X-Google-Smtp-Source: AGHT+IEQN3Rl72pcmgLCTKgbIcOtLba1v+GzwtpoC9AF0fnEDdxLNrxqZqv2s5T7uD+5Iv4bbg/olQ== X-Received: by 2002:a17:903:2289:b0:20c:5263:247a with SMTP id d9443c01a7336-20c637809c9mr15713945ad.38.1728432303433; Tue, 08 Oct 2024 17:05:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller Subject: [PATCH v3 08/20] target/hppa: Perform access rights before protection id check Date: Tue, 8 Oct 2024 17:04:41 -0700 Message-ID: <20241009000453.315652-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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: 1728432367155116600 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:39:42 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=1728432448; cv=none; d=zohomail.com; s=zohoarc; b=oLl87XgS+MrfP0Zp8feyuufyln28i6ejwLxOUX9DT6sl9RxC7J3G2vVZaA+BgYBGk3QOz5KMVTqikT2ww4gAvFa3v4IRUGJX5T9G8ShHTKm8aRACMiw2sX5pgI1RipqJ+Ywix5bYNIYsA2urik5Af0goUCqZNP57wgsa7w3NR2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432448; 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=lerasuBCBXuYqP2U/j+KrUktJ9MqVIjq5mGa5Tuq9UyZEn259GaObsweony2YXkjfMocJfn+0VC5JB1ASkAw8puLtHp24u98sWD+VtHPIWIDSPbtOp5XdeDEm5ZpgY5bCxrbvyUtPZBR5DiFE6mCq38ZWciFZmFfuCDN/VuxPnA= 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 1728432448150346.86571863103075; Tue, 8 Oct 2024 17:07:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCW-0004NT-7X; Tue, 08 Oct 2024 20:05: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 1syKCS-0004Ik-A0 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:08 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCP-0002rr-UR for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:07 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20b0b2528d8so70928005ad.2 for ; Tue, 08 Oct 2024 17:05:05 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432304; x=1729037104; 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=QG1nPvj4zfH7GnQRIAAQz9SpYqyAdJ5/aBqi8aSG/EaefoDDj7yWs6OFacxEwDP2ai tR9ershpLoFZxu1NkILKtVfj1X1cK/T7SAcI+2kziJOwd3MG4YFOxbWIL0ZqK5djDCes ewTgma/GjFGN9TU2gOwg9GXTR9tc1z/RJS2Szt5So7YMTsMcLDvIzsUsDEK0NTz3UtVC 7N1NpBwFwNUTP6wE7lYy11M/FkSVYFVuv9VjCbzuNpLbFMCIDkuTQvGxdBBE0PS4iQcY obsNdtMY5tQmOEMwkAI+cO2Z/jD7wmN+0YJtxPurj3FYEU4tKbiEFCwPKfTrv0NY+hC0 ANzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432304; x=1729037104; 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=ldLWUMJUO713iHwXJsTuem63Z3i1WbTRU02hS68egDcRUZCHQVWlDixrxMfnZdN7tM YnnY6tnoVIjc66bedybeAwHhch0OrBw4emSX2cP0eEHSh1hnBYEf5F4W9Iq0JNIQOK44 VGui7wU/+cWokYCwx1ny8AtjL+nqvkmdU5y82y7sedBd8mXM0QQamQtjLfmI8lyVNSH3 2dRLT+zB9aWR8zTxLNBRoqmaxXjcy/y6oAnUrvPqplFb2nu3PPlDTgMeM4lxjIUkHrA+ GUSYaU1aiVF0DiYyMMvw3FF4qyU0V1Gq5jVhfDr8j7gSggc12Z1ZYz/SLuEvuRctv28D fZBA== X-Gm-Message-State: AOJu0YyIfQsxlApBeXxlzJRMk9bp5hiZMEdwbO4h9R8H1IAI/J7S2h5Y ouvRSjufYMRN+G+MtxwRRVyYjZyU6uiy8YqWsmHgXpIN7oj5+VoLbEdO1kpA5Om3l4PFb15k8et Q X-Google-Smtp-Source: AGHT+IF0ZLww/QirXn6eqf2utM1nSiZwyzsJ3soHtkS1Z0DxnmXSBaV1UhTlgasVQznyDC1QSh7zOg== X-Received: by 2002:a17:902:dac7:b0:206:fd9d:b88d with SMTP id d9443c01a7336-20c637986d4mr11253965ad.61.1728432304454; Tue, 08 Oct 2024 17:05:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/20] target/hppa: Fix priority of T, D, and B page faults Date: Tue, 8 Oct 2024 17:04:42 -0700 Message-ID: <20241009000453.315652-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432448989116600 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:39:42 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=1728432430; cv=none; d=zohomail.com; s=zohoarc; b=VskzGPiHTeyH8C0afTX7JDl7j+afSjA9/cNUSZB0vb9jS+x9GBEzhM2YO8mQE8GkT0hnYJemqFpOSavHqaE+kflzG2s95CVd5QSvwCaW5Dm7J9nMdcv3OgSXcfqz7flY+u8vNA1HP4WL6pi23mBTot9GokR4ciLZOWt7JFoYesQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432430; 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=nd5zIty4rcpzni+283BhvC3/R8l0TpL7twoyd/RtQUmgHQ1mgXiJZ7wkkuAs/Kp54kHMuQKSz5afTbT2uuGT9zyMUvGNwMDnAVScsRtmcEQiouMjMjuOAlRGlypAwqKX9PEithPUaXqFMye/Dvx+eQ4DqSsd7gRu8H/G2ErgJTk= 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 1728432430507915.1212701162303; Tue, 8 Oct 2024 17:07:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCa-0004Rj-1P; Tue, 08 Oct 2024 20:05: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 1syKCW-0004OV-9N for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:12 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCQ-0002sM-Jh for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:11 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-20b86298710so53279755ad.1 for ; Tue, 08 Oct 2024 17:05:06 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432305; x=1729037105; 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=Dmn9fQ2vtmubV1jQOcXh1e9bPMTS5lnAx37z3EXDNsWO2iPFArUgTDphSvJ1uWphO/ 4GPrAf4UrwYZ7GDhEGM+ap92L+vb46127Rdzr/ttm6yAw5ta5ntlaqs5N+fYz66002rA gm0PZZQQaCKQ2aR//2dGEuRfl1DFjZlZZGztb13PNE8JFjKPlNLbm0ulL1iL8tJabbQD XmdGF36vYr5xEjiiHWMPAyWn1VCqEed2OHmjCCk8Zntw6HkMaEggjGa/ClPKLonCiz8E 7LmkiQ210jXScJkds7krDJph6LoRROZ43vRoN3Sxv+6dhgtQAPcZ3yPzpMsqjoQOmYAn G4VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432305; x=1729037105; 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=k007mwMK15WJWrMOqkmyySfDwzjamZKCqf5sa7jBdBlU40FLJJyA1/eEcxi/Yh7px6 6YsuEOckrHm7P4CTNTxGHxP24bv1bzirh1++iOhPZ7vP/I9PW6Caam+Nk+imr0p551Yz jOLu//dNOidpJYx8olZhzrCH1QFKylmPBTho4LkHaJhGF2WlRJHcf9euIIwMi/IZh133 43sWcCCuMAhgoV0xjHQg4rjrnuQZcKRZ9I3zmMb8lO7r/XWTf0PMvvNSnWdDNcsK0U3j jUs6UMamvThigRbmpWH7mXav/42slrgJ6VIGakN2maoWfRboDIgd5tWfb4n3s2WSVYZ8 Yitw== X-Gm-Message-State: AOJu0Yz7e/JfVIqvLrqxGUwVTky9rxp7fwingSvjZ1USLHX0vPVwwoM9 sM+CMH9FHfvq3SGMv+qU4dJFRU6vy+8DbumUK0Q+8X4+HG0UVeL2BGsKPWf3YCMEbc2kbxyMc/b G X-Google-Smtp-Source: AGHT+IGk0V3WqNWZpuoKiyjHCbvkavwK7mPvzoRJ0f7iYAkKJh77UVywliO2AjnwG+Rua0FM3sG5Mg== X-Received: by 2002:a17:903:2309:b0:20b:51c2:d789 with SMTP id d9443c01a7336-20c63711761mr12234395ad.16.1728432305301; Tue, 08 Oct 2024 17:05:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller Subject: [PATCH v3 10/20] target/hppa: Handle alignment faults in hppa_get_physical_address Date: Tue, 8 Oct 2024 17:04:43 -0700 Message-ID: <20241009000453.315652-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432430975116600 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:39:42 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=1728432546; cv=none; d=zohomail.com; s=zohoarc; b=Q7eO28XRGXXybQ7VnBcvBdcceKiGntTbwEDS4Uxc9X26Gl5gXCm6aNdeWbTNwjOKBDeEtcU+dS2WbV8p5/cqRKi7VoEz35P0vJ7qQYED4wb+wN6lNYLuE48E5nWz2GMMun3qOAywJwIxmU6p2GkIjvGyDKuJcduQ4AqUO1gDHSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432546; 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=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; b=fkfu33n+eQ4SAN0E5T098fW5LenpG0/0xaNa2LmUMB04dXtaYSppQ+Jb8HWTMiShjTU+ebsdZmhrZ6CE4JPg8zg3Z3nn9M7aMhARH9lL0pvzV10uSBL9mFasqlXmwb4XBbBrLdV7ntcM/8/cDtrcEeX4/XeFOvcXk/HoxQaHB94= 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 1728432545990754.9397346716571; Tue, 8 Oct 2024 17:09:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCd-0004UT-6E; Tue, 08 Oct 2024 20:05: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 1syKCT-0004Lw-Uc for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:09 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCR-0002sl-DA for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:09 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20c544d34bcso12092885ad.1 for ; Tue, 08 Oct 2024 17:05:06 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432306; x=1729037106; 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=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; b=J3aKb9Iyi691KWz01n8GgVdmpzlRcXM+e6yLl6g0beKQjo1nTAtVTe/0+a35GJUV7Q SFilfrH2Zgee4yBpV2DCNnAnf7Oc7677fnPC+I4lIUh3t50zIMa2q3Td460VsSJj/ON9 ZWNSBDB8X522LESZ20qnC6ouWpygRC+7j5sUtTmBBjP+hZ/GNIJF6slptyDQD17BHDFJ XWSoktcTWTmuDcfGPfwhKXZaLkZgy7rITynmGeCSl1rO18X42xfHQj0Obv6fB2b0Pm69 erTUU5jfuFDeW6CPH1ykzZ3bDmarPbqeLLAimIT8UV1Qtic4SI2RGTAxv1h6K53CH1Lb Io3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432306; x=1729037106; 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=iV2KSUuCTdEDpKpG+VIBV8pupsJQOA9ecDi8J+rVd34=; b=roBYGVDvoqTyz0J7fPSoBIXyUS3NT75DwRNKaRu4J2SkHsbxEv2Z+L4crx7Mjzf0NL glLT9XuEa79uu2RbmTnFLbiTcRCxXakyBXKP/TQOYYGYVSOygVRVHCEA5WWXAIyioEdR PnZahY/xL/SRHjWZ7hX3wZSJwTDqfKCF0C8IsJScdNM4ajROckoEydSjHV91jDeOh9CP I58QWi7D1ZaVuiy6bzGiM/IYC2hqG5/ggcMIuKwK8LM9LupZVlgKfUUCyEDnAL353Rau NCXTnzpOrPzq3ZhXvJojxgjOQmSzJxOyhoO79MIi0LoSrKWQ3Q1W3Mn0lBYgOkvXlmoe 7qqw== X-Gm-Message-State: AOJu0YxDfKjtwms9fBB3/5O0zzUbc14pb9scjsFNoSGn1ECXzDLm+Q6u bIHup1QsnUS93D5iFu1R9C6zFKdgDKIkNmhabLkv6UDEHunsnUubJKPhYhcEnWyYm6LbX8WzI+H Y X-Google-Smtp-Source: AGHT+IEKU+69FGHaarUOvElg72DCHkm1xPG7wfOM2NLThus+mTJDQJLk8D0LtS7DglEQU4MbeYyvAA== X-Received: by 2002:a17:903:110c:b0:20c:5698:75cd with SMTP id d9443c01a7336-20c636eb2a7mr13032315ad.2.1728432306088; Tue, 08 Oct 2024 17:05:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 11/20] target/hppa: Implement TCGCPUOps.tlb_fill_align Date: Tue, 8 Oct 2024 17:04:44 -0700 Message-ID: <20241009000453.315652-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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: 1728432546201116600 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 Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Tested-by: Helge Deller --- 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:39:42 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=1728432393; cv=none; d=zohomail.com; s=zohoarc; b=nO8UQSHZE5qNFz2AjPGRGmLzXwEOTHTPe3FtWXPhU9ALf0FfezoVg+915BhBTR56IrCBqQFkeX0CaDnLGMd/LvuxU+ORD+dHccujVxwu27oANADlFAvZP4wX+vzQhQYvVZ6qlBqFeX94nt02oEcA+gfp87WTgW7wjE8HKxzX4HU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432393; 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=MM6eQ9RKtF7jTjNhXLCSIPVLMCEliHMN6cgS5c86k1urUp10LArH617GAHlOaDI9kuNTA4buaaZ9v8bBh7yoqmTnczc1uHGvexfjYVM4wVdw/Sypdq8yuXpFeZEuVEgV6wxXGwgyxZpDXKaUGTwvbmoMgR7KYr8EHh7T393oKjM= 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 1728432393749563.9546289786189; Tue, 8 Oct 2024 17:06:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCY-0004QV-E1; Tue, 08 Oct 2024 20:05:14 -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 1syKCV-0004NL-3E for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:11 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCS-0002tO-Ks for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:10 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b78ee6298so40043125ad.2 for ; Tue, 08 Oct 2024 17:05:08 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432307; x=1729037107; 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=m4nCceRmnrgpR8iO4c6bEet0g4jl68ZZxnA0huxaOtXZgT3JCkQV4MDcLYIan+bQMQ ro3x5eCBSJeTFL0L4UISQwc8DFrFxUYTDEeWCjUiD0DwCq9xXFooDYWzRM0ZH7in+NrT U4VLWyWO++TTfxMbY0hnBCqme1KsgbNh8bwrkQsLlDXvUOqHuSPKlpQTvdkfK2V5mMOx fcMG8NTVoqHsjCbfIAxnMdGQNioDcruQyTeUvPsmEfXFzil8ou8K64us7OpoQco+8Rh9 wNtYiaGYPkJnDJ+d2OQVNCKVguWR6MT3b39JZZtGuF72aGzb7bgRI5w0X2aNEiuzRVOB 5CBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432307; x=1729037107; 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=okXZicSGSLr34gSn+J8EIQYTJCnU6+JO0KMtmG3IaHMkpSGN/b47xVtjBedoxi3a1K LW7GP2aN0z/y6IRIVPD48xjha6CBw4tj3vLAiTwwG1MKtMzVPNJ6hbdKfUrVvsPONbDP /YIHaKxp4Wf68zyINuxVzZvw/fftGdrOHnoBedBlOSPqqkehSDn/jO5jDdGrrt4oO4XC 3kEL8o8skpBPL6h0Wjtok9GsxwljlLlqD6ni83OWMJykV+WkcLAUpUKqyLlj5RXraeP3 ZiJWMJ5eGqdEsnVit3elfnd/up1jiUK/PDZv57kxddF9FYYsblWnNu+4KiTEM6Qy+C1m jJcA== X-Gm-Message-State: AOJu0YwsDY06RnntQsdGATgiAS+z6uNFsoi5P2tj7nlZd0DzIaDi2mv2 Z68/NhndSuSxYamiuoEYMfYjw4cylakTdAs24eVy4f5tJn/1BO0aV3NXUYZQ9opgZLew/icT1Ln a X-Google-Smtp-Source: AGHT+IEOzR02cuGQIAfO5rhioXqq6+S1yUdY62tdcjtmeVq0WQ3OZwwN00IC+X3KAkSW8TC6DwnsKg== X-Received: by 2002:a17:902:e88f:b0:207:2093:99bb with SMTP id d9443c01a7336-20c63743a92mr10917825ad.31.1728432307098; Tue, 08 Oct 2024 17:05:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 12/20] target/arm: Pass MemOp to get_phys_addr Date: Tue, 8 Oct 2024 17:04:45 -0700 Message-ID: <20241009000453.315652-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432394993116600 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:39:42 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=1728432492; cv=none; d=zohomail.com; s=zohoarc; b=BMZKGfzcndk4uFFyTFjk+o230mMtgdATagMJWUF4g02+tNFfUViQ5nItT7tkefxLaRDe638NplIGpCkPAz4FL2pR/RXwPfguCEkg8CKqzKJvLjoiVkrm16FhKX+XnvK9vMFSAZ7IIM0dhtuxDzLzzpSyrjqBcK5i2YL9FuedrUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432492; 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=Cf48Uq0QOxAdtB+L4DvNS2jnvO4edjITwlM+j/oCSFKniy0hSomAkvZybL1Mr6nfW1j8WL6sbpe1tHMJVPqxaJGyg++EKMGYj+qqCcJybUgWroEUcoBgBf3sItIH+P6ZPwlFuiLpcvfscL1rGwHrZWVne+C02bA3tqrjw7fWeCg= 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 1728432492576319.82930142849546; Tue, 8 Oct 2024 17:08:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCY-0004Po-1x; Tue, 08 Oct 2024 20:05:14 -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 1syKCV-0004NN-Bs for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:11 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCT-0002tu-B3 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:11 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20b86298710so53280025ad.1 for ; Tue, 08 Oct 2024 17:05:08 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432308; x=1729037108; 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=yc0D//L+IZ+3lFanqlfWduQKjeLINYYiwuiwituX6sA4X+IDYDVSRDQnNZYF53jvXX I3Ko/WLd2/QMMzIxxE72CGNXT/u/coAyHi1zsFapuB2TyPF4znfouhMxNfU+QZHfJ9d1 sOREAS49oAFZes8T1sr8zn6rpMnKJSnmf/fdcq9n8q/1O6SdRfPq4PYoQp7TL1JEZRk/ sYGmuW/AVtDZ1pPDcwBRg4gTgUr4ePwDvjpdLbYVqyToMqCG3IxYd1dcli0Vhs6Zd3xE 0mx9si5SKOQZfE3BzQVvng7r6AF4oVmUOb8ZJi0cY3hdmV0Z8mG5gfygV3jmukM8aqXu xX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432308; x=1729037108; 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=J2sL2PgI7XuF4YMpr6KN1b+PzEyeS0ObA980d8TxTTs2YRap0iI0WA+26gVlzfRD62 9Q/U6EXOOR0BB6FyZFw85/EKOdA2tf8y3GQgpnkclbKR5kyUvMVWpYZE6xI8a8kb/dmb qLXW9CcpAgAST4Ja+BOuvL/W4N+009xNwlf8dOY7oChaaSTiT5mtOBCW1vLyRVR8hHvF wKOm1wu16yD0/esjv5SA+osTVAFn8gkIEA79+HSeQZOvI7TlRSuYlnh23lbBE5YR2jdz SvZ5MJJZq6hcd+oYakKHXdkWgxHNDd++9X79NVGGH3sP+zWnFGBYvw9d60aDySYYNvJu rdIQ== X-Gm-Message-State: AOJu0YwoFMcdzJcoVbWHgKbDBWwdEDaSYsJAZn+RN8qZvbbouNbSaMgC tF1GMewinmcjIWBx2N3NfsmdEoDjknSV3uzYGgx6bHHGISTpEOvrx+Q4yXddKJVVPC517POwHoc E X-Google-Smtp-Source: AGHT+IFMRMcxUNXCHul99WM0nOEYQH8Nd6y4x6kBohzqFF7CIBlmB9qDX2IdxPxzJUxR3zV7HkR2Wg== X-Received: by 2002:a17:902:da8d:b0:20b:7be8:8ecf with SMTP id d9443c01a7336-20c6379030emr10548965ad.53.1728432307943; Tue, 08 Oct 2024 17:05:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 13/20] target/arm: Pass MemOp to get_phys_addr_with_space_nogpc Date: Tue, 8 Oct 2024 17:04:46 -0700 Message-ID: <20241009000453.315652-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432493265116600 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:39:42 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=1728432550; cv=none; d=zohomail.com; s=zohoarc; b=gD2yegyEuEK8IjTnLkAMyjsG/DSG3bnM+eA4UbJckJ5PYXJG+1XbHZApuKcQbFM8pWWojC5LAam58mF/HdIpt9wtM4ZAOJzA89V74y8lpGYRqyhcX908VwcrN0/kyWrrNoQ3TD8TxVR5LI0XFkOXXYNWR4A8CE5Bl2Aw5SEsGSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432550; 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=fPwH8WzvUOSBv7b2/yz1JNhBrP4JSy8wU0/63Jw+amFOLRoPhzE+lS+HKvLcWklE2OmZPurGQxDMR2VskhVNBBwUYDhcA6juy1VRfWrtJ7bqloiWSSs+PsZ0katk5oRQcqpFhwEiExYR9InWAC6CetMcfVUWF/kiWxqUwPdLvMM= 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 1728432550361489.727957843122; Tue, 8 Oct 2024 17:09:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCZ-0004R7-5v; Tue, 08 Oct 2024 20:05: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 1syKCW-0004P9-Pa for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:12 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCU-0002uG-8M for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:12 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20bb610be6aso68589335ad.1 for ; Tue, 08 Oct 2024 17:05:09 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432309; x=1729037109; 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=BjRYaOoDQGEsEE64uTZ7bFuN1BblEZoOjojjTKsNeTifmXKqMK52hDK2HnBmnvOENl i8Tas7iasYxs65yHsDTiU4OTFE4k9/BfMuLy24MMbvlOGETEuTujulFZ/1nFNhNmniLW jD2BKU5vk/SCIFn+AIcdh8+LC7ff3JF4of+owiwLmpnb0Vvjzzd/o785mpn+cnq+Zxv1 SiwG7bn3TpccfnsDCaGCw6iP+s7MuT9UL4b72/LFRT35vCDUD4NMSDwhwR3lGve074Is 1tz78OlJwX1IQwh3S0QXrGMQf/9ld7OdfAMfL5k/3U8nCHq7C76JNkbG6gbY2dnio/J6 F84g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432309; x=1729037109; 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=K8ZuvjVqWH22WzmcT/PIqdvE7DFw58j8og5SLAPX/llwN787SJbR8Y4Pk9nlqWTZS9 lqPUVtnXPSzH7mScjeWzyFOldLWNFnoYNf+y+iiQSHNSALIALugH0zNTs6o55t0Yo0dq MHmRlUZu5/z7wp09yjIEZ7tUi5A4Ri4WglyqLf7gqh9FZz3MnB1g1XCXJnF6YFl99XyU HT3zKzEFQRpvbbdP3c4mEiIdNhycw+Dp0sk9vAOGUrPdyqWu6k6sWm8cDks9zOkyTRm/ o3mAMWRdZn58N/MI2xff8IgPpL2ICoSJozZP9bIen6dby1oPhp8tls33xG8ixL2eegcT waMA== X-Gm-Message-State: AOJu0Yz/KmtQ0ba3tSlfSZ+L2NMv2ijNsag28gdHBWuuA8p+TTjkyoOK NPnLwXizwimkPRWx0AWw3p+Xm5qFXmqbaw17jwNMkF2oie1Lg418c0ftCgt3GVtCIesc36bpR41 c X-Google-Smtp-Source: AGHT+IGz831u80Gw701tK56DvhnXhyXPWJ4bmGeVXTKsGYyVIeaQp323LRx3BoQmx+OjkzUmoyjqwg== X-Received: by 2002:a17:902:e543:b0:20b:5be:a403 with SMTP id d9443c01a7336-20c636f5d9fmr11781085ad.11.1728432308873; Tue, 08 Oct 2024 17:05:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 14/20] target/arm: Pass MemOp to get_phys_addr_gpc Date: Tue, 8 Oct 2024 17:04:47 -0700 Message-ID: <20241009000453.315652-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432552248116600 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:39:42 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=1728432490; cv=none; d=zohomail.com; s=zohoarc; b=Kkl3m6bxcry5E8q+7yrjhAUm5SJDrp3AunlD/+XKU/o3QP4Bru8XCnlbquzz1YcbHh3DfOWKFQubRFTDrSEwQjtrY1Jqb4Eiv0IFZrV+Nr8umK3xjU4QqGF5yr05lQnF4Jupt3ImCyC2matTYwUTi40ny1S4+rihrn0BaOnlZnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432490; 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=Ig45tdJIHTGdhZ6ERyzOpKTbHoTBiLJcl4d/IlhrKZTIS/8/92PHRZROGBHbD+l/65pEE2M6xauTlo/ODG46ob3Ti6+ABOVwjLOly9Ir210vg+g+st0ElqX7UQYGK2j6NQKV1XpeYL0UY3gTNXfBRz7VIVGbo21eM36cqedZD48= 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 1728432490922393.1042983274066; Tue, 8 Oct 2024 17:08:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCa-0004Sr-Qq; Tue, 08 Oct 2024 20:05: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 1syKCY-0004Ps-29 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:14 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCV-0002uo-4c for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:12 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-208cf673b8dso68771795ad.3 for ; Tue, 08 Oct 2024 17:05:10 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432310; x=1729037110; 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=CkEt7i4AM9zM3IIh0AOS7bpPHSCnvlfX1qFxZB4sT+EqkeKwXd6Yl2aufbaXiO9EUE KlstvE5w0NyS0KfTtSASAyHQy+amoiGTsJV6mNex1uZb55+dBP6zsO/gvDEWIpR+8fwq sNUgZN5Or6Duyb9tb83ryRplsGaQMIYAkAlPy7xK6VMbkLBIb2eQ9AEClOcJAbRCNClc /93xyn7CR0taBJvrO9Kv0hAcdVmpv6D2Yy8dZGJPfMy+XA2k072cEV3cV6Lsg+qrtyqV K2jp3gNur3AM/ag2eqM4H5ITaqGb2ahNs48mYnExx7A9L/0F9sxnLMwdF5mm17itxItX e7IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432310; x=1729037110; 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=gf182TIs6KdmR8hyrXDBV/LtNYjl9Ihp/Mk7H+S7k0E9+ghekcQ2lFxdaV0OcfBmsA DcI1/IRI5qnjdNuk+8Fhq6wQ2HjI1MpWPWCtl8Dluh8paMgjlciaTJIqNgrDkd9EPv9f r8bwrXAX5gRRkq3AP8CxdPLwzTYnoykJHvzShA3JtCeJeBu+Id0UXdEbJK1MuJEWmxbF Gstaa1O3nM1v8bhlwAIy3WWGErh5iYHuDPrwY3R76kyMAJbRnyzB1lvHDkKn0N6y0FA0 WhmbVnS1YbKY8iVow7/fy2823JhKRoKkqM2TLx5nJ3jhSVx2BtVZEhXAdYvGFspByHeG JQEA== X-Gm-Message-State: AOJu0Yz8q4yAkWasf3jQy9h+xAihzF8AsWK/xhGDTvzUmXh3TDqkxSa1 ilzZHtOzoDtqdQB4FIfFTg37piEIUDOVLJ5XIr93u3LJFUCiWWlIncFdKOQhuf3f5wfru93Bzfp S X-Google-Smtp-Source: AGHT+IECyy3ECPwpIxrRErzht1GulXjMyxKnwSvtoRqfwlCQOZkW3JggsvRngQz//es+//aYqmgOdg== X-Received: by 2002:a17:903:22c9:b0:20c:5960:bd35 with SMTP id d9443c01a7336-20c63710345mr8780115ad.20.1728432309687; Tue, 08 Oct 2024 17:05:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 15/20] target/arm: Pass MemOp to get_phys_addr_nogpc Date: Tue, 8 Oct 2024 17:04:48 -0700 Message-ID: <20241009000453.315652-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: 1728432491250116600 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:39:42 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=1728432490; cv=none; d=zohomail.com; s=zohoarc; b=GaZ5llwGd5Nl7U0ESXzu6CEkJB3dtcwC8WDNSDRMR7KiTwhw+qBzFLALyFltjTx5z00ZRU3I01KzIlSlmBV9NM89ms4AIECPxKkK6yzlzwtUXuKEM2Sej0mqj12MROwwPouRcB4M50njPT2NgaNqD7I1UlgaNdp/XDfhrILSbis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432490; 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=Bymw4pjGU1F9TU/qrH28sRthCnosRnquaHcBF3gJRGUk1d/fwbd07ss/H2MyYoHnXbpLz/ah+hi+xZIiAfumxk8iN+uBLDWsS5kJ7VDEkURFKqCf7RutFD4K4+Np0wsR0kxNq3TzE8gIcpOFRgJqKuiYSdtEh5TiCtKoydAvbjY= 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 1728432490224582.9513825160543; Tue, 8 Oct 2024 17:08:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCe-0004WI-Sh; Tue, 08 Oct 2024 20:05: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 1syKCY-0004Q6-4J for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:14 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCW-0002vP-FL for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:13 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-20c693b68f5so674385ad.1 for ; Tue, 08 Oct 2024 17:05:11 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432311; x=1729037111; 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=RCevTzLB/Xw8viAlhPQPqUOQhWu0Gmnlo7fqMLuL82t8w0awlbAcTdh2TdY7vmta4E q7FtrPfI9f32kgmUcH2mAPlrLEp69Z0MkKD0M5H1Tpew6YJqkVvVulwztFUo6JUAw8ru Ns0QAbnWHEm+CJGS/tzuA3HNfvTK4dwmf6K5XhembELKT16PzhVg+c9YFLAINyIH6RK5 lB0t2jIVzF5pZRt4DuZXOce4JpZteIkK0S7UNNI8kNn+NPkx7z+Z2GdgqblS9KALoNid o5wUFqlM1DFmA5ylm0n67ZWmTrzSazoS2iAa4A1AjU6wXmJspa28kPYFcX0+aXEBu0Z2 acaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432311; x=1729037111; 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=lqIWOklmVPhrT1r4A75bR54F7XMZlp7jFk+dUJpSCcGvixseyrsSAGv5YDrwR1ZntP rxtaRkCVrRfgNl/8PI7LOLykiNip/9RaYSRYY8/JTylynct9t0NClzJOEY/2pMR1T7K4 xi4BA+c0puhWhcd02xYA6ROqistjM0v1HIJTitIzKifR3EUmJeQxeH+1HcFx49s16OlO VuuFtbtDcgr80dvzxgt2j/QrqJKWSFhPGsOajiJwie6zrOmkadNEZtM2QPOIrv6YeKwK 5jgSa9SGUeE7YHlm/uP+rQ8TjbG3b0YcBEE4IKEd2POaSzfWjAA1pAyrttXjz7s29Y9d ptHw== X-Gm-Message-State: AOJu0YxehA0klsT9ufZmQu6N333go4ekkqoDHHwC/ln2xWqHSH7/910E fWJweKakNp7Y433DdjoSX/dSO6cbncj4C2i8+wKOZ5lAf1V8j61+XE5Vv1cr3ZfRs3R81Q/o2bS b X-Google-Smtp-Source: AGHT+IGJ8O2nfVebXs/rTPoybsu6FDn6yseoR+E5sJTRxCOXXVZpsC04cUko3bF+v5+Uw1ma0m9ncw== X-Received: by 2002:a17:902:d585:b0:20b:a739:bd60 with SMTP id d9443c01a7336-20c6378d2acmr8950605ad.51.1728432310616; Tue, 08 Oct 2024 17:05:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 16/20] target/arm: Pass MemOp through get_phys_addr_twostage Date: Tue, 8 Oct 2024 17:04:49 -0700 Message-ID: <20241009000453.315652-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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: 1728432491262116600 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:39:42 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=1728432521; cv=none; d=zohomail.com; s=zohoarc; b=JPECgfYKLkydxpiOPiMeIKWUgTySzJV5+BceJ5xCng7pTXnPzBJ05ACxCxmFvv3fYaGGLdPg6Fcz651Zhlo4aG2C+PJCc1B7a7wJWL7b0DKXiWL2dYsvhUxkjELBXQtRfiPlRr1Huv3768c/y9VETt07bPXLoK3gLKOCnOBlzhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432521; 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=RKQyN1UYiWdTPDjV0PmRNzpK+gWNaO0iCgU130RW1FgnsqsIkkNU18TsabwCauHyts07OpqXQley4W3OakFyc+D4ScJB6r09aOpVVPOE5/R4JRO5Wj2DZfq7VSKXvAmHVT7/6myT+3dJhhFbZY/n3tji7U0whUVygD8oHmdkjZk= 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 1728432521319152.79821321985003; Tue, 8 Oct 2024 17:08:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCh-0004XK-7K; Tue, 08 Oct 2024 20:05: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 1syKCd-0004Ue-8F for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:19 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCX-0002vq-5V for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:19 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20b49ee353cso58170815ad.2 for ; Tue, 08 Oct 2024 17:05:12 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432312; x=1729037112; 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=U6kx0i/eMPIC2ohHI1uR+zInnQ6YCT0aSvcGPSlIYD9YEIkfMpaYWWSR8Gyykz71ir jifEUmELtNrusQ9AOgBphnL7ISec98s4KXKF/G5/vctoTVgIKCfWPM6On4zQMLMcOy75 u7UHGTISRERk4N2e180b5eRCFzWT1nRVRQbbX683GkQz3mj/f0Q1eCDYMO5gMPCCe/G3 0ma3zqQCfq3HQzyLViJCo8CqeXbeNTNrkcCz/jQ4VN0X6T1rp/RurpERW0LshjPSY/w+ S5nS7uGD/NbfFcf5b46l/Gpym8JPiO+VLmfkrX6173aSyQHrl+V/Ndy5635n/EFE37Wl JcgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432312; x=1729037112; 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=H3oTHY2d1kQV6jG5kwRfljIpDfh7PYPUsuP+vH/OJ0JUJup7bTvOqKJH4AzWYoys4w 37KxRa5AcZp8M4FrXZBDomGFqpstGl94r7lSOppyGaZJR21q80zK2WhmUZ7n0f/2B+dT lb3mNkO7YoPHoo/2eyoe13B+RtSgwXzu9gs8U8CRpTBTUmteadHLUE13iEvEOTjhwXIn EvQW4dvhhPQ0IGMu3lXXULP5IaVofNAjlmG4OGk7nU3XGAigVN4bD1ltaJexxJ0kcV0E 2rgAJk1dDh7XSjZ9vJJ4L3HWnjKzMlEvL461JIM7cup5xkuV2NcTek7j9JXU1hzko9sy LWHA== X-Gm-Message-State: AOJu0Yzy9+oCtg7g7AHD5+F2c1IkM9ru/Ki+07x7YLiPNe0zv4tBP+5Z /FlpYdSFuppH65a+in/m0kInog4XVMV2/qiHkQyzDt9tAqjpcTp+sSb5o3XbS8ESHTmDKYfE3mJ I X-Google-Smtp-Source: AGHT+IF4BglkotazCAHqUPofHInFIYYYoctu9w4tOUz92qreZT9FiKqKTEYHHdQjaQVFF8PF0y1lkg== X-Received: by 2002:a17:902:da8d:b0:20b:c258:2a74 with SMTP id d9443c01a7336-20c6373ce07mr11388505ad.29.1728432311644; Tue, 08 Oct 2024 17:05:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 17/20] target/arm: Pass MemOp to get_phys_addr_lpae Date: Tue, 8 Oct 2024 17:04:50 -0700 Message-ID: <20241009000453.315652-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432522109116600 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:39:42 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=1728432366; cv=none; d=zohomail.com; s=zohoarc; b=f61RSkpa3hT3fdRUvwh3jTzLuycYMW/RuJcl4MmDPJClndcBBHp+0r8zaFgvcWN+PlBp4LVIV4G8f19OexfpDN3SOgZDoAWXUTqw1jTwYWr+Fsuawsv3jUkjC0fMYRm3vFEgdQqFcukDmywvF9Y5UtzqIlX8fuZomQGgIPjXLTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432366; 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=LjewFJcIHATUuZiHLi57dakeGmmIVYgHPGK59lAqWiHBaZWc9PYQ1jcfHYumSqvrLPmCRGKipixlzrTxbbmROh6WjjOuSYYJtxL0bmFJXn9JBPeI9IbCf1xVOz8TrfE5Mq1Q2+HeaDQ+E1qEQpx3eyrW3tguDL6Mz7VHkYM97qM= 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 1728432366785583.4894282900729; Tue, 8 Oct 2024 17:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCc-0004UD-Lr; Tue, 08 Oct 2024 20:05: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 1syKCZ-0004Rn-O2 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:15 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCX-0002wE-TO for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:15 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20ba9f3824fso47871655ad.0 for ; Tue, 08 Oct 2024 17:05:13 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432312; x=1729037112; 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=O05Tx7zVQ0y2zGS9Q6GqBAi4Ceok4SaAAPjFEZdlHdbxA2DwQcLdA2KSF6ltKKcyik 2qOiQeIvxoa7S0yw+9D2/xijqAPr3+NoKw264v+K7wDmbrJ3KZaQDCQ9K8GeVZBQ/1hi E+We2sccOBiPa2ZLnMGjrbP8N5w0FleyWV74vY3UYqxs81SBfUPw7dG0PeorDyOWBT62 qher5a7I45cokEAl68NrWYV1+Qu+LioWPs9IIgXcBKqIe4YBWEovsnB0yTxF2ZYPr2A/ EUWAcOl8MhaL976Qp0fzqMXxEI+pnRoKLTFGR1lLsiNpQ8iitfVaJxaoy589q04XkD3E MQQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432312; x=1729037112; 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=CgADoFpt/Q6AxxOwN1LkgNTKJgZWTQz1aOPHp9DTwlxntHo41R97XqCO7BrqcyAUu8 w0drRCKtanhjzPtoLdAMy6dbAeM4z4v3ksIT08s84U50tlydzPLId3H6b7paSjVqrrjW +J/xzmcA6O4kTANDVcw05t7ZfjZfzWrGK6qIOpyAE4uvxYzFEH1pu9QbgjpKE9flNFNk zcgQbIpBHLnWX+LGQtgxAQ/aZh7yZMCqLl1gbGJf2by30tlNzikzy/IokNvn+AD/xoGl 6p8ePsxyie7jAL6dq22v8jQPSEVsDPpU4zRrfWi5lGSjQPuLcd9kCWcXyX72/XucDzoa +9Ag== X-Gm-Message-State: AOJu0YyRYK2ek6IVKXaYTld6txgqzz8Hi6qSdHwg16SwVgme4gg77nSG mlUdwuIw/ruh7PzterEi8uHDV8zWFdi8x7zK37FhG9mn5E2YZ+eLjklDryUtAcsE+AvKfZGkM5K g X-Google-Smtp-Source: AGHT+IGdLlh7lpqvQhrMnt+h4KRJVDHjJLBqhH4OV1XyMKMzeUf8I/qGPJ2X48D5Sn4234GTGJ8pPw== X-Received: by 2002:a17:902:ce91:b0:20b:54e5:e822 with SMTP id d9443c01a7336-20c6377b24fmr8881225ad.21.1728432312463; Tue, 08 Oct 2024 17:05:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 18/20] target/arm: Move device detection earlier in get_phys_addr_lpae Date: Tue, 8 Oct 2024 17:04:51 -0700 Message-ID: <20241009000453.315652-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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: 1728432368802116600 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:39:42 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=1728432379; cv=none; d=zohomail.com; s=zohoarc; b=RVsv2yphz/IGDdvuQEz553iyBtPxetI9HqBpE9Ou0zZs67QZ0xqPd0GujxISduhZSrD7Mc2oXK1s9Fm/XDBf7DwU8jTPw4kKwWCGYAl2C3Xmw/sieNM9fvdkD54ml0ok+esjmlMbVUxauEvK+WOOOrZgBll46JJxk4+iaEzl+yA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432379; 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=AsNmQx87g0SWMKNuiqJxyPNh2jiF8Ss0MC8Fky2xo4U=; b=B4dnkGVe9iTySzHfU/x5IpLfb6n8+gIBIbg7NBa1O5Kqwi8k0UcDbn4y3lYkCG5mB5w2Q4n6R14oN9enzajxEHBVpx7UyGRo/gu5u5caKQeVRgwSzMv5HQDma3+F3bzBu8NWJzRkh+jOmDJtTu5Cu4RkUz/Sz5QDoskde1nCCOk= 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 1728432379564645.5213625971217; Tue, 8 Oct 2024 17:06:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCd-0004VH-RU; Tue, 08 Oct 2024 20:05: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 1syKCa-0004TA-VE for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:17 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCY-0002wY-R6 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:16 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b0b2528d8so70929345ad.2 for ; Tue, 08 Oct 2024 17:05:14 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432313; x=1729037113; 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=AsNmQx87g0SWMKNuiqJxyPNh2jiF8Ss0MC8Fky2xo4U=; b=XEHwPY2IXI97sKGlSMw7Jt466C4Gy7yQYmitt5P5zPhSDAyV/lsLKMyQAaqkGFtq8l Htna6jR0qs1sMkVBL9KvwQxdZh69ubTxNoD1Cjnd6O2bofFk1wm8gDtCX4Dlyjvhw14u xVo5uPM2HEkxQncLmu6S0VudkA5HXvQwIofPsATSA79tD0z5Uih5qiwumaICTSzP3WKn Zpa3DsRMQLk2g9dVYFmmXoIteOkWgTTCbmBXShDF/omqTkMYhycpSWxQMcmT1kPQ1y8q MdqOhAF7JFjZGV9NSvQs9tr3d4L4zEzB6uWGFqKXPZAMwyBeQQ4jRzNFkJMSTyVOxfhB t91g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432313; x=1729037113; 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=AsNmQx87g0SWMKNuiqJxyPNh2jiF8Ss0MC8Fky2xo4U=; b=mD8e0kGIcH9s6t91qpLQDDlIKWV5JeJT5ewPbzTm73bM5qG0f1Ym82JzmoQXHmOMSF pDLyf531GaW7O5IALN4D2GVZtfnqSP5nQKWDSxfnK+3xpb4OPugdC2TSmgLQHd7RboFW gkm7B7R9/n4aU4aC18ZFPDYRN/6gEvNDhoC9/CKmpuU2DxACuJcFSwRtcAU48/v8kRFM Lpv3Gc9K0f4lLunwY96r8u2e5nlv8fxnAL/P4zQFDDQErixFJXzc91h+UIVOoWP1zdYG 6CN52Epv+cC07U35FeXjuG1Uly7YEj7jyoZbKi0osRUCyWbBZzv+U0x0Lu6B87mfmU7X AROw== X-Gm-Message-State: AOJu0YwswONt2LJjeNhh3hl6ET6Xk2TFIx3vTBOzC7thDwPndi5gGjDi lffv/w82pIL7bQ3ytCqh5KjU6oBwvW4VTy13lZHHdrum2NDUM4GjD4Bgwb9sb4pLFHILMAUEHFL 1 X-Google-Smtp-Source: AGHT+IFwettQe3bNvU+s7lxTJSvr2zVnYgznFgHUWVsZdUYFjaAq3kofjLpeFOF7iswFe+1y64JOcA== X-Received: by 2002:a17:903:228a:b0:20c:5a64:9bc6 with SMTP id d9443c01a7336-20c6378e9c4mr11368345ad.50.1728432313486; Tue, 08 Oct 2024 17:05:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 19/20] target/arm: Implement TCGCPUOps.tlb_fill_align Date: Tue, 8 Oct 2024 17:04:52 -0700 Message-ID: <20241009000453.315652-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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: 1728432380900116600 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. 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:39:42 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=1728432462; cv=none; d=zohomail.com; s=zohoarc; b=NmBsNzceB8p3dgqJ0Y2+mFOmerejMCQKqkAet2hlGz3OFzITpcsRcRQeziNzTigdwu2+PnDYisNaENvlEsSNkcF4Fg1iB/CA5/SqWWL9f3GqrSY+cu9mq9XErOj5OGeTYA5bKkoJk3dDRX93OBxko4zN2eyGxgSMsM7p5JekTJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432462; 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=V85NZ87ZvVDChIQiPUKf6vTDddn8Rb31gw7Xx1+FH0QD4YuO0/WSgKYW1MPle5McLaYhhaThEH1EVBLy1b/yhaZr/HVhN897VaB/AK+Yx+iNjdNHUHJECYPULmactAh8TtkbHmKhutxwvsuTuPD2ZFcq25g/ryYXPoKNiLVnMsM= 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 1728432462589126.81210970063978; Tue, 8 Oct 2024 17:07:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCi-0004Y1-8q; Tue, 08 Oct 2024 20:05: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 1syKCb-0004Tu-TS for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:18 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCZ-0002wv-TL for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:17 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20b5affde14so45287395ad.3 for ; Tue, 08 Oct 2024 17:05:15 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432314; x=1729037114; 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=nyHqqErlHFWGeF3OTMPKHNnTLBYpT0gqymAgIym+zh+g0cf4yo1tfdNkczWpJWT7o2 uGVqoWRAiwItJjt7tDoETyRyXjE7/yMggihV1w4C1pY2AL4E3Nlca7hentoSfgU2HcVn Jby+Yq35tTuPY8Zk1NDbckEP8VcYbbqM9QWJRFnKnEjMVNtw1DXGPSBpcw4T2ZBOvvR6 DR62s6lp9QbMOjFQiK8eFOxqErW30qVgIwEGzs70vTjFXg3aYMWu1Lxq6WVjkoUBtSSd GeyC/Atpvjqgi3ELMXQ1V5x9YhRXtqCJIfRT4jNkqXF5rT8eBQw9H/iGrUSsnfwsb7r+ ZPWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432314; x=1729037114; 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=ZJudyl19112scXkuZ9aUy00ILY0SN2nZFNyAnSy+3IcNTrTe9HpksLfmZ+njW8G0lb O4Gb2F9olS7Eeft9y3OM949RACcZ1homl/M8rtg32KHu68IMhUYVZhUEppuz55vVd8+Q Bmy3sT7Qk4xlP4I73mZ4f/UCYoGyBae8EZ/bAq5G+fGpequpHmIlL38lKxBsOQgxt0tv RizjShSnDlhJPGGc5fwrpoGbc3u9ZO41OAtQwdixEeqaIWStCKBLrNWBW320Z1jqbkJE Gz4dggb8RqG76a5rIUNm1nPZCvOYTtCZP4+DYXI5wHVmYiVFtznomgGBdvQrhigiHbG3 3O5Q== X-Gm-Message-State: AOJu0YwcEwtxAprvBmeWvC3bQ08i9enHSgjgfrKDGxoCS+6Y0ev8IWyW f4RD6QgcoAm2un8i5tIRkLuYd24uGcIreD1COTajP3v7SJZo+TnvclK8cSGXbJPTln4+z8JJMfa b X-Google-Smtp-Source: AGHT+IEIyXlGp9GlJJjjmIJWjUJQUjNDGcChOdkRVTwHuAzsY/hOJnshLN76/ClOQ0ILuClUnw979g== X-Received: by 2002:a17:903:22ce:b0:20b:a5b5:b89 with SMTP id d9443c01a7336-20c63751f24mr14941525ad.35.1728432314287; Tue, 08 Oct 2024 17:05:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v3 20/20] target/arm: Fix alignment fault priority in get_phys_addr_lpae Date: Tue, 8 Oct 2024 17:04:53 -0700 Message-ID: <20241009000453.315652-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 1728432463182116600 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