From patchwork Mon Apr 22 17:07:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 790966 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp2472760wrm; Mon, 22 Apr 2024 10:08:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUk1z6tpztJmeZVWrzfxrfM67NhPLmRrNMwrJEtnY9CmjjtvK3R9Zr7HCvR1T3kCIlXmhIgfO9hG4FEbR2e4QGF X-Google-Smtp-Source: AGHT+IHczKFyOhohOo0XWaPxa/a7nHOPhZOccioAAmLO0bfs/SvrHx+3Qumr2OK0bCYXqbdATPFj X-Received: by 2002:a05:622a:1353:b0:439:b41a:81dd with SMTP id w19-20020a05622a135300b00439b41a81ddmr4985456qtk.1.1713805700281; Mon, 22 Apr 2024 10:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713805700; cv=none; d=google.com; s=arc-20160816; b=zg7DXMNfl7I3gfoEp2RA+e5Ab+cBH+M/Pi5NnJPTaBGwpD7H7zckVWjcl/hLHrMvBd A4qwau/IjVEaZccfIAhqiv8V5K3KCtSo0j/sTE0ih5/GpF0YPjnjH1k9hTRGrj3Rdm2I hqiNS/LNb6EWXywX+LCkOIjMmv+txOAKPU5FHpbM9x/nfEbhO649s4hUj+AJg9wHFZYS rZEX3anUQkYjjF2mW/yQimnmw+WvKLBL0fyRwQoAhaL6TLx2b7DlBSjbm67SqufXsmcd 6V4YvPvcVhHRLb8Pv7jWx15+FmUks5cEb10X9QKXz4r89LPP5vMPI9AUxz1CxtMvoKfZ WIZA== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; fh=kNJN6LFp4QHV8DBPnW/UHBM+UJp4R+sOv9S7Q7W+4Ww=; b=WzQ7os7OmFlJbLG+vKW3CLS5dpZxGV0TUwefiKNBp31o52YRXSjb9GvulVbYwoeHtI QTqhPx+X0WimxXUWz+kguZdumzHJOR7NjTX4dRieiJyL3o7L8/GS/fxRQ3pqxnGd0RAB 12j5MMTv+d4uCEfHarmjk4aJ/i0qPM3+YZ5L2ViE3AXzNUlDb257EFxIkLHUROmiv+NM bkpe4EPXNL0nTKftwteMLkckLV/OdcxZNlq7htXYvEdXjLaY5V0iXmwRjUyPyL14Qi5g Dqy17D9GwhirVLthZEzyMLh5y8olBA8d0ZviF2KF8HhbYZ7JzjBXfj7x9D5QCl00AhdQ joSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aXr/UAgi"; 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 q13-20020a05622a030d00b00437ca9c084esi8315905qtw.410.2024.04.22.10.08.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2024 10:08:20 -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="aXr/UAgi"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryx8f-00067m-7G; Mon, 22 Apr 2024 13:07:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ryx8b-00067a-3Q for qemu-devel@nongnu.org; Mon, 22 Apr 2024 13:07:29 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ryx8Z-0004lb-0p for qemu-devel@nongnu.org; Mon, 22 Apr 2024 13:07:28 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1e9ffd3f96eso2644715ad.3 for ; Mon, 22 Apr 2024 10:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713805645; x=1714410445; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; b=aXr/UAgiaEznS5InwxMHPbjpFh+7YYZ+f5gpIHUkED2Qf/sZYo6Y1UvZDlwKBGVM/D cpp5rPXAQ/BMKxCx5f6Bkh4g10AoP5OQbDfesp3WUgl2PPwSxtz9FaMX+yNEmwoG3fMj KNJLRg+Oy6tmwMCfrBgag4oISXV89zm8GbZlcxCM9IVMd6Ki5PfKL3dwCda82u029aQj nEXTlHxxzzygPeTOcjGeE7HFSWZLcx2btqVLDwmn70ZGpA28o8iXdAi4sTiSPI35nhMS j81LG3d2hwfsIUQRJWwsS6lsf/3fmSU7E6dK3lXQ9Uxvgnd5x1IuLb2RqnUt7hUa76zf 67tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713805645; x=1714410445; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=39YtgjPga6zni7TyfrRqLQG7p9NAFXqRFglkaRLeOY8=; b=tJ+6arQhikTYJlaPeL2cUPi5l6Zb6wz6PDcA1YCpaQN660wpgjbW3EO86S36SZgryw uhxAlPqAO24LMRDVvvbtaImsfJyGm4hxGgc09OwWdgz9PNHCMK2WLzEJb/HzJWTH575d XNVJiuq/UlrIwsv6xun6o0V+xFTNb9SdT1e3C7yVLw9UN3aqPpDXu+dg5igFZtoqNeA1 kOt3cFSycABE6L/98WxoMiwDsOm+uWO6G+F0T05FL32MGskhCdVWIv59dRqizlL5FGlQ 6anv5G/gFNF4GosuL6T3M7Z4U0VhQgPOWq/EsHB+/bVQRZ+ErYARTIym8Skv4oui2jHe 0oTA== X-Gm-Message-State: AOJu0YwHTFIQ6mG9rFfBvafUU5a2jUreB6YbNxm8/y4Qq0pVeK1MTMH6 6/q1pXZJhnN6TqIK91lHX+Y521uB10wYpMwMPBxtcKndRNE3bGjSSkV9+pxGmpYP6nClYuAl8En W X-Received: by 2002:a17:902:dac7:b0:1e5:2a20:2d68 with SMTP id q7-20020a170902dac700b001e52a202d68mr13247523plx.47.1713805644975; Mon, 22 Apr 2024 10:07:24 -0700 (PDT) Received: from stoup.. ([156.19.246.23]) by smtp.gmail.com with ESMTPSA id t6-20020a170902e84600b001e604438791sm8350594plg.156.2024.04.22.10.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 10:07:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Cl=C3=A9ment_Chigot?= , qemu-stable@nongnu.org Subject: [PATCH] target/arm: Restrict translation disabled alignment check to VMSA Date: Mon, 22 Apr 2024 10:07:22 -0700 Message-Id: <20240422170722.117409-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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.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-bounces+patch=linaro.org@nongnu.org For cpus using PMSA, when the MPU is disabled, the default memory type is Normal, Non-cachable. Fixes: 59754f85ed3 ("target/arm: Do memory type alignment check when translation disabled") Reported-by: Clément Chigot Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Clément Chigot --- Since v9 will likely be tagged tomorrow without this fixed, Cc: qemu-stable@nongnu.org --- target/arm/tcg/hflags.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index 5da1b0fc1d..66de30b828 100644 --- a/target/arm/tcg/hflags.c +++ b/target/arm/tcg/hflags.c @@ -38,8 +38,16 @@ static bool aprofile_require_alignment(CPUARMState *env, int el, uint64_t sctlr) } /* - * If translation is disabled, then the default memory type is - * Device(-nGnRnE) instead of Normal, which requires that alignment + * With PMSA, when the MPU is disabled, all memory types in the + * default map is Normal. + */ + if (arm_feature(env, ARM_FEATURE_PMSA)) { + return false; + } + + /* + * With VMSA, if translation is disabled, then the default memory type + * is Device(-nGnRnE) instead of Normal, which requires that alignment * be enforced. Since this affects all ram, it is most efficient * to handle this during translation. */