From patchwork Fri Jul 19 21:03:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 169273 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4324579ilk; Fri, 19 Jul 2019 14:05:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsLMUnYDwppCqw2gOrxaE9Zn0txW5jzBee2leYgj8ziRHCukxsnySCjjoPSjTcRwpcj1bZ X-Received: by 2002:a17:906:6bc4:: with SMTP id t4mr43958808ejs.256.1563570319272; Fri, 19 Jul 2019 14:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563570319; cv=none; d=google.com; s=arc-20160816; b=FI3N0hcjgOfNla08I24LlivcPhZOeh3dAznir1S5eH6qzvMdRA3i2x52ylwVlPKq8L 4fbVQ4qClZ4bO27dZNDEE0+irvsFEIkqjmr9LR38nhy8JZP4qcuVdDwXUJBTHFd0hWDp 08C1OTv98nKW7MM9aOH6Q9Jgkd1Iw9jonJUtGFJMrhiAUc7dDqCY4qlVLTFJKp3RoFAQ Icavfx0VxUM8mneG+fsWpfAWYH3QfP9Xbu7NBz7ZMHUuLad7DNQOaK+Y4ZA4/d8EMXrG ETdxDdTH2/iF/kicdnN58CVJidHuvhQbbh3Hi/pWtjCspAUfY9YDki0uwOeq6DWJkqdx bu0w== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=bac4HlG+GhgCvK1k1tbO834GKZB7uCzaXoyKitScQ6E=; b=W40lNMvW7y0I9zQxtqjRZ+xVtu6I5zrtSvz3OSaBV+Ohc+e0tAtA/6POB3hmudz68X EgBVemKUuvCqgQCCMvP7ZrnLgEfhgW+SVVkyAxAD0oc52/hlof0jgZu8dNuHn68734YI eWNQ3dCvF0/lQsKx7eJiaClrba3mmrfVjxiXBydlgaz4G0DktfEttxDoyXl9MVjrR29H XVoe18qUA7kikLn952BHceS9E2WI8a1B53GPdT9m6rok9TTN7G0C1C4+PAsaon7CSLyO 0P2mzQOn5Hi+RiEzupNNWcUKafKxjVT/BEEinTl8VtB5KDaXoWjCbKAs8nqab8FFd8LM YMkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MQ5wekzR; 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 c17si814430eds.77.2019.07.19.14.05.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jul 2019 14:05:19 -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=MQ5wekzR; 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 ([::1]:48184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa45-0001S7-JM for patch@linaro.org; Fri, 19 Jul 2019 17:05:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55036) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa3P-0007OC-AJ for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:04:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoa3G-0005Qb-8S for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:04:31 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43905) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hoa34-0005A3-Ku for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:04:14 -0400 Received: by mail-pg1-x542.google.com with SMTP id f25so14961722pgv.10 for ; Fri, 19 Jul 2019 14:03:45 -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; bh=bac4HlG+GhgCvK1k1tbO834GKZB7uCzaXoyKitScQ6E=; b=MQ5wekzRq98FXeVHb4/hyGN9D0wgON4UDJTqCRfGtYpW5UEnZlAcwUqKg4CD16QK2N PQjlBbvJNM9sLRU9SPtLQdRBkIg+yJT4NkZX+eiT1vHNywNl+ZW/P+k0MzRyG1j1GpNa N9MuUyDSUN4m2fExZTq3zJP/0NsfdC/tOm4SNo8ZZ00iodV1pQqQHKnXCizqpfAHi17F E8TiILrOkQmf7r5CaTz+svhMJomY6G+YSaKXOJ1I2S35BnJOh4K1xuB62ink1xr3/CSX CFuJrS4hWjnfJi6SK++OjytYiF9+TK5utwDr0CBUALf+4P5QWSogVl3Vpd6Y8vS0jg42 FrDQ== 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; bh=bac4HlG+GhgCvK1k1tbO834GKZB7uCzaXoyKitScQ6E=; b=UWPvSQgxOzZcpyqigru8hywjBzn+f0s68opqxRl04ZpYLmLYEzh51HcWTXXYDkXce2 fpv+zakU1mOVbek9FBAP8oC77MWLBFMdQtmnF4qjF+59gG3NKNUdqUxBXJDjM3Vllbre hirIGR6a/jZ/zLQKDV/q3mhU9b98QUINdS2CQ09bWWxT9ZHWrZl1RoU/07p2mOy1jcAS DuaKPBYwLCqDU+CWY3i4s7BsX2Aw8VjTVx4eiGtnCu/17irLll4f1aC4t+dQdcnT0CaS MvYfRKqUkKfNAqb6bhSoxBpOSZFoOnZhKxDPzyTm5y0BebozYz5uDOSKs6oj9X4GwY7P QDYw== X-Gm-Message-State: APjAAAUCaHwucP2k/+JptNbwtNk+igEIzi9WnvjN1ducaWvQ/C0r82IG lVUf2U6wlw73Ai0U2rLgUGvW1vB6eno= X-Received: by 2002:a65:64c6:: with SMTP id t6mr57167694pgv.323.1563570224614; Fri, 19 Jul 2019 14:03:44 -0700 (PDT) Received: from localhost.localdomain (97-126-117-207.tukw.qwest.net. [97.126.117.207]) by smtp.gmail.com with ESMTPSA id i6sm32724751pgi.40.2019.07.19.14.03.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 14:03:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Jul 2019 14:03:16 -0700 Message-Id: <20190719210326.15466-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190719210326.15466-1-richard.henderson@linaro.org> References: <20190719210326.15466-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH for-4.2 14/24] target/arm: Simplify tlb_force_broadcast alternatives X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, beata.michalska@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rather than call to a separate function and re-compute any parameters for the flush, simply use the correct flush function directly. Signed-off-by: Richard Henderson --- target/arm/helper.c | 52 +++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 28 deletions(-) -- 2.17.1 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index 7adbf51479..2b95fc763f 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -626,56 +626,54 @@ static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { /* Invalidate all (TLBIALL) */ - ARMCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); if (tlb_force_broadcast(env)) { - tlbiall_is_write(env, NULL, value); - return; + tlb_flush_all_cpus_synced(cs); + } else { + tlb_flush(cs); } - - tlb_flush(CPU(cpu)); } static void tlbimva_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { /* Invalidate single TLB entry by MVA and ASID (TLBIMVA) */ - ARMCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); + value &= TARGET_PAGE_MASK; if (tlb_force_broadcast(env)) { - tlbimva_is_write(env, NULL, value); - return; + tlb_flush_page_all_cpus_synced(cs, value); + } else { + tlb_flush_page(cs, value); } - - tlb_flush_page(CPU(cpu), value & TARGET_PAGE_MASK); } static void tlbiasid_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { /* Invalidate by ASID (TLBIASID) */ - ARMCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); if (tlb_force_broadcast(env)) { - tlbiasid_is_write(env, NULL, value); - return; + tlb_flush_all_cpus_synced(cs); + } else { + tlb_flush(cs); } - - tlb_flush(CPU(cpu)); } static void tlbimvaa_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { /* Invalidate single entry by MVA, all ASIDs (TLBIMVAA) */ - ARMCPU *cpu = env_archcpu(env); + CPUState *cs = env_cpu(env); + value &= TARGET_PAGE_MASK; if (tlb_force_broadcast(env)) { - tlbimvaa_is_write(env, NULL, value); - return; + tlb_flush_page_all_cpus_synced(cs, value); + } else { + tlb_flush_page(cs, value); } - - tlb_flush_page(CPU(cpu), value & TARGET_PAGE_MASK); } static void tlbiall_nsnh_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -3926,11 +3924,10 @@ static void tlbi_aa64_vmalle1_write(CPUARMState *env, const ARMCPRegInfo *ri, int mask = vae1_tlbmask(env); if (tlb_force_broadcast(env)) { - tlbi_aa64_vmalle1is_write(env, NULL, value); - return; + tlb_flush_by_mmuidx_all_cpus_synced(cs, mask); + } else { + tlb_flush_by_mmuidx(cs, mask); } - - tlb_flush_by_mmuidx(cs, mask); } static int vmalle1_tlbmask(CPUARMState *env) @@ -4052,11 +4049,10 @@ static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t pageaddr = sextract64(value << 12, 0, 56); if (tlb_force_broadcast(env)) { - tlbi_aa64_vae1is_write(env, NULL, value); - return; + tlb_flush_page_by_mmuidx_all_cpus_synced(cs, pageaddr, mask); + } else { + tlb_flush_page_by_mmuidx(cs, pageaddr, mask); } - - tlb_flush_page_by_mmuidx(cs, pageaddr, mask); } static void tlbi_aa64_vae2is_write(CPUARMState *env, const ARMCPRegInfo *ri,