From patchwork Thu Mar 28 23:03:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10876083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 893501575 for ; Thu, 28 Mar 2019 23:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72CB428D92 for ; Thu, 28 Mar 2019 23:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65D2C28FD9; Thu, 28 Mar 2019 23:37:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 571DC28D92 for ; Thu, 28 Mar 2019 23:37:54 +0000 (UTC) Received: from localhost ([127.0.0.1]:43418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9ean-0000ji-Iv for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Mar 2019 19:37:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eKq-0001km-JG for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:21:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9e4h-00037S-R8 for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:45 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:39154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9e4f-00035y-ML for qemu-devel@nongnu.org; Thu, 28 Mar 2019 19:04:42 -0400 Received: by mail-pg1-x543.google.com with SMTP id k3so229669pga.6 for ; Thu, 28 Mar 2019 16:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=zb3IwtEFtozbWmQd0XMuC4pAkuKjWM7tvwO+rs6HOfo=; b=YobJelZX71gUV7s3ktbKEZHXnQnxR9s2xGa7/jEV0He3Tb47ga79Y93YxQtzGSZiIn u0tYmqtaQ5OgAOw9bAi701UVI4ODyH9llnVu3NBOhczBasWeucQteUr9jQgDBPknAKAc YjaFx46thqWYrbMreFiEDOYLDl4Jyo5GkaY1xvi/spD699VYSrCnYOCn2XQkBtyOvwuY NzFQ3tJPzfR3R6D5MW173183ljugUoSaHDmIZuYKtKKEC+HiBUGInCUF/RUIiksD/gc3 WBjwBM5qtMNMjJs1wG09uOre9p0xdqYGBIIQB5D5sJRXtfmWc1JuJPBlFq8UxH7REp2f uJtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=zb3IwtEFtozbWmQd0XMuC4pAkuKjWM7tvwO+rs6HOfo=; b=BBDqwnXIC1dK8Sr1NnLJCZdQSyX64v+HtbmujvJ73/U9cZ+pCjMBDAVtL8f46gSvRI myc4Sxx7lGrjsi1ZI2w9yijIgBL3/6aGi5PeSamNEb/117pRsmyKRqz9V+ACn9xbxUJq H8JT6IGSBoVF4Cd05YsESSTvqHSpzG9cjRI5DpitlVMZQ0Ds7pGpGbJAZVbQ10sMP4Iv qqO6xlPzrdJScQZfkylWkapRhDfNzlsYwbo00N+MfIf9jhX/eqPqMViUcPbN6fX9z5e4 ToE0bEFF/eEUTIdaT3Oq8HqA8pWn6t8bAqTqh+af9ChKT70AdWbE1x6QLEZrmZ2hQSFh qcxw== X-Gm-Message-State: APjAAAWF5qLGcevBR5GnsQ+4VtdztJJ9ffLKdmHCLzRj+7+GciA1Mdkw 82jWGRn1tEPEVtp+zyN/N1Yw/A1/yTI= X-Google-Smtp-Source: APXvYqw+ZDVRpUkkIiptIWr3yNbHX8hzownz0MqkKcJJKpSK6H5Oftc++5vT+h9afv8CoVHJSG3Mbw== X-Received: by 2002:a62:445a:: with SMTP id r87mr42876488pfa.13.1553814277572; Thu, 28 Mar 2019 16:04:37 -0700 (PDT) Received: from cloudburst.ASUS (cpe-66-75-72-255.hawaii.res.rr.com. [66.75.72.255]) by smtp.gmail.com with ESMTPSA id f1sm280911pgl.35.2019.03.28.16.04.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 16:04:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Mar 2019 13:03:46 -1000 Message-Id: <20190328230404.12909-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190328230404.12909-1-richard.henderson@linaro.org> References: <20190328230404.12909-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::543 Subject: [Qemu-devel] [PATCH for-4.1 v2 18/36] target/nios2: Use env_cpu, env_archcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- 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 e0e12a910e..3fc27ead81 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -193,11 +193,6 @@ typedef struct Nios2CPU { uint32_t fast_tlb_miss_addr; } Nios2CPU; -static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env) -{ - return NIOS2_CPU(container_of(env, Nios2CPU, env)); -} - #define ENV_OFFSET offsetof(Nios2CPU, env) 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) void nios2_check_interrupts(CPUNios2State *env) { - Nios2CPU *cpu = nios2_env_get_cpu(env); - CPUState *cs = CPU(cpu); - if (env->irq_pending) { env->irq_pending = 0; - cpu_interrupt(cs, CPU_INTERRUPT_HARD); + cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD); } } diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c index 0752699e25..173da3becc 100644 --- a/target/nios2/mmu.c +++ b/target/nios2/mmu.c @@ -72,7 +72,7 @@ unsigned int mmu_translate(CPUNios2State *env, Nios2MMULookup *lu, target_ulong vaddr, int rw, int mmu_idx) { - Nios2CPU *cpu = nios2_env_get_cpu(env); + Nios2CPU *cpu = env_archcpu(env); int pid = (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4; int vpn = vaddr >> 12; @@ -114,7 +114,7 @@ unsigned int mmu_translate(CPUNios2State *env, static void mmu_flush_pid(CPUNios2State *env, uint32_t pid) { CPUState *cs = env_cpu(env); - Nios2CPU *cpu = nios2_env_get_cpu(env); + Nios2CPU *cpu = env_archcpu(env); int idx; MMU_LOG(qemu_log("TLB Flush PID %d\n", pid)); @@ -138,7 +138,7 @@ static void mmu_flush_pid(CPUNios2State *env, uint32_t pid) void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v) { CPUState *cs = env_cpu(env); - Nios2CPU *cpu = nios2_env_get_cpu(env); + Nios2CPU *cpu = env_archcpu(env); MMU_LOG(qemu_log("mmu_write %08X = %08X\n", rn, v)); @@ -255,7 +255,7 @@ void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v) void mmu_init(CPUNios2State *env) { - Nios2CPU *cpu = nios2_env_get_cpu(env); + Nios2CPU *cpu = env_archcpu(env); Nios2MMU *mmu = &env->mmu; MMU_LOG(qemu_log("mmu_init\n")); @@ -266,7 +266,7 @@ void mmu_init(CPUNios2State *env) void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUNios2State *env) { - Nios2CPU *cpu = nios2_env_get_cpu(env); + Nios2CPU *cpu = env_archcpu(env); int i; cpu_fprintf(f, "MMU: ways %d, entries %d, pid bits %d\n",