From patchwork Wed Jul 31 20:37:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170260 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4477442ile; Wed, 31 Jul 2019 13:47:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8dd0xzGW821+S4LHKw9TmZ/QyTutFtoMw2yAHOEWgFPV1W3dBv0PVsSjRXzYQE8S3Vxu0 X-Received: by 2002:a50:aa14:: with SMTP id o20mr109936014edc.165.1564606032348; Wed, 31 Jul 2019 13:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564606032; cv=none; d=google.com; s=arc-20160816; b=ev3MQC2WTbqU73y+dZqYp+H9EUVdDW7jP2g+UinXiQaMYnNpGoPnzMFEC3SKD0y2ZG FFWkePEabIWIgNQIYxcWwk89yYAbhO1buC3cALlZBOUfisCrwanir+HQIkmCxQTHbcC6 6x7j2daEh5P2EZcy/EEmasbeUe7W2+BshyRzFeYc40PKlSfQ4xfu1ahnVXo87q5Vyziu v/kr/1AxhvLLzStgHptmCEL1MadwJEHaQ1FMoLaoFCDw2uz+73M+plnNgVZDn5RCSLZM ojU6P9x58T4gZv0VN7fqZHBauFsieH0ERgdVktlmAJijVCbWIx+fhPJgBztgHFOahfMR AP5g== 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=RHV3vStI8hqe3CeMRucY7WZ1UFpWZPYBbhdsWvPNW30=; b=0sC0U5O+BBHFS+IFlB2ILUOoEhl35VjxJ0Znh396Zty9YqoDA2iVC6lCdNv0m5MH4M bpByVYZ7OQP9g5ytOmOHJI82zrJ477WQ+oDst5nZfDYeuGhoPHan6fm3TVdHGx7blYfe tNdAwpjmUVIAMTgUMQE92T8tYe1Q61my9eNv2H7FjgvHgkieLRaMoEYI84AwMkIvoAA1 AsXIX4TVsIrttzceqbbc7xaYFNjptwyC09Wnmt7mCCC9KzeDjP1fRvSk2nISyaZ5edq8 rIdZkTsxx1UOGW44e+/b8RI4dCbcAlJ30rdMfp9BffpyQJ2zLfc5Tp9BOTUhn3tnkf/P aVzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QWm4D6tI; 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 k58si21040721ede.311.2019.07.31.13.47.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 13:47:12 -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=QWm4D6tI; 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]:44404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvV9-0007tX-A9 for patch@linaro.org; Wed, 31 Jul 2019 16:47:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60938) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvMp-0004iy-8b for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsvMo-0003VK-7R for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:35 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40497) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsvMo-0003Uv-2E for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:34 -0400 Received: by mail-pf1-x443.google.com with SMTP id p184so32509288pfp.7 for ; Wed, 31 Jul 2019 13:38:34 -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=RHV3vStI8hqe3CeMRucY7WZ1UFpWZPYBbhdsWvPNW30=; b=QWm4D6tIVVlCHNDWidhXBv3U+A7GuWyovfDIlJWkpWxjEGZJBP5am0SjFaoXk2ATrD e95MlhjOojiBHxxlx6AO7etV/0yRuB1DQesRzt0eDwuKlueXLG0n45AogMfs6im7YH9G pyZBdxPoArEG5YT0c0hH5q8swpTWofLTUdk01WHc+2SCW5/iAawesl/QOOhY7nOz/6b1 do4D1rkW5Y+EGNQBLANbDPWVBfibMol1BwM3ku5MZLiAagRTIR9Y1PxYL++Lsm4jkA// 0xkGFAPdTq8gnajI61cWS5WOdmIOu7PDBwfkPx2srm1Fvn5alrvnV4dPmVlJ4c1Kndrc exjA== 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=RHV3vStI8hqe3CeMRucY7WZ1UFpWZPYBbhdsWvPNW30=; b=RM7ZK9rnpuzID7qv/3Y6XfWg1u1JCWme3YPItJpdoFAfZSUILcwue5OXeJS7DKJ21p fuFsJIN3yYYyQLoVT5UEoFrZ25Ml3iazpRUBcIi8pin+o+TL6jnOqTvJv6UaHWRa+tZy BGTORaUrJVpauhNc3OUr+gnPj8DcrLnRcnFszuK9AJcZtfCrnAoDU5KmNLkbZ7J3Wg2C YqGvjnGd1t3hERZUw/Nrhp6xpCYl1IfwaCVmabtqUW95m5He/Q7vLkJjsHfKNMsutN4b b1I+HlPzjnKToRiyxq/Mnw6YmGt922bqtkzWz46ojF+TkewDspnhbXUvKSsQ2momtf6w DZNA== X-Gm-Message-State: APjAAAU/mccsIIoOl8uv0DOVbEP1WpjWjUYbCE6BlLy3tl3SsCqpPuzZ taJPakZLvAuOt8xJGlDF+emoH9VFd1g= X-Received: by 2002:a63:9c5:: with SMTP id 188mr80039525pgj.2.1564605512775; Wed, 31 Jul 2019 13:38:32 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id g4sm84054164pfo.93.2019.07.31.13.38.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 13:38:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 13:37:55 -0700 Message-Id: <20190731203813.30765-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190731203813.30765-1-richard.henderson@linaro.org> References: <20190731203813.30765-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::443 Subject: [Qemu-devel] [PATCH v2 14/32] 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, qemu-arm@nongnu.org, alex.bennee@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. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/helper.c | 52 +++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 7ecaacb276..185f5e4aea 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, @@ -3923,11 +3921,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) @@ -4049,11 +4046,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,