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: 161356 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1336475jan; Thu, 28 Mar 2019 16:36:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWsVOkAzyBreCOG4BiSsA+TRzUupTnuo6/KOd4Xard8lUnnnqUuv2vDyB+pmfvp5Sp1wDV X-Received: by 2002:a5e:db0d:: with SMTP id q13mr29357962iop.279.1553816206536; Thu, 28 Mar 2019 16:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553816206; cv=none; d=google.com; s=arc-20160816; b=f7V3I7xi9mYpTWtXP2fnXfUzk2bI9fLLzcLV4rHUz6uyp+b4A/wyAF8TR0VIBhgmSv zSjdhcnuZG5S1SWa2G4DZRnEsxluj/Za10q92MZ2pcXEB3r72KLx3aPoxNkWDwbXKjCQ 5/cONlOUKfhvfBCHZ/djga/xjMObOkv2V6tjQB+7R+HH1i4Yh9dFPJ/uDUWa+Z9CnfR/ sPmBQ/d5HsxwK4Q6GUGLpLdERva5M4Z329JfZ03yLsVUR2d06hSu60bSEO5hA7xX19Vj FA/vJr403R5t7vnFegzlWv7K/JOjgT62phe4U6xvpwWjalBcBzpNB5b4bRw+kzfyC2z6 cYNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=zb3IwtEFtozbWmQd0XMuC4pAkuKjWM7tvwO+rs6HOfo=; b=gEt57yue4MYqTNM1kDbvyl6QTMgWg6J7satweC8baUTGN0INbi4BBLoKA4iwx2uLas 0mnoHJoYD9jnbnO5IuYYp/yLTTmSVGKA5MJLNg0jTGQz37AnZGMCbDu1B/L5wEZ/wzdX xbwfRsk/kp/8VCx2L0HCVRUIeyYqeyKfXEWsHWifheyTEzMb+029YSQIx+DB2iNlGC2q fhd5UtLXHVHewWqVg8Xoph98UtKoxvbiCzZrKhBRpTb8l7rEhcfgrus+jRjTyyG6sBph thFUGB9Xv7t3ASc+K3ZRFSummlQiiVZCQWg8aW5z9SD7blzb2CqYmZnYr3C79cDTNu56 dgXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YobJelZX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h133si200642ith.107.2019.03.28.16.36.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Mar 2019 16:36:46 -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=fail header.i=@linaro.org header.s=google header.b=YobJelZX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:43402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9eZh-00084G-PL for patch@linaro.org; Thu, 28 Mar 2019 19:36:45 -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-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.17.1 Reviewed-by: Peter Maydell 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",