From patchwork Fri May 10 15:19:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163885 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp2536874ilr; Fri, 10 May 2019 08:41:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwE0dw8PDyFJlByATiN9pMQEN4B9sOzWg9MuEJa0UcHdUrLhDDXS1EpzIC8QSO1lezI4qR6 X-Received: by 2002:a50:b78b:: with SMTP id h11mr11669482ede.134.1557502860872; Fri, 10 May 2019 08:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557502860; cv=none; d=google.com; s=arc-20160816; b=RPvwQJa5N/V9Jh9H29IEaYGu2Wfl8eT92UpEk9EckY++yDhbF/0ArDlI7bXmFq3m7a d75Z8eUa7L7SU9k0bvtCFToPriypwhUP7eYfq4PB6ymyl6rd40iFepWBOReJIigy4YGW 2B3ZbV9jZ8V2w4LO9yVf4IeZANA9yxno04qa9RQSGz6KnNLds5fTxykDUx3WLJKeFyww KfyTIdhIYvIGs/ui28teVGcdhBEdEMt6XXEMvWgMQ9dC/nrRprMQtcQDmSnJ1LNloZ4+ eDIwmCqsQV5QI/uNqYxq49S2qBka9OZU9ZAWajhW2cuL5IIUcJRN7tzRU6fugY9B9KNQ GLhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=ZTH91pjxahUuQtOu1GsBhTY4d5CvJ+Jx8ktGJV35Xwc=; b=00Lu2wxAzeJ4Fd8CZ1GO3RldC6lVdm1eBjEN1AyTzbVNd0p0qvb91lNYOIovYp+mB/ xVYPkKCCL0AAAkXY7XAbPp8hDqzTocOLIYV/1pzQNN0FGpuE58TZFZA6RQ/YehizRgrj 4J+zlD1kzAdxAHAHYu7Yti/d5emAEcocivePlpro7DlJ08ySzAzK0R2dYJQ/7wKupUz+ DoH3JqkvpGU0aeU9GoVjPUfP5U5WLgTq7+TVDl5Q++HWE/iTtc6tMyHMmrkKN5jQNxsA ce1RBrM+7rzfKK7tGQONdVztZ+yZCN6CAHJsQF8pXw35xsSwgIYgXnDE/mBVNHvNV5FR Uwxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=joA0AKXM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m11si4115994eds.32.2019.05.10.08.41.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 10 May 2019 08:41: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=fail header.i=@linaro.org header.s=google header.b=joA0AKXM; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:45293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7dr-0002Qp-Ol for patch@linaro.org; Fri, 10 May 2019 11:40:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP7Ja-0007ZR-UZ for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP7JZ-0008TR-UA for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:02 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:33570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hP7JZ-0008T0-OK for qemu-devel@nongnu.org; Fri, 10 May 2019 11:20:01 -0400 Received: by mail-pl1-x642.google.com with SMTP id y3so2996738plp.0 for ; Fri, 10 May 2019 08:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZTH91pjxahUuQtOu1GsBhTY4d5CvJ+Jx8ktGJV35Xwc=; b=joA0AKXMyY3BQHcLx+GIcFgwz5GAZXfeA6hScCTEGYm+l8g/J3oJ/9zSx4nkGZhpNP VMwK5+W80PXW/S5ibRy8IsqlAhRkXqiIJpdg62esSFrhEh4A2i3WnT8dmSg7XXxd1+bD RzRYknUv8/4TW/bJ0Mc84KniF17SsHKY0BuE0OI54cEkYrrMQo7bRrAOtG8xbv6kEzjW VrLTDb9VS2l17s3Gm+P35XC6xLzDAswPgLTxkEat1EgWdltbEHr2RVAUehQKHjkPUq61 gng319gUdWUGrPkGtLaMN0a/Oef/AxSGXZ3cx/KrUPNssnnCkS5dnmITL77q18WiNH3P HXAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZTH91pjxahUuQtOu1GsBhTY4d5CvJ+Jx8ktGJV35Xwc=; b=Zp9D8pGgkoXZJaRp/y7lixzK58AT8C5j8/uiCo6PaZ4Po7qu02XIJD1K6vPO+zPPe6 wHFDTv3svmuexvvpyiGbMqlDLlMXUnaAkYPrxzHF38oYmQ6Z9gXQoUJfDnDACReoJJR8 Ox5uIo0iKA4rp9Q1FPA2haraCjV5ApJ3grzRvlH6s0KMJB+/Y5r2AjXqxA4u1C+7ViIb 759MT0THBLYtINmrYOTXLXhtwcGxsz34Tc3dPrphSvPnvLEDhLKIOvUlyyMlCumi2p2N 8uMhi7EXop8qC5AcUdQeorjEEjaw3ECBwv04PhROFDTybpmO8JFVNy7RV75A1n6RGp0W 7E5A== X-Gm-Message-State: APjAAAVzjGNUTYs4zETs19e0BvWvo4R7QBj8k1qFe3+bd09MAaPM2N0a lnTNftYVyS1Pm+0L4cbYHhgZ+6SikZU= X-Received: by 2002:a17:902:7883:: with SMTP id q3mr13718857pll.60.1557501600552; Fri, 10 May 2019 08:20:00 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id 19sm5920517pgz.24.2019.05.10.08.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 08:19:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 08:19:28 -0700 Message-Id: <20190510151944.22981-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510151944.22981-1-richard.henderson@linaro.org> References: <20190510151944.22981-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PULL 11/27] target/mips: Tidy control flow in mips_cpu_handle_mmu_fault X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since the only non-negative TLBRET_* value is TLBRET_MATCH, the subsequent test for ret < 0 is useless. Use early return to allow subsequent blocks to be unindented. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/mips/helper.c | 54 ++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) -- 2.17.1 diff --git a/target/mips/helper.c b/target/mips/helper.c index cc7be7703a..86e622efb8 100644 --- a/target/mips/helper.c +++ b/target/mips/helper.c @@ -915,41 +915,35 @@ int mips_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, tlb_set_page(cs, address & TARGET_PAGE_MASK, physical & TARGET_PAGE_MASK, prot | PAGE_EXEC, mmu_idx, TARGET_PAGE_SIZE); - ret = 0; - } else if (ret < 0) -#endif - { -#if !defined(CONFIG_USER_ONLY) + return 0; + } #if !defined(TARGET_MIPS64) - if ((ret == TLBRET_NOMATCH) && (env->tlb->nb_tlb > 1)) { - /* - * Memory reads during hardware page table walking are performed - * as if they were kernel-mode load instructions. - */ - int mode = (env->hflags & MIPS_HFLAG_KSU); - bool ret_walker; - env->hflags &= ~MIPS_HFLAG_KSU; - ret_walker = page_table_walk_refill(env, address, rw, mmu_idx); - env->hflags |= mode; - if (ret_walker) { - ret = get_physical_address(env, &physical, &prot, - address, rw, access_type, mmu_idx); - if (ret == TLBRET_MATCH) { - tlb_set_page(cs, address & TARGET_PAGE_MASK, - physical & TARGET_PAGE_MASK, prot | PAGE_EXEC, - mmu_idx, TARGET_PAGE_SIZE); - ret = 0; - return ret; - } + if ((ret == TLBRET_NOMATCH) && (env->tlb->nb_tlb > 1)) { + /* + * Memory reads during hardware page table walking are performed + * as if they were kernel-mode load instructions. + */ + int mode = (env->hflags & MIPS_HFLAG_KSU); + bool ret_walker; + env->hflags &= ~MIPS_HFLAG_KSU; + ret_walker = page_table_walk_refill(env, address, rw, mmu_idx); + env->hflags |= mode; + if (ret_walker) { + ret = get_physical_address(env, &physical, &prot, + address, rw, access_type, mmu_idx); + if (ret == TLBRET_MATCH) { + tlb_set_page(cs, address & TARGET_PAGE_MASK, + physical & TARGET_PAGE_MASK, prot | PAGE_EXEC, + mmu_idx, TARGET_PAGE_SIZE); + return 0; } } -#endif -#endif - raise_mmu_exception(env, address, rw, ret); - ret = 1; } +#endif +#endif - return ret; + raise_mmu_exception(env, address, rw, ret); + return 1; } #if !defined(CONFIG_USER_ONLY)