From patchwork Sat Oct 5 15:25:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832987 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1257044wra; Sat, 5 Oct 2024 08:31:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXC3Bt7hytJmWXx7g5RU9KXZxwx3tYqQ+8uATzVmb8GLQYGRNoBTOPrqy0bPMHJekIb3u6FBw==@linaro.org X-Google-Smtp-Source: AGHT+IFgTSDO/0W15T0rPKr8p7bvG48LMa4aMzFbcsg+DMs2tZ7TIFV/6wzHVPKafTAkgrytyMEZ X-Received: by 2002:ac8:7c46:0:b0:458:3b68:ce39 with SMTP id d75a77b69052e-45d9ba79546mr97518241cf.9.1728142275890; Sat, 05 Oct 2024 08:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142275; cv=none; d=google.com; s=arc-20240605; b=PQoDkkTN7yiSeJl9eJxdJgWRRFv1hc65XPxcn70sci/V05j0a4xkx9npOKt+UX2+kZ WRq4rS9JUzIboK3oTsX2EhAvUp/goSr/tFhYJsQBr/sU1SX807EomemTMu+llX2uWKHD zdQ82jdiscCswnLNydQnpvqw7nXm+I7w6xFtw/cBjSsjVVc+jOx2G2zZiOOITdrFMp34 2wI72r4/W7jgW96Cj5OLVx/VqFz424ELLL8mSDXze3dK09FDaihl1etjCLBCeFUzeuDX nfYsbMAnhF2CWhR5p55XuhI3krssR7/odZnR5EmzwFpzYwitCAmWgcIw2R4z1op7Ctvf A8MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qpc+gtvz4QF2D7U7hwk6I/PwDTmOhNNc5A8A2G2CqV8=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=Z+goVtVUjBXc6h7JJEputVUELhZxhgRsE1fM7t7lFDjCH926vsvnjxvwc/1cNrDfLM 8Zey3MbXU+Tp/JgvMBIwjPO21AT1aWHN89vAap2rc8IKBuxaYB1ZNw6RotNu1/bPWC7A dArS/bw98xc8Xim8AQhmmf2d0umglb8dhSgTzI+CfdL9CHHXgQeUJb3P3AjWA3zGv4lK dOwBjS/MpZVX0wLpoaykYPo5ZO8S/+v6tVWRBFHS5LYT5Rhk2B8K64DgsUEwnR/OHW/N XEjtOnOXneRb0AUSZUcvVPZy5UJaDejCI2YEca6hWWWMU8DLhP4qRSiI7MhRH7l1GxzD 5D9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b5bH8TzN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74ac7ffsi21629311cf.102.2024.10.05.08.31.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b5bH8TzN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fO-0001xc-Mt; Sat, 05 Oct 2024 11:25:58 -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 1sx6fN-0001wa-9k for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:57 -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 1sx6fL-0002KG-4j for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:57 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20b49ee353cso28727765ad.2 for ; Sat, 05 Oct 2024 08:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141954; x=1728746754; 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=Qpc+gtvz4QF2D7U7hwk6I/PwDTmOhNNc5A8A2G2CqV8=; b=b5bH8TzNryOOwnuIPccE5c3jXQcoTLmj3rhK301DiqYSSeqiN2hywFG/BtDwp2cXFz qQ88SomeL5d2m86/ddrR3T1paVASX8MWN+ATOdfYr9OC7+UBQ/T4rdVcdHBIP0MHO5Ld ZC3wBUHZ1VisVlKtKn02HbJ49qcfXy9pijUw+FOVBgg9PTlU5ri2taTePGH+UljZRWbE rTpqTcWJDBIXl/c6cFj/DRkVBi1BmoFLCxyEk3Q9SkLLEofbYyZgBQdGlqGHSuHKznXI jdGWipLdEI8UGiqx6LYR7tIWCqXhtBvU5P+hAJYUBYF7jz57sj48w6NIaC64iRjGLNBU EjsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141954; x=1728746754; 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=Qpc+gtvz4QF2D7U7hwk6I/PwDTmOhNNc5A8A2G2CqV8=; b=v8o8cF3wzBNwtSe8as87X/Z1ju8X1VnZn7REqwlDFRe8hbmaFmpruPJcJBKeBJ4ZI+ P47QQRk8VceTQNQbvUJm3RNlQ6N8SYr9z9C6aV6Eg98/tL/f32JFDXbdqGytMZFTNoLo beeoPAVFuxrD81cLy07OuLPkJ+sHkbCj3qoFC1mJW3soX6dNGmazZ74P2VVjmmZpTYW5 XAlbUceLYzjeDE/ATnn5NxRCGavHhhn6zjImF4YY6dO0KUXh7zqaHwWKUv+ECjoPmcTe SgWVRJomncZpHpy9ksH4GdOQ25vKIA47RCqHQHwIkjFaCfuOGrwuLVIUMgLZfLqHQ4yD 2/CQ== X-Gm-Message-State: AOJu0YyijW5WyFzmFXV1C5bNwcjTKHpBLBMIJBx03URX/X8LS/v/aKP8 T789MubXKOTSZo9LPv4pO60QDhQbgH2JRhe8pnBHuYWMp82XbZHvtIxaJnEwcmq4s8roGeR+GrM S X-Received: by 2002:a17:902:f68f:b0:20b:54cc:b34e with SMTP id d9443c01a7336-20bfee34d54mr84315875ad.51.1728141953851; Sat, 05 Oct 2024 08:25:53 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396948dsm14351765ad.225.2024.10.05.08.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25:53 -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 01/20] accel/tcg: Assert noreturn from write-only page for atomics Date: Sat, 5 Oct 2024 08:25:32 -0700 Message-ID: <20241005152551.307923-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org There should be no "just in case"; the page is already in the tlb, and known to be not readable. 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 |= tlbe->addr_read; From patchwork Sat Oct 5 15:25:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832979 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256258wra; Sat, 5 Oct 2024 08:29:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/vFILC6FMYmowq1DoznIFTp3yEFehmLQpQpuaYxwuZfQVema+C8PjPG9dPRS95KmztPtSfg==@linaro.org X-Google-Smtp-Source: AGHT+IGAHun1YYk45gMHgvYGK7vj6LBgfQCta9WlFhbk7maKqf8LYl7UPEZWE+1/4Rqfus8twai7 X-Received: by 2002:a05:620a:2407:b0:7a9:a6a7:dc2e with SMTP id af79cd13be357-7ae6f441a7emr1010284985a.26.1728142140666; Sat, 05 Oct 2024 08:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142140; cv=none; d=google.com; s=arc-20240605; b=Plas2yhVrvb0Q/V9bMRBi7PXZsBiQLyVZcjTVZL1+WI4N00SxUV47/5eVnZ2ULu8e8 MgPzfvWIbUPU/r20p4jKXlCNIQd67fNCEmqg3/Rm9WlIdOcSk0GCdZYx/4XBiZT0GL9h x5XC+XPm3rqWbDTSwRe5Hm0sUUxiCFtxVDOfi5DKddznfkyYuNYElve33N1lKw7nBVmp FfcAVv1wPnUFj4pIpeS+n3pPwPJFeSF+NgiOvauPPWmF/trdpO0Y8KkKkd8mxUMOMDoC lyLq0OzO8Bg5QNIvBQcJtFgNWi/+XZnlmPTV/gB0ZOdxEJS0qXGiS+Mp97zjAOwb5mSY AbuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=aZdR9LIf8F0dugaec6jrlqgppcxujC9tn9yrRoPogmESUEuuI3gx8Td2Ld3lyydPHs F3xVEwPF0z++Vc0PvnImHzEdP3gslvfh14+rTvv91lwpVc4scry9xssOMqDP0TuU5JkX FihNAPiQBekp6E9YxYvFlq4DXq8PB51WTKc4mLxCBvYNmR29lBut/0X+n25qz9HDVnP8 CwOm4PD+zbJ1dyWI6vdRz03Ivv/u1C6svwinv7bY40gQ9vXXbY4j+LD2Hg+5pXCsezVO X1OE5T35apgJqOaHDpKAMicTdWWhD5qY64XMY+Lh76mALmCCZmESQoHEjIhfr88T7Tsd QwVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NRxMumqh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae7561e652si228676985a.95.2024.10.05.08.29.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NRxMumqh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fP-0001yR-Jl; Sat, 05 Oct 2024 11:25:59 -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 1sx6fN-0001wq-Pp for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:57 -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 1sx6fM-0002KS-85 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:57 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b6458ee37so36306035ad.1 for ; Sat, 05 Oct 2024 08:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141955; x=1728746755; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=NRxMumqhUyi4JtJy/8PTggZsUF1jOR0NNV50ryHAaU2cqj05VlICmZs3b06OiKYHnv gmjMgSyapT0roF9bCsU9+qDLqmCHetHwarcbolRovDLfXFsn23n1LAsNuG+GZE0aDE8H vSeelEQ/kaGrblkkrNZ1SQl9DEJMHPaBozsr3CjaMXvok/vpShsAWVfSdfvBsZYginUf DsvXzJOndqPLLcROLUngHqT/DOj4ZxMWt7vh5gRCbZdz+IOMZj6e6Pguas53nIEYEqBJ iYSKUlPHLkG1SitzO9aBt6OLh/8J8teDYp6LRx70eZPtGfjge0+f7PxwQcCCxgek8fAt DAfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141955; x=1728746755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=ocWFPcy6DZgGoY42joWFetRjXpKZgHfl+PvOWeHHEq5+tCnFV+MHyS0Dcj/rzTwD/N 4gU/0YbIDVUQHXIjpWygT3G5aY6owK0izWw6SEiQu0DaAQ6QapT3acTqaGOltN0RB07e qlOW1mj6oVty+BZZKTjV2imrOhlqLyqoWiW46nE+pPfQSB/XjcTvR54GB2tqLTxQChcD kRXfOmjQsQXadhoWFi1Ty4rYU2TVw0GG7QgpeMboqKOBEvyrm3v9fvmsFGffzXlmJ8aK 2YQiRF423XSkkO0hQdYHfA8fDlYv35fuXkQsBSBIAV6QAc/MIGVNrWf2vB4ZjpCvYaIy hiWQ== X-Gm-Message-State: AOJu0Ywz9MnbOQWAgNPbQXU4P0ktrQeIPnLSF/1qz7Jz96LyzM2d18C0 xcWRz7zeXP27LlYhFdVajIITrQ7J2Z5c6id7jD/adfYm8y/OnEsVH40FC+/Ylt4n3o6PdCCeF67 Q X-Received: by 2002:a17:902:d581:b0:20b:419e:9f15 with SMTP id d9443c01a7336-20bfea570admr86092045ad.46.1728141954795; Sat, 05 Oct 2024 08:25:54 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396948dsm14351765ad.225.2024.10.05.08.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25:54 -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 02/20] accel/tcg: Expand tlb_fill for 3 callers Date: Sat, 5 Oct 2024 08:25:33 -0700 Message-ID: <20241005152551.307923-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd6459b695..58960969f4 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1220,25 +1220,6 @@ void tlb_set_page(CPUState *cpu, vaddr addr, prot, mmu_idx, size); } -/* - * Note: tlb_fill() can trigger a resize of the TLB. This means that all of the - * caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must - * be discarded and looked up again (e.g. via tlb_entry()). - */ -static void tlb_fill(CPUState *cpu, vaddr addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - bool ok; - - /* - * This is not a probe, so only valid return is success; failure - * should result in exception + longjmp to the cpu loop. - */ - ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); - assert(ok); -} - static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) @@ -1631,7 +1612,10 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, data->size, access_type, mmu_idx, ra); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, data->size, + access_type, mmu_idx, + false, ra); + assert(ok); maybe_resized = true; index = tlb_index(cpu, mmu_idx, addr); entry = tlb_entry(cpu, mmu_idx, addr); @@ -1833,8 +1817,10 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, size, - MMU_DATA_STORE, mmu_idx, retaddr); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, + MMU_DATA_STORE, mmu_idx, + false, retaddr); + assert(ok); index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); } @@ -1848,7 +1834,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read == -1)) { - tlb_fill(cpu, addr, size, MMU_DATA_LOAD, mmu_idx, retaddr); + cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, MMU_DATA_LOAD, + mmu_idx, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for From patchwork Sat Oct 5 15:25:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832977 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256196wra; Sat, 5 Oct 2024 08:28:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGZ9ARi2URAjJdR9kAWv1TanoLbJfjzrvizlyXlk5chgJhL4yzvCKLKLP4VTXtECgJgAMHew==@linaro.org X-Google-Smtp-Source: AGHT+IH1WevLPVfrAhQoB/ZzytLnMNjm3TCO9UWbMK7k/IDWzuqLPJGTtsxlhI80MJ0DR4hQNs6p X-Received: by 2002:a05:620a:4588:b0:7ae:4b83:daf2 with SMTP id af79cd13be357-7ae6f493bd8mr1021771285a.61.1728142124194; Sat, 05 Oct 2024 08:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142124; cv=none; d=google.com; s=arc-20240605; b=PrG87Y9ru6XGx0Y7oPwg20TA4i4p+8Ubwq3tEBiDvPitTQpBgrRdoZMVPAshUr34u8 2ZksFMVCdsUXaHNUNcY8u4WsNKXXztv2z/jIP5Sxjly5+iPrR20pUeJPthXgK9gJJYmy Q41EltFl1uwqmDxeEA1krApC+oQeVwYNoR4CPl9hh1q5bg/Z6x42f3eOXRRoBKNWj/nQ lCDLg3tf8+iYmk1cZPxqMhKcgzjQ+71Z/zbw9R3/sFvjj/IaxYBd6Sp2scchNEcOvg3o IIWe/I70HglJzCoyaVEjmquRzczry1JwS60NvwdG/xwZDPkZPADBDNOWcxrVDOHgRsAu VcgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=js9k8IR/cEhAqGc5dKpCioG/n/UgV+piB56d5dg8Aiw=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=bVaxvNzbcDDr4752czaBC9oehSEAUoGbkCzHT8s9m1eLhTl/y+8wMnx+0Auy9OMffi re/VXNCDDlr1DNC+m11SxHHsnXt5IsT4FBzIGITJ0ZIZFOLpnJLOm3rDfKxLmrxqE3cR w6RDXaAQPmHPsDpGgxmQfDHWjlMI8T71J6pFs5kuV34j3KlXPV/bpAa8sApk3NknTYxY kOahM45ASBEuS8utLOVC0u6DdMac584SqcKd1apDhADYJkT49byBlaxcfUhcaUr53M7i 818XxkomazNtk/eH9ZdD5v6A3bxo+uftFGj5lCVWKTyCy+QOqfE2JoUYfYH9EjuhF+s2 7zyA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UBDojHq+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae756628f1si201628385a.270.2024.10.05.08.28.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UBDojHq+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fS-0001zz-Op; Sat, 05 Oct 2024 11:26: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 1sx6fO-0001xd-OZ for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:58 -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 1sx6fN-0002Ki-40 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:58 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-20b9b35c7c3so32438885ad.3 for ; Sat, 05 Oct 2024 08:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141956; x=1728746756; 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=js9k8IR/cEhAqGc5dKpCioG/n/UgV+piB56d5dg8Aiw=; b=UBDojHq+IY6hLn2Pm+jokXV1Vb/qHm2LRTVrgvpvQX78JPyAnXm2dcGbffMht2WRLp vwNZwf7SMtJxxDwr4h9oIIqgHHMTL5xF6bRHzg8iAgrdHD5iU9fc9IXLtOMPcgOkYPq7 iHrbX+vflVajChWvcO2EkWphPMo84H1VONdNpl9/iDRQear4HoyMytycZ0Onc8uPOq3G M4zniZeE72I9IV/DrWBdS3bWXsZoTK+pwAIeHo0eG1b+DA2NCtlLCfmUPh3JEV8A47PS rnPaaHWWzlEzEywsthBqUZ7HET4z4D+GYL9tHQV+khOLumsRpxoM/PYQbUZyzygtZ7ws HyJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141956; x=1728746756; 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=js9k8IR/cEhAqGc5dKpCioG/n/UgV+piB56d5dg8Aiw=; b=KoH9FL6+R+QW0NlY4XZ9xOqKDtxS4RqqTQJpGPt3aJDCO+7TtmyqKfjg+XaM3d3s37 awrw9EYfq+bJ5hYYMfCYnDCTvlhuf29B6IFVUnzmFunDKmCcJUOuDwSemc8/Nbd64TN2 brePe2v9W2GmGBYadTwzJgFqSLIZ+duweL0gPkwxptkouuNLsKOe1+OvtFALCo4S7Kmw po9oaV9CbGA2AEIZBpDT0Joq1x+0FhAKhg3C7lQjfnYCz5HGYlED/xbwxmiHLHDYMrt1 wSgbylBg3hbf1HxMnyTiGnr6DtvgXHovNon7PjOrujZBMoFmPI9x2B9Hu4+/u3myxVml J8eQ== X-Gm-Message-State: AOJu0YxQ0NFY+s+CL4+RLcnvw2514wNNQXGxcM6ZF6ywIrtynZrGMwpO if6FdDGkpXqupEDltngRAuAVzhnmMMzI616X4X+WJ5BgsT6F3Fi+7esjH0/LnIQEmoI5vnUkxcj x X-Received: by 2002:a17:902:e551:b0:20b:4875:2c51 with SMTP id d9443c01a7336-20bfe024d5cmr107983235ad.27.1728141955681; Sat, 05 Oct 2024 08:25:55 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396948dsm14351765ad.225.2024.10.05.08.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25:55 -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 03/20] include/exec/memop: Move get_alignment_bits from tcg.h Date: Sat, 5 Oct 2024 08:25:34 -0700 Message-ID: <20241005152551.307923-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This function is specific to MemOp, not TCG in general. 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) == MO_BE; } +/** + * get_alignment_bits + * @memop: MemOp value + * + * Extract the alignment size from the memop. + */ +static inline unsigned get_alignment_bits(MemOp memop) +{ + unsigned a = memop & MO_AMASK; + + if (a == MO_UNALN) { + /* No alignment required. */ + a = 0; + } else if (a == MO_ALIGN) { + /* A natural alignment requirement. */ + a = memop & MO_SIZE; + } else { + /* A specific alignment requirement. */ + a = 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; } -/** - * get_alignment_bits - * @memop: MemOp value - * - * Extract the alignment size from the memop. - */ -static inline unsigned get_alignment_bits(MemOp memop) -{ - unsigned a = memop & MO_AMASK; - - if (a == MO_UNALN) { - /* No alignment required. */ - a = 0; - } else if (a == MO_ALIGN) { - /* A natural alignment requirement. */ - a = memop & MO_SIZE; - } else { - /* A specific alignment requirement. */ - a = a >> MO_ASHIFT; - } - return a; -} - typedef tcg_target_ulong TCGArg; /* Define type and accessor macros for TCG variables. From patchwork Sat Oct 5 15:25:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832971 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1255792wra; Sat, 5 Oct 2024 08:27:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWM+N0latAWNdMgxfBuh3CKI0U0gW27GZCR+z45EbCLS5FxP6WdPpdPfnq/YZtrNLZdwn11jQ==@linaro.org X-Google-Smtp-Source: AGHT+IG8lU119xRJSW57tXOJPQMGVjFQNrHJCvW6sDm6yMuSpLBx+ZejNffjUsvaoEWagbr5sN9l X-Received: by 2002:ac8:5d42:0:b0:458:4f4d:1ff0 with SMTP id d75a77b69052e-45d9bb2078fmr105826251cf.40.1728142039555; Sat, 05 Oct 2024 08:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142039; cv=none; d=google.com; s=arc-20240605; b=J+1+psSHdGG268IqWW0hHXAj2BGO6bgmuU176gyCSHpCj/hsh84sXqnu4zdyUxnbS1 FlOtlNwJKh2A+aRWtbHNuG79vdh0ObXY2C3JFte1b0SMiNKvety06P882GgaLD4LJOHH FjZ1Q/iOiR8aLi7V20u5NSL+uAfcPQD3EdXATONBzTI7OAW6XnDbG4O/NS5hDQxMSZWf 9AgDeZIjDjmsFHfmmVKy1Mrr6ueVVYqGmtH35GqfNGICs/lzRHSzuHaj53PwNdTj9xSF x1ANnVX5sMAGTyJ1HNynRnfM6wwLY3f4rWdIfJmfd07A71uliqyF2dSzjK78opdQnDJC xyOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DH35lHXcbsJC32qCjyMaGZFqdyczAIeo1misqQjkoMQ=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=fCnW/8ObJtJWMTsVzq909Chzgsd0NVEHCrCR+bTNIoR0NHKhTR/dr3CzKfFcuQrViI 8+HrdkdAHAp8wlYyVqA44idXmD+kGu4LkYD407pK4XIfN6uNxUgUfwnYLUpZunlgas6n X9en8vYZ0qzCtcfziag/qLrRYT4Qakz6LzzkceYNNCrihKX20vuvF3xLL8JFQf0bx+i5 1gmPDx9g1SErqsm4Jpn4roSj+9Cr9m245tCrqPXWTcbsjC60IwTtZBaWCMhblwUUQkLO fbm+IVJJq+uvQfquOxedqKvWeRdBSjykMeqj4hp1bg7H9TUM7k3K2ZPjlWD9hi3gxnXJ txqw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UCh0hlAX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74aca8dsi22386121cf.135.2024.10.05.08.27.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:27:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UCh0hlAX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fR-0001zV-7Y; Sat, 05 Oct 2024 11:26:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sx6fQ-0001yn-6N for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:00 -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 1sx6fO-0002L1-43 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:25:59 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20b1335e4e4so30912285ad.0 for ; Sat, 05 Oct 2024 08:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141957; x=1728746757; 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=DH35lHXcbsJC32qCjyMaGZFqdyczAIeo1misqQjkoMQ=; b=UCh0hlAXOunMMPt9F5S8w98xbM/zSc7abiacXVRbMO3Xd9b6pXPB/zDboGURyzAvin 5VCXFLOCRSvmhu1bC1MG7Y1bXofhTZUFRdSrIpbbME/O6wMRzqgsBKmc92rdbZpm0CBo cxk+Sf4LqN1ldAQPnp9r+G9jqsCfHiwYQTKrtJC3yNlPS9lmHX83ByjiwbfmBaEaLkKq rLQ9bpgzzcwj91ajRKJXbdmicQdOXsW8t+0DWgiy0d6BwRyisMIlqMebZnILD6UzjFj1 UAhcfUycLk8OL57GgPaTgAHL1OO4nqKPGf/ExRRI+v/hPBQVpmwiJhoRluIetmW1sWpJ Lfmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141957; x=1728746757; 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=DH35lHXcbsJC32qCjyMaGZFqdyczAIeo1misqQjkoMQ=; b=cDJLCNNgrKSzi86/0H+Zc9h1Jz1DSYIRh2Lz4TyMEwqX2lefc+158kWPLACj0dF4jA BkahnWeHg3g8mZPUuZIB60H6xiaxkozuGBo6Zs8IzC8H9BeRc4wiLxXrDPK3CUsEGYXt 35of90Ga7/v7xBAPSAGjBSfq4Qr5HpmsqxPGkn6LaMxSENTEhe+p5UjfTq897RoRj6m+ oIZFQm7NEZV+8TFF41NRfDjx7U2hM8FgcwYS8NJc3txNIFoeWklolWb2hoB4Q7j8/FF/ 0akhf/dWyDeRA68mUN/wV8rQbWGHPef6Y2nh78yZPH0gjoNkRtHXi0pGtVjejeAUrUxO b/tg== X-Gm-Message-State: AOJu0Yxr1QUHkJ88GSrDuRl/JtyQy1RyhK2Z7ecH36+WLMMmf2+qaZFX alO1J6U5FmcbaH3M8PYO75YsN+prlmSgNPD74Xac0FDeb7/SUHe5E33nIPkcq42gkhjwq8D5bA9 z X-Received: by 2002:a17:902:e94e:b0:20b:ce4e:b9e4 with SMTP id d9443c01a7336-20bfe044af6mr97224115ad.29.1728141956662; Sat, 05 Oct 2024 08:25:56 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396948dsm14351765ad.225.2024.10.05.08.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25: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 Subject: [PATCH 04/20] include/exec/memop: Rename get_alignment_bits Date: Sat, 5 Oct 2024 08:25:35 -0700 Message-ID: <20241005152551.307923-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Rename to use "memop_" prefix, like other functions that operate on MemOp. 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) } /** - * 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 = memop & MO_AMASK; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 58960969f4..b5bff220a3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1693,7 +1693,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); /* Handle CPU specific unaligned behaviour */ - a_bits = get_alignment_bits(l->memop); + a_bits = memop_alignment_bits(l->memop); if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } @@ -1781,7 +1781,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, { uintptr_t mmu_idx = get_mmuidx(oi); MemOp mop = get_memop(oi); - int a_bits = get_alignment_bits(mop); + int a_bits = 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 = get_alignment_bits(mop); + int a_bits = memop_alignment_bits(mop); void *ret; /* Enforce guest required alignment. */ @@ -1241,7 +1241,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, int size, uintptr_t retaddr) { MemOp mop = get_memop(oi); - int a_bits = get_alignment_bits(mop); + int a_bits = memop_alignment_bits(mop); void *ret; /* 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 = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(memop)); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(memop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, memop_size(memop) - 1); ret = tcg_temp_new_i64(); @@ -326,7 +326,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(single_mop)); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(single_mop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); ret = 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 |= 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) static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st) { - unsigned a_bits = get_alignment_bits(op); + unsigned a_bits = memop_alignment_bits(op); check_max_alignment(a_bits); @@ -559,7 +559,7 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr, TCGv_i64 ext_addr = NULL; TCGOpcode opc; - 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); /* In serial mode, reduce atomicity. */ @@ -676,7 +676,7 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr, TCGv_i64 ext_addr = NULL; TCGOpcode opc; - 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); /* 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 = get_alignment_bits(opc); + MemOp align = memop_alignment_bits(opc); MemOp size = opc & MO_SIZE; MemOp half = size ? size - 1 : 0; MemOp atom = 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, MemOp opc, TCGReg datalo, tcg_debug_assert((datalo & 1) == 0); tcg_debug_assert(datahi == datalo + 1); /* LDRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >= MO_64) { + if (memop_alignment_bits(opc) >= 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, MemOp opc, TCGReg datalo, tcg_debug_assert((datalo & 1) == 0); tcg_debug_assert(datahi == datalo + 1); /* STRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >= MO_64) { + if (memop_alignment_bits(opc) >= 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 != get_alignment_bits(opc)) { + if (s_bits != 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); From patchwork Sat Oct 5 15:25:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832976 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256162wra; Sat, 5 Oct 2024 08:28:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfqvsYxJoI4lIYBO04h+wKLAeVTe4miPr7TGfQzNlqyAxk0xCwEg35KttHCb/IkrSPngT/nQ==@linaro.org X-Google-Smtp-Source: AGHT+IEb2BBBPMDo4CjMWO1tA+g8aDMkI9FblgLP8ruwzWP4xCsXH7eJBT23fzvAI3LBgJV93Kfy X-Received: by 2002:a05:620a:29d2:b0:7a9:c2d5:a9f0 with SMTP id af79cd13be357-7ae6f42dfadmr912352685a.6.1728142119955; Sat, 05 Oct 2024 08:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142119; cv=none; d=google.com; s=arc-20240605; b=FgCkRacJuwb71ZpBHRc6KeQeXx/mL4gpPrOOVapmHjDqnVXAM2zUG9rwCA4OVvtzA+ UUsnQ3/0Gj0FGP4KC6zBQoJbCuh2X35OJ5wSSBK4JxHEbO+zBI+HnHWbUc6YnpSFOa5Q z6yJrCsSLokA/DUwYodvOnK4xKL3HP6qwX8t2OJ6DawCEsGPS2M1rb1JQZiYEKeu8GVD J0XUZBSpryJi7/cl+Pspg8UFFMybaJT+K47vTwoyJEDuIGcOIeML7xt3Qr/n3/mBt/hB W2ULSryUkuZse3h/c0c9zk87/98pAnRkyxpMerCnOOrcxVZ+OwyLGrYAFKrnVeMR7UHK UWRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rMIQXnxelIQ86qxYbOA8sg/WFq9fqYpMUetqZ1DDKfA=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=FWoHeYfgV2GpAPrn/G2BuFpPK1PhIFnIHcTBQOX+g4L6cUyWNbqSo/w4Zak6mlrai2 oUxUN/9V4s54Tt9VedRsFwuLqqvjDX1ksTLVVgRvJvGNk/NomhYIhfhm85C6FVKwdT3Z xA0IU2nU+Yfb+dinGAQJUuFfRJnpsyzCR3M9U9W87G2K+DXKqbYDskhuVAiAR0bXRc5b besnumz5M4eh3EZS1340/Sz7WvJGDipxSPClFiM0NXN1Fuawf3BF4U4ca3cWFBOY5m4x YE9FmdHdbsxNyEfkDZQydLGT0LJhp5RsPjLlpYv8NGWzT/du4vkIco8MXM/6mrryHaiQ +U0Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LL9FfGzl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae757797ecsi208375785a.749.2024.10.05.08.28.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:28:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LL9FfGzl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fT-00021Q-LS; Sat, 05 Oct 2024 11:26: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 1sx6fQ-0001yw-Dl for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:00 -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 1sx6fO-0002Lh-Ux for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:00 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20b7a4336easo22654155ad.3 for ; Sat, 05 Oct 2024 08:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141957; x=1728746757; 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=rMIQXnxelIQ86qxYbOA8sg/WFq9fqYpMUetqZ1DDKfA=; b=LL9FfGzlAJTA4MPYk9UKoMqE1mSDqEY9PsTFfA1nY07kgq15e4KJ/NswBtEztVDMEP 7y5kUv2wNHH5UcC0C/F+kSHZzZZHkec3zGwC54y3PN2Yzp2s2LY+vvqlAqzpHK/1vc6Q oh/qtdE7VHV2pLAkpJoVBxqtQMpk+tfv9Y6QODtvPA0R/EubhGgh7TQmPhGYjXO8740G 4p5s6XrnlXujaLMvdl+tju4RYNVJ1zCATkAOrV2IC9vlvieN0U8izUebCTTWCRCL+Z67 FrFtNVr6cE3qpJZClhh4Ydbb0/8zni54IZC2LRMLei4gplWnPRNHJxVEq79zQMqKYx6i 9iiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141957; x=1728746757; 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=rMIQXnxelIQ86qxYbOA8sg/WFq9fqYpMUetqZ1DDKfA=; b=nyLj+dUqodUaGX5RRJU9GskkkTE/MEteUhkVNq+McUyz+pD3vEaS+MtYGp1VTsTfTc rxRIGvllC2WOuhtENAI1kY/jay0EF94yStgGw92uJWaAPxyAssq7dS+pfu5wIJiN9j7c GrtXv4um8rnSbMVWOg0qAmpvp5Vp5ASVggiBRWXDsxMazaldgMjWZxKAFN4bjTaak4xf DO5e0OzhXOMVY0BErzCY/PAcn1zvLEsBdj+P7u6oFpYXtpyHSoRY8irAbkEdpQFY3eF7 quNU+kwKuqKITwp4lMXhUCKZCUWbisjoDJAJxztXyw0raMTuW9eQdrGS9Yee5T0g53vK yJgQ== X-Gm-Message-State: AOJu0Yx5ONKdF+I2ODrzH7hXFFMZHXWPHHJukPjIQDp8PFSy5z/286Ul w3xW8hOQRJiioy2rro541V7Sb0JgxEbjH2NZk/aA7mji7AyxcbkpwkIG0r/hj/Z7RHPxqTh3m3d k X-Received: by 2002:a17:902:ec81:b0:20b:90ab:67de with SMTP id d9443c01a7336-20bfde594f1mr78046015ad.8.1728141957612; Sat, 05 Oct 2024 08:25: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-20c1396948dsm14351765ad.225.2024.10.05.08.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25: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 Subject: [PATCH 05/20] include/exec/memop: Introduce memop_atomicity_bits Date: Sat, 5 Oct 2024 08:25:36 -0700 Message-ID: <20241005152551.307923-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Split out of mmu_lookup. Signed-off-by: Richard Henderson --- include/exec/memop.h | 24 ++++++++++++++++++++++++ accel/tcg/cputlb.c | 16 ++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index f53bf618c6..b699bf7688 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -193,4 +193,28 @@ static inline unsigned memop_alignment_bits(MemOp memop) return a; } +/* + * memop_atomicity_bits: + * @memop: MemOp value + * + * Extract the atomicity size from the memop. + */ +static inline unsigned memop_atomicity_bits(MemOp memop) +{ + unsigned size = memop & MO_SIZE; + + switch (memop & MO_ATOM_MASK) { + case MO_ATOM_NONE: + size = MO_8; + break; + case MO_ATOM_IFALIGN_PAIR: + case MO_ATOM_WITHIN16_PAIR: + size = size ? size - 1 : 0; + break; + default: + break; + } + return size; +} + #endif diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b5bff220a3..f5fca5a118 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1751,20 +1751,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Device memory type require alignment. */ if (unlikely(flags & TLB_CHECK_ALIGNED)) { - MemOp size = l->memop & MO_SIZE; - - switch (l->memop & MO_ATOM_MASK) { - case MO_ATOM_NONE: - size = MO_8; - break; - case MO_ATOM_IFALIGN_PAIR: - case MO_ATOM_WITHIN16_PAIR: - size = size ? size - 1 : 0; - break; - default: - break; - } - if (addr & ((1 << size) - 1)) { + a_bits = memop_atomicity_bits(l->memop); + if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } } From patchwork Sat Oct 5 15:25:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832975 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256147wra; Sat, 5 Oct 2024 08:28:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZluEZhqgdaItTWP/kQGWDcZ5nzT5eAtENWZTTHLCwnNCRSMmeCR3yvPhWJUGczejzu/7odA==@linaro.org X-Google-Smtp-Source: AGHT+IGX8/tJs2t99c+02u89O47BQQ5xhUzsR6DYMm8iBLLD1y0y1gg1FXwjkIrJZrr2pkyktK3S X-Received: by 2002:a05:620a:248d:b0:7ab:36c8:6607 with SMTP id af79cd13be357-7ae6f49c99dmr1085155985a.54.1728142116771; Sat, 05 Oct 2024 08:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142116; cv=none; d=google.com; s=arc-20240605; b=dbpexDrnk9J3RtKan2oCYGn00pXOB30KeRDtn0fNjs29RpNzO9oCqlcB7FWOhY6bCE GMNggJu4WCD+qieehqg7vCEPyD1KFOWEhb/LMFYNe2SYUrpgARuTM7gasW+WZcKLdZNP PIjI/uZYOlplB/hMD6rvVNvRr0UJDGiAsVxZe2H1EzZmEYMPNT3hYVWH9Q/ipqj0QrZ/ gePUOKYKyPIyV+XZbZsJNfpi9QgpcQxrqF0eIdjjEeU6T+dx07SGJSZSRpQnbAzLxCHB KrKA7tSNYMqmsehpeaecasgbwjcyH9kLpt+tQFVazHpPqg5gJ+7Rw2zIcB4iO1mL8z1S 8qIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1f/qgYd1hp1mLwoixEUX+NfB0hBePURRnKwRiQEkN3A=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=JKA4mvIHMJIBQ+suMbg8k77Q1TnxzvMei/lo++ApPSrnpkkDiz5L1vhAQ5A3NHy0G7 6xFszaNp21eZrmHzPTnXnlnJUk0YL/TK51L51JfVcokJ3SvsZMrNWt3ha6f557Ao3hpT doXG5V4VSpRlMBc0EMzmtcpYRhjnA6cX5sXQ05r4TLKG6sXKDEV0KsuTaKbWhVT2Tjl8 M/vQwDNExwiMlTqr/OjHoE/DahwHBeKbbZhhNewvRqgiLTS0RHglv5fNpBVaChSN600G dlOx5uNkLFrhTGvZG/VDqUN/b/Peb0FtDfV9D9XDMqB1BZs6SFjlum1AgJkhgOhMBvnz o56A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d2PHUhhP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75779466si200279185a.711.2024.10.05.08.28.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:28:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d2PHUhhP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fU-00022J-P3; Sat, 05 Oct 2024 11:26: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 1sx6fS-00020f-78 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:02 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sx6fQ-0002M3-2G for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:01 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-20bcae5e482so27832665ad.0 for ; Sat, 05 Oct 2024 08:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141959; x=1728746759; 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=1f/qgYd1hp1mLwoixEUX+NfB0hBePURRnKwRiQEkN3A=; b=d2PHUhhPMYKZrc9iqqxsO05jV81cIUVxhne52fvUSRYclmZe6qqDUQEMKMmaiCdv10 UjaDFqerVNSt/WH+ouAXnD7Fo5EuMVqLPHYTaeth7lXfeujc4pS0fvlMVzHsOea07DOs q0aoJLEUXkDutm1FX1U7vZrYGb2qa7C4KfI0EV1bmwsFDz4wixlwe4so9E2nzcjpx1pB leXdwaH1G+nRVhzpMATMmeaV2BxPg193AOHZ9IEM8ZZ5sBTM9ggx6vlX7dNfD1ZWcQn0 V6ONqISrwT1Nsk4xbiLQ8gyzP+RZed3sWbzl08P0zJVIGRDCzlrzYe+ADaRIt5FyB0hy vmOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141959; x=1728746759; 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=1f/qgYd1hp1mLwoixEUX+NfB0hBePURRnKwRiQEkN3A=; b=d+zYtXIBfeiBTpTujjRxhhh2cFam5C1UjEOtxJHTY7/2THFDieF2Qalvea7TpK98dR M/IW8rnQCwzLCDZ7ghDHvEOtU+cXVqsrrinttYTi+DUqZACv+TbcRWuQwfI2JD96BY+G +h64cPfhNXjGr1ur28Jh1tRuMumL6J8HTwBnGptJp8fFU7F6DFO7wgASqmfmoHVQGOry b3HaGY5qQzlgTDPgUXatnx3pcbUeFNbViMWcaIQlcbF3Nk9Onbnq2M3rM2ip7JHCZioz ZlXbWAAwoPrsniDpw0oIfxfs74MX0KFFo7uLhRpISy2VLGsnkxHhAW5KVrUTI3UOsO/P 79kA== X-Gm-Message-State: AOJu0YyVWL+x9rUnCx94vRJ00FRzer2XZ5MPZevmFqZjVZrrFwtKRlY8 AMWOph+5ghhe9j6fSe6Tnih1B3f7hcp/X2pQEFsAFCRZF+egi1LuMwaAswJYg0qDsJ2KfUmSzGR R X-Received: by 2002:a17:903:41d1:b0:20b:80e6:bcdf with SMTP id d9443c01a7336-20bfe17e008mr91058345ad.23.1728141958687; Sat, 05 Oct 2024 08:25: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-20c1396948dsm14351765ad.225.2024.10.05.08.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25: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 Subject: [PATCH 06/20] hw/core/tcg-cpu-ops: Introduce tlb_fill_align hook Date: Sat, 5 Oct 2024 08:25:37 -0700 Message-ID: <20241005152551.307923-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add the hook to struct TCGCPUOps. Add a default implementation that recognizes alignment faults before page faults. Populate all TCGCPUOps structures with the default implementation. Signed-off-by: Richard Henderson --- include/hw/core/tcg-cpu-ops.h | 25 +++++++++++++++++++++++++ accel/tcg/cputlb.c | 19 +++++++++++++++++++ target/alpha/cpu.c | 1 + target/arm/cpu.c | 1 + target/arm/tcg/cpu-v7m.c | 1 + target/avr/cpu.c | 1 + target/hppa/cpu.c | 1 + target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 1 + target/m68k/cpu.c | 1 + target/microblaze/cpu.c | 1 + target/mips/cpu.c | 1 + target/openrisc/cpu.c | 1 + target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 1 + target/rx/cpu.c | 1 + target/s390x/cpu.c | 1 + target/sh4/cpu.c | 1 + target/sparc/cpu.c | 1 + target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 1 + 21 files changed, 63 insertions(+) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 34318cf0e6..49420bc93d 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" @@ -131,6 +132,21 @@ struct TCGCPUOps { * same function signature. */ bool (*cpu_exec_halt)(CPUState *cpu); + + /** + * @tlb_fill_align: Handle a softmmu tlb miss, and alignment fault + * + * If the access is valid, call tlb_set_page and return true; + * if the access is invalid and probe is true, return false; + * otherwise raise an exception and do not return. + * + * The alignment check is deferred to this hook, so that the + * target can choose to recognize either before or after the + * permission check. + */ + bool (*tlb_fill_align)(CPUState *cpu, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); /** * @tlb_fill: Handle a softmmu tlb miss * @@ -234,6 +250,15 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, */ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); +/* + * tlb_fill_align_first: + * + * Prioritize alignment faults over page faults. + */ +bool tlb_fill_align_first(CPUState *cpu, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); + #endif #endif /* TCG_CPU_OPS_H */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index f5fca5a118..4bc34c8a37 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1565,6 +1565,25 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx, } #endif + +/* + * Generic implementation of tlb_fill_align which recognizes + * alignment faults before page faults. + */ +bool tlb_fill_align_first(CPUState *cpu, vaddr addr, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + unsigned a_bits = memop_alignment_bits(mop); + + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); + } + + return cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, access_type, + mmu_idx, probe, retaddr); +} + /* * Probe for a load/store operation. * Return the host address and into @flags. diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 9db1dffc03..2eb5afd34a 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -217,6 +217,7 @@ static const TCGCPUOps alpha_tcg_ops = { .record_sigsegv = alpha_cpu_record_sigsegv, .record_sigbus = alpha_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = alpha_cpu_tlb_fill, .cpu_exec_interrupt = alpha_cpu_exec_interrupt, .cpu_exec_halt = alpha_cpu_has_work, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 19191c2391..08731ed4e0 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2663,6 +2663,7 @@ static const TCGCPUOps arm_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 5496f14dc1..8874fe0e11 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -242,6 +242,7 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 3132842d56..6ac4434f1d 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -211,6 +211,7 @@ static const TCGCPUOps avr_tcg_ops = { .restore_state_to_opc = avr_restore_state_to_opc, .cpu_exec_interrupt = avr_cpu_exec_interrupt, .cpu_exec_halt = avr_cpu_has_work, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = avr_cpu_tlb_fill, .do_interrupt = avr_cpu_do_interrupt, }; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 7cf2e2f266..3b6c325e09 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,6 +226,7 @@ static const TCGCPUOps hppa_tcg_ops = { .restore_state_to_opc = hppa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = hppa_cpu_tlb_fill, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, .cpu_exec_halt = hppa_cpu_has_work, diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index cca19cd40e..83cfb86346 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -117,6 +117,7 @@ static const TCGCPUOps x86_tcg_ops = { .record_sigsegv = x86_cpu_record_sigsegv, .record_sigbus = x86_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = x86_cpu_tlb_fill, .do_interrupt = x86_cpu_do_interrupt, .cpu_exec_halt = x86_cpu_exec_halt, diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 7212fb5f8f..ae8856d988 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -755,6 +755,7 @@ static const TCGCPUOps loongarch_tcg_ops = { .restore_state_to_opc = loongarch_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = loongarch_cpu_tlb_fill, .cpu_exec_interrupt = loongarch_cpu_exec_interrupt, .cpu_exec_halt = loongarch_cpu_has_work, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 1d49f4cb23..295ebd941b 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -534,6 +534,7 @@ static const TCGCPUOps m68k_tcg_ops = { .restore_state_to_opc = m68k_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = m68k_cpu_tlb_fill, .cpu_exec_interrupt = m68k_cpu_exec_interrupt, .cpu_exec_halt = m68k_cpu_has_work, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 135947ee80..6e63600631 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -411,6 +411,7 @@ static const TCGCPUOps mb_tcg_ops = { .restore_state_to_opc = mb_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = mb_cpu_tlb_fill, .cpu_exec_interrupt = mb_cpu_exec_interrupt, .cpu_exec_halt = mb_cpu_has_work, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 89655b1900..5a36b22256 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -553,6 +553,7 @@ static const TCGCPUOps mips_tcg_ops = { .restore_state_to_opc = mips_restore_state_to_opc, #if !defined(CONFIG_USER_ONLY) + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = mips_cpu_tlb_fill, .cpu_exec_interrupt = mips_cpu_exec_interrupt, .cpu_exec_halt = mips_cpu_has_work, diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 6ec54ad7a6..9223228758 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -231,6 +231,7 @@ static const TCGCPUOps openrisc_tcg_ops = { .restore_state_to_opc = openrisc_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = openrisc_cpu_tlb_fill, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, .cpu_exec_halt = openrisc_cpu_has_work, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9..42a38ec155 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7482,6 +7482,7 @@ static const TCGCPUOps ppc_tcg_ops = { #ifdef CONFIG_USER_ONLY .record_sigsegv = ppc_cpu_record_sigsegv, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = ppc_cpu_tlb_fill, .cpu_exec_interrupt = ppc_cpu_exec_interrupt, .cpu_exec_halt = ppc_cpu_has_work, diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index dea8ab7a43..42c4ea13af 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -137,6 +137,7 @@ static const TCGCPUOps riscv_tcg_ops = { .restore_state_to_opc = riscv_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = riscv_cpu_tlb_fill, .cpu_exec_interrupt = riscv_cpu_exec_interrupt, .cpu_exec_halt = riscv_cpu_has_work, diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 36d2a6f189..27fc372ca4 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -188,6 +188,7 @@ static const TCGCPUOps rx_tcg_ops = { .initialize = rx_translate_init, .synchronize_from_tb = rx_cpu_synchronize_from_tb, .restore_state_to_opc = rx_restore_state_to_opc, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = rx_cpu_tlb_fill, #ifndef CONFIG_USER_ONLY diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 4e41a3dff5..8120ddeb5b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -363,6 +363,7 @@ static const TCGCPUOps s390_tcg_ops = { .record_sigsegv = s390_cpu_record_sigsegv, .record_sigbus = s390_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = s390_cpu_tlb_fill, .cpu_exec_interrupt = s390_cpu_exec_interrupt, .cpu_exec_halt = s390_cpu_has_work, diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 8f07261dcf..b03f6dfad8 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -252,6 +252,7 @@ static const TCGCPUOps superh_tcg_ops = { .restore_state_to_opc = superh_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = superh_cpu_tlb_fill, .cpu_exec_interrupt = superh_cpu_exec_interrupt, .cpu_exec_halt = superh_cpu_has_work, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 54cb269e0a..da1bfad5f0 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -924,6 +924,7 @@ static const TCGCPUOps sparc_tcg_ops = { .restore_state_to_opc = sparc_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = sparc_cpu_tlb_fill, .cpu_exec_interrupt = sparc_cpu_exec_interrupt, .cpu_exec_halt = sparc_cpu_has_work, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 1a26171590..9d8f8f13d2 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -173,6 +173,7 @@ static const TCGCPUOps tricore_tcg_ops = { .initialize = tricore_tcg_init, .synchronize_from_tb = tricore_cpu_synchronize_from_tb, .restore_state_to_opc = tricore_restore_state_to_opc, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = tricore_cpu_tlb_fill, .cpu_exec_interrupt = tricore_cpu_exec_interrupt, .cpu_exec_halt = tricore_cpu_has_work, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index a08c7a0b1f..b0f84403f0 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -232,6 +232,7 @@ static const TCGCPUOps xtensa_tcg_ops = { .restore_state_to_opc = xtensa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = xtensa_cpu_tlb_fill, .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, .cpu_exec_halt = xtensa_cpu_has_work, From patchwork Sat Oct 5 15:25:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832984 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256625wra; Sat, 5 Oct 2024 08:30:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWIiTuUR91gnvJIdz10Cts/ZVSPl2JLZN3jiqMb005yfOOLZtr69q/xbLNMZJ51VTrHzjNViw==@linaro.org X-Google-Smtp-Source: AGHT+IF8Er3GmI61gRycXtpwpdMERYhxxrUIRCWNAk4BpJp0NiMJq4owC5RNpz6Pxtjdd+jBRwsJ X-Received: by 2002:a05:620a:2410:b0:7ac:bfb6:8202 with SMTP id af79cd13be357-7ae6f44dc85mr901939185a.38.1728142211579; Sat, 05 Oct 2024 08:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142211; cv=none; d=google.com; s=arc-20240605; b=R0KkvoUtX3KrcrnLwGlHOg45eVb9Rw5fVqCbVprvK8TznAz9xpamt08WYyIrws7fEV 1p+p/5VLM0ODdQ87PS3cXmtiFxKP1p0PDyWbNRhHYy7JyrRa/JLGIkGQKgUcY1XlBsbL W4M3/9UKmgL2Li55BZG/wTcUpGkDwe+sI47adnqT5BcrUvp1N6H4VGw7JjVHaCuK6Elt qNuLAGwDTIIGV8LQ0fVXAKP2NOZBt//Xp/rr87PiAiLQ0trmUZD9HrZom6hXOZU3+KgD 3pJU3pVbawp2PcXz6oe+Hf6rLBEeat0t2H8tA8ic7dMQ7ZaeKeFL+lI0ve0mB8cn6+iT otVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aSpIks7wgvzrdGiSzq/HYW4dr1jFM7gjMRozlRGemJM=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=GhMSiXJQjOBHWIcMtSXFAAW3ndHkHOKvrmRq0ju7vZTJ9Xvgk436HpMl6LS20gIRTU o/x69eRr3CMw0nQio0fjdyb9qvc3C60m6t8ZacrtT90aoy8ynLK1p/465tRZFtALKVIr Q+Vmw0168dbNG5pfhqEf7AOR1eSg33IJ9K9RwAG1NJYRIa8opZwzveSydM1k+rHmD9T8 Fta2fCnLQ8m4WwlfyiiP/YntEyHC5jX9DfngqqbLccQQAkYsJhVel2ODIZRpds5qZBw9 FKSzCZsfzirtjxj0fq4CMub4zG7CGfjH17cRyUrDMt6+7siYt1fWyVhxqNJj/TcddLiX Bu3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P8fmzQye; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae7561683dsi210385785a.99.2024.10.05.08.30.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P8fmzQye; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fY-00024n-Hg; Sat, 05 Oct 2024 11:26: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 1sx6fT-00021L-BC for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:03 -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 1sx6fR-0002MQ-52 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:03 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-20aff65aa37so26630865ad.1 for ; Sat, 05 Oct 2024 08:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141960; x=1728746760; 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=aSpIks7wgvzrdGiSzq/HYW4dr1jFM7gjMRozlRGemJM=; b=P8fmzQyeMDcLVoycbC6o8Mqpq1LXwy/30TTRbNRe3YLaFtctGnC90F9ThWA6EYrKeG iM3BzR6zUTGywG2hwOugYYH924z+i09BjbPY+ktP5taPf0P9yRnepwpGnY/Aa5K98Q38 oGxiH4pDbMx0qnyXb/LCKzW7r0RWoac642u6AcAUr8o1KfXGYmcnmHpANH4K0Xpbdvkc NBjgFdhK4MypahJcgyAKAy7pKIuNQf7A9gLJZoCdvcSUETYRwD3wADybHljtjETiOQDL Z8m/I6j8U5CMdefK2tX4OSH+beS5zjvLGZN4amBzO9Mq5Lv59Dx9Sg1dBi21p8NmNlcr VKtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141960; x=1728746760; 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=aSpIks7wgvzrdGiSzq/HYW4dr1jFM7gjMRozlRGemJM=; b=uZJij62gIje3Uc5WcvN2U6acWEhFhzzuKoOw2Nkk32akexcOyFjcPxBVJkxB2rlMUO D7Ortfcl6JVu8Kfl5gBPkApap97Tzuf/jkYzMa8pkfJWaw2fdw7pREUCd+K1dvuDfxfR nI0Li02BTwiMkTMGLDw5O520UEiJcQLflxp3OzrfTDB9aPCzKnL98ZpkST7BMeM8cUqt 2yPuGyQhAU78UYzrsG7DJvJTg+Iw6O2RrtFIBQlRbibOgUATv+6MD/CRsdjBpFbR+VMw RJt5otRkUz7kRZbnanEh6zBN4EUvQFToeK2LGGSv7BQHE3D0HthfYIIChjhLvGJMbBvZ eOBQ== X-Gm-Message-State: AOJu0YwIWuO0F/iBb4mpyuKMonsb2c2+APB0zzPypwTW72aKxuXhXr5c 3nA8q6EPJXCbrRjGp1ntD7nPOHsJw32DpzSX7/JN/6UOzGWkCzvRYdiErMGGgzjIHHnj5O7X8x8 4 X-Received: by 2002:a17:902:ec89:b0:20b:982e:73d6 with SMTP id d9443c01a7336-20bff043851mr82009865ad.49.1728141959618; Sat, 05 Oct 2024 08:25: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-20c1396948dsm14351765ad.225.2024.10.05.08.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:25: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 07/20] accel/tcg: Use the tlb_fill_align hook Date: Sat, 5 Oct 2024 08:25:38 -0700 Message-ID: <20241005152551.307923-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- accel/tcg/cputlb.c | 89 +++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 4bc34c8a37..0e6ae65a39 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1616,14 +1616,14 @@ typedef struct MMULookupLocals { * tlb_fill 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 memop, int mmu_idx, MMUAccessType access_type, uintptr_t ra) { vaddr addr = data->addr; uintptr_t index = tlb_index(cpu, mmu_idx, addr); CPUTLBEntry *entry = tlb_entry(cpu, mmu_idx, addr); uint64_t tlb_addr = tlb_read_idx(entry, access_type); - bool maybe_resized = false; + bool did_tlb_fill = false; CPUTLBEntryFull *full; int flags; @@ -1631,17 +1631,26 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { - bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, data->size, - access_type, mmu_idx, - false, ra); + bool ok = cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, memop, + data->size, access_type, + mmu_idx, false, ra); assert(ok); - maybe_resized = true; + did_tlb_fill = true; index = tlb_index(cpu, mmu_idx, addr); entry = tlb_entry(cpu, mmu_idx, addr); } tlb_addr = tlb_read_idx(entry, access_type) & ~TLB_INVALID_MASK; } + if (!did_tlb_fill) { + /* We didn't use tlb_fill_align, so alignment not yet checked. */ + unsigned a_bits = memop_alignment_bits(memop); + + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_unaligned_access(cpu, addr, access_type, mmu_idx, ra); + } + } + full = &cpu->neg.tlb.d[mmu_idx].fulltlb[index]; flags = tlb_addr & (TLB_FLAGS_MASK & ~TLB_FORCE_SLOW); flags |= full->slow_flags[access_type]; @@ -1651,7 +1660,7 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, /* Compute haddr speculatively; depending on flags it might be invalid. */ data->haddr = (void *)((uintptr_t)addr + entry->addend); - return maybe_resized; + return did_tlb_fill; } /** @@ -1702,7 +1711,6 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULookupPageData *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; @@ -1711,12 +1719,6 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); - /* Handle CPU specific unaligned behaviour */ - a_bits = 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 = addr; l->page[0].size = memop_size(l->memop); l->page[1].addr = (addr + l->page[0].size - 1) & TARGET_PAGE_MASK; @@ -1724,7 +1726,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, crosspage = (addr ^ l->page[1].addr) & TARGET_PAGE_MASK; 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); flags = l->page[0].flags; if (unlikely(flags & (TLB_WATCHPOINT | TLB_NOTDIRTY))) { @@ -1743,8 +1745,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Lookup both pages, recognizing exceptions from either. If the * second lookup potentially resized, refresh first CPUTLBEntryFull. */ - 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 = tlb_index(cpu, l->mmu_idx, addr); l->page[0].full = &cpu->neg.tlb.d[l->mmu_idx].fulltlb[index]; } @@ -1770,7 +1772,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Device memory type require alignment. */ if (unlikely(flags & TLB_CHECK_ALIGNED)) { - a_bits = memop_atomicity_bits(l->memop); + unsigned a_bits = memop_atomicity_bits(l->memop); if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } @@ -1788,34 +1790,18 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, { uintptr_t mmu_idx = get_mmuidx(oi); MemOp mop = get_memop(oi); - int a_bits = memop_alignment_bits(mop); uintptr_t index; CPUTLBEntry *tlbe; vaddr tlb_addr; void *hostaddr; CPUTLBEntryFull *full; + bool did_tlb_fill = false; tcg_debug_assert(mmu_idx < NB_MMU_MODES); /* Adjust the given return address. */ retaddr -= GETPC_ADJ; - /* 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 = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); @@ -1824,10 +1810,11 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { - bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - MMU_DATA_STORE, mmu_idx, - false, retaddr); + bool ok = cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, mop, size, + MMU_DATA_STORE, mmu_idx, + false, retaddr); assert(ok); + did_tlb_fill = true; index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); } @@ -1841,8 +1828,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read == -1)) { - cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, MMU_DATA_LOAD, - mmu_idx, false, retaddr); + cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, mop, size, MMU_DATA_LOAD, + mmu_idx, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for @@ -1850,6 +1837,28 @@ 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) { + int a_bits = memop_alignment_bits(mop); + 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; + } + /* Collect tlb flags for read. */ tlb_addr |= tlbe->addr_read; From patchwork Sat Oct 5 15:25:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832988 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1257045wra; Sat, 5 Oct 2024 08:31:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxrcsNS3VKBwFgqNz0tPK5tbSb7fPzSvVTVTn4RrKjqsvZSlmtxJ+iESEHijXRMoodOeCRtA==@linaro.org X-Google-Smtp-Source: AGHT+IEqQ006RW387zJbFXEjKepNvUge/tN4S/Z+23LPEjRm2HoezjAdgzVJZj7rOfwyuLPl74Ej X-Received: by 2002:a05:6122:1822:b0:509:197b:3e2 with SMTP id 71dfb90a1353d-50c85594bbemr5030736e0c.11.1728142275990; Sat, 05 Oct 2024 08:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142275; cv=none; d=google.com; s=arc-20240605; b=hiUt9jF606N/XOp7gX1hqzN5D6OfHlNtJyp3iCedupIz2EVHhta+Y4Zv37cE9+5+gk zWN9wE6Iz0CmoJR99b1dZ6qs9XBpslC7A5TfReU8US044fwbu5YS9oY2XQDNLySAvKlg mIMzYyHwYKgrIs7iocAcywxvmSmaJbXCcuEJGViYVveLJt53UppIa1LoIDWhXFnl68+w 1JBMAsWvI0Yp1FloFp7PDKSr17ZN/7dZTRcZvuBj0/B4mqot220lyifgvPUXhZCJmYUo 71ZlZFdCUHs/GzGjH2DuaIYoDKRnrfFSPfps1H1tkQ77hTzaTspg/50+Fv+MDx3BsMSP oslg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MP+WvwE/XecW9wPOVCpjk+gA5jxWiH/v3HQ4ejXK7hQ=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=Y+ju+9KFX0th2aQkzFzSsDJNHZdkMiD9uGVmKC3yZHViFhydApqkQjZgCBswkBOWW6 PS+L7h2xZMQO3Z/VMene8TqX860Zh18q2/yxB1PcR3tcG5Xk03umLSAr9b5g5XIj5vZm 7zJT5216SBWYXMzk5IoSmHCYhZtsRxc3JUg0j2oFR5oTdIIZ+lQ6NlrsiHiHWV75PBfs 7kjvT1lKzbc4rOwTYzepoh55e6rsjGWFjLJXBH5IEt+CPYbiqporQ+8s+z6Fni15oDcs urMNlEQ2aW4CwtcrVgQtgwBH/I/SYf0mwcBoGTJRT7yqZf6ZbtOK90/3ulptVlwof8OC lYYA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PD9Inbel; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-50c9ae9a7cesi337544e0c.200.2024.10.05.08.31.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:31:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PD9Inbel; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fX-00024d-HD; Sat, 05 Oct 2024 11:26:07 -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 1sx6fT-00021j-PC for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:03 -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 1sx6fS-0002Mm-3D for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:03 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-20b90984971so32650785ad.3 for ; Sat, 05 Oct 2024 08:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141960; x=1728746760; 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=MP+WvwE/XecW9wPOVCpjk+gA5jxWiH/v3HQ4ejXK7hQ=; b=PD9InbelSTBbSyJQhO2yBhjfv6quspqR+hcKBK8xNJQh7SiQ5x16zJul91E/KMn9cE apbtsmFnpLKw+Zqk5SH3KnM/hQ5ZjCC4g/kG0TmnPrM1Pz+yJZ4bVfI3Nvuk/qyO8vfw LbWJ5JIZlCGbGadT0U+n2G932knz+XmtjrxxPrkGrlGZlwbV/oprBYlljocBZ72nxjbt asqgeWZQAsewI4FVTIIZ6F8ZGgQlw82xqN3yuQ/u2IZLV0oJIso7CdsXUnjIUL4WX+RQ gYikTvGLG/FiXCwhPQGnQIWifKFHplP8fQw6OXJDoL2dyUuCoGnot+uLmk5d7n2xz1+g umJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141960; x=1728746760; 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=MP+WvwE/XecW9wPOVCpjk+gA5jxWiH/v3HQ4ejXK7hQ=; b=jx8+nV4E59yswRl++f81Niahqc/nLKnexx83Kx262BNAyHRSs3kvpWKie0x+RmFgkO h7eVxlkebUDrqLSey2TDecSnJeuVuOQHbIxAdEkIDcLdvr+LWB2dgk3L6M66EQn8kmSe TmCtuSsFg1/d+vgnk6NGbHmwbysx4L4qby24r+LZzqYlLA/00O7okgfz+fgJYRx2iY+E xwuD7lEI3eSA8r4yKPImd92pQMHJuzb7dRyrLqNXHEcHP/WWVJz6LpYl61sjMZ0PQ9Qt sKP2AMArFrKarTOa4DXwGKYG8BjKsxGh5OC9kQnlswHTqEpr4LIKAX8NbQwnpCyT1xsu hWlg== X-Gm-Message-State: AOJu0YyG1Z1MaqttcY9VoTT1+LujbUuCVqwWEeDRGzq/ncufCeboB3cT FUZEZZt+6GLcDDtwxsldHoLYakD/SDIADvN2LdPwtuOPfSer4YarX9JRAApwpIJwnFr0kUhnfJ8 U X-Received: by 2002:a17:902:db02:b0:20b:ba72:37c with SMTP id d9443c01a7336-20bfea542c6mr100209775ad.48.1728141960541; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26:00 -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 08/20] target/hppa: Add MemOp argument to hppa_get_physical_address Date: Sat, 5 Oct 2024 08:25:39 -0700 Message-ID: <20241005152551.307923-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Just add the argument, unused at this point. Zero is the safe do-nothing value for all callers. 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 *pprot); 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) vaddr = hppa_form_gva_psw(old_psw, env->iasq_f, vaddr); t = hppa_get_physical_address(env, vaddr, MMU_KERNEL_IDX, - 0, &paddr, &prot); + 0, 0, &paddr, &prot); if (t >= 0) { /* We can't re-load the instruction. */ env->cr[CR_IIR] = 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) } 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 *pprot) { 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 = (cpu->env.psw & PSW_D ? MMU_KERNEL_IDX : cpu->env.psw & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); - excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, + excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, 0, &phys, &prot); /* 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 size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, &phys, &prot); + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { return false; @@ -678,7 +679,7 @@ target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulong addr) hwaddr phys; int prot, excp; - excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, + excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, 0, &phys, &prot); if (excp >= 0) { if (excp == 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_ulong addr, } mmu_idx = PRIV_P_TO_MMU_IDX(level, env->psw & PSW_P); - excp = hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot); + excp = hppa_get_physical_address(env, addr, mmu_idx, 0, 0, &phys, &prot); if (excp >= 0) { cpu_restore_state(env_cpu(env), GETPC()); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); From patchwork Sat Oct 5 15:25:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832985 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256766wra; Sat, 5 Oct 2024 08:30:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXr1McqzfJp7e1K7Z6IzNwNmm6OwFM4fXyJFNmWQvqh7KfYI27glvRIUvCAxNLiMo9+Rx+lgQ==@linaro.org X-Google-Smtp-Source: AGHT+IF4nZLscfWjKCNfIMSb5gETu6ABJ7fCSGWINs5nNdprfr/13To3KPLfS7+ThwfcB8oSC6AB X-Received: by 2002:a05:6102:d89:b0:49b:d1d1:8f7d with SMTP id ada2fe7eead31-4a4059264d5mr6007247137.26.1728142233312; Sat, 05 Oct 2024 08:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142233; cv=none; d=google.com; s=arc-20240605; b=Zz1sHnLK1YNiQz9VIeOhOGfwambSRUMF5pUzAf9jcNTut3+CN80EFYfRMIa56hEvB4 /kwb6cKVSdOMwDKUec/luVLNoaZ7+mytKw2F4iFIJXWQzRN7VDwCBCseP904B3aQVcP6 UxKJN2fxepFD4f4btIZlpIhgDaY3v9gAVC7g6imDtBpwlTYmI5m/J5HyZ5RLlCIH3+GP BSVjYfeRGLmCCh6pwcFYNT4EiKYDZc4MEhZztEaxDIkcQPHCl87MzyD5YIAsXzmZUOcT batbqHfty3UrXbUQheXSFiyDa9DCdBPqQDt124HEN/GuHh7Ap1C2YgaNFaJuHZYkKcSk taaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/wa2JC5GTiuZOa9FUt+c/E5R/4D7wBSs90VoPwelenc=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=fheuN08EvvYZ/7329kBqMFGbpn2uSgi259pmAPLM36Tn10ROjko2kC84USw62rPpmG dcvbw/JTqYfZgU5nmu84786X4UISzveO//lnkgj9ZhOrmeWl23pXb6Zbc+CJ4fOowst9 xOBE89DlyaNMBvuR40zxLiE/KRNk+ZzTiI4DfBggKFPQWkLGe7qUMJGvxanfA7slWFSj D+f77eUGZnU00fAXbLaKOI+VTEUbiea9DNixx/bkA+DTQL8cz8jgOABcHwRMJDPHRFub CcHPLvGHi5HojGQHwR4AISCiuDp2APg5g7KdDUAxxHaYUnF4goML5QTDsTRVFdutp+6e w8/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XKTTdeWx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4a412ee2d5csi385061137.626.2024.10.05.08.30.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XKTTdeWx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fY-00025K-Rr; Sat, 05 Oct 2024 11:26: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 1sx6fU-00022o-TT for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:05 -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 1sx6fT-0002N1-7h for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:04 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b64584fd4so30733735ad.1 for ; Sat, 05 Oct 2024 08:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141961; x=1728746761; 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=/wa2JC5GTiuZOa9FUt+c/E5R/4D7wBSs90VoPwelenc=; b=XKTTdeWxdO6WqJvEnBdtufVtG6Bpz43HNEB+Qkp9dFQiBi90H631W1LMJOql3p6Xjw nKu4e+araHW7rmJjK5KuzyAQoFChSLrmL/yHPxv1ov31M9faNjcTNyTnCfmZyPHzvp1X VxRJT8JhKKmE55bfaRmqyGlC4Orlv3wZVGwHQQz2qxPHFEK+tOaz3wbDqusJmrZonGe8 Il9+JDqS4P+N1IHAGoLisGfM/rzmiNui+Ch7wzSQY2Nj7tUNRrX2YjJ8r+VUj+ukUaG2 vnzzo6IwwXeWv44BD1ycJCRGijrAiMyFnHXkY9x3nD9edU9IFJVdg9HLTT3tgz64k/Pa k5rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141961; x=1728746761; 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=/wa2JC5GTiuZOa9FUt+c/E5R/4D7wBSs90VoPwelenc=; b=hu5CN0dL7KLuP0QoyrQrV3q0+RJVogVleVuDp4ZhEvzle00RJSt2A3wqSPlXqhqL7z FDaXlIiLSRk7AcHhkz+g3tF+fceZdV2xh8hvicSbIRdk9msfBc/rs0dqIvPbjMLyrYGx DltPoqnd6OQantP1f8Cty58cKqseq/Kvd3dj7H4X7wlppzJN4Srdykl163BuUT0LBTYP xv5fF/yX9JUty0ZO0RwzThdwq/r1c8xZqXB3J+UPRJg1+h9vp9lxRAv697qxoy/mQzy8 QIRMfNyHN+fFEqwnknGdt2s4X7VIA6Ksrz1PjU9Y1T5/CR8tPvdJCrqSg/IHQqFc2CpQ 1+Fg== X-Gm-Message-State: AOJu0YyrwnuhohmkXFP6Q8IHUakEXdpWd3Z37F/BCDZwHfdbri++3d9a 1q5gn9biZxLSh+Gyzzd0tdfwk524fI0sDLbHh09tal0+ASHulCIxbcXv9hVD1ER7ynZBzKeFF3H t X-Received: by 2002:a17:902:e887:b0:20b:8036:f77f with SMTP id d9443c01a7336-20bff1a9178mr88727005ad.46.1728141961604; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 09/20] target/hppa: Perform access rights before protection id check Date: Sat, 5 Oct 2024 08:25:40 -0700 Message-ID: <20241005152551.307923-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. 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; } + if (unlikely(!(prot & type))) { + /* Not allowed -- Inst/Data Memory Access Rights Fault. */ + ret = (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; + goto egress; + } + /* access_id == 0 means public page and no check is performed */ if (ent->access_id && MMU_IDX_TO_P(mmu_idx)) { int access_prot = (hppa_is_pa20(env) @@ -281,12 +287,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, prot &= access_prot; } - if (unlikely(!(prot & type))) { - /* Not allowed -- Inst/Data Memory Access Rights Fault. */ - ret = (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, From patchwork Sat Oct 5 15:25:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832983 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256580wra; Sat, 5 Oct 2024 08:30:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUPQgb+3NOwCUpI42oPVRXmy+NfH9q0nzAn9hB7iTwwlb57Ax6bbVj2bjmRx8AejesFpxSVTA==@linaro.org X-Google-Smtp-Source: AGHT+IGCwTyRRKCK7kukyNd0IufdxP97+zOB+4dsCoeAtHk05SyyQ5a0sBnEULBIE+JDffmZZGsQ X-Received: by 2002:a05:620a:1aa8:b0:7a9:b20d:cfe7 with SMTP id af79cd13be357-7ae6f444983mr1131661185a.15.1728142204435; Sat, 05 Oct 2024 08:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142204; cv=none; d=google.com; s=arc-20240605; b=lXFa8/mbsjWk+BVOKR/6FH7ruasU9lKxBD+8/33czceSm1g7TjcqQGfPLN5zO3LdvM 11cbWjRtj97z12sZpuKtz/JAMw0169sa7b72C5znU+B83a0KTM7Q3yCm4TvibxiBcWtx wpfzj3NEUFYkW5zDLNy7UKxERaT9T70fHubh63q4zq1laVXQb/DtUTZqNpyjUd0TPV2k sFOdjFhhO5uILV30kQLdCpeQfG3etpyoh7lptUIXwS3Iw0a5+rI/SUJKjWMmrAo1+laN VZlcf4bx+KSX5m2a5ixh1bykHTHrA07dDDQAySHOfFr3XPhUTqmmLesnYG6BuJ815yU2 xKhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=posPbKSzdb+ffX+WhfgYFaW0pAyKjx4IZlbzVQLaTuc=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=KMQPG6ViPfySSnDNgBuuD2gV8t81jQfXVxT5P0BgBqsV018LDy0lfy8vqsHJd1if6p Jp0LbLQmoROkT5vYRGTwnS7dvbH5lrGsyr0sEbZzvmRSDwWdm9vlBTjgr3EIbePj6Qna kIJDaKjR/7Evxu03sVR36nL4gqYUGcOu5oJGVTPylDgqr/V5MBt3AYRHkGXmMvut2O3q uxSG0ZQewjWyJhxUs2Ohcj7WLso8lrUM4qLAnqRnvShMUfj7xFVjgeFpJPe3KIfMXzeY aqvX/4DArZnLt133UFO8VMu8bexmmEh/aguU9ezyn1K6sQh95mzjc+lTYfGmI0KDCgFb QyNA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ma6Alayf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75614bcbsi206598785a.103.2024.10.05.08.30.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ma6Alayf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fb-000279-UP; Sat, 05 Oct 2024 11:26:11 -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 1sx6fV-00022q-EB for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:06 -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 1sx6fT-0002NN-Va for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:05 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-20ba9f3824fso24155255ad.0 for ; Sat, 05 Oct 2024 08:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141963; x=1728746763; 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=posPbKSzdb+ffX+WhfgYFaW0pAyKjx4IZlbzVQLaTuc=; b=Ma6AlayfgwVm9xWhtnJUF07prxdyJ06l4bjxt8TmBR3Es11DIO4P1llmZRnWMj6x77 lTaXuAZbYaK4C7lN2CK2Giag5OHlxKh2Kf+oFgIbma4zzxghDT7+C/cUrFOB/IspAcIb SvcrM9O1iJ3z6xb5s8n7OwXppA7X/LSEmu5Gke/iTyQp0TpdFlHe72oUd4vIaqrwN2yL F+7lybRIBI5lg7dEAmSSPBSnKGqKPJ1FwB77BEk/3eTDO3ETHeXNL5X49hmZCfo+GqoD pwv2VhSsyoj24F7LqAgNTyDq5w8QgfrKphfWNANnx0go3F4vwLtuKKU5Ljm4bWSJDdRF bP3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141963; x=1728746763; 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=posPbKSzdb+ffX+WhfgYFaW0pAyKjx4IZlbzVQLaTuc=; b=DGbTl3pRVs7FnyhBd0UkpqYV6+nBiuotZKEu6Rl0f9R/7V8SGbjOPYc0gHYFaFkpvL cU4Et/7YUhbV1UL7wia4CYeDVlov/CyxCogu9j4yCSgmQVtV3mjYuPuEk5dm/YaFRPzz pZDfiYMRbBCJSqNQzTsefIZH+B1RZKXuB4rhvNq/i8M9gf+d+Iu8GxaAAwGDndM98aKI PB0d4o0OEQ1DbyWKSrhi2b/ZxYu1h0HrPS2gO/k3EALpwulYrAjgP+zkyNPTeRn0rPlv Zu8Aq5qbwY8Wp1abeXhqHyVksPuzjnxjiaXAdRO05OjSUkGxoiU+Ve1YTzxYwexvTnez 18xQ== X-Gm-Message-State: AOJu0Yzp4d3w904GfJYPYFSZbrO5N/9BV37uM1DdASO7xG43gSuqxvSu buONyea2xF1CgmXmASGqHaWARcPy6b7Fx81BPF/B0G65eOceFIhZM1k+2em1Xw4BQcBhIHlh24j F X-Received: by 2002:a17:902:d2cf:b0:20b:502f:8c2e with SMTP id d9443c01a7336-20bfee333acmr92469555ad.51.1728141962599; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 10/20] target/hppa: Fix priority of T, D, and B page faults Date: Sat, 5 Oct 2024 08:25:41 -0700 Message-ID: <20241005152551.307923-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Drop the 'else' so that ret is overridden with the highest priority fault. 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, } /* - * 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, vaddr addr, int mmu_idx, /* The T bit is set -- Page Reference Fault. */ ret = EXCP_PAGE_REF; } - } else if (!ent->d) { + } + if (unlikely(!ent->d)) { prot &= PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* The D bit is not set -- TLB Dirty Bit Fault. */ ret = EXCP_TLB_DIRTY; } - } else if (unlikely(ent->b)) { + } + if (unlikely(ent->b)) { prot &= PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* From patchwork Sat Oct 5 15:25:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832981 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256460wra; Sat, 5 Oct 2024 08:29:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUK1t26gYkAL10efEJb0UJZ+ylKAto4U3jVbEQnJTPZIJsVeIWFoZUv2Un4m/OZciOo/6HB4Q==@linaro.org X-Google-Smtp-Source: AGHT+IGsx9SZ76yjWaL7GfUfqbu8VndILYg3rOwAx88/IwgD9H/eLA8HIPyv452XZ7y+9+3Ft8hT X-Received: by 2002:a05:6214:318c:b0:6cb:1006:e9cb with SMTP id 6a1803df08f44-6cb9a45e98dmr92242536d6.28.1728142181743; Sat, 05 Oct 2024 08:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142181; cv=none; d=google.com; s=arc-20240605; b=dgLwlW20cJr8kkIqJ1JiG8q090+hDcP8XjHdflRb3lw6oKbqYlLPF9aq86U2jO1/78 eIZ0YO6A1v1M+C+7f01eP4XJkwd2rbXnh1A8oip4kMXNV7mPyyd9ohQkffOgaGwmTMxn 35e0CX/DBkVqaQJm+3utEhgAmJ5f/UqengdKgljD6sRR2Fpr9o0fmcNSmc5Nf81gaD+D dNJZE3AL0xp5UGdWyOIyYnFAe3VAhVjH313znVwLuz+nVN3Bnh9AmkzhGaqGKEUiT6ub JnM15lp35invDbyXYi5pixrQPq+dsVIfSJ9+iQeXYloq4kKtXKSMGNqk0sJ4pT8M3YZt e78g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TZFSB9ZUy/VXACo96L3HUXARpyVU9ywq9XNxX+p9inM=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=UmmC7UD4eqGl9/xQvy4FU4jDehvvrdmRu8dQl9O7zhakypreEyPF3m9a97CYP1UGwH 4zCkIELt2RhO7uidz0MO6p5zKlUHYict5VmPt8ZhZ0DslOsn6JUk1icamoGOVu1q3Uit 9DMZxcLvcuLXzdJKIPqAn5DkhIh8DxxYFLvrXXvSAf1wEl243LR2CNBHaHyW8gHpAZLH 2GdScApyfhpkySFh2pgTpWYmVTpNOpXizp2zNrozZ/qzFl05HhyFy6lbaUgEKA50er8/ KhWRCQudknMNGbwMxOMwQ0SPpVi92y2vmCFNPEDHO8kxpStMKKI10QY3xBCoJwkK6Yyw Zqrg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k8e89w4C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba478b93bsi22368156d6.449.2024.10.05.08.29.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:29:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k8e89w4C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fb-00026t-Qh; Sat, 05 Oct 2024 11:26:11 -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 1sx6fW-00023q-Ig for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:06 -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 1sx6fU-0002Nq-P7 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:05 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-20bb39d97d1so27185265ad.2 for ; Sat, 05 Oct 2024 08:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141963; x=1728746763; 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=TZFSB9ZUy/VXACo96L3HUXARpyVU9ywq9XNxX+p9inM=; b=k8e89w4ChnXsaaKuSvUeLM6mkPAACCHbS+9FlidKqQgd+wb5Q/DAcEuxSea960KejT vtM3vjfD9pFXwr3cUBleFYsWycRv36cwKxbj1Ehbl/Q5KiQ+XBJKBxNttCSyfWYduI1I FEXsYM791iSqMo1rDKcqyOc5Sx6d6egYPPwEZ5GbzZ3MexPW77E9LF6CGZpjzrcuO16N eFm6SUdQbSCjd16ngAzqzS9KuqG2tDhnccNIGagQTKk1oPe6/4vZPE675OFQy2Nz+RGI 7tgLm++/8FpCltRLMHyLVGm7Iik67QUANJ7RbtqUNqHFrIWYT/vsfbXm9hX9VwOD55se ub+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141963; x=1728746763; 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=TZFSB9ZUy/VXACo96L3HUXARpyVU9ywq9XNxX+p9inM=; b=PRavDROkaZXjn9UKMcMBcHRZngGl1X0J5p1tU56GLleY0dCUYyIF6HXFpICZgNlvrw XwhXtawtqsvWEdoi9EVCw3P18k/gE324m+Y1jXShi3gtiGBOd7RmI2kHI0dxYSGHQ0CP 0Zmaiv+dir7r6HDqXGWaiRxDFW4lHPJgW3x9YTIASRIx/ROHWTrbBrdM9u/INJb3/Nhu LCP15Fe0UTsuuRjsFA2rndcY3fWFmK9tmyWgHBduOyFoqTHITqerFB0qOhg8h1bPap59 8OsfxDgti+LgdR6/xeGTowUIx8Ykc0IwmtCpyTM6yJfBl5VBD6x/a0mEw0kJaBhqgYle MHyA== X-Gm-Message-State: AOJu0Yz78vBajtdtRwRHRUFjNNbgesPMpENJp5KuicX/4K6YlwbVPzLb d0I/3q6787meHMUzV1zZAioOYhTFuMEXwNdME77+4U7Qkin80hWNb4xfhwE47pc7QiSXuLbWWsP n X-Received: by 2002:a17:902:f788:b0:20b:8ed8:9c74 with SMTP id d9443c01a7336-20bff1cb9d3mr97600185ad.49.1728141963574; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH 11/20] target/hppa: Handle alignment faults in hppa_get_physical_address Date: Sat, 5 Oct 2024 08:25:42 -0700 Message-ID: <20241005152551.307923-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In Chapter 5, Interruptions, the group 3 exceptions lists "Unaligned data reference trap" has higher priority than "Data memory break trap". 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 = PAGE_READ | PAGE_WRITE | PAGE_EXEC; - goto egress; + goto egress_align; } /* 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, } } + egress_align: + if (addr & ((1u << memop_alignment_bits(mop)) - 1)) { + ret = EXCP_UNALIGN; + } + egress: *pphys = phys; *pprot = prot; From patchwork Sat Oct 5 15:25:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832982 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256560wra; Sat, 5 Oct 2024 08:30:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8+1z1A/PlF4N174nHKhk32eAlpgSR2AMN2F4QT6ODf7B3OXW6S6PGkqU3zsmRnVdgGPiNRw==@linaro.org X-Google-Smtp-Source: AGHT+IH0hEMJkJoEa3W+EzEyB8ctanl7CwXljFBTVXjeuQTC8eX7rs6lsQCOR9vZEZLIQCARnPXh X-Received: by 2002:a05:6214:4803:b0:6cb:50d0:56ae with SMTP id 6a1803df08f44-6cb9a30e901mr85216896d6.29.1728142201980; Sat, 05 Oct 2024 08:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142201; cv=none; d=google.com; s=arc-20240605; b=h5fSPVS7UyS9tEWQH9Mn0+g+e9r8dU4Rz63Ry56ftlWaH8a1IBUQKVpfxoi2yGBUMu A9DtkTXtOXV8rzvLGE9nbRd7AxNCJ+XIcfz2n5KQYNcqCz0P4BvX2HvCLphNqv61R/4D Rbcfvn2N25EA40vK0VulkHdsvmZOZIZG8SXMcZUsGwOzOsjS8YGK06bZ0dVoPt2A8v5D 6C1dh8Pl8Qz6FTPaWD0ix/jBZ++dP6QUelOdGDhsjdM8L4rqI8R/0DC5vtvqsQRMYDf0 pmTQTJ5ojpcIW9HE/vVytqu0SjftCf0OZS/YKg0KIubIfn9bFgarmzsXxTy8hflt/J5d RWCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Rc7m2CC+o/vfg9459Vx/ro/giFzSXc14VGjLvy+03yM=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=PeIaIAtVgWwf8fi0C+D97jF3remm0Vhz57ck6aMCIYAUqP9Skdn+LY2h3a+o/d/fuR cHi6rHLbV4SIRNAVDTAR9D/x893yGXZ2SaZrEpr0PIQgzwBkzCvbNk35yzvh2SPXuLdP nGsorCaPVcIIPR3Hvrg8NjaJnIp1AWClH8nMJ7bDZLKZ7gSNtLBfF1uqfy6qs7vMAXRT 5TD884xnarF93hpnB782W4hH0+qDrJl9X0sfINaqfok8JuNbnhK7QKo7glpIg3a/jpl/ LkkIpYP/ZLyy7uPgacjY5eUxQpIlwO2eWvYxxglIlPzeRIDz8gh1LSsRl6mH8RIdk1u1 D/BA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RGG8ZX+/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba478f38asi22711046d6.534.2024.10.05.08.30.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:30:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="RGG8ZX+/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fb-00026q-Pu; Sat, 05 Oct 2024 11:26:11 -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 1sx6fY-00024p-87 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:08 -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 1sx6fW-0002O9-9y for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:08 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20b90ab6c19so33845305ad.0 for ; Sat, 05 Oct 2024 08:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141964; x=1728746764; 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=Rc7m2CC+o/vfg9459Vx/ro/giFzSXc14VGjLvy+03yM=; b=RGG8ZX+/MqLNYXDfLP15/ANLNc65VPRwR3KzFbN3af0xA2e5ROyFd2XeC2/Lt1TwZm V2dz+vxSngftG+64OLK1zXC8HJzEmDEDu3HUTk0expctHzWMWHw3yixx3w+DSvkK3+A6 a5VWGlfF5QwB84qAMwv/49Pm1WKoWkfidLBUiJAnWv/P8ZtlwvVOi8b1th/Z6VfuAE/t smI6poTYw/liJiC34tA+gCdqCcmAwDmkA+09Fk6x9OvoE5H/wT7jRvFKM8yHqDxjl7fX HDWlhtTtzqq+Fx4fE5ZyXf6Uect8x9VgNpJOsPcBIW4rf0gcvioe27LiXHnl0g2eer3Y 5lVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141964; x=1728746764; 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=Rc7m2CC+o/vfg9459Vx/ro/giFzSXc14VGjLvy+03yM=; b=SLynjWMJWAF49kqvQ/Nz89uqdQsdhf7Cd5LQGjAWK2GAh7VWYbgLOY5tRwFmp86SJ+ 9LLLLyejJrGwz67/pqCSC3DksLTn6JtB3C2yJxMQGCXesiAJFB495Ode6+OtwOlM5t8a wK0+WjKs8PK//u9zPCTLZK+uy4FwyeQ9ipKasZPJ/Hp+2i950N0pacOH19pxgM8If3lk 0vQpN8iHqJNceBS8NKdNNeWh4nuXTeRUBviFH8/4TUpNHBihnOk7pcBnnfKhUe8HOGEI 5iRL3fWrrkdlTpkvl3DSmlBBfRHKLaysMgc6LBaw0sgXBhDTyLCm/gQzirRWdzOBGSHe Pm8g== X-Gm-Message-State: AOJu0YzzpgVyqtnqYuLNS3erxDSIUrKrm6wpFHiM+EwpCkJKG34BBTcI Uc8sOXAH8UGH2aVl4t/+IRoQDfX0GF5NDhGSGusMjZeWKNzaGncquvRqqoaPro+nRyjHlDU8MsK F X-Received: by 2002:a17:902:db04:b0:205:709e:1949 with SMTP id d9443c01a7336-20bff04dd11mr92195455ad.57.1728141964403; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 12/20] target/hppa: Add hppa_cpu_tlb_fill_align Date: Sat, 5 Oct 2024 08:25:43 -0700 Message-ID: <20241005152551.307923-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fill in the tlb_fill_align hook, so that we can recognize alignment exceptions in the correct priority order. Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 3 +++ target/hppa/cpu.c | 2 +- target/hppa/mem_helper.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 526855f982..c0567ce0ab 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -366,6 +366,9 @@ 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, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); 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 3b6c325e09..768abc6e5d 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,7 +226,7 @@ static const TCGCPUOps hppa_tcg_ops = { .restore_state_to_opc = hppa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY - .tlb_fill_align = tlb_fill_align_first, + .tlb_fill_align = hppa_cpu_tlb_fill_align, .tlb_fill = hppa_cpu_tlb_fill, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, .cpu_exec_halt = hppa_cpu_has_work, diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index d38054da8a..35e9170bf3 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -424,9 +424,9 @@ void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, } } -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, vaddr addr, MemOp mop, int size, + MMUAccessType type, int mmu_idx, + bool probe, uintptr_t retaddr) { HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; @@ -445,7 +445,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, mop, &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { @@ -473,6 +473,14 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, return true; } +bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, + MMUAccessType type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + return hppa_cpu_tlb_fill_align(cs, addr, 0, size, type, + mmu_idx, probe, retaddr); +} + /* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */ void HELPER(itlba_pa11)(CPUHPPAState *env, target_ulong addr, target_ulong reg) { From patchwork Sat Oct 5 15:25:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832978 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256249wra; Sat, 5 Oct 2024 08:28:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOKUelkxc4R6jv7Oue97yk0AgL/p6RRDPPFU/nXjHPrtBiM1lAghmQsnytOm0oxJ1hNugzyg==@linaro.org X-Google-Smtp-Source: AGHT+IGwGqfLx+QD4AhGyPV0GHOBTQKmWd3KiXFyFVrEVL5dJEog+i1n/3hHfaOR8pRyqOFZjeWO X-Received: by 2002:a05:6214:3f83:b0:6cb:99db:bdbf with SMTP id 6a1803df08f44-6cb9a4e7955mr101407926d6.43.1728142139694; Sat, 05 Oct 2024 08:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142139; cv=none; d=google.com; s=arc-20240605; b=Og8/l/mbOCqZmjSS3DVUExa8T3Th6GLXlQRqkplBUCRjnJpRtSbL06jzqhHZ/302FE KTX/xr/uVinDpTnPtxV3zgenk78gCIIoizesFucF8s2O1Eui98iYxZ4g5O6ShVfDOpeX 10M6RDd3Afd5yfns7jXHy40a+HMPHIRvgvBGwWqK9hRHP5+1hOu2SL8f1rkxSiJFMAZF f1g6XRssnJ1Vb6y8bXVv6TTZH2wX/vjjyCd8AAXlUJmre9CcFZRnKJ6RGw6fC2aQWCUm BgVErQdy0ZSGg4ZuKt/90zYeqHEx4adtARx01rr5um3DaJkz6KvEu5gVje47Yzegl3uT IMfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E1uh5v8Er5HwrssIP/tcmhd1DyyVCAW+cpRhBaU0frQ=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=UtWOMVmc5f8Zb1tp8k8xpim9yj2J0u2rMdbmKGi7kdMKi3upwmcE3vbG3dMCW1mNYn Z/XZUWTrYG5QJ6peZgSOraBfYfqBQdxg8XN36eFxmYHzOtechOLb6f19dSjzbyifIx78 W1Xz/0l7bFTFQd9IyPA1L7yYUN5+jz7IiLy/tMr3L+Umv5HyOHCq4HDbFY9j8Mitd/rO tQR1WZLjuZAW8aAWYmNFtCpvhB7FglCKyugnN2sG/ASJX/Fhp436otOQj9pcRwKENqPe TS/VpTIICaoDqYlQeXStgEqe4xAzmNox0aJzCSGBUgxy/KoWxKw56R5ZPwnqd5frv5TE R95g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSf6isPk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cba47722cbsi22643176d6.408.2024.10.05.08.28.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XSf6isPk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fh-0002Bn-W7; Sat, 05 Oct 2024 11:26: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 1sx6fZ-000268-Lv for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:11 -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 1sx6fW-0002OT-Od for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:09 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20b833f9b35so26761655ad.2 for ; Sat, 05 Oct 2024 08:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141965; x=1728746765; 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=E1uh5v8Er5HwrssIP/tcmhd1DyyVCAW+cpRhBaU0frQ=; b=XSf6isPkETO/Z+QHvF5QsoGZKhS3bQ5aJYcxrXaEPv1JOvpW5a1IciamZcKUBI+ITX x6B9vo2otJVBz3tRUo+MgdQyVEM0LepWBERaiClL/W3RQiEF7Bgl4tB4ohMMRcFYC850 L5rYwgX5320OWuu81ez6Q+byKnHi3gYO8b7AruPUMmeDmuLkqHg9gLRaAxWkEC7B5Fm1 VrA4m9PrqztE9zbYXF+dLxAianCY/5ov+267WnbaicuJ4t6onV9hrejx2ZOXZgs+XxX5 3dw+78iZJrL2VxxgdwpT9O4Kcqgbe1h7PAG5swcfL0CH62VPegoZjMRAauy81Ngil+PO LJiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141965; x=1728746765; 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=E1uh5v8Er5HwrssIP/tcmhd1DyyVCAW+cpRhBaU0frQ=; b=PUf22U3S1Cs50XySNAJ4Yuwlf9fFqDXlKa4ZzvlNk1hbKSaQk+BeRiSpKdxKFa3jkt MktkYj3EVpxtyPHj4GbIFy/ta0bqHKgwptim9maLoSGbLl/a9TEEW/uhb7Ge6O7HAoIw 5IMWGIXR3f6u3Ipzm1T93uvk/wx2k4A8Ld2ofdntgHyPPwuMA5Dglo5PreYGrUxfoNgp FxbnhcOKshl/wDsuGZXHFYWMuwixO0yY3fXaJil3er+fF6BtCKgrFdUbUjNzYqRsKCFg B8UwBc3Vc8tH3VA9dpyqSe59mb3DjMOFOsk5Y0HQUH4cY5OAGnlwWi5TYBq8Cq+Ad3o6 4cMQ== X-Gm-Message-State: AOJu0Yz0CcR8ROt1ssOiEHsf7W9lJN9WcRy7WcXZZqST3RucuJRsr7jZ dwdNYPj2M99oExPi29vtkqMfCtr/vgLePunLyx2tFYbY+2snASZZInGYFcE2jaB13Xiw498tkD9 A X-Received: by 2002:a17:903:2307:b0:20b:9088:6545 with SMTP id d9443c01a7336-20bfe95dbcfmr96932395ad.46.1728141965422; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 13/20] target/arm: Pass MemOp to get_phys_addr Date: Sat, 5 Oct 2024 08:25:44 -0700 Message-ID: <20241005152551.307923-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Zero is the safe do-nothing value for callers to use. 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_idx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) __attribute__((nonnull)); 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, } bool get_phys_addr(CPUARMState *env, vaddr address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { S1Translate ptw = { 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; - 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 == ARMFault_QEMU_SFault) { if (mode == 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; - 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 == 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] |= R_V7M_CFSR_IACCVIOL_MASK; armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM, env->v7m.secure); @@ -2045,7 +2045,7 @@ static bool v7m_read_sg_stack_word(ARMCPU *cpu, ARMMMUIdx mmu_idx, ARMMMUFaultInfo fi = {}; uint32_t value; - 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 == 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 = get_phys_addr(&cpu->env, address, access_type, + ret = get_phys_addr(&cpu->env, address, access_type, 0, core_to_arm_mmu_idx(&cpu->env, mmu_idx), &res, fi); if (likely(!ret)) { From patchwork Sat Oct 5 15:25:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832974 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1255873wra; Sat, 5 Oct 2024 08:27:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLOFm13f/h30SKxeR/AsguMCTEZJARPeVZEl4/9HcWSSK9SQFGw+wS5FFZukvNqQkEptJgDA==@linaro.org X-Google-Smtp-Source: AGHT+IHmwx2eFt0S44/CxaC7xtMSoyDViLANGOoPO5ZT4dnhouXxVkVL8156mIjp0Ni4pZHbmJqn X-Received: by 2002:a05:620a:298a:b0:7a9:bf31:dbba with SMTP id af79cd13be357-7ae6fb2e8camr948561385a.7.1728142056541; Sat, 05 Oct 2024 08:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142056; cv=none; d=google.com; s=arc-20240605; b=Tx4iQSeb4v9EbtpDV0DaAqv+MCsM7G6qk3Ij/SpDGwL26jaM1yKNNMFnSUwd+Qdhya i6OhbZOlWN8PFJ5IA0Te52WbApUy4LKvOUqfaBfOVO1Mb/d/fVY4sPpuvSNOVijnUCte +tIGKzReME7e/2jqVKZr1JH0+DzguXLJdDPILTYzKM82noqnvPOGKMjfvVYJY58+6ltd 399sLEVkjTkNdL3m/+NqwVtyOAKVP+cGfhMmjVT/E2SrGL1S73foqryA0fMu5wY8RJJA cqIpCSTexfld9iOYqEjdu2/KMZs2iLD4uUvbfyikXv/GuDQg1QwRqpn5vZ61SW6iSC+e O9iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=or+46uGq1e2/GbDMKkBXfTr+x8kd8hih+f1GC2rPQFE=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=jqeGMeJkCkBoXMh5o1zTpaARlVIPcirlyWbm3UNHgf8+H33kzhOznWqXEHbjaK2zSj OW43dY03UXleUb3EIQlz4Omgnzivb7Jr45i+CzmxqH9Gs8QYm6yoCdLg57njJERLix1e Ick3UIDzbTyIn5lF4dfmLVrSiQPXVbp0i7qDoFxY0f8/deb3Ft+NbeAMs5tdDfvlehsK WFp8eSyRtpG733+XQy/0uf1dhGcLRfkgkZe6Mzx6Yu++EDDZGKPndSqYt42h5CAdI4u9 q9k/u5EIGNIgFP097HUszUlmcutYlDbi8XJ2yRBADgFwgF3Wodjr8yXdujn6dktKAFYG X5lw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fHTXmPv0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae756618ecsi226299485a.287.2024.10.05.08.27.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fHTXmPv0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fp-0002Hj-Fd; Sat, 05 Oct 2024 11:26:28 -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 1sx6fZ-000269-Lv for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:11 -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 1sx6fX-0002On-NW for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:09 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-20b01da232aso24810895ad.1 for ; Sat, 05 Oct 2024 08:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141966; x=1728746766; 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=or+46uGq1e2/GbDMKkBXfTr+x8kd8hih+f1GC2rPQFE=; b=fHTXmPv0NroP7YB2PLlW/KDDp273HA7cf5HHo5K8OJf6rtsY76zNrO8ihvSBYaJqmV 8chUnhr9o2m2BHv+K2jlBANhFQoipXJcL33DWvkAOb22sITAKWGpfXzj+VMGY73EGeJ6 MLE7vA0jZDXW/ZV1Pb45P9F0RvKOxuylOC5viH+rIeP6+XCcnGzHAMR4SnI84TcY0eTZ UsY0rB3QhZvJ8OmljScr9Yon0qELgHykCf7dAssv18stTcBIytUm54djCBZ3yARS5+r7 MpbhMrpI639uZ3V9k8IYfyTB9rJm0lXvZ4N7MCbEbuVnqviKWmIh+hH8SoWWXU/fTsvb T8Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141966; x=1728746766; 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=or+46uGq1e2/GbDMKkBXfTr+x8kd8hih+f1GC2rPQFE=; b=dAXUsW3gRL10WOuMfhvIsAta0H92/I4J1KudJ+j4c8CDd0XLA2sJQH6PfdxFnOmuhl LPger14SSY2pQenmVKOuBNOO+bRxqSmbB9JODRvcy8WF7Pgn2KEFa+l6CwHFKfXHva+n qj7MvsBRfF9ZRmEcUHUg264AcIQaxyJ3SsBO/i9qpOniqMvdyaG4vfD9N3sKKAtNZ48q IntUu95mcMayAUOey3XxQGzeZO3LEjdNUa+FCJI7bbR12ZNhJ3TPCH+vnP6rTX1JbLuZ XI8l43lJCcLf2/nVjsW5tOl6RFK/ipk9tiQgM5b13HxI4bB9oVj/fuFqwIUcZ3QSjFbq Ntaw== X-Gm-Message-State: AOJu0Yyg9oFgiFyhE/jLcOrG3vTwZzdZO7l24tgZ5Xo1qt+Ws8gvsyxc MgvfWcq7SNdYbsyutweXwPhbSaijQ1fiAHfhuVEhOszzCTT7vQw+EZt/D7RZcWd6xX07lEyONzu f X-Received: by 2002:a17:902:e887:b0:20b:9365:e6ea with SMTP id d9443c01a7336-20bff393be4mr111588295ad.10.1728141966447; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 14/20] target/arm: Pass MemOp to get_phys_addr_with_space_nogpc Date: Sat, 5 Oct 2024 08:25:45 -0700 Message-ID: <20241005152551.307923-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Zero is the safe do-nothing value for callers to use. Signed-off-by: Richard Henderson --- target/arm/internals.h | 3 ++- target/arm/helper.c | 4 ++-- target/arm/ptw.c | 2 +- 3 files changed, 5 insertions(+), 4 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 space, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f77b40734..f2f329e00a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3602,8 +3602,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, * I_MXTJT: Granule protection checks are not performed on the final address * of a successful translation. */ - ret = get_phys_addr_with_space_nogpc(env, value, access_type, mmu_idx, ss, - &res, &fi); + ret = get_phys_addr_with_space_nogpc(env, value, access_type, 0, + mmu_idx, ss, &res, &fi); /* * 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, S1Translate *ptw, } bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, ARMSecuritySpace space, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) From patchwork Sat Oct 5 15:25:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832980 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256371wra; Sat, 5 Oct 2024 08:29:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUanykKoaZGqPIM75g48Tsnx3+nfcLoR21gKqtF/yJU5iFni9aVooE1sAikbe4W7b/bSX4L5A==@linaro.org X-Google-Smtp-Source: AGHT+IE1f4bsgVupErIDnAJc9MdxEUr+bJezYk70KkDsT8oBf5rB50ambMUkMBzaWeV1wXCh5X7t X-Received: by 2002:a05:620a:294d:b0:7a1:c40d:7573 with SMTP id af79cd13be357-7ae6f48e01bmr1110853085a.49.1728142161428; Sat, 05 Oct 2024 08:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142161; cv=none; d=google.com; s=arc-20240605; b=KRKyFkR8IBmuctQ8F/fakqFdc8/yNVqaPwDyh98EuqLI+PqBYHf90VOm4rsurTe45t lm5xBEQqq+AXXC2hv1prLeYmRHQqgwO6mLFkFzAlfaYGoCUe5y7+7lBOz6MEAMQGcmmn YxuMp/Db9uFwmdH6ZunPN+/C0w2Mp71HHQTAGu5I2z7lsQ9i5DQ0LGz4D93fDvlHz9Dt roGBUwVWXg+6OAaX0GN/REuIx3mvbwFC1kY/kukqjcvMjGCZBtDFHwLh/MSpuAXHPaO2 2Bke0qTg1zNIfortUOWZpmZNnZOWcY9sLz9cXPu8X+QcLuRicGvxAd3p3wDqMYMpuJ9p /bvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4X5zP7zXx4H0vSkmfgBSYylbUDArgVMPw2dfqzvhfaA=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=d0Gs+FpJguvkhzWD708800U7R5LgcJTuVdE4qv8sIPkDpuYJCm+0Bwm2dBrBpcp4Hx mLxr2Df7ICTukN0dNsdWTgkHaktphfUVCVl2aqDuHmiZ8e0gE46UpN96pueFn2rqM4nb HTLxSYNa54KmLjiUFZyPd9m+BQ6ozonzMpCnTbyE0TKKigfvBabOy/rhpjNYBQ0AxuY2 j00hps7Uc919ZylRVfy4xU7ZFgF/mncFZa4L8XB2beirL1AzymTi7t9ZvoQHD7Y1EzNo qd+cvnJ+dzdKwUYqOppsijdUE3Sc3y/JhKAkF0udVQN4Beg+s5X/f+/gTgAtwZgWzeKi 3R9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x5YzRLk4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75779c49si225297385a.768.2024.10.05.08.29.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:29:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x5YzRLk4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fe-00029e-N7; Sat, 05 Oct 2024 11:26: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 1sx6fb-00026n-MF for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26: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 1sx6fY-0002P1-Nq for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:10 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b9b35c7c7so21873515ad.1 for ; Sat, 05 Oct 2024 08:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141967; x=1728746767; 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=4X5zP7zXx4H0vSkmfgBSYylbUDArgVMPw2dfqzvhfaA=; b=x5YzRLk4ARd6XpiUopEFYv+iyWGitqOvwSXLlYUSZ/BgOIE07Hc+9hxiqJNatRBfd4 8hcEPA235BXocSstX592wCuiJGiJ1yPcKJr5pJvZcAhpB0G0cmoRjzL+9ZayYXA9eONg NLlozVhLBfhVos5qMndqHfcpCWKdzhoqwBQLAwtXV+Hx+1Jug/IFxHCNY3O1UuvPCWaJ pZ/ZZM0kuTIND1SvRbxWaT03etn33NY2VtUjWbo310W9SxJSTLKfcsZdQLXtJbSAa9cf o6tRVzk3FD3GcEAcvjRs3XQIIULJbdJqvtwmHNYn2mcjiNAnU1t4dXhr7BkLNAcliG4R Xs1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141967; x=1728746767; 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=4X5zP7zXx4H0vSkmfgBSYylbUDArgVMPw2dfqzvhfaA=; b=EqcNM7Fwxtnofdd4NVYEvCpIa9DiFwT53ghJlYXH0NrPkfp8pXGyBrjeVa8mkcI2/B FfcM0bQks1JZqQgdXAVYtMyukDIqPO+L8NRMe+SmUBE4Sv5W3DzezK/XxPJfNNPS0kzu aGe0J7Kuq4EQoPjjMg9vI0rcw2RI3ThKrg2yk7HvJoALan1TC8JRxn+BkNblwX9lmueN GLafF3+3tStl/oHQWaf0fTKWIqlIM3Wme3JiZBKUKjkUbHPt5SJqD031kfbNf4UhsAa6 WaSD90WftC01Sl8mF+CKrz0j8n2fYOAQE5Ecn2R9yIMMPI8g+jSnmq9M3a6bAaH96bDY KvNQ== X-Gm-Message-State: AOJu0YwVgTxOXBlq1aMtDAoOEaqunBK6qU0Y2DoKPdiXBPMvzW23wsyb DS1Q0uORIDlilm46gtoSYIEjLrLeEdMSFZKgoa0mkP9RbsCEb4maTI+jqBDVGMHPffxn8oqDXv6 f X-Received: by 2002:a17:903:1d0:b0:20b:fa34:7325 with SMTP id d9443c01a7336-20bfe291d4emr83779435ad.43.1728141967491; Sat, 05 Oct 2024 08:26:07 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396948dsm14351765ad.225.2024.10.05.08.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 15/20] target/arm: Pass MemOp to get_phys_addr_gpc Date: Sat, 5 Oct 2024 08:25:46 -0700 Message-ID: <20241005152551.307923-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Zero is the safe do-nothing value for callers to use. Pass the value through from get_phys_addr. 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, S1Translate *ptw, static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); @@ -579,7 +579,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, }; GetPhysAddrResult s2 = { }; - 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; } @@ -3543,7 +3543,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, 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, } ptw.in_space = 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); } 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 = {}; bool ret; - ret = get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, &res, &fi); + ret = get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, 0, &res, &fi); *attrs = res.f.attrs; if (ret) { From patchwork Sat Oct 5 15:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832989 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1257051wra; Sat, 5 Oct 2024 08:31:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXap5AIkgCwRTlF+HReN5ea+UbC0PFthZh682xJMHEHCNt1KAToJCl9vFm+CkXIV6Pild58Rg==@linaro.org X-Google-Smtp-Source: AGHT+IFDs4/Yffd4VVuUDLQH2Q2VL6Q2eoTyUaHOaCTtaCckFF4X1bgTMahVCr3SVS9QOOzPSeag X-Received: by 2002:a05:620a:1925:b0:7a9:aeb3:4b22 with SMTP id af79cd13be357-7ae6f421d78mr1158690585a.6.1728142276818; Sat, 05 Oct 2024 08:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142276; cv=none; d=google.com; s=arc-20240605; b=TZva6pZwnluWnTxJ/sZuO8/6xEKhnOkaNvSlwptfWeQmk4FLyaJODAVSZURDrZPjLO jE/xvzYxwsTtDvmlhb4MnojpM5nGusBh16l9SBq1wY8jPFZwULLyyvt6Y0XhMvZys7gk WAhtB80tfTDR8K/4ylDzxWLRyf77DggOSwMyBuLbKNNVIHraOAiJGrkR9GO9QvSsAa46 Ctngzmvsnk6s+AjX/cBaA+pbZvoOB16zq0bLEcwebgE+5ADe3CawH91b+QVfaWDkelLj gKbc5AE0sMxg/vVgwQiHnt6CULkIDgSsxc/JtLJB8t8RLgmcHPVQ40J9OhB+luPPyju4 yExw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3KXMhwqlNY3FEn9X64ijA0SceY+BOiTFnpHj8/s1p5o=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=abCNZktf78541AOVy5TtKfbJat6SggJCEY86JqnwkF8GNvGeQBskDJr/n0vxka2fGz ZMED3ZhqDN1eREZvFs5XCzq6d8Wv3EYgxnf/mr9mEbut9wYCTg5CSAuQzMcNe5xTqWEr lqADESSx4CBoxmMtwIrpLj5pcM8xRSvrLGVKQva/nATbr6pS/sbTuwTP+o84NzTMowzb 2EbqWhHPnA7WZu2tNfpS43VjPeb+Xi/9UHspjb5yrEBvcRwyoVKBvSvIZAhroVkL7vyg YGu9mNNpsOYyjwupHq7uSvH3brPoWJLZnB996d1E+Fc9Frmc4n4tf4rnEIMQHPqB9hDY oXgw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zdimwVRY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae756169e0si216811885a.54.2024.10.05.08.31.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:31:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zdimwVRY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fm-0002Cm-ER; Sat, 05 Oct 2024 11:26:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sx6fc-00028U-Pa for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:13 -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 1sx6fa-0002PO-OM for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:12 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b7463dd89so33893355ad.2 for ; Sat, 05 Oct 2024 08:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141968; x=1728746768; 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=3KXMhwqlNY3FEn9X64ijA0SceY+BOiTFnpHj8/s1p5o=; b=zdimwVRYWcrIaLfcLOKxZT00xtHrk3o0XVhS6YCFHYYDBTLIo0fR3+ea+23xfyzIsO Zlmt/fGjbTjpXyBTMlONglp50UE7V3LsRVei1PGtVMHoTQ/7u0uy7hxzH2lilQocTGJK b7QQj+FsF9V69x/wRAOQBCmxNR3Kb0ncT08qJy6hiEgqOI8qLAUAd9kXCBjP//QvJVSK 6OLtYvo1aBVFi4dI1goDzMuFqhoE2HC1Hz64l/I/B0Er+tOC5tn2twDUq/KdA4/quES1 Nt6hFRC3FGP2AIEWf6msV0pGhHPakg4/jAthyvRdgJL8bKks2Qyp+ZGyslCkLNnMOlpQ fqGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141968; x=1728746768; 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=3KXMhwqlNY3FEn9X64ijA0SceY+BOiTFnpHj8/s1p5o=; b=NJJ8EnKTiVtacegRw6JO9BNqN3hVXdMqNongnbFQ7R+DmapnuV7VnqWIQqMf17XDMY WYUfy6Y6OCn+CcuXUvYQL8Y1iolgE0JYHJVH2+taJK21h4ASVaYYjyfOecZ69xqlJ4Qr Rwykj0tueWXaMfQIxAl+hsF1fv15diKrLnmD7L2+3le99GRovA1C/JEWabis7eykWN8K 4krmk7j3lh1J5EdrDtNv6kJlCuC0r1lhdj12zS6f+Px9X6HiTj4F7vBJOisLBkvixSb1 K7maPOTc5JBEckTcF8E5swEQkEf5Rb+a6q/mSp5hfmDGEV29cGN0klWfdxZ0iNQ0UmL1 sE3Q== X-Gm-Message-State: AOJu0YxwLA2Z+dfwWZzDpoeVd0QpLDXRyg81SMgyGIaPFJ7PFscv0ged F9/zo5KrTcITs3jIK5l84GfLEgakth59QhUqS+AtVlLOtjuUsqrfR0afku0T01ik00ZQUoP752a l X-Received: by 2002:a17:902:fc4e:b0:202:4666:f018 with SMTP id d9443c01a7336-20bfdfd2693mr105297675ad.15.1728141968397; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 16/20] target/arm: Pass MemOp to get_phys_addr_nogpc Date: Sat, 5 Oct 2024 08:25:47 -0700 Message-ID: <20241005152551.307923-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. 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 { static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); @@ -3313,7 +3313,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, ARMSecuritySpace ipa_space; uint64_t hcr; - ret = get_phys_addr_nogpc(env, ptw, address, access_type, result, fi); + ret = get_phys_addr_nogpc(env, ptw, address, access_type, 0, result, fi); /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3339,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); - ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, result, fi); + ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ @@ -3406,7 +3406,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3547,7 +3547,8 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *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 = mmu_idx, .in_space = 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); } bool get_phys_addr(CPUARMState *env, vaddr address, From patchwork Sat Oct 5 15:25:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832973 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1255846wra; Sat, 5 Oct 2024 08:27:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXDY68uFZQFJPBhIod8AxepLhQIYb3L0SSDRXtid0RvfvhswhFqwLZyRLsJi5I6jRgWb+pT0w==@linaro.org X-Google-Smtp-Source: AGHT+IFMY0wWjW7ci4kdCw1RrTUsZQyzA1vby8lU8S+r6yRazgy2O//KMbW9+GVYx91Og0hcD7po X-Received: by 2002:a05:622a:2b0c:b0:45d:a127:8257 with SMTP id d75a77b69052e-45da1278757mr68759421cf.57.1728142052194; Sat, 05 Oct 2024 08:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142052; cv=none; d=google.com; s=arc-20240605; b=NeMhGXgY6EPfryYNsYJkfuKB5XnXwPDuY3Xi0kDswFHhu+9VUkY48intlq/HFCizuk 8mnZ2peOL1K/6HrXQ2yUNygRAunbOyDvuEOC0mEMxhHyq9sePQXf8UhbMCw1w/hrxaA9 z74kqfYnPEkG9Uh+JtyYBlqHwq/QE3XJoM/LtPk+8KWkFnjq/+KNsV3kv3gdTTn6297z qMtkuDV/UYu1pID7xNFxDhwRkZcd7jPyOdOzZi/mHOyCgN8+U0n0ekIW9z48Ux2N9GE9 JOiXtZDvLQ1FKiVDq4kEv2EFcYC/ZG0LdAVqOcBz7W3ZGFahcN8Hp0oWMPCGItLuaTUH 0SNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oB3S/z+Tf/YurYPbjZAkQ2iOmy2pkllXkguo9aONGm0=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=HXYa3J7schBYghLGy8zYltYxpDE6I3UU8CU+gjXzMrIxeljsJMb99NneLXueLdLntU nwVBxonlH9wUNAcgO5bJ2XZ4ML8Gr5XCGNM6rRWDiQbI+k6YRaZw4OQQ5oAGhaitovLk S4VfO112jJsh2h46Fz2I9e3aCTiOWxz3vB9OoJlMzuoDMk9YrCqIEHAoLMD3TOzF9zy9 uwheuof46kq+HPoAWqp5rx0wbbNxP4eDQGS9j+yUFhsWCR9EhqVS3zqzXhOMxWLivG4O BzwZ0edINOka/MRK+7IAQ3wtrUV30/pIh08Spb3Snh3FO/BLxDv3J3rjFVD65IKM5Ehq EZbw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OtTQd1cd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da76995cesi23398181cf.614.2024.10.05.08.27.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OtTQd1cd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6ft-0002KF-Ei; Sat, 05 Oct 2024 11:26:29 -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 1sx6fd-00028Z-Rj for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:13 -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 1sx6fb-0002Pr-3b for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:13 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-207115e3056so28290475ad.2 for ; Sat, 05 Oct 2024 08:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141969; x=1728746769; 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=oB3S/z+Tf/YurYPbjZAkQ2iOmy2pkllXkguo9aONGm0=; b=OtTQd1cdWPLuugQ5KG+BA0nlxRGl2kTb7ZBDToC5K+jfsnGgnMHovf332GqIFgnEDC RcPxcxk3tDjW7MImV2NdgrPlGUz5tBwqsOH+xlde72GeT9XHVgNj6f4sfC/Bvld6lMlB oLD3ymtbwEc3ba4Ipt4Jx6eW515SwyZiCCK7Hj08CzR+6mKUrMP3bIbrC6IP7rRPjox8 1cMmpzmuY047u8PMfMA/Ds8RknVwrEiGmAFkV/NodaV4f86Es19IpNeJ15jxNudoCn1j Z4jRcatJLO0x7TMAmQW2E5BloR7uFvo/vhxv94M7ZYeNKcuU6itZFcMtVNgfFUlIJAiK tHOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141969; x=1728746769; 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=oB3S/z+Tf/YurYPbjZAkQ2iOmy2pkllXkguo9aONGm0=; b=RvrqLV+AsUY0BwTTpgr9fC29fyRwF6sSr0itYBWgZNNwb6+Bxw+6JTJIYeOkVyD4FR kf5DPlELoJT63O6NQoUb4OJwuof2XT/QlGKlcnYRzcMdM80bhpbUaA6scEPtjm43RSKR pNM0iXmkrvcS89Se7iuMjJ6zihjNEaLmJfJaA7HGV00hzDkhrXeDxbF4IRVDBTkffi6s bKfN2m/tSSv3qNcEOiQfPtMiAvX0dax1e1FZO89og8LcxOWz9jLD7Y0ArKRj+aE9mJOh PjmPfcDm8qpVfwlAfhBNnIt4s+0Qdfct3719tD6dL5Y5buHa7Nr+/PfFrAJBiiNwT5RE JY0Q== X-Gm-Message-State: AOJu0Yw+hE3UkOtec9OJqDkNhtnBxVyrfdXnHpOl1SkOvEmOdJcKE7UY Jbc6IgP3EQZE2k0EYvaiqququjXzTiTG1J20fnoSMWvFdVZsrMSwsEtWQXA8gBslsWmYL9ho5A1 E X-Received: by 2002:a17:903:2343:b0:20b:8924:3a77 with SMTP id d9443c01a7336-20bfe071396mr82155675ad.26.1728141969294; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 17/20] target/arm: Pass MemOp through get_phys_addr_twostage Date: Sat, 5 Oct 2024 08:25:48 -0700 Message-ID: <20241005152551.307923-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Pass memop through get_phys_addr_twostage with its recursion with get_phys_addr_nogpc. 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, 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; - ret = get_phys_addr_nogpc(env, ptw, address, access_type, 0, result, fi); + ret = get_phys_addr_nogpc(env, ptw, address, access_type, + memop, result, fi); /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3340,8 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); - ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); + ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, + memop, result, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ @@ -3469,7 +3471,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, if (arm_feature(env, ARM_FEATURE_EL2) && !regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_space)) { return get_phys_addr_twostage(env, ptw, address, access_type, - result, fi); + memop, result, fi); } /* fall through */ From patchwork Sat Oct 5 15:25:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832986 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1256936wra; Sat, 5 Oct 2024 08:30:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUovEJWrsfYy5Zj6E/O3xlL5dMRKSRoz+6P22vDfmseipmE9KJXZy7hF/9f3Zc8KZrKEvdnAw==@linaro.org X-Google-Smtp-Source: AGHT+IFDgT2EiHeMDQRWmpXdBBp2HmiFnsfud+xGuN7SyYphwGrVoZJOKxgMS0zX/GpzYtNGcbu4 X-Received: by 2002:a05:620a:1a86:b0:7a9:d0d2:a5fc with SMTP id af79cd13be357-7ae6f43c967mr1159325285a.15.1728142259151; Sat, 05 Oct 2024 08:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142259; cv=none; d=google.com; s=arc-20240605; b=UcT6TJ9MB+EzygOJPPx53Bt1dQZTI3JSM5Tv6SIb/mnmgMNr+dhNMyQl61SVIkNvI9 kYIrPWr7ZHSt7QLgC3buSFnT8y8s+6rAGfvkzcSzg9Qm0NMCku7WYFMV4CoFNubKOi52 SikbAXtFl65xuDrDMnaAkTPH9xDpLatpYgOCcjM3gGP/GY4FohwMLTIPXoYpMONfq3j+ Od51Dhci+f6DGRZ6YDrcCbohGXayCVltQ1ZOIUYKO1cdkNnnUmLgUkjO22sdPP/LIbDu n4cdxOeurHiaGmUHT5duBaAKZ7lR64UW+kIr2pAFqrpqf1y4hEn2OGWCq1cNfQWxBaDr WOYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9tqb0TUsQOZF/sRJ8YxWqhKeQa3g/EH2JXyCvd2UdW4=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=KvQrWZQWWIEkHHz1d43HbFdzXZntqjoOyIpBDEbgs/8d7finkXATZUpnquOt/iSSsg wCkz1Ju0Oj8ere82uatYYTXx8Xmu2Y23wsAQOI5XvEsOUtmYUxnpShpHKc6X1SIyMBu5 K6Ww26nEteZkvQFtQEjLvctsRmbITCVX0Rs01yjh60mxQV/NbKGebPrWJZZq1QZ0IrPT rEQFHAyy5JK0PeDtMRsQP2easaF8MIii8Hz5iYBZrI/yfhMyzJy19KAFG+YksaJxlazu VSMlCwacbAhmfjEOUrOcmkxyWosiCwCcrSqz8b7Sr8OTSiPhVH8m7mWyF9rOz6mN4bYw urbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y2YAOQ2M; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75616880si210233785a.98.2024.10.05.08.30.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y2YAOQ2M; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fv-0002NL-Kw; Sat, 05 Oct 2024 11:26:31 -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 1sx6fe-00028o-6F for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:14 -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 1sx6fc-0002Q3-7K for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:13 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-20b93887decso25572495ad.3 for ; Sat, 05 Oct 2024 08:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141970; x=1728746770; 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=9tqb0TUsQOZF/sRJ8YxWqhKeQa3g/EH2JXyCvd2UdW4=; b=y2YAOQ2M3rfwVjP+EOOSPePWmxRMBHW1uH657FCgoy7ROq1LhmaJzs1ghCh/J3ort3 YV35cL/qbEzjFpljuHz6nghVuPykH6xfIPQ1mQw8ZL9LXYSscObyfGaWCX+SmNUk6w6t d4jL+HRo4lhJYbof1Q9Wsg0e5oFARsMDcnF4aB3t+XKs8mu1QGNdcLWJWka2HcsZ8NYi M4veyKjocwq/FrOIkDFflDwxPkN4Ccvd1dPAmOisORPaPxiLm/L2Iiqo5to9YU089RZ5 IyAe2GbW9ed/4R+3U+9SM5mNpZPMrSwMVQw/Zm2aKsoH7GgobyvmJXhRMpuDhci4cHzT WzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141970; x=1728746770; 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=9tqb0TUsQOZF/sRJ8YxWqhKeQa3g/EH2JXyCvd2UdW4=; b=TRFNORhotHzzPgQtlldw1nGOsjPZItWKvKXrD6CtUz0vK8A9zR9GWzyMGFgvp/2uCX tnZ3G+gKPnCSgmrOb8yK6BOPJfOzscwyW6uf/L3vQFW25sXPrmhHQaYuTXNSQ5wA89IR 4ow83iWO1XUIEz68dqKA3RbKXHz7Wyi+5DUXXr3G899jqlNyqfeMak5vdMlCyeshJwXD 1f1UyZjtopEf0kV2bDYYWb3E0RvRVV12SACTbT3f3D4eYYxXuIS1M9kaTlk9Y9WUHDIK g6FZOvVKKZ71+pCHzFWeoHvVLDYQRJBHvuSjoqn+g1SRciZJOYw6fcjjkCdlPmQXatCV xXew== X-Gm-Message-State: AOJu0Yyf+kWrWRYW5DhnRwCV5tbbtj2jzzBhkqbceQFpAqsOQZWpHofv La7F8QeEpoiWSjQfzQ9cJ3oml5g/YDoO1T4Mk//7ASETNC+d55MTGBLfwDJYs00kEyXdNSptNzQ c X-Received: by 2002:a17:902:d2d0:b0:20b:be06:f3d9 with SMTP id d9443c01a7336-20bfe1887c8mr91971805ad.24.1728141970334; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 18/20] target/arm: Pass MemOp to get_phys_addr_lpae Date: Sat, 5 Oct 2024 08:25:49 -0700 Message-ID: <20241005152551.307923-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Pass the value through from get_phys_addr_nogpc. 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, S1Translate *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 = env_archcpu(env); @@ -3534,7 +3535,8 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, } 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); From patchwork Sat Oct 5 15:25:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832972 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1255831wra; Sat, 5 Oct 2024 08:27:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtxArnvgy1zuYlGmPDIqsxfj+7U3Dbb9lj+h4NmAd/ipqLcOtaqVIfWAAfEt7lw8lXSNzsmw==@linaro.org X-Google-Smtp-Source: AGHT+IHtsGS4Im5ho43XCp2oFDgCrCBhDXIiG0J04HJjZ596mqaYiq8CXJTl/dhVODERaTgcW2ZZ X-Received: by 2002:a05:620a:1929:b0:7ad:832a:4063 with SMTP id af79cd13be357-7ae6f432b64mr1067967285a.7.1728142048532; Sat, 05 Oct 2024 08:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728142048; cv=none; d=google.com; s=arc-20240605; b=iTgCauaPK0bSFj4fXS0Bo/IRX/D4n6N6lmfhNNjHwyCe2KesCfXVQ0dlzYjVUpBevg PVixDoj1TVYl8Ft+xqyXXnezS8D7e1h4OUBZrpkAp/iFGNr6gQD/DS7sqFoskg5F+kMQ 4KlL+IMcenoyKRvxhqmkDmSi7+RhMVPtTjQHbzrL4FaP2NPIFUcbiEdvT+V3zZ3qwJvV Y90ETz+1NycP3LlvHti31fj6J981PPX+uvWC1nhONbObZkJocPER7sUkOrAAruCKF3ks bZua+4O8J/K8QR1iIZzDHL7KEMJ1SawqdESbmLFgg/6H0cv3LtJTMH5PjzVDIoVNvjwk couQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/ZHU/9Bj/Yhl/fLIAf9ED9KKjqQvRkGT+c+Pl2SvUJY=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=fnBwXM9AwZuHXLbCT9TrFccogHv/yf6zPz1jDPuWAVpmpnwE6YQzYFf07sWvrxRfjb 8/vQ7WbUwh8lA22rarziZSe8+kG1V8G/3HChuoLI1Ezsno4aTOOJuDYpnP70A6U+4hdx zvYfhLtgMwq2iV2JSjr9SbTd87kzBd/a7xdQo/N5QIE910o/moh9yGia/lEvnbStZ49+ kGKKxQxlEfNxIvkb/E6b+jbk8LFP74lWt2zRCpgfM+Vz8E8hdbWrrU2FFGtJgNS238kg p0AlPA3Oip4IAso6JfB5T/U0JukeMbmaIVjuT1NSdB0LzpXGOVtzB9Wxog4X/M5G5vJx RU1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbCZxWDX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7ae75661812si207071385a.259.2024.10.05.08.27.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:27:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbCZxWDX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fi-0002Br-7C; Sat, 05 Oct 2024 11:26: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 1sx6fe-00029f-OQ for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26: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 1sx6fc-0002QI-J8 for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:14 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-20ba9f3824fso24155675ad.0 for ; Sat, 05 Oct 2024 08:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141971; x=1728746771; 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=/ZHU/9Bj/Yhl/fLIAf9ED9KKjqQvRkGT+c+Pl2SvUJY=; b=NbCZxWDXl67vfNw5Ketw445FX8j/e3765S4th3nWnATFSoeU0iFpCPG2GYzm3XrV8V gij4rxIdteJBA7wmVPzqnNP9ZHKmMOUDgCC0tPkxdHxlq6fcmLSnpnRmQAkyf75lus6m wGpOYbqnosdLZ3rrL6uxV6oH8mDoqHBLO6wHejMg+pJ4tP6q97gCT2jIxUcRS62/8YSK PeAD+ldOp+SWwJFpbYHu+VRrrtA1c5l9EloFWyD5MzZFBrJIo6O07EsoIeguFgijZgjz 0Q02AupovWS9eNzThw72F1xaPhy3d2LRl2f6vMkBjWlW67xoULsI0juBfgKqrlyPDv8W L6Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141971; x=1728746771; 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=/ZHU/9Bj/Yhl/fLIAf9ED9KKjqQvRkGT+c+Pl2SvUJY=; b=eecp76kMR23tMCvjdFWBFfZcv4p/3pH2KlCAqgC/b79hKGxNh+9ZfVEfDbYKlGXyzD aMLdcqE1x32XXpfyiaK3Y38A/s5AWXZaZ8juWYH8Cv85yZNbjlZORIBkSsbwDhwESRti YcCrCq/TmF7Sb0cdn5D5iqX5RaNKkaugdhxaKTr5RN2C4WVO6caJXvR0dyBvrj2l/qlw szu17nxYkLtvyq5JmBSwYAK/ffcT/xGK78ekTL6bWDkylFy2dBr/GwgMZtwcP+kfShsg xnKJFgf03jRVU4QhI9Z5NmjTDRqhSAuaQ+Iv2gzVxn0J6KBoRWrRCaU+JTeinS4Hlc+P UNAw== X-Gm-Message-State: AOJu0Yya0hvSQrPwkIpLXm8llXtUz9WKTVovAc9RTn12+9+QdHwkiVgn drd3cm+mJ3qsznvtpR79yWAVwWRzX7UBjMCvjZUtMs9IIilnV6MPTwJD0KJcj5D/Huh1q8c8FER l X-Received: by 2002:a17:903:2b07:b0:20b:8e18:a395 with SMTP id d9443c01a7336-20bfe291f03mr89154495ad.44.1728141971365; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 19/20] target/arm: Move device detection earlier in get_phys_addr_lpae Date: Sat, 5 Oct 2024 08:25:50 -0700 Message-ID: <20241005152551.307923-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. 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, S1Translate *ptw, xn = extract64(attrs, 53, 2); result->f.prot = get_S2prot(env, ap, xn, ptw->in_s1_is_el0); } + + result->cacheattrs.is_s2_format = true; + result->cacheattrs.attrs = 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 = S2_attrs_are_device(arm_hcr_el2_eff(env), + result->cacheattrs.attrs); } else { int nse, ns = 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, S1Translate *ptw, */ result->f.prot = get_S1prot(env, mmu_idx, aarch64, ap, xn, pxn, result->f.attrs.space, out_space); + + /* Index into MAIR registers for cache attributes */ + attrindx = extract32(attrs, 2, 3); + mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; + assert(attrindx <= 7); + result->cacheattrs.is_s2_format = false; + result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); + + /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ + if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { + result->f.extra.arm.guarded = extract64(attrs, 50, 1); /* GP */ + } + device = S1_attrs_are_device(result->cacheattrs.attrs); } if (!(result->f.prot & (1 << access_type))) { @@ -2131,30 +2156,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.space = out_space; result->f.attrs.secure = arm_space_is_secure(out_space); - if (regime_is_stage2(mmu_idx)) { - result->cacheattrs.is_s2_format = true; - result->cacheattrs.attrs = 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 = S2_attrs_are_device(arm_hcr_el2_eff(env), - result->cacheattrs.attrs); - } else { - /* Index into MAIR registers for cache attributes */ - uint8_t attrindx = extract32(attrs, 2, 3); - uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; - assert(attrindx <= 7); - result->cacheattrs.is_s2_format = false; - result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); - - /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ - if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { - result->f.extra.arm.guarded = extract64(attrs, 50, 1); /* GP */ - } - device = S1_attrs_are_device(result->cacheattrs.attrs); - } - /* * Enable alignment checks on Device memory. * From patchwork Sat Oct 5 15:25:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 832970 Delivered-To: patch@linaro.org Received: by 2002:adf:8b52:0:b0:367:895a:4699 with SMTP id v18csp1255586wra; Sat, 5 Oct 2024 08:26:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVj1ke+x70O31fzCAI66z6wSRKjluJSmx8DiEVLStLpcRyldh2DRyU+j21l/VPZisot3eNN9Q==@linaro.org X-Google-Smtp-Source: AGHT+IHAsxw1Ia4cBJlzuoA4hORx5apueNt2708cERrx3+7n10CrqTj1vizotb3lhvk8qtaxUnCG X-Received: by 2002:a05:622a:1ba5:b0:458:2c22:e696 with SMTP id d75a77b69052e-45d9bb2a884mr83834051cf.56.1728141995098; Sat, 05 Oct 2024 08:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728141995; cv=none; d=google.com; s=arc-20240605; b=O2Sz9+O1WD0AgPfqn1Z9yjcCrmeRqY4L1VNYStt/76ZynX9gQoaCb8SbqnseyWHaZU R2aVZzEtUlkHpd3Zxll8N/4yKCeXP7ETLtGdgX0cclySqi1Yw2noEWp1g04C/BZiJaF6 CpT8BOF0uw0tZaWPNQKXXop1lSxm72TJ2Q3eDL1nEPNy/UBLIjMFHxqdEUGmHgf6Yh3B xmAe8GDo07Tsegn5JUlfLEqgInJ8dykdE76iGnTbDD7fjj5siN8kjQRCRzC5gfSRyoJA fmbC7Cw4W/yUT8HJwcVcQHrRqoLUxzWkFbkKXkcKFhV0DIMU6yWEI0RxUVyaaoy6qVAQ nK+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qIlBHpyIHO+kiCFyGgZVBXgacr4yw5gCrMn63zUSz3U=; fh=rQg8EQ8KH04w/0VkDYF6/ktgEyHJ2dqn1eatHCfBaLw=; b=RU1axX2j2WY/q2fZ2QYpWTNLH1x2jyFIQr29OacHdA6Axi0rVpVIMN0kTFZBGLr++J AcEjHLA6Eo0Y4gHio/L6uerK+xHbnPVS5aswZgnUiYhGIfuS9m3EZ1/tPAfwC/gHo4rm P+hdD+2RwA0wsMOgxU9nppcwnfh0biZMmDEhpiPW+UQuWn+3Xl/Ke0EHZBv/Qjb6y+uq Rt87saY02T0+VY7nz+PqnF5H6x0mGnTJ5R1rDAJ8IyPkIethOHR4w6XZV5UF7H1KqA2y PFOFcJDcTp070LQwGQoAYLMywJmRKexZCSyLmYx/9USdv2AfgOFf18J6cygC7qk/cHc1 BeXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eDMItdVM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45da74e5eacsi21406401cf.202.2024.10.05.08.26.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Oct 2024 08:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eDMItdVM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sx6fj-0002Cg-Sq; Sat, 05 Oct 2024 11:26:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sx6ff-0002AA-Hh for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:15 -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 1sx6fd-0002Qt-Jl for qemu-devel@nongnu.org; Sat, 05 Oct 2024 11:26:15 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b95359440so27109595ad.0 for ; Sat, 05 Oct 2024 08:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728141972; x=1728746772; 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=qIlBHpyIHO+kiCFyGgZVBXgacr4yw5gCrMn63zUSz3U=; b=eDMItdVME/VsMLfCoup7x9FWV5tSbBjc2rTrL3G3ZRO7H97Uwh6WV8kZY98RIWxYVz 0LQe7c9kLru7UOTrQFY7W70Or/R9UMzquKSYRy0WwJPdFtVTOf44zds9NmL9Q6xt05/f YAwFMkxdOmAiXSt/11m8K/uNVG7NTo7+HsySX2Vsc0Dlwt2UZRHDeIq3YZ9Nwreg2qT/ G98b+nQhKzYdtYuIDD/zJdwVpIr/AMwUhOxB7neBWLkpbALAPQwDBcp8slJ2tiy7nc4J BijDdZZfpr5+pp7w+w5H/o3gXS0afn0LVidyoUzcMV42KvGFhuNr8XlDz0UGcx7pKK// y93Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728141972; x=1728746772; 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=qIlBHpyIHO+kiCFyGgZVBXgacr4yw5gCrMn63zUSz3U=; b=YDan9tVefdTHkpPZDIeXV7XSC8RtDZnpw6FNTD3sbaMUMGd+tnsmlFGBEmn8CmuqjV kqEJigEZQLrtzNviyNTelYUmrciprEfObQ5jhuEB7tnL87LRZGfvoRXfuHUbUazIM7t9 d7/wRtsbiUqTLqvL7huzZ7XeEcZerKTeJyEk8/uj+DasEAQKT7EArYdaM8ewOHJkz3pS XP2/SvF3EbiGDNTrHt2ikDjRbQwHNUM2lW2gp6KGhrC7oNpHSlsPOxEBZDD2oMqhz9UF fQ1GLW0/jlACzD3yF1p09KKyrehhgOAQ9sKf8J4MIz1dvFhsv7V1tye8L/Zv0UMeipz1 hVtw== X-Gm-Message-State: AOJu0YyTqW26ldEfwVbeSvCik+YYB4fvVAt+pxVtNEI/CuqE1uSCbyyA IhGOUf0/EvINS+hkrBUoDMQJGjNxFJ5xk6icS4jwrjc5I/tKf0mO3qxR0vWcxa4R3AfeHwYEYdF t X-Received: by 2002:a17:902:d2d1:b0:20b:9547:9b2d with SMTP id d9443c01a7336-20bfde55510mr91868295ad.2.1728141972285; Sat, 05 Oct 2024 08:26: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-20c1396948dsm14351765ad.225.2024.10.05.08.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 08:26: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 Subject: [PATCH 20/20] target/arm: Fix alignment fault priority in get_phys_addr_lpae Date: Sat, 5 Oct 2024 08:25:51 -0700 Message-ID: <20241005152551.307923-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005152551.307923-1-richard.henderson@linaro.org> References: <20241005152551.307923-1-richard.henderson@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 49 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 0a1a820362..50aa5e338c 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2129,6 +2129,34 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, device = S1_attrs_are_device(result->cacheattrs.attrs); } + /* + * 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. + * + * 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 = memop_atomicity_bits(memop); + if (address & ((1 << a_bits) - 1)) { + fi->type = ARMFault_Alignment; + goto do_fault; + } + result->f.tlb_fill_flags = TLB_CHECK_ALIGNED; + } else { + result->f.tlb_fill_flags = 0; + } + if (!(result->f.prot & (1 << access_type))) { fi->type = ARMFault_Permission; goto do_fault; @@ -2156,27 +2184,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.space = out_space; result->f.attrs.secure = arm_space_is_secure(out_space); - /* - * 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 |= 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