From patchwork Fri Jul 19 21:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 169270 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4324063ilk; Fri, 19 Jul 2019 14:04:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKj+L4LvczrXVfvoBiQvt90lTanZj13IR7Iq8fNviXh4vqy+ir+92XFKlwlSkQrBMlDRHp X-Received: by 2002:a50:eac6:: with SMTP id u6mr48555848edp.83.1563570285250; Fri, 19 Jul 2019 14:04:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563570285; cv=none; d=google.com; s=arc-20160816; b=LgSrHHQVS6bZ1QCpMDyiyiBiYqW30fs2H+BzcyecqPXCbCf1V7dZ54cvKCOfgBBjsb In7427Pji2LNHoFUm3tqKhelSPg+Lr6dAuyvMXNKjgE1UdI226zmT19Ej4t8vEgaxvyr hn0bHgyr507Xz/tDND/YcI5BcTI380/aH8idznVqy0JgxhDtql+guTpMcpXxfQ8kXynF qt1+I7rOqiFnF7r/CzJ6h7P08hErtPnnMWXwl4auzMATfXEsRVB9VGSl9iA5PBdI01kR 5wJ77+88KVaeqeEPxb/npBqETSL3s9h4O267lowccGTDlUWECOrIduo1ao14XPUPQHli cc0w== 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=NUSM1qmbu6kHaDmLHqWVtWdOZoHscxZfBv6st8fQLVo=; b=i8tb8MCrR6HPQHQGfs++c2tbKk8a/8rgOXwb5e7//1d3ERi64R+IcePZDncqcAIz3/ FJCiuRseY6c0TjSSuGSLsjALZaYUS+KDLmrNuk70tobMspC97c93SqYkrcG2fyQBs/KI EA0bAopLCZtzGR9L6h48REBwwDWLa0qgBcqu8lcq0CQDidOaD8X0df+MWJtrh4FwPZDW OenKm7pWJ0RL1SrnKQkdjCJUBzQaMVNknQkNwxO/PEeZ9LtEU28TnG5eFCzjiSS7juwX bsnSKNCbFCCmhy40VBjgaRmrANVJyG5zB8cp+87wqzc6x2nw9H9aTS+l6YToWZuOF7aV Ze4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=E1RFVPs9; 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 y25si586282eju.251.2019.07.19.14.04.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jul 2019 14:04:45 -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=E1RFVPs9; 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]:48170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa3X-0007gr-Ph for patch@linaro.org; Fri, 19 Jul 2019 17:04:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54953) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa2u-0005GU-KX for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:04:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoa2l-0005Di-T3 for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:03:58 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:37903) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hoa2d-000570-7p for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:03:49 -0400 Received: by mail-pg1-x541.google.com with SMTP id f5so6143443pgu.5 for ; Fri, 19 Jul 2019 14:03:35 -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=NUSM1qmbu6kHaDmLHqWVtWdOZoHscxZfBv6st8fQLVo=; b=E1RFVPs9zYEk8fml6OCh0EpMr5IVFaInRJ9uIH6agfw4gErIuOFQcubkxH8J3VAUiL b1zaB+bZZuJS+Zo1U0YjxWlg5AK6VfK5N3TdrRBItCdL46nYw3g5OjK8NQ0PBXJywEB2 NOnjz+5QVYuFxOsE9BsUW5sYfIEdxA2sxn9BAsd9MIem6IU+6uDLNwOfqjjGV3j6bYIe NtpIsjPsX7l5puqdh2PcwoaL42yOAvJxp72ke4maBie31yvPW6qNFaNN+zjfFLPrwbrB DnwASec56bnyTYs1CmcAdvavhAyepcFti0m8UCisRiiBo8TmX4ekZAuKM8QA744M1I7F DdMg== 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=NUSM1qmbu6kHaDmLHqWVtWdOZoHscxZfBv6st8fQLVo=; b=tI98G1r3x14HbKZ90aFjMEHJ+N0Ht6pNtAkUUT46CmQVOhqAeXjB/pS3p0WsIYYQ0+ v8ZAoLg0ZMyZnFMtSe06PjeL1rNgrqDNgILtqvOVh60+8HDMChVMjTPUyRdIRXBcVuAd hSOOT3TtUh+rvlaSS64EiAXbclz8oCAk1+pZ2iQ3U0FvBCa49TweyFtmQCt2dKcrBV7k eFMzAxKkmyC+knUZD5B4+tzGYBLU9uapBxve3bAbuJ4F4Q7qzFmVD3UW21QRe7v9xTVD G1VqgtpBqbkIrZqN3qDoLaF1ryBKBFbCxa54qUfH61SEDtHYxBr6Uas9p9Xko+R7Ffni NvGw== X-Gm-Message-State: APjAAAXwQDbsAHPzYL2Pc6bWppW52wQ5l031YVxbmcXhcBmPMK/hmd7Y 3VmxPdnzx/Y3US/lWKRZsVApuRv7gdY= X-Received: by 2002:a63:5945:: with SMTP id j5mr55943450pgm.452.1563570214508; Fri, 19 Jul 2019 14:03:34 -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.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 14:03:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Jul 2019 14:03:07 -0700 Message-Id: <20190719210326.15466-6-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::541 Subject: [Qemu-devel] [PATCH for-4.2 05/24] target/arm: Install ASIDs for EL2 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" The VMID is the ASID for the 2nd stage page lookup. Signed-off-by: Richard Henderson --- target/arm/helper.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) -- 2.17.1 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index 1ed7c06313..3a9f35bf4b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3452,17 +3452,23 @@ static void vmsa_ttbr_el1_write(CPUARMState *env, const ARMCPRegInfo *ri, static void vttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - ARMCPU *cpu = env_archcpu(env); - CPUState *cs = CPU(cpu); + CPUState *cs = env_cpu(env); + int vmid; - /* Accesses to VTTBR may change the VMID so we must flush the TLB. */ - if (raw_read(env, ri) != value) { - tlb_flush_by_mmuidx(cs, - ARMMMUIdxBit_S12NSE1 | - ARMMMUIdxBit_S12NSE0 | - ARMMMUIdxBit_S2NS); - raw_write(env, ri, value); - } + raw_write(env, ri, value); + + /* + * TODO: with ARMv8.1-VMID16, aarch64 must examine VTCR.VS + * (re-evaluating with changes to VTCR) then use bits [63:48]. + */ + vmid = extract64(value, 48, 8); + + /* + * A change in VMID to the stage2 page table (S2NS) invalidates + * the combined stage 1&2 tlbs (S12NSE1 and S12NSE0). + */ + tlb_set_asid_for_mmuidx(cs, vmid, ARMMMUIdxBit_S2NS, + ARMMMUIdxBit_S12NSE1 | ARMMMUIdxBit_S12NSE0); } static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = {