From nobody Wed Apr 16 08:10:49 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613050724; cv=none; d=zohomail.com; s=zohoarc; b=Hk3L2F2kblvRQpKykgbRZO01otoZeHt8Z8szgiHnJdipWQrRMNo0BlQLkISqC1x2dXBcuCdIVrcdHf0d1hD6BATmHs0ZxmwR15FS6qtNR7b08s4BMfQfI8zz7hMKMxYKOEuDsiOdnAqp9keX0lk+/PitoZOHzmJDAPzQttf82aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613050724; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g2Yy6Gw+Zt5E0Xgr51AYWc0qRdU0SjlUfwyoeBPlQ/c=; b=ksoCfgVjtLGEhx3WW34dpvx2F5osaRewth1/HG0PBX917//GXnMIpFl1tByWql4g2vTUJ9nri3CNzsB8FekIBt6XKsMqvcnW2ylHazB7iwNLTWeEmqN2pLTXe9ObBHRLD1zHKBkbNRQ/AOqcyefqCJ3jRujL2ewXEtAQ0Ca7CtE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613050724485766.8108321769786; Thu, 11 Feb 2021 05:38:44 -0800 (PST) Received: from localhost ([::1]:58632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lACB9-0003no-EO for importer@patchew.org; Thu, 11 Feb 2021 08:38:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lABZO-0008S4-I5 for qemu-devel@nongnu.org; Thu, 11 Feb 2021 07:59:42 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lABZE-00006d-D3 for qemu-devel@nongnu.org; Thu, 11 Feb 2021 07:59:42 -0500 Received: by mail-wr1-x42f.google.com with SMTP id g10so4124656wrx.1 for ; Thu, 11 Feb 2021 04:59:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id g15sm4955716wrx.1.2021.02.11.04.59.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 04:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=g2Yy6Gw+Zt5E0Xgr51AYWc0qRdU0SjlUfwyoeBPlQ/c=; b=RlJapo9DbgT4rlHnOoCiNNsJ1g3ckDZ9ioFGbaP0bi8eIVtS746/jqEpYAFSvha2Xo v8y9qdw9nlUFSZ0i8WVhgg7jB+6u4ph4p3F9dZ/vkDl98sb41NGRkoY/fi90Wgq6K4XQ Q9pI9N9BCpeOLj+dRTlyKcAZOrPsfdLnpoQPgJgKEJpRJfcU5QAE1Je/fNI/T4o4/hg0 mpdZzy0ByQiZ5M8yxqWmahlCkgmdI3x1diJZgOH3ODui5qTMZKuRDfhGd/EXVc0Mp5+F 9hJUvsQiI5BXHU9tygMJpUSAfQ0U59Suy1RIg6j2SKlmEHe2E8Dp6btD8dwXkHUKF5Nf 2Kmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g2Yy6Gw+Zt5E0Xgr51AYWc0qRdU0SjlUfwyoeBPlQ/c=; b=LXP7+kTv/KKsih2bMMA25MWxn0hPu1dOrhPBez1U4Ry/85Ze6ppyU7d8TzrxuFPdPN 44qdq0fcTzkLl5gTqE15uCSj2T0leJ6PGTdtxwPdIzRVINlhEV+5dCg1nTh8oIo7WhFX w4R/2Cgxw34+wsI5yFfaC/6G9ZtwvHWHqtq1leGkpWWIjkk0Bja36oCjIdyB8dEWrxz1 uqkyMpt51Mja1POkomz4Mj8/CO5SumrVhIS+pajnB1Wcd+o71GNQq8kKgsIS9+M1mIpo HTAdVBFxtAwPnquz/Vw1kASl3CdIKIbztcn8OgHVGhwO890rKC/NzzrsMIBEw8TNDmR5 jhhA== X-Gm-Message-State: AOAM533R9apJa0MgJ6thuPPoiK93tjc4IC2rJZaPyECOYMg0n4fBbLY5 VU58bwL8Rmolu0g1QBBfsrEMRNVmHLqp3g== X-Google-Smtp-Source: ABdhPJxDzQaxx2WXmBpHkGKdAswdGy4S0S3y9uINErbfW52rDKt942pzgPqnBu6UPRh+QDBEfOlqkg== X-Received: by 2002:a5d:4708:: with SMTP id y8mr5491816wrq.402.1613048371190; Thu, 11 Feb 2021 04:59:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/45] target/arm: Add allocation tag storage for user mode Date: Thu, 11 Feb 2021 12:58:53 +0000 Message-Id: <20210211125900.22777-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210211125900.22777-1-peter.maydell@linaro.org> References: <20210211125900.22777-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Use the now-saved PAGE_ANON and PAGE_MTE bits, and the per-page saved data. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20210210000223.884088-30-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/mte_helper.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index d55f8d1e1ed..1c569336eae 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -78,8 +78,33 @@ static uint8_t *allocation_tag_mem(CPUARMState *env, int= ptr_mmu_idx, int tag_size, uintptr_t ra) { #ifdef CONFIG_USER_ONLY - /* Tag storage not implemented. */ - return NULL; + uint64_t clean_ptr =3D useronly_clean_ptr(ptr); + int flags =3D page_get_flags(clean_ptr); + uint8_t *tags; + uintptr_t index; + + if (!(flags & (ptr_access =3D=3D MMU_DATA_STORE ? PAGE_WRITE : PAGE_RE= AD))) { + /* SIGSEGV */ + arm_cpu_tlb_fill(env_cpu(env), ptr, ptr_size, ptr_access, + ptr_mmu_idx, false, ra); + g_assert_not_reached(); + } + + /* Require both MAP_ANON and PROT_MTE for the page. */ + if (!(flags & PAGE_ANON) || !(flags & PAGE_MTE)) { + return NULL; + } + + tags =3D page_get_target_data(clean_ptr); + if (tags =3D=3D NULL) { + size_t alloc_size =3D TARGET_PAGE_SIZE >> (LOG2_TAG_GRANULE + 1); + tags =3D page_alloc_target_data(clean_ptr, alloc_size); + assert(tags !=3D NULL); + } + + index =3D extract32(ptr, LOG2_TAG_GRANULE + 1, + TARGET_PAGE_BITS - LOG2_TAG_GRANULE - 1); + return tags + index; #else uintptr_t index; CPUIOTLBEntry *iotlbentry; --=20 2.20.1