From patchwork Sat Oct 5 20:05:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823477 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69189153838 for ; Sat, 5 Oct 2024 20:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158764; cv=none; b=UPM8IR4ux6TgLbBgCzjsSowjWkh43clHcfhpiFUBrSpEEOGits7cfafWO4Afqwa3yMC2RdwxuPMj12NMZ/jBE03rbhz6Yu0RvWescGEplGfHKw9iMHxMISfJZha6rrS1cuazYdotVIngNMrr6lQo5dx47GzSaSDQScP+thzZo/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158764; c=relaxed/simple; bh=+dpu25dlok+GjgsLvrO8ITZP/Q4KUk6jRMPM9e4O+S4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X9XINpD4sjRf8XTRQDRc1d5ljwUr2hVqXoOnLgAQkA0nrVgqXvFlrrmyNCRTEHqNj+zsPPkx0xFXTVrWJb0KLL8l0jI9HTk2XUVuEx8cMIC2ZVuRwiBY3R6KLqFO8tBUUW9MqmJBnuCF2Zc6SKm7lsAyDQMw8Zol1uf+DTHJ/os= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wMU8zMeM; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wMU8zMeM" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-20b93887decso26368315ad.3 for ; Sat, 05 Oct 2024 13:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158763; x=1728763563; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qpc+gtvz4QF2D7U7hwk6I/PwDTmOhNNc5A8A2G2CqV8=; b=wMU8zMeMq0XYzHQt9G1xz0iUYqQYIFr44xNi8+PlCdLanpDJXK6yu018qM3zRrcli+ YnokOtl5ECR9CScaRxQ/86KKvAMDT2dL2kwZxMq0xuTmRsBwn+KbIt+6ln2ZEVxdtc61 qJm5O4HvFJfY88/CTyttyJiyfk5X1N4Sb0LzzQS0ZVf8lwD9E2q4eziTem4L42JQrWi3 TpZGVCqlGTstrl2OogszwIM9F39PhO6NCmBI3KZdOc8qeFQxJq6BkHWwtv2bIJPfWSZi afLuiB+ss35eAkPYSiwa8RiV8M2+lWGwt6KyMftJBmTSQnan5Eb0R7kPa672MOoXrRpE 2shQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158763; x=1728763563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qpc+gtvz4QF2D7U7hwk6I/PwDTmOhNNc5A8A2G2CqV8=; b=m6cUv+Vc+IcOEWthWq6dGSU2VLTEBQ336bKQBiyPzNooB+IXym5ky9nkj6j7MoejAT HhCSf/BcnO0J8tAjhjazjA8jgvpGpBXej6LG+difJV8cZjNw33QGRYxhL8FQD4woNIho XgFgQkFZnejSIcnYq6gEA/GJhr/XjBNvzpZnFlVnNKyLa+TOulZFsL2rrlZrqTagb520 J3NQZqeG1TKEMCiBmOXXB/MMQLbMtGs3zsZp1drBdLoRGqB4M+lUvdRgnBtNgjow62SV 3VPZXXboGX8zRbkjdruBpCwZbabensYXhETm3f1R9BImXGhsC++fbkOq4UzQjFpFQQzh SvhA== X-Forwarded-Encrypted: i=1; AJvYcCXICcDKUB62r7/bvU99nUAqjJh6vB/G0AtLi79AzPWt3IlHztw9T6aSDd5RhcfrdgIa3ioAx5VXrrwwrJM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5PtMy8uoOaq4bqCI3keJucLcEFu5MlV/wM1APW9Pv+U6QtV8x TQte3zruht02gwP+W6/x7xJlG0Ernt4jlUMiY3Ln2Muth5orvw6oG1tLxuOXsnsmPwLgXoVrNIT / X-Google-Smtp-Source: AGHT+IFmM8Oxp421B76h4UpAzO5VbLx+wqOrR4XfQnLhl5uTco5sEvRm26Oyl1URtBb3k58uPkW8Hg== X-Received: by 2002:a17:902:f545:b0:20b:a576:1896 with SMTP id d9443c01a7336-20bff190668mr89398765ad.43.1728158762695; Sat, 05 Oct 2024 13:06:02 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 01/21] accel/tcg: Assert noreturn from write-only page for atomics Date: Sat, 5 Oct 2024 13:05:40 -0700 Message-ID: <20241005200600.493604-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There should be no "just in case"; the page is already in the tlb, and known to be not readable. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- accel/tcg/cputlb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 117b516739..fd6459b695 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1852,10 +1852,9 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for - * write, this shouldn't ever return. But just in case, - * handle via stop-the-world. + * write, this shouldn't ever return. */ - goto stop_the_world; + g_assert_not_reached(); } /* Collect tlb flags for read. */ tlb_addr |= tlbe->addr_read; From patchwork Sat Oct 5 20:05:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823478 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1ADA01552E0 for ; Sat, 5 Oct 2024 20:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158765; cv=none; b=efJRhdLTdysCVTJojtOe4iLRGYNkcOSaz8tJDMmJ1yWjVOUvd+XlfCdegU0HDeOBt3hezoSUkWcvohMtvwedIRoHJunvLEi+QKH8bnFxoDqo0GKDo3eiYo9JAPE+xjiWyYpv5K6/+xYqh+ua/TcNAS9XE+DhfQ7GGPg7HSZf3+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158765; c=relaxed/simple; bh=CsqbOG3MqlbMWcSFdA2BCSBmA0dzoz8OyW/OJILfreQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L2EfpZ9y9yRc79WDa1FsS3uG2ctDgntEVAYTBc3Z/q7AZJ7QuzRdOpemwHmb1utn/b85t9r3JeSJUsPjSVnO3zpahe0R9tiMrYyg3KGFtXjAchVeiugRFXa1nWEq8aglRVcxBoxt8uVEBh4kAEr7Jm4b7KlMzZ1t+KXnrxizsJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=svGGwJDh; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="svGGwJDh" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20b7eb9e81eso38275615ad.2 for ; Sat, 05 Oct 2024 13:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158763; x=1728763563; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=svGGwJDhSUAKWMote8NWCzoiYx7BBjBQ5BBiC43ekyzjG803v46i0/0XtVVd860yf8 ep8i5DPira4ntBp0dBm3cyGttcX1M2ZkNx86RX3W90Hf0slHIu+yRaFMVQes8IhhZ3ic m70qOI0CEN/vEU8g+thiOhsGpuUlzyiuRcHrRJ5BpHC5Kp0NDdglj38WC24Ooys2t+9x NICOqMOoGW9jaRKCEecOkOIcz/pZtpfza/dE3dIqHayaZvszjxOff0g8W410LmRjixRE fiVVravR3Nl9zkBUGdKt9IKNvLP7nlA3lL75e+R8D2IA/UQaWyYw9iFtjrU68onbxB2e w4AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158763; x=1728763563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wBthGFf8BfR2i4dob959bB47CFsEJX0Mf+aRMHd0jM4=; b=D4WYunDvu2l8f4Rlw6z7gNz6GqlN469bumtYdXZ7j37N+qSOxmbJMH9heKAo1pPNAN C4mrRMuk0JELFFx1ak9WtxglybnAM65+lZCpvc1rfVhmeQ9Vf1pT2gzDqw/tPfwWEzOc ehZn8KkKi8ZyQ2tPlzFhxEPWan4Y8kIFC4syJEcmrWAYUuB3BzfQ8xHGsEw0Mdc3MK71 TbhG9oEkvptq69/NCHxkCpeNUyj3SS14znrwculYV8ekFKrxCuf0e/yMQ6x4FmGkswrX H0UiMQscfstlXTuQwWZzOSFqOZoc2/sRrbCMtTsbN9VcHomyR9KcHlz+fPECEmRR5Hdq ThdQ== X-Forwarded-Encrypted: i=1; AJvYcCUffSogwQCVPnfD6ExQBrRkYyJCB39GkkDT1nlkkob/3KcaBSnT+c0UIY3I+w8ftmNoHT/XA9/a2MUV9yw=@vger.kernel.org X-Gm-Message-State: AOJu0YwtrNWrf8Dqc3EwBptlGsn58VCCU0gni4DK3tX8PVlSyfW0E4C1 64RnxGLqCqjUoKgQ3e1GFnNVOZsDPuo9fxduXDaSdORvdOOL5olW9IwkFnsokOk= X-Google-Smtp-Source: AGHT+IH0bNmSgTilkfsUlgJ9vbuANm1j0xSSg22B3KtpzdX6j/LOhzX6NRgjtvxwOpPWp0dQMEWPcA== X-Received: by 2002:a17:902:e5c6:b0:20b:6ede:5b1c with SMTP id d9443c01a7336-20bfdfeef3cmr94363425ad.25.1728158763513; Sat, 05 Oct 2024 13:06:03 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 02/21] accel/tcg: Expand tlb_fill for 3 callers Date: Sat, 5 Oct 2024 13:05:41 -0700 Message-ID: <20241005200600.493604-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- accel/tcg/cputlb.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index fd6459b695..58960969f4 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1220,25 +1220,6 @@ void tlb_set_page(CPUState *cpu, vaddr addr, prot, mmu_idx, size); } -/* - * Note: tlb_fill() can trigger a resize of the TLB. This means that all of the - * caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must - * be discarded and looked up again (e.g. via tlb_entry()). - */ -static void tlb_fill(CPUState *cpu, vaddr addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - bool ok; - - /* - * This is not a probe, so only valid return is success; failure - * should result in exception + longjmp to the cpu loop. - */ - ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); - assert(ok); -} - static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) @@ -1631,7 +1612,10 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, data->size, access_type, mmu_idx, ra); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, data->size, + access_type, mmu_idx, + false, ra); + assert(ok); maybe_resized = true; index = tlb_index(cpu, mmu_idx, addr); entry = tlb_entry(cpu, mmu_idx, addr); @@ -1833,8 +1817,10 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { - tlb_fill(cpu, addr, size, - MMU_DATA_STORE, mmu_idx, retaddr); + bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, + MMU_DATA_STORE, mmu_idx, + false, retaddr); + assert(ok); index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); } @@ -1848,7 +1834,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read == -1)) { - tlb_fill(cpu, addr, size, MMU_DATA_LOAD, mmu_idx, retaddr); + cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, MMU_DATA_LOAD, + mmu_idx, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for From patchwork Sat Oct 5 20:05:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823479 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EF0315884D for ; Sat, 5 Oct 2024 20:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158766; cv=none; b=nW1cTmRm0zw0KM1quS71HdHHAtb8IxG8CllpUaHXNWhpp3VEmHuINP4GGM4dAa12P930hfmB6VkMD3x0AOdGos+aeQqdjq5aTHHZrCMZqAU64t+b5NCGgABbbTzCQWiw3zvynG3MZdMa0ir65vVgpZYuYfMOgfnPxaA+93F6d1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158766; c=relaxed/simple; bh=Gh98pY0MAR0Ot832aCn3hg2vuaYiKb/XiJoz+Ma5LyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nOYdLZ+svPZ4sLJ2CustQkV6LP1Kip7p6aA3/5owW8yN2PfZPLzBKXa9MOkuRNR8pOonTPhcFLvz+683JDZCRxnExMi7mtiS3LmCCXESoq5QmfN4kyZlmckEAWQKve5dK+MupDpoiHCP60Zp6tRBUhdApQgLIJyWYnkVlnEc/so= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aC72o5Z1; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aC72o5Z1" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-20b78ee6298so20648275ad.2 for ; Sat, 05 Oct 2024 13:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158764; x=1728763564; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=js9k8IR/cEhAqGc5dKpCioG/n/UgV+piB56d5dg8Aiw=; b=aC72o5Z1zpvJrxSaiEEKXy8+1QIlIzP/np6e9yH4oIbzx9kD+iqwIIl794tI8ZY5/b RkOs+kjj5MF2OCwSBDwLBQjwCAAA6oJCoQi5HcN4qFCYEAAUYJXfrnnBURps89waDrzU +jzh089xeEn+W/kWci1bWuaxeJj2qoc/xaMtQQ7teThIGxQ2p1duR5k96SqVomlo23YW VTJQ+8NVhcDminBmRVwCEGqPmnGRyB47JvIHK8auy6i68nI7sPM+HVuywVyiFeC0JAQg cGkMocQXm+t7po/n6xbeG8P8FVrIjOKAiRfYngSW8QIfhN5Bj4/gE/+z09ykpD/+Oj+B nQLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158764; x=1728763564; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=js9k8IR/cEhAqGc5dKpCioG/n/UgV+piB56d5dg8Aiw=; b=FIYHtdVgR0cVNnnHYqSJA3AkeNfb4WS+fbGMFfn1Lb4qcg1tnbxRvcKalT8M74RNbW 2Bvfqy53YJsk97mRgFZivWd/ExVhOl7xaa3QBjPd+Pj5idwsr2LJKs2KSjnfcMfmG5sv 7foY0qB/WLTtpqsjb7LcWtwRL8Ob6VUT4LW0I1SEB9O5eBIH2PSGKLqnjNFJRgr+Qjs1 DnWvq5IwIticP7W+rAVrKru+XnWiO4zpOKl8WMga2zD+Rx0s66EditU5fiQViDpuzqsa D63Kt92eamKfO/yNyCD7foqfyYAiysrQC2Om9yQm6H3aAhob2zcLFBfKzvypqX2UER1B yzfg== X-Forwarded-Encrypted: i=1; AJvYcCXdB9PLs+xUZfnfOL+CWDYyLjgfY6CSxVFx9HbmQcszB5Tl/diYEo5q819y98UURXY09SuzWzBJaRN0JuY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8Yadwp9jNYgU6ugHoDjldKBWm7urvQ5/XgG34+nJ/WiP9KcLj STql8pzXSLCTK+AKtZtcLuLhptagBLbn2cS3g023tqmnVmsFuzcz5cuYiKW0wt0= X-Google-Smtp-Source: AGHT+IG2QzkqWQJ6aa5SACwUNhrBcwJqwMcmd6FgF+mUSPNCiyiBOS8ZrrP8asqO/lz2F3toxq/lxg== X-Received: by 2002:a17:902:db0d:b0:20b:8642:9863 with SMTP id d9443c01a7336-20bfdfc268dmr105234565ad.18.1728158764343; Sat, 05 Oct 2024 13:06:04 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 03/21] include/exec/memop: Move get_alignment_bits from tcg.h Date: Sat, 5 Oct 2024 13:05:42 -0700 Message-ID: <20241005200600.493604-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This function is specific to MemOp, not TCG in general. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- include/exec/memop.h | 23 +++++++++++++++++++++++ include/tcg/tcg.h | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index f881fe7af4..97720a8ee7 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -170,4 +170,27 @@ static inline bool memop_big_endian(MemOp op) return (op & MO_BSWAP) == MO_BE; } +/** + * get_alignment_bits + * @memop: MemOp value + * + * Extract the alignment size from the memop. + */ +static inline unsigned get_alignment_bits(MemOp memop) +{ + unsigned a = memop & MO_AMASK; + + if (a == MO_UNALN) { + /* No alignment required. */ + a = 0; + } else if (a == MO_ALIGN) { + /* A natural alignment requirement. */ + a = memop & MO_SIZE; + } else { + /* A specific alignment requirement. */ + a = a >> MO_ASHIFT; + } + return a; +} + #endif diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 21d5884741..824fb3560d 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -281,29 +281,6 @@ static inline int tcg_type_size(TCGType t) return 4 << i; } -/** - * get_alignment_bits - * @memop: MemOp value - * - * Extract the alignment size from the memop. - */ -static inline unsigned get_alignment_bits(MemOp memop) -{ - unsigned a = memop & MO_AMASK; - - if (a == MO_UNALN) { - /* No alignment required. */ - a = 0; - } else if (a == MO_ALIGN) { - /* A natural alignment requirement. */ - a = memop & MO_SIZE; - } else { - /* A specific alignment requirement. */ - a = a >> MO_ASHIFT; - } - return a; -} - typedef tcg_target_ulong TCGArg; /* Define type and accessor macros for TCG variables. From patchwork Sat Oct 5 20:05:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823480 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCA641552E0 for ; Sat, 5 Oct 2024 20:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158767; cv=none; b=Jfg45J5q97JBuoGcAU1mqbF36RjDTrmm6iSKrWvZE1EFVKLOnmehoSDmOwoBUpLo5+KrRbRhVL8pUonHkjRCZXBMGTP5QhCbo8q+WgiRjSld6lstfo58jGMQZDhlR6YTScQ521qMMiB0xzm3S/S7bkiGODbXwUIzR3O7t8uOcds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158767; c=relaxed/simple; bh=cBxszF6IGuIGwt5QkpXfxb3/BnjVVGgXMOWgr8qhrQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BA/gasT7lbNqjcxxQDSHpoe5zgq/4lorKBKJCl7BJpY2E2TIwm77UflyyqutiSDFSBUON+E2Up+xmlk8py0GGVtxS13W0frX/XemjkzYYZuOXbLG22LbLXikvrBV/zxSopA/+kiiB33JXxXRbJMATW/xtbtiq+FaHUPyfiWHiBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=zgQyQK7L; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zgQyQK7L" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-20ba733b904so31802915ad.1 for ; Sat, 05 Oct 2024 13:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158765; x=1728763565; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DH35lHXcbsJC32qCjyMaGZFqdyczAIeo1misqQjkoMQ=; b=zgQyQK7L3jRyEZOOGNGER6QqajEH+vKgdoscC6orZmnRt9CjCzWu/7IR7uZT+ZqDp/ uEsMEIhmm0ndneIIPWHlFJpg+BENoCvEYrEYRNsCDBHnlUQ8V0kVieqbNU0r7K6e3tw7 Q2IyZDQpFirfue7/DKWNz+Rgbdm5I0naHBgPm+s93qCnNH3gRrfLCVHACT7zzJHvxxCQ 2dGKfYB7YQ/yQLCaALoFYKf5qrIhITuEGUzzJyrSlRpfuNIATsDJKfvMtoayA3X1z8Hx 3A4LQaYT29NZo5XWLlh1KgIeJvazLseHRAPl9xxXIgl0eRzENxe6jqIkr/cZ9ZbB4i7e 0zrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158765; x=1728763565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DH35lHXcbsJC32qCjyMaGZFqdyczAIeo1misqQjkoMQ=; b=SqdAeLVTUj6ikU4b+XdjDZxlX3u78DcPSAtRqcU4JNCaOyYwn66QVFVBouYW7zA68a GJxQYbkfcwP+z2/Y5ua4Hl72Z5e3ytIhBnFAG2xPaTSjl9Ektp0DWld3iXvS4wb43Y4T 6ysDL7rbipJ0kVZU4wrkDZEUf04ziEIQApZRzLANhSp5Bf30D51J3xADCABWSMPu8uuM aml40gFTJuNlxJb8+NLXyigXHw0sv38t4KnwsXmVwMP8/YKE27ZdV93cpinY3YSCAhyE u7DGxMcHYYWOGLIKOILOm7gCuUO6xfZsIKQoDuKixs8EV/i0NlmZKUKyoB9jssAK35SA D9XA== X-Forwarded-Encrypted: i=1; AJvYcCVCYY/+Em+nVNJw0FHru87Sgclf1mfiLz++L8c2kQRsios+Ef7O+0LWR2y9Hg3qi4qYI4euoyQQBowczwM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw97jn07nyLaO/FKfgOnQISBUECMan9/5be/yuOMHWUAyQpbdvZ y1M3bkgz3fp3ovNyWDstw6pPfTUxtZ5Zg0DS5jkYGMBBzgCn4+BQJUwTrbkRMeI= X-Google-Smtp-Source: AGHT+IHIb0nvq4eNPHU0RqWZQLaosTrrxJaEwg0X9iadpDKgGULb2krdXNgtY4yg4RXKinwxw3yncg== X-Received: by 2002:a17:903:40ce:b0:20b:a8d9:2a02 with SMTP id d9443c01a7336-20bfe072971mr98365935ad.36.1728158765269; Sat, 05 Oct 2024 13:06:05 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 04/21] include/exec/memop: Rename get_alignment_bits Date: Sat, 5 Oct 2024 13:05:43 -0700 Message-ID: <20241005200600.493604-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rename to use "memop_" prefix, like other functions that operate on MemOp. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- include/exec/memop.h | 4 ++-- accel/tcg/cputlb.c | 4 ++-- accel/tcg/user-exec.c | 4 ++-- target/arm/tcg/translate-a64.c | 4 ++-- target/xtensa/translate.c | 2 +- tcg/tcg-op-ldst.c | 6 +++--- tcg/tcg.c | 2 +- tcg/arm/tcg-target.c.inc | 4 ++-- tcg/sparc64/tcg-target.c.inc | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index 97720a8ee7..f53bf618c6 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -171,12 +171,12 @@ static inline bool memop_big_endian(MemOp op) } /** - * get_alignment_bits + * memop_alignment_bits: * @memop: MemOp value * * Extract the alignment size from the memop. */ -static inline unsigned get_alignment_bits(MemOp memop) +static inline unsigned memop_alignment_bits(MemOp memop) { unsigned a = memop & MO_AMASK; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 58960969f4..b5bff220a3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1693,7 +1693,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); /* Handle CPU specific unaligned behaviour */ - a_bits = get_alignment_bits(l->memop); + a_bits = memop_alignment_bits(l->memop); if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } @@ -1781,7 +1781,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, { uintptr_t mmu_idx = get_mmuidx(oi); MemOp mop = get_memop(oi); - int a_bits = get_alignment_bits(mop); + int a_bits = memop_alignment_bits(mop); uintptr_t index; CPUTLBEntry *tlbe; vaddr tlb_addr; diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 7ddc47b0ba..08a6df9987 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -959,7 +959,7 @@ void page_reset_target_data(target_ulong start, target_ulong last) { } static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr, MemOp mop, uintptr_t ra, MMUAccessType type) { - int a_bits = get_alignment_bits(mop); + int a_bits = memop_alignment_bits(mop); void *ret; /* Enforce guest required alignment. */ @@ -1241,7 +1241,7 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, int size, uintptr_t retaddr) { MemOp mop = get_memop(oi); - int a_bits = get_alignment_bits(mop); + int a_bits = memop_alignment_bits(mop); void *ret; /* Enforce guest required alignment. */ diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 071b6349fc..ec0b1ee252 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -294,7 +294,7 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(memop)); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(memop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, memop_size(memop) - 1); ret = tcg_temp_new_i64(); @@ -326,7 +326,7 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc = FIELD_DP32(desc, MTEDESC, ALIGN, get_alignment_bits(single_mop)); + desc = FIELD_DP32(desc, MTEDESC, ALIGN, memop_alignment_bits(single_mop)); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, total_size - 1); ret = tcg_temp_new_i64(); diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 75b7bfda4c..f4da4a40f9 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -521,7 +521,7 @@ static MemOp gen_load_store_alignment(DisasContext *dc, MemOp mop, mop |= MO_ALIGN; } if (!option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { - tcg_gen_andi_i32(addr, addr, ~0 << get_alignment_bits(mop)); + tcg_gen_andi_i32(addr, addr, ~0 << memop_alignment_bits(mop)); } return mop; } diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 23dc807f11..a318011229 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -45,7 +45,7 @@ static void check_max_alignment(unsigned a_bits) static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st) { - unsigned a_bits = get_alignment_bits(op); + unsigned a_bits = memop_alignment_bits(op); check_max_alignment(a_bits); @@ -559,7 +559,7 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr, TCGv_i64 ext_addr = NULL; TCGOpcode opc; - check_max_alignment(get_alignment_bits(memop)); + check_max_alignment(memop_alignment_bits(memop)); tcg_gen_req_mo(TCG_MO_LD_LD | TCG_MO_ST_LD); /* In serial mode, reduce atomicity. */ @@ -676,7 +676,7 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr, TCGv_i64 ext_addr = NULL; TCGOpcode opc; - check_max_alignment(get_alignment_bits(memop)); + check_max_alignment(memop_alignment_bits(memop)); tcg_gen_req_mo(TCG_MO_ST_LD | TCG_MO_ST_ST); /* In serial mode, reduce atomicity. */ diff --git a/tcg/tcg.c b/tcg/tcg.c index 34e3056380..5decd83cf4 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -5506,7 +5506,7 @@ static void tcg_reg_alloc_call(TCGContext *s, TCGOp *op) static TCGAtomAlign atom_and_align_for_opc(TCGContext *s, MemOp opc, MemOp host_atom, bool allow_two_ops) { - MemOp align = get_alignment_bits(opc); + MemOp align = memop_alignment_bits(opc); MemOp size = opc & MO_SIZE; MemOp half = size ? size - 1 : 0; MemOp atom = opc & MO_ATOM_MASK; diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 3de5f50b62..56072d89a2 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1587,7 +1587,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, MemOp opc, TCGReg datalo, tcg_debug_assert((datalo & 1) == 0); tcg_debug_assert(datahi == datalo + 1); /* LDRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >= MO_64) { + if (memop_alignment_bits(opc) >= MO_64) { if (h.index < 0) { tcg_out_ldrd_8(s, h.cond, datalo, h.base, 0); break; @@ -1691,7 +1691,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo, tcg_debug_assert((datalo & 1) == 0); tcg_debug_assert(datahi == datalo + 1); /* STRD requires alignment; double-check that. */ - if (get_alignment_bits(opc) >= MO_64) { + if (memop_alignment_bits(opc) >= MO_64) { if (h.index < 0) { tcg_out_strd_8(s, h.cond, datalo, h.base, 0); } else { diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index 176c98740b..32f9ec24b5 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -1133,7 +1133,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, * Otherwise, test for at least natural alignment and defer * everything else to the helper functions. */ - if (s_bits != get_alignment_bits(opc)) { + if (s_bits != memop_alignment_bits(opc)) { tcg_debug_assert(check_fit_tl(a_mask, 13)); tcg_out_arithi(s, TCG_REG_G0, addr_reg, a_mask, ARITH_ANDCC); From patchwork Sat Oct 5 20:05:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823481 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D86E815884D for ; Sat, 5 Oct 2024 20:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158768; cv=none; b=l/PURWAX5EvYj+KEb1AeXSz1y0jfWiKrLJ9uVyqMD5Lvjm4LM4GsX63dt1LJaYVzkw8GXXHINDldwfIYqWRQ0E2Vj9lHpcE7j2ov9GYVlzA2j5mHRT12jCTWxC8qn4WGm9y4L4GhSf8nvQ82DERiqA0WYgQbaNhLRyUgrSVhvpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158768; c=relaxed/simple; bh=CNQPVBhItRPAxhRnqCnm3EiuHXwFUY2vwcYaZEAIlXA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FMpbMoyYRGOqjq5D8ruIai8/x8bmAAwpB5vfN/9n+i6Q4gajSNxQSogQN9Jc34rjSl10WYcm0sk/H2DmYX7htJuCz/2GSWzYTxUV83rHK3HnvJIYnOYqC8ncAu9pW17t1bJn/0B8akhxU5X7NNgsnIliqsO7TR0a5JKQRkBWj+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tD6iMv8s; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tD6iMv8s" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-20b93887decso26368515ad.3 for ; Sat, 05 Oct 2024 13:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158766; x=1728763566; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rMIQXnxelIQ86qxYbOA8sg/WFq9fqYpMUetqZ1DDKfA=; b=tD6iMv8sf/CmcWiOtVkfPebcn2ZwyQHwl7ASzV3q1UQjCnsJ7XR/tkujPMrmFB2sGm sSb7N5KlncqpER/seeBQV9LrR83h8tRQxiop5zOW3bb554RbMoDmXiaVCtSHZgxkSywz okjwwQ1G87Qgb+q6oftNvs8+fDIkbQLPjkearn0poqpvDWfd8B6be49ag4MqOlLqXvi9 PFYOzQuu6etNc6d+kINvVsPrBdfC6yA1KIKWYdUiz59uryzPQefPYA832M7/x1FftrdO RGMn4NrLkl2sLCvEuJ7NDqaD/o+0A/DCoZo6EmxmbnZZrlY2O+XgZEtDarlLBWhu8IbM dJ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158766; x=1728763566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rMIQXnxelIQ86qxYbOA8sg/WFq9fqYpMUetqZ1DDKfA=; b=jFMujc9PZ6TWq/nUZTCmOYXGn7XCkAtvg0B7eYf/79VevKk71CFUXnYwmFTOoU1l9p 4SNS8Vee9lL1ZiYigaCmBJvNZwsRDVm5ZhYAcFbhgOyvx6qpTeg+8/j1mtsocXg6etPk GIZh7w1ug/G/dkzJAstKFq3W17JANEgWA0EKZkWvVvuNX+bp2CKAm9kvN3L6rg9sJ/Q1 jbIy1WtNlUk9pzQjmIP7pG6ziTfJcxHn0b+wxuMusRILgAAMxu2RiffdWgvYmwVzy1Lb uZQfvCacINoqM0NjLMKri4NDlV4XN/xVKVOnuv2GTQPH8jRTl5m7J/3/pJOPDqPhdDnX 9NlA== X-Forwarded-Encrypted: i=1; AJvYcCW58fqns2bLsEYn8Excal/142c+9KCvQaeGubpAKPIEg6cTDgJy0JBknvVXQDvzMolM31r2bKggFeTYfgo=@vger.kernel.org X-Gm-Message-State: AOJu0Yxxn0pWp55T4JJ5CL2LScpUbbGGl/WxmptNFh9P3ve3SOG+3Dxt uk9url84+zl/FCd75MnczHKvA9JJjJQJcj9Izh4pvufIOAmTwkOCwTDBmBea45s= X-Google-Smtp-Source: AGHT+IHH1UPbilIVxeQbQP7YVJkO3rAkayOpruqAQpJ8VTJH0ulhL8QO7zYfsZKakqfCs3+vPIEAIw== X-Received: by 2002:a17:902:f545:b0:20b:a576:1896 with SMTP id d9443c01a7336-20bff190668mr89400615ad.43.1728158766201; Sat, 05 Oct 2024 13:06:06 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 05/21] include/exec/memop: Introduce memop_atomicity_bits Date: Sat, 5 Oct 2024 13:05:44 -0700 Message-ID: <20241005200600.493604-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Split out of mmu_lookup. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- include/exec/memop.h | 24 ++++++++++++++++++++++++ accel/tcg/cputlb.c | 16 ++-------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/include/exec/memop.h b/include/exec/memop.h index f53bf618c6..b699bf7688 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -193,4 +193,28 @@ static inline unsigned memop_alignment_bits(MemOp memop) return a; } +/* + * memop_atomicity_bits: + * @memop: MemOp value + * + * Extract the atomicity size from the memop. + */ +static inline unsigned memop_atomicity_bits(MemOp memop) +{ + unsigned size = memop & MO_SIZE; + + switch (memop & MO_ATOM_MASK) { + case MO_ATOM_NONE: + size = MO_8; + break; + case MO_ATOM_IFALIGN_PAIR: + case MO_ATOM_WITHIN16_PAIR: + size = size ? size - 1 : 0; + break; + default: + break; + } + return size; +} + #endif diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b5bff220a3..f5fca5a118 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1751,20 +1751,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Device memory type require alignment. */ if (unlikely(flags & TLB_CHECK_ALIGNED)) { - MemOp size = l->memop & MO_SIZE; - - switch (l->memop & MO_ATOM_MASK) { - case MO_ATOM_NONE: - size = MO_8; - break; - case MO_ATOM_IFALIGN_PAIR: - case MO_ATOM_WITHIN16_PAIR: - size = size ? size - 1 : 0; - break; - default: - break; - } - if (addr & ((1 << size) - 1)) { + a_bits = memop_atomicity_bits(l->memop); + if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } } From patchwork Sat Oct 5 20:05:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823482 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D78581552E0 for ; Sat, 5 Oct 2024 20:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158769; cv=none; b=CNAbYsFz7PxaFNcBizPjcZLeMagw6F4L17kvGTcUI2DiV555q0PcqpreVaFPdMXMWdYIwZqMNidsJ5ft2Ab8eOx/0WR8m3/a/YGOMwu7s2HFF1d3kKG5+803sKY56+wroXNykPili72CFckLd+9uAYuKSIcjIFmy/PDaRUwnuZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158769; c=relaxed/simple; bh=QT4L20i/uvGnpQx/+7mQvzKz0ZX1VGWN5uFF3Erquvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VCwfbBfVB1R3TO4ktIjZ++wB1ZpmpHOswO1ekb2u5hgU8Z67sVuq5vqzP6pbO7a1zfpdgz671b575cMMNa9SIX5wXLly6LvHdWgzCdE2oNG0NTHTozMCISu6lE3q38MVocmq6Gr8VESFNxCB0uQeWLAAvsIyi55/f/+6HBKqhSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=f8fsQg+k; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f8fsQg+k" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20b5affde14so25024445ad.3 for ; Sat, 05 Oct 2024 13:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158767; x=1728763567; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1f/qgYd1hp1mLwoixEUX+NfB0hBePURRnKwRiQEkN3A=; b=f8fsQg+k7JnjGLkJ+j5frdbBKIY+xRCeSrRMFX1dVuHXxmRnSbGzScuLIyG3MqLDhe NTeN1+c33iIIE3lOQUppPMknkDUuigstozwL9PObWfk2wS+e1ON0MVfiao4AR31tYG/P mczej+nS1y9e0okHKXxHkglT0+2gXaGIJCnoS9T9tmlqCDZ7pTlO+3wD8146tmZ3uqyZ dBOYpPNC3vYZnkzVouuN/HnJbjjiuoygIorItSdm+vpcOt3zqJbE55BwVqP8XWwmW9m8 /Y0LcypSEhojFp7+nrOSNway8ZMqvm7UHRBlYw+k66Z8WYb65DQAyLZPcJ/M3znj8frT Cn4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158767; x=1728763567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1f/qgYd1hp1mLwoixEUX+NfB0hBePURRnKwRiQEkN3A=; b=qTdQObFj3PZWTdQ8YGutHz3a1SWF+vE+5Wz0YOCEoYMwL3TEqCJ5qfjCML6M7hc99D SvxtMftKxIo1eSOuf1bbl1g4behowTJAcq7pyznABNC0094K569hqIh67IwN9xf7RtwA FCywiQqr+M2K1E2d4t/if64YTbKqj51Wf/ozsYU+rk1+SpJ92L0XnIGK+TctS31pbm08 BHmVGx5+5qb3IIznADDktv7W14bliVNX4n1+QzcIjruaLUSk9azzMmvR2KL1oUEhJzGZ ZJY18L3KEhZbBoZvtN7pCPTkwnBEac6Lq1VxmA5lHbPO+gST52UWb10QuZDsHYXpqJtj i73w== X-Forwarded-Encrypted: i=1; AJvYcCWdTMb+7U+54jaHJz7p7wFI+BQbLFSKV3JG8D5N12u8W/S8THZha99Igoe1jGK4p78aOOKjr19hwgVvEw8=@vger.kernel.org X-Gm-Message-State: AOJu0YytRZkbIg4I0kOfHKjTGfjn6Sr/5OlfUFGtu1oUZy/w9SB+h1Tt zOVS+03R+Tb7w3ED8XpbeQd0UtVIiHhiQbWiBVMAi0ktaof8dGsC2mK26XxczP7nw/lgx2jJEYY 3 X-Google-Smtp-Source: AGHT+IFzmszmyv7EFaMoyI1QCdaJl5nSZJZ1pqGh26krRNpf2aOXvO2XCeE4nHbEYZOTpe8UJGf/ng== X-Received: by 2002:a17:902:ecc8:b0:20b:7784:27a2 with SMTP id d9443c01a7336-20bfe07c8aemr114472495ad.27.1728158767224; Sat, 05 Oct 2024 13:06:07 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 06/21] hw/core/tcg-cpu-ops: Introduce tlb_fill_align hook Date: Sat, 5 Oct 2024 13:05:45 -0700 Message-ID: <20241005200600.493604-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the hook to struct TCGCPUOps. Add a default implementation that recognizes alignment faults before page faults. Populate all TCGCPUOps structures with the default implementation. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- include/hw/core/tcg-cpu-ops.h | 25 +++++++++++++++++++++++++ accel/tcg/cputlb.c | 19 +++++++++++++++++++ target/alpha/cpu.c | 1 + target/arm/cpu.c | 1 + target/arm/tcg/cpu-v7m.c | 1 + target/avr/cpu.c | 1 + target/hppa/cpu.c | 1 + target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 1 + target/m68k/cpu.c | 1 + target/microblaze/cpu.c | 1 + target/mips/cpu.c | 1 + target/openrisc/cpu.c | 1 + target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 1 + target/rx/cpu.c | 1 + target/s390x/cpu.c | 1 + target/sh4/cpu.c | 1 + target/sparc/cpu.c | 1 + target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 1 + 21 files changed, 63 insertions(+) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 34318cf0e6..49420bc93d 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -13,6 +13,7 @@ #include "exec/breakpoint.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" +#include "exec/memop.h" #include "exec/mmu-access-type.h" #include "exec/vaddr.h" @@ -131,6 +132,21 @@ struct TCGCPUOps { * same function signature. */ bool (*cpu_exec_halt)(CPUState *cpu); + + /** + * @tlb_fill_align: Handle a softmmu tlb miss, and alignment fault + * + * If the access is valid, call tlb_set_page and return true; + * if the access is invalid and probe is true, return false; + * otherwise raise an exception and do not return. + * + * The alignment check is deferred to this hook, so that the + * target can choose to recognize either before or after the + * permission check. + */ + bool (*tlb_fill_align)(CPUState *cpu, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); /** * @tlb_fill: Handle a softmmu tlb miss * @@ -234,6 +250,15 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, */ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); +/* + * tlb_fill_align_first: + * + * Prioritize alignment faults over page faults. + */ +bool tlb_fill_align_first(CPUState *cpu, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); + #endif #endif /* TCG_CPU_OPS_H */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index f5fca5a118..4bc34c8a37 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1565,6 +1565,25 @@ bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx, } #endif + +/* + * Generic implementation of tlb_fill_align which recognizes + * alignment faults before page faults. + */ +bool tlb_fill_align_first(CPUState *cpu, vaddr addr, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + unsigned a_bits = memop_alignment_bits(mop); + + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); + } + + return cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, access_type, + mmu_idx, probe, retaddr); +} + /* * Probe for a load/store operation. * Return the host address and into @flags. diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 9db1dffc03..2eb5afd34a 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -217,6 +217,7 @@ static const TCGCPUOps alpha_tcg_ops = { .record_sigsegv = alpha_cpu_record_sigsegv, .record_sigbus = alpha_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = alpha_cpu_tlb_fill, .cpu_exec_interrupt = alpha_cpu_exec_interrupt, .cpu_exec_halt = alpha_cpu_has_work, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 19191c2391..08731ed4e0 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2663,6 +2663,7 @@ static const TCGCPUOps arm_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 5496f14dc1..8874fe0e11 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -242,6 +242,7 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 3132842d56..6ac4434f1d 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -211,6 +211,7 @@ static const TCGCPUOps avr_tcg_ops = { .restore_state_to_opc = avr_restore_state_to_opc, .cpu_exec_interrupt = avr_cpu_exec_interrupt, .cpu_exec_halt = avr_cpu_has_work, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = avr_cpu_tlb_fill, .do_interrupt = avr_cpu_do_interrupt, }; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 7cf2e2f266..3b6c325e09 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,6 +226,7 @@ static const TCGCPUOps hppa_tcg_ops = { .restore_state_to_opc = hppa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = hppa_cpu_tlb_fill, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, .cpu_exec_halt = hppa_cpu_has_work, diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index cca19cd40e..83cfb86346 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -117,6 +117,7 @@ static const TCGCPUOps x86_tcg_ops = { .record_sigsegv = x86_cpu_record_sigsegv, .record_sigbus = x86_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = x86_cpu_tlb_fill, .do_interrupt = x86_cpu_do_interrupt, .cpu_exec_halt = x86_cpu_exec_halt, diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 7212fb5f8f..ae8856d988 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -755,6 +755,7 @@ static const TCGCPUOps loongarch_tcg_ops = { .restore_state_to_opc = loongarch_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = loongarch_cpu_tlb_fill, .cpu_exec_interrupt = loongarch_cpu_exec_interrupt, .cpu_exec_halt = loongarch_cpu_has_work, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 1d49f4cb23..295ebd941b 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -534,6 +534,7 @@ static const TCGCPUOps m68k_tcg_ops = { .restore_state_to_opc = m68k_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = m68k_cpu_tlb_fill, .cpu_exec_interrupt = m68k_cpu_exec_interrupt, .cpu_exec_halt = m68k_cpu_has_work, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 135947ee80..6e63600631 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -411,6 +411,7 @@ static const TCGCPUOps mb_tcg_ops = { .restore_state_to_opc = mb_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = mb_cpu_tlb_fill, .cpu_exec_interrupt = mb_cpu_exec_interrupt, .cpu_exec_halt = mb_cpu_has_work, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 89655b1900..5a36b22256 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -553,6 +553,7 @@ static const TCGCPUOps mips_tcg_ops = { .restore_state_to_opc = mips_restore_state_to_opc, #if !defined(CONFIG_USER_ONLY) + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = mips_cpu_tlb_fill, .cpu_exec_interrupt = mips_cpu_exec_interrupt, .cpu_exec_halt = mips_cpu_has_work, diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 6ec54ad7a6..9223228758 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -231,6 +231,7 @@ static const TCGCPUOps openrisc_tcg_ops = { .restore_state_to_opc = openrisc_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = openrisc_cpu_tlb_fill, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, .cpu_exec_halt = openrisc_cpu_has_work, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 23881d09e9..42a38ec155 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7482,6 +7482,7 @@ static const TCGCPUOps ppc_tcg_ops = { #ifdef CONFIG_USER_ONLY .record_sigsegv = ppc_cpu_record_sigsegv, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = ppc_cpu_tlb_fill, .cpu_exec_interrupt = ppc_cpu_exec_interrupt, .cpu_exec_halt = ppc_cpu_has_work, diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index dea8ab7a43..42c4ea13af 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -137,6 +137,7 @@ static const TCGCPUOps riscv_tcg_ops = { .restore_state_to_opc = riscv_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = riscv_cpu_tlb_fill, .cpu_exec_interrupt = riscv_cpu_exec_interrupt, .cpu_exec_halt = riscv_cpu_has_work, diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 36d2a6f189..27fc372ca4 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -188,6 +188,7 @@ static const TCGCPUOps rx_tcg_ops = { .initialize = rx_translate_init, .synchronize_from_tb = rx_cpu_synchronize_from_tb, .restore_state_to_opc = rx_restore_state_to_opc, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = rx_cpu_tlb_fill, #ifndef CONFIG_USER_ONLY diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 4e41a3dff5..8120ddeb5b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -363,6 +363,7 @@ static const TCGCPUOps s390_tcg_ops = { .record_sigsegv = s390_cpu_record_sigsegv, .record_sigbus = s390_cpu_record_sigbus, #else + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = s390_cpu_tlb_fill, .cpu_exec_interrupt = s390_cpu_exec_interrupt, .cpu_exec_halt = s390_cpu_has_work, diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 8f07261dcf..b03f6dfad8 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -252,6 +252,7 @@ static const TCGCPUOps superh_tcg_ops = { .restore_state_to_opc = superh_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = superh_cpu_tlb_fill, .cpu_exec_interrupt = superh_cpu_exec_interrupt, .cpu_exec_halt = superh_cpu_has_work, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 54cb269e0a..da1bfad5f0 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -924,6 +924,7 @@ static const TCGCPUOps sparc_tcg_ops = { .restore_state_to_opc = sparc_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = sparc_cpu_tlb_fill, .cpu_exec_interrupt = sparc_cpu_exec_interrupt, .cpu_exec_halt = sparc_cpu_has_work, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 1a26171590..9d8f8f13d2 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -173,6 +173,7 @@ static const TCGCPUOps tricore_tcg_ops = { .initialize = tricore_tcg_init, .synchronize_from_tb = tricore_cpu_synchronize_from_tb, .restore_state_to_opc = tricore_restore_state_to_opc, + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = tricore_cpu_tlb_fill, .cpu_exec_interrupt = tricore_cpu_exec_interrupt, .cpu_exec_halt = tricore_cpu_has_work, diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index a08c7a0b1f..b0f84403f0 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -232,6 +232,7 @@ static const TCGCPUOps xtensa_tcg_ops = { .restore_state_to_opc = xtensa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY + .tlb_fill_align = tlb_fill_align_first, .tlb_fill = xtensa_cpu_tlb_fill, .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, .cpu_exec_halt = xtensa_cpu_has_work, From patchwork Sat Oct 5 20:05:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823483 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB65D15884D for ; Sat, 5 Oct 2024 20:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158770; cv=none; b=Sn8GOoCo5cTPEGwrJjUPx/TuPpnanTxos8aW6tK5o4quM05AeVfLc8XPtGmmpinP5IwNkTi0evAO1HbQx8RgMA0GkVacvBWTPr7EpPtDPJ2EcwvS+FJL937VtuSsGWU/lnLKnsJqGjv8dScdSbfY+QNrY2BOBt7lPd6bQ0TGy5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158770; c=relaxed/simple; bh=4NVUV6YGGVu0dfDzUFRQNyxQmIfvN5ZZlTdwZgCxg+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fnsOszN9O5v0kR0gPoKP56/Q9VdIl7L23DqT2VDsBGwo/9m60FBmkLDoQg76uuXiuMjR3K8E9mIOsK8twhpkF3NRbkPJIKM7ZxSpkLfhuwF70N+6zH8H3psUV4QPSgBwA1vSbROYvK9XSn7vNlOx3VZQiYqB6kBR99HPk8YLlb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CBvBxve3; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CBvBxve3" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7e6cbf6cd1dso2137937a12.3 for ; Sat, 05 Oct 2024 13:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158768; x=1728763568; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aSpIks7wgvzrdGiSzq/HYW4dr1jFM7gjMRozlRGemJM=; b=CBvBxve3AOd605pmn6pu7RU/ddkplixEz8+Hhd3gsbHgouPCysEAV/pJa2nVUGP6Q/ 4L2JJM2wW02k2KGFLnK14QXdlIrK6C7eGyaoTuQUjAS/EaJHjwVAFmB2+u3LTMoeqCLw hn+50hYDjFKEfvsGf/WR7NEaJlrWzoTNVrxOqfFHjWT4ziK1ITPydXMM4kreSFEFfP6z sJP6pIhCzt+CQi1SEEQz7H2GRO/ZaVKjlILkSUHa64yAyp60xQWWx3dPltFzkJBmKJI9 LFbGAFh1BzTz8cGULpxJDsKR8hvjMlC4dInQdlHxkaOFtyAzCSvlMv2t9JQDyXcZARlm uaPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158768; x=1728763568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aSpIks7wgvzrdGiSzq/HYW4dr1jFM7gjMRozlRGemJM=; b=rmzTa0IgleT4i1se04WCDVhvd4YkiG/Ua4TBR7uL/vZlzRjR7ogsit2fKAU3CcD2rJ Nao7VFAJ3YEX5YibOn6dyUvdjojsv9wx42kbVDbEH0Z0Si7ern8zK7MYvUFqGYTHLCPk InNRSNgDFlEWF1sfDXLJOHLhT9PZJl56BlA5NEz0sHlx0mqzBlypOFUHAvU3A5PZl+jl AaUP7G1flstHWnc39RukUYdrEvoyIqBGNcafukZBUvj2npZgwS2jF3cr7wbFtq4y97HG E5HYvAVjUHxllHPDdz8I/U7mA6HHkqLigG2P7Vhi0BZm+qvO50fxAr4Pjp4WkISPxMfq z3Uw== X-Forwarded-Encrypted: i=1; AJvYcCVN1dq/4956PWpjNyR5mSoNw/xDRjRAkp3Yywjhu6q9uTLe6Ji5Kzk8RKdJfMaNst7h/rbnsUaMkRtskAk=@vger.kernel.org X-Gm-Message-State: AOJu0YygDdRNk1UZ2GnArSXhPIE45fNwRqr+fMlkSEKS6A7lp1QlS3fr /l8EWl3MH2Iqx1E1LaYQ6otpwAv211Lm5oNw6n5APwjTHKKFCI+bfMl3nU1W3Og= X-Google-Smtp-Source: AGHT+IEaeCLxh/V4FYDHhcizmCqrbA2X6RtS9JLzATD1GoweD02dQoKPmQSlloLgWaenfDYRsJ7amg== X-Received: by 2002:a17:90a:a107:b0:2e0:7560:9334 with SMTP id 98e67ed59e1d1-2e1e636f75bmr8187622a91.36.1728158768046; Sat, 05 Oct 2024 13:06:08 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 07/21] accel/tcg: Use the tlb_fill_align hook Date: Sat, 5 Oct 2024 13:05:46 -0700 Message-ID: <20241005200600.493604-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When we have a tlb miss, defer the alignment check to the new tlb_fill_align hook. Move the existing alignment check so that we only perform it with a tlb hit. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- accel/tcg/cputlb.c | 89 +++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 4bc34c8a37..0e6ae65a39 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1616,14 +1616,14 @@ typedef struct MMULookupLocals { * tlb_fill will longjmp out. Return true if the softmmu tlb for * @mmu_idx may have resized. */ -static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, +static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, MemOp memop, int mmu_idx, MMUAccessType access_type, uintptr_t ra) { vaddr addr = data->addr; uintptr_t index = tlb_index(cpu, mmu_idx, addr); CPUTLBEntry *entry = tlb_entry(cpu, mmu_idx, addr); uint64_t tlb_addr = tlb_read_idx(entry, access_type); - bool maybe_resized = false; + bool did_tlb_fill = false; CPUTLBEntryFull *full; int flags; @@ -1631,17 +1631,26 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, access_type, addr & TARGET_PAGE_MASK)) { - bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, data->size, - access_type, mmu_idx, - false, ra); + bool ok = cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, memop, + data->size, access_type, + mmu_idx, false, ra); assert(ok); - maybe_resized = true; + did_tlb_fill = true; index = tlb_index(cpu, mmu_idx, addr); entry = tlb_entry(cpu, mmu_idx, addr); } tlb_addr = tlb_read_idx(entry, access_type) & ~TLB_INVALID_MASK; } + if (!did_tlb_fill) { + /* We didn't use tlb_fill_align, so alignment not yet checked. */ + unsigned a_bits = memop_alignment_bits(memop); + + if (unlikely(addr & ((1 << a_bits) - 1))) { + cpu_unaligned_access(cpu, addr, access_type, mmu_idx, ra); + } + } + full = &cpu->neg.tlb.d[mmu_idx].fulltlb[index]; flags = tlb_addr & (TLB_FLAGS_MASK & ~TLB_FORCE_SLOW); flags |= full->slow_flags[access_type]; @@ -1651,7 +1660,7 @@ static bool mmu_lookup1(CPUState *cpu, MMULookupPageData *data, /* Compute haddr speculatively; depending on flags it might be invalid. */ data->haddr = (void *)((uintptr_t)addr + entry->addend); - return maybe_resized; + return did_tlb_fill; } /** @@ -1702,7 +1711,6 @@ static void mmu_watch_or_dirty(CPUState *cpu, MMULookupPageData *data, static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, uintptr_t ra, MMUAccessType type, MMULookupLocals *l) { - unsigned a_bits; bool crosspage; int flags; @@ -1711,12 +1719,6 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, tcg_debug_assert(l->mmu_idx < NB_MMU_MODES); - /* Handle CPU specific unaligned behaviour */ - a_bits = memop_alignment_bits(l->memop); - if (addr & ((1 << a_bits) - 1)) { - cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); - } - l->page[0].addr = addr; l->page[0].size = memop_size(l->memop); l->page[1].addr = (addr + l->page[0].size - 1) & TARGET_PAGE_MASK; @@ -1724,7 +1726,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, crosspage = (addr ^ l->page[1].addr) & TARGET_PAGE_MASK; if (likely(!crosspage)) { - mmu_lookup1(cpu, &l->page[0], l->mmu_idx, type, ra); + mmu_lookup1(cpu, &l->page[0], l->memop, l->mmu_idx, type, ra); flags = l->page[0].flags; if (unlikely(flags & (TLB_WATCHPOINT | TLB_NOTDIRTY))) { @@ -1743,8 +1745,8 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Lookup both pages, recognizing exceptions from either. If the * second lookup potentially resized, refresh first CPUTLBEntryFull. */ - mmu_lookup1(cpu, &l->page[0], l->mmu_idx, type, ra); - if (mmu_lookup1(cpu, &l->page[1], l->mmu_idx, type, ra)) { + mmu_lookup1(cpu, &l->page[0], l->memop, l->mmu_idx, type, ra); + if (mmu_lookup1(cpu, &l->page[1], 0, l->mmu_idx, type, ra)) { uintptr_t index = tlb_index(cpu, l->mmu_idx, addr); l->page[0].full = &cpu->neg.tlb.d[l->mmu_idx].fulltlb[index]; } @@ -1770,7 +1772,7 @@ static bool mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * Device memory type require alignment. */ if (unlikely(flags & TLB_CHECK_ALIGNED)) { - a_bits = memop_atomicity_bits(l->memop); + unsigned a_bits = memop_atomicity_bits(l->memop); if (addr & ((1 << a_bits) - 1)) { cpu_unaligned_access(cpu, addr, type, l->mmu_idx, ra); } @@ -1788,34 +1790,18 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, { uintptr_t mmu_idx = get_mmuidx(oi); MemOp mop = get_memop(oi); - int a_bits = memop_alignment_bits(mop); uintptr_t index; CPUTLBEntry *tlbe; vaddr tlb_addr; void *hostaddr; CPUTLBEntryFull *full; + bool did_tlb_fill = false; tcg_debug_assert(mmu_idx < NB_MMU_MODES); /* Adjust the given return address. */ retaddr -= GETPC_ADJ; - /* Enforce guest required alignment. */ - if (unlikely(a_bits > 0 && (addr & ((1 << a_bits) - 1)))) { - /* ??? Maybe indicate atomic op to cpu_unaligned_access */ - cpu_unaligned_access(cpu, addr, MMU_DATA_STORE, - mmu_idx, retaddr); - } - - /* Enforce qemu required alignment. */ - if (unlikely(addr & (size - 1))) { - /* We get here if guest alignment was not requested, - or was not enforced by cpu_unaligned_access above. - We might widen the access and emulate, but for now - mark an exception and exit the cpu loop. */ - goto stop_the_world; - } - index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); @@ -1824,10 +1810,11 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, if (!tlb_hit(tlb_addr, addr)) { if (!victim_tlb_hit(cpu, mmu_idx, index, MMU_DATA_STORE, addr & TARGET_PAGE_MASK)) { - bool ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, - MMU_DATA_STORE, mmu_idx, - false, retaddr); + bool ok = cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, mop, size, + MMU_DATA_STORE, mmu_idx, + false, retaddr); assert(ok); + did_tlb_fill = true; index = tlb_index(cpu, mmu_idx, addr); tlbe = tlb_entry(cpu, mmu_idx, addr); } @@ -1841,8 +1828,8 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, * but addr_read will only be -1 if PAGE_READ was unset. */ if (unlikely(tlbe->addr_read == -1)) { - cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, MMU_DATA_LOAD, - mmu_idx, false, retaddr); + cpu->cc->tcg_ops->tlb_fill_align(cpu, addr, mop, size, MMU_DATA_LOAD, + mmu_idx, false, retaddr); /* * Since we don't support reads and writes to different * addresses, and we do have the proper page loaded for @@ -1850,6 +1837,28 @@ static void *atomic_mmu_lookup(CPUState *cpu, vaddr addr, MemOpIdx oi, */ g_assert_not_reached(); } + + /* Enforce guest required alignment, if not handled by tlb_fill_align. */ + if (!did_tlb_fill) { + int a_bits = memop_alignment_bits(mop); + if (unlikely(a_bits > 0 && (addr & ((1 << a_bits) - 1)))) { + /* ??? Maybe indicate atomic op to cpu_unaligned_access */ + cpu_unaligned_access(cpu, addr, MMU_DATA_STORE, + mmu_idx, retaddr); + } + } + + /* Enforce qemu required alignment. */ + if (unlikely(addr & (size - 1))) { + /* + * We get here if guest alignment was not requested, + * or was not enforced by cpu_unaligned_access above. + * We might widen the access and emulate, but for now + * mark an exception and exit the cpu loop. + */ + goto stop_the_world; + } + /* Collect tlb flags for read. */ tlb_addr |= tlbe->addr_read; From patchwork Sat Oct 5 20:05:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823484 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B06A8157E6B for ; Sat, 5 Oct 2024 20:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158771; cv=none; b=j78VjGeWhnzoxGRBEBTLhbQC9cqOxemLgKg9fYC/T+6x8DDoCfEjGlznfwuzhQaUhJhfrpXqXwiNokPtZLfoJzR0WqbGJrm4hiHz2Pt8BbrPQk7lHHEdd3GiRPJVPOhwAiJh6D/pZp3CWbLznQMg4COL753Yt6zf/Iv/oquBLKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158771; c=relaxed/simple; bh=lMqTSWOZj1IlCEf4v6pbIf89Bz3BR40fXSPmPVcNUi8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=th1MRn6jLpaIiz95zmO1lbcDWRZbf8I7lAJzCy0dX4Uu39CasamCIDadBWDKemgl6Qm4HtNJeUX5oKhLOsn2aRBC94p1wxaQPKpAt2tA7GLSxctDMayaqHPLHNYbeha++pQqQys+CnK2JsNJd0zmoibvwSlvyXs66A5PO5gIjn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=r7+m/l2y; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r7+m/l2y" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-20b0b5cdb57so31578975ad.1 for ; Sat, 05 Oct 2024 13:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158769; x=1728763569; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MP+WvwE/XecW9wPOVCpjk+gA5jxWiH/v3HQ4ejXK7hQ=; b=r7+m/l2y9IjIBKWQK9an4EO+J+OP12yrnQPww6L5OhJkfT7h6OUMrVa0ev83dL8UYV H2o73UzIsZNEVDxfU0BVLhcDqYNeA1LktRMwO1Xvy3EBdjwZ9EsD7MpRTlDkX3Ybp4js lC7JMW0OUAhNF262MVtTq5OA7XjPRma18Vu+YlFD3cHU2KxGTg8Cg+3pTt4A/5DNMvL0 K7CRENTk/DlPPU9/LOffDIrNfrEbuIel71cf6dq9cK/WAjw23ytW28c0arQNrEAaaOQ4 QPQ6g4vd2m2mtkRZlUJlXq8ofDswTzbSwyAilAaZdqs3d1FXb0uE5uOdEaARWtd+sXSo /Rog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158769; x=1728763569; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MP+WvwE/XecW9wPOVCpjk+gA5jxWiH/v3HQ4ejXK7hQ=; b=q6KktonmYHeAJinEqZ6Geen4qy8YVMuMTTRrFSkHfToefI17PyGZ+qGEEYucfor5At X+0BJqGoh1p+sayQluwRoKsaoM7QSEajg4Y+JZJap47iwngQFwPBQQT4DGBHSg/peDUI cwv86KkEJj+xStKBXOY+W939lmayAoQxH+fhAH9hsRhLRlFN2hTIxHfJh0AND82XpqyQ XgAFe8tY85Gx7B0KtoHQCB4mUKORTMaSm2nnINfr4B8m+9SmR9FVuFwGlRPe5B9zCVmZ sFYnUfKiTWAzmGq5TH3n4tiEGfn71ugYn7Oh8lSxpzcHibmWHbneJ+OBd6/40QiOFXEz zvrQ== X-Forwarded-Encrypted: i=1; AJvYcCVsj7v1EHOl+5HQ0YiSxsIK/dCPVxFHr6/v7nbgQKHIm0PqGG1g1y+hipbdRfYwvJ/3ziXQpLFzAy4PRlw=@vger.kernel.org X-Gm-Message-State: AOJu0YyVFR5hOjT+cF5RKxIgtupL3wJOUIyWyX5Za8iOtrqtWQFIx7Vk LQ9/yfgXj5xkSDGuT+PtwrtX8I5fOoFeNfqDBdgkJQqE1nSN8k0OOGbIvpy9OeOxAB8Mga2LnPd c X-Google-Smtp-Source: AGHT+IG4o7j/ZFzlHdwrYk17l+PK6a847Ql8/KK14Pm1cpqL+sGkT/q0+Vhje7Ma/G1N+w5P6iDU7A== X-Received: by 2002:a17:902:d2cc:b0:20b:7902:3456 with SMTP id d9443c01a7336-20bff37ac46mr105992105ad.1.1728158769036; Sat, 05 Oct 2024 13:06:09 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 08/21] target/hppa: Add MemOp argument to hppa_get_physical_address Date: Sat, 5 Oct 2024 13:05:47 -0700 Message-ID: <20241005200600.493604-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Just add the argument, unused at this point. Zero is the safe do-nothing value for all callers. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/cpu.h | 2 +- target/hppa/int_helper.c | 2 +- target/hppa/mem_helper.c | 9 +++++---- target/hppa/op_helper.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index f4e051f176..526855f982 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -369,7 +369,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot); + int type, MemOp mop, hwaddr *pphys, int *pprot); void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index 391f32f27d..58695def82 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -167,7 +167,7 @@ void hppa_cpu_do_interrupt(CPUState *cs) vaddr = hppa_form_gva_psw(old_psw, env->iasq_f, vaddr); t = hppa_get_physical_address(env, vaddr, MMU_KERNEL_IDX, - 0, &paddr, &prot); + 0, 0, &paddr, &prot); if (t >= 0) { /* We can't re-load the instruction. */ env->cr[CR_IIR] = 0; diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index b984f730aa..a386c80fa4 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -197,7 +197,7 @@ static int match_prot_id64(CPUHPPAState *env, uint32_t access_id) } int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, - int type, hwaddr *pphys, int *pprot) + int type, MemOp mop, hwaddr *pphys, int *pprot) { hwaddr phys; int prot, r_prot, w_prot, x_prot, priv; @@ -340,7 +340,7 @@ hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) mmu_idx = (cpu->env.psw & PSW_D ? MMU_KERNEL_IDX : cpu->env.psw & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX); - excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, + excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0, 0, &phys, &prot); /* Since we're translating for debugging, the only error that is a @@ -438,7 +438,8 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, &phys, &prot); + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { return false; @@ -678,7 +679,7 @@ target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulong addr) hwaddr phys; int prot, excp; - excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, + excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0, 0, &phys, &prot); if (excp >= 0) { if (excp == EXCP_DTLB_MISS) { diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 7f79196fff..744325969f 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -334,7 +334,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr, } mmu_idx = PRIV_P_TO_MMU_IDX(level, env->psw & PSW_P); - excp = hppa_get_physical_address(env, addr, mmu_idx, 0, &phys, &prot); + excp = hppa_get_physical_address(env, addr, mmu_idx, 0, 0, &phys, &prot); if (excp >= 0) { cpu_restore_state(env_cpu(env), GETPC()); hppa_set_ior_and_isr(env, addr, MMU_IDX_MMU_DISABLED(mmu_idx)); From patchwork Sat Oct 5 20:05:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823485 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9624B153838 for ; Sat, 5 Oct 2024 20:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158772; cv=none; b=RN4qKmgv2EHs6pojsgr+Y5zeIFcUi3jU6tPaa7F2r0n9ngoNWNWQGPQtbqPTH3sjhkC5FXaUgfs8SV9IKEizBQrE1D56ej6mMxORC1/KB4vCEE24RdZdSIzZn4nA8MoJ6c7K0tOfG/MS4BTEwt6UWvPEHRqKkryj/jXpFpIEPdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158772; c=relaxed/simple; bh=tZoCwtIK/p1jJzOfgZpJrtMvDCOC/SNFglCoA1ddJgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fUfewvidLjwJqpZejAn68ZUK08Zsd/NLGdxfYPYbuJuO1nj8ubYyDUBlEwZUoq8ZaBVc1NSsqYVAT102Y31XvWanUOOKSyis/D9zptSR8648Uob+5LPpkygxZ1MKudXvBu5aCdgbxHA02XerhIrzwUu7Vfr6/ikXRgitl7u2fmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=eKC0fodX; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eKC0fodX" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7e6d04f74faso2687676a12.1 for ; Sat, 05 Oct 2024 13:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158770; x=1728763570; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/wa2JC5GTiuZOa9FUt+c/E5R/4D7wBSs90VoPwelenc=; b=eKC0fodXNH0cWRel+oF0XjEEgKjmE7nAXFyQgEMYXCb3+2XK36hH75/KqGOIz3fcIk gOuj25NtwkAhH0FOPUmRoZYJvQ3ZRIuuxG6waD397L4ATR6a8aE4m3bemksf5AUnePAj iNtrw25k1ZUXxqpQjcnynIG8D8eOt5jIXmSY4enrzIY2ggWeJH2CQAPQxCWcVqTwGjM+ qhEroxJu1YfCi9DGBiiJXMhe8dPutUzp98SZy/28feX6l/I+FShyuUFAZjJ88zV92EP3 kOzLxmnKKQ/5jbq3x0rCOIEs8nqplQAJwD56gWJuw9t33pFqhm0+N3OMToGwBislPiop ++wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158770; x=1728763570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/wa2JC5GTiuZOa9FUt+c/E5R/4D7wBSs90VoPwelenc=; b=jafYU5oIDpTlJsS4issUuKISu5D6CydQnpH877IOuoGkTf9NReltwhwkBzuyzPoLxe 1SNXDXlLf4jWk4BfBt9qfBp3n2HKJuP0oAIkGjBYmcl6wL6edITkLa5Pt7GJRDcJ4RN2 Igjc2E2VMEyzTbNa9IX3pzoDAl9DImkeuWhaUvrJdPuX9BjqWFK2eXMzuMimWg/VFRcR Da8xA4conL1O/+P9tihOyROlUiE9jP6aNzTRsRo/r0uxS+XfJm3dluQWWX/jyhHrbBac 1LZWjOUp/BVvcbMrJv0Z1uakHx2TkTAhYHzdAjx+brP1NvchtJTZFSbZRbrPPVsUtimG SCSA== X-Forwarded-Encrypted: i=1; AJvYcCUwQMB4S3Cjvw03q1mENbA8Kg4d0XTjn4fVhvSneUNdcnmkO2oWFIVppv5hrpn7AclmJgyZ/LYSM1/cJEs=@vger.kernel.org X-Gm-Message-State: AOJu0YwGpuE3bh+Xs8PtecOF88qMVF1i7nLkt7uIufc4RYtzyyLs8KSi MdZc6nwGH99TV345VnsPeb9+0rXmEiwOFhjZxa3pit2NS8Nq+IGFXZPIh9ssCgQ= X-Google-Smtp-Source: AGHT+IEu/yRGIXzgnnxtsNkCW1Gem8iXzS/ffba0hjtpfN6ZQ1VIoxbuDWZWql5a5WIxSKhWPrRs6g== X-Received: by 2002:a17:90b:3709:b0:2e0:7b03:1908 with SMTP id 98e67ed59e1d1-2e1b38c7582mr16486887a91.10.1728158770066; Sat, 05 Oct 2024 13:06:10 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 09/21] target/hppa: Perform access rights before protection id check Date: Sat, 5 Oct 2024 13:05:48 -0700 Message-ID: <20241005200600.493604-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In Chapter 5, Interruptions, the group 3 exceptions lists "Data memory access rights trap" in priority order ahead of "Data memory protection ID trap". Swap these checks in hppa_get_physical_address. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/mem_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index a386c80fa4..f027c494e2 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -267,6 +267,12 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, goto egress; } + if (unlikely(!(prot & type))) { + /* Not allowed -- Inst/Data Memory Access Rights Fault. */ + ret = (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; + goto egress; + } + /* access_id == 0 means public page and no check is performed */ if (ent->access_id && MMU_IDX_TO_P(mmu_idx)) { int access_prot = (hppa_is_pa20(env) @@ -281,12 +287,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, prot &= access_prot; } - if (unlikely(!(prot & type))) { - /* Not allowed -- Inst/Data Memory Access Rights Fault. */ - ret = (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR; - goto egress; - } - /* * In priority order, check for conditions which raise faults. * Remove PROT bits that cover the condition we want to check, From patchwork Sat Oct 5 20:05:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823486 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77696157E6B for ; Sat, 5 Oct 2024 20:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158772; cv=none; b=cg4lVEKTcz6N+7D8ycb5xZqyxXXblMRjY0Ae/fKIaTiZWVuTQYvx2bRNaJlpw0GOgDuvL0QPa6Plg3WBdhlY3d3QDDzfWpg8awd/E+ZS0DP6oifdlAu+kBV1JxXJq2fWRJp7JJbth5mC8VJ/L6riP0OqylQUXasqFZO3Mqq8wFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158772; c=relaxed/simple; bh=sTfOjnd7WOnuX+x1S4o3BYX1tyPFXVNWkYKKV6kIQa8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C+d6D6rRxVp2iSq3NF9QT+ChxsezpvqI7uVJy9Z6hhjW4ddyBRMwK0LLTjsE+F9uijvMnDyNdpCi/xJIZUK3KWTCLTZhuZr4f1hJyE3CWKzMyef0qKlPGG8PkSFWL3qDrPylYoU+xC8aKl0OR4vIleih/suSMvZNMu/Slm3Ryy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HXBZNOnJ; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HXBZNOnJ" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20ba6b39a78so23376485ad.3 for ; Sat, 05 Oct 2024 13:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158771; x=1728763571; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=posPbKSzdb+ffX+WhfgYFaW0pAyKjx4IZlbzVQLaTuc=; b=HXBZNOnJalyxYK9ALB3Qs+2IKPK6OnA1ou/s/A+TVE248kMWUoBWQFx3Ervfh1N0Pp AtcSDqUpK8b/BCFsZ6PVvA41eQUviad84xOccKRDRj02ql99MOzRpM5Zv7SaANh/e0cn hK2rUZO+iypQ5UZBGqhSYkKl3kUZAnzc/Mzu/TFzWWCwxIDD5zsWWLGOlHM7O7O9mRZb 0NYmnBO7kDopxex/5zOEnz7943vP2Pffn+3SqQQ5Wt0k3MEb+lA1hqK8KGAyzbJRk8sT Is9b1OulbJ1NcJqbSeyoworDyjyKw+3DC1l1Bqj5hNJrY5ItuUqYUUobQzymwHWaNcQN N6RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158771; x=1728763571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=posPbKSzdb+ffX+WhfgYFaW0pAyKjx4IZlbzVQLaTuc=; b=sxcViMyMdCWnIeRXxg/Q+qBH8irZZ9w7zMEkgJCu8owdBhy+SmplkamP3ysniX93Zw e4hVjxQfqYSjmVxsGJ09MOLkRtkBAv6hdTV6OLk0v8bCFUniVp5/zWAYIaDt0sFWf5Dr ICFl9MMOh1PlXewiaLbAgdLSylvMoFCiZPn3ABcf1H4WyIbXxT2e7BjmlZMLpWaENurW OlIrvSGi9KnxeinePYPlAMB+0gr+Gj5Sij/ATdrqOUX9C5Q7B4L3vOqa/67CwiEM5Sg2 c9yThK/W4k4eQ5bVsBmCnLU/HxVo7UdKtBf1ZMM38UO+WsgAprw6l7CrR14CNsPBhx5g 3yAA== X-Forwarded-Encrypted: i=1; AJvYcCXCx6LXO+RhNHlzom4/0ERau9FeJODU3aKz9ZqxipxpQaJvS97/85M1i0F+PdNax+r2sIU6J+iOAlAVqC0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyy4EaiwJjXPb7tsS8D9/zRoVzuATuKaLc4qY98PimZWfMYvur9 Y+vbXQ+MbtQvfIwlIKiaLvhYkCVH7S9vjYKCExhKKC6HAkin0MCjpkLJATRzoUE= X-Google-Smtp-Source: AGHT+IFkbH5I/ZaJe+I4v335+XuhQ/F/ef46EsJUG+t30A/nnryOiFz1aTLseUaZK0R77t/l8tl9fg== X-Received: by 2002:a17:902:da91:b0:20b:7c00:5e50 with SMTP id d9443c01a7336-20bfe022a33mr98058335ad.12.1728158770895; Sat, 05 Oct 2024 13:06:10 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 10/21] target/hppa: Fix priority of T, D, and B page faults Date: Sat, 5 Oct 2024 13:05:49 -0700 Message-ID: <20241005200600.493604-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop the 'else' so that ret is overridden with the highest priority fault. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/mem_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index f027c494e2..f71cedd7a9 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -288,7 +288,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, } /* - * In priority order, check for conditions which raise faults. + * In reverse priority order, check for conditions which raise faults. * Remove PROT bits that cover the condition we want to check, * so that the resulting PROT will force a re-check of the * architectural TLB entry for the next access. @@ -299,13 +299,15 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, /* The T bit is set -- Page Reference Fault. */ ret = EXCP_PAGE_REF; } - } else if (!ent->d) { + } + if (unlikely(!ent->d)) { prot &= PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* The D bit is not set -- TLB Dirty Bit Fault. */ ret = EXCP_TLB_DIRTY; } - } else if (unlikely(ent->b)) { + } + if (unlikely(ent->b)) { prot &= PAGE_READ | PAGE_EXEC; if (type & PAGE_WRITE) { /* From patchwork Sat Oct 5 20:05:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823487 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E72B153838 for ; Sat, 5 Oct 2024 20:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158773; cv=none; b=tF460wwaatU8ZfpKH1LOgj5ByUKAJQMp6hAmmvKHOEsl9+jPXB/AIUGv5KzTcWWLWdqNtBscPDMg4NF1ecHCrSBH8rlT02UyH6nF/IlLFlxam7z4lpjcchVAmBN3SoguokvDrGHTUw8xfXNsWKF6RP2uj2eotX/6SChqH1dBQB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158773; c=relaxed/simple; bh=4iaK0QoQiOhshJacorWqZlodkQnPRyOf/R/YyIYfv1E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cb+MjmjyN9YjUMmqb4NCyMuHdXVm1fFxsu4iv7S9Kbwfbr3AvBUr43l3PGafqLwIOXQV7Ue6V7hMDTycsAn2NpulkTxKZzke7YHdK7lXhNBouvSb+sRYtMdAZ/2MxYMc+X/XDj4pcWKkfLfOl9+3m9sYKVgfzm6AwZKb2hL5mC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=k7Fad4Kd; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k7Fad4Kd" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20bb92346caso20346625ad.0 for ; Sat, 05 Oct 2024 13:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158772; x=1728763572; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TZFSB9ZUy/VXACo96L3HUXARpyVU9ywq9XNxX+p9inM=; b=k7Fad4Kd2bhIcXPlWkG+dNUcF66vJVh9L7cvXKlTXMNkAp/RAEGTJy39/+cIvVOtRo kHXr7ZhcRvaQkVrdSNqkNFQNw+kc+KCUvEOl2seZ5aiM5Kue+x9Gab0hcow2p7LFRs0S VeyauEBZ8KBgpO3sOlWRtNAVcL2BmTQOOvBJyrpyaHRJHX3T/DxsAjgFllXg58WYPhPT YhE+eHGLc1ssGD5eJ2vm2kWKZtRrRmoHlD7Bk/2WFSbIzmVomKgT4KQJUpJjCbtVVm0g dcpd1ayY3PuuPpjNWUhX5Yh1d4gJuny3AqVO+5u033FlqbOswW8YIH2GV8lIgyqSnpiu SSMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158772; x=1728763572; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TZFSB9ZUy/VXACo96L3HUXARpyVU9ywq9XNxX+p9inM=; b=AIUV5n1HjGIWTwDzszKyFGbrsE4/PnxpXiQTuTUq+Lnt9avXsLSJZmRFii7fFOYNmr 95diZ2d+qwvkDTyvszyarQ6GV0v+G5bn6mIZGfkQ4QIQiKopCqrINwBNk4aOVODI+RZl sSeTDECncsRmKPQYrtOvy8i0l1rU7CDTshZgDjdJjgBIvUtwM8c8KaGB3oOAcpzxUmJO fpyuQDglKzXtRUF7Md0RAoHyy3ZniTGks5xmc3C6qlAqosKMmlKpvgQpYzsuL+SqBKRf VNiW21yEVOyzDa+4X+YWJnkAqTxeKcPZjpBP+bCEYJeNP/deIt97QvHCcaOUQzpKkjjn oJhg== X-Forwarded-Encrypted: i=1; AJvYcCUdHaDfDa3cWbzPekILm5N6wFImFTcgNQhEj/MFLT+0o2dIXI3S+UBTYAyNgPXzDUci/FMu9pq76SZgS7I=@vger.kernel.org X-Gm-Message-State: AOJu0YxbaNALwv2eHUYSUK8TQ5z4gwieKnGIBvMNg3OdtmtD9YT9dg4U sTuGS07GHvjSzPgLesoTmLFlRYQBDikVhTeyRxI8jdUbai242zKcvpZJyU/JdKk= X-Google-Smtp-Source: AGHT+IEnSEOUIrHMqhl+2wC7MJEt2x3LJD6slbQirH4WqyRvisJVw+9UvtZb97XvweZZ36AVIQ0gZA== X-Received: by 2002:a17:902:ecca:b0:20b:805d:bfe5 with SMTP id d9443c01a7336-20be19c0fb0mr135947635ad.30.1728158771892; Sat, 05 Oct 2024 13:06:11 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 11/21] target/hppa: Handle alignment faults in hppa_get_physical_address Date: Sat, 5 Oct 2024 13:05:50 -0700 Message-ID: <20241005200600.493604-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In Chapter 5, Interruptions, the group 3 exceptions lists "Unaligned data reference trap" has higher priority than "Data memory break trap". Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/mem_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index f71cedd7a9..d38054da8a 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -221,7 +221,7 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, g_assert_not_reached(); } prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; - goto egress; + goto egress_align; } /* Find a valid tlb entry that matches the virtual address. */ @@ -323,6 +323,11 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, } } + egress_align: + if (addr & ((1u << memop_alignment_bits(mop)) - 1)) { + ret = EXCP_UNALIGN; + } + egress: *pphys = phys; *pprot = prot; From patchwork Sat Oct 5 20:05:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823488 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30FAF157E6B for ; Sat, 5 Oct 2024 20:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158774; cv=none; b=E3Ig/Ot0fQvwjMX1HLAvE2iB7W1pXeCMqobDFlXjq54LxJ4TnE9gRj61VR4p7ruTW4Q5EFkXayn2w1lx3buInP19zsxhu1JpXWPOcOfpFoHVsa9FmpCTKsxpTsJcPc7MyxYn6JGUwT7KWZ6PmE0Y8fVJVnZOBraDFjZ+dKSxHaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158774; c=relaxed/simple; bh=4Y9YWp6EM7aAkdmftt8JKSZpOs1BvVvy02XzjMP1/6A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VHRWqhtHk9nDze7M6KYWgz30aOEJM6LZWPaqNGU7ETzWnjXByeB2nXU+6kL9/a8nf0FvvCJaCFCa3B4S6aXDm8U03KAnY+racxMUIx07IfQIso3xIDGx77ceuDDK3oaEzFT210g4ZETTGPJ1csEJvSibEQ1Uf28zCS48BSYOskE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FttJgw4c; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FttJgw4c" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-20b90ab6c19so35190125ad.0 for ; Sat, 05 Oct 2024 13:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158773; x=1728763573; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rc7m2CC+o/vfg9459Vx/ro/giFzSXc14VGjLvy+03yM=; b=FttJgw4cbBS3kgMbEZDa1ulIQBsQ9xPS8yRl/maxbw2mGN1q5b63bqDd6lXWanucDr 87YhDh8uzjPat+1+Sbu/KpdJDEWj/l97fvq3Y+1UVx5BzVkU2Bs4jwXzHwj69z7LSkYM Q3DYRIK6eyf/e5y2u48wLm/1ZCeEVcNs7B6R2AQ/4OVBexY3QQSX3DnuBgwSoI+gN7BU Si15821oZVgvCFNLxSvJXax4kUFodqdcYPp32N5IEchhdMzWNeVXcFDpGp0BzlYUPYoT SNhqOTMCZ1fFBtRSDX4En0iA0EqHrUYEVhBzMiohpovRrxti6aUbad1aQdRv9LQJneVC jplw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158773; x=1728763573; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rc7m2CC+o/vfg9459Vx/ro/giFzSXc14VGjLvy+03yM=; b=i12emN2XXMNlll/TB9OtTwS1oxq/Re8/ZVA2gKD/QmugnzOddqoDMaZARt5FNSuNRg 7DYLrUftsv1DOIhu4sySenAV4fDsaArmwSobxzP3kmooEPh0oEhoUvS1IfAQcdBQG/a0 yubovlB8kVxbNWmYkM9tOz29QgYYueFtdEHD13D3oF2CWs/KN7Zbw5HabQO9/FZoffN5 +K0OxoPQ9et216/clIe+YQtC4hLyMd2rR2S5Nh46uZ0Kluytju+7Qpl3MsEsoYnWpOpN 6lOCjv9La/HW85jp1N1DVqpqh/Dr0PC16fiGFmCS5TNOUsnjSMtN0QPyCiOwceFd9m52 cgFw== X-Forwarded-Encrypted: i=1; AJvYcCVt54NhxksghehNaoOx0qir9OA+ivxQblAZcze0XEg3GATmXrq64Stlmsc7mHcji1R0NY/7i76N6WjQWEY=@vger.kernel.org X-Gm-Message-State: AOJu0YyYws2tzk2szovUibYgmlvINVWKuLuOVepoIDe7Ykr4JImxCDS2 CYCJHcdEcP8BMy7EEQIyZYAJ6jqNzOJ8Rm9nZI4FiTk6AKydmQ256YPvm/gW0Jo= X-Google-Smtp-Source: AGHT+IGHEK6fjBSmL22oUUwIkylcWSfEnGAMH/PbqEEDgjtyaqNVMTdBmg2DLFABo2GcKikjZC9wnw== X-Received: by 2002:a17:902:e54f:b0:20b:9698:a234 with SMTP id d9443c01a7336-20bfde65b4dmr91370085ad.8.1728158772729; Sat, 05 Oct 2024 13:06:12 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 12/21] target/hppa: Add hppa_cpu_tlb_fill_align Date: Sat, 5 Oct 2024 13:05:51 -0700 Message-ID: <20241005200600.493604-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fill in the tlb_fill_align hook, so that we can recognize alignment exceptions in the correct priority order. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/hppa/cpu.h | 3 +++ target/hppa/cpu.c | 2 +- target/hppa/mem_helper.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 526855f982..c0567ce0ab 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -366,6 +366,9 @@ void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled); bool hppa_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); +bool hppa_cpu_tlb_fill_align(CPUState *cs, vaddr address, MemOp mop, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr); void hppa_cpu_do_interrupt(CPUState *cpu); bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req); int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 3b6c325e09..768abc6e5d 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -226,7 +226,7 @@ static const TCGCPUOps hppa_tcg_ops = { .restore_state_to_opc = hppa_restore_state_to_opc, #ifndef CONFIG_USER_ONLY - .tlb_fill_align = tlb_fill_align_first, + .tlb_fill_align = hppa_cpu_tlb_fill_align, .tlb_fill = hppa_cpu_tlb_fill, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, .cpu_exec_halt = hppa_cpu_has_work, diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index d38054da8a..35e9170bf3 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -424,9 +424,9 @@ void hppa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, } } -bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, - MMUAccessType type, int mmu_idx, - bool probe, uintptr_t retaddr) +bool hppa_cpu_tlb_fill_align(CPUState *cs, vaddr addr, MemOp mop, int size, + MMUAccessType type, int mmu_idx, + bool probe, uintptr_t retaddr) { HPPACPU *cpu = HPPA_CPU(cs); CPUHPPAState *env = &cpu->env; @@ -445,7 +445,7 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, break; } - excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, 0, + excp = hppa_get_physical_address(env, addr, mmu_idx, a_prot, mop, &phys, &prot); if (unlikely(excp >= 0)) { if (probe) { @@ -473,6 +473,14 @@ bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, return true; } +bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, + MMUAccessType type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + return hppa_cpu_tlb_fill_align(cs, addr, 0, size, type, + mmu_idx, probe, retaddr); +} + /* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */ void HELPER(itlba_pa11)(CPUHPPAState *env, target_ulong addr, target_ulong reg) { From patchwork Sat Oct 5 20:05:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823489 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D311153838 for ; Sat, 5 Oct 2024 20:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158775; cv=none; b=I7rk2nR+Sxm9fm5tnM7FbuT4ldtMkEB5wqayMHKIH2YUWP2/lnBhCw+ofvpHis3MWvq/eIJzKu1CBSucEQUcDd4yNm6at6oHciuLGyCYoalwUibsf/u8In4xxXdMM9/s1ULnE+CGPhL9vfZz9rFlChr2JFaAKjKTAI3kzD+FbTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158775; c=relaxed/simple; bh=vDk3HNbU7V0mlRGB4QGw0XzPVHWLM0iY2xxG+t37CEk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AjHErk6fuoqN0rlBmdyd3vgR75JVQCx7k+MCDYuXotdsG6P5/4qicJv6foeWrSBpiotsVVL5ptfhQ2Hi7sWoNYLp6seRjLHHu+/SWTSvarNs5vWTwlYz+UQHxmXNganMzpd0DldH/AiU7U5Vw2lBcdGKborX7x4CP0hJG+eInmI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=IGDzbVIP; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IGDzbVIP" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20b833f9b35so27622505ad.2 for ; Sat, 05 Oct 2024 13:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158774; x=1728763574; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E1uh5v8Er5HwrssIP/tcmhd1DyyVCAW+cpRhBaU0frQ=; b=IGDzbVIPKxE9xHB1soNQGlAVh6hQ5azcHeNtOA86Ppds2dxwppUNN0+t2QYAW3WLR8 OwovWv84Qx607ILqNHcv1YPNwIz8btTo1HWG7LTTm9jBlb4h0nuNmtdFCPolh6LoeBhw +rWa0q4SgHIVQaUZYCtr50XOcsx0gsiqsdFZrmzl2dK0woSHADVisr067BmltS7sQcwS hcqZelmklEfcuo7bDrmZj6nMXFjn64jhdX9/6ohuuZkQNdAzcThyUWMd5cWGnoWj1hQY fjGzhJ9rWCoR2JfsTvtw6WXdm0Rv2pfaxEVKwSdPfaErPBu4vhG+r4CkZ+L3lOMuGQ9W k57g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158774; x=1728763574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E1uh5v8Er5HwrssIP/tcmhd1DyyVCAW+cpRhBaU0frQ=; b=EiiF4OQ7EaAR+g/kFZ7J4DsidHhjN64TZYyoq4PYeaInlLl6zQfZ8G5nEEEAE8N02z K/61nGolPNhpL2ZOY0l6odOSk10UQzV8VRzmZgc/T/heUhqbZtjZEObFvZQoNFTYhilw h98+i7oPV2kp6TlDC9h2w6qFm8YQm8OJdOMmpf6wR4E2OhBmhPnYA23ZUsQXfjxzqLPn EJDIP9qVA3+ZBX9GDOSHwpa8JJbjcQuFI0gf+ZhDsHeswThlg7eI/DJSbsZWJ4LCmKYX VMD9IUYBHQ2uFGbB/mhh0b5sFu1UsiJst2B2Vj29ewkj+nvV6lc3Mgp43EJfxyfIr8LL B25Q== X-Forwarded-Encrypted: i=1; AJvYcCUoZmETqBlWWH7AzQ8teL/feBUpK5o2W7BudWalRPK8mLoekT3wmNSAbzEArJHieItmLxitTylN2YL7Y+s=@vger.kernel.org X-Gm-Message-State: AOJu0YwSEROAyVijvFMU1pO2RmSHA1a98CHevMzs0bdaE2kBATpkzoN/ USNpabIWBeI/Zk0sFJ7g/+Lz4eNWY80A0OfZT3OpBHuEAlkCDwVe4oC0yyHczOc= X-Google-Smtp-Source: AGHT+IFuIEZa4i6J0XzDsWHUBnGbrBzjQrdOCbbZFKtwtRYvhgzw6qHzcnt8mJfy/cgTXRoh5crEPg== X-Received: by 2002:a17:902:d4c6:b0:20b:b48d:68e with SMTP id d9443c01a7336-20bfde57cf8mr99495885ad.7.1728158773783; Sat, 05 Oct 2024 13:06:13 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 13/21] target/arm: Pass MemOp to get_phys_addr Date: Sat, 5 Oct 2024 13:05:52 -0700 Message-ID: <20241005200600.493604-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Zero is the safe do-nothing value for callers to use. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller --- target/arm/internals.h | 3 ++- target/arm/ptw.c | 2 +- target/arm/tcg/m_helper.c | 8 ++++---- target/arm/tcg/tlb_helper.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 1e5da81ce9..2b16579fa5 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1432,6 +1432,7 @@ typedef struct GetPhysAddrResult { * @env: CPUARMState * @address: virtual address to get physical address for * @access_type: 0 for read, 1 for write, 2 for execute + * @memop: memory operation feeding this access, or 0 for none * @mmu_idx: MMU index indicating required translation regime * @result: set on translation success. * @fi: set to fault info if the translation fails @@ -1450,7 +1451,7 @@ typedef struct GetPhysAddrResult { * value. */ bool get_phys_addr(CPUARMState *env, vaddr address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) __attribute__((nonnull)); diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 659855133c..373095a339 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3572,7 +3572,7 @@ bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, } bool get_phys_addr(CPUARMState *env, vaddr address, - MMUAccessType access_type, ARMMMUIdx mmu_idx, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { S1Translate ptw = { diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c index 23d7f73035..f7354f3c6e 100644 --- a/target/arm/tcg/m_helper.c +++ b/target/arm/tcg/m_helper.c @@ -222,7 +222,7 @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value, int exc; bool exc_secure; - if (get_phys_addr(env, addr, MMU_DATA_STORE, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_STORE, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type == ARMFault_QEMU_SFault) { if (mode == STACK_LAZYFP) { @@ -311,7 +311,7 @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr, bool exc_secure; uint32_t value; - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_LOAD, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type == ARMFault_QEMU_SFault) { qemu_log_mask(CPU_LOG_INT, @@ -2009,7 +2009,7 @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx, bool secure, "...really SecureFault with SFSR.INVEP\n"); return false; } - if (get_phys_addr(env, addr, MMU_INST_FETCH, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_INST_FETCH, 0, mmu_idx, &res, &fi)) { /* the MPU lookup failed */ env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_IACCVIOL_MASK; armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_MEM, env->v7m.secure); @@ -2045,7 +2045,7 @@ static bool v7m_read_sg_stack_word(ARMCPU *cpu, ARMMMUIdx mmu_idx, ARMMMUFaultInfo fi = {}; uint32_t value; - if (get_phys_addr(env, addr, MMU_DATA_LOAD, mmu_idx, &res, &fi)) { + if (get_phys_addr(env, addr, MMU_DATA_LOAD, 0, mmu_idx, &res, &fi)) { /* MPU/SAU lookup failed */ if (fi.type == ARMFault_QEMU_SFault) { qemu_log_mask(CPU_LOG_INT, diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 885bf4ec14..1d8b7bcaa2 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -344,7 +344,7 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, * return false. Otherwise populate fsr with ARM DFSR/IFSR fault * register format, and signal the fault. */ - ret = get_phys_addr(&cpu->env, address, access_type, + ret = get_phys_addr(&cpu->env, address, access_type, 0, core_to_arm_mmu_idx(&cpu->env, mmu_idx), &res, fi); if (likely(!ret)) { From patchwork Sat Oct 5 20:05:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823490 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95DE2157E6B for ; Sat, 5 Oct 2024 20:06:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158777; cv=none; b=VBZCQShL6fMgXovQGt6OVvxSx/GYl8ne1F9QHCvL6+/w/EhQBUaa2/q7vjmfFK3BAfjqBJV7nh6B6dJe6yH3Oaqxx3Y7xxBCGuC1NzRLg8XQKFqKuhnyCQvUlu6rYeSW+CvLKsTVuDmIPoAZM3GnvQF5nv8iajKYD0UjHELqtro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158777; c=relaxed/simple; bh=0LcUXggN44y26UL2csydkFcmlkLrDThLrVZVjfPCMMg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GA/q5u/z72zHCXr+muV7DYiQsFO/KmXIr0ViKHGtnTXT4Z6HtKm7IYBsKdaNStXB0+yTLwjb3ZOAyqQUfAauzI+UqMxMjdV2eL7vjwaFLdvWIwD4jzyMV57/2uU13rtYdAfOY6TqsgZTFOgEfGMKO82UWeYpgvadTrU2numbefU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=G4gbmPyi; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G4gbmPyi" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-20b01da232aso25564625ad.1 for ; Sat, 05 Oct 2024 13:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158775; x=1728763575; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=or+46uGq1e2/GbDMKkBXfTr+x8kd8hih+f1GC2rPQFE=; b=G4gbmPyiLa5Gij246rKBEUAJ6e+fN6KQNyRkTDOzCD2GRtOiTpp1Be95sgi6xvLXL+ mnhu0WBk0KoCyNmUQ7aoeMvZpkDE0IzXgzNqUimTmeernfvcVYsOFm60+sEkZUb3FJao 3QdL6Nu09qIgBJ0b9+yi9G8Po5051Ji7DLf+FIYguI9gxOeSM57Hmdkh4gWSt0o47KCD sXU9S2hjzUwIkSvR4oUl4tFjnuxj7+T4wei5N6kSOJ/QVKr1tL+9AzQVzVHYAy6j+k1n Fm+lgylk2pRlQHkUw6S0QVketgDovUgJcp3Y5vnC9Rc4zFJFIl8RLFoYRkegXgp1vtCg xRmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158775; x=1728763575; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=or+46uGq1e2/GbDMKkBXfTr+x8kd8hih+f1GC2rPQFE=; b=FvO8QYWQW66fCDqbn1N6CsQNOvHIqS+78hB39540pAE/9aWo4QWXbfddL61n1T/lRS LmbPEZlGaNVI0UAjMvDZwZLnem2n4TsMxVWT3CF026WqUsDtfjwLnxlWfBYTvq+tLocR tPvUc7lpF9ILR84zZRXAvTJTUpugm0MC77cGut4jdpG1/+rgPXlvns5v8ybQgDrO+t/+ 43+HoTHge1QED5H+YhAH+29KlV5fJWtyxTgkntTzlBc5ed9I5FCsPN6rHvuPRC6jqvqv r3eid6FKG96H2jbiuDDvscNv722P9uLpKtZ8HKJlstmGrZWcLbG9OBkvOqbpJwjNs4Rc Wqbw== X-Forwarded-Encrypted: i=1; AJvYcCXxdDqNXfC8fV9KpJczfi0Eitw8TBtL3IQlR9HqAM7Ys2tzgzor4zS3t43Q1hBP9XvPwoLzQ/dSox/cuAM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+m11Ze4gom4KEa/A7dFau96e9uOvzW0GEZ2GKYXoMVP4uIa/V ijFCRxB3cQqrd1A9jrdMIfARllt3sezB3/A8QMln0MwYA5GNGj88pzGnXhBXs2A= X-Google-Smtp-Source: AGHT+IGg8sgiEBRoSbtsp5hCkfkIAZ+oEWQnrBAFFM+N7oyUTJv3AhGKcIaJbMYi1S9IuPikpnwrog== X-Received: by 2002:a17:902:d2ca:b0:206:9dfb:3e9e with SMTP id d9443c01a7336-20be189892dmr148488525ad.10.1728158774767; Sat, 05 Oct 2024 13:06:14 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 14/21] target/arm: Pass MemOp to get_phys_addr_with_space_nogpc Date: Sat, 5 Oct 2024 13:05:53 -0700 Message-ID: <20241005200600.493604-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Zero is the safe do-nothing value for callers to use. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/internals.h | 3 ++- target/arm/helper.c | 4 ++-- target/arm/ptw.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 2b16579fa5..a6088d551c 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1461,6 +1461,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, * @env: CPUARMState * @address: virtual address to get physical address for * @access_type: 0 for read, 1 for write, 2 for execute + * @memop: memory operation feeding this access, or 0 for none * @mmu_idx: MMU index indicating required translation regime * @space: security space for the access * @result: set on translation success. @@ -1470,7 +1471,7 @@ bool get_phys_addr(CPUARMState *env, vaddr address, * a Granule Protection Check on the resulting address. */ bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, ARMSecuritySpace space, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) diff --git a/target/arm/helper.c b/target/arm/helper.c index 3f77b40734..f2f329e00a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3602,8 +3602,8 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, * I_MXTJT: Granule protection checks are not performed on the final address * of a successful translation. */ - ret = get_phys_addr_with_space_nogpc(env, value, access_type, mmu_idx, ss, - &res, &fi); + ret = get_phys_addr_with_space_nogpc(env, value, access_type, 0, + mmu_idx, ss, &res, &fi); /* * ATS operations only do S1 or S1+S2 translations, so we never diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 373095a339..9af86da597 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3559,7 +3559,7 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, } bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, ARMMMUIdx mmu_idx, ARMSecuritySpace space, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) From patchwork Sat Oct 5 20:05:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823491 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39741153838 for ; Sat, 5 Oct 2024 20:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158777; cv=none; b=PakU/laI4ugnm1Uvbj4dwJtwnHic38jFQ4rTPFcYY+GevBHYzbn7h+ZH/EvBl6OTNVxUag9drg7n58F+yl4jjoVbJVhfnM9lKEvbAh5sr+qwosCBUm2UXd336cKkVXmIF2YjRwQeN6UaLsBL0t/Ny13/OCbKTePgh/wVcegWur8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158777; c=relaxed/simple; bh=XTzfK06oaFA2G+iVog17UM/vpH9ZZI8haEnAh7kVvHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W8O/sKVhxwpGqrh7dEyjXoClDUhkKTVI/KJlo/aq8uuFujxhRHKp44lLdxIWRfYtBmkcg5jS10M9dhmyM0pWoQt4f2PEUFl5hdlXd4V3Lp1xvMuqeOjvy8Rm1o1r0HaHAneDLkQfWI1DqKByS0JiGxa5FKV1zK1289G+EeZBFRM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=GhHHgHS/; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GhHHgHS/" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20b90ab6c19so35190385ad.0 for ; Sat, 05 Oct 2024 13:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158776; x=1728763576; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4X5zP7zXx4H0vSkmfgBSYylbUDArgVMPw2dfqzvhfaA=; b=GhHHgHS/W0WGLHYBlIhCWaLgwIVRAyUpHTlwORvpm5NY+8e8D45G6zsmgO1shwge3f 7wYtbeZwJyyyrgALbeUcRfGZs1rKeLe+21PDSqgQr8PBxX0x+fQdfJ/O+obt3MdT2A5X I+YoUv1hGdcZWnAuPVz8CKtDoe2zWj/pwHmrDZ4rHABLODo0l+aF9wO+YjwvTyt1UJa1 M9ioetpzrZrG+stUC7Qwa10RJNlBEsnP8dRivfqnO49QS+ga1LrpfJeWtEQAiVXVXn+F 6j+5SFPPsLdsKZsRuQ4GmFqywVSN1QMjzT3P/Tpxi35kCU4aASiB/DY2auunCcSvs1kP qDHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158776; x=1728763576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4X5zP7zXx4H0vSkmfgBSYylbUDArgVMPw2dfqzvhfaA=; b=thIqh61Bjby/4kwxh0DASVaEJTUFKZhWGZAUkbMNo2xg9+Atdsq/cWgtffRsvgsUbv eQqknev2xILjagRsVumH1V7PsJQYBZejE1bKtqz9scKzJMqmNJ2we4SyRHvaH71kut2X 4nHWMSW8N5BLCLsWEtvTlKN9qIba0IitevUPfdG5EZN9KnnCOspya1YO6/CNdihQgG18 UgYiJCJh5GKBbkJA6yc8PMUVbSWalQM/E1kh8iq6ePNhkhgLA+Dd3BIWfosb/ftb1kfw mkwu3Tbzhujj2+6BxjaComf7WTIj/44OA27Lj3N1xn9jCFv2Ji40DVnE+Tp3BGdzmVKu wZdg== X-Forwarded-Encrypted: i=1; AJvYcCUAtfm9dkb3sD2LuTfExTiRBbI+7py+WAYTLrfH3S0la5U4Sse9iHpPFwXEci4W0p035uDGPtG1fuS3ZpE=@vger.kernel.org X-Gm-Message-State: AOJu0YzvnV6NElH6tCrNbkZFYTAMfmXgQDdBkRIaRane+il6Rm9EtSZz KVjF3xZCf5It0Rd5DUMArImV8K1XQdAK6OZgKy7uvxYtPMW2co4PxkVTJjvFLVIbZ9UnZQuZW5K x X-Google-Smtp-Source: AGHT+IEx5vHtVkprUThlZwV+Lqo7Z029AoCfFZ0CZWDgQlrwN//FsMIaExtuwtG6PQ0wcXYm3ZJH7Q== X-Received: by 2002:a17:902:e84f:b0:20b:b7b2:b6c5 with SMTP id d9443c01a7336-20bfee383c2mr91865325ad.54.1728158775790; Sat, 05 Oct 2024 13:06:15 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 15/21] target/arm: Pass MemOp to get_phys_addr_gpc Date: Sat, 5 Oct 2024 13:05:54 -0700 Message-ID: <20241005200600.493604-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Zero is the safe do-nothing value for callers to use. Pass the value through from get_phys_addr. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/ptw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 9af86da597..e92537d8f2 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -81,7 +81,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); @@ -579,7 +579,7 @@ static bool S1_ptw_translate(CPUARMState *env, S1Translate *ptw, }; GetPhysAddrResult s2 = { }; - if (get_phys_addr_gpc(env, &s2ptw, addr, MMU_DATA_LOAD, &s2, fi)) { + if (get_phys_addr_gpc(env, &s2ptw, addr, MMU_DATA_LOAD, 0, &s2, fi)) { goto fail; } @@ -3543,7 +3543,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3641,7 +3641,8 @@ bool get_phys_addr(CPUARMState *env, vaddr address, } ptw.in_space = ss; - return get_phys_addr_gpc(env, &ptw, address, access_type, result, fi); + return get_phys_addr_gpc(env, &ptw, address, access_type, + memop, result, fi); } hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, @@ -3660,7 +3661,7 @@ hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, ARMMMUFaultInfo fi = {}; bool ret; - ret = get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, &res, &fi); + ret = get_phys_addr_gpc(env, &ptw, addr, MMU_DATA_LOAD, 0, &res, &fi); *attrs = res.f.attrs; if (ret) { From patchwork Sat Oct 5 20:05:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823492 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F564157E6B for ; Sat, 5 Oct 2024 20:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158778; cv=none; b=PFP1lOrocPxlg9IUo0GT+wKiGCm6SyCFJb4zbeuf5OG2M/jL1IrMkJP00NKFubsTI7ct/fWIaLzeCOf58ZulMEtvdpAqlWUof74OcN9W5aLI15+idgeY6+V2S32OSxNhZCs3UE+rWLMCvUkhuOFxtAzix+ah2GPNL9yfQ3FCk7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158778; c=relaxed/simple; bh=dwcQYey/qg79IaExNd/1cs7BEFjH0rBox5pjB3rW+tM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VLwQSq7PUPUARReBfPw/o9oGazNGcs6TB6IYk5XNLIZfn3sL+vnOlwkWFvjI+xGcmfnxIhQl/Y2OXdmaf0x9rthn95YNxG/iTIaJzrGExPEi0U5W8HSXxVKDpTbsZ6TyiRFydI6x6mV44o8utT+1JcYVxOmopyD+Bz/uAVixbx0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KoEfIGfR; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KoEfIGfR" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-20b58f2e1f4so21812745ad.2 for ; Sat, 05 Oct 2024 13:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158776; x=1728763576; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3KXMhwqlNY3FEn9X64ijA0SceY+BOiTFnpHj8/s1p5o=; b=KoEfIGfRtZmizi96vJeNNI+7tFyB9tXlfZHw7Uwd+BNtPC1jjCEg3njxMN9G1qF86Y M3lHOD3woYqLcWE2cFlEhMS6ZO2RMFDgI2ROyqg//YEA/G/jptRMvQItb1Ywv96BZ0jU QSeAhRvvUNF/QFXT7HxTUIjw3+yYZ+zSYTZzyf6L7KNym2/ac/ICGfIA3STroUWHO7mx jchSN1RP5vyBhL1qNG9zPiVZirLSUtZ4i1nb/xUYUjqNMtKbPoF0gOVdChMJ8zuWiGkH 3UFTT6FIa7fgpM48DTaUlvclqP/X0YqOTdMTYD/XVCboDyebb1oV/wfuj7Uqq6WFfs8+ pTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158776; x=1728763576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3KXMhwqlNY3FEn9X64ijA0SceY+BOiTFnpHj8/s1p5o=; b=KifAj/qCKUUKThCQNyCm/Er/ImSft48iIDej+So2Q+G/vDuC9dDwL9o+lipHZTfWN3 TRQhGJP9hmdan7TmmM9SL9iaL+fmsj3aLHuqIxcGbi1zvVRjqVSzVTe6ZTb5VbFqxF4B ZjJCd3SkzARc/NtURFOA1r25uobLvaZlD2MUH8D+6GWPIhZGsuTmrgv6IQ/zTM9cQntK nbsfB98dUE1J09EYjLutnu/ZaiM9czqHUvDMulIr5E+vGLMZUAFCkXhbG/VRSP+dmqMu +lPNTAbXRxkqYX3a4yw1iEBrkbAamBye3T3NVOfBjF4dWcFZggEet8H2BpVF+XRFuATA lCug== X-Forwarded-Encrypted: i=1; AJvYcCVdFbi2PmuA9fNKs2eY50MWHGIIEZfxS+uXTt2bzxWqhOk5lE6/Iphz2lUUmoMvq5LK42ArT38UgzZUeDM=@vger.kernel.org X-Gm-Message-State: AOJu0YzxgC8yGmJZ1k25FZoo5tWEJgkqNtZbdt8brRSJ3JX81fC9Q9Wv hmu48eXFgxTk7m3x3GoYINfjbF/XZ1i9doh23p0Uj8jqt6Kl4HRCPJPFOYXog9aX3IcDwCMCT3/ 4 X-Google-Smtp-Source: AGHT+IEc/YiENR//GQsH6NJPwFKZle512StiSwrb6jw4fVSQbkD7P+i/ct1jx2CukoHpWHGxpya25Q== X-Received: by 2002:a17:902:ec84:b0:20b:6b68:c635 with SMTP id d9443c01a7336-20bff20ca7dmr104384815ad.58.1728158776618; Sat, 05 Oct 2024 13:06:16 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 16/21] target/arm: Pass MemOp to get_phys_addr_nogpc Date: Sat, 5 Oct 2024 13:05:55 -0700 Message-ID: <20241005200600.493604-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Zero is the safe do-nothing value for callers to use. Pass the value through from get_phys_addr_gpc and get_phys_addr_with_space_nogpc. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/ptw.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index e92537d8f2..0445c3ccf3 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -75,7 +75,7 @@ typedef struct S1Translate { static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi); @@ -3313,7 +3313,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, ARMSecuritySpace ipa_space; uint64_t hcr; - ret = get_phys_addr_nogpc(env, ptw, address, access_type, result, fi); + ret = get_phys_addr_nogpc(env, ptw, address, access_type, 0, result, fi); /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3339,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); - ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, result, fi); + ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ @@ -3406,7 +3406,7 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3547,7 +3547,8 @@ static bool get_phys_addr_gpc(CPUARMState *env, S1Translate *ptw, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { - if (get_phys_addr_nogpc(env, ptw, address, access_type, result, fi)) { + if (get_phys_addr_nogpc(env, ptw, address, access_type, + memop, result, fi)) { return true; } if (!granule_protection_check(env, result->f.phys_addr, @@ -3568,7 +3569,8 @@ bool get_phys_addr_with_space_nogpc(CPUARMState *env, vaddr address, .in_mmu_idx = mmu_idx, .in_space = space, }; - return get_phys_addr_nogpc(env, &ptw, address, access_type, result, fi); + return get_phys_addr_nogpc(env, &ptw, address, access_type, + memop, result, fi); } bool get_phys_addr(CPUARMState *env, vaddr address, From patchwork Sat Oct 5 20:05:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823493 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5AF153838 for ; Sat, 5 Oct 2024 20:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158779; cv=none; b=WCW67399Qc1k0SXxL5xSqmQsDURcNAlDU90tnhFus9r3hFS2hnyI5ktOCV4Q04HDJRRHigFrDSwygSSe9qPNIxIQNexTv1//J7SR26/fvH+dCaukXTbcrDXCWUKBc7GYOjhUhvfrxnmVuTtu5z7yjnD0YL/ps2apZukLhEkRXbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158779; c=relaxed/simple; bh=mKNr4HPQW8zX73f98vjtas3HbqrZ2mbpCZvK/LaYaik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uGJjTw2pilZmnYb2YlufD7eR0oh9CPVkRahC2h4dNnA+bTmE1enAeQE4/mpNxTFHIBvyDxIMgvJOxBs4eoxZh55OWj+seSmWDyfAKKFz8pmgPxnRnWkWJf4U4m5ptWjK1MieN6X7TSR018fy084umJkO77WYyXmFDqTqRxHvZnw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=S7i3wyy7; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S7i3wyy7" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-20b9b35c7c7so22719805ad.1 for ; Sat, 05 Oct 2024 13:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158777; x=1728763577; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oB3S/z+Tf/YurYPbjZAkQ2iOmy2pkllXkguo9aONGm0=; b=S7i3wyy7zQ4Abk/8fdgiYmVE4EDXedJMB4TzFhURT+4ztp9Hxs/JNr6856dXsOHP7Q dO1XzynHrbajT/QFZdYqRxGqU/faGyxgO0YPWajpj3JWc0Ydcd0/TCo/RUpwAoxkd493 0JZF79Po/X3/VJKzG5/xazacqAIuVf8AQzVXy+mzmCG896dciAH0SER4DsCuRS4TuZt6 JBtKpZqzMSbYDCwmqciDMPNjgFzowT72ai2wkoQNJdpqUpiGu5PP8SqKl/CJdRBYMv3j JVTlld1Uop/7q8jYJVZKGVSfPBv8TfymzHwSoAg5R6+7r43nWcVVL4Rn1Gj7i75QWeRv dsOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158777; x=1728763577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oB3S/z+Tf/YurYPbjZAkQ2iOmy2pkllXkguo9aONGm0=; b=mYFwwa3VJT6Tv/4jVZtqm1FJffaD6TSLT6vfqmNgOsbLcraqUF0+JrE+1CGUEt2XJ1 LYR+MveOZwVotgvg6q427bB6S4+VhutM7rBRONaQnnxGCiR+/tt5NAuLS+LFVmXNIbrv pN65w372BW67kN6LMWevV2n1q1mMyqoYWRZpZPTIIVuu3R3b0rOYilmec7q5Z4mS20ET xKsEVHuYGd+NeFXH7/4k9yx+izJNst6EIllE67lZYuekLZyhwSC4DrXuvJZQrPWdZYXu htgs9QJ/TZvJpPCqlJxbsDNYJklV2/vBoBQHtbUIUnsBWQsL6/bPEy12SSuXBWq4GPtH xsoQ== X-Forwarded-Encrypted: i=1; AJvYcCWhHgAJSFV0p3EmW/3plRTpkuTYRJ9Xlz0L4ANSKOdvsiMm3I3GGDSh8BgMveXpfwEQxgS9jnTd4gS7TRc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5TjzipYI9Jqz6lcLvEEdzb5i4blpKf47qcF1o8TJhS96I1ds+ oopcNLM9mDwJwlaNSB9Mm2vtuBl3SuVdHn8/dz6Arf+TnCVIcZaVlK7U6JBi8XA= X-Google-Smtp-Source: AGHT+IFI03P/ZwqgMEeykQf6RuuyTdik7GAJO+0IxSS0VbFT5FxKQ+by1C3Nfg/VbMmCSMS//V9B9g== X-Received: by 2002:a17:902:dac5:b0:20b:b132:4dec with SMTP id d9443c01a7336-20bfde57e80mr119970415ad.11.1728158777552; Sat, 05 Oct 2024 13:06:17 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 17/21] target/arm: Pass MemOp through get_phys_addr_twostage Date: Sat, 5 Oct 2024 13:05:56 -0700 Message-ID: <20241005200600.493604-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Pass memop through get_phys_addr_twostage with its recursion with get_phys_addr_nogpc. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/ptw.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 0445c3ccf3..f1fca086a4 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -3301,7 +3301,7 @@ static bool get_phys_addr_disabled(CPUARMState *env, static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, vaddr address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { @@ -3313,7 +3313,8 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, ARMSecuritySpace ipa_space; uint64_t hcr; - ret = get_phys_addr_nogpc(env, ptw, address, access_type, 0, result, fi); + ret = get_phys_addr_nogpc(env, ptw, address, access_type, + memop, result, fi); /* If S1 fails, return early. */ if (ret) { @@ -3339,7 +3340,8 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw, cacheattrs1 = result->cacheattrs; memset(result, 0, sizeof(*result)); - ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, 0, result, fi); + ret = get_phys_addr_nogpc(env, ptw, ipa, access_type, + memop, result, fi); fi->s2addr = ipa; /* Combine the S1 and S2 perms. */ @@ -3469,7 +3471,7 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, if (arm_feature(env, ARM_FEATURE_EL2) && !regime_translation_disabled(env, ARMMMUIdx_Stage2, ptw->in_space)) { return get_phys_addr_twostage(env, ptw, address, access_type, - result, fi); + memop, result, fi); } /* fall through */ From patchwork Sat Oct 5 20:05:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823494 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA74C157E6B for ; Sat, 5 Oct 2024 20:06:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158780; cv=none; b=QUSxEB0/DT2e6wf3Bt/jgr9RWcV/FKzFPJU0NdoFqdDXclUEMTTSkVj9NXsBt3/LEl1Pj4DxHeaatsEbkMYePM5H+Yxjo9wcFTuvsNRpT7GdKP7qGMsq/ZfMZNS25M8a2a1IypLMMIv5KykEPfWx5cLt1lhPWjGaJBqKm78PEow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158780; c=relaxed/simple; bh=vw+vuHfKefsP5JRxOVj5kr//br775m5Gcy+Gi29V22g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VntunVFf6cwUOa5NnoU8A8A3TVtP90Zt6CIWE3wRqkD0Y195c/q5sS7WWArNmjpd1GdP5QSrGWI3WKgwI8qFLYCOhp851JqmlqrvB95F7FajPhNKEnWv9IZ6qYOjXPLdwqBwZKjkhE2O3iocatRZNdUuDnP1Y4u4RyvHhkuCUrs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ppLk4gRH; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ppLk4gRH" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-20b6c311f62so28404015ad.0 for ; Sat, 05 Oct 2024 13:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158778; x=1728763578; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9tqb0TUsQOZF/sRJ8YxWqhKeQa3g/EH2JXyCvd2UdW4=; b=ppLk4gRHCR6Vdlxu9MdDlMObcB2Oy8xmK5Qc7pW272mK0P/bG8OwNG5rmfcukm39dJ kR3ZGwaRsnnGWLinoMIXwlh85px1ap2oKdmRIbMKXXzHyKWLB05tHu/HNoo3ZibeP/ok o/b5Wn5o67Df0UcumZRPk6SLFtGanAgXl3kDkdIbjSjaWmV7JqbwUyY6/rGSj/Tx5JLN Pw3GBgDkECNcTfkqv9j6xCWRKSU8EWkvM+xNPux3cj4aqUxKj9Kh1cR8f/ED8MzeUoD7 tb04wHT3NzypaNydTeaGHKQJwUsjqvjzZxUhjrF5ZtdIFV4dLn8VaWh3R7idougljAPN VUkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158778; x=1728763578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9tqb0TUsQOZF/sRJ8YxWqhKeQa3g/EH2JXyCvd2UdW4=; b=HTjdfZhvLe3/d6sj7FEeB8i8KLKm0Q6JaGtAtP1VqF7ndQ9VFl96i+1MRDLkmApkV9 /55LUqLI9KxJ8H0x+RN7Gr8q1fix3XwtEvsM5QERQnalkCrAGjicLv6v/uGPQNQ4fQBs 3H0EHCKmxjxmukYprOpdvJIPHtHVle5G7E4GwwqbVEy+WQacacMToq+qQ+wh+wlYpPjz jjEDT8AdEBooQiZpJcG2GuYTpNo5PRh4A5vtUn8tJ8OrCwOw1V4tDnssH6UN9inirBBd XNcyni0Jguy7F3ihC9kizgKkV9aH6KNhHDM5564d1lBpWpv8jphiEOqGpkZ5+0qKY9XV 5z9Q== X-Forwarded-Encrypted: i=1; AJvYcCWhStF+4KyNPhV4JkrxJPIVcnu/IE4o/6jguok5c3xGi7btcjQ+5heyFqdmz8m+ZjgvuuTKDgjiNswrwiE=@vger.kernel.org X-Gm-Message-State: AOJu0YwcPDM8ecImDVhnfNDY/M2gQ+I/VrSGUjXQm0vhNAvt7nQsVJpN bkt5nP0UUKHZeh1CAAJvutdBFcetM5kgKTaYwrrMQVo7xQK5DfAnl0LGjS6JcgU= X-Google-Smtp-Source: AGHT+IF/QbpbF3vd5RhMGi/uYgncSfdSoTpNoytfe03axosXsTK4sk6Oan6NQUL6chZLVm5cLU1oHQ== X-Received: by 2002:a17:902:f78f:b0:20b:7731:e3df with SMTP id d9443c01a7336-20bff1a5c04mr101016475ad.43.1728158778416; Sat, 05 Oct 2024 13:06:18 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 18/21] target/arm: Pass MemOp to get_phys_addr_lpae Date: Sat, 5 Oct 2024 13:05:57 -0700 Message-ID: <20241005200600.493604-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Pass the value through from get_phys_addr_nogpc. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/ptw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index f1fca086a4..238b2c92a9 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -1684,12 +1684,13 @@ static bool nv_nv1_enabled(CPUARMState *env, S1Translate *ptw) * @ptw: Current and next stage parameters for the walk. * @address: virtual address to get physical address for * @access_type: MMU_DATA_LOAD, MMU_DATA_STORE or MMU_INST_FETCH + * @memop: memory operation feeding this access, or 0 for none * @result: set on translation success, * @fi: set to fault info if the translation fails */ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, uint64_t address, - MMUAccessType access_type, + MMUAccessType access_type, MemOp memop, GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { ARMCPU *cpu = env_archcpu(env); @@ -3534,7 +3535,8 @@ static bool get_phys_addr_nogpc(CPUARMState *env, S1Translate *ptw, } if (regime_using_lpae_format(env, mmu_idx)) { - return get_phys_addr_lpae(env, ptw, address, access_type, result, fi); + return get_phys_addr_lpae(env, ptw, address, access_type, + memop, result, fi); } else if (arm_feature(env, ARM_FEATURE_V7) || regime_sctlr(env, mmu_idx) & SCTLR_XP) { return get_phys_addr_v6(env, ptw, address, access_type, result, fi); From patchwork Sat Oct 5 20:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823495 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44C4F153838 for ; Sat, 5 Oct 2024 20:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158781; cv=none; b=GEF7E7tihyercF11sLLOxDyNpGGc47MfaU7ennmu2YPhfVhtT05aj3Q0/WKBhCqiFFj0vdnmIy9i+nxX/+gfmoLYmEF/RW9AzJTCQH7zxLDqAK3LvfH7woYSFaJQA213wXge1eYczo2TC8AVSKVrYwIE78MvMmxgqiNO9XQP0HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158781; c=relaxed/simple; bh=GfbgeWhvJZEkGvmTmmQeIHTRaV4I16CMz8q34Fkno2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M/OPBcMc9w3UQvZYpFobjMIFvbqi80tYGai8v1KEnjTm4lat/sIjuyHeP7LGRoFGTbTkijrMfmEZ9iGBl4H5XS+ktcgXeonqA2llkZ4z7XysBLDarBq31mnoe20iSRuEP9EvhMCcdtrPyQFTtfvvN5XmiRW7x0rpfa9Q8JE6P9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=vVAUlrZ0; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vVAUlrZ0" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20b58f2e1f4so21812865ad.2 for ; Sat, 05 Oct 2024 13:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158780; x=1728763580; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ZHU/9Bj/Yhl/fLIAf9ED9KKjqQvRkGT+c+Pl2SvUJY=; b=vVAUlrZ05g2+FSOVXaZmL44g1lt2dpVI4KYgr9LWuwWV+VLy/lGzfhGAkc+EYn4AQL pKxlUNAG/XwS8k8DQYXSk9mII3DlaE1BEuzcJz0UOGUInnxO2bvydJhbxNAhD4ccvH9E xeiqHCYrIW9uMz2xoip1OOKmBs/4VwBqTnjH8UzrfEWuYVSGwu5xyPYA91isSkOqEWny f85X1dNeNpFctS+KzB4x66grC4ezSsuAR093lrz/Flkmo9YsrhJJcsL4tsTPFUNBjxOk i44da4dhxorAxcbwexY8PzA3N79vEeG4s34qwGnux99BkwxVttZnxYos1mIyiqfabiEO h4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158780; x=1728763580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/ZHU/9Bj/Yhl/fLIAf9ED9KKjqQvRkGT+c+Pl2SvUJY=; b=iCmqyjuCE+Hsw7crsgkC9uI/WYR5gBxKFCHBWEh61ZZLCFwDUlvI91Xx/NmJCMGH5b N8B6UEg5etXwBamFg4yOQ/d4GMeOcbV81dBDPmJfro58viR1FKeCIgfAr/+LJhwINoKo A/WijHMoGs83OcE5weegLc1C2ylGDsoNqJ5s6ZaKabnEUIvOAQw/5CWAtad8ZI/wiB4U tRc9yliPGV1h6v+8h6ey8bbhqbZtiFVfG7NofFEVq5OBcS8xYH4EnzLCfQkZxkcCI+DR xP1b/7u45inKMebRT4++eaPXDBGKLXjfJrpWuh4H4nrsEB/+BWEueMi+pjZh/ZAxjZ55 xB7w== X-Forwarded-Encrypted: i=1; AJvYcCUR6GJO1WXwAco+nE+JGr8oxvR3IipwmH5g1qe3zL9o+cys08Nph6nQtrB+Aq1JTyALQpvZhH0XRjyn+Mk=@vger.kernel.org X-Gm-Message-State: AOJu0YyPeHvQICrUHPLeL/5PRGrWRbPUQPi8esBYfZ4zumwRc1zhzUvw AtfojE2wGyOkB/peqH1BryboBCUzrZlMlF2p2yWIYGCSD1aCRmuLGpvIb74EmI4= X-Google-Smtp-Source: AGHT+IGaG41RXKz72+WYu6xA+vlkOEFZ7bvd3v+g0ts4N6YOcoq8IJtsLlpIollZYFin0+jpif++rQ== X-Received: by 2002:a17:903:228a:b0:207:1825:c65e with SMTP id d9443c01a7336-20bfe05f3c5mr90235625ad.18.1728158779678; Sat, 05 Oct 2024 13:06:19 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 19/21] target/arm: Move device detection earlier in get_phys_addr_lpae Date: Sat, 5 Oct 2024 13:05:58 -0700 Message-ID: <20241005200600.493604-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Determine cache attributes, and thence Device vs Normal memory, earlier in the function. We have an existing regime_is_stage2 if block into which this can be slotted. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/ptw.c | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 238b2c92a9..0a1a820362 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2029,8 +2029,20 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, xn = extract64(attrs, 53, 2); result->f.prot = get_S2prot(env, ap, xn, ptw->in_s1_is_el0); } + + result->cacheattrs.is_s2_format = true; + result->cacheattrs.attrs = extract32(attrs, 2, 4); + /* + * Security state does not really affect HCR_EL2.FWB; + * we only need to filter FWB for aa32 or other FEAT. + */ + device = S2_attrs_are_device(arm_hcr_el2_eff(env), + result->cacheattrs.attrs); } else { int nse, ns = extract32(attrs, 5, 1); + uint8_t attrindx; + uint64_t mair; + switch (out_space) { case ARMSS_Root: /* @@ -2102,6 +2114,19 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, */ result->f.prot = get_S1prot(env, mmu_idx, aarch64, ap, xn, pxn, result->f.attrs.space, out_space); + + /* Index into MAIR registers for cache attributes */ + attrindx = extract32(attrs, 2, 3); + mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; + assert(attrindx <= 7); + result->cacheattrs.is_s2_format = false; + result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); + + /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ + if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { + result->f.extra.arm.guarded = extract64(attrs, 50, 1); /* GP */ + } + device = S1_attrs_are_device(result->cacheattrs.attrs); } if (!(result->f.prot & (1 << access_type))) { @@ -2131,30 +2156,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.space = out_space; result->f.attrs.secure = arm_space_is_secure(out_space); - if (regime_is_stage2(mmu_idx)) { - result->cacheattrs.is_s2_format = true; - result->cacheattrs.attrs = extract32(attrs, 2, 4); - /* - * Security state does not really affect HCR_EL2.FWB; - * we only need to filter FWB for aa32 or other FEAT. - */ - device = S2_attrs_are_device(arm_hcr_el2_eff(env), - result->cacheattrs.attrs); - } else { - /* Index into MAIR registers for cache attributes */ - uint8_t attrindx = extract32(attrs, 2, 3); - uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)]; - assert(attrindx <= 7); - result->cacheattrs.is_s2_format = false; - result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8); - - /* When in aarch64 mode, and BTI is enabled, remember GP in the TLB. */ - if (aarch64 && cpu_isar_feature(aa64_bti, cpu)) { - result->f.extra.arm.guarded = extract64(attrs, 50, 1); /* GP */ - } - device = S1_attrs_are_device(result->cacheattrs.attrs); - } - /* * Enable alignment checks on Device memory. * From patchwork Sat Oct 5 20:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823496 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E9981552E0 for ; Sat, 5 Oct 2024 20:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158782; cv=none; b=h6wbwi4iwQleFASE8NZJ8DYXZv0ji3rTb83sNpcFQd5nyZsfCs8C9nZAx9KWp3uuAYhVLe6p5hpBTeCeQfdw4Hh0QGV+DbXHa3Q5TJJ37ItIPcj2CIbBmz9LQLaIuvd13EpucW6RqW5q3Wr9l2t4g20vZZyVqSPJywP5qnyx95w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158782; c=relaxed/simple; bh=r2cKUvhG9pNat8RIjHsog3GVW+rEGmVEg3b6INDSBgU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pMS21WY2UGJzhlai2lvlmR6wB/bfFBdBhsD4LmOTqypnUTDlvlShTelklBhPOG7StCVVfgKjhtDVYvVrIkaz5Y3kHLddkHCMiE4mZ+QocXj+s0gt0SVoUz64WZTAYyDayvYw2L+sdRLvCJ+0oiXML44jHOr1FVdtvEJUsuc+trU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FY8y0FZg; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FY8y0FZg" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-207115e3056so29305635ad.2 for ; Sat, 05 Oct 2024 13:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158780; x=1728763580; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0AFMCCsh2dZpLpZMXFYavJotm9FHniFYW8AGrgK05Hs=; b=FY8y0FZgaVm6x6FaA6yTdFcPpGiqi5YvdrGNLfBQD0KWOScDsbkneo5bAQhJL5Xp6m Gr6xjUZxeyMCg6VYbMFVPM8Ie3WvK0w8mNMMWaEfD7Jx3E02Mrsm23+9LRwA6OJVl4ck jP95NAs/aYevGFY8rVZfyctoW/ynS1WD1mkU5Wef3uhdlbMpVA5Qg2SATeD/DhOjeClb +rOhwRtWAYOV7Kin9/CtcGyjXrdM1HqKz33fekt+r8CLkQYddwA/OfbXg4WOLnFlRgfS sx8wDPiFQDrqvgklLLixSTbbucvYf4nPiiEqjxxOdINwbTv9lDwLaTfSo/DH1jiqOKDs 4wyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158780; x=1728763580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0AFMCCsh2dZpLpZMXFYavJotm9FHniFYW8AGrgK05Hs=; b=H4FHP479dW9jC8ZMgiYxLuzxE0DZ2vqvdqlZDLgzTlGsny5VhZQqb3L/RRTCccCXiQ 3YW8FSUw55YailCUqwztifjRcT0PcR+CQ6vQQIO6+vWgefY9Et8TiqwgIYZH9SlzAtIf SBtR2JrFD6kwC4XryjmEaJ6Jma7yd6Xx1BiQ2Ff1d//oGkOTvu1HW8xNlEkqDa+LuZvX jxwsRmdiNu10lBmEZrA4NMaBcUWDYZWVOtNPk/7ylqfLLzc1CVzLXDD1ZgHonGYijlk8 0R3rmSt9r+YD/UBQxWgXJ9/To/lwQ4bOcbU+zHdZD2kxYhIgT1rduFAmp4UsgV2KebXL b+kg== X-Forwarded-Encrypted: i=1; AJvYcCWXrh+Ztr6NPqbBX+sVwuAv4YhOZBwcedCmJQ1bYotZ+aTsllDdiqZJpdtUr9VMzaqmrjK313LhJ9ajbA8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzy0INGghnWUcs7r+IebO51+dzR0CmcV+S0jVaOvuMZm39r2NfM FgUV8RrFmh93iUVqv5YYs/axn8zhsP5JZMk+vKzfb+WlgHtNuxMSfOhdvjxrofY= X-Google-Smtp-Source: AGHT+IFQWlOaLHXh4IPf9U+1cxmSVfYPLms4xolaX7BFBENlDrFNojC92ydhZIWJvqWY9iSxsqXglg== X-Received: by 2002:a17:903:32ca:b0:206:9818:5439 with SMTP id d9443c01a7336-20bfdff2fe6mr85317145ad.19.1728158780508; Sat, 05 Oct 2024 13:06:20 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 20/21] target/arm: Add arm_cpu_tlb_fill_align Date: Sat, 5 Oct 2024 13:05:59 -0700 Message-ID: <20241005200600.493604-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fill in the tlb_fill_align hook. So far this is the same as tlb_fill_align_first, except that we can pass memop to get_phys_addr as well. Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Reviewed-by: Peter Maydell --- target/arm/internals.h | 3 +++ target/arm/cpu.c | 2 +- target/arm/tcg/cpu-v7m.c | 2 +- target/arm/tcg/tlb_helper.c | 27 +++++++++++++++++++++++---- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index a6088d551c..6916d43009 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -819,6 +819,9 @@ void arm_cpu_record_sigbus(CPUState *cpu, vaddr addr, bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); +bool arm_cpu_tlb_fill_align(CPUState *cs, vaddr address, MemOp memop, + int size, MMUAccessType access_type, + int mmu_idx, bool probe, uintptr_t retaddr); #endif static inline int arm_to_core_mmu_idx(ARMMMUIdx mmu_idx) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 08731ed4e0..293eb5949e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2663,7 +2663,7 @@ static const TCGCPUOps arm_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else - .tlb_fill_align = tlb_fill_align_first, + .tlb_fill_align = arm_cpu_tlb_fill_align, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 8874fe0e11..a071979636 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -242,7 +242,7 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, #else - .tlb_fill_align = tlb_fill_align_first, + .tlb_fill_align = arm_cpu_tlb_fill_align, .tlb_fill = arm_cpu_tlb_fill, .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt, .cpu_exec_halt = arm_cpu_exec_halt, diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 1d8b7bcaa2..e83ece9462 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -318,9 +318,9 @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, arm_deliver_fault(cpu, addr, access_type, mmu_idx, &fi); } -bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, - MMUAccessType access_type, int mmu_idx, - bool probe, uintptr_t retaddr) +static bool tlb_fill_internal(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, MemOp memop, + int mmu_idx, bool probe, uintptr_t retaddr) { ARMCPU *cpu = ARM_CPU(cs); GetPhysAddrResult res = {}; @@ -344,7 +344,7 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, * return false. Otherwise populate fsr with ARM DFSR/IFSR fault * register format, and signal the fault. */ - ret = get_phys_addr(&cpu->env, address, access_type, 0, + ret = get_phys_addr(&cpu->env, address, access_type, memop, core_to_arm_mmu_idx(&cpu->env, mmu_idx), &res, fi); if (likely(!ret)) { @@ -371,6 +371,25 @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, arm_deliver_fault(cpu, address, access_type, mmu_idx, fi); } } + +bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + return tlb_fill_internal(cs, address, size, access_type, 0, + mmu_idx, probe, retaddr); +} + +bool arm_cpu_tlb_fill_align(CPUState *cs, vaddr address, MemOp memop, + int size, MMUAccessType access_type, + int mmu_idx, bool probe, uintptr_t retaddr) +{ + if (unlikely(address & ((1 << memop_alignment_bits(memop)) - 1))) { + arm_cpu_do_unaligned_access(cs, address, access_type, mmu_idx, retaddr); + } + return tlb_fill_internal(cs, address, size, access_type, memop, + mmu_idx, probe, retaddr); +} #else void arm_cpu_record_sigsegv(CPUState *cs, vaddr addr, MMUAccessType access_type, From patchwork Sat Oct 5 20:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 13823497 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F382153838 for ; Sat, 5 Oct 2024 20:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158783; cv=none; b=Sx8Fzji9llwTgMY+wjyxh7jcDmMgoTVCJP/Ob5W4nFhEOD4CeSxgxW9KUe2fH53J4MFoYj4yBbhnE51gBDTivbY7gz+2n04xqX2tIg42b/2dxhB30vM1vUr7emehx4ZHPXvbHWKys/eEPuKLLvmY7YrIImFsvQa6dczBSr8h3NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158783; c=relaxed/simple; bh=yiKYyjzNDzYpUHiUdxWP4DdsbincyiYCu9UL8gVpY40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z9krxmHQL3ld9KdX0FQENFIhllOvSphpikzT2n4uoToDn/BBdGxMirJgCCsRwDuK4xqH/u/WHZryiuKe4d/fkMsSq8ZVnA0+JZ7ZXemypSfSasCdhz9bi2GCI8uIqxt9iZb1AyYk1fXwuyCwVdpUFCqCw8iNmNsCBcyUL+wIEt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YeqHYQOj; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YeqHYQOj" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-20b833f9b35so27623115ad.2 for ; Sat, 05 Oct 2024 13:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728158781; x=1728763581; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OPq3M0kuo1Nn8l2/hQhKXzGFF76ZzptYhUbdCidOcco=; b=YeqHYQOjdZ5855vj1V96x2qoIAvY3oR8YbUQ1WjZv2tuBPo4HuKcE83yR85lwdg1HH 3UjTmje0uF77ULGYuu1vZv+vaN0RWhbsxFouACXMATWW7jUFTY91n5XvC34A1krfjyxI DLKDUbNmcYZWYIBJ8neeN9D9U5GgPJAZ408GquQgJPxGrSDlDWfBQjGsgOZvAX+4h8dP WcaWJoBZwMkBII7ltkFHRn4s04X5fcWztw1lkYqh4WFIkerrhzYjDEHaNORBLJGztbYa 4hIfxOW+mRyiAz7PdAEhhoV7pQSmMVcf0okmh1irFDII3gxGhEp2XbGuANP4rgQQ4Rlu z/pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158781; x=1728763581; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OPq3M0kuo1Nn8l2/hQhKXzGFF76ZzptYhUbdCidOcco=; b=Rg51V+1LpLTqmQ06cwLZ2mzCsdvyYfXTuQF+78FfChFpSLJCh7RtRMWIixU+GqkkRu p+dPNtTDJbljY1XylOi00Gdq8u4/vAn6MPSB26Hjl8XOnwwCbMvDh3eS9AMrP6e4VdEp WXnI8Z8PGW/UGQ5fPKknda+GpTRYTPbUn1QFz/NOj+FwEQornEX+YIZWdD5u0pWdRHJB tp5s0+HLID1Y0bCbX4CjaxFatOobEJEf2cDQJMM3zrJVug2Vi3/9garZ9VDCUgznLtnF qcedn5wO9U2HFWhdTSfCzmmXkBfNbis4YEfF2F0/OGuz6diplj6j5HgopIXQZV+kI8Ij dSgQ== X-Forwarded-Encrypted: i=1; AJvYcCWPtsaDG+TiOe8dQ6UjdV8Wgs1SYImuEx4sF96f5nI0WCuDYqb0XcOO4PfhRPdDI2AaoINeiiRMhmYpzcw=@vger.kernel.org X-Gm-Message-State: AOJu0YyFakt3GtwxcqVO7q64TVfrHoEMeV193cWnSWy4g42P98gKiaq9 AVvbXGt2sYIDkjNvTcxpdhNzmxps1ZqOP+9I6C2bdCNXz2caa6weP8GteFpvpY7GnmjpvqrZ5D3 h X-Google-Smtp-Source: AGHT+IEXZ+Zzt8PYusjsrpVGhTnFdRGcsZ6PugCvEf2Sr7CI2YAi0gDdsUS8CYPUBNKBVP2Jklnamw== X-Received: by 2002:a17:902:da92:b0:20b:6188:fc5e with SMTP id d9443c01a7336-20bfdfff45emr91588865ad.28.1728158781473; Sat, 05 Oct 2024 13:06:21 -0700 (PDT) Received: from stoup.. (174-21-81-121.tukw.qwest.net. [174.21.81.121]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13931055sm16493405ad.139.2024.10.05.13.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 13:06:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@kernel.org, peter.maydell@linaro.org, alex.bennee@linaro.org, linux-parisc@vger.kernel.org, qemu-arm@nongnu.org Subject: [PATCH v2 21/21] target/arm: Fix alignment fault priority in get_phys_addr_lpae Date: Sat, 5 Oct 2024 13:06:00 -0700 Message-ID: <20241005200600.493604-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241005200600.493604-1-richard.henderson@linaro.org> References: <20241005200600.493604-1-richard.henderson@linaro.org> Precedence: bulk X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Now that we have the MemOp for the access, we can order the alignment fault caused by memory type before the permission fault for the page. For subsequent page hits, permission and stage 2 checks are known to pass, and so the TLB_CHECK_ALIGNED fault raised in generic code is not mis-ordered. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/ptw.c | 51 ++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 0a1a820362..dd40268397 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2129,6 +2129,36 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, device = S1_attrs_are_device(result->cacheattrs.attrs); } + /* + * Enable alignment checks on Device memory. + * + * Per R_XCHFJ, the correct ordering for alignment, permission, + * and stage 2 faults is: + * - Alignment fault caused by the memory type + * - Permission fault + * - A stage 2 fault on the memory access + * Perform the alignment check now, so that we recognize it in + * the correct order. Set TLB_CHECK_ALIGNED so that any subsequent + * softmmu tlb hit will also check the alignment; clear along the + * non-device path so that tlb_fill_flags is consistent in the + * event of restart_atomic_update. + * + * In v7, for a CPU without the Virtualization Extensions this + * access is UNPREDICTABLE; we choose to make it take the alignment + * fault as is required for a v7VE CPU. (QEMU doesn't emulate any + * CPUs with ARM_FEATURE_LPAE but not ARM_FEATURE_V7VE anyway.) + */ + if (device) { + unsigned a_bits = memop_atomicity_bits(memop); + if (address & ((1 << a_bits) - 1)) { + fi->type = ARMFault_Alignment; + goto do_fault; + } + result->f.tlb_fill_flags = TLB_CHECK_ALIGNED; + } else { + result->f.tlb_fill_flags = 0; + } + if (!(result->f.prot & (1 << access_type))) { fi->type = ARMFault_Permission; goto do_fault; @@ -2156,27 +2186,6 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw, result->f.attrs.space = out_space; result->f.attrs.secure = arm_space_is_secure(out_space); - /* - * Enable alignment checks on Device memory. - * - * Per R_XCHFJ, this check is mis-ordered. The correct ordering - * for alignment, permission, and stage 2 faults should be: - * - Alignment fault caused by the memory type - * - Permission fault - * - A stage 2 fault on the memory access - * but due to the way the TCG softmmu TLB operates, we will have - * implicitly done the permission check and the stage2 lookup in - * finding the TLB entry, so the alignment check cannot be done sooner. - * - * In v7, for a CPU without the Virtualization Extensions this - * access is UNPREDICTABLE; we choose to make it take the alignment - * fault as is required for a v7VE CPU. (QEMU doesn't emulate any - * CPUs with ARM_FEATURE_LPAE but not ARM_FEATURE_V7VE anyway.) - */ - if (device) { - result->f.tlb_fill_flags |= TLB_CHECK_ALIGNED; - } - /* * For FEAT_LPA2 and effective DS, the SH field in the attributes * was re-purposed for output address bits. The SH attribute in