From patchwork Mon May 27 08:21:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 799216 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1760389wrw; Mon, 27 May 2024 01:23:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwd8TWcLVL20bZZoBzNqyye6KXLVFUXzvDOpVdcKYo3xEZpev+Ej3wlBYuPMEko3mZr7y5RlKcW4R9xHn2vu/n X-Google-Smtp-Source: AGHT+IHxWjI6WyJDCN4+o6gGAOZyt0OWQr8iLWeJ3UStPwvuC1dnkWjCZUxHQWgsHmY5d9WGgCDg X-Received: by 2002:a05:6214:19e3:b0:6aa:39a7:a63d with SMTP id 6a1803df08f44-6ab8f60c45bmr215921376d6.32.1716798185950; Mon, 27 May 2024 01:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716798185; cv=none; d=google.com; s=arc-20160816; b=Ag/peBa0dcDPue8fSLgbtxGBFVk37bVD4l3CK7SMTECrtyXwSMjWylK7tr4wpzVmAu tzAgBp/5u3jVR4HJZd0Ll3t/Ejkxhxc6RA8XoVbG54UgPJsAT/6h+2a9Py4F90hcW6hU 885zhisMxgSiuVANDsPSwKDKHBLCygV52Lrbr24SAi9FqGTkMojdOcXbs1oPxA8Q+17U 5WpvXA2Xex8cc54VgS37sGOZymEdM/eqxPkXw4tS8Ztok1+ZYOshVfTxWGrQFRlYF/JR Jfv2C1wQXRyysfOawJjS7iZ7dPrhgS2wjTktUNO5GxLSvtttnOOhI12ocMxzSNhiqOW8 3ZHQ== 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; bh=pKdPQVIHUet8uZnyn8NrdeWqXA6FNYKFDoROGVS7vOc=; fh=Oa3f+WaEKgy/Ug3GfH+2W1RB+A2Dt7VWEGRCo7eypf4=; b=svYA4LaoHA4Govw348LNGmLBv2qNQuMDZnxM1kUUn6vza3oWBg7BAw8NRfvzIkiqhA 66XBNxW3RKOa9KsyLg2jrODTVOMhLj2nai3juRCnannVQH9mUCwi3WJ58d4NBx9hnGK8 IIb/e3rdnMs4KqCqIJDG7CyoLJ/vYSPeWjERxUfMcqMtqJa/SmzRhwVnkbzM03ZmICs1 914SNELNM/+34IeV599oniuh9OtFD1IQtnsdugJfamtXKd/BkjpqrVNu4waJV/Wp++Un hMRJF7+JB1dhgXlYl/UxzxCbVYfrpRSe09YnkcD7gzwwmeT8kSeni77Js4pgD4cac7JV FbIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac06f508fcsi74871726d6.115.2024.05.27.01.23.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 May 2024 01:23:05 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBVd8-0001Il-GP; Mon, 27 May 2024 04:22:54 -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 1sBVcH-00010e-95; Mon, 27 May 2024 04:22:02 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBVcF-0000ip-JT; Mon, 27 May 2024 04:22:00 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3565C6A566; Mon, 27 May 2024 11:22:13 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 5F6AAD8503; Mon, 27 May 2024 11:21:39 +0300 (MSK) Received: (nullmailer pid 66378 invoked by uid 1000); Mon, 27 May 2024 08:21:38 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Cl=C3=A9ment_Chigot?= , =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= , Peter Maydell , Michael Tokarev Subject: [Stable-9.0.1 09/44] target/arm: Restrict translation disabled alignment check to VMSA Date: Mon, 27 May 2024 11:21:00 +0300 Message-Id: <20240527082138.66217-9-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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-bounces+patch=linaro.org@nongnu.org From: Richard Henderson For cpus using PMSA, when the MPU is disabled, the default memory type is Normal, Non-cachable. This means that it should not have alignment restrictions enforced. Cc: qemu-stable@nongnu.org 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 Message-id: 20240422170722.117409-1-richard.henderson@linaro.org [PMM: trivial comment, commit message tweaks] Signed-off-by: Peter Maydell (cherry picked from commit 7b19a3554d2df22d29c75319a1dac17615d1b20e) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c index 5da1b0fc1d..f03977b4b0 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 are Normal, so don't need aligment enforcing. + */ + 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. */