From patchwork Sat Aug 3 18:47:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 170475 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp2340835ile; Sat, 3 Aug 2019 11:48:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8ldsLC51ZIUvNpZidF8qM4PpjnDpAQEOQ4BFmS9cpgwRgyCYo3pGpL7huaz+C7j1zn8Uk X-Received: by 2002:a50:d0d6:: with SMTP id g22mr126923771edf.250.1564858132854; Sat, 03 Aug 2019 11:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564858132; cv=none; d=google.com; s=arc-20160816; b=FHj5TMZpWH7bzz5BT/Omnx4Ga2lEqiZttZ1E6ugcVVAtRRBjoaSnQF9hjE+OANVbil upxFKbOxfP3QXhiT49jiMpjFgYemHLnDsfEGeDgNh2OGu4IJYkiVI44hNrFAygeuyRSe OjbBlQrA40E/N4zawWRVpQdqZlcEnC38+QF8dMAM1dxfSNkI4l237QLqFCme/+gB76ph hnBRU4UIhbfDYlzFD3Iq9S3yF8urFmbY7D+2gVW2Gn4mWjvJse7dbo+SZyabDiCTlvOE T7qhyrCTXxHE1QEMM7bJDVq/rAQ74PbE2VkG3WBjLny1Pea5GqEdpIlYnHQkbipvxEaq f2sQ== 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=jS7HvuJramjNgL9qsPlVZ7J/vjvEsm6dvcpgR7V7Jb4OGrnfOKjcVw+enrB5aQNS3D rJ+uziSyC7IBl8J7mVgvlKc2c75ZSW00p6vohoMRogYdbkjGpNn4uQGY4ZspB6YThmLG B/WoiOHmpvFHV2HSCOWa/YwuWunSPu8kX0L+3Qe7qSGedgRAyaNZdNvnCtyreOPwWMNw sXVAROk6MVnYKeHpsa3MwJSIxKbtAQ0xig54flN8XuYs737tDoifgipIk0jZAyoUzZa7 onVdF0e4FQ5+xKjsOk9ErI7Qs4ge//93LWkwUUzGttOraXD2yNZ4t4rkgIyYWU1WEwvr BSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zeuwLZaL; 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 qw10si24457565ejb.58.2019.08.03.11.48.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 03 Aug 2019 11:48:52 -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=zeuwLZaL; 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]:41340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htz5H-0006TB-RR for patch@linaro.org; Sat, 03 Aug 2019 14:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60581) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1htz4c-00063Q-T8 for qemu-devel@nongnu.org; Sat, 03 Aug 2019 14:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1htz4b-00077s-TD for qemu-devel@nongnu.org; Sat, 03 Aug 2019 14:48:10 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:42853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1htz4b-00077L-OA for qemu-devel@nongnu.org; Sat, 03 Aug 2019 14:48:09 -0400 Received: by mail-pf1-x443.google.com with SMTP id q10so37607192pff.9 for ; Sat, 03 Aug 2019 11:48:09 -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=zeuwLZaLsuKqWvo0H7Lao3Xmq/IJ/PIq5u1FH0Yo7+Ni0P3R68YJHjwxjMrTtuaWjv 6UIrxJop+hOjmQMKQmGyUtp6T3hEuNYSt7wzQQZMeD4Whyg71621DfHr+ZDL3FNabgcM Ei6YZ1Qjm2qvwsPMXDbAodapGHrzDuKJ3WFjUAlA8hwRKF4hZoqaVeY8Cy4Zf5EQD70Q toso8YjoLAGaQ0ePImuSya6uKEGRuNX4Z83FoB9B2hX682K7shVPM9hj7y+Jn0ZN4wQE 8sVIe+ORce9HBYoAAavsZ0O0+Lb03HwTAA2v7x85Sf2HmI6PUWezWG7TUkVOBoRkMEhK GWZw== 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=gm5CXamxZzmKFIFap4ZPFWc2mAuJjcqKYvxBE35igQ7PR1wHlBAQ4icG7YwMO65iUo guviJeT0CgEFFyEpAySZ2nXQjbwblf1tiRwtowtqACC9MaCWIDWrRpamIO02tp5wyw6r SUyNwv0Of8o+/eDTFWi30T4En4ZiYJrDhOr8k3OHl0VQHhg8IEIrCUZq1fm7uKqHEeVI 7qD8zF1l2GuXEecSyHfD0sNdxwrRpIkzjIvUjRYdnacvmpISX+EKoe+qKMlftEauGgP5 mVpfzYY81wQ2wHg7do5eSmc80gUq4G+GVvBbGzkmEf/JCpspwf8RofDRPSURZ6RPj/SL Oxsg== X-Gm-Message-State: APjAAAV/nyIJ4/7OsdaTYCwg+53KuMvCKMsFxz+Hr/+RkPHkrFTXruxv 18UVAwwLb49aYTnNBIXkdojX0T3YAYw= X-Received: by 2002:a62:8246:: with SMTP id w67mr67312952pfd.226.1564858088554; Sat, 03 Aug 2019 11:48:08 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id q69sm15405454pjb.0.2019.08.03.11.48.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 03 Aug 2019 11:48:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 3 Aug 2019 11:47:31 -0700 Message-Id: <20190803184800.8221-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190803184800.8221-1-richard.henderson@linaro.org> References: <20190803184800.8221-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 v3 05/34] 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[] = {