From patchwork Wed Jul 31 20:37:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170243 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4472402ile; Wed, 31 Jul 2019 13:40:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjldJWy+1BV0cb06LIQpi9Uba6RTOtLzOebf2ktfTyZnIW1nqyih/XE4mXkrBTfdgb/Cn3 X-Received: by 2002:a67:d00d:: with SMTP id r13mr82352499vsi.100.1564605649471; Wed, 31 Jul 2019 13:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564605649; cv=none; d=google.com; s=arc-20160816; b=ydP83mF3MVPfNKZAEeyHbvlWnreTiPQ5yIXkBjoQ1UiyfhbkNe6IiqP7wPdL4HBYF9 jBA5Ke6HOTjyVHEpy45f/r+2WEMeGOf+1Cmef9kq9MaCt2/0Jy4AkP78QrvY1UMtFaNS YE4/ZCD1REYHGypklStezOq89aRx/lKAmtdSK/IUOy/PcePsj8U6nEpZV103GwWQVyjm +f8bfygHDK/6eJYUyK88s3OoiHYsKeVioYmYxZdXAD0Za5EoLdAXGXxGlZJYgUaBH741 hlf46yqfBIKbSE6wuF8rCAtlkYwW+cQdwDsfAN+MYl1c3okPGrFfFqO5v5sLOjrk/O93 iZUg== 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=hV2eslCkM9+11E22XGBDo1tPxuDz+vxwGvc3iXR5Q+U=; b=oXCz1ZS60t6p0rL4GX+H60nsW1D+JP4kAfsxVxaL3lVZ/1BHLBG1W9UHjDyVVmuhPs Fuor1ClhijlFCwMJoGFdZCAmUKhziycMZEnogYjEpmmDRO2E4lY6j59HyMJgxz9cH5zO ukspB7UNiLRiD9vZj/8M88ZPv+qNx0wfVAm5tF7EZxGOqil7V+LP+4a131gNWjYK9iP6 6LOYfWXA0a3/GdZQTQtF6vlYaW/0nCAXG3ZfjqYYeIiTJjRiya8xDuy0IxZDs/3t/w6f BS8gaU0tU/V0KIEiK88FzQVmrfHuCQd05Z+PZ6itFWMeM93tuiMPHpry8EYmiHhH9kvj kXKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=QNmCPw3G; 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 s202si15874516vks.58.2019.07.31.13.40.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 13:40:49 -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=QNmCPw3G; 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]:44254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvOz-00007K-1R for patch@linaro.org; Wed, 31 Jul 2019 16:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60703) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsvMe-00046H-11 for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsvMc-0003LV-Tb for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:23 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:43333) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsvMc-0003Km-OO for qemu-devel@nongnu.org; Wed, 31 Jul 2019 16:38:22 -0400 Received: by mail-pl1-x642.google.com with SMTP id 4so23999414pld.10 for ; Wed, 31 Jul 2019 13:38:22 -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=hV2eslCkM9+11E22XGBDo1tPxuDz+vxwGvc3iXR5Q+U=; b=QNmCPw3GCuujd8LoT8j4bsCJSixD7op8PTLgNifr81NcecAEkA9d/fNMyHEA/3bPl1 EiN7CzYJbcBQAHqYrBVOkNpnJWkTqJSNeZ+rlLVnDTfVsYVqMi6Yoj/q7Dvy59N7Vgtz mJka6IEPmGDCnUAb0ogeiP7XOzvbfjiupgMvRLVzS9MFGibnBjtyq+RPH6PzaiZzP+VN KDXE/qyFcvcXMHouwvNzY+Y6OKs/Dgp3aL0sDLLFm9HyDLG9FbXMbXOeCD2ysmSluVLi DXlO9v5a31ollQGNny6RsqgeupPNNtM234csP23pUHdMX+760AQ4e/E23fAmqvMfbJjl DLAg== 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=hV2eslCkM9+11E22XGBDo1tPxuDz+vxwGvc3iXR5Q+U=; b=MJdBmb/U3TTpd+7BBR9gNOD0oObjyulNZytlQ2SeGEZ2oDQRV3bF1QCeymvYMWi0Qr xxjs6PvuNxbsCkEJjKe0crx+t81tlF+/fZy2QkpxVNIvyjUQ+KPdUA08cw3fpR3W/H61 sy60gb85T+lM7dMvWb8jCjXAV7bGyDBnbqi9Z+u/+RfDHG6edjBCu9v/3Z+vMMdXyYdq kHO5VdYNeBKSMyzYBMO5hHkiIlTEIG3dXop4wgbBoGuI3kh047jzpCpnvFISIb9CzCvT +KYvgm0RXw3MHYgOtZFVX64RScERNhy6rzncDKBBAvBbCi5fE9aec/qHCnN4Is7tqfzh Cp6w== X-Gm-Message-State: APjAAAWdvNMb/sy1yjpCaYSlQYMAHr/Q9EOz1OsL4NOF3q95lmanFoGY QzMiNK6AIW5ZTN55IxxUrQH9vvuK0go= X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr124813523plr.154.1564605501580; Wed, 31 Jul 2019 13:38:21 -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.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 13:38:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 13:37:46 -0700 Message-Id: <20190731203813.30765-6-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::642 Subject: [Qemu-devel] [PATCH v2 05/32] 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, qemu-arm@nongnu.org, alex.bennee@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. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/helper.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index c0dc76ed41..65e3ffbb43 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[] = {