From nobody Mon Feb 9 23:39:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1560133715; cv=none; d=zoho.com; s=zohoarc; b=KND6Rw659B52dSUz+EgcE2mPyCGfzGs6oW15yBBzSMdMhzwLcJjOKZ4HB8cZInZVeoFbChi526GQGUafBuuRy5lJZFX3+c14no1073/aVAZOSUREv6C+DNHL2q08FBcz2aii2eBOCBsH+MdtpnklllruRHnltXzWgXrv/wczpOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560133715; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pnOBaWOuZI6RQh/0O1nDjt3Ap0L8f++M/zWc9l2w1jE=; b=G89eV3UW/dBwjCdnWVsB5igT1gDuCWTASOZ0DRcjbO789NV3wVcZjO01YmbD6ZY+TnOOY59bME8uUjIi1LcMiDfaNrDRiWlw3zM4O6pWOhES8Tlsvhy2LhPggzpA7ipfTPeO6Mh6o9UBVlNIb3L7OZ70R5c0c/hyhxe9BhW4n7s= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560133715765761.3222688929616; Sun, 9 Jun 2019 19:28:35 -0700 (PDT) Received: from localhost ([::1]:39782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haA2y-0006S2-UI for importer@patchew.org; Sun, 09 Jun 2019 22:28:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53142) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha9e3-0006Ik-BN for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha9e2-0001lg-AR for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:47 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ha9e2-0001lL-4e for qemu-devel@nongnu.org; Sun, 09 Jun 2019 22:02:46 -0400 Received: by mail-pg1-x542.google.com with SMTP id f25so4142497pgv.10 for ; Sun, 09 Jun 2019 19:02:46 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id l63sm9749013pfl.181.2019.06.09.19.02.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 19:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pnOBaWOuZI6RQh/0O1nDjt3Ap0L8f++M/zWc9l2w1jE=; b=DT1XalxplIcXfF9J5/z+2DSwkPoGtEx64Qvik79+ASBJjsEwdbH2DpqrOzlCu7spR2 uWVJcVML9UxjwG301o0xk1AG1I9HGTHO04ASgPYj4piQyl+9N7bMFwi0exbBHFWgR48Y uVGYwavI+NRgJjNEVO4HpXHaWs4ihl4FXF2wAq/Lv1AwwKUSQPSo6vEtI89Vj2fzLtCe cpSfVCk9GFj+yGAYTLHpIQbgNW0PALsQ+ATGs5u6B0acnc7VNlCw+TUldhja2XTW1eWk XPLoM7VK0sXzPzWIN4EpJ4fzgAmOMNk65sNOSdgQ50gkI2CkNwILQ4SGEEMVJsIb/93Y QTsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pnOBaWOuZI6RQh/0O1nDjt3Ap0L8f++M/zWc9l2w1jE=; b=NAtOGTGKJaxJQuz5oBjdSPSuYW21d8po2cXNnCxqbR3fATKPn2893jTXJQNe+cY5Fw 5D/2F58BSkzI5+uwnmeBZZi6g3+pAg3+G+jMasKOWrCBw1ZX3VcyYcBppswt3Anhp/9X fIkh2QmKHRkPvYXfKAF1OCmYmFiI4z83eONjBFnxaKtHJohMhmFtyuYcf6Eb4qFNL4DL Vode5WJ3yyHbHR/Wc5DE/GNMATVRhe133vn+V5HvmCnfNbNApRDEGPuAVctiR3Kkon0n 57NxKzmQfQ9OA7nl0LvdjizlgVaMB2uFr38xs3eNuMEqrCSKpRumNVhtS+dpe3/zYUJZ tNMQ== X-Gm-Message-State: APjAAAUV80C96/G87DKFrNisRJ8qF4jZfVBPkuNM/q7TZdj6TZvpzzho 6bl1zYJ7/naav5q8rg1LNhexShTuK9Y= X-Google-Smtp-Source: APXvYqzj3nRVPH7UYG52oBTVzzS7kcJpRBXam3yBoUTjlo8k+AYAx5wxm0wGwilGllzBMkOps1BzkQ== X-Received: by 2002:a17:90a:3688:: with SMTP id t8mr2752155pjb.35.1560132164686; Sun, 09 Jun 2019 19:02:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Jun 2019 19:01:59 -0700 Message-Id: <20190610020218.9228-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610020218.9228-1-richard.henderson@linaro.org> References: <20190610020218.9228-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PULL 20/39] target/nios2: Use env_cpu, env_archcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cleanup in the boilerplate that each target must define. Replace nios2_env_get_cpu with env_archcpu. The combination CPU(nios2_env_get_cpu) should have used ENV_GET_CPU to begin; use env_cpu now. Reviewed-by: Alistair Francis Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 5 ----- hw/nios2/cpu_pic.c | 5 +---- target/nios2/mmu.c | 10 +++++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index ae6cf1b4d1..9490ba83e4 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -194,11 +194,6 @@ typedef struct Nios2CPU { uint32_t fast_tlb_miss_addr; } Nios2CPU; =20 -static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env) -{ - return NIOS2_CPU(container_of(env, Nios2CPU, env)); -} - #define ENV_OFFSET offsetof(Nios2CPU, env) =20 void nios2_tcg_init(void); diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c index 6bccce2f32..9e39955bd1 100644 --- a/hw/nios2/cpu_pic.c +++ b/hw/nios2/cpu_pic.c @@ -54,12 +54,9 @@ static void nios2_pic_cpu_handler(void *opaque, int irq,= int level) =20 void nios2_check_interrupts(CPUNios2State *env) { - Nios2CPU *cpu =3D nios2_env_get_cpu(env); - CPUState *cs =3D CPU(cpu); - if (env->irq_pending) { env->irq_pending =3D 0; - cpu_interrupt(cs, CPU_INTERRUPT_HARD); + cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD); } } =20 diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c index 53ed6413b4..9a0bafe786 100644 --- a/target/nios2/mmu.c +++ b/target/nios2/mmu.c @@ -61,7 +61,7 @@ unsigned int mmu_translate(CPUNios2State *env, Nios2MMULookup *lu, target_ulong vaddr, int rw, int mmu_idx) { - Nios2CPU *cpu =3D nios2_env_get_cpu(env); + Nios2CPU *cpu =3D env_archcpu(env); int pid =3D (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4; int vpn =3D vaddr >> 12; =20 @@ -103,7 +103,7 @@ unsigned int mmu_translate(CPUNios2State *env, static void mmu_flush_pid(CPUNios2State *env, uint32_t pid) { CPUState *cs =3D env_cpu(env); - Nios2CPU *cpu =3D nios2_env_get_cpu(env); + Nios2CPU *cpu =3D env_archcpu(env); int idx; MMU_LOG(qemu_log("TLB Flush PID %d\n", pid)); =20 @@ -127,7 +127,7 @@ static void mmu_flush_pid(CPUNios2State *env, uint32_t = pid) void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v) { CPUState *cs =3D env_cpu(env); - Nios2CPU *cpu =3D nios2_env_get_cpu(env); + Nios2CPU *cpu =3D env_archcpu(env); =20 MMU_LOG(qemu_log("mmu_write %08X =3D %08X\n", rn, v)); =20 @@ -244,7 +244,7 @@ void mmu_write(CPUNios2State *env, uint32_t rn, uint32_= t v) =20 void mmu_init(CPUNios2State *env) { - Nios2CPU *cpu =3D nios2_env_get_cpu(env); + Nios2CPU *cpu =3D env_archcpu(env); Nios2MMU *mmu =3D &env->mmu; =20 MMU_LOG(qemu_log("mmu_init\n")); @@ -255,7 +255,7 @@ void mmu_init(CPUNios2State *env) =20 void dump_mmu(CPUNios2State *env) { - Nios2CPU *cpu =3D nios2_env_get_cpu(env); + Nios2CPU *cpu =3D env_archcpu(env); int i; =20 qemu_printf("MMU: ways %d, entries %d, pid bits %d\n", --=20 2.17.1