From patchwork Wed Oct 9 00:04:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 833814 Delivered-To: patch@linaro.org Received: by 2002:adf:a1d9:0:b0:367:895a:4699 with SMTP id v25csp555896wrv; Tue, 8 Oct 2024 17:06:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUH1axMjT8R6zpHewc1YRFQcR0Qtsh6Eua8KQDgKZ/uj9ddw+Oi8PzZvknnEWyniNsjEUY30Q==@linaro.org X-Google-Smtp-Source: AGHT+IGXyb3Fqlbp3I63wJ3KsgStGRxTLzcburq6uaLBVHKm6i8pmlZ6vqKYVJ4/LFKTU6KBWQo2 X-Received: by 2002:a05:622a:1b15:b0:45f:873:ff5e with SMTP id d75a77b69052e-45fb0e6ef82mr9535251cf.57.1728432393428; Tue, 08 Oct 2024 17:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728432393; cv=none; d=google.com; s=arc-20240605; b=bfnlDUZdh1rkzkvGiydOojBfI2jhBqgsXhwMIKMGP/pfA8IMX0LTKiCPl0jrrmM/g8 ZMTaRHWB8CptwuxcjZF93F0N93drqI2hWVGSi80od7zsYQCw5WR5zW31oOoM6wUqs9aL S74oGRE7v8QGaRa5UD25LvVCdKGYxKbb92tgsmvEvAHcPEHyn6ztVQ/4mSBXvcFib9Wr K/K6d+EyAKhnaORa4fdEKJSpY3G8GG8c/WQFcldud2SRJuGdYVN3/g4sieU8967cYx0R cuOQGcGrsPBB+ziJ2Tmy3LBHIdNkMCgdZgfqr4jzbWoK4700dSmjnaUTkAbywtubjhhA QnaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; fh=3RK8noKPsRgJpwHDkrKY6p9N6ePZuLOt1ZjdS1VodvU=; b=YhC8tVj19xIYopBY9Ze32DKsiq1MNMkVdhGgNMCdv86Ld06H58oVCZJazCetPlsOsZ k9ikOQGCkwWFWr4lzwsrDomJMp0d1YAaOwyU82pqbSe7gH0FFbtNr5OeamQHffnH80sg MEDJgqWmHSudkOCiKMlK8WZ6fFAeD8DcU35o3sy0PNjFkH5/f/tc5qzPUbEN5JehpwE3 DO/w8A1vk4nXjPtd2Y0LnzY1Eee6CGPp095VIktuBckPmLuMfAOicNhWcNPy4jYId0dZ f3/m+hccYTYyBWWtsjzNlQV2Vaebe/QSl7qQinvgBamnhagrBIRvZ5NAfcHS0+adgcd3 kWLw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m4nCceRm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-45f07995de6si14940181cf.219.2024.10.08.17.06.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2024 17:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m4nCceRm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syKCY-0004QV-E1; Tue, 08 Oct 2024 20:05:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1syKCV-0004NL-3E for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:11 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1syKCS-0002tO-Ks for qemu-devel@nongnu.org; Tue, 08 Oct 2024 20:05:10 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-20b78ee6298so40043125ad.2 for ; Tue, 08 Oct 2024 17:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728432307; x=1729037107; darn=nongnu.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=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; b=m4nCceRmnrgpR8iO4c6bEet0g4jl68ZZxnA0huxaOtXZgT3JCkQV4MDcLYIan+bQMQ ro3x5eCBSJeTFL0L4UISQwc8DFrFxUYTDEeWCjUiD0DwCq9xXFooDYWzRM0ZH7in+NrT U4VLWyWO++TTfxMbY0hnBCqme1KsgbNh8bwrkQsLlDXvUOqHuSPKlpQTvdkfK2V5mMOx fcMG8NTVoqHsjCbfIAxnMdGQNioDcruQyTeUvPsmEfXFzil8ou8K64us7OpoQco+8Rh9 wNtYiaGYPkJnDJ+d2OQVNCKVguWR6MT3b39JZZtGuF72aGzb7bgRI5w0X2aNEiuzRVOB 5CBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728432307; x=1729037107; 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=RUID/VOY3Ga2ZN/DeZx4JrZs9/xknXUyzF7dZ/9YQNo=; b=okXZicSGSLr34gSn+J8EIQYTJCnU6+JO0KMtmG3IaHMkpSGN/b47xVtjBedoxi3a1K LW7GP2aN0z/y6IRIVPD48xjha6CBw4tj3vLAiTwwG1MKtMzVPNJ6hbdKfUrVvsPONbDP /YIHaKxp4Wf68zyINuxVzZvw/fftGdrOHnoBedBlOSPqqkehSDn/jO5jDdGrrt4oO4XC 3kEL8o8skpBPL6h0Wjtok9GsxwljlLlqD6ni83OWMJykV+WkcLAUpUKqyLlj5RXraeP3 ZiJWMJ5eGqdEsnVit3elfnd/up1jiUK/PDZv57kxddF9FYYsblWnNu+4KiTEM6Qy+C1m jJcA== X-Gm-Message-State: AOJu0YwsDY06RnntQsdGATgiAS+z6uNFsoi5P2tj7nlZd0DzIaDi2mv2 Z68/NhndSuSxYamiuoEYMfYjw4cylakTdAs24eVy4f5tJn/1BO0aV3NXUYZQ9opgZLew/icT1Ln a X-Received: by 2002:a17:902:e88f:b0:207:2093:99bb with SMTP id d9443c01a7336-20c63743a92mr10917825ad.31.1728432307098; Tue, 08 Oct 2024 17:05: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-20c138cecf2sm60705105ad.104.2024.10.08.17.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 17:05: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, Helge Deller , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 12/20] target/arm: Pass MemOp to get_phys_addr Date: Tue, 8 Oct 2024 17:04:45 -0700 Message-ID: <20241009000453.315652-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241009000453.315652-1-richard.henderson@linaro.org> References: <20241009000453.315652-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Zero is the safe do-nothing value for callers to use. Reviewed-by: Helge Deller Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- 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)) {