From patchwork Sat Oct 5 15:25:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Philippe Mathieu-Daudé --- 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) { /*