From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305687420958.6154113825206; Fri, 7 Sep 2018 00:34:47 -0700 (PDT) Received: from localhost ([::1]:37115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBHo-0001Wx-S5 for importer@patchew.org; Fri, 07 Sep 2018 03:34:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFT-0007UF-QS for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFQ-00053K-JH for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:11 -0400 Received: from ozlabs.org ([203.11.71.1]:44249) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFP-00050l-OP; Fri, 07 Sep 2018 03:32:08 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jx3CgDz9sBv; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305521; bh=bbe4sNWbSL2O5tU0i74JWi4Z04JrsMOZk4i4Xv7PzxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5TVv3MmOdKXoW4hhveIK5V6V5R8x4zjTudVSRMzLCKiLpB1LOCr+mzPc17TwJZCL mybzNvh3qA0jhwvl7Bokso7ekujdjCB6+oGgd7K6jS6DkqWltpNK/yOslTDD+mCOlS +jI4pn5vSZLpemHAbpXY8iukqDTT/hccxLyOW5fg= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:42 +1000 Message-Id: <20180907073155.26200-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 01/14] ppc: Remove deprecated ppcemb target 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: lvivier@redhat.com, Thomas Huth , mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth There is no known available OS for ppc around anymore that uses page sizes below 4k, so it does not make much sense that we keep wasting our time on building and testing the ppcemb-softmmu target. It has been deprecated since two releases, and nobody complained, so let's remove this now. Signed-off-by: Thomas Huth Signed-off-by: David Gibson --- configure | 13 +++-------- cpus.c | 1 - default-configs/ppcemb-softmmu.mak | 23 -------------------- hw/ppc/ppc405_boards.c | 14 ------------ hw/ppc/ppc440_bamboo.c | 7 ------ hw/ppc/sam460ex.c | 7 ------ hw/ppc/virtex_ml507.c | 7 ------ include/exec/poison.h | 1 - qapi/common.json | 2 +- qemu-deprecated.texi | 6 ----- target/ppc/cpu-qom.h | 2 -- target/ppc/cpu.h | 16 -------------- target/ppc/kvm.c | 4 +--- target/ppc/mmu_helper.c | 6 ++--- target/ppc/translate_init.inc.c | 35 +----------------------------- tests/machine-none-test.c | 1 - 16 files changed, 9 insertions(+), 136 deletions(-) delete mode 100644 default-configs/ppcemb-softmmu.mak diff --git a/configure b/configure index 58862d2ae8..7fd989aee1 100755 --- a/configure +++ b/configure @@ -195,8 +195,7 @@ supported_kvm_target() { i386:i386 | i386:x86_64 | i386:x32 | \ x86_64:i386 | x86_64:x86_64 | x86_64:x32 | \ mips:mips | mipsel:mips | \ - ppc:ppc | ppcemb:ppc | ppc64:ppc | \ - ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \ + ppc:ppc | ppc64:ppc | ppc:ppc64 | ppc64:ppc64 | \ s390x:s390x) return 0 ;; @@ -6951,7 +6950,7 @@ if test "$linux" =3D "yes" ; then i386|x86_64|x32) linux_arch=3Dx86 ;; - ppcemb|ppc|ppc64) + ppc|ppc64) linux_arch=3Dpowerpc ;; s390x) @@ -6981,7 +6980,7 @@ target_name=3D$(echo $target | cut -d '-' -f 1) target_bigendian=3D"no" =20 case "$target_name" in - armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1= k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensae= b) + armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1= k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=3Dyes ;; esac @@ -7109,12 +7108,6 @@ case "$target_name" in gdb_xml_files=3D"power-core.xml power-fpu.xml power-altivec.xml power-= spe.xml" target_compiler=3D$cross_cc_powerpc ;; - ppcemb) - TARGET_BASE_ARCH=3Dppc - TARGET_ABI_DIR=3Dppc - gdb_xml_files=3D"power-core.xml power-fpu.xml power-altivec.xml power-= spe.xml" - target_compiler=3D$cross_cc_ppcemb - ;; ppc64) TARGET_BASE_ARCH=3Dppc TARGET_ABI_DIR=3Dppc diff --git a/cpus.c b/cpus.c index 8ee6e5db93..f66cb67066 100644 --- a/cpus.c +++ b/cpus.c @@ -2251,7 +2251,6 @@ static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysE= muTarget target) return CPU_INFO_ARCH_X86; =20 case SYS_EMU_TARGET_PPC: - case SYS_EMU_TARGET_PPCEMB: case SYS_EMU_TARGET_PPC64: return CPU_INFO_ARCH_PPC; =20 diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-so= ftmmu.mak deleted file mode 100644 index ac44f150c6..0000000000 --- a/default-configs/ppcemb-softmmu.mak +++ /dev/null @@ -1,23 +0,0 @@ -# Default configuration for ppcemb-softmmu - -include pci.mak -include sound.mak -include usb.mak -CONFIG_PPC4XX=3Dy -CONFIG_M48T59=3Dy -CONFIG_SERIAL=3Dy -CONFIG_SERIAL_ISA=3Dy -CONFIG_I8257=3Dy -CONFIG_OPENPIC=3Dy -CONFIG_PFLASH_CFI01=3Dy -CONFIG_PFLASH_CFI02=3Dy -CONFIG_PTIMER=3Dy -CONFIG_I8259=3Dy -CONFIG_XILINX=3Dy -CONFIG_XILINX_ETHLITE=3Dy -CONFIG_USB_EHCI_SYSBUS=3Dy -CONFIG_SM501=3Dy -CONFIG_DDC=3Dy -CONFIG_IDE_SII3112=3Dy -CONFIG_I2C=3Dy -CONFIG_BITBANG_I2C=3Dy diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index f5a9c24b6c..3be3fe4432 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -162,13 +162,6 @@ static void ref405ep_init(MachineState *machine) DriveInfo *dinfo; MemoryRegion *sysmem =3D get_system_memory(); =20 -#ifdef TARGET_PPCEMB - if (!qtest_enabled()) { - warn_report("qemu-system-ppcemb is deprecated, " - "please use qemu-system-ppc instead."); - } -#endif - /* XXX: fix this */ memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.= ram", 0x08000000); @@ -463,13 +456,6 @@ static void taihu_405ep_init(MachineState *machine) int fl_idx, fl_sectors; DriveInfo *dinfo; =20 -#ifdef TARGET_PPCEMB - if (!qtest_enabled()) { - warn_report("qemu-system-ppcemb is deprecated, " - "please use qemu-system-ppc instead."); - } -#endif - /* RAM is soldered to the board so the size cannot be changed */ ram_size =3D 0x08000000; memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram", diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index 3d4c43b8cc..f5720f979e 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -195,13 +195,6 @@ static void bamboo_init(MachineState *machine) exit(1); } =20 -#ifdef TARGET_PPCEMB - if (!qtest_enabled()) { - warn_report("qemu-system-ppcemb is deprecated, " - "please use qemu-system-ppc instead."); - } -#endif - qemu_register_reset(main_cpu_reset, cpu); ppc_booke_timers_init(cpu, 400000000, 0); ppc_dcr_init(env, NULL, NULL); diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 9c77183006..250fb86795 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -419,13 +419,6 @@ static void sam460ex_init(MachineState *machine) exit(1); } =20 -#ifdef TARGET_PPCEMB - if (!qtest_enabled()) { - warn_report("qemu-system-ppcemb is deprecated, " - "please use qemu-system-ppc instead."); - } -#endif - qemu_register_reset(main_cpu_reset, cpu); boot_info =3D g_malloc0(sizeof(*boot_info)); env->load_info =3D boot_info; diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 7891464cd9..ee9b4b4490 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -211,13 +211,6 @@ static void virtex_init(MachineState *machine) int kernel_size; int i; =20 -#ifdef TARGET_PPCEMB - if (!qtest_enabled()) { - warn_report("qemu-system-ppcemb is deprecated, " - "please use qemu-system-ppc instead."); - } -#endif - /* init CPUs */ cpu =3D ppc440_init_xilinx(&ram_size, 1, machine->cpu_type, 400000000); env =3D &cpu->env; diff --git a/include/exec/poison.h b/include/exec/poison.h index 41cd2eb1d8..97d3b56640 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -24,7 +24,6 @@ #pragma GCC poison TARGET_NIOS2 #pragma GCC poison TARGET_OPENRISC #pragma GCC poison TARGET_PPC -#pragma GCC poison TARGET_PPCEMB #pragma GCC poison TARGET_PPC64 #pragma GCC poison TARGET_ABI32 #pragma GCC poison TARGET_S390X diff --git a/qapi/common.json b/qapi/common.json index c367adc4b6..50ac121d25 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -146,6 +146,6 @@ 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', - 'ppc64', 'ppcemb', 'riscv32', 'riscv64', 's390x', 'sh4', + 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] } diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 1b9c007f12..a0db7a5c17 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -162,12 +162,6 @@ replaced by the ``target'' output member. The ``ivshmem'' device type is replaced by either the ``ivshmem-plain'' or ``ivshmem-doorbell`` device types. =20 -@subsection Page size support < 4k for embedded PowerPC CPUs (since 2.12.0) - -qemu-system-ppcemb will be removed. qemu-system-ppc (or qemu-system-ppc64) -should be used instead. That means that embedded 4xx PowerPC CPUs will not -support page sizes < 4096 any longer. - @section System emulator machines =20 @subsection pc-0.10 and pc-0.11 (since 3.0) diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 433a71e484..4ea67692e2 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -24,8 +24,6 @@ =20 #ifdef TARGET_PPC64 #define TYPE_POWERPC_CPU "powerpc64-cpu" -#elif defined(TARGET_PPCEMB) -#define TYPE_POWERPC_CPU "embedded-powerpc-cpu" #else #define TYPE_POWERPC_CPU "powerpc-cpu" #endif diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index ec149349e2..b5b8f6f440 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -52,23 +52,7 @@ #else /* defined (TARGET_PPC64) */ /* PowerPC 32 definitions */ #define TARGET_LONG_BITS 32 - -#if defined(TARGET_PPCEMB) -/* Specific definitions for PowerPC embedded */ -/* BookE have 36 bits physical address space */ -#if defined(CONFIG_USER_ONLY) -/* It looks like a lot of Linux programs assume page size - * is 4kB long. This is evil, but we have to deal with it... - */ -#define TARGET_PAGE_BITS 12 -#else /* defined(CONFIG_USER_ONLY) */ -/* Pages can be 1 kB small */ -#define TARGET_PAGE_BITS 10 -#endif /* defined(CONFIG_USER_ONLY) */ -#else /* defined(TARGET_PPCEMB) */ -/* "standard" PowerPC 32 definitions */ #define TARGET_PAGE_BITS 12 -#endif /* defined(TARGET_PPCEMB) */ =20 #define TARGET_PHYS_ADDR_SPACE_BITS 36 #define TARGET_VIRT_ADDR_SPACE_BITS 32 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 9211ee2ee1..ef63842217 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1315,9 +1315,7 @@ int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, in= t level) return 0; } =20 -#if defined(TARGET_PPCEMB) -#define PPC_INPUT_INT PPC40x_INPUT_INT -#elif defined(TARGET_PPC64) +#if defined(TARGET_PPC64) #define PPC_INPUT_INT PPC970_INPUT_INT #else #define PPC_INPUT_INT PPC6xx_INPUT_INT diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index e6739e6c24..04f8317ea1 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -2363,12 +2363,12 @@ void helper_4xx_tlbwe_hi(CPUPPCState *env, target_u= long entry, tlb->size =3D booke_tlb_to_page_size((val >> PPC4XX_TLBHI_SIZE_SHIFT) & PPC4XX_TLBHI_SIZE_MASK); /* We cannot handle TLB size < TARGET_PAGE_SIZE. - * If this ever occurs, one should use the ppcemb target instead - * of the ppc or ppc64 one + * If this ever occurs, we should implement TARGET_PAGE_BITS_VARY */ if ((val & PPC4XX_TLBHI_V) && tlb->size < TARGET_PAGE_SIZE) { cpu_abort(cs, "TLB size " TARGET_FMT_lu " < %u " - "are not supported (%d)\n", + "are not supported (%d)\n" + "Please implement TARGET_PAGE_BITS_VARY\n", tlb->size, TARGET_PAGE_SIZE, (int)((val >> 7) & 0x7)); } tlb->EPN =3D val & ~(tlb->size - 1); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index d920d3e538..263e63cb03 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9647,17 +9647,6 @@ static int ppc_fixup_cpu(PowerPCCPU *cpu) return 0; } =20 -static inline bool ppc_cpu_is_valid(PowerPCCPUClass *pcc) -{ -#ifdef TARGET_PPCEMB - return pcc->mmu_model =3D=3D POWERPC_MMU_BOOKE || - pcc->mmu_model =3D=3D POWERPC_MMU_SOFT_4xx || - pcc->mmu_model =3D=3D POWERPC_MMU_SOFT_4xx_Z; -#else - return true; -#endif -} - static void ppc_cpu_realize(DeviceState *dev, Error **errp) { CPUState *cs =3D CPU(dev); @@ -9681,8 +9670,6 @@ static void ppc_cpu_realize(DeviceState *dev, Error *= *errp) } } =20 - assert(ppc_cpu_is_valid(pcc)); - create_ppc_opcodes(cpu, &local_err); if (local_err !=3D NULL) { error_propagate(errp, local_err); @@ -9933,10 +9920,6 @@ static gint ppc_cpu_compare_class_pvr(gconstpointer = a, gconstpointer b) return -1; } =20 - if (!ppc_cpu_is_valid(pcc)) { - return -1; - } - return pcc->pvr =3D=3D pvr ? 0 : -1; } =20 @@ -9967,10 +9950,6 @@ static gint ppc_cpu_compare_class_pvr_mask(gconstpoi= nter a, gconstpointer b) return -1; } =20 - if (!ppc_cpu_is_valid(pcc)) { - return -1; - } - if (pcc->pvr_match(pcc, pvr)) { return 0; } @@ -10036,11 +10015,7 @@ static ObjectClass *ppc_cpu_class_by_name(const ch= ar *name) g_free(typename); g_free(cpu_model); =20 - if (oc && ppc_cpu_is_valid(POWERPC_CPU_CLASS(oc))) { - return oc; - } - - return NULL; + return oc; } =20 static void ppc_cpu_parse_featurestr(const char *type, char *features, @@ -10146,9 +10121,6 @@ static void ppc_cpu_list_entry(gpointer data, gpoin= ter user_data) char *name; int i; =20 - if (!ppc_cpu_is_valid(pcc)) { - return; - } if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) =3D=3D 0)) { return; } @@ -10206,11 +10178,6 @@ static void ppc_cpu_defs_entry(gpointer data, gpoi= nter user_data) const char *typename; CpuDefinitionInfoList *entry; CpuDefinitionInfo *info; - PowerPCCPUClass *pcc =3D POWERPC_CPU_CLASS(oc); - - if (!ppc_cpu_is_valid(pcc)) { - return; - } =20 typename =3D object_class_get_name(oc); info =3D g_malloc0(sizeof(*info)); diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c index 7e72466354..2b3b750500 100644 --- a/tests/machine-none-test.c +++ b/tests/machine-none-test.c @@ -44,7 +44,6 @@ static struct arch2cpu cpus_map[] =3D { { "or1k", "or1200" }, { "ppc", "604" }, { "ppc64", "power8e_v2.1" }, - { "ppcemb", "440epb" }, { "s390x", "qemu" }, { "sh4", "sh7750r" }, { "sh4eb", "sh7751r" }, --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 153630568459793.02843550697423; Fri, 7 Sep 2018 00:34:44 -0700 (PDT) Received: from localhost ([::1]:37113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBHk-0001Tt-BY for importer@patchew.org; Fri, 07 Sep 2018 03:34:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFT-0007UG-Qb for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFQ-00053N-Jg for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:11 -0400 Received: from ozlabs.org ([203.11.71.1]:38513) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFP-00050m-OJ; Fri, 07 Sep 2018 03:32:08 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jx1Whtz9s4s; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305521; bh=bNmzMjZSawOFMp4DxVYp2EsjvTHdMciAqoikEszF/ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hwxjX9N32s75Df1vKsf8b93IBkwz1DqwQgx+cZIUvaNl/F28zPP/BGw1N8uYr/WGk zh6LIFIbB9X1ZATntItHsK/B5Hpv6riJFEEz+z/dBIHtgoRYIjWeduFlqzT2jwLlMg 0hkmnPwlpJdda/xXV433/F5zoD9vRP0OS2lyccIA= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:43 +1000 Message-Id: <20180907073155.26200-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 02/14] spapr: fix leak of rev array 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, "Emilio G. Cota" , qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Introduced in 04d595b300 ("spapr: do not use CPU_FOREACH_REVERSE", 2018-08-23) Fixes: CID1395181 Reported-by: Peter Maydell Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 4edb6c7d16..505d4c84e5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -607,6 +607,7 @@ static void spapr_populate_cpus_dt_node(void *fdt, sPAP= RMachineState *spapr) spapr_populate_cpu_dt(cs, fdt, offset, spapr); } =20 + g_free(rev); } =20 static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t = addr) --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306191882940.9601643482285; Fri, 7 Sep 2018 00:43:11 -0700 (PDT) Received: from localhost ([::1]:37175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBQ6-0001gY-RP for importer@patchew.org; Fri, 07 Sep 2018 03:43:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFW-0007cz-Hj for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFQ-00053H-JG for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:14 -0400 Received: from ozlabs.org ([203.11.71.1]:41289) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFP-00050o-ON; Fri, 07 Sep 2018 03:32:08 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jx6Mdvz9sCs; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305521; bh=ciRkWvw2c3j8Sb9u/ckUt094hm2ACiS1t4pt3XgBlzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n6gQHIRGKR3lAStP3jfinwZWxDdy9BtYEGly7gFJfS2ii50UsJdDm3cqJSE2vwqBa i7ISnJvpuooJfjvhDxHjeV7MxIkzkcCtJ33i4RFKCr9xTaIhK0WqXxtdBkhfwmgqIU sdU5mmRbOZHh+1/6sBnSj8+UGtyGgM5mER9A8/94= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:44 +1000 Message-Id: <20180907073155.26200-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 03/14] spapr_pci: fix potential NULL pointer dereference 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz Commit 2c88b098e76fd added a call to SPAPR_MACHINE_GET_CLASS(spapr) in spapr_phb_realize() before we check spapr isn't NULL. This causes QEMU to crash when starting a non-pseries machine with a sPAPR PHB. This could be fixed by setting the smc variable after the null check, but it seems more explicit to use a ternary operator to skip the call to SPAPR_MACHINE_GET_CLASS() if spapr is NULL, since spapr_phb_realize() will return immediately in this case. This was reported by Coverity (CID 1395170 and 1395183). Fixes: 2c88b098e76fde0c7fcc0476dd3f80ce58409505 Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 5cd676e443..6bcb4f419b 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1559,7 +1559,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) sPAPRMachineState *spapr =3D (sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(), TYPE_SPAPR_MACHINE); - sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); + sPAPRMachineClass *smc =3D spapr ? SPAPR_MACHINE_GET_CLASS(spapr) : NU= LL; SysBusDevice *s =3D SYS_BUS_DEVICE(dev); sPAPRPHBState *sphb =3D SPAPR_PCI_HOST_BRIDGE(s); PCIHostState *phb =3D PCI_HOST_BRIDGE(s); --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305858086394.01879354527523; Fri, 7 Sep 2018 00:37:38 -0700 (PDT) Received: from localhost ([::1]:37136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBKi-0003yE-Bf for importer@patchew.org; Fri, 07 Sep 2018 03:37:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFT-0007UE-QQ for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFQ-00053B-JD for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:11 -0400 Received: from ozlabs.org ([203.11.71.1]:56643) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFP-00050p-OR; Fri, 07 Sep 2018 03:32:08 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jx5RCVz9sBn; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305521; bh=KXXE2xuH3uxPyaLdz6Ldi2uEitdqqgTQwDYiao+LchY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXYGKO3hLYsTtYfXkfornOwg4krO74HtxqkazDneArrQJU1Q0yzO7TTt6M4kAI8yN +taQFH0dsasQQB7KY63qZJFXJXlDZ61XrvePdaUjBo8Ng86+ix+zQisF7fpLNabhwe meSr2BhFJepfdNEhFVUps0f2/CkfIV1if8ulaa8g= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:45 +1000 Message-Id: <20180907073155.26200-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 04/14] macio: move MACIOIDEState type declarations to macio.h 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ide/macio.c | 1 + hw/ppc/mac.h | 26 -------------------------- include/hw/misc/macio/macio.h | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index d3a85cba3b..f23961e241 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -26,6 +26,7 @@ #include "hw/hw.h" #include "hw/ppc/mac.h" #include "hw/ppc/mac_dbdma.h" +#include "hw/misc/macio/macio.h" #include "sysemu/block-backend.h" #include "sysemu/dma.h" =20 diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 41fd289e81..a741300ac9 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -86,32 +86,6 @@ typedef struct Core99MachineState { uint8_t via_config; } Core99MachineState; =20 -/* MacIO */ -#define TYPE_MACIO_IDE "macio-ide" -#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) - -typedef struct MACIOIDEState { - /*< private >*/ - SysBusDevice parent_obj; - /*< public >*/ - uint32_t channel; - qemu_irq real_ide_irq; - qemu_irq real_dma_irq; - qemu_irq ide_irq; - qemu_irq dma_irq; - - MemoryRegion mem; - IDEBus bus; - IDEDMA dma; - void *dbdma; - bool dma_active; - uint32_t timing_reg; - uint32_t irq_reg; -} MACIOIDEState; - -void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); -void macio_ide_register_dma(MACIOIDEState *ide); - /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" =20 diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index cfaa145500..0c3964ec12 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -34,6 +34,32 @@ #include "hw/ppc/mac_dbdma.h" #include "hw/ppc/openpic.h" =20 +/* MacIO IDE */ +#define TYPE_MACIO_IDE "macio-ide" +#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) + +typedef struct MACIOIDEState { + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + uint32_t channel; + qemu_irq real_ide_irq; + qemu_irq real_dma_irq; + qemu_irq ide_irq; + qemu_irq dma_irq; + + MemoryRegion mem; + IDEBus bus; + IDEDMA dma; + void *dbdma; + bool dma_active; + uint32_t timing_reg; + uint32_t irq_reg; +} MACIOIDEState; + +void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table); +void macio_ide_register_dma(MACIOIDEState *ide); + #define TYPE_MACIO "macio" #define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO) =20 --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306198545153.76845615166587; Fri, 7 Sep 2018 00:43:18 -0700 (PDT) Received: from localhost ([::1]:37176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBQD-00020X-1X for importer@patchew.org; Fri, 07 Sep 2018 03:43:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFV-0007WP-6E for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-000551-Fh for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:13 -0400 Received: from ozlabs.org ([203.11.71.1]:58415) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053l-PZ; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy0f7Lz9sCD; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=2nigEbh6L6iIGzKXe14CwM4nUCrWcYXV4LWvxqpBAP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XL73KDvPZ4YL8Pauc+E6JNP17WJ6G998Rucpa8vHLyRVuqQL8PWRUArP/eXAk9eXe 92YqXginmbp3FxNxLAANzNGw5OSblIL0k/pOcaYvLAASKBNcAoJwzjJxpFaXA/LchY bP0sEAAj7OJzmPNychFppXgBXJAmatHUr6Bey170= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:46 +1000 Message-Id: <20180907073155.26200-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 05/14] macio: add macio bus to help with fw path generation 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland As the in-built IDE controller is attached to the macio bus then we should = also model this the same in QEMU to aid fw path generation. Note that all existing macio devices are moved onto the new macio bus so th= at the qdev tree accurately reflects the real hardware. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/macio.c | 37 ++++++++++++++++++++++++++--------- include/hw/misc/macio/macio.h | 10 ++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 52aa3775f4..229bfddb90 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -90,6 +90,15 @@ static void macio_bar_setup(MacIOState *s) macio_escc_legacy_setup(s); } =20 +static void macio_init_child_obj(MacIOState *s, const char *childname, + void *child, size_t childsize, + const char *childtype) +{ + object_initialize_child(OBJECT(s), childname, child, childsize, childt= ype, + &error_abort, NULL); + qdev_set_parent_bus(DEVICE(child), BUS(&s->macio_bus)); +} + static void macio_common_realize(PCIDevice *d, Error **errp) { MacIOState *s =3D MACIO(d); @@ -211,7 +220,7 @@ static void macio_init_ide(MacIOState *s, MACIOIDEState= *ide, size_t ide_size, { gchar *name =3D g_strdup_printf("ide[%i]", index); =20 - sysbus_init_child_obj(OBJECT(s), name, ide, ide_size, TYPE_MACIO_IDE); + macio_init_child_obj(s, name, ide, ide_size, TYPE_MACIO_IDE); memory_region_add_subregion(&s->bar, 0x1f000 + ((index + 1) * 0x1000), &ide->mem); g_free(name); @@ -229,7 +238,7 @@ static void macio_oldworld_init(Object *obj) qdev_prop_allow_set_link_before_realize, 0, NULL); =20 - sysbus_init_child_obj(obj, "cuda", &s->cuda, sizeof(s->cuda), TYPE_CUD= A); + macio_init_child_obj(s, "cuda", &s->cuda, sizeof(s->cuda), TYPE_CUDA); =20 object_initialize(&os->nvram, sizeof(os->nvram), TYPE_MACIO_NVRAM); dev =3D DEVICE(&os->nvram); @@ -340,7 +349,7 @@ static void macio_newworld_realize(PCIDevice *d, Error = **errp) object_property_set_link(OBJECT(&s->pmu), OBJECT(sysbus_dev), "gpi= o", &error_abort); qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb); - qdev_set_parent_bus(DEVICE(&s->pmu), sysbus_get_default()); + qdev_set_parent_bus(DEVICE(&s->pmu), BUS(&s->macio_bus)); object_property_add_child(OBJECT(s), "pmu", OBJECT(&s->pmu), NULL); =20 object_property_set_bool(OBJECT(&s->pmu), true, "realized", &err); @@ -356,7 +365,7 @@ static void macio_newworld_realize(PCIDevice *d, Error = **errp) } else { /* CUDA */ object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA); - qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default()); + qdev_set_parent_bus(DEVICE(&s->cuda), BUS(&s->macio_bus)); object_property_add_child(OBJECT(s), "cuda", OBJECT(&s->cuda), NUL= L); qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency", s->frequency); @@ -385,8 +394,8 @@ static void macio_newworld_init(Object *obj) qdev_prop_allow_set_link_before_realize, 0, NULL); =20 - sysbus_init_child_obj(obj, "gpio", &ns->gpio, sizeof(ns->gpio), - TYPE_MACIO_GPIO); + macio_init_child_obj(s, "gpio", &ns->gpio, sizeof(ns->gpio), + TYPE_MACIO_GPIO); =20 for (i =3D 0; i < 2; i++) { macio_init_ide(s, &ns->ide[i], sizeof(ns->ide[i]), i); @@ -399,10 +408,13 @@ static void macio_instance_init(Object *obj) =20 memory_region_init(&s->bar, obj, "macio", 0x80000); =20 - sysbus_init_child_obj(obj, "dbdma", &s->dbdma, sizeof(s->dbdma), - TYPE_MAC_DBDMA); + qbus_create_inplace(&s->macio_bus, sizeof(s->macio_bus), TYPE_MACIO_BU= S, + DEVICE(obj), "macio.0"); =20 - sysbus_init_child_obj(obj, "escc", &s->escc, sizeof(s->escc), TYPE_ESC= C); + macio_init_child_obj(s, "dbdma", &s->dbdma, sizeof(s->dbdma), + TYPE_MAC_DBDMA); + + macio_init_child_obj(s, "escc", &s->escc, sizeof(s->escc), TYPE_ESCC); } =20 static const VMStateDescription vmstate_macio_oldworld =3D { @@ -470,6 +482,12 @@ static void macio_class_init(ObjectClass *klass, void = *data) dc->user_creatable =3D false; } =20 +static const TypeInfo macio_bus_info =3D { + .name =3D TYPE_MACIO_BUS, + .parent =3D TYPE_BUS, + .instance_size =3D sizeof(MacIOBusState), +}; + static const TypeInfo macio_oldworld_type_info =3D { .name =3D TYPE_OLDWORLD_MACIO, .parent =3D TYPE_MACIO, @@ -501,6 +519,7 @@ static const TypeInfo macio_type_info =3D { =20 static void macio_register_types(void) { + type_register_static(&macio_bus_info); type_register_static(&macio_type_info); type_register_static(&macio_oldworld_type_info); type_register_static(&macio_newworld_type_info); diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 0c3964ec12..3189973ee6 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -34,6 +34,15 @@ #include "hw/ppc/mac_dbdma.h" #include "hw/ppc/openpic.h" =20 +/* MacIO virtual bus */ +#define TYPE_MACIO_BUS "macio-bus" +#define MACIO_BUS(obj) OBJECT_CHECK(MacIOBusState, (obj), TYPE_MACIO_BUS) + +typedef struct MacIOBusState { + /*< private >*/ + BusState parent_obj; +} MacIOBusState; + /* MacIO IDE */ #define TYPE_MACIO_IDE "macio-ide" #define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE) @@ -68,6 +77,7 @@ typedef struct MacIOState { PCIDevice parent; /*< public >*/ =20 + MacIOBusState macio_bus; MemoryRegion bar; CUDAState cuda; PMUState pmu; --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306032053939.3121430439783; Fri, 7 Sep 2018 00:40:32 -0700 (PDT) Received: from localhost ([::1]:37149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBNM-0007Pa-W1 for importer@patchew.org; Fri, 07 Sep 2018 03:40:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFU-0007UL-L2 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-00054v-9N for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from ozlabs.org ([203.11.71.1]:45601) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053r-S3; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy2gTyz9shj; Fri, 7 Sep 2018 17:32:01 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=rVJFpwMIt/4YpYeB9U6nTQULVhfxexT47xPBLg3/HmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TS6EHCCnmnzRUxyeOqN32q980HMRrGX2ah7bZsXaJUSGt6veQWIBlKZmTqzAUN+j4 FcwCsnD7Iq1u/H6RGgVfqjRCOGSDRksP69vsOVXjZ9q5uIB8kVmBXjx6lnuJ49StSU CpPqlU2/QLEWajFMqyg+Wzm5jAhUCjrOTESUWdf8= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:47 +1000 Message-Id: <20180907073155.26200-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 06/14] macio: add addr property to macio IDE object 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This contains the offset of the IDE controller within the macio address spa= ce and is required to allow the address to be included within the fw path. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ide/macio.c | 1 + hw/misc/macio/macio.c | 5 +++-- include/hw/misc/macio/macio.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ide/macio.c b/hw/ide/macio.c index f23961e241..bab8c45a43 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -461,6 +461,7 @@ static void macio_ide_initfn(Object *obj) =20 static Property macio_ide_properties[] =3D { DEFINE_PROP_UINT32("channel", MACIOIDEState, channel, 0), + DEFINE_PROP_UINT32("addr", MACIOIDEState, addr, -1), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 229bfddb90..94da85c8d7 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -219,10 +219,11 @@ static void macio_init_ide(MacIOState *s, MACIOIDESta= te *ide, size_t ide_size, int index) { gchar *name =3D g_strdup_printf("ide[%i]", index); + uint32_t addr =3D 0x1f000 + ((index + 1) * 0x1000); =20 macio_init_child_obj(s, name, ide, ide_size, TYPE_MACIO_IDE); - memory_region_add_subregion(&s->bar, 0x1f000 + ((index + 1) * 0x1000), - &ide->mem); + qdev_prop_set_uint32(DEVICE(ide), "addr", addr); + memory_region_add_subregion(&s->bar, addr, &ide->mem); g_free(name); } =20 diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 3189973ee6..970058b6ed 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -51,6 +51,7 @@ typedef struct MACIOIDEState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ + uint32_t addr; uint32_t channel; qemu_irq real_ide_irq; qemu_irq real_dma_irq; --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306055478755.9835855317928; Fri, 7 Sep 2018 00:40:55 -0700 (PDT) Received: from localhost ([::1]:37153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBNp-0007mG-WD for importer@patchew.org; Fri, 07 Sep 2018 03:40:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFo-0000EZ-6H for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFn-0005Gw-CT for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:32 -0400 Received: from ozlabs.org ([203.11.71.1]:55941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFn-00053t-02; Fri, 07 Sep 2018 03:32:31 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy4Wb2z9shh; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=5tm5QQGAdFppdKH4sm3zeSrKzHhhhb9lq5Li7DDZOSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nngOMCqBsifN/jmSX6YZ6G7TXXYR8pLvncFqzASVb/8OFmc84+Bzv1ezO9fJ7E/qT XDdpb5yfqcC0wV+UVAo2hhCf0JpItaulZiI0VMuzB950d/VUffG6O/lhu6uGH2rkxy 6IAGB9/ox11JPYZgnqGpn1Xs/F14vvx7nN5Me4Wo= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:48 +1000 Message-Id: <20180907073155.26200-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 07/14] grackle: set device fw_name and address for correct fw path generation 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/pci-host/grackle.c | 17 +++++++++++++++++ hw/ppc/mac_oldworld.c | 1 + 2 files changed, 18 insertions(+) diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index 4810a4de79..5a151e93e9 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -37,6 +37,7 @@ typedef struct GrackleState { PCIHostState parent_obj; =20 + uint32_t ofw_addr; HeathrowState *pic; qemu_irq irqs[4]; MemoryRegion pci_mmio; @@ -146,12 +147,28 @@ static const TypeInfo grackle_pci_info =3D { }, }; =20 +static char *grackle_ofw_unit_address(const SysBusDevice *dev) +{ + GrackleState *s =3D GRACKLE_PCI_HOST_BRIDGE(dev); + + return g_strdup_printf("%x", s->ofw_addr); +} + +static Property grackle_properties[] =3D { + DEFINE_PROP_UINT32("ofw-addr", GrackleState, ofw_addr, -1), + DEFINE_PROP_END_OF_LIST() +}; + static void grackle_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + SysBusDeviceClass *sbc =3D SYS_BUS_DEVICE_CLASS(klass); =20 dc->realize =3D grackle_realize; + dc->props =3D grackle_properties; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + dc->fw_name =3D "pci"; + sbc->explicit_ofw_unit_address =3D grackle_ofw_unit_address; } =20 static const TypeInfo grackle_host_info =3D { diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 80b5525775..c7b73e274f 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -254,6 +254,7 @@ static void ppc_heathrow_init(MachineState *machine) =20 /* Grackle PCI host bridge */ dev =3D qdev_create(NULL, TYPE_GRACKLE_PCI_HOST_BRIDGE); + qdev_prop_set_uint32(dev, "ofw-addr", 0x80000000); object_property_set_link(OBJECT(dev), OBJECT(pic_dev), "pic", &error_abort); qdev_init_nofail(dev); --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305861323451.8584181259595; Fri, 7 Sep 2018 00:37:41 -0700 (PDT) Received: from localhost ([::1]:37137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBKl-00041S-N7 for importer@patchew.org; Fri, 07 Sep 2018 03:37:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFU-0007VT-VG for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-00055G-M9 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from ozlabs.org ([203.11.71.1]:44253) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053x-Tq; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy3pF9z9sDr; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=kaAntRQzASpItjGPcRosKsTBSNUtwVsR65oaUjIteYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hM2YGLVrHZVlVhXV2VPp7zvVO7wAsqqrlEPnfSQl09BdPeKSVPrAEHO23RB8wnWpf +ngsu+Tkwk0axPIiCFIcWRka84js9rcOqKAjxVsKSNexWpWUY0tlcMlC4DFJjyXY4M eeBIHGuRYQp0AKNhUshX5VK2g583G5+FOQaZ6NvE= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:49 +1000 Message-Id: <20180907073155.26200-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 08/14] mac_oldworld: implement custom FWPathProvider 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This enables the correct generation of bootdevice fw paths for in-built IDE and virtio-pci-blk devices suitable for OpenBIOS. Note we also set the MachineClass ignore_boot_device_suffixes property to t= rue since an additional disk node should not be added except for virtio devices. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ppc/mac_oldworld.c | 58 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index c7b73e274f..9891c325a9 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -42,6 +42,7 @@ #include "hw/misc/macio/macio.h" #include "hw/ide.h" #include "hw/loader.h" +#include "hw/fw-path-provider.h" #include "elf.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" @@ -373,6 +374,54 @@ static void ppc_heathrow_init(MachineState *machine) qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); } =20 +/* + * Implementation of an interface to adjust firmware path + * for the bootindex property handling. + */ +static char *heathrow_fw_dev_path(FWPathProvider *p, BusState *bus, + DeviceState *dev) +{ + PCIDevice *pci; + IDEBus *ide_bus; + IDEState *ide_s; + MACIOIDEState *macio_ide; + + if (!strcmp(object_get_typename(OBJECT(dev)), "macio-oldworld")) { + pci =3D PCI_DEVICE(dev); + return g_strdup_printf("mac-io@%x", PCI_SLOT(pci->devfn)); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "macio-ide")) { + macio_ide =3D MACIO_IDE(dev); + return g_strdup_printf("ata-3@%x", macio_ide->addr); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-drive")) { + ide_bus =3D IDE_BUS(qdev_get_parent_bus(dev)); + ide_s =3D idebus_active_if(ide_bus); + + if (ide_s->drive_kind =3D=3D IDE_CD) { + return g_strdup("cdrom"); + } + + return g_strdup("hd"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-hd")) { + return g_strdup("hd"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-cd")) { + return g_strdup("cdrom"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "virtio-blk-device")) { + return g_strdup("disk"); + } + + return NULL; +} + static int heathrow_kvm_type(const char *arg) { /* Always force PR KVM */ @@ -382,6 +431,7 @@ static int heathrow_kvm_type(const char *arg) static void heathrow_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + FWPathProviderClass *fwc =3D FW_PATH_PROVIDER_CLASS(oc); =20 mc->desc =3D "Heathrow based PowerMAC"; mc->init =3D ppc_heathrow_init; @@ -395,12 +445,18 @@ static void heathrow_class_init(ObjectClass *oc, void= *data) mc->kvm_type =3D heathrow_kvm_type; mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("750_v3.1"); mc->default_display =3D "std"; + mc->ignore_boot_device_suffixes =3D true; + fwc->get_dev_path =3D heathrow_fw_dev_path; } =20 static const TypeInfo ppc_heathrow_machine_info =3D { .name =3D MACHINE_TYPE_NAME("g3beige"), .parent =3D TYPE_MACHINE, - .class_init =3D heathrow_class_init + .class_init =3D heathrow_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, }; =20 static void ppc_heathrow_register_types(void) --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15363060355071001.6242181243667; Fri, 7 Sep 2018 00:40:35 -0700 (PDT) Received: from localhost ([::1]:37150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBNZ-0007Xs-Ug for importer@patchew.org; Fri, 07 Sep 2018 03:40:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFU-0007UI-8B for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-00054g-5r for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from ozlabs.org ([203.11.71.1]:41763) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053m-Og; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy1q6jz9sDb; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=R2fUo14ityREdZk/fimERlRX641ueRhmJ+zVtC/HaRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=inxMnw6efTNwhPed1znL5eTXxQU83BN1u4IaiXtH+ufCPtjRkIasEfgb+x8RpSzet +Vzi8jSINIxDQ5Jlj6qvS8wCMSwQyNZDM7zLSJuQhEjqNwsn39P6gTe189LARi7c6M l/mNsrWv7SoY7LCkdGGQm2/bGLeGr4TbJP6MqSIs= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:50 +1000 Message-Id: <20180907073155.26200-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 09/14] uninorth: add ofw-addr property to allow correct fw path generation 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/pci-host/uninorth.c | 16 ++++++++++++++++ hw/ppc/mac_newworld.c | 1 + include/hw/pci-host/uninorth.h | 1 + 3 files changed, 18 insertions(+) diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index a843aa7b36..1378c5c7fb 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -118,6 +118,13 @@ static void pci_unin_init_irqs(UNINHostState *s) } } =20 +static char *pci_unin_main_ofw_unit_address(const SysBusDevice *dev) +{ + UNINHostState *s =3D UNI_NORTH_PCI_HOST_BRIDGE(dev); + + return g_strdup_printf("%x", s->ofw_addr); +} + static void pci_unin_main_realize(DeviceState *dev, Error **errp) { UNINHostState *s =3D UNI_NORTH_PCI_HOST_BRIDGE(dev); @@ -455,12 +462,21 @@ static const TypeInfo unin_internal_pci_host_info =3D= { }, }; =20 +static Property pci_unin_main_pci_host_props[] =3D { + DEFINE_PROP_UINT32("ofw-addr", UNINHostState, ofw_addr, -1), + DEFINE_PROP_END_OF_LIST() +}; + static void pci_unin_main_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + SysBusDeviceClass *sbc =3D SYS_BUS_DEVICE_CLASS(klass); =20 dc->realize =3D pci_unin_main_realize; + dc->props =3D pci_unin_main_pci_host_props; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + dc->fw_name =3D "pci"; + sbc->explicit_ofw_unit_address =3D pci_unin_main_ofw_unit_address; } =20 static const TypeInfo pci_unin_main_info =3D { diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index a6b95f024c..325013f563 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -344,6 +344,7 @@ static void ppc_core99_init(MachineState *machine) =20 /* Uninorth main bus */ dev =3D qdev_create(NULL, TYPE_UNI_NORTH_PCI_HOST_BRIDGE); + qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000); object_property_set_link(OBJECT(dev), OBJECT(pic_dev), "pic", &error_abort); qdev_init_nofail(dev); diff --git a/include/hw/pci-host/uninorth.h b/include/hw/pci-host/uninorth.h index 2a1cf9f284..060324536a 100644 --- a/include/hw/pci-host/uninorth.h +++ b/include/hw/pci-host/uninorth.h @@ -49,6 +49,7 @@ typedef struct UNINHostState { PCIHostState parent_obj; =20 + uint32_t ofw_addr; OpenPICState *pic; qemu_irq irqs[4]; MemoryRegion pci_mmio; --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305684697119.09003035003207; Fri, 7 Sep 2018 00:34:44 -0700 (PDT) Received: from localhost ([::1]:37114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBHm-0001VA-Fa for importer@patchew.org; Fri, 07 Sep 2018 03:34:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFU-0007V2-S9 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-000559-GS for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from ozlabs.org ([203.11.71.1]:43347) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053q-RF; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jz0yWbz9sjD; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305523; bh=Ve7v6oOdDo2E/9P/dJQNTOEcC4DCGqAAtwn3e1DxR4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYg+hYqfCTIGYzdo73Sf2p24syJ6LFsI36xoLAjOxMFIKB8w2wbprC7vPNPjuZ/K0 v3JZ0lFGYwDzTljOIlZU5d2mLKv6bAj8JV4zon4jtwQepQ/CU5z/QxXwBRwHRLk1Ey Sn3iDhBNRmAzD22miOiCgKhf5IPmIvhPZkgDeIbc= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:51 +1000 Message-Id: <20180907073155.26200-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 10/14] mac_newworld: implement custom FWPathProvider 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This enables the correct generation of bootdevice fw paths for in-built IDE and virtio-pci-blk devices suitable for OpenBIOS. Note we also set the MachineClass ignore_boot_device_suffixes property to t= rue since an additional disk node should not be added except for virtio devices. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/ppc/mac_newworld.c | 58 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 325013f563..a630cb81cd 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -64,6 +64,7 @@ #include "hw/ppc/openpic.h" #include "hw/ide.h" #include "hw/loader.h" +#include "hw/fw-path-provider.h" #include "elf.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" @@ -521,6 +522,54 @@ static void ppc_core99_init(MachineState *machine) qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); } =20 +/* + * Implementation of an interface to adjust firmware path + * for the bootindex property handling. + */ +static char *core99_fw_dev_path(FWPathProvider *p, BusState *bus, + DeviceState *dev) +{ + PCIDevice *pci; + IDEBus *ide_bus; + IDEState *ide_s; + MACIOIDEState *macio_ide; + + if (!strcmp(object_get_typename(OBJECT(dev)), "macio-newworld")) { + pci =3D PCI_DEVICE(dev); + return g_strdup_printf("mac-io@%x", PCI_SLOT(pci->devfn)); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "macio-ide")) { + macio_ide =3D MACIO_IDE(dev); + return g_strdup_printf("ata-3@%x", macio_ide->addr); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-drive")) { + ide_bus =3D IDE_BUS(qdev_get_parent_bus(dev)); + ide_s =3D idebus_active_if(ide_bus); + + if (ide_s->drive_kind =3D=3D IDE_CD) { + return g_strdup("cdrom"); + } + + return g_strdup("hd"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-hd")) { + return g_strdup("hd"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "ide-cd")) { + return g_strdup("cdrom"); + } + + if (!strcmp(object_get_typename(OBJECT(dev)), "virtio-blk-device")) { + return g_strdup("disk"); + } + + return NULL; +} + static int core99_kvm_type(const char *arg) { /* Always force PR KVM */ @@ -530,6 +579,7 @@ static int core99_kvm_type(const char *arg) static void core99_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + FWPathProviderClass *fwc =3D FW_PATH_PROVIDER_CLASS(oc); =20 mc->desc =3D "Mac99 based PowerMAC"; mc->init =3D ppc_core99_init; @@ -543,6 +593,8 @@ static void core99_machine_class_init(ObjectClass *oc, = void *data) #else mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("7400_v2.9"); #endif + mc->ignore_boot_device_suffixes =3D true; + fwc->get_dev_path =3D core99_fw_dev_path; } =20 static char *core99_get_via_config(Object *obj, Error **errp) @@ -599,7 +651,11 @@ static const TypeInfo core99_machine_info =3D { .parent =3D TYPE_MACHINE, .class_init =3D core99_machine_class_init, .instance_init =3D core99_instance_init, - .instance_size =3D sizeof(Core99MachineState) + .instance_size =3D sizeof(Core99MachineState), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, }; =20 static void mac_machine_register_types(void) --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305879386598.2631596582246; Fri, 7 Sep 2018 00:37:59 -0700 (PDT) Received: from localhost ([::1]:37138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBL3-0004Fa-SZ for importer@patchew.org; Fri, 07 Sep 2018 03:37:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFr-0000FY-F5 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFp-0005Je-RC for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:35 -0400 Received: from ozlabs.org ([203.11.71.1]:33531) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFp-00055K-EN; Fri, 07 Sep 2018 03:32:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jz1f07z9shq; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305523; bh=YBaN0IYumL8PwXEoxk00buwcMjl6we/z5oJcVR7aTx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NM5ZXMCH5C4Wv+eZCd86Et0kB4v719Vj5H8iuzTVO6EA8HCvZ7LDFJTpH4eYWkA2R nrnk6VatIaMcd37Kh+WFZdNI5ORX7TykUl+oGlm2x2qztbakOUz13I8vbd9WogyG5A cHGPGHuOOyhXhUWhN3tR39UGIKNCK+F4zHqwX6es= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:52 +1000 Message-Id: <20180907073155.26200-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 11/14] spapr: Correct reference count on spapr-cpu-core 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: lvivier@redhat.com, Sam Bobroff , mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sam Bobroff spapr_init_cpus() currently creates spapr-cpu-core objects via object_new() and setting their realized property to true. This leaves their reference count at two, because object_new() adds an initial reference and the realization attaches them to a default parent object which also increments the reference count. This causes a problem if one of these cores is hot unplugged: no delete event is generated for it because it's reference count doesn't reach zero when it is detached from it's parent. Correct this by adding a call to object_unref() in spapr_init_cpus(). Signed-off-by: Sam Bobroff Signed-off-by: David Gibson --- hw/ppc/spapr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 505d4c84e5..4a9dd4d9bc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2480,6 +2480,8 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID, &error_fatal); object_property_set_bool(core, true, "realized", &error_fatal); + + object_unref(core); } } } --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306072471155.89797734879266; Fri, 7 Sep 2018 00:41:12 -0700 (PDT) Received: from localhost ([::1]:37157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBOB-00087w-CL for importer@patchew.org; Fri, 07 Sep 2018 03:41:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFs-0000FZ-1n for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFr-0005L1-46 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:36 -0400 Received: from ozlabs.org ([203.11.71.1]:37413) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFq-00055M-Em; Fri, 07 Sep 2018 03:32:35 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jz3fQXz9sj3; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305523; bh=68xbPUPojAuRJqwktuX9TUyw3j2CxDbj6f+pSKLmj+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGAuSZlvCB1xeglOUREDwPxTzmC90N3MnHqn5mRclwOtqJtRpGD36zkXSQ8ipq4Er 3FlScaLDZdZBduTaJKCLopyfBkmLZXVUdwShFOuxp8tKm8OOH83HQdW/pbLk6+Fs0L DNdbTd/XYpC7vDvKjCN1W2BczzFL1AjbD3XixX6Y= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:53 +1000 Message-Id: <20180907073155.26200-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 12/14] Fix a deadlock case in the CPU hotplug flow 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: lvivier@redhat.com, Jose Ricardo Ziviani , mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jose Ricardo Ziviani We need to set cs->halted to 1 before calling ppc_set_compat. The reason is that ppc_set_compat kicks up the new thread created to manage the hotplugged KVM virtual CPU and the code drives directly to KVM_RUN ioctl. When cs->halted is 1, the code: int kvm_cpu_exec(CPUState *cpu) ... if (kvm_arch_process_async_events(cpu)) { atomic_set(&cpu->exit_request, 0); return EXCP_HLT; } ... returns before it reaches KVM_RUN, giving time to the main thread to finish its job. Otherwise we can fall in a deadlock because the KVM thread will issue the KVM_RUN ioctl while the main thread is setting up KVM registers. Depending on how these jobs are scheduled we'll end up freezing QEMU. The following output shows kvm_vcpu_ioctl sleeping because it cannot get the mutex and never will. PS: kvm_vcpu_ioctl was triggered kvm_set_one_reg - compat_pvr. STATE: TASK_UNINTERRUPTIBLE|TASK_WAKEKILL PID: 61564 TASK: c000003e981e0780 CPU: 48 COMMAND: "qemu-system-ppc" #0 [c000003e982679a0] __schedule at c000000000b10a44 #1 [c000003e98267a60] schedule at c000000000b113a8 #2 [c000003e98267a90] schedule_preempt_disabled at c000000000b11910 #3 [c000003e98267ab0] __mutex_lock at c000000000b132ec #4 [c000003e98267bc0] kvm_vcpu_ioctl at c00800000ea03140 [kvm] #5 [c000003e98267d20] do_vfs_ioctl at c000000000407d30 #6 [c000003e98267dc0] ksys_ioctl at c000000000408674 #7 [c000003e98267e10] sys_ioctl at c0000000004086f8 #8 [c000003e98267e30] system_call at c00000000000b488 crash> struct -x kvm.vcpus 0xc000003da0000000 vcpus =3D {0xc000003db4880000, 0xc000003d52b80000, 0xc0000039e9c80000, 0xc0= 00003d0e200000, 0xc000003d58280000, 0x0, 0x0, ...} crash> struct -x kvm_vcpu.mutex.owner 0xc000003d58280000 mutex.owner =3D { counter =3D 0xc000003a23a5c881 <- flag 1: waiters }, crash> bt 0xc000003a23a5c880 PID: 61579 TASK: c000003a23a5c880 CPU: 9 COMMAND: "CPU 4/KVM" (active) crash> struct -x kvm_vcpu.mutex.wait_list 0xc000003d58280000 mutex.wait_list =3D { next =3D 0xc000003e98267b10, prev =3D 0xc000003e98267b10 }, crash> struct -x mutex_waiter.task 0xc000003e98267b10 task =3D 0xc000003e981e0780 The following command-line was used to reproduce the problem (note: gdb and trace can change the results). $ qemu-ppc/build/ppc64-softmmu/qemu-system-ppc64 -cpu host \ -enable-kvm -m 4096 \ -smp 4,maxcpus=3D8,sockets=3D1,cores=3D2,threads=3D4 \ -display none -nographic \ -drive file=3Ddisk1.qcow2,format=3Dqcow2 ... (qemu) device_add host-spapr-cpu-core,core-id=3D4 [no interaction is possible after it, only SIGKILL to take the terminal back] Signed-off-by: Jose Ricardo Ziviani Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 876f0b3d9d..a73b244a3f 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -34,16 +34,16 @@ static void spapr_cpu_reset(void *opaque) =20 cpu_reset(cs); =20 - /* Set compatibility mode to match the boot CPU, which was either set - * by the machine reset code or by CAS. This should never fail. - */ - ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &error_abort); - /* All CPUs start halted. CPU0 is unhalted from the machine level * reset code and the rest are explicitly started up by the guest * using an RTAS call */ cs->halted =3D 1; =20 + /* Set compatibility mode to match the boot CPU, which was either set + * by the machine reset code or by CAS. This should never fail. + */ + ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &error_abort); + env->spr[SPR_HIOR] =3D 0; =20 lpcr =3D env->spr[SPR_LPCR]; --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536306391463503.28701588956415; Fri, 7 Sep 2018 00:46:31 -0700 (PDT) Received: from localhost ([::1]:37207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBTA-0004xM-PA for importer@patchew.org; Fri, 07 Sep 2018 03:46:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFo-0000Ey-Q8 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFn-0005HP-O5 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:32 -0400 Received: from ozlabs.org ([203.11.71.1]:53171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFn-00053u-2i; Fri, 07 Sep 2018 03:32:31 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jy5xp9z9sX6; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305522; bh=ggp0kx+HprPOH0eMcpYfQPXBYMwsrCRrxlK+q1brSL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CGqwExL6vMkEHCWNpFdha6iQ4jFialRM0QlJD+oeqc15bpgO1+loilgkZW72FwnEg mCtkyisSxNH5jbz4DI9Sst6Amnk9QFctMo36fzQVlhoN+YkZm5CtPY+2qAFSFBGvzn Yb8ySZ0xTT9yc0ntuyHMsSwWS1I4Xx5yDLblHoic= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:54 +1000 Message-Id: <20180907073155.26200-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 13/14] target/ppc/kvm: set vcpu as online/offline 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, Nikunj A Dadhania , qemu-ppc@nongnu.org, clg@kaod.org, paulus@samba.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Nikunj A Dadhania Set the newly added register(KVM_REG_PPC_ONLINE) to indicate if the vcpu is online(1) or offline(0) KVM will use this information to set the RWMR register, which controls the = PURR and SPURR accumulation. CC: paulus@samba.org Signed-off-by: Nikunj A Dadhania Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 1 + hw/ppc/spapr_rtas.c | 2 ++ target/ppc/kvm.c | 9 +++++++++ target/ppc/kvm_ppc.h | 7 +++++++ 4 files changed, 19 insertions(+) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index a73b244a3f..2398ce62c0 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -90,6 +90,7 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_ul= ong nip, target_ulong r =20 env->nip =3D nip; env->gpr[3] =3D r3; + kvmppc_set_reg_ppc_online(cpu, 1); CPU(cpu)->halted =3D 0; /* Enable Power-saving mode Exit Cause exceptions */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] | pcc->lpcr_pm); diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 4ac96bc94b..d6a0952154 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -33,6 +33,7 @@ #include "sysemu/device_tree.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" +#include "kvm_ppc.h" =20 #include "hw/ppc/spapr.h" #include "hw/ppc/spapr_vio.h" @@ -207,6 +208,7 @@ static void rtas_stop_self(PowerPCCPU *cpu, sPAPRMachin= eState *spapr, * guest */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); cs->halted =3D 1; + kvmppc_set_reg_ppc_online(cpu, 0); qemu_cpu_kick(cs); } =20 diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index ef63842217..30aeafa7de 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2783,3 +2783,12 @@ bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu) =20 return !kvmppc_is_pr(cs->kvm_state); } + +void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online) +{ + CPUState *cs =3D CPU(cpu); + + if (kvm_enabled()) { + kvm_set_one_reg(cs, KVM_REG_PPC_ONLINE, &online); + } +} diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 657582bb32..f696c6e498 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -72,6 +72,7 @@ bool kvmppc_pvr_workaround_required(PowerPCCPU *cpu); =20 bool kvmppc_hpt_needs_host_contiguous_pages(void); void kvm_check_mmu(PowerPCCPU *cpu, Error **errp); +void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, unsigned int online); =20 #else =20 @@ -187,6 +188,12 @@ static inline target_ulong kvmppc_configure_v3_mmu(Pow= erPCCPU *cpu, return 0; } =20 +static inline void kvmppc_set_reg_ppc_online(PowerPCCPU *cpu, + unsigned int online) +{ + return; +} + #ifndef CONFIG_USER_ONLY static inline bool kvmppc_spapr_use_multitce(void) { --=20 2.17.1 From nobody Wed Nov 5 16:56:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536305849765981.9944936046369; Fri, 7 Sep 2018 00:37:29 -0700 (PDT) Received: from localhost ([::1]:37135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBKa-0003rt-IU for importer@patchew.org; Fri, 07 Sep 2018 03:37:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBFU-0007UK-J4 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBFT-00054n-7z for qemu-devel@nongnu.org; Fri, 07 Sep 2018 03:32:12 -0400 Received: from ozlabs.org ([203.11.71.1]:58613) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fyBFS-00053p-QL; Fri, 07 Sep 2018 03:32:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4268Jz0GMBz9sjB; Fri, 7 Sep 2018 17:32:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1536305523; bh=P/OLGRoZhoBumMHDzktWrMKM4+sermO10FwIA2A2U6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQLJegDKYys4MnX8G6AH5v14yVKhrw5DDRXEC7ugZg8okSeFJWJEvX4bEVdRXiRgY f6ouRHvI/m5DdKsQ8/mVn8C1hQkr8qv9wj1c2d//T3PE4jidVDHDvT2ibLc8LjECbY clQzH2Ynry8KN53iSSpokc8fo+chq+9VAtR/LSxE= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 7 Sep 2018 17:31:55 +1000 Message-Id: <20180907073155.26200-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907073155.26200-1-david@gibson.dropbear.id.au> References: <20180907073155.26200-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 14/14] target-ppc: Extend HWCAP2 bits for ISA 3.0 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: lvivier@redhat.com, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson , Sandipan Das Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sandipan Das This adds the HWCAP2 bit to detect if a linux user process is running on an ISA 3.0 compliant cpu like POWER9. This can be verified using a simple test program that prints the value in the auxiliary vector for AT_HWCAP2 as shown below. Before: $ qemu-ppc64le -cpu power8 test 0x8c000000 $ qemu-ppc64le -cpu power9 test 0x8c000000 After: $ qemu-ppc64le -cpu power8 test 0x8c000000 $ qemu-ppc64le -cpu power9 test 0x8c800000 Signed-off-by: Sandipan Das Reviewed-by: Laurent Vivier Signed-off-by: David Gibson --- linux-user/elfload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 8638612aec..e97c4cde49 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -710,6 +710,7 @@ enum { QEMU_PPC_FEATURE2_HAS_EBB =3D 0x10000000, /* Event Base Branching */ QEMU_PPC_FEATURE2_HAS_ISEL =3D 0x08000000, /* Integer Select */ QEMU_PPC_FEATURE2_HAS_TAR =3D 0x04000000, /* Target Address Register */ + QEMU_PPC_FEATURE2_ARCH_3_00 =3D 0x00800000, /* ISA 3.00 */ }; =20 #define ELF_HWCAP get_elf_hwcap() @@ -764,6 +765,7 @@ static uint32_t get_elf_hwcap2(void) GET_FEATURE2(PPC2_BCTAR_ISA207, QEMU_PPC_FEATURE2_HAS_TAR); GET_FEATURE2((PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA207S), QEMU_PPC_FEATURE2_ARCH_2_07); + GET_FEATURE2(PPC2_ISA300, QEMU_PPC_FEATURE2_ARCH_3_00); =20 #undef GET_FEATURE #undef GET_FEATURE2 --=20 2.17.1