From patchwork Tue Nov 7 12:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 741868 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1587861wrr; Tue, 7 Nov 2023 04:27:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/jPo1WDcl5Dya1bg3Dv4otCJ1O4XddZzZU4MgA/wuwpfOKU7iBGqksRrMPAtgWUh0uuy/ X-Received: by 2002:a05:622a:15c6:b0:41e:236d:9474 with SMTP id d6-20020a05622a15c600b0041e236d9474mr38081877qty.64.1699360077318; Tue, 07 Nov 2023 04:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699360077; cv=none; d=google.com; s=arc-20160816; b=dKwDNFunWIhDHBixzXRkhuQ56wZk3l9JybC65bIssIYBoEqNKNOdMw12HdwRdXhnWu i/o6rYlzlnXTfVtKvCZrEuLhX/wccdDq9kYjcPB8CLaVEQqsmCFWp+iD2J6cLBYfvVDD BqcMCLJXSPsGKIB+ylSR6tFCkj26ribGVJxgMrWmt/yzPdjL7gkQbSvVk/zxJy32EepK PBQalv+O0/HR/P++IA07zjeOiAeEp8FMUW5qseQnX5xSUNloimMAqlFr7m1ldFzadXsl gVPvaVI4i6PvuJoDWrHYZD9xkLXgKI2Go9jFQ+p6l4LeNBq7/cI6VnKYjts67kQVDF3N v4sg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IukOQrcvFKTQKQHU+Gn7+JZ4VvtRt6lfWofdjUUbwSE=; fh=YV4gNTMS90pCJFtdEnyCZ1ABVtsCB59kwLHicky2n2c=; b=ZVPWjJ6RrvEFxfpPg2ZWRJCeWApTr/n+SD6dpkky3sZrPs6zkE4W1IDeE3niCgcSpR cNrQdf7LENJeUy0iJBzTjSb96UTPb0Jl89pFAU9K8R7ewr9vYB9Q9aoQ1tpaIpLkuYkf Kp8m2tnx+iic50XYyL0jOt7xCrvjxfLnCbVqn4ZFZ49lu3gHGZnjIiUkv5SHtYucs6jP LZ5raUE/yeznYmosj56KR2bDAJ+8AxIpJMNBhpdDlv6OLZ72pQORsb+6bTrM2vlh5dij agqS/Lzx1fAIVOe5sRrIJrp+FdudnJ+U3RKyV4ghVRv8cE9tBFHj8xZDGSMNLdBgBA8U ThxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uoGCNbkP; 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=pass (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 t12-20020ac8588c000000b0041e3143e812si6839092qta.263.2023.11.07.04.27.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Nov 2023 04:27:57 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=uoGCNbkP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0L96-0005ki-CT; Tue, 07 Nov 2023 07:25:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0L95-0005ex-1Z for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:25:27 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0L8j-0004nM-KK for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:25:26 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40906fc54fdso43003605e9.0 for ; Tue, 07 Nov 2023 04:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699359903; x=1699964703; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IukOQrcvFKTQKQHU+Gn7+JZ4VvtRt6lfWofdjUUbwSE=; b=uoGCNbkPbk5ggg2wqkztH6sYNd/Ke1nPYSEC+ls9IyKuOIkdpsnze50BZTVi8UhmB5 AvRtYcvC3O6W+G4pYuW8CLjmtSU4GitY42Rg+dN3ACV/9IlwR2eGP88d3078LsHJ3hF2 U//PYLOGSYhAKVYzWyHP4gQT37QmRIKLBUFngFXH3uowx3fO6Hvs630dOGEbITZXtxW8 HbLDLekwFoJrBSH9gA4PCkvB4dQYgFol2bY8SwrA6B+H916AgHE2x7i1ioodgUkq4uks UMbIqNAYi2lpGu3NxcAKvUhSbA17CU2vnVd6epwOiE8dcngwPmf0Y4WcoXaMsCW9ZKQx PQUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699359903; x=1699964703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IukOQrcvFKTQKQHU+Gn7+JZ4VvtRt6lfWofdjUUbwSE=; b=v24zbLbxF43RhaXjSi86pRZit8RHaddVqy9RFIzSEDrvC3JfQgO+KQzb8MZL4Q22+t 3lJBHXC7AQzbD/VTdfGMfig4oqe7Pe9yldwNUNenzX4okBHvigjA6hvd7/37DSfQkCd2 49J0ldjzzUf9WZkAThjwfTx2fQLmeqYy4JbShS3YfWP9Me2trTdDmeqngrBGCTVmmf6q YtPjw9ufgoJBAE38289WeGXyLJjNtUnfFXcbD6DZc+mkKDZbscdVFOcwBfmyceqQ+bfz zq7+WtrsOYQ8sqzaBrr+mtVlX+rzGno3zhWd1xMXG9TX88ZWxmKawOeuF0EhFPDJq2ND geSg== X-Gm-Message-State: AOJu0YwVG5HmpbC6vowPoITubZOuKZnB5nBVRW90USUI5/Dax/98lG0G wg0QwVCGP19fR5Ip8jQOzjjlN/JHmSrZo3pcawU= X-Received: by 2002:a05:600c:35d1:b0:406:52e4:cd23 with SMTP id r17-20020a05600c35d100b0040652e4cd23mr2108351wmq.0.1699359902878; Tue, 07 Nov 2023 04:25:02 -0800 (PST) Received: from m1x-phil.lan ([176.187.216.69]) by smtp.gmail.com with ESMTPSA id n30-20020a05600c501e00b00405442edc69sm15681877wmr.14.2023.11.07.04.25.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Nov 2023 04:25:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , Richard Henderson , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= Subject: [PULL 38/75] target/ppc: Move PowerPCCPUClass definition to 'cpu.h' Date: Tue, 7 Nov 2023 13:24:28 +0100 Message-ID: <20231107122442.58674-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107122442.58674-1-philmd@linaro.org> References: <20231107122442.58674-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org The OBJECT_DECLARE_CPU_TYPE() macro forward-declares the PowerPCCPUClass type. This forward declaration is sufficient for code in hw/ to use the QOM definitions. No need to expose the structure definition. Keep it local to target/ppc/ by moving it to target/ppc/cpu.h. Suggested-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231013125630.95116-5-philmd@linaro.org> --- include/hw/ppc/ppc.h | 2 +- target/ppc/cpu-qom.h | 56 -------------------------------------------- target/ppc/cpu.h | 51 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 57 deletions(-) diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 17a8dfc107..d5d119ea7f 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -1,7 +1,7 @@ #ifndef HW_PPC_H #define HW_PPC_H -#include "target/ppc/cpu-qom.h" +#include "target/ppc/cpu.h" void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level); PowerPCCPU *ppc_get_vcpu_by_pir(int pir); diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 0b8dfa5fee..65a640470f 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -21,7 +21,6 @@ #define QEMU_PPC_CPU_QOM_H #include "hw/core/cpu.h" -#include "qom/object.h" #ifdef TARGET_PPC64 #define TYPE_POWERPC_CPU "powerpc64-cpu" @@ -36,10 +35,6 @@ OBJECT_DECLARE_CPU_TYPE(PowerPCCPU, PowerPCCPUClass, POWERPC_CPU) #define TYPE_HOST_POWERPC_CPU POWERPC_CPU_TYPE_NAME("host") -typedef struct CPUArchState CPUPPCState; -typedef struct ppc_tb_t ppc_tb_t; -typedef struct ppc_dcr_t ppc_dcr_t; - /*****************************************************************************/ /* MMU model */ typedef enum powerpc_mmu_t powerpc_mmu_t; @@ -133,57 +128,6 @@ enum powerpc_input_t { PPC_FLAGS_INPUT_RCPU, }; -typedef struct PPCHash64Options PPCHash64Options; - -/** - * PowerPCCPUClass: - * @parent_realize: The parent class' realize handler. - * @parent_phases: The parent class' reset phase handlers. - * - * A PowerPC CPU model. - */ -struct PowerPCCPUClass { - /*< private >*/ - CPUClass parent_class; - /*< public >*/ - - DeviceRealize parent_realize; - DeviceUnrealize parent_unrealize; - ResettablePhases parent_phases; - void (*parent_parse_features)(const char *type, char *str, Error **errp); - - uint32_t pvr; - /* - * If @best is false, match if pcc is in the family of pvr - * Else match only if pcc is the best match for pvr in this family. - */ - bool (*pvr_match)(struct PowerPCCPUClass *pcc, uint32_t pvr, bool best); - uint64_t pcr_mask; /* Available bits in PCR register */ - uint64_t pcr_supported; /* Bits for supported PowerISA versions */ - uint32_t svr; - uint64_t insns_flags; - uint64_t insns_flags2; - uint64_t msr_mask; - uint64_t lpcr_mask; /* Available bits in the LPCR */ - uint64_t lpcr_pm; /* Power-saving mode Exit Cause Enable bits */ - powerpc_mmu_t mmu_model; - powerpc_excp_t excp_model; - powerpc_input_t bus_model; - uint32_t flags; - int bfd_mach; - uint32_t l1_dcache_size, l1_icache_size; -#ifndef CONFIG_USER_ONLY - unsigned int gdb_num_sprs; - const char *gdb_spr_xml; -#endif - const PPCHash64Options *hash64_opts; - struct ppc_radix_page_info *radix_page_info; - uint32_t lrg_decr_bits; - int n_host_threads; - void (*init_proc)(CPUPPCState *env); - int (*check_pow)(CPUPPCState *env); -}; - #ifndef CONFIG_USER_ONLY typedef struct PPCTimebase { uint64_t guest_timebase; diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f3ddfd7a26..55330d9319 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -200,9 +200,14 @@ typedef struct opc_handler_t opc_handler_t; /*****************************************************************************/ /* Types used to describe some PowerPC registers etc. */ typedef struct DisasContext DisasContext; +typedef struct ppc_dcr_t ppc_dcr_t; typedef struct ppc_spr_t ppc_spr_t; +typedef struct ppc_tb_t ppc_tb_t; typedef union ppc_tlb_t ppc_tlb_t; typedef struct ppc_hash_pte64 ppc_hash_pte64_t; +typedef struct PPCHash64Options PPCHash64Options; + +typedef struct CPUArchState CPUPPCState; /* SPR access micro-ops generations callbacks */ struct ppc_spr_t { @@ -1341,6 +1346,52 @@ struct ArchCPU { int32_t mig_slb_nr; }; +/** + * PowerPCCPUClass: + * @parent_realize: The parent class' realize handler. + * @parent_phases: The parent class' reset phase handlers. + * + * A PowerPC CPU model. + */ +struct PowerPCCPUClass { + CPUClass parent_class; + + DeviceRealize parent_realize; + DeviceUnrealize parent_unrealize; + ResettablePhases parent_phases; + void (*parent_parse_features)(const char *type, char *str, Error **errp); + + uint32_t pvr; + /* + * If @best is false, match if pcc is in the family of pvr + * Else match only if pcc is the best match for pvr in this family. + */ + bool (*pvr_match)(struct PowerPCCPUClass *pcc, uint32_t pvr, bool best); + uint64_t pcr_mask; /* Available bits in PCR register */ + uint64_t pcr_supported; /* Bits for supported PowerISA versions */ + uint32_t svr; + uint64_t insns_flags; + uint64_t insns_flags2; + uint64_t msr_mask; + uint64_t lpcr_mask; /* Available bits in the LPCR */ + uint64_t lpcr_pm; /* Power-saving mode Exit Cause Enable bits */ + powerpc_mmu_t mmu_model; + powerpc_excp_t excp_model; + powerpc_input_t bus_model; + uint32_t flags; + int bfd_mach; + uint32_t l1_dcache_size, l1_icache_size; +#ifndef CONFIG_USER_ONLY + unsigned int gdb_num_sprs; + const char *gdb_spr_xml; +#endif + const PPCHash64Options *hash64_opts; + struct ppc_radix_page_info *radix_page_info; + uint32_t lrg_decr_bits; + int n_host_threads; + void (*init_proc)(CPUPPCState *env); + int (*check_pow)(CPUPPCState *env); +}; ObjectClass *ppc_cpu_class_by_name(const char *name); PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);