All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 04/34] target/arm: Make stage_2_format for cache attributes optional
Date: Thu,  5 Jan 2023 16:43:47 +0000	[thread overview]
Message-ID: <20230105164417.3994639-5-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230105164417.3994639-1-peter.maydell@linaro.org>

From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>

The v8R PMSAv8 has a two-stage MPU translation process, but, unlike
VMSAv8, the stage 2 attributes are in the same format as the stage 1
attributes (8-bit MAIR format). Rather than converting the MAIR
format to the format used for VMSA stage 2 (bits [5:2] of a VMSA
stage 2 descriptor) and then converting back to do the attribute
combination, allow combined_attrs_nofwb() to accept s2 attributes
that are already in the MAIR format.

We move the assert() to combined_attrs_fwb(), because that function
really does require a VMSA stage 2 attribute format. (We will never
get there for v8R, because PMSAv8 does not implement FEAT_S2FWB.)

Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20221206102504.165775-4-tobias.roehmel@rwth-aachen.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/ptw.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 2e7826dc29b..1c7c9cb5e37 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -2361,7 +2361,11 @@ static uint8_t combined_attrs_nofwb(uint64_t hcr,
 {
     uint8_t s1lo, s2lo, s1hi, s2hi, s2_mair_attrs, ret_attrs;
 
-    s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs);
+    if (s2.is_s2_format) {
+        s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs);
+    } else {
+        s2_mair_attrs = s2.attrs;
+    }
 
     s1lo = extract32(s1.attrs, 0, 4);
     s2lo = extract32(s2_mair_attrs, 0, 4);
@@ -2418,6 +2422,8 @@ static uint8_t force_cacheattr_nibble_wb(uint8_t attr)
  */
 static uint8_t combined_attrs_fwb(ARMCacheAttrs s1, ARMCacheAttrs s2)
 {
+    assert(s2.is_s2_format && !s1.is_s2_format);
+
     switch (s2.attrs) {
     case 7:
         /* Use stage 1 attributes */
@@ -2467,7 +2473,7 @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr,
     ARMCacheAttrs ret;
     bool tagged = false;
 
-    assert(s2.is_s2_format && !s1.is_s2_format);
+    assert(!s1.is_s2_format);
     ret.is_s2_format = false;
 
     if (s1.attrs == 0xf0) {
-- 
2.25.1



  parent reply	other threads:[~2023-01-05 16:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 16:43 [PULL 00/34] target-arm queue Peter Maydell
2023-01-05 16:43 ` [PULL 01/34] target/arm:Set lg_page_size to 0 if either S1 or S2 asks for it Peter Maydell
2023-01-05 16:43 ` [PULL 02/34] target/arm: Don't add all MIDR aliases for cores that implement PMSA Peter Maydell
2023-01-05 16:43 ` [PULL 03/34] target/arm: Make RVBAR available for all ARMv8 CPUs Peter Maydell
2023-01-05 16:43 ` Peter Maydell [this message]
2023-01-05 16:43 ` [PULL 05/34] target/arm: Enable TTBCR_EAE for ARMv8-R AArch32 Peter Maydell
2023-01-05 16:43 ` [PULL 06/34] target/arm: Add PMSAv8r registers Peter Maydell
2023-01-05 16:43 ` [PULL 07/34] target/arm: Add PMSAv8r functionality Peter Maydell
2023-01-05 16:43 ` [PULL 08/34] target/arm: Add ARM Cortex-R52 CPU Peter Maydell
2023-01-05 16:43 ` [PULL 09/34] target/arm: fix handling of HLT semihosting in system mode Peter Maydell
2023-01-05 16:43 ` [PULL 10/34] hw/timer/imx_epit: improve comments Peter Maydell
2023-01-05 16:43 ` [PULL 11/34] hw/timer/imx_epit: cleanup CR defines Peter Maydell
2023-01-05 16:43 ` [PULL 12/34] hw/timer/imx_epit: define SR_OCIF Peter Maydell
2023-01-05 16:43 ` [PULL 13/34] hw/timer/imx_epit: update interrupt state on CR write access Peter Maydell
2023-01-05 16:43 ` [PULL 14/34] hw/timer/imx_epit: hard reset initializes CR with 0 Peter Maydell
2023-01-05 16:43 ` [PULL 15/34] hw/timer/imx_epit: factor out register write handlers Peter Maydell
2023-01-05 16:43 ` [PULL 16/34] hw/timer/imx_epit: remove explicit fields cnt and freq Peter Maydell
2023-01-05 16:44 ` [PULL 17/34] hw/timer/imx_epit: fix compare timer handling Peter Maydell
2023-01-05 16:44 ` [PULL 18/34] target/arm: Fix checkpatch comment style warnings in helper.c Peter Maydell
2023-01-05 16:44 ` [PULL 19/34] target/arm: Fix checkpatch space errors " Peter Maydell
2023-01-05 16:44 ` [PULL 20/34] target/arm: Fix checkpatch brace " Peter Maydell
2023-01-05 16:44 ` [PULL 21/34] target/arm: Remove unused includes from m_helper.c Peter Maydell
2023-01-05 16:44 ` [PULL 22/34] target/arm: Remove unused includes from helper.c Peter Maydell
2023-01-05 16:44 ` [PULL 23/34] target/arm: cleanup cpu includes Peter Maydell
2023-01-05 16:44 ` [PULL 24/34] hw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg Peter Maydell
2023-01-05 16:44 ` [PULL 25/34] hw/arm/nseries: Constify various read-only arrays Peter Maydell
2023-01-05 16:44 ` [PULL 26/34] hw/arm/nseries: Silent -Wmissing-field-initializers warning Peter Maydell
2023-01-05 16:44 ` [PULL 27/34] target/arm: align exposed ID registers with Linux Peter Maydell
2023-01-05 16:44 ` [PULL 28/34] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Peter Maydell
2023-01-05 16:44 ` [PULL 29/34] hw/arm/smmu-common: Avoid using inlined functions with external linkage Peter Maydell
2023-01-05 16:44 ` [PULL 30/34] i.MX7D: Connect GPT timers to IRQ Peter Maydell
2023-01-05 16:44 ` [PULL 31/34] i.MX7D: Compute clock frequency for the fixed frequency clocks Peter Maydell
2023-01-05 16:44 ` [PULL 32/34] i.MX6UL: Add a specific GPT timer instance for the i.MX6UL Peter Maydell
2023-01-05 16:44 ` [PULL 33/34] i.MX7D: Connect IRQs to GPIO devices Peter Maydell
2023-01-05 16:44 ` [PULL 34/34] hw/net: Fix read of uninitialized memory in imx_fec Peter Maydell
2023-01-06 12:10 ` [PULL 00/34] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230105164417.3994639-5-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.