From patchwork Wed Oct 9 00:04:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833826 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp556225wrv; Tue, 8 Oct 2024 17:07:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWataVHkvrEfuX/1xPJI6I/UMJF5dP921nSNTDCrbTWOdW00+hMdm9iX+mmmAStZXR5rlBErQ==@linaro.org X-Google-Smtp-Source: AGHT+IGz4UfKQEfX+LNe6kypJAoMwRr7YW0JWyQscJ+JWb4gFg+nYfxsfYFza0clSSiGj1ussnT+ X-Received: by 2002:a05:622a:2990:b0:458:34b4:7cd with SMTP id d75a77b69052e-45fb0e77a72mr9232211cf.58.1728432447735; Tue, 08 Oct 2024 17:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728432447; cv=none; d=google.com; s=arc-20240605; b=CJgROoIc0I/Lib5crLJWziDUpG+13cfbgvdEoRQNacI/0s+/NOu8LwLoLeOXPe8yOd DyCQPZQV1Q6cC2LvuShbFyruvPFTNYUAof9VeS8neS0LzmlLIlF9Jl+ipYF1rzqssWyR ZnoTH9EcURISvxRklDDdG6ML9sMK5QS2vgzwy1EPUhJ8aB/9Qg9k9KHsa5InvgFdPWUM 7eoXljDjvgScE0K4Vr+2VXyKHpWbhaN7mxlzBG+AAnE4WyKuxIgCsJ8/eB8nhym8F5Yk AhUp1GXKOyQIrKQJaDFPN8pP3WDCNLr5cs9l2WGlvbk0AiEH/zEK1ZGP6gw0IvImTp45 CCHw== 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=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; fh=3RK8noKPsRgJpwHDkrKY6p9N6ePZuLOt1ZjdS1VodvU=; b=VTJVb2nqqFZapvZMiJ9FVEUPBN61H3nSnIdSzvr7ZhQGvSlD1HfdF1qj4UJ7uz5D/3 9BsJP+WWBEX2ScsbeV7R1N78g9oATDnW0DooF54+p79GC28ozDqFs1SvIIGt2+iSdP1e zK+8nFR8/Ck0EwVsfNM01QBx6rbAcZJaM5gBo+n1r+Ht3QwU3lq/TdIlJ16CJYDecSe9 cQP4wcmvNA79AUTZfMvTIBIz7EAdmfn5gfeshPH/c55fR+gRCiCK1XDEgWU4hW4O65Av qk846smXKIdeP+Ry5WMU7AG47DENZemtFCRLC8+7g+Pdg2WgxI1Wn+Y+RoaSPvtQ7qPz /Aiw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QG1nPvj4; 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-45da76c7dddsi102482591cf.674.2024.10.08.17.07.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 17:07:27 -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=QG1nPvj4; 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 1syKCW-0004NT-7X; Tue, 08 Oct 2024 20:05:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syKCS-0004Ik-A0 for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:08 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCP-0002rr-UR for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:07 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20b0b2528d8so70928005ad.2 for ; Tue, 08 Oct 2024 17:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432304; x=1729037104; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; b=QG1nPvj4zfH7GnQRIAAQz9SpYqyAdJ5/aBqi8aSG/EaefoDDj7yWs6OFacxEwDP2ai tR9ershpLoFZxu1NkILKtVfj1X1cK/T7SAcI+2kziJOwd3MG4YFOxbWIL0ZqK5djDCes ewTgma/GjFGN9TU2gOwg9GXTR9tc1z/RJS2Szt5So7YMTsMcLDvIzsUsDEK0NTz3UtVC 7N1NpBwFwNUTP6wE7lYy11M/FkSVYFVuv9VjCbzuNpLbFMCIDkuTQvGxdBBE0PS4iQcY obsNdtMY5tQmOEMwkAI+cO2Z/jD7wmN+0YJtxPurj3FYEU4tKbiEFCwPKfTrv0NY+hC0 ANzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432304; x=1729037104; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8E2Z9ZSy95UZsg9Y2N2fIiaRxpU5aj12TR1V9ijHxjM=; b=ldLWUMJUO713iHwXJsTuem63Z3i1WbTRU02hS68egDcRUZCHQVWlDixrxMfnZdN7tM YnnY6tnoVIjc66bedybeAwHhch0OrBw4emSX2cP0eEHSh1hnBYEf5F4W9Iq0JNIQOK44 VGui7wU/+cWokYCwx1ny8AtjL+nqvkmdU5y82y7sedBd8mXM0QQamQtjLfmI8lyVNSH3 2dRLT+zB9aWR8zTxLNBRoqmaxXjcy/y6oAnUrvPqplFb2nu3PPlDTgMeM4lxjIUkHrA+ GUSYaU1aiVF0DiYyMMvw3FF4qyU0V1Gq5jVhfDr8j7gSggc12Z1ZYz/SLuEvuRctv28D fZBA== X-Gm-Message-State: AOJu0YyIfQsxlApBeXxlzJRMk9bp5hiZMEdwbO4h9R8H1IAI/J7S2h5Y ouvRSjufYMRN+G+MtxwRRVyYjZyU6uiy8YqWsmHgXpIN7oj5+VoLbEdO1kpA5Om3l4PFb15k8et Q X-Received: by 2002:a17:902:dac7:b0:206:fd9d:b88d with SMTP id d9443c01a7336-20c637986d4mr11253965ad.61.1728432304454; Tue, 08 Oct 2024 17:05:04 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cecf2sm60705105ad.104.2024.10.08.17.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org, Helge Deller , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/20] target/hppa: Fix priority of T, D, and B page faults Date: Tue, 8 Oct 2024 17:04:42 -0700 Message-ID: <20241009000453.315652-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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. Fixes: d8bc1381250 ("target/hppa: Implement PSW_X") Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daudé 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) { /*