From nobody Sat Nov 23 23:53:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1728432366; cv=none; d=zohomail.com; s=zohoarc; b=iz0z96oK1WGX76CZ2+YzHfctpVKKmKGrtkeWWg9dlTdyvDIKIgObWj1YsjLOoN5Hy1V6KGKnJ7iX9hKzsC3aSWqwMpW+BxOtoDbMBljODwh2Q75qk7eG/fgkm2KPoIZ5jYh+7AnPUHr9e8QI7SZBsMDQZjAfcwd87mbTIemVLXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728432366; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=L6Kx1xZE0GtMcEU2O8ea1zr86nztTNOhfHDg8U1azQVwAcxQyK7Iz6wb7xw9vZi1SMoM+oG9RtcII+MBCR3exvfyHhJRkmqNRXmgIw1FOaBKf5HO+Ef/yMvTQvKFDJIZqZb1JcEU5ln7Tc0YFhUXdQ53+rgdJJoHOTwUMV9mLQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728432366416992.6278172317507; Tue, 8 Oct 2024 17:06:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCT-0004Lo-Vo; Tue, 08 Oct 2024 20:05:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syKCQ-0004HI-Td for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:06 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCO-0002nt-R7 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:06 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b49ee353cso58170055ad.2 for ; Tue, 08 Oct 2024 17:05:04 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432303; x=1729037103; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=vxSzVVqeKiEtpkgnsEzyp53JDmmebK62JIP6+ye7ruN0cRnveuXcbPeqSnlR30qXgP YxdpRhZqkKKxnc0lsXkXaPGwZKRSHcKOVEzMDBiCkpHForCKCimsq0bFuc29M/ZC4za1 OJnrgSKvtpBR6tuT+PELxBN5SeX9YswGfl3bhS4AJy0JpPfK/9SGiCCAmI/kghx7gIzQ 6xjvebnXS+/Ocg6kxIl9KdH75JJn/Gn4saqa+wnB63DjYAAjJtR+GeY9dKE4xf4oTNUO CoRNMEAA8t7CCUEoLOcOTcr4ztHNUjsl38vnmoio4YmGHu0s4wcR3NS0DIiGzR5txpcB xh6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432303; x=1729037103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jvwlrMz3Fk2P5q43/JWG8Wh7xLnVWB9wP6XAmMUyGN8=; b=apEaePGClXcPENwePxgnEOSTDX8mxET7ziVI4zGfGUdlEHkfNJcAFyMkOJ/tmXZGxk tNfu9ON1VERAHUG3hl3oF6uZWojn/se1Ac0rmz9YsAWfELM8TO/PleSR2pqebH59NKh2 QXMcqOm5RAyd1k68Z4VH58Fs0tGqSUd8Yo49kOirj+KvrsZVT534L+vbUCgJt610XZ90 3vRLOiAVK0UyQMdcwC9q9fqWblw7fi8eunmZ12sUuz/GJZmHQobPiScm4OkFpSmBaQZN B12P1j8ZxZHx3q68bOcesSV0LFJqjRpGgkY5B15/L+MnIdrn2MMoyxzN4nVA1pzvllO7 nzQQ== X-Gm-Message-State: AOJu0Yw/slmfnzedW5ftQMoYQukQjNZtnirwqkiEVJSbGRrSLRcmqRAS IyzanmKOZx1yMBYGGCjpikSvyQw4BsQ/EpZ3P5CUTzXmZ5X49ql0MS/EXmVrxzoL2wmCmSDfXPk O X-Google-Smtp-Source: AGHT+IEQN3Rl72pcmgLCTKgbIcOtLba1v+GzwtpoC9AF0fnEDdxLNrxqZqv2s5T7uD+5Iv4bbg/olQ== X-Received: by 2002:a17:903:2289:b0:20c:5263:247a with SMTP id d9443c01a7336-20c637809c9mr15713945ad.38.1728432303433; Tue, 08 Oct 2024 17:05:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller Subject: [PATCH v3 08/20] target/hppa: Perform access rights before protection id check Date: Tue, 8 Oct 2024 17:04:41 -0700 Message-ID: <20241009000453.315652-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728432367155116600 Content-Type: text/plain; charset="utf-8" In Chapter 5, Interruptions, the group 3 exceptions lists "Data memory access rights trap" in priority order ahead of "Data memory protection ID trap". Swap these checks in hppa_get_physical_address. Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index a386c80fa4..f027c494e2 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -267,6 +267,12 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr= addr, int mmu_idx, goto egress; } =20 + if (unlikely(!(prot & type))) { + /* Not allowed -- Inst/Data Memory Access Rights Fault. */ + ret =3D (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; + goto egress; + } + /* access_id =3D=3D 0 means public page and no check is performed */ if (ent->access_id && MMU_IDX_TO_P(mmu_idx)) { int access_prot =3D (hppa_is_pa20(env) @@ -281,12 +287,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr= addr, int mmu_idx, prot &=3D access_prot; } =20 - if (unlikely(!(prot & type))) { - /* Not allowed -- Inst/Data Memory Access Rights Fault. */ - ret =3D (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; - goto egress; - } - /* * In priority order, check for conditions which raise faults. * Remove PROT bits that cover the condition we want to check, --=20 2.43.0