From patchwork Tue Jul 23 20:38:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 813985 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp2489809wro; Tue, 23 Jul 2024 13:43:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVADsJXu0a16GEmyyW0nChB9OwegmrTnwEiFiShzi9yII60o7P/veYWP6Wqm3CTryQRAc4YUwNInkDS0dJkZTiC X-Google-Smtp-Source: AGHT+IGfOZvhPgPqQotOnkKiuizDDU/X16hK3J4rHDm+l/hJYSk9jvp/FF6N8tm8AuaFxtkZRyzx X-Received: by 2002:a05:6214:d0d:b0:6b7:9a8a:2feb with SMTP id 6a1803df08f44-6b990778f81mr556096d6.26.1721767385055; Tue, 23 Jul 2024 13:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721767385; cv=none; d=google.com; s=arc-20160816; b=RHjuj1VF2EtIQPuo69g7ARCCMH2IvXc3Ej/+MYtKwu1jiCUoho7cXDd+GSJWbR1DO/ QgDKmDTHIj3DrhRrhu/OLi4wIYGYXHPR83dZciqEVCqOlZaywJL9lYDw2CTY81uDXhkp n/h6YKRkGzqGnQhaVTCJG310D8foCuT2f/JPv2swQ7gKN/28DKXhPEj6ONCKulV7YXN3 nRNb+/e++9zKNJiZU59dIHglIL3Ro+9E2YhYsvQmB3hcdu9QDLtX/dDDhwf4H8I7YNtr u0KqdFjEfkiPK/DvDoqwvqyyN8wT3pC6AFr94GxjqPIlCxjVnJYslIuY/I9q7HeJBURo TsKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=pqhDz9jkzJVJQG2tzSqklstnX2oao7JbXMBXUDlT2s0=; fh=2T+KfhuSLAapjLkuIGm4M/wQO1FbRA2dukK4EuTVnoI=; b=LGqmmH9qqkxfyTLlBL2IRMymTFPM6JaFAZPtqVW8Tbiz/jKIsbVzpZ14pXdz7f/OvL ggE3Wddtz58GPFxG6qV+8Obu/pDZA5Ed+eZkclzidjREfTfMH+SSzCUEeLOGbGab1WsO t4BPN+HhXe8EZEFef0UpqI3vP29r0A6qHoCXICf7/HRuHk/zRUb/0p4LeEn+Hd/K3QZw eLLf5Bbavo27YKmg+xpCKyH7naX17WREepAdmo2/UKY7j7IF/wV3MXDizpZbNMWpnRtD SlpJKHhr9YLpPi1oWC/kO6XanPnAh9Eu+HvI5rJgmS/mG9wNgnkFJC0cT+4w7dmCw0MD qLUA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lhQpAjNp; 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-6b7acae19d8si105172086d6.409.2024.07.23.13.43.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2024 13:43:05 -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=lhQpAjNp; 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 1sWMJG-0000fE-4c; Tue, 23 Jul 2024 16:40:34 -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 1sWMJ2-00080B-Vl for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:40:21 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWMJ0-0004GF-QC for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:40:20 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-369cb9f086aso2071619f8f.0 for ; Tue, 23 Jul 2024 13:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721767217; x=1722372017; 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=pqhDz9jkzJVJQG2tzSqklstnX2oao7JbXMBXUDlT2s0=; b=lhQpAjNpUj2d8fkr0XCwzjRhteDtmS3dEbYCxXIodEx/hN3cTer2VzlJKVr5ySllq8 LD5Vr+Kfy508M0YQ5UurQV7s7dAVcHEgQcNbjxz0VVpU405GWXm2/ORNpGx1ul7VBJJX +zUCAUZxaxI5sS09jdC/xWIDwly+7j16orA2GBDO4H4+FNjQnr6bx7rrjecUDpvN6F5e MIK+Ju0HP+wfL79k5yaSg6FpWuX7cITKTAJ8Fxg2Lp7TEaJJnJjsQPf7uURcIYLdXQwQ F+JUqJAmhAZT94+oKRp+lhdICq3VQSLdZmuPAFK4E1tATlnHDGYHrb94Yv+700cl4oJq Bbaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721767217; x=1722372017; 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=pqhDz9jkzJVJQG2tzSqklstnX2oao7JbXMBXUDlT2s0=; b=vwzMc1p+s4p8wqeRPRXE38hZ/XS5XbTBhxDapumK/BSm6StvvltAHEcEX19BuuMUCa DQm9oL8tUuq3WKhTNqnrUdjPema1sGd12D6wptKL+6JCJUWGdGp/RNqm84fv3xcYmRWv psfgI0WWX8iv2gm/nim7bHy5mHIJbSxYDU4Xskn1DkfSFQ57K3HKFUp7i+2BlEen0m27 jSP55iDfjtrqoxgo+1jbdizxLnN9PNehCxMd41lUmIsog1tdrPs+FMcSzrTDOXLTa+A9 FZO4uqe7vEmlacCzJGjjf1+q6OzGdafVTtx5QN9X6AGF8xroQVifdQqEL2f8DM/5AgXT TYPA== X-Gm-Message-State: AOJu0YyxBDyy/UtRtfY0Fpm6/NYkZ+WMApb8owV9IklYqeLctf2OF+rA 78BZXXNwdZSR8SR+Z4WlRIdXH7sVFRHHtN5O5gtVhgVoLtGicVMUvq5TtvGaHnkvN/ELSSInk5c pZKc= X-Received: by 2002:adf:f38c:0:b0:367:402f:805b with SMTP id ffacd0b85a97d-369f5af631amr43652f8f.2.1721767217092; Tue, 23 Jul 2024 13:40:17 -0700 (PDT) Received: from localhost.localdomain (vbo91-h01-176-184-50-4.dsl.sta.abo.bbox.fr. [176.184.50.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427ef3f4665sm25877335e9.0.2024.07.23.13.40.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jul 2024 13:40:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Yao Xingtao , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 14/28] sparc/ldst_helper: make range overlap check more readable Date: Tue, 23 Jul 2024 22:38:41 +0200 Message-ID: <20240723203855.65033-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240723203855.65033-1-philmd@linaro.org> References: <20240723203855.65033-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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 From: Yao Xingtao use ranges_overlap() instead of open-coding the overlap check to improve the readability of the code. Signed-off-by: Yao Xingtao Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240722040742.11513-9-yaoxt.fnst@fujitsu.com> Signed-off-by: Philippe Mathieu-Daudé --- target/sparc/ldst_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 2d48e98bf46..d92c9f15934 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/range.h" #include "cpu.h" #include "tcg/tcg.h" #include "exec/helper-proto.h" @@ -240,9 +241,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb, if (new_ctx == ctx) { uint64_t vaddr = tlb[i].tag & ~0x1fffULL; uint64_t size = 8192ULL << 3 * TTE_PGSIZE(tlb[i].tte); - if (new_vaddr == vaddr - || (new_vaddr < vaddr + size - && vaddr < new_vaddr + new_size)) { + if (ranges_overlap(new_vaddr, new_size, vaddr, size)) { DPRINTF_MMU("auto demap entry [%d] %lx->%lx\n", i, vaddr, new_vaddr); replace_tlb_entry(&tlb[i], tlb_tag, tlb_tte, env1);