From patchwork Sun Apr 30 23:14:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 9706267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34091602CA for ; Sun, 30 Apr 2017 23:23:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 239502582C for ; Sun, 30 Apr 2017 23:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 158502623C; Sun, 30 Apr 2017 23:23:16 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 98CCE2582C for ; Sun, 30 Apr 2017 23:23:15 +0000 (UTC) Received: from localhost ([::1]:46215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4yBO-0007ON-Rs for patchwork-qemu-devel@patchwork.kernel.org; Sun, 30 Apr 2017 19:23:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4y3g-0002BO-Vv for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4y3f-0006k3-Ra for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:17 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:34917) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d4y3f-0006ig-LE for qemu-devel@nongnu.org; Sun, 30 Apr 2017 19:15:15 -0400 Received: by mail-pf0-x241.google.com with SMTP id o68so6704297pfj.2 for ; Sun, 30 Apr 2017 16:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ZSRaRZ7Gpo/Gz2A0pzY4GEBaKCItT05/PrKrzTgD0LE=; b=Nnh+g6sGi7fakVSL1smS20YAoHrLOMDaLSMYuKbQkor/7Fc8t5OMY9Nr6Clh91l7Bb jZ56IViPDmDk8dRfeSfsAYko1VgEKyou+8cRIYYvvQD+a7JowgBau1SNY/y3lmzhGZio UAXj2FOUImK2CWpOxZEkm38jmHfkK0reXH615TGiJNlatIVYF1rYkOoXDVsNBNHZee/B k4yUWAMn7gRNOMJplN4Z7xF6Z/URMj4xYbehRLQ1mj9xpNIEtSVP8UIwbfSdhkrglBal JpLCLt00Z3w8/J+PTL/RSHVzrgMw+P0/dVQ3jowQA4acQx/2LhIsKrzkTnyrTWtOMaJM dttw== 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:in-reply-to:references; bh=ZSRaRZ7Gpo/Gz2A0pzY4GEBaKCItT05/PrKrzTgD0LE=; b=kIxmhWMzFX1j7clyePPXFUuieA6jrmD+NDGNP0acX5iZLHJyY651boweO3BVrN/r4t 2dHSAGWbxIOqVgUlfOzmnjMkXqnnLH+Cl94pDJ0Rj88AKYZQ0j6uKshl/JQZl3Uf6MF7 frN6LshHHDFh352knV5Cu0S9rKaiBH61otxpe9LCw49hM1EPWmlgxvBAWClYrPMy3Ayg 0fdCCuVGJhQ73MVTkD4PVyx7odiDl/mT5aiGfvNvOilZBVncm7HPAesrsdmk6QUXqbE1 vwlapwX7XeBkMmZHR1VW01mZ9qFYkxwlLfnCUfOvsVGSItHIrtm8pZno5+LOCxU9mMUd 0LaQ== X-Gm-Message-State: AN3rC/6tO12DoSVdhGFAvcyns+YtIlNf+VRzPPdcOEX9gXe2ORHOB5oq u/5q6TIECF/d1g== X-Received: by 10.84.224.206 with SMTP id k14mr1034302pln.162.1493594114917; Sun, 30 Apr 2017 16:15:14 -0700 (PDT) Received: from localhost (z209.124-44-183.ppp.wakwak.ne.jp. [124.44.183.209]) by smtp.gmail.com with ESMTPSA id x185sm20859981pfx.102.2017.04.30.16.15.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 30 Apr 2017 16:15:14 -0700 (PDT) From: Stafford Horne To: peter.maydell@linaro.org Date: Mon, 1 May 2017 08:14:24 +0900 Message-Id: <5466599bfa21f03ae01741580c7e3fa0fdc6800d.1493593744.git.shorne@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PULL 10/11] target/openrisc: Remove duplicate features property 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: , Cc: Stafford Horne , QEMU Development Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The features property has stored the exact same thing as the cpucfgr spr. Remove the feature enum and property as it is not needed. In order to preserve the behavior or keeping features accross reset this patch moves cpucfgr into the non reset region of the state struct. Since the cpucfgr is read only this means we only need to sset cpucfgr once during class init. Signed-off-by: Stafford Horne --- target/openrisc/cpu.c | 17 +++-------------- target/openrisc/cpu.h | 16 ++-------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 6c1ed07..c9b3f22 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -52,7 +52,6 @@ static void openrisc_cpu_reset(CPUState *s) s->exception_index = -1; cpu->env.upr = UPR_UP | UPR_DMP | UPR_IMP | UPR_PICP | UPR_TTP; - cpu->env.cpucfgr = CPUCFGR_OB32S | CPUCFGR_OF32S | CPUCFGR_NSGF; cpu->env.dmmucfgr = (DMMUCFGR_NTW & (0 << 2)) | (DMMUCFGR_NTS & (6 << 2)); cpu->env.immucfgr = (IMMUCFGR_NTW & (0 << 2)) | (IMMUCFGR_NTS & (6 << 2)); @@ -65,12 +64,6 @@ static void openrisc_cpu_reset(CPUState *s) #endif } -static inline void set_feature(OpenRISCCPU *cpu, int feature) -{ - cpu->feature |= feature; - cpu->env.cpucfgr = cpu->feature; -} - static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); @@ -132,19 +125,15 @@ static void or1200_initfn(Object *obj) { OpenRISCCPU *cpu = OPENRISC_CPU(obj); - set_feature(cpu, OPENRISC_FEATURE_NSGF); - set_feature(cpu, OPENRISC_FEATURE_OB32S); - set_feature(cpu, OPENRISC_FEATURE_OF32S); - set_feature(cpu, OPENRISC_FEATURE_EVBAR); + cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_OF32S | + CPUCFGR_EVBARP; } static void openrisc_any_initfn(Object *obj) { OpenRISCCPU *cpu = OPENRISC_CPU(obj); - set_feature(cpu, OPENRISC_FEATURE_NSGF); - set_feature(cpu, OPENRISC_FEATURE_OB32S); - set_feature(cpu, OPENRISC_FEATURE_EVBAR); + cpu->env.cpucfgr = CPUCFGR_NSGF | CPUCFGR_OB32S | CPUCFGR_EVBARP; } typedef struct OpenRISCCPUInfo { diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index e159b22..938ccc3 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -196,18 +196,6 @@ enum { SR_SCE = (1 << 17), }; -/* OpenRISC Hardware Capabilities */ -enum { - OPENRISC_FEATURE_NSGF = (15 << 0), - OPENRISC_FEATURE_CGF = (1 << 4), - OPENRISC_FEATURE_OB32S = (1 << 5), - OPENRISC_FEATURE_OB64S = (1 << 6), - OPENRISC_FEATURE_OF32S = (1 << 7), - OPENRISC_FEATURE_OF64S = (1 << 8), - OPENRISC_FEATURE_OV64S = (1 << 9), - OPENRISC_FEATURE_EVBAR = (1 << 12), -}; - /* Tick Timer Mode Register */ enum { TTMR_TP = (0xfffffff), @@ -292,7 +280,6 @@ typedef struct CPUOpenRISCState { uint32_t sr; /* Supervisor register, without SR_{F,CY,OV} */ uint32_t vr; /* Version register */ uint32_t upr; /* Unit presence register */ - uint32_t cpucfgr; /* CPU configure register */ uint32_t dmmucfgr; /* DMMU configure register */ uint32_t immucfgr; /* IMMU configure register */ uint32_t esr; /* Exception supervisor register */ @@ -311,6 +298,8 @@ typedef struct CPUOpenRISCState { CPU_COMMON /* Fields from here on are preserved across CPU reset. */ + uint32_t cpucfgr; /* CPU configure register */ + #ifndef CONFIG_USER_ONLY CPUOpenRISCTLBContext * tlb; @@ -337,7 +326,6 @@ typedef struct OpenRISCCPU { CPUOpenRISCState env; - uint32_t feature; /* CPU Capabilities */ } OpenRISCCPU; static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)