From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB99BD0C608 for ; Fri, 25 Oct 2024 12:55:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4Jq9-0006Uy-9h; Fri, 25 Oct 2024 08:54:55 -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 1t4Jq4-0006T8-Bf for qemu-devel@nongnu.org; Fri, 25 Oct 2024 08:54:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4Jq2-0004hO-L2 for qemu-devel@nongnu.org; Fri, 25 Oct 2024 08:54:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729860884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=g8HvZUrdqxYpsQCnW1LInwnnKHa3OwCrmx21wPZJ8gA=; b=G76r7iICq5dGi+K66lj3tRA2K8Brvzoj5bLvl41kdDvBJjTY8MVypYwa9d7AvgQXI9kq8f mvvKd93Ee2B5lEq7avdN96GAD4HpXACsoHT4bnOhvt3izmuWLSeS6fAHSeGh9YKakE3qMW qeLoKswcwzDZ0osm6bCiHBdF0SRBQZk= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-bL2ba-tTMsevwcAje8It-Q-1; Fri, 25 Oct 2024 08:54:40 -0400 X-MC-Unique: bL2ba-tTMsevwcAje8It-Q-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-53b1eddcf4aso1610971e87.3 for ; Fri, 25 Oct 2024 05:54:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729860879; x=1730465679; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :from:references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g8HvZUrdqxYpsQCnW1LInwnnKHa3OwCrmx21wPZJ8gA=; b=dv2L6qAP2xKQ/Z2PWKuIAHuSoYfWJMuutzxHvJ4uId+VWRPStbQ/vbCY54/Dq4e3Oe LSKDPRU1sxtIWEjNrvQpIeWeqc7Xdz6Iz2HE+1dy5uxPxkZ73LHUxNDsGRcXuDEGNAyh T0lr0sJLPb8R6gPUTdJFZ4zNhj+MX3YaYbwKCCJgqe86LsySQi509MIISttDLB6m0bL6 5hoSPRIyPCIfoNajkkpRGtRpvan+gWY7A0YaSFXoBShUyomyG1ciJ4mHOyp9fFHb6VOO FZ00RiWPN3qd8aEa9iKEQO4kltHYM+WSUQwqQEVJkZqorv5Xh6bDHOeGJDmBaymmBqdx vJtg== X-Forwarded-Encrypted: i=1; AJvYcCX711viRG+T3+RJsL+be3g5053cT0IXWxwHzPG2fmoRDxz1Gk+zhzDqumIMqKllsMRC4PP1TYfJ6ij5@nongnu.org X-Gm-Message-State: AOJu0YxRGrItJfPvaBhviy0PEIdcsy3KGiKWlwTj0V/s+Y4rK13LcD8A QcnrnfqBODf7CEMVED1qnpMl0mR+3zzBLCb8SAp+Yz6YH9ZWdTNuZ5w694gAEPAAHiUy0BXNFXI sl+SA20SorGymdDFNWRNLG5SbHi8TztIZy+Mtl810EuDbWzmyDNC9 X-Received: by 2002:a05:6512:1083:b0:539:de03:d7a7 with SMTP id 2adb3069b0e04-53b1a3030fdmr6218621e87.22.1729860878658; Fri, 25 Oct 2024 05:54:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhmRAuYqs4pJQ1M7U6H6JgpIleoKRSeKkPeOk+LMA297xNAwfgrQYdxBnUon3FwG7NOvRzeQ== X-Received: by 2002:a05:6512:1083:b0:539:de03:d7a7 with SMTP id 2adb3069b0e04-53b1a3030fdmr6218606e87.22.1729860878205; Fri, 25 Oct 2024 05:54:38 -0700 (PDT) Received: from [192.168.0.7] (ip-109-40-241-30.web.vodafone.de. [109.40.241.30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431935a4ad8sm17134765e9.23.2024.10.25.05.54.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2024 05:54:37 -0700 (PDT) Message-ID: Date: Fri, 25 Oct 2024 14:54:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PULL 4/4] target/arm: Fix usage of MMU indexes when EL3 is AArch32 To: Peter Maydell , qemu-devel@nongnu.org, qemu-arm References: <20240813152054.2445099-1-peter.maydell@linaro.org> <20240813152054.2445099-5-peter.maydell@linaro.org> From: Thomas Huth Content-Language: en-US Cc: Richard Henderson Autocrypt: addr=thuth@redhat.com; keydata= xsFNBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8O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F1h2CKZQPpTw890k fy18AvgFHkVk2Oylyexw3aOBsXg6ukN44vIFqPoc+YSU0+0QIdYJp/XFsgWxnFIMYwDpxSHS 5fdDxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn In-Reply-To: <20240813152054.2445099-5-peter.maydell@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.454, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 13/08/2024 17.20, Peter Maydell wrote: > Our current usage of MMU indexes when EL3 is AArch32 is confused. > Architecturally, when EL3 is AArch32, all Secure code runs under the > Secure PL1&0 translation regime: > * code at EL3, which might be Mon, or SVC, or any of the > other privileged modes (PL1) > * code at EL0 (Secure PL0) > > This is different from when EL3 is AArch64, in which case EL3 is its > own translation regime, and EL1 and EL0 (whether AArch32 or AArch64) > have their own regime. > > We claimed to be mapping Secure PL1 to our ARMMMUIdx_EL3, but didn't > do anything special about Secure PL0, which meant it used the same > ARMMMUIdx_EL10_0 that NonSecure PL0 does. This resulted in a bug > where arm_sctlr() incorrectly picked the NonSecure SCTLR as the > controlling register when in Secure PL0, which meant we were > spuriously generating alignment faults because we were looking at the > wrong SCTLR control bits. > > The use of ARMMMUIdx_EL3 for Secure PL1 also resulted in the bug that > we wouldn't honour the PAN bit for Secure PL1, because there's no > equivalent _PAN mmu index for it. > > We could fix this in one of two ways: > * The most straightforward is to add new MMU indexes EL30_0, > EL30_3, EL30_3_PAN to correspond to "Secure PL1&0 at PL0", > "Secure PL1&0 at PL1", and "Secure PL1&0 at PL1 with PAN". > This matches how we use indexes for the AArch64 regimes, and > preserves propirties like being able to determine the privilege > level from an MMU index without any other information. However > it would add two MMU indexes (we can share one with ARMMMUIdx_EL3), > and we are already using 14 of the 16 the core TLB code permits. > > * The more complicated approach is the one we take here. We use > the same MMU indexes (E10_0, E10_1, E10_1_PAN) for Secure PL1&0 > than we do for NonSecure PL1&0. This saves on MMU indexes, but > means we need to check in some places whether we're in the > Secure PL1&0 regime or not before we interpret an MMU index. > > The changes in this commit were created by auditing all the places > where we use specific ARMMMUIdx_ values, and checking whether they > needed to be changed to handle the new index value usage. Hi Peter, this commit caused a regression with one of the Avocado tests: AVOCADO_ALLOW_LARGE_STORAGE=1 avocado run tests/avocado/boot_linux_console.py:BootLinuxConsole.test_arm_bpim2u_openwrt_22_03_3 is failing now. It works still fine before this commit. Could you please have a look? Thanks, Thomas