From patchwork Sat Mar 23 19:09:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 160976 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2190842jan; Sat, 23 Mar 2019 12:37:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8wgPzcHZHdj7lNyA8smIRLF3iRygApATohr7rYs/8YoVw1Chi9wDA4FNW14ag7A5qhE77 X-Received: by 2002:a0d:d7c5:: with SMTP id z188mr13962175ywd.346.1553369854795; Sat, 23 Mar 2019 12:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553369854; cv=none; d=google.com; s=arc-20160816; b=tRkj/8B7AhByFXAxl+RXZTYoWky8fuDGqjJJ0GGppqkcsUfLaRgOswzcZtfdSVI33O WdYmbHv9RnJNSYvdX/+Xeqrkgi6m1YNOisq0NcKMIko9uTcR83YiP8P6EWgk/GgfqK37 i+Db40yhNZtYvtN2265td8PGhBXqcmzduyqhe0YB9yWbAVsLz0ELdF9ottqm7CN+jGz8 YbAFP/4i3FNn0Xdk137NRMZSJBnV1fqzJ2KwQUXccWmPDkkHWRbpxPgi37f4jc1769/f t01KRN690NXDRfS5IYkgdfIVDHAnI9UiRrgvW1WyDYpmz0z7GCg0Vc11RS6NQZ51yW6k h3Hg== 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=snslY8abQTdgd3UYfQTOr6XdgiBekNbliYbV8TqybxB3ufBZyqE+3iflzxIECKdGoU 2xTtquBYptDPW59EbT/kQ9w9OJlhgG6Jf2sI3jpjfXHuacVFeuCFFTrM/bO+EWyS0HEn +3pzG43yUQ31cWfvprTVoyN1QG9hKy7fulPbIgywW7OL3GbzAZw4tqbw+kOC6DAUzJ8/ IEGqscKG2HXuRBFZTKuY5Yyrd3PMTASAXKTFWyDPu0soRgNdOIup6QU/iSe7XqhWYRsR sIJgaphYzUmuB6kDGOv/nIhT0vYQrtSGVLRn9CZklFg2kzldtAYAx5+z81RdWlaqblDz 6DgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=unYyTZaH; 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 g187si6979081ywa.203.2019.03.23.12.37.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 23 Mar 2019 12:37:34 -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=unYyTZaH; 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]:47133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mSU-0002Gs-9f for patch@linaro.org; Sat, 23 Mar 2019 15:37:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7mFx-0007kB-Vr for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:24:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7m26-0007Do-U6 for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:10:21 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:43011) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h7m1y-0006vd-N6 for qemu-devel@nongnu.org; Sat, 23 Mar 2019 15:10:14 -0400 Received: by mail-pf1-x441.google.com with SMTP id c8so3672571pfd.10 for ; Sat, 23 Mar 2019 12:09:51 -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=unYyTZaHsIb6CtgkMplJj9sdqQ0eEPLsaZs+KGMcm92n/TXcQlGTK0yKDkfBP6C5El v4GDbLaH/H8BrO8bs9QjF3VK3MopP0n8SqRWQTB0WuKBPHw6dRMeN3bwaUZOAktH9edy R4H5D2NDrs9q7ewvngrZzbuDhxyWrHWBxd6r9/6ZVcqa12J1xFuvyINWVmBe3hjfFkKi wDRrFkRw2dzIzKmDQxaEZnf7H124LUuNNIeOiWlabuYOkdYb2/e/pipUzgYHCWoG5VOd Azr0hPXFtx75MJEbu8KjQnPVCIKcOxEwoZNDEQMqRttu8AqEwbrJbtGgrTRbBR3H81EO H2YA== 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=Iwl3+TX9BSKuF5mfY9+OCwZMDa4gnEeT1s9rY2HdNOUl8OSLTcnkiyqUAEh6ECGZWs 8MdEjcixeArE74rMvlLJwgfp2huZHN2WfU/QC0MfzfIkEAN9mR14/PP2A3M5z04VlCkh 6fYvdnQykKz6BCs8WNhkD2NF2KsErpfKt5NVpehU14OaF+dMNng7bGgJWHYgLPrFNO5T jzTXa8tJwEDDPf2qfpGYxWJlsqRfWKqlQfk5sz4sAngDZ7mBuy6EmEzPsm7CvfXicItj ImknkxKRGWzvuwwLExh6XcYcYGBM6HMbW5M4tJ0o8XH25Ke+5rBI2JFC+ujO53S7tuWP bWtQ== X-Gm-Message-State: APjAAAV8w80W8Q/V+J6SaqV36ywpCKZPGj3ANGSTOX7AHZ3fPvw7RxEl RWRTb9LrPIuTmSe2KP1ZcMiUDsAnjY8= X-Received: by 2002:a17:902:2aca:: with SMTP id j68mr16446702plb.233.1553368190802; Sat, 23 Mar 2019 12:09:50 -0700 (PDT) Received: from localhost.localdomain (174-21-5-201.tukw.qwest.net. [174.21.5.201]) by smtp.gmail.com with ESMTPSA id h184sm25990703pfc.78.2019.03.23.12.09.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Mar 2019 12:09:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 23 Mar 2019 12:09:08 -0700 Message-Id: <20190323190925.21324-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190323190925.21324-1-richard.henderson@linaro.org> References: <20190323190925.21324-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::441 Subject: [Qemu-devel] [PATCH 18/35] 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 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",