From patchwork Wed May 8 00:06:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163585 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:81:0:0:0:0 with SMTP id l1csp2002675ilm; Tue, 7 May 2019 17:29:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqzj0ez3hu3eSMG3YRzwNdAtf2skTkcLqsIpkFMNB5t3eD7kVJk6VObANxh68U1Oq6PoYmzQ X-Received: by 2002:adf:ed8f:: with SMTP id c15mr3522163wro.14.1557275350237; Tue, 07 May 2019 17:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557275350; cv=none; d=google.com; s=arc-20160816; b=ddPpr75Vn+M0isV43utLla66fIZSoNrIzem5UNuuoqMtVJSsHN1L80/KaOuJUDWAWa iDKZF1qu7XskKg4whXiUffrMIhdBrqOQZ/IdXUm/Or89fFHVKC4HeNbA9DhtU8ECJzdJ P9N80Ql03m312yHvvlowXcO/wCAoPXDEBq97BLOPUIeSOPkRy8FfY4HryzY3B3LMgKe1 8mtlf3Q2VE4qj1cj2f03g4L3lGa1F9XZz9u0GFHmHQNQh2/RDExwOgzBxrx/kCXIigoH c35M6Hy9gSXre+JcfCZ3PBi1Mr1yoTyUUW7+YRwergexnkIPlOBxDLcl61jsXs9FcWP4 OO4w== 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=ilw4uJGpVF3VRToZ+rnA6cMu0Ie6bfMk5jWb5ElbsqI=; b=PY4wjWwc3y0jsquyQDOmrZfiaP47jNfs3+sw3cdNu87RBfNS4mEgmDHUNmb5XDk040 Zmioey+HfjIhyWkbs0gCm2AQWugnV+0hcEs0qsdAqplavSurPCDRECCvN+hx9/XzS9pB cftT2uwWJ74tfaxcUGUDhyLQRi6lQWaEr52wGkRKZ7JX4JGIODE5zJBz8r5se7sXoCAC +QuVvO2sjq0VTIFO0mL2QV5amSXFMABw1dpbtIYZvbnXuduv13KuzQHp8M2rBaCG818U WsnAPOd3H8o1lg8584PwOIUl02YXunM/I5tbk4heJHFZnq/i83frTUcgVzj7Sddn1LKm AsLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=t+yT0MqK; 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 i10si389147wmc.135.2019.05.07.17.29.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 May 2019 17:29:10 -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=t+yT0MqK; 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]:56686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOASL-0001nR-3f for patch@linaro.org; Tue, 07 May 2019 20:29:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOA7Q-0007uX-Hd for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOA7O-0007oB-Sx for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:32 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:38883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOA7M-0007fA-UT for qemu-devel@nongnu.org; Tue, 07 May 2019 20:07:30 -0400 Received: by mail-pf1-x444.google.com with SMTP id 10so9495796pfo.5 for ; Tue, 07 May 2019 17:07:28 -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=ilw4uJGpVF3VRToZ+rnA6cMu0Ie6bfMk5jWb5ElbsqI=; b=t+yT0MqKTwN3NCCgMr1medazLsigIeYlZ9lv4WQ7emLsSTHUEVlBEqcTh2OBan5ud1 6D253nKsaviIpepevbYrbixCApfPDpreFC9uPF7GJU1cpds/3hF3CMj+VPQJaKtoHMiZ b8e8rtomCCC7hlkqZO16f8180gs39o9QVT19kSleokgIupRZr95PYK4rqVHEYrDeWKEa yN2fHuRALvW6w9l6tYKq94DlUt/raHNmUXvtwYrZIblrEBkLNHpaMXFz7zdREJRUxPsF eh3NtJCCs6rOdZYN6GBaNsn+wZPrR2K26RP7mgkyaWiT2g6TfaxQWxxpaJLvKbNKWNOa Lx1g== 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=ilw4uJGpVF3VRToZ+rnA6cMu0Ie6bfMk5jWb5ElbsqI=; b=aI67aMRNgIFeE71Bqoo2CVlRrgdjl2EA2u4LC0yy8tecxGEsvaY/PPJpM2tVf/UsgB Z+q55uT72vYtQCa3Xwq35S4OczN2ywW5UvEW1dswV5AW8ipwEhnhNrfOD1pLdM+YmPNQ 9I8Zpso/caKtM+yY4awhr84J73LK6dcbaNCfv1U/EWe/aZ/meMsmGam/QhxeyLuEZ+pN +AH7x8trWxp0ToCH4y6zZQM66gEpyWoWhcLzjMyuTNGUqFuTN/Fm/hYbTeKp5d6yUshr IEB9XTbihAtiCYJeWq1mtCYbjcPXvQcUHXlawe1w5jh3EOm1ceWZkgvpSXEh8/BoifrE CHVQ== X-Gm-Message-State: APjAAAU7Zyiu6VsOh3sz0Dd5EIbhUOytVreY3wUxYO0yGKh2TLiigOxq V14AJAhIz3O/BDJGGe6MFyuE/31M7dY= X-Received: by 2002:a62:2ec4:: with SMTP id u187mr28118180pfu.84.1557274046213; Tue, 07 May 2019 17:07:26 -0700 (PDT) Received: from localhost.localdomain (97-113-189-189.tukw.qwest.net. [97.113.189.189]) by smtp.gmail.com with ESMTPSA id j1sm15793183pgp.91.2019.05.07.17.07.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 17:07:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 7 May 2019 17:06:35 -0700 Message-Id: <20190508000641.19090-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190508000641.19090-1-richard.henderson@linaro.org> References: <20190508000641.19090-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::444 Subject: [Qemu-devel] [PATCH v3 33/39] cpu: Introduce CPUNegativeOffsetState 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" Nothing in there so far, but all of the plumbing done within the target ArchCPU state. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 24 ++++++++++++++++++++++++ include/exec/cpu-defs.h | 8 ++++++++ target/alpha/cpu.h | 1 + target/arm/cpu.h | 1 + target/cris/cpu.h | 1 + target/hppa/cpu.h | 1 + target/i386/cpu.h | 1 + target/lm32/cpu.h | 1 + target/m68k/cpu.h | 1 + target/microblaze/cpu.h | 5 +++-- target/mips/cpu.h | 1 + target/moxie/cpu.h | 1 + target/nios2/cpu.h | 2 ++ target/openrisc/cpu.h | 2 +- target/ppc/cpu.h | 2 ++ target/riscv/cpu.h | 1 + target/s390x/cpu.h | 1 + target/sh4/cpu.h | 1 + target/sparc/cpu.h | 1 + target/tilegx/cpu.h | 1 + target/tricore/cpu.h | 1 + target/unicore32/cpu.h | 1 + target/xtensa/cpu.h | 1 + 23 files changed, 57 insertions(+), 3 deletions(-) -- 2.17.1 Reviewed-by: Alistair Francis diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 71154070a7..5ae83405c8 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -404,4 +404,28 @@ static inline CPUState *env_cpu(CPUArchState *env) return &env_archcpu(env)->parent_obj; } +/** + * env_neg(env) + * @env: The architecture environment + * + * Return the CPUNegativeOffsetState associated with the environment. + */ +static inline CPUNegativeOffsetState *env_neg(CPUArchState *env) +{ + ArchCPU *arch_cpu = container_of(env, ArchCPU, env); + return &arch_cpu->neg; +} + +/** + * cpu_neg(cpu) + * @cpu: The generic CPUState + * + * Return the CPUNegativeOffsetState associated with the cpu. + */ +static inline CPUNegativeOffsetState *cpu_neg(CPUState *cpu) +{ + ArchCPU *arch_cpu = container_of(cpu, ArchCPU, parent_obj); + return &arch_cpu->neg; +} + #endif /* CPU_ALL_H */ diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h index fbe8945606..ad97991faf 100644 --- a/include/exec/cpu-defs.h +++ b/include/exec/cpu-defs.h @@ -227,4 +227,12 @@ typedef struct CPUTLB { #endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ +/* + * This structure must be placed in ArchCPU immedately + * before CPUArchState, as a field named "neg". + */ +typedef struct CPUNegativeOffsetState { + /* Empty */ +} CPUNegativeOffsetState; + #endif diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index 66782cf5d4..f4bb67c101 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -267,6 +267,7 @@ struct AlphaCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUAlphaState env; /* This alarm doesn't exist in real hardware; we wish it did. */ diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 23beb1de9a..909cb4604d 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -719,6 +719,7 @@ struct ARMCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUARMState env; /* Coprocessor information */ diff --git a/target/cris/cpu.h b/target/cris/cpu.h index c19fdcec1e..eeab483dba 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -180,6 +180,7 @@ struct CRISCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUCRISState env; }; diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 58b2bf2933..0661ff60c1 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -218,6 +218,7 @@ struct HPPACPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUHPPAState env; QEMUTimer *alarm_timer; }; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index a9cfb42b22..43bb6ab841 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1368,6 +1368,7 @@ struct X86CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUX86State env; bool hyperv_vapic; diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h index 4234a439a3..0ec898eb1d 100644 --- a/target/lm32/cpu.h +++ b/target/lm32/cpu.h @@ -186,6 +186,7 @@ struct LM32CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPULM32State env; uint32_t revision; diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 02fbff3625..096d1eb588 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -160,6 +160,7 @@ struct M68kCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUM68KState env; }; diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 1becb9270b..732653caed 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -287,6 +287,9 @@ struct MicroBlazeCPU { /*< public >*/ + CPUNegativeOffsetState neg; + CPUMBState env; + /* Microblaze Configuration Settings */ struct { bool stackprot; @@ -306,8 +309,6 @@ struct MicroBlazeCPU { char *version; uint8_t pvr; } cfg; - - CPUMBState env; }; diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 52286fcb0e..2d9c5f26eb 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1048,6 +1048,7 @@ struct MIPSCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUMIPSState env; }; diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h index ebe1c66f52..f5ee8a02f4 100644 --- a/target/moxie/cpu.h +++ b/target/moxie/cpu.h @@ -87,6 +87,7 @@ typedef struct MoxieCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUMoxieState env; } MoxieCPU; diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 96c8193179..cd06a2ef41 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -181,7 +181,9 @@ typedef struct Nios2CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUNios2State env; + bool mmu_present; uint32_t pid_num_bits; uint32_t tlb_num_ways; diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index 150227d450..e1acd48652 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -313,8 +313,8 @@ typedef struct OpenRISCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUOpenRISCState env; - } OpenRISCCPU; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f970853556..bb57496212 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1184,7 +1184,9 @@ struct PowerPCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUPPCState env; + int vcpu_id; uint32_t compat_pvr; PPCVirtualHypervisor *vhyp; diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 818692dde5..30a01e8386 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -208,6 +208,7 @@ typedef struct RISCVCPU { /*< private >*/ CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPURISCVState env; } RISCVCPU; diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 971dc0ccbd..ebcf7863e4 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -156,6 +156,7 @@ struct S390CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUS390XState env; S390CPUModel *model; /* needed for live migration */ diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 3f2f4043e0..944854dbe0 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -204,6 +204,7 @@ struct SuperHCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUSH4State env; }; diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index b170dd592e..ae9ac07a9d 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -529,6 +529,7 @@ struct SPARCCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUSPARCState env; }; diff --git a/target/tilegx/cpu.h b/target/tilegx/cpu.h index 643b7dbd17..deb3e836ea 100644 --- a/target/tilegx/cpu.h +++ b/target/tilegx/cpu.h @@ -135,6 +135,7 @@ typedef struct TileGXCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUTLGState env; } TileGXCPU; diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index 581e68e37c..43ef29b6bd 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -205,6 +205,7 @@ struct TriCoreCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUTriCoreState env; }; diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h index abb36b5d48..140c590ec1 100644 --- a/target/unicore32/cpu.h +++ b/target/unicore32/cpu.h @@ -73,6 +73,7 @@ struct UniCore32CPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUUniCore32State env; }; diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 748b6fca25..1bbb839bed 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -526,6 +526,7 @@ struct XtensaCPU { CPUState parent_obj; /*< public >*/ + CPUNegativeOffsetState neg; CPUXtensaState env; };