From patchwork Sun Jul 3 08:23:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586796 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2911749mab; Sun, 3 Jul 2022 01:28:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vqA3+CG5sp9WJmMnIJhwNFghj9qwrvScRo6n9C1QmAMjUeakicqpoMfqZMxrBI8Yin7fdt X-Received: by 2002:a81:14d6:0:b0:31c:4c40:c75b with SMTP id 205-20020a8114d6000000b0031c4c40c75bmr18014584ywu.129.1656836923092; Sun, 03 Jul 2022 01:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656836923; cv=none; d=google.com; s=arc-20160816; b=dYbwKqsHCi4y5BGEeGmkFHNMyi7IAs2eUkYkt1DtG5f9zfqSAsI9437t/9uj+IXhG7 hLlaOw4yE6R0vQ350PH/6FMEda9owQ2DIdLxiidvg5kWHzUbdU6K3QHMYkisqiU0XAvH aeewdGwQxsiTFT4Cegc9pVNetvrQJoYQwZHwanAI//EHr0/d7gBc6m4M4rhPvHiQlSCo +tFLUaiXAxlpo9jaVMG2LL72naQQSMMOHF3aYCXBiDFDNS0MfEOjF/eRxYpfOcyTXORQ b7PcRV5ApdFv0Uyq2C2JrvolsoxPKfq0qgLtCNh5YQl1H8eFzxaE3n3X26hkizpwrKGH P+ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vbeQfFOZRxgjST6VhHPHw0Aocd+Vk/eMVmhwzhfwMAo=; b=0BHAPfNE6TvgVXLg6gKiWxrw6Mp6EoSb2jimTjJgfUBWi80XDGT+ye1pMlIz7u71yn zZxsYX/UQuc9Asn0VUdkaKwGxhlGpKADF1Matf/hANlkzC4JhqkU8D/qlBcLaXS09W6c Nofq0T78ZYqv6Vja1/MJ1bGWrpuCuyP2JE2Gk7e94/WDC2QteobKEjUNT67L91pib64z CooHOlaN9WKm6LOH+sWk7tzS6gTIi+bWzShwdfr1AB7FC3HpW+6FmeTAhC2HDQuKAK2/ VASL+Il7nfx2GTgo2sR4c7US/2J+B4A52TNIv1zi8E09nq8xzXmPyCvvmjY12TpGE72+ fToA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IZFadF2J; 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=pass (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 k130-20020a256f88000000b0065d3d989c55si34359876ybc.474.2022.07.03.01.28.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jul 2022 01:28:43 -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=pass header.i=@linaro.org header.s=google header.b=IZFadF2J; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7uyA-0004Ns-JG for patch@linaro.org; Sun, 03 Jul 2022 04:28:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7uuA-0006H9-VI for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:24:34 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:42561) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7uu9-0005o4-AK for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:24:34 -0400 Received: by mail-pg1-x531.google.com with SMTP id o18so5068364pgu.9 for ; Sun, 03 Jul 2022 01:24:32 -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=vbeQfFOZRxgjST6VhHPHw0Aocd+Vk/eMVmhwzhfwMAo=; b=IZFadF2JtOwSikHfzQhBY1cZBZ3jjvQ1v5FyHvncvCFiKugtcp1mkbottcr73UE5wF /jL7fLaCRlPhYUQ1a6oFjNlMEh9goQW67mviJ0esESdRGlNfWYZF+pVrMKmYIT0h5xlw E5ROtB57nvNN0+8m9n330ixsDtPpKaU1hWLGR2cjTT0wIOo71JvN0G2dYt7I5JuXXxcZ QjLGpIUYzCeSNqjFaKVK6mNWXnV8eu3wtzgduy/lVz7qw4fTu0uLDX6s7OYaJAhWLEJ3 uNDd23W3ELgDP4BoBpACw/K+/f7xCmXmyfpXTj9btDKitVNuVqJKLfKq8JYu+OHfStP8 x40g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vbeQfFOZRxgjST6VhHPHw0Aocd+Vk/eMVmhwzhfwMAo=; b=X+iwMhpWLh4RD/xdevKQ/5zoumUgjYMyXTzIQHmNFtxjLKJujkZYs00jWJ9dfCnNo2 WXmRIuWGOoAVr8abwIXvm8CV01i3rqBXmeHDJdq5lfQVef6zGU6838L29AHJ0rnWOp8S D9DUWqi5zQOeRlgnCQbl6fHCGU81ATlqCZhD1EHvwLObhelTCFVqjAGVIZOvijpt8odw d7k2jAuO+u8G9lKu5q4pEBVXrmaQ5ugsy+J7GxLlHdGSveD/QAa/GEEVWZBZzNcqUXix RUbY4mwCK4de4spaU6+EleNLd6iTIoYdy3CZUkrEKxL3T3SAQlfLhh85lB2lHcYYcVPE 2RCg== X-Gm-Message-State: AJIora8y/JhwP+3/BSvknoGOYJ5udffu/XKM4JtpdpjitUzY60e5WqA6 yPHwxzJ4BVIDoHskeRKKH7CGMnxrpCn3BmMu X-Received: by 2002:a63:6cc8:0:b0:40d:e553:f200 with SMTP id h191-20020a636cc8000000b0040de553f200mr19271338pgc.166.1656836671862; Sun, 03 Jul 2022 01:24:31 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b0016a3f9e528asm13569112plb.57.2022.07.03.01.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 01:24:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 02/62] target/arm: Enable PageEntryExtra Date: Sun, 3 Jul 2022 13:53:19 +0530 Message-Id: <20220703082419.770989-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220703082419.770989-1-richard.henderson@linaro.org> References: <20220703082419.770989-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Copy attrs, sharability, and the NS bit into the TLB. Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 8 ++++++++ target/arm/internals.h | 5 +++++ target/arm/tlb_helper.c | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h index 68ffb12427..a14f167d11 100644 --- a/target/arm/cpu-param.h +++ b/target/arm/cpu-param.h @@ -30,6 +30,14 @@ */ # define TARGET_PAGE_BITS_VARY # define TARGET_PAGE_BITS_MIN 10 +/* + * Extra information stored in softmmu page tables. + */ +# define TARGET_PAGE_ENTRY_EXTRA +struct PageEntryExtra { + /* See PAGEENTRYEXTRA fields in cpu.h */ + uint64_t x; +}; #endif #define NB_MMU_MODES 15 diff --git a/target/arm/internals.h b/target/arm/internals.h index c66f74a0db..2b38a83574 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -74,6 +74,11 @@ FIELD(V7M_EXCRET, DCRS, 5, 1) FIELD(V7M_EXCRET, S, 6, 1) FIELD(V7M_EXCRET, RES1, 7, 25) /* including the must-be-1 prefix */ +/* Bit definitions for PageEntryExtra */ +FIELD(PAGEENTRYEXTRA, ATTRS, 0, 8) +FIELD(PAGEENTRYEXTRA, SHAREABILITY, 8, 2) +FIELD(PAGEENTRYEXTRA, PA, 12, 52) + /* Minimum value which is a magic number for exception return */ #define EXC_RETURN_MIN_MAGIC 0xff000000 /* Minimum number which is a magic number for function or exception return diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c index 7d8a86b3c4..9de3099153 100644 --- a/target/arm/tlb_helper.c +++ b/target/arm/tlb_helper.c @@ -226,21 +226,31 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, &phys_addr, &attrs, &prot, &page_size, &fi, &cacheattrs); if (likely(!ret)) { + PageEntryExtra extra = {}; + /* * Map a single [sub]page. Regions smaller than our declared * target page size are handled specially, so for those we - * pass in the exact addresses. + * pass in the exact addresses. This only happens for M-profile, + * which does not use or require PageEntryExtra. */ if (page_size >= TARGET_PAGE_SIZE) { phys_addr &= TARGET_PAGE_MASK; address &= TARGET_PAGE_MASK; + + /* Record some particulars for later lookup. */ + extra.x = phys_addr; + extra.x = FIELD_DP64(extra.x, PAGEENTRYEXTRA, ATTRS, + cacheattrs.attrs); + extra.x = FIELD_DP64(extra.x, PAGEENTRYEXTRA, SHAREABILITY, + cacheattrs.shareability); } /* Notice and record tagged memory. */ if (cpu_isar_feature(aa64_mte, cpu) && cacheattrs.attrs == 0xf0) { arm_tlb_mte_tagged(&attrs) = true; } - tlb_set_page_with_attrs(cs, address, phys_addr, attrs, + tlb_set_page_with_extra(cs, address, phys_addr, attrs, extra, prot, mmu_idx, page_size); return true; } else if (probe) {