From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15505009386801023.2475292016046; Mon, 18 Feb 2019 06:42:18 -0800 (PST) Received: from localhost ([127.0.0.1]:59699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvk7a-0006F5-J2 for importer@patchew.org; Mon, 18 Feb 2019 09:42:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwm-0005TA-IW for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwk-0002aR-R1 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:04 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:36623) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwk-0002WM-8q; Mon, 18 Feb 2019 09:31:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rb1gFzz9sNT; Tue, 19 Feb 2019 01:30:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500255; bh=/SC8r/Y3cokZrphmSKh5rapdNmDs33Xxq9Ry0m8TEK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4xsOhuukXdqITuLGMjviPzVLeueTdA+ytz4cuX6ca+7uAHAjgO7DzcSSjWQmK99o JPo6zn1YdzewpsdqITJfkAFq3Wc/stwaEjD3lkmJLPxy9sTQ62yjH95+7CDeknrGvO 5o0XYvfaKiQ6lAM+VBJ6zdDVq5CFcDhrOHrFOF24= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:07 +1100 Message-Id: <20190218143049.17142-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 01/43] hw/ppc/prep: Drop useless inclusion of "hw/i386/pc.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: groug@kaod.org, qemu-devel@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , clg@kaod.org, qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 In 47973a2dbf we split the last generic chipset out of the PC board, but forgot to remove the include of "hw/i386/pc.h". Since it is now unused, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Herv=C3=A9 Poussineau Signed-off-by: David Gibson --- hw/ppc/prep.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 7bda86a7d0..847d320465 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -26,7 +26,6 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/timer/m48t59.h" -#include "hw/i386/pc.h" #include "hw/char/serial.h" #include "hw/block/fdc.h" #include "net/net.h" --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501540601752.4120918735254; Mon, 18 Feb 2019 06:52:20 -0800 (PST) Received: from localhost ([127.0.0.1]:59885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkHI-0005pS-JH for importer@patchew.org; Mon, 18 Feb 2019 09:52:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjws-0005XD-6J for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwk-0002aM-Q9 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:09 -0500 Received: from ozlabs.org ([203.11.71.1]:55985) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwj-0002WI-I9; Mon, 18 Feb 2019 09:31:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rb4wy8z9sPZ; Tue, 19 Feb 2019 01:30:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500255; bh=1ud6hUinC7iP7PRW94SdoLKklQYsKTFA/aKDx1wLBFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6ha+AjBCeHOVq3zg6xC9FTmMBR3cElCRd30JiY0bkHY/cgTNpbMIEvDSJZjPYiM6 AP4dGOzCZqPV+UcgLamMLWRRju7B7E0yB0haGI4m64v0ihEyep3gn5pYp0rwdrOdpV Ajsloqpg5oQVJ2eUclXf+HxJNpxkfb452NrYLCTw= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:08 +1100 Message-Id: <20190218143049.17142-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 02/43] spapr: Rename xics to intc in interrupt controller agnostic code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz All this code is used with both the XICS and XIVE interrupt controllers. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/ppc/spapr.c | 6 +++--- hw/ppc/spapr_events.c | 2 +- hw/ppc/spapr_pci.c | 6 +++--- hw/ppc/spapr_vio.c | 2 +- include/hw/pci-host/spapr.h | 2 +- include/hw/ppc/spapr.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 332cba89d4..850cfe28c4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -96,7 +96,7 @@ =20 #define MIN_RMA_SLOF 128UL =20 -#define PHANDLE_XICP 0x00001111 +#define PHANDLE_INTC 0x00001111 =20 /* These two functions implement the VCPU id numbering: one to compute them * all and one to identify thread 0 of a VCORE. Any change to the first one @@ -1274,7 +1274,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr) =20 /* /interrupt controller */ spapr->irq->dt_populate(spapr, spapr_max_server_number(spapr), fdt, - PHANDLE_XICP); + PHANDLE_INTC); =20 ret =3D spapr_populate_memory(spapr, fdt); if (ret < 0) { @@ -1294,7 +1294,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr) } =20 QLIST_FOREACH(phb, &spapr->phbs, list) { - ret =3D spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, + ret =3D spapr_populate_pci_dt(phb, PHANDLE_INTC, fdt, spapr->irq->nr_msis); if (ret < 0) { error_report("couldn't setup PCI devices in fdt"); diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 32719a1b72..b9c7ecb9e9 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -282,7 +282,7 @@ void spapr_dt_events(sPAPRMachineState *spapr, void *fd= t) continue; } =20 - spapr_dt_xics_irq(interrupts, source->irq, false); + spapr_dt_irq(interrupts, source->irq, false); =20 _FDT(node_offset =3D fdt_add_subnode(fdt, event_sources, source_na= me)); _FDT(fdt_setprop(fdt, node_offset, "interrupts", interrupts, diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index c99721cde8..41d81f4a85 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2063,7 +2063,7 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *ph= b) =20 } =20 -int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void = *fdt, +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t intc_phandle, void = *fdt, uint32_t nr_msis) { int bus_off, i, j, ret; @@ -2161,8 +2161,8 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_= t xics_phandle, void *fdt, irqmap[1] =3D 0; irqmap[2] =3D 0; irqmap[3] =3D cpu_to_be32(j+1); - irqmap[4] =3D cpu_to_be32(xics_phandle); - spapr_dt_xics_irq(&irqmap[5], phb->lsi_table[lsi_num].irq, tru= e); + irqmap[4] =3D cpu_to_be32(intc_phandle); + spapr_dt_irq(&irqmap[5], phb->lsi_table[lsi_num].irq, true); } } /* Write interrupt map */ diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 414673d313..2b7e7ecac5 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -126,7 +126,7 @@ static int vio_make_devnode(VIOsPAPRDevice *dev, if (dev->irq) { uint32_t ints_prop[2]; =20 - spapr_dt_xics_irq(ints_prop, dev->irq, false); + spapr_dt_irq(ints_prop, dev->irq, false); ret =3D fdt_setprop(fdt, node_off, "interrupts", ints_prop, sizeof(ints_prop)); if (ret < 0) { diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index a5a7bf4837..51d81c4b7c 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -112,7 +112,7 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRP= HBState *phb, int pin) return spapr_qirq(spapr, phb->lsi_table[pin].irq); } =20 -int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void = *fdt, +int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t intc_phandle, void = *fdt, uint32_t nr_msis); =20 void spapr_pci_rtas_init(void); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index a947a0a0dc..cbd276ed2b 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -683,7 +683,7 @@ void spapr_load_rtas(sPAPRMachineState *spapr, void *fd= t, hwaddr addr); * "interrupt-controller" node has its "#interrupt-cells" property set to = 2 (ie, * VIO devices, RTAS event sources and PHBs). */ -static inline void spapr_dt_xics_irq(uint32_t *intspec, int irq, bool is_l= si) +static inline void spapr_dt_irq(uint32_t *intspec, int irq, bool is_lsi) { intspec[0] =3D cpu_to_be32(irq); intspec[1] =3D is_lsi ? cpu_to_be32(1) : 0; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550500996967422.9176381955958; Mon, 18 Feb 2019 06:43:16 -0800 (PST) Received: from localhost ([127.0.0.1]:59703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvk8X-00071i-Sm for importer@patchew.org; Mon, 18 Feb 2019 09:43:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwp-0005Vm-Jw for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwn-0002cx-6R for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:07 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:54047) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwm-0002WL-BT; Mon, 18 Feb 2019 09:31:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rc2PKsz9sPb; Tue, 19 Feb 2019 01:30:55 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500256; bh=Jni7cGLIubDYiC0aU3t4batU4siHcsxuZbY9+ApAlPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HzPRrA6oFCCO2ea276cnmFz20shemc2wGRkGTMq7k0u5klLfVIgylBt8g6tKm2Dbd d7Maxq8y8J+uCv7jGaon3s4JMyik6qQ24t534TcR0jmyjR8K3GgyDcCB8cTZyvAXmd w5KwIF+NOQY4e43ERc3pJ+IgcbIU56VSKvPulRQQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:09 +1100 Message-Id: <20190218143049.17142-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 03/43] target/ppc: Enable reporting of SPRs to GDB 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: Fabiano Rosas , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas This allows reading and writing of SPRs via GDB: (gdb) p/x $srr1 $1 =3D 0x8000000002803033 (gdb) p/x $pvr $2 =3D 0x4b0201 (gdb) set $pvr=3D0x4b0000 (gdb) p/x $pvr $3 =3D 0x4b0000 The `info` command can also be used: (gdb) info registers spr For this purpose, GDB needs to be provided with an XML description of the registers (see the gdb-xml directory for examples) and a set of callbacks for reading and writing the registers must be defined. The XML file in this case is created dynamically, based on the SPRs already defined in the machine. This way we avoid the need for several XML files to suit each possible ppc machine. The gdb_{get,set}_spr_reg callbacks take an index based on the order the registers appear in the XML file. This index does not match the actual location of the registers in the env->spr array so the gdb_find_spr_idx function does that conversion. Note: GDB currently needs to know the guest endianness in order to properly print the registers values. This is done automatically by GDB when provided with the ELF file or explicitly with the `set endian ` command. Signed-off-by: Fabiano Rosas Signed-off-by: David Gibson --- target/ppc/cpu-qom.h | 4 +++ target/ppc/cpu.h | 5 +++ target/ppc/gdbstub.c | 61 ++++++++++++++++++++++++++++++++ target/ppc/translate_init.inc.c | 62 +++++++++++++++++++++++++++++++-- 4 files changed, 130 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h index 4ea67692e2..3130802304 100644 --- a/target/ppc/cpu-qom.h +++ b/target/ppc/cpu-qom.h @@ -179,6 +179,10 @@ typedef struct PowerPCCPUClass { 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; void (*init_proc)(CPUPPCState *env); diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 2c22292e7f..78af7e4608 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -230,6 +230,7 @@ struct ppc_spr_t { void (*oea_write)(DisasContext *ctx, int spr_num, int gpr_num); void (*hea_read)(DisasContext *ctx, int gpr_num, int spr_num); void (*hea_write)(DisasContext *ctx, int spr_num, int gpr_num); + unsigned int gdb_id; #endif const char *name; target_ulong default_value; @@ -1263,6 +1264,10 @@ int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t= *buf, int reg); int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg); +#ifndef CONFIG_USER_ONLY +void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu); +const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name); +#endif int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs, int cpuid, void *opaque); int ppc32_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs, diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 19565b584d..fbf3821f4b 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -319,3 +319,64 @@ int ppc_cpu_gdb_write_register_apple(CPUState *cs, uin= t8_t *mem_buf, int n) } return r; } + +#ifndef CONFIG_USER_ONLY +void ppc_gdb_gen_spr_xml(PowerPCCPU *cpu) +{ + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); + CPUPPCState *env =3D &cpu->env; + GString *xml; + char *spr_name; + unsigned int num_regs =3D 0; + int i; + + if (pcc->gdb_spr_xml) { + return; + } + + xml =3D g_string_new(""); + g_string_append(xml, ""); + g_string_append(xml, ""); + + for (i =3D 0; i < ARRAY_SIZE(env->spr_cb); i++) { + ppc_spr_t *spr =3D &env->spr_cb[i]; + + if (!spr->name) { + continue; + } + + spr_name =3D g_ascii_strdown(spr->name, -1); + g_string_append_printf(xml, ""); + + /* + * GDB identifies registers based on the order they are + * presented in the XML. These ids will not match QEMU's + * representation (which follows the PowerISA). + * + * Store the position of the current register description so + * we can make the correspondence later. + */ + spr->gdb_id =3D num_regs; + num_regs++; + } + + g_string_append(xml, ""); + + pcc->gdb_num_sprs =3D num_regs; + pcc->gdb_spr_xml =3D g_string_free(xml, false); +} + +const char *ppc_gdb_get_dynamic_xml(CPUState *cs, const char *xml_name) +{ + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cs); + + if (strcmp(xml_name, "power-spr.xml") =3D=3D 0) { + return pcc->gdb_spr_xml; + } + return NULL; +} +#endif diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 59e0b86762..9295f78d5f 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8979,6 +8979,10 @@ static void init_ppc_proc(PowerPCCPU *cpu) /* PowerPC implementation specific initialisations (SPRs, timers, ...)= */ (*pcc->init_proc)(env); =20 +#if !defined(CONFIG_USER_ONLY) + ppc_gdb_gen_spr_xml(cpu); +#endif + /* MSR bits & flags consistency checks */ if (env->msr_mask & (1 << 25)) { switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) { @@ -9475,6 +9479,55 @@ static bool avr_need_swap(CPUPPCState *env) #endif } =20 +#if !defined(CONFIG_USER_ONLY) +static int gdb_find_spr_idx(CPUPPCState *env, int n) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(env->spr_cb); i++) { + ppc_spr_t *spr =3D &env->spr_cb[i]; + + if (spr->name && spr->gdb_id =3D=3D n) { + return i; + } + } + return -1; +} + +static int gdb_get_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +{ + int reg; + int len; + + reg =3D gdb_find_spr_idx(env, n); + if (reg < 0) { + return 0; + } + + len =3D TARGET_LONG_SIZE; + stn_p(mem_buf, len, env->spr[reg]); + ppc_maybe_bswap_register(env, mem_buf, len); + return len; +} + +static int gdb_set_spr_reg(CPUPPCState *env, uint8_t *mem_buf, int n) +{ + int reg; + int len; + + reg =3D gdb_find_spr_idx(env, n); + if (reg < 0) { + return 0; + } + + len =3D TARGET_LONG_SIZE; + ppc_maybe_bswap_register(env, mem_buf, len); + env->spr[reg] =3D ldn_p(mem_buf, len); + + return len; +} +#endif + static int gdb_get_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n) { if (n < 32) { @@ -9704,7 +9757,10 @@ static void ppc_cpu_realize(DeviceState *dev, Error = **errp) gdb_register_coprocessor(cs, gdb_get_vsx_reg, gdb_set_vsx_reg, 32, "power-vsx.xml", 0); } - +#ifndef CONFIG_USER_ONLY + gdb_register_coprocessor(cs, gdb_get_spr_reg, gdb_set_spr_reg, + pcc->gdb_num_sprs, "power-spr.xml", 0); +#endif qemu_init_vcpu(cs); =20 pcc->parent_realize(dev, errp); @@ -10467,7 +10523,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) #endif =20 cc->gdb_num_core_regs =3D 71; - +#ifndef CONFIG_USER_ONLY + cc->gdb_get_dynamic_xml =3D ppc_gdb_get_dynamic_xml; +#endif #ifdef USE_APPLE_GDB cc->gdb_read_register =3D ppc_cpu_gdb_read_register_apple; cc->gdb_write_register =3D ppc_cpu_gdb_write_register_apple; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501185130314.9438014999315; Mon, 18 Feb 2019 06:46:25 -0800 (PST) Received: from localhost ([127.0.0.1]:59773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkBZ-0001Lv-4b for importer@patchew.org; Mon, 18 Feb 2019 09:46:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjws-0005XC-5W for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwl-0002ap-2k for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:09 -0500 Received: from ozlabs.org ([203.11.71.1]:54069) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwj-0002WK-JW; Mon, 18 Feb 2019 09:31:02 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rc69Xxz9sPc; Tue, 19 Feb 2019 01:30:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500256; bh=yCpvtMtOy2sg4LROwvXiCB6Az/0gCld5AU7a4tsq5q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6ed77lN6b8XrIOhD3uI4y2odMk9RdYFAk4mPstM2vz5b2FLw02QDV4XyGrVciEJc J1zguxT/Aedf6BoCWustYplafYpHUaJF32WLUArCHtWMndDmsOu0Xe3jGQ3EDqH/uA FIfXjs+nwZn1jlxEX4d6X2WF545Gye2OqvzlN6wo= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:10 +1100 Message-Id: <20190218143049.17142-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 04/43] target/ppc: Fix msync to do what hardware does 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: 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) Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan According to BookE docs, invalid bits (while undefined behaviour) should not raise exception but be ignored. This seems to be implementation dependent though and QEMU currently does what e500 CPUs do and raise exception for invalid bits. Unfortunately some versions of libstdc++ (and so all programs compiled with it) have lwsync on PPC440 which is invalid but on real hardware it's just executed as msync ignoring the invalid bits (maybe that's why it got undetected) but they fail on QEMU. This patch changes invalid mask of msync to allow these programs to run but keep generating exception on e500 cores to follow what hardware does. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- target/ppc/translate.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index e169c43643..5429ceb1ab 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -6476,7 +6476,12 @@ static void gen_mbar(DisasContext *ctx) /* msync replaces sync on 440 */ static void gen_msync_4xx(DisasContext *ctx) { - /* interpreted as no-op */ + /* Only e500 seems to treat reserved bits as invalid */ + if ((ctx->insns_flags2 & PPC2_BOOKE206) && + (ctx->opcode & 0x03FFF801)) { + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); + } + /* otherwise interpreted as no-op */ } =20 /* icbt */ @@ -7054,11 +7059,11 @@ GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000E7C01, P= PC_WRTEE), GEN_HANDLER(dlmzb, 0x1F, 0x0E, 0x02, 0x00000000, PPC_440_SPEC), GEN_HANDLER_E(mbar, 0x1F, 0x16, 0x1a, 0x001FF801, PPC_BOOKE, PPC2_BOOKE206), -GEN_HANDLER(msync_4xx, 0x1F, 0x16, 0x12, 0x03FFF801, PPC_BOOKE), +GEN_HANDLER(msync_4xx, 0x1F, 0x16, 0x12, 0x039FF801, PPC_BOOKE), GEN_HANDLER2_E(icbt_440, "icbt", 0x1F, 0x16, 0x00, 0x03E00001, PPC_BOOKE, PPC2_BOOKE206), GEN_HANDLER2(icbt_440, "icbt", 0x1F, 0x06, 0x08, 0x03E00001, - PPC_440_SPEC), + PPC_440_SPEC), GEN_HANDLER(lvsl, 0x1f, 0x06, 0x00, 0x00000001, PPC_ALTIVEC), GEN_HANDLER(lvsr, 0x1f, 0x06, 0x01, 0x00000001, PPC_ALTIVEC), GEN_HANDLER(mfvscr, 0x04, 0x2, 0x18, 0x001ff800, PPC_ALTIVEC), --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502296948290.1697187178279; Mon, 18 Feb 2019 07:04:56 -0800 (PST) Received: from localhost ([127.0.0.1]:60093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkTS-0007ew-Sz for importer@patchew.org; Mon, 18 Feb 2019 10:04:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjws-0005XA-54 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwo-0002dp-SN for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:09 -0500 Received: from ozlabs.org ([203.11.71.1]:54685) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwo-0002b3-6k; Mon, 18 Feb 2019 09:31:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd3QCBz9sPg; Tue, 19 Feb 2019 01:30:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=9PgqAm8HLA7qmBJ2NAl+3kOHG3J5eeOd898CPW/ctBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3XYFwKAT3sLVdj+U1SI5/Kv6eFSsNgSJ1BHPZgVIzPSJqdH18ZvJ6BEbq1chexYT 7wVV+gG3UBW9lCjQrRRmy4pqXQxlAa8sQOIl6YVNcw4unCo7HZTz7z8MpFETABOp/a 5yH0ry/v9JTgRS4mIZE8RqbfwGFvEML8x3ouTuZk= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:11 +1100 Message-Id: <20190218143049.17142-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 05/43] spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz Now that IRQ allocation has been split in two (first allocate IRQ numbers, then claim them), if the claiming fails, we must release the IRQs. Fixes: 4fe75a8ccd80 "spapr: split the IRQ allocation sequence" Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 41d81f4a85..c3fb0ac884 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -393,6 +393,12 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPR= MachineState *spapr, for (i =3D 0; i < req_num; i++) { spapr_irq_claim(spapr, irq + i, false, &err); if (err) { + if (i) { + spapr_irq_free(spapr, irq, i); + } + if (!smc->legacy_irq_allocation) { + spapr_irq_msi_free(spapr, irq, req_num); + } error_reportf_err(err, "Can't allocate MSIs for device %x: ", config_addr); rtas_st(rets, 0, RTAS_OUT_HW_ERROR); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501112798434.6171613345774; Mon, 18 Feb 2019 06:45:12 -0800 (PST) Received: from localhost ([127.0.0.1]:59733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkAJ-0000Eh-Lc for importer@patchew.org; Mon, 18 Feb 2019 09:45:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwu-0005aW-Ir for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwo-0002dV-7M for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:12 -0500 Received: from ozlabs.org ([203.11.71.1]:34435) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwn-0002b2-Hb; Mon, 18 Feb 2019 09:31:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd1dRHz9sPd; Tue, 19 Feb 2019 01:30:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=4h/n18hAk/nruVa0nkiZdPe+3iWpmQFNanoANbvGypg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqyDbAjZ3t/t3JpFhvN1j9A/jqQ82v6raQBO1I4yWttixSpWDN1jgn80u/pabh6ud StSX6bG1sP3DUclyoACIjt04gnOdOGKPuwOdgDttzPc89xkxtnEYnA+c09WY7KkeGl E8KaTzxlJApJWNtS68/Q+62QjLW0sdBO6g68Wub4= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:12 +1100 Message-Id: <20190218143049.17142-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 06/43] cuda: decrease time delay before raising VIA SR interrupt and remove fast path 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: Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland In order to handle a race condition in the MacOS 9 CUDA driver, a delay was introduced when raising the VIA SR interrupt inspired by similar code in MacOnLinux. During original testing of the MacOS 9 patches it was found that the 30us delay used in MacOnLinux did not work reliably within QEMU, and a value of 300us was required to function correctly. Recent experiments have shown two things: firstly when booting Linux, MacOS 9 and MacOS X the fast path which bypasses the delay is never triggered once the OS kernel is loaded making it effectively useless. Rather than leave this code in place where a guest could potentially enable it by accident and break itself, we might as well just remove it. Secondly the previous reliability issues are no longer present, and this value can be reduced down to 20us with no apparent ill effects. This has the benefit of considerably improving the responsiveness of the ADB keyboard and mouse within the guest. Signed-off-by: Mark Cave-Ayland Signed-off-by: David Gibson --- hw/misc/macio/cuda.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index c4f7a2f39b..3febacdd1e 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -97,17 +97,8 @@ static void cuda_set_sr_int(void *opaque) =20 static void cuda_delay_set_sr_int(CUDAState *s) { - MOS6522CUDAState *mcs =3D &s->mos6522_cuda; - MOS6522State *ms =3D MOS6522(mcs); - MOS6522DeviceClass *mdc =3D MOS6522_DEVICE_GET_CLASS(ms); int64_t expire; =20 - if (ms->dirb =3D=3D 0xff || s->sr_delay_ns =3D=3D 0) { - /* Disabled or not in Mac OS, fire the IRQ directly */ - mdc->set_sr_int(ms); - return; - } - trace_cuda_delay_set_sr_int(); =20 expire =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->sr_delay_ns; @@ -542,7 +533,7 @@ static void cuda_realize(DeviceState *dev, Error **errp) s->tick_offset =3D (uint32_t)mktimegm(&tm) + RTC_OFFSET; =20 s->sr_delay_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_set_sr_int= , s); - s->sr_delay_ns =3D 300 * SCALE_US; + s->sr_delay_ns =3D 20 * SCALE_US; =20 s->adb_poll_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, = s); s->adb_poll_mask =3D 0xffff; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501378088968.149480989335; Mon, 18 Feb 2019 06:49:38 -0800 (PST) Received: from localhost ([127.0.0.1]:59815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkEd-0003cO-Vh for importer@patchew.org; Mon, 18 Feb 2019 09:49:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwv-0005cm-Md for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwu-0002h7-5U for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:13 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52251) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjws-0002b9-04; Mon, 18 Feb 2019 09:31:11 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd6vrRz9sP6; Tue, 19 Feb 2019 01:30:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=Q7oLJ5chH6CvwChmQ/QusYiYOHv+JWPZJBoGvtnalJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXyOeCz8hZZuLv4D0IeCXrfiNGuM+cYRi5Z9AxWey5+sfxHlxGh5xrXRbqVdefE1V kjnbCMdyAz3EJ/63cVIm5fLCjezYsDPjgJFlN9QJLsdttLx3kwPGuD6oB55q+JsIN1 3MdOHLsPI/RginOISobbaeC2/oRONVdTVII6lnl4= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:13 +1100 Message-Id: <20190218143049.17142-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 07/43] spapr: Disallow unsupported kernel-irqchip settings 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz Split mode doesn't make sense on pseries, neither with XICS nor XIVE. But passing kernel-irqchip=3Dsplit silently behaves like kernel-irqchip=3Don. Other architectures that support kernel-irqchip do terminate QEMU when split mode is requested but not available though. Do the same with pseries for consistency. Similarly, passing kernel-irqchip=3Don,accel=3Dtcg starts the machine with = the emulated interrupt controller, ie, behaves like kernel-irqchip=3Doff. Howev= er, when passing kernel-irqchip=3Don,accel=3Dkvm, if we can't initialize the K= VM XICS for some reason, ie, xics_kvm_init() fails, then QEMU is terminated. This is inconsistent. Terminate QEMU all the same when requesting the in-kernel interrupt controller without KVM. Signed-off-by: Greg Kurz Message-Id: <154964986747.291716.2679312373018476920.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 2d7a7c1638..80b0083b8e 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -600,6 +600,19 @@ sPAPRIrq spapr_irq_dual =3D { */ void spapr_irq_init(sPAPRMachineState *spapr, Error **errp) { + MachineState *machine =3D MACHINE(spapr); + + if (machine_kernel_irqchip_split(machine)) { + error_setg(errp, "kernel_irqchip split mode not supported on pseri= es"); + return; + } + + if (!kvm_enabled() && machine_kernel_irqchip_required(machine)) { + error_setg(errp, + "kernel_irqchip requested but only available with KVM"); + return; + } + /* Initialize the MSI IRQ allocator. */ if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) { spapr_irq_msi_init(spapr, spapr->irq->nr_msis); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501288728634.0220820989463; Mon, 18 Feb 2019 06:48:08 -0800 (PST) Received: from localhost ([127.0.0.1]:59801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkDB-0002co-Dg for importer@patchew.org; Mon, 18 Feb 2019 09:48:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwv-0005cX-C2 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwu-0002gw-41 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:13 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:40977) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjws-0002b8-4c; Mon, 18 Feb 2019 09:31:11 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rd4wp5z9sPf; Tue, 19 Feb 2019 01:30:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500257; bh=C0tr1n+kEbUh08D+Q1bF1iXJ3yXaycvHgFVSf6jqMbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z1iXteXTyidMUBn60Oi1dBQHI1EEYZ4wfeLH9xrVm2/qb64k2VWh2Bam6H/dbKlwv Ok36L6ixYJkBGNzQw7lBntcQiqks5YOJx+i/7iaysk9LuRI0JR9vkoI5X1kjisZ2Sx Fkk0tzsmgGcPFoyoPEd0iLWHTSXBFd8wsRBL9Wjs= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:14 +1100 Message-Id: <20190218143049.17142-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 08/43] mac_newworld: change default NIC to sungem for mac99 machine 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: Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This model brings out-of-the-box networking for all of Linux, MacOS 9 and O= S X without requiring the installation of additional drivers. Signed-off-by: Mark Cave-Ayland Message-Id: <20190208172201.29001-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- hw/ppc/mac_newworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 10be728c37..98461052ac 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -432,7 +432,7 @@ static void ppc_core99_init(MachineState *machine) } =20 for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); + pci_nic_init_nofail(&nd_table[i], pci_bus, "sungem", NULL); } =20 /* The NewWorld NVRAM is not located in the MacIO device */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501897133444.64239044264343; Mon, 18 Feb 2019 06:58:17 -0800 (PST) Received: from localhost ([127.0.0.1]:59973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkN3-0002aF-5M for importer@patchew.org; Mon, 18 Feb 2019 09:58:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwz-0005h7-E6 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwv-0002i5-Fr for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:15 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48771) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwu-0002bO-1S; Mon, 18 Feb 2019 09:31:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rf5RP2z9sPh; Tue, 19 Feb 2019 01:30:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500258; bh=+VuCWlQx9dzy5TKAswfzKDl04tz4gSB7fDtvxAz/31A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FfIX3mkqujck2N/U1hZa3V91zsJYRtEQ4fBcBLQhysSd64X4axv2whynpQ9cNcyNG OnzXXHaQeRwKe/i47gFwUc+uvavrbskmQcdkFT8hqnFP0TiJMK/c8o8y/uFQ/yyuE9 GqEwGEbRA3Bbwgad1QSjA7f9OtnkjvinEjp26nG0= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:15 +1100 Message-Id: <20190218143049.17142-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 09/43] target/ppc: Remove some #if 0'ed code 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: groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt Some debug stuff we don't need to keep there Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190128094625.4428-7-clg@kaod.org> Signed-off-by: David Gibson --- target/ppc/excp_helper.c | 12 ------------ target/ppc/mmu_helper.c | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 0ec7ae1ad4..751d759fcc 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -748,13 +748,7 @@ void ppc_cpu_do_interrupt(CPUState *cs) static void ppc_hw_interrupt(CPUPPCState *env) { PowerPCCPU *cpu =3D ppc_env_get_cpu(env); -#if 0 - CPUState *cs =3D CPU(cpu); =20 - qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n= ", - __func__, env, env->pending_interrupts, - cs->interrupt_request, (int)msr_me, (int)msr_ee); -#endif /* External reset */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { env->pending_interrupts &=3D ~(1 << PPC_INTERRUPT_RESET); @@ -797,12 +791,6 @@ static void ppc_hw_interrupt(CPUPPCState *env) if (msr_ce !=3D 0) { /* External critical interrupt */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_CEXT)) { - /* Taking a critical external interrupt does not clear the ext= ernal - * critical interrupt status - */ -#if 0 - env->pending_interrupts &=3D ~(1 << PPC_INTERRUPT_CEXT); -#endif powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_CRITICAL); return; } diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index cefed34da4..bcf19da61d 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -1415,10 +1415,6 @@ static int get_physical_address_wtlb( bool real_mode =3D (access_type =3D=3D ACCESS_CODE && msr_ir =3D=3D 0) || (access_type !=3D ACCESS_CODE && msr_dr =3D=3D 0); =20 -#if 0 - qemu_log("%s\n", __func__); -#endif - switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: @@ -1468,10 +1464,6 @@ static int get_physical_address_wtlb( cpu_abort(CPU(cpu), "Unknown or invalid MMU model\n"); return -1; } -#if 0 - qemu_log("%s address " TARGET_FMT_lx " =3D> %d " TARGET_FMT_plx "\n", - __func__, eaddr, ret, ctx->raddr); -#endif =20 return ret; } @@ -1805,10 +1797,6 @@ static int cpu_ppc_handle_mmu_fault(CPUPPCState *env= , target_ulong address, break; } } -#if 0 - printf("%s: set exception to %d %02x\n", __func__, - cs->exception, env->error_code); -#endif ret =3D 1; } =20 --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502511759473.53385927145894; Mon, 18 Feb 2019 07:08:31 -0800 (PST) Received: from localhost ([127.0.0.1]:60158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkWu-00028S-JQ for importer@patchew.org; Mon, 18 Feb 2019 10:08:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjwz-0005h5-Dx for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjwq-0002ec-8V for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:15 -0500 Received: from ozlabs.org ([203.11.71.1]:49475) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwp-0002bX-EY; Mon, 18 Feb 2019 09:31:08 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rg2sT9z9sQm; Tue, 19 Feb 2019 01:30:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500259; bh=E+JxlrJ/pDFyS5PHraRA/utYy+hjrBoU1vKR/rjy2sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQQnQhB5UVAMVePcFnZ9aUzxz0j0frIQg8bnQeiY5/9Zmlgb/sgrCsJw542RMGv3I yRutQIRvjKcKttDV4IfFWLyR18Ju3lI/IWfKrbssd4jdVx074TLI0ARyYU8PRANkrg sgsXbN9m+GhZtnD5GTp++B2NQecCQMogv+hoks3A= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:16 +1100 Message-Id: <20190218143049.17142-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 10/43] ppc: fix crash during branch stepping 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: Roman Kapl , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Roman Kapl The PPC BRANCH exception could bubble up, but this is an QEMU internal exce= ption and QEMU then crased. Instead it should trigger TRACE exception, according = to PPC 2.07 book. It could happen only when using branch stepping, which is not commonly used. Change gen_prep_dbgex do do trigger TRACE. The excp, argument is now remove= d, since the type of exception can be inferred from the singlestep_enabled fla= gs. removed the guards around gen_exception, since they are unnecessary. Fixes: 0e3bf48909 ("ppc: add DBCR based debugging"). Signed-off-by: Roman Kapl Message-Id: <20190212121255.2279-1-rka@sysgo.com> Signed-off-by: David Gibson --- target/ppc/translate.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 5429ceb1ab..d5f29d3536 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -287,26 +287,22 @@ static void gen_exception_nip(DisasContext *ctx, uint= 32_t excp, ctx->exception =3D (excp); } =20 -/* Translates the EXCP_TRACE/BRANCH exceptions used on most PowerPCs to - * EXCP_DEBUG, if we are running on cores using the debug enable bit (e.g. - * BookE). +/* + * Tells the caller what is the appropriate exception to generate and prep= ares + * SPR registers for this exception. + * + * The exception can be either POWERPC_EXCP_TRACE (on most PowerPCs) or + * POWERPC_EXCP_DEBUG (on BookE). */ -static uint32_t gen_prep_dbgex(DisasContext *ctx, uint32_t excp) +static uint32_t gen_prep_dbgex(DisasContext *ctx) { - if ((ctx->singlestep_enabled & CPU_SINGLE_STEP) - && (excp =3D=3D POWERPC_EXCP_BRANCH)) { - /* Trace excpt. has priority */ - excp =3D POWERPC_EXCP_TRACE; - } if (ctx->flags & POWERPC_FLAG_DE) { target_ulong dbsr =3D 0; - switch (excp) { - case POWERPC_EXCP_TRACE: + if (ctx->singlestep_enabled & CPU_SINGLE_STEP) { dbsr =3D DBCR0_ICMP; - break; - case POWERPC_EXCP_BRANCH: + } else { + /* Must have been branch */ dbsr =3D DBCR0_BRT; - break; } TCGv t0 =3D tcg_temp_new(); gen_load_spr(t0, SPR_BOOKE_DBSR); @@ -315,7 +311,7 @@ static uint32_t gen_prep_dbgex(DisasContext *ctx, uint3= 2_t excp) tcg_temp_free(t0); return POWERPC_EXCP_DEBUG; } else { - return excp; + return POWERPC_EXCP_TRACE; } } =20 @@ -3652,10 +3648,8 @@ static void gen_lookup_and_goto_ptr(DisasContext *ct= x) if (sse & GDBSTUB_SINGLE_STEP) { gen_debug_exception(ctx); } else if (sse & (CPU_SINGLE_STEP | CPU_BRANCH_STEP)) { - uint32_t excp =3D gen_prep_dbgex(ctx, POWERPC_EXCP_BRANCH); - if (excp !=3D POWERPC_EXCP_NONE) { - gen_exception(ctx, excp); - } + uint32_t excp =3D gen_prep_dbgex(ctx); + gen_exception(ctx, excp); } tcg_gen_exit_tb(NULL, 0); } else { @@ -7790,9 +7784,8 @@ static void ppc_tr_translate_insn(DisasContextBase *d= cbase, CPUState *cs) ctx->exception !=3D POWERPC_SYSCALL && ctx->exception !=3D POWERPC_EXCP_TRAP && ctx->exception !=3D POWERPC_EXCP_BRANCH)) { - uint32_t excp =3D gen_prep_dbgex(ctx, POWERPC_EXCP_TRACE); - if (excp !=3D POWERPC_EXCP_NONE) - gen_exception_nip(ctx, excp, ctx->base.pc_next); + uint32_t excp =3D gen_prep_dbgex(ctx); + gen_exception_nip(ctx, excp, ctx->base.pc_next); } =20 if (tcg_check_temp_count()) { --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502682967174.98603870025886; Mon, 18 Feb 2019 07:11:22 -0800 (PST) Received: from localhost ([127.0.0.1]:60220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkZj-0004fc-Ri for importer@patchew.org; Mon, 18 Feb 2019 10:11:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjx1-0005hE-D7 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjws-0002fc-8j for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:17 -0500 Received: from ozlabs.org ([203.11.71.1]:38403) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjwq-0002bT-2E; Mon, 18 Feb 2019 09:31:09 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rg0XD9z9sPl; Tue, 19 Feb 2019 01:30:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500259; bh=1Xqt9DETDgVcXdwGihEWE1Wj68O8RHJ0OJs8t12nO3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQ3eyCKPfN19kFJbi5eEVUMAM8C7xZMf0BupEg+ReAsUszYJw1UVATQT7XPp6y2yV ntzDB0s55fCmsJArp4vEmNVZ9rgumK7Y2HhsTD8u9jtLKPKXXLcwPtnKDHy9glLXn/ yfoJkjNOMUDXJoRIZ2eW9WdcAzni90+F6FqXSOYY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:17 +1100 Message-Id: <20190218143049.17142-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 11/43] xive: Only set source type for LSIs 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz MSI is the default and LSI specific code is guarded by the xive_source_irq_is_lsi() helper. The xive_source_irq_set() helper is a nop for MSIs. Simplify the code by turning xive_source_irq_set() into xive_source_irq_set_lsi() and only call it for LSIs. The call to xive_source_irq_set(false) in spapr_xive_irq_free() is also a nop. Just drop it. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater Message-Id: <154999584656.690774.18352404495120358613.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/intc/spapr_xive.c | 7 +++---- include/hw/ppc/xive.h | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index a0f5ff9294..290a290e43 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -489,20 +489,19 @@ bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t l= isn, bool lsi) } =20 xive->eat[lisn].w |=3D cpu_to_be64(EAS_VALID); - xive_source_irq_set(xsrc, lisn, lsi); + if (lsi) { + xive_source_irq_set_lsi(xsrc, lisn); + } return true; } =20 bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn) { - XiveSource *xsrc =3D &xive->source; - if (lisn >=3D xive->nr_irqs) { return false; } =20 xive->eat[lisn].w &=3D cpu_to_be64(~EAS_VALID); - xive_source_irq_set(xsrc, lisn, false); return true; } =20 diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index ec3bb2aae4..13a487527b 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -283,13 +283,10 @@ static inline bool xive_source_irq_is_lsi(XiveSource = *xsrc, uint32_t srcno) return test_bit(srcno, xsrc->lsi_map); } =20 -static inline void xive_source_irq_set(XiveSource *xsrc, uint32_t srcno, - bool lsi) +static inline void xive_source_irq_set_lsi(XiveSource *xsrc, uint32_t srcn= o) { assert(srcno < xsrc->nr_irqs); - if (lsi) { - bitmap_set(xsrc->lsi_map, srcno, 1); - } + bitmap_set(xsrc->lsi_map, srcno, 1); } =20 void xive_source_set_irq(void *opaque, int srcno, int val); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501731133385.4246705559226; Mon, 18 Feb 2019 06:55:31 -0800 (PST) Received: from localhost ([127.0.0.1]:59915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkKM-0000Eb-Uw for importer@patchew.org; Mon, 18 Feb 2019 09:55:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxh-0006Js-Qk for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxd-00030X-Um for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:00 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:59443) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxa-0002dE-3K; Mon, 18 Feb 2019 09:31:56 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rg4vvqz9sPx; Tue, 19 Feb 2019 01:30:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500259; bh=ENAUkm/ULWDqeIko96h79dL/vMC21fvu4qvRxEijv5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RyxJ8NYpHr5u21LWwc7hOP4LSRv85jfJcfFwyVmvgw9c+YxqxI4s6nZpbZ/mK/T1S SOW5DWHz9EoQ/3O0BQrDa27gwLRexS40B5ul/h2SLGyjL0VdnOX+ptC7GB0BeVbU75 HpFW9aieiv3gkuXu7Yf7wPhnNvkrrkeVqb2Q/wTs= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:18 +1100 Message-Id: <20190218143049.17142-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 12/43] qdev: pass an Object * to qbus_set_hotplug_handler() 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: Eduardo Habkost , "Michael S . Tsirkin" , qemu-devel@nongnu.org, Cornelia Huck , Michael Roth , groug@kaod.org, Halil Pasic , 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) Content-Type: text/plain; charset="utf-8" From: Michael Roth Certain devices types, like memory/CPU, are now being handled using a hotplug interface provided by a top-level MachineClass. Hotpluggable host bridges are another such device where it makes sense to use a machine-level hotplug handler. However, unlike those devices, host-bridges have a parent bus (the main system bus), and devices with a parent bus use a different mechanism for registering their hotplug handlers: qbus_set_hotplug_handler(). This interface currently expects a handler to be a subclass of DeviceClass, but this is not the case for MachineClass, which derives directly from ObjectClass. Internally, the interface only requires an ObjectClass, so expose that in qbus_set_hotplug_handler(). Cc: Michael S. Tsirkin Cc: Eduardo Habkost Signed-off-by: Michael Roth Signed-off-by: Greg Kurz Reviewed-by: David Gibson Reviewed-by: Cornelia Huck Acked-by: Halil Pasic Reviewed-by: Michael S. Tsirkin Message-Id: <154999589921.690774.3640149277362188566.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/acpi/pcihp.c | 2 +- hw/acpi/piix4.c | 2 +- hw/char/virtio-serial-bus.c | 2 +- hw/core/bus.c | 11 ++--------- hw/pci/pcie.c | 2 +- hw/pci/shpc.c | 2 +- hw/ppc/spapr_pci.c | 2 +- hw/s390x/css-bridge.c | 2 +- hw/s390x/s390-pci-bus.c | 6 +++--- hw/scsi/virtio-scsi.c | 2 +- hw/scsi/vmw_pvscsi.c | 2 +- hw/usb/dev-smartcard-reader.c | 2 +- include/hw/qdev-core.h | 3 +-- 13 files changed, 16 insertions(+), 24 deletions(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 7bc7a72340..9429181323 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -251,7 +251,7 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_= dev, AcpiPciHpState *s, object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { PCIBus *sec =3D pci_bridge_get_sec_bus(PCI_BRIDGE(pdev)); =20 - qbus_set_hotplug_handler(BUS(sec), DEVICE(hotplug_dev), + qbus_set_hotplug_handler(BUS(sec), OBJECT(hotplug_dev), &error_abort); /* We don't have to overwrite any other hotplug handler yet */ assert(QLIST_EMPTY(&sec->child)); diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 88f9a9ec09..df8c0db909 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -536,7 +536,7 @@ static void piix4_pm_realize(PCIDevice *dev, Error **er= rp) =20 piix4_acpi_system_hot_add_init(pci_address_space_io(dev), pci_get_bus(dev), s); - qbus_set_hotplug_handler(BUS(pci_get_bus(dev)), DEVICE(s), &error_abor= t); + qbus_set_hotplug_handler(BUS(pci_get_bus(dev)), OBJECT(s), &error_abor= t); =20 piix4_pm_add_propeties(s); } diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index d76351d748..bdd917bbb8 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -1052,7 +1052,7 @@ static void virtio_serial_device_realize(DeviceState = *dev, Error **errp) /* Spawn a new virtio-serial bus on which the ports will ride as devic= es */ qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_= BUS, dev, vdev->bus_name); - qbus_set_hotplug_handler(BUS(&vser->bus), DEVICE(vser), errp); + qbus_set_hotplug_handler(BUS(&vser->bus), OBJECT(vser), errp); vser->bus.vser =3D vser; QTAILQ_INIT(&vser->ports); =20 diff --git a/hw/core/bus.c b/hw/core/bus.c index 4651f24486..e09843f6ab 100644 --- a/hw/core/bus.c +++ b/hw/core/bus.c @@ -22,22 +22,15 @@ #include "hw/qdev.h" #include "qapi/error.h" =20 -static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handl= er, - Error **errp) +void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp) { - object_property_set_link(OBJECT(bus), OBJECT(handler), QDEV_HOTPLUG_HANDLER_PROPERTY, errp); } =20 -void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error *= *errp) -{ - qbus_set_hotplug_handler_internal(bus, OBJECT(handler), errp); -} - void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp) { - qbus_set_hotplug_handler_internal(bus, OBJECT(bus), errp); + qbus_set_hotplug_handler(bus, OBJECT(bus), errp); } =20 int qbus_walk_children(BusState *bus, diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 230478faab..3f7c366093 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -543,7 +543,7 @@ void pcie_cap_slot_init(PCIDevice *dev, uint16_t slot) dev->exp.hpev_notified =3D false; =20 qbus_set_hotplug_handler(BUS(pci_bridge_get_sec_bus(PCI_BRIDGE(dev))), - DEVICE(dev), NULL); + OBJECT(dev), NULL); } =20 void pcie_cap_slot_reset(PCIDevice *dev) diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c index 45053b39b9..52ccdc5ae3 100644 --- a/hw/pci/shpc.c +++ b/hw/pci/shpc.c @@ -648,7 +648,7 @@ int shpc_init(PCIDevice *d, PCIBus *sec_bus, MemoryRegi= on *bar, shpc_cap_update_dword(d); memory_region_add_subregion(bar, offset, &shpc->mmio); =20 - qbus_set_hotplug_handler(BUS(sec_bus), DEVICE(d), NULL); + qbus_set_hotplug_handler(BUS(sec_bus), OBJECT(d), NULL); =20 d->cap_present |=3D QEMU_PCI_CAP_SHPC; return 0; diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index c3fb0ac884..60777b2355 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1686,7 +1686,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) &sphb->memspace, &sphb->iospace, PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_PCI_BU= S); phb->bus =3D bus; - qbus_set_hotplug_handler(BUS(phb->bus), DEVICE(sphb), NULL); + qbus_set_hotplug_handler(BUS(phb->bus), OBJECT(sphb), NULL); =20 /* * Initialize PHB address space. diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index 1bd6c8b458..7573c40bad 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -108,7 +108,7 @@ VirtualCssBus *virtual_css_bus_init(void) cbus =3D VIRTUAL_CSS_BUS(bus); =20 /* Enable hotplugging */ - qbus_set_hotplug_handler(bus, dev, &error_abort); + qbus_set_hotplug_handler(bus, OBJECT(dev), &error_abort); =20 css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false, 0, &error_abort); diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 80ff1ce33f..5998942b4c 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -742,7 +742,7 @@ static void s390_pcihost_realize(DeviceState *dev, Erro= r **errp) pci_setup_iommu(b, s390_pci_dma_iommu, s); =20 bus =3D BUS(b); - qbus_set_hotplug_handler(bus, dev, &local_err); + qbus_set_hotplug_handler(bus, OBJECT(dev), &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -750,7 +750,7 @@ static void s390_pcihost_realize(DeviceState *dev, Erro= r **errp) phb->bus =3D b; =20 s->bus =3D S390_PCI_BUS(qbus_create(TYPE_S390_PCI_BUS, dev, NULL)); - qbus_set_hotplug_handler(BUS(s->bus), dev, &local_err); + qbus_set_hotplug_handler(BUS(s->bus), OBJECT(dev), &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -912,7 +912,7 @@ static void s390_pcihost_plug(HotplugHandler *hotplug_d= ev, DeviceState *dev, pci_bridge_map_irq(pb, dev->id, s390_pci_map_irq); pci_setup_iommu(&pb->sec_bus, s390_pci_dma_iommu, s); =20 - qbus_set_hotplug_handler(BUS(&pb->sec_bus), DEVICE(s), errp); + qbus_set_hotplug_handler(BUS(&pb->sec_bus), OBJECT(s), errp); =20 if (dev->hotplugged) { pci_default_write_config(pdev, PCI_PRIMARY_BUS, diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index eb90288f47..ce99d288b0 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -906,7 +906,7 @@ static void virtio_scsi_device_realize(DeviceState *dev= , Error **errp) scsi_bus_new(&s->bus, sizeof(s->bus), dev, &virtio_scsi_scsi_info, vdev->bus_name); /* override default SCSI bus hotplug-handler, with virtio-scsi's one */ - qbus_set_hotplug_handler(BUS(&s->bus), dev, &error_abort); + qbus_set_hotplug_handler(BUS(&s->bus), OBJECT(dev), &error_abort); =20 virtio_scsi_dataplane_setup(s, errp); } diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index a3a019e30a..584b4be07e 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -1142,7 +1142,7 @@ pvscsi_realizefn(PCIDevice *pci_dev, Error **errp) scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info, NULL); /* override default SCSI bus hotplug-handler, with pvscsi's one */ - qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(s), &error_abort); + qbus_set_hotplug_handler(BUS(&s->bus), OBJECT(s), &error_abort); pvscsi_reset_state(s); } =20 diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 8f716fc165..6b0137bb76 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1322,7 +1322,7 @@ static void ccid_realize(USBDevice *dev, Error **errp) usb_desc_init(dev); qbus_create_inplace(&s->bus, sizeof(s->bus), TYPE_CCID_BUS, DEVICE(dev= ), NULL); - qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(dev), &error_abort); + qbus_set_hotplug_handler(BUS(&s->bus), OBJECT(dev), &error_abort); s->intr =3D usb_ep_get(dev, USB_TOKEN_IN, CCID_INT_IN_EP); s->bulk =3D usb_ep_get(dev, USB_TOKEN_IN, CCID_BULK_IN_EP); s->card =3D NULL; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 0a84c42756..e70a4bfa49 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -430,8 +430,7 @@ char *qdev_get_dev_path(DeviceState *dev); =20 GSList *qdev_build_hotpluggable_device_list(Object *peripheral); =20 -void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, - Error **errp); +void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp= ); =20 void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp); =20 --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501612153603.7932917416596; Mon, 18 Feb 2019 06:53:32 -0800 (PST) Received: from localhost ([127.0.0.1]:59889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkIR-0006mA-KU for importer@patchew.org; Mon, 18 Feb 2019 09:53:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxN-00063J-9b for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxE-0002rZ-Ry for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:36 -0500 Received: from ozlabs.org ([203.11.71.1]:53125) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjx7-0002di-Kj; Mon, 18 Feb 2019 09:31:28 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rh0Hgrz9sQq; Tue, 19 Feb 2019 01:30:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500260; bh=7nLGjDdsr3Qk/jQnne2SIqpDeqCi4S8qYmRj3Ey+rWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0UntkpvKjxVwq4lgkBkFIHSH7gP93cqnr6GGX4KGbh/UG1aCAXebtMFngUoFKr3r lVeRo9URGR2iYkfM+jU2CupkhNQ0+/SSR2hHpIMSww4Tfkj4gvlkcFvXO1HfZ9S47t STlvcyObpajFJatS9lYKUZz8qv8YjfcoqBI4APVk= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:19 +1100 Message-Id: <20190218143049.17142-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 13/43] target/ppc: Disable ISA 2.06 PM instructions on POWER9 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: groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Benjamin Herrenschmidt The ISA 2.06/2.07 Power Management instructions (doze, nap & rvwinkle) don't exist on POWER9, don't enable them. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190128094625.4428-13-clg@kaod.org> Signed-off-by: David Gibson --- target/ppc/translate_init.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 9295f78d5f..c9985c0d22 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8873,7 +8873,7 @@ POWERPC_FAMILY(POWER9)(ObjectClass *oc, void *data) PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA205 | PPC2_ISA207S | PPC2_FP_CVT_S64 | - PPC2_TM | PPC2_PM_ISA206 | PPC2_ISA300 | PPC2_PRCN= TL; + PPC2_TM | PPC2_ISA300 | PPC2_PRCNTL; pcc->msr_mask =3D (1ull << MSR_SF) | (1ull << MSR_TM) | (1ull << MSR_VR) | --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155050287538393.66200492760697; Mon, 18 Feb 2019 07:14:35 -0800 (PST) Received: from localhost ([127.0.0.1]:60260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkcq-0007g1-AD for importer@patchew.org; Mon, 18 Feb 2019 10:14:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxl-0006NC-ED for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxh-00032a-UH for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:03 -0500 Received: from ozlabs.org ([203.11.71.1]:56343) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxe-0002e1-DR; Mon, 18 Feb 2019 09:32:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rh2Bqmz9sQr; Tue, 19 Feb 2019 01:30:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500260; bh=brDQQNFYdNPYgfXa/ylCfYanWecZd6LOX5kZrN5US9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HB6EeU5g1L7GF5VWQ3vrsm4U/McMaWTc+IxYQn+BWQBz59ebLJcB6+IcgnGf5EBfA 3XiCWkwSvvf8ThBYkX/T1U0Y6vXqMJOkC3rmmy48dHj3TdlrbzZNwU1/7gq9+O+OmF tLvMvZpKLAMYUbI2s2RfNexZ2lWMlSgd600n+Bdo= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:20 +1100 Message-Id: <20190218143049.17142-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 14/43] spapr: fix out of bounds write in spapr_populate_drmem_v2 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: Fabiano Rosas , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas buf_len is uint8_t which is not large enough to hold the result of: nr_entries * sizeof(struct sPAPRDrconfCellV2) + sizeof(uint32_t); for a nr_entries greater than 10. This causes the allocated buffer 'int_buf' to be smaller than expected and we eventually overwrite some of glibc's control structures (see "chunk" in https://sourceware.org/glibc/wiki/MallocInternals) The following error is seen while trying to free int_buf: "free(): invalid next size (fast)" Fixes: a324d6f166 "spapr: Support ibm,dynamic-memory-v2 property" Signed-off-by: Fabiano Rosas Message-Id: <20190213172926.21740-1-farosas@linux.ibm.com> Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 850cfe28c4..abf9ebce59 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -687,14 +687,14 @@ static int spapr_populate_drmem_v2(sPAPRMachineState = *spapr, void *fdt, int offset, MemoryDeviceInfoList *dimms) { MachineState *machine =3D MACHINE(spapr); - uint8_t *int_buf, *cur_index, buf_len; + uint8_t *int_buf, *cur_index; int ret; uint64_t lmb_size =3D SPAPR_MEMORY_BLOCK_SIZE; uint64_t addr, cur_addr, size; uint32_t nr_boot_lmbs =3D (machine->device_memory->base / lmb_size); uint64_t mem_end =3D machine->device_memory->base + memory_region_size(&machine->device_memory->mr); - uint32_t node, nr_entries =3D 0; + uint32_t node, buf_len, nr_entries =3D 0; sPAPRDRConnector *drc; DrconfCellQueue *elem, *next; MemoryDeviceInfoList *info; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503022077713.2850256967199; Mon, 18 Feb 2019 07:17:02 -0800 (PST) Received: from localhost ([127.0.0.1]:60323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkfA-0001S9-2W for importer@patchew.org; Mon, 18 Feb 2019 10:16:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxm-0006Ns-11 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxh-00032M-Sa for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:04 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48083) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxe-0002iZ-2o; Mon, 18 Feb 2019 09:32:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rk3tjpz9sQx; Tue, 19 Feb 2019 01:30:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500262; bh=eHm2GCIiLvkrbDuHlrUGWo8X87pVxS7lORSAOJ2fle4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMbfROumk2fW8iX+dPSQosYBCaSxNjbDB3BdAFAudw59gRsEmVvDThF3C5FLpLlQl KK36GdjAN1cFF4mS4mng429qVnMHTtvV0elK6V+dBsW+5d7CQemRt86PdX4ptRJfNA uX385gqOY6KAtvBV17hXt0lR+VkRUFehCxbBbH+0= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:21 +1100 Message-Id: <20190218143049.17142-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 15/43] spapr/irq: add an 'nr_irq' parameter to initialize the backend. 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater When using the 'dual' interrupt mode, the source numbers of both sPAPR IRQ backends are aligned to share a common IRQ number space and to use a similar mapping of the machine qemu_irq array which is indexed by the source number. The XICS IRQ number range initially being [ 0x1000 - 0x2000 ], this requires to change the XICS ICSState offset to 0 and to provision for an extra 4K of source numbers and qemu_irqs which will never be used by the machine when running under the XICS interrupt mode. This is not an optimal solution. Change the init() method to allocate an IRQ number space of the expected size for the XICS sPAPR IRQ backend. It breaks the interrupt signaling when under the 'dual' mode because source numbers have unexpected values but next patch will fix that. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190213210756.27032-2-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 18 ++++++++++-------- include/hw/ppc/spapr_irq.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 80b0083b8e..da52a46e80 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -93,10 +93,10 @@ error: return NULL; } =20 -static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp) +static void spapr_irq_init_xics(sPAPRMachineState *spapr, int nr_irqs, + Error **errp) { MachineState *machine =3D MACHINE(spapr); - int nr_irqs =3D spapr->irq->nr_irqs; Error *local_err =3D NULL; =20 if (kvm_enabled()) { @@ -262,7 +262,8 @@ sPAPRIrq spapr_irq_xics =3D { /* * XIVE IRQ backend. */ -static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp) +static void spapr_irq_init_xive(sPAPRMachineState *spapr, int nr_irqs, + Error **errp) { MachineState *machine =3D MACHINE(spapr); uint32_t nr_servers =3D spapr_max_server_number(spapr); @@ -278,7 +279,7 @@ static void spapr_irq_init_xive(sPAPRMachineState *spap= r, Error **errp) } =20 dev =3D qdev_create(NULL, TYPE_SPAPR_XIVE); - qdev_prop_set_uint32(dev, "nr-irqs", spapr->irq->nr_irqs); + qdev_prop_set_uint32(dev, "nr-irqs", nr_irqs); /* * 8 XIVE END structures per CPU. One for each available priority */ @@ -435,7 +436,8 @@ static sPAPRIrq *spapr_irq_current(sPAPRMachineState *s= papr) &spapr_irq_xive : &spapr_irq_xics; } =20 -static void spapr_irq_init_dual(sPAPRMachineState *spapr, Error **errp) +static void spapr_irq_init_dual(sPAPRMachineState *spapr, int nr_irqs, + Error **errp) { MachineState *machine =3D MACHINE(spapr); Error *local_err =3D NULL; @@ -445,7 +447,7 @@ static void spapr_irq_init_dual(sPAPRMachineState *spap= r, Error **errp) return; } =20 - spapr_irq_xics.init(spapr, &local_err); + spapr_irq_xics.init(spapr, spapr_irq_xics.nr_irqs, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -462,7 +464,7 @@ static void spapr_irq_init_dual(sPAPRMachineState *spap= r, Error **errp) */ spapr->ics->offset =3D 0; =20 - spapr_irq_xive.init(spapr, &local_err); + spapr_irq_xive.init(spapr, spapr_irq_xive.nr_irqs, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -618,7 +620,7 @@ void spapr_irq_init(sPAPRMachineState *spapr, Error **e= rrp) spapr_irq_msi_init(spapr, spapr->irq->nr_msis); } =20 - spapr->irq->init(spapr, errp); + spapr->irq->init(spapr, spapr->irq->nr_irqs, errp); =20 spapr->qirqs =3D qemu_allocate_irqs(spapr->irq->set_irq, spapr, spapr->irq->nr_irqs); diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h index 14b02c3aca..488511c3d8 100644 --- a/include/hw/ppc/spapr_irq.h +++ b/include/hw/ppc/spapr_irq.h @@ -35,7 +35,7 @@ typedef struct sPAPRIrq { uint32_t nr_msis; uint8_t ov5; =20 - void (*init)(sPAPRMachineState *spapr, Error **errp); + void (*init)(sPAPRMachineState *spapr, int nr_irqs, Error **errp); int (*claim)(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp= ); void (*free)(sPAPRMachineState *spapr, int irq, int num); qemu_irq (*qirq)(sPAPRMachineState *spapr, int irq); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502124825190.10403707493208; Mon, 18 Feb 2019 07:02:04 -0800 (PST) Received: from localhost ([127.0.0.1]:60050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkQi-0005fM-Pm for importer@patchew.org; Mon, 18 Feb 2019 10:02:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxN-00063M-A7 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxE-0002ra-S1 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:42255) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjx7-0002eu-LS; Mon, 18 Feb 2019 09:31:28 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rj3bFrz9sQs; Tue, 19 Feb 2019 01:31:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500261; bh=zZFbNM9DOFLJvET8vnmInuTbysc06i0ByXomhnqsAI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LKfU8voIHRtUmfhYH7b+y0MQIDCoPnO6DvB+ip9S1BlDV0T9VAEDriY7CR832WP3t wapJ4X88oEmKlmUv5Ri6QVm6yByB60T/O2CuS05S+4ciedUdIGQ0eIYwFgLslhInAx XorZ6PYUjy3H6qCVRWm0eTjxq6cQxM0H/3ujP62Y= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:22 +1100 Message-Id: <20190218143049.17142-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 16/43] spapr/irq: remove the XICS offset adjustment 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater Now that we have changed the XICS and the XIVE interrupt backend to have different size for their IRQ number space, we do not need to align their source numbers anymore. Remove the offset adjustment and wire the dual 'qirq' handler to the 'qirq' handler of the current interrupt mode in use. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190213210756.27032-3-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index da52a46e80..48d6b2daed 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -453,17 +453,6 @@ static void spapr_irq_init_dual(sPAPRMachineState *spa= pr, int nr_irqs, return; } =20 - /* - * Align the XICS and the XIVE IRQ number space under QEMU. - * - * However, the XICS KVM device still considers that the IRQ - * numbers should start at XICS_IRQ_BASE (0x1000). Either we - * should introduce a KVM device ioctl to set the offset or ignore - * the lower 4K numbers when using the get/set ioctl of the XICS - * KVM device. The second option seems the least intrusive. - */ - spapr->ics->offset =3D 0; - spapr_irq_xive.init(spapr, spapr_irq_xive.nr_irqs, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -500,21 +489,7 @@ static void spapr_irq_free_dual(sPAPRMachineState *spa= pr, int irq, int num) =20 static qemu_irq spapr_qirq_dual(sPAPRMachineState *spapr, int irq) { - sPAPRXive *xive =3D spapr->xive; - ICSState *ics =3D spapr->ics; - - if (irq >=3D spapr->irq->nr_irqs) { - return NULL; - } - - /* - * The IRQ number should have been claimed under both interrupt - * controllers. - */ - assert(!ICS_IRQ_FREE(ics, irq - ics->offset)); - assert(xive_eas_is_valid(&xive->eat[irq])); - - return spapr->qirqs[irq]; + return spapr_irq_current(spapr)->qirq(spapr, irq); } =20 static void spapr_irq_print_info_dual(sPAPRMachineState *spapr, Monitor *m= on) --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501795394178.55091332083384; Mon, 18 Feb 2019 06:56:35 -0800 (PST) Received: from localhost ([127.0.0.1]:59949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkLM-00018U-9p for importer@patchew.org; Mon, 18 Feb 2019 09:56:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxN-00063N-A2 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxE-0002rg-S6 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:36 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:50267) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjx7-0002fx-JD; Mon, 18 Feb 2019 09:31:28 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rj6V34z9sQv; Tue, 19 Feb 2019 01:31:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500261; bh=x3GbgyK6INLYUGccBwn+9MtGkQ7TfAoLYdCh0djQMb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mULgz5mHWKiNQED61Wl995lxUkFhxgH8xOp4Rz9//RUsGOkUqVyGWxd5PgInhTZd0 rd+tSXmghJeDFDZLuLImO14TJxudF2pIRCCoIha5U640Y9JAgtybODxIfhUy8iPGKX GhcQBAhz2hmYYdbXD4/sC8wSHc2jGlnBvTtGJ4sY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:23 +1100 Message-Id: <20190218143049.17142-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 17/43] xics: Explicitely call KVM ICP methods from the common code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The pre_save(), post_load() and synchronize_state() methods of the ICPStateClass type are really KVM only things. Make that obvious by dropping the indirections and directly calling the KVM functions instead. Signed-off-by: Greg Kurz Message-Id: <155023078871.1011724.3083923389814185598.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 24 +++++++++++------------- hw/intc/xics_kvm.c | 12 ++++-------- include/hw/ppc/xics.h | 9 +++++---- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 16e8ffa2aa..988b53abd1 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -37,18 +37,18 @@ #include "qapi/visitor.h" #include "monitor/monitor.h" #include "hw/intc/intc.h" +#include "sysemu/kvm.h" =20 void icp_pic_print_info(ICPState *icp, Monitor *mon) { - ICPStateClass *icpc =3D ICP_GET_CLASS(icp); int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; =20 if (!icp->output) { return; } =20 - if (icpc->synchronize_state) { - icpc->synchronize_state(icp); + if (kvm_irqchip_in_kernel()) { + icp_synchronize_state(icp); } =20 monitor_printf(mon, "CPU %d XIRR=3D%08x (%p) PP=3D%02x MFRR=3D%02x\n", @@ -252,25 +252,23 @@ static void icp_irq(ICSState *ics, int server, int nr= , uint8_t priority) } } =20 -static int icp_dispatch_pre_save(void *opaque) +static int icp_pre_save(void *opaque) { ICPState *icp =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 - if (info->pre_save) { - info->pre_save(icp); + if (kvm_irqchip_in_kernel()) { + icp_get_kvm_state(icp); } =20 return 0; } =20 -static int icp_dispatch_post_load(void *opaque, int version_id) +static int icp_post_load(void *opaque, int version_id) { ICPState *icp =3D opaque; - ICPStateClass *info =3D ICP_GET_CLASS(icp); =20 - if (info->post_load) { - return info->post_load(icp, version_id); + if (kvm_irqchip_in_kernel()) { + return icp_set_kvm_state(icp); } =20 return 0; @@ -280,8 +278,8 @@ static const VMStateDescription vmstate_icp_server =3D { .name =3D "icp/server", .version_id =3D 1, .minimum_version_id =3D 1, - .pre_save =3D icp_dispatch_pre_save, - .post_load =3D icp_dispatch_post_load, + .pre_save =3D icp_pre_save, + .post_load =3D icp_post_load, .fields =3D (VMStateField[]) { /* Sanity check */ VMSTATE_UINT32(xirr, ICPState), diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index dff1330050..7efa99b8b4 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -54,7 +54,7 @@ static QLIST_HEAD(, KVMEnabledICP) /* * ICP-KVM */ -static void icp_get_kvm_state(ICPState *icp) +void icp_get_kvm_state(ICPState *icp) { uint64_t state; int ret; @@ -83,14 +83,14 @@ static void do_icp_synchronize_state(CPUState *cpu, run= _on_cpu_data arg) icp_get_kvm_state(arg.host_ptr); } =20 -static void icp_synchronize_state(ICPState *icp) +void icp_synchronize_state(ICPState *icp) { if (icp->cs) { run_on_cpu(icp->cs, do_icp_synchronize_state, RUN_ON_CPU_HOST_PTR(= icp)); } } =20 -static int icp_set_kvm_state(ICPState *icp, int version_id) +int icp_set_kvm_state(ICPState *icp) { uint64_t state; int ret; @@ -121,7 +121,7 @@ static void icp_kvm_reset(DeviceState *dev) =20 icpc->parent_reset(dev); =20 - icp_set_kvm_state(ICP(dev), 1); + icp_set_kvm_state(ICP(dev)); } =20 static void icp_kvm_realize(DeviceState *dev, Error **errp) @@ -178,10 +178,6 @@ static void icp_kvm_class_init(ObjectClass *klass, voi= d *data) &icpc->parent_realize); device_class_set_parent_reset(dc, icp_kvm_reset, &icpc->parent_reset); - - icpc->pre_save =3D icp_get_kvm_state; - icpc->post_load =3D icp_set_kvm_state; - icpc->synchronize_state =3D icp_synchronize_state; } =20 static const TypeInfo icp_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fad786e8b2..3236ccec92 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -66,10 +66,6 @@ struct ICPStateClass { =20 DeviceRealize parent_realize; DeviceReset parent_reset; - - void (*pre_save)(ICPState *icp); - int (*post_load)(ICPState *icp, int version_id); - void (*synchronize_state)(ICPState *icp); }; =20 struct ICPState { @@ -203,4 +199,9 @@ void icp_resend(ICPState *ss); Object *icp_create(Object *cpu, const char *type, XICSFabric *xi, Error **errp); =20 +/* KVM */ +void icp_get_kvm_state(ICPState *icp); +int icp_set_kvm_state(ICPState *icp); +void icp_synchronize_state(ICPState *icp); + #endif /* XICS_H */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501908820160.10109504681452; Mon, 18 Feb 2019 06:58:28 -0800 (PST) Received: from localhost ([127.0.0.1]:59975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkNC-0002id-LZ for importer@patchew.org; Mon, 18 Feb 2019 09:58:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxo-0006Q2-0C for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxh-00032L-Si for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:07 -0500 Received: from ozlabs.org ([203.11.71.1]:59641) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxe-0002iR-4i; Mon, 18 Feb 2019 09:32:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rl2khJz9sRG; Tue, 19 Feb 2019 01:31:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500263; bh=Dz1eO6oE7FED4kbYFa7CAjuehFxZ1F9OInOLu2+BCM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+LbFjYxj+S4/lBV9WcwZDfZNMifNJmKqhJSVZyG9K5AwXc2EbFQox6gIHFauIafM 5hEAw44k18kaOOa4m2m1lNDpD2aTYcPacsx8XoPeulFugELV1uVFk4UvvA88vVj0cz 2hyb4R6NHnTDOCGMRmt68+LxBLBylbNL21uj85YA= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:24 +1100 Message-Id: <20190218143049.17142-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 18/43] xics: Handle KVM ICP reset from the common code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The KVM ICP reset handler simply writes the ICP state to KVM. This doesn't need the overkill parent_reset logic we have today. Call icp_set_kvm_state() from the base ICP reset function instead. Since there are no other users for ICPStateClass::parent_reset, and it isn't currently expected to change, drop it as well. Signed-off-by: Greg Kurz Message-Id: <155023079461.1011724.12644984391500635645.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 12 ++++-------- hw/intc/xics_kvm.c | 11 ----------- include/hw/ppc/xics.h | 1 - 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 988b53abd1..822d367e63 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -289,7 +289,7 @@ static const VMStateDescription vmstate_icp_server =3D { }, }; =20 -static void icp_reset(DeviceState *dev) +static void icp_reset_handler(void *dev) { ICPState *icp =3D ICP(dev); =20 @@ -299,13 +299,10 @@ static void icp_reset(DeviceState *dev) =20 /* Make all outputs are deasserted */ qemu_set_irq(icp->output, 0); -} =20 -static void icp_reset_handler(void *dev) -{ - DeviceClass *dc =3D DEVICE_GET_CLASS(dev); - - dc->reset(dev); + if (kvm_irqchip_in_kernel()) { + icp_set_kvm_state(ICP(dev)); + } } =20 static void icp_realize(DeviceState *dev, Error **errp) @@ -370,7 +367,6 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) =20 dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; - dc->reset =3D icp_reset; } =20 static const TypeInfo icp_info =3D { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 7efa99b8b4..80321e9b75 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -115,15 +115,6 @@ int icp_set_kvm_state(ICPState *icp) return 0; } =20 -static void icp_kvm_reset(DeviceState *dev) -{ - ICPStateClass *icpc =3D ICP_GET_CLASS(dev); - - icpc->parent_reset(dev); - - icp_set_kvm_state(ICP(dev)); -} - static void icp_kvm_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); @@ -176,8 +167,6 @@ static void icp_kvm_class_init(ObjectClass *klass, void= *data) =20 device_class_set_parent_realize(dc, icp_kvm_realize, &icpc->parent_realize); - device_class_set_parent_reset(dc, icp_kvm_reset, - &icpc->parent_reset); } =20 static const TypeInfo icp_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3236ccec92..e33282a576 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -65,7 +65,6 @@ struct ICPStateClass { DeviceClass parent_class; =20 DeviceRealize parent_realize; - DeviceReset parent_reset; }; =20 struct ICPState { --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501548342977.0583009536206; Mon, 18 Feb 2019 06:52:28 -0800 (PST) Received: from localhost ([127.0.0.1]:59887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkHQ-0005wm-9w for importer@patchew.org; Mon, 18 Feb 2019 09:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxZ-0006Dl-Ur for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxQ-0002vd-Mh for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:31:48 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:52339) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxH-0002ie-4y; Mon, 18 Feb 2019 09:31:37 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rp5Yftz9sR0; Tue, 19 Feb 2019 01:31:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500266; bh=LbTy1eMIeOO/qernx6v/RfVXmRQyaJMc7uxBUd5JqcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQJYRUuIi8deOerXHd0/BGOLvO4GLb6fkheBi2Zay8u7R786G/PHR+OFbqPXvoOIC 0JXoOOEGrXmi2AxeAXJBJD1FU/nEf4cZvkNI0fCU9cZRoY9iJNMGdEXL//SLA4ivhJ hzHNBsgw9SUeYxuGUEi3/tmpDCQH9SBuXK71MM5I= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:25 +1100 Message-Id: <20190218143049.17142-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 19/43] xics: Handle KVM ICP realize from the common code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The realization of KVM ICP currently follows the parent_realize logic, which is a bit overkill here. Also we want to get rid of the KVM ICP class. Explicitely call icp_kvm_realize() from the base ICP realize function. Note that ICPStateClass::parent_realize is retained because powernv needs it. Signed-off-by: Greg Kurz Message-Id: <155023080049.1011724.15423463482790260696.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 8 ++++++++ hw/intc/xics_kvm.c | 10 +--------- include/hw/ppc/xics.h | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 822d367e63..acd63ab5e0 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -349,6 +349,14 @@ static void icp_realize(DeviceState *dev, Error **errp) return; } =20 + if (kvm_irqchip_in_kernel()) { + icp_kvm_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } + } + qemu_register_reset(icp_reset_handler, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); } diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 80321e9b75..4eebced516 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -115,11 +115,9 @@ int icp_set_kvm_state(ICPState *icp) return 0; } =20 -static void icp_kvm_realize(DeviceState *dev, Error **errp) +void icp_kvm_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); - ICPStateClass *icpc =3D ICP_GET_CLASS(icp); - Error *local_err =3D NULL; CPUState *cs; KVMEnabledICP *enabled_icp; unsigned long vcpu_id; @@ -129,12 +127,6 @@ static void icp_kvm_realize(DeviceState *dev, Error **= errp) abort(); } =20 - icpc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - cs =3D icp->cs; vcpu_id =3D kvm_arch_vcpu_id(cs); =20 diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index e33282a576..ab61dc2401 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -202,5 +202,6 @@ Object *icp_create(Object *cpu, const char *type, XICSF= abric *xi, void icp_get_kvm_state(ICPState *icp); int icp_set_kvm_state(ICPState *icp); void icp_synchronize_state(ICPState *icp); +void icp_kvm_realize(DeviceState *dev, Error **errp); =20 #endif /* XICS_H */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155050274771945.80290622714472; Mon, 18 Feb 2019 07:12:27 -0800 (PST) Received: from localhost ([127.0.0.1]:60230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkam-0005cr-KZ for importer@patchew.org; Mon, 18 Feb 2019 10:12:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxw-0006cd-FU for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003CD-MP for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:16 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:41465) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-0002s1-Gz; Mon, 18 Feb 2019 09:32:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rq4G3tz9sR4; Tue, 19 Feb 2019 01:31:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500267; bh=1sAiq5fdcVjN7Z0NuUWHJUP3YExIxjcw/+Ax1Q7EGDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BfYYFri56iZ2dB+Z/4hH7R7rbFQXo6EEcf2fxuoemx1glyb1uBGDgxwyFHoJBXDnE JSegGIMzF7h3O5IR7aKAfaNMQgaEFCjYiqopgMmm6jp9FuNjJ6m5P0Txs4+J+Obks/ wm4NBy+LMH3tWOueAOTFXHR2oBeH8PYGUYSgC4mQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:26 +1100 Message-Id: <20190218143049.17142-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 20/43] spapr/irq: Use the base ICP class for KVM 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The base ICP class knows how to interact with KVM. Adapt sPAPR to use it instead of the ICP KVM class. Signed-off-by: Greg Kurz Message-Id: <155023080638.1011724.792095453419098948.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 4 +--- include/hw/ppc/spapr.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 48d6b2daed..e6893df61e 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -102,7 +102,6 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, if (kvm_enabled()) { if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(spapr, &local_err)) { - spapr->icp_type =3D TYPE_KVM_ICP; spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, &local_err); } @@ -117,7 +116,6 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, =20 if (!spapr->ics) { xics_spapr_init(spapr); - spapr->icp_type =3D TYPE_ICP; spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, &local_err); } @@ -199,7 +197,7 @@ static void spapr_irq_cpu_intc_create_xics(sPAPRMachine= State *spapr, Object *obj; sPAPRCPUState *spapr_cpu =3D spapr_cpu_state(cpu); =20 - obj =3D icp_create(OBJECT(cpu), spapr->icp_type, XICS_FABRIC(spapr), + obj =3D icp_create(OBJECT(cpu), TYPE_ICP, XICS_FABRIC(spapr), &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index cbd276ed2b..631fc5103b 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -178,7 +178,6 @@ struct sPAPRMachineState { /*< public >*/ char *kvm_type; =20 - const char *icp_type; int32_t irq_map_nr; unsigned long *irq_map; sPAPRXive *xive; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502305919305.7174621648063; Mon, 18 Feb 2019 07:05:05 -0800 (PST) Received: from localhost ([127.0.0.1]:60095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkTd-0007oP-Om for importer@patchew.org; Mon, 18 Feb 2019 10:05:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxw-0006ce-Fv for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003Cj-Vd for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:16 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:60487) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-0002s0-EL; Mon, 18 Feb 2019 09:32:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rq6BClz9sRC; Tue, 19 Feb 2019 01:31:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500267; bh=/EtonkbGqt0n7JZ5h4VK7BPUu1LhLVv+yBB737MXChM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVZ9AVvMW3F1pLI38O/vgCYNw6ooaipfdzTYiMrhmLGE8C9tjRvsp5xF23LOudvCs 54EX7fCrEp+jZomj0OaZIOXQBAI3yeKK59R+BKsZ8MRen47tHL6gXJirx4VVWLkPXu JUk3rUDv0m7vf+NVdW9P8B+cFcaa2giEDfDe1aEY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:27 +1100 Message-Id: <20190218143049.17142-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 21/43] xics: Drop the KVM ICP class 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The KVM ICP class isn't used anymore. Drop it. Signed-off-by: Greg Kurz Message-Id: <155023081228.1011724.12474992370439652538.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics_kvm.c | 18 ------------------ include/hw/ppc/xics.h | 3 --- 2 files changed, 21 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 4eebced516..fae4ac431f 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -152,23 +152,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp) QLIST_INSERT_HEAD(&kvm_enabled_icps, enabled_icp, node); } =20 -static void icp_kvm_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - ICPStateClass *icpc =3D ICP_CLASS(klass); - - device_class_set_parent_realize(dc, icp_kvm_realize, - &icpc->parent_realize); -} - -static const TypeInfo icp_kvm_info =3D { - .name =3D TYPE_KVM_ICP, - .parent =3D TYPE_ICP, - .instance_size =3D sizeof(ICPState), - .class_init =3D icp_kvm_class_init, - .class_size =3D sizeof(ICPStateClass), -}; - /* * ICS-KVM */ @@ -425,7 +408,6 @@ fail: static void xics_kvm_register_types(void) { type_register_static(&ics_kvm_info); - type_register_static(&icp_kvm_info); } =20 type_init(xics_kvm_register_types) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index ab61dc2401..fae54e6f28 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -50,9 +50,6 @@ typedef struct XICSFabric XICSFabric; #define TYPE_ICP "icp" #define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP) =20 -#define TYPE_KVM_ICP "icp-kvm" -#define KVM_ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_KVM_ICP) - #define TYPE_PNV_ICP "pnv-icp" #define PNV_ICP(obj) OBJECT_CHECK(PnvICPState, (obj), TYPE_PNV_ICP) =20 --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503171510866.7026416028713; Mon, 18 Feb 2019 07:19:31 -0800 (PST) Received: from localhost ([127.0.0.1]:60347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkhb-0003Rf-FN for importer@patchew.org; Mon, 18 Feb 2019 10:19:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxp-0006SR-Uf for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxo-00036m-3i for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:09 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:32821) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxm-0002s2-2A; Mon, 18 Feb 2019 09:32:07 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rs0d7Tz9sRN; Tue, 19 Feb 2019 01:31:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500269; bh=ZMjVIIdSVwOxErgNkFH+PugiiSkfR7rcRgE8U6jqcfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLp/hnA47aw01bolMaxbm70l+G1xG9k8ljxX0jm+bKyCJy+aXG43v8n5M99JLjf39 RI1Zf8h2N135QdjV0ApFm7n5stzEO3T/Ruiro2SDzZIFQE8XFKAQKcb+JEd0KySOOd HcZt9w1yCHkMW7Sp0JKyLL0N086ftmmyMkBbyGmc= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:28 +1100 Message-Id: <20190218143049.17142-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 22/43] xics: Explicitely call KVM ICS methods from the common code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The pre_save(), post_load() and synchronize_state() methods of the ICSStateClass type are really KVM only things. Make that obvious by dropping the indirections and directly calling the KVM functions instead. Signed-off-by: Greg Kurz Message-Id: <155023081817.1011724.14078777320394028836.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 23 ++++++++++------------- hw/intc/xics_kvm.c | 12 ++++-------- include/hw/ppc/xics.h | 7 ++++--- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index acd63ab5e0..ae5d5ea135 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -58,7 +58,6 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon) =20 void ics_pic_print_info(ICSState *ics, Monitor *mon) { - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(ics); uint32_t i; =20 monitor_printf(mon, "ICS %4x..%4x %p\n", @@ -68,8 +67,8 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon) return; } =20 - if (icsc->synchronize_state) { - icsc->synchronize_state(ics); + if (kvm_irqchip_in_kernel()) { + ics_synchronize_state(ics); } =20 for (i =3D 0; i < ics->nr_irqs; i++) { @@ -647,25 +646,23 @@ static void ics_base_instance_init(Object *obj) ics->offset =3D XICS_IRQ_BASE; } =20 -static int ics_base_dispatch_pre_save(void *opaque) +static int ics_base_pre_save(void *opaque) { ICSState *ics =3D opaque; - ICSStateClass *info =3D ICS_BASE_GET_CLASS(ics); =20 - if (info->pre_save) { - info->pre_save(ics); + if (kvm_irqchip_in_kernel()) { + ics_get_kvm_state(ics); } =20 return 0; } =20 -static int ics_base_dispatch_post_load(void *opaque, int version_id) +static int ics_base_post_load(void *opaque, int version_id) { ICSState *ics =3D opaque; - ICSStateClass *info =3D ICS_BASE_GET_CLASS(ics); =20 - if (info->post_load) { - return info->post_load(ics, version_id); + if (kvm_irqchip_in_kernel()) { + return ics_set_kvm_state(ics); } =20 return 0; @@ -689,8 +686,8 @@ static const VMStateDescription vmstate_ics_base =3D { .name =3D "ics", .version_id =3D 1, .minimum_version_id =3D 1, - .pre_save =3D ics_base_dispatch_pre_save, - .post_load =3D ics_base_dispatch_post_load, + .pre_save =3D ics_base_pre_save, + .post_load =3D ics_base_post_load, .fields =3D (VMStateField[]) { /* Sanity check */ VMSTATE_UINT32_EQUAL(nr_irqs, ICSState, NULL), diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index fae4ac431f..642351e579 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -155,7 +155,7 @@ void icp_kvm_realize(DeviceState *dev, Error **errp) /* * ICS-KVM */ -static void ics_get_kvm_state(ICSState *ics) +void ics_get_kvm_state(ICSState *ics) { uint64_t state; int i; @@ -208,12 +208,12 @@ static void ics_get_kvm_state(ICSState *ics) } } =20 -static void ics_synchronize_state(ICSState *ics) +void ics_synchronize_state(ICSState *ics) { ics_get_kvm_state(ics); } =20 -static int ics_set_kvm_state(ICSState *ics, int version_id) +int ics_set_kvm_state(ICSState *ics) { uint64_t state; int i; @@ -286,7 +286,7 @@ static void ics_kvm_reset(DeviceState *dev) =20 icsc->parent_reset(dev); =20 - ics_set_kvm_state(ICS_KVM(dev), 1); + ics_set_kvm_state(ICS_KVM(dev)); } =20 static void ics_kvm_reset_handler(void *dev) @@ -318,10 +318,6 @@ static void ics_kvm_class_init(ObjectClass *klass, voi= d *data) &icsc->parent_realize); device_class_set_parent_reset(dc, ics_kvm_reset, &icsc->parent_reset); - - icsc->pre_save =3D ics_get_kvm_state; - icsc->post_load =3D ics_set_kvm_state; - icsc->synchronize_state =3D ics_synchronize_state; } =20 static const TypeInfo ics_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index fae54e6f28..06e87128f8 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -109,12 +109,9 @@ struct ICSStateClass { DeviceRealize parent_realize; DeviceReset parent_reset; =20 - void (*pre_save)(ICSState *s); - int (*post_load)(ICSState *s, int version_id); void (*reject)(ICSState *s, uint32_t irq); void (*resend)(ICSState *s); void (*eoi)(ICSState *s, uint32_t irq); - void (*synchronize_state)(ICSState *s); }; =20 struct ICSState { @@ -201,4 +198,8 @@ int icp_set_kvm_state(ICPState *icp); void icp_synchronize_state(ICPState *icp); void icp_kvm_realize(DeviceState *dev, Error **errp); =20 +void ics_get_kvm_state(ICSState *ics); +int ics_set_kvm_state(ICSState *ics); +void ics_synchronize_state(ICSState *ics); + #endif /* XICS_H */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502085407718.9376421286765; Mon, 18 Feb 2019 07:01:25 -0800 (PST) Received: from localhost ([127.0.0.1]:60043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkQ0-00056P-AM for importer@patchew.org; Mon, 18 Feb 2019 10:01:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxo-0006Q3-0a for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxl-00034m-Jg for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:07 -0500 Received: from ozlabs.org ([203.11.71.1]:38791) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxi-0002vs-62; Mon, 18 Feb 2019 09:32:04 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rs6wk1z9sPb; Tue, 19 Feb 2019 01:31:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500269; bh=SNcxm5b5NMLJiTj9Ih+EMWiW1T47vLEh2n/L3YgDiYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7Kem980SHE0E9A/KWy0dX15fiGTkdck40mFGCNViAnEc1fjl0Th0LlpNQS3taDNs nFnEX4KSwAh+pnXMZH6LYugWwkd0sitzCL0JBMX2HYLwc4ksjAGy/u3wtAtVfgm1/c yVmz+v3XY4BHAtscf8cNlkQeFuPvTXur6/nJQSQk= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:29 +1100 Message-Id: <20190218143049.17142-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 23/43] xics: Handle KVM ICS reset from the "simple" ICS code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The KVM ICS reset handler simply writes the ICS state to KVM. This doesn't need the overkill parent_reset logic we have today. Also we want to use the same ICS type for the KVM and non-KVM case with pseries. Call icp_set_kvm_state() from the "simple" ICS reset function. Signed-off-by: Greg Kurz Message-Id: <155023082407.1011724.1983100830860273401.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 4 ++++ hw/intc/xics_kvm.c | 18 ------------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index ae5d5ea135..49401745c4 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -553,6 +553,10 @@ static void ics_simple_reset(DeviceState *dev) ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(dev); =20 icsc->parent_reset(dev); + + if (kvm_irqchip_in_kernel()) { + ics_set_kvm_state(ICS_BASE(dev)); + } } =20 static void ics_simple_reset_handler(void *dev) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 642351e579..e7b8d4c29c 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -280,20 +280,6 @@ void ics_kvm_set_irq(void *opaque, int srcno, int val) } } =20 -static void ics_kvm_reset(DeviceState *dev) -{ - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(dev); - - icsc->parent_reset(dev); - - ics_set_kvm_state(ICS_KVM(dev)); -} - -static void ics_kvm_reset_handler(void *dev) -{ - ics_kvm_reset(dev); -} - static void ics_kvm_realize(DeviceState *dev, Error **errp) { ICSState *ics =3D ICS_KVM(dev); @@ -305,8 +291,6 @@ static void ics_kvm_realize(DeviceState *dev, Error **e= rrp) error_propagate(errp, local_err); return; } - - qemu_register_reset(ics_kvm_reset_handler, ics); } =20 static void ics_kvm_class_init(ObjectClass *klass, void *data) @@ -316,8 +300,6 @@ static void ics_kvm_class_init(ObjectClass *klass, void= *data) =20 device_class_set_parent_realize(dc, ics_kvm_realize, &icsc->parent_realize); - device_class_set_parent_reset(dc, ics_kvm_reset, - &icsc->parent_reset); } =20 static const TypeInfo ics_kvm_info =3D { --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502106019873.515813663443; Mon, 18 Feb 2019 07:01:46 -0800 (PST) Received: from localhost ([127.0.0.1]:60048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkQQ-0005Qc-Gg for importer@patchew.org; Mon, 18 Feb 2019 10:01:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxv-0006bK-3S for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003Ax-3B for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:15 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:41991) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-000317-4U; Mon, 18 Feb 2019 09:32:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rx36Z0z9sPW; Tue, 19 Feb 2019 01:31:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500273; bh=yUzVlCUqBvM0ym7fyXMIW9cf/u1sbVfrlxtrBZHbe2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3OYcG1hf++a6bR+xG3GhqRTcmHpzVq/t+MfOzS1JsaKUL3RlpgilqjTXLCgxgEnx 7liTznFClM2VJgw5B2ukwL3E4mPaHB0xWcQde2FmpW70DWjv4fR56+XlN7Z76qBXtM IaCPmUSWVHKi7K8se+ABqWouWUPK4XbU2vGJqBMY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:30 +1100 Message-Id: <20190218143049.17142-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 24/43] xics: Handle KVM interrupt presentation from "simple" ICS code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz We want to use the "simple" ICS type in both KVM and non-KVM setups. Teach the "simple" ICS how to present interrupts to KVM and adapt sPAPR accordingly. Signed-off-by: Greg Kurz Message-Id: <155023082996.1011724.16237920586343905010.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/intc/xics.c | 5 +++++ hw/intc/xics_kvm.c | 3 +-- hw/ppc/spapr_irq.c | 7 +------ include/hw/ppc/xics.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 49401745c4..3009fa7472 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int v= al) { ICSState *ics =3D (ICSState *)opaque; =20 + if (kvm_irqchip_in_kernel()) { + ics_kvm_set_irq(ics, srcno, val); + return; + } + if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { ics_simple_set_irq_lsi(ics, srcno, val); } else { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index e7b8d4c29c..f34eacda03 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) return 0; } =20 -void ics_kvm_set_irq(void *opaque, int srcno, int val) +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) { - ICSState *ics =3D opaque; struct kvm_irq_level args; int rc; =20 diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index e6893df61e..9f43b7b3bf 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState = *spapr, int version_id) static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) { sPAPRMachineState *spapr =3D opaque; - MachineState *machine =3D MACHINE(opaque); =20 - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { - ics_kvm_set_irq(spapr->ics, srcno, val); - } else { - ics_simple_set_irq(spapr->ics, srcno, val); - } + ics_simple_set_irq(spapr->ics, srcno, val); } =20 static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 06e87128f8..61bd0fb978 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); void ics_simple_write_xive(ICSState *ics, int nr, int server, uint8_t priority, uint8_t saved_priority); void ics_simple_set_irq(void *opaque, int srcno, int val); -void ics_kvm_set_irq(void *opaque, int srcno, int val); =20 void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); void icp_pic_print_info(ICPState *icp, Monitor *mon); @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); void ics_get_kvm_state(ICSState *ics); int ics_set_kvm_state(ICSState *ics); void ics_synchronize_state(ICSState *ics); +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); =20 #endif /* XICS_H */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155050331579443.28669890064111; Mon, 18 Feb 2019 07:21:55 -0800 (PST) Received: from localhost ([127.0.0.1]:60398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkjw-0005Pz-Ic for importer@patchew.org; Mon, 18 Feb 2019 10:21:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxu-0006aX-If for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxs-0003Ae-SQ for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:14 -0500 Received: from ozlabs.org ([203.11.71.1]:42187) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-00032v-AH; Mon, 18 Feb 2019 09:32:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rz1zgtz9sPZ; Tue, 19 Feb 2019 01:31:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500275; bh=MESAegcCe7+HVLomilUJvGKjTzn3rjxHLnEPE0wHy7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BD4KWMZHCmPtPtznx3vDcSFzhyN7NxEnTu5UdYY7DV9f5ixw0pzvXJPHBRWsAYqGT pPSjK9mZUkidsWZtlUf+WqWKgvvxGNQPZ/NcmIW8tQ7DAgHwBOplZSXVwkdbqGxTlz OBRvZhqgZ7NkNtOdvpuXb/AzlgH+omIeuOgwDXC4= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:31 +1100 Message-Id: <20190218143049.17142-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 25/43] spapr/irq: Use the "simple" ICS class for KVM 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The "simple" ICS class knows how to interract with KVM. Adapt sPAPR to use it instead of the ICS KVM class. Signed-off-by: Greg Kurz Message-Id: <155023083585.1011724.2868047424353921455.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 9f43b7b3bf..4aa8165307 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -67,13 +67,12 @@ void spapr_irq_msi_reset(sPAPRMachineState *spapr) */ =20 static ICSState *spapr_ics_create(sPAPRMachineState *spapr, - const char *type_ics, int nr_irqs, Error **errp) { Error *local_err =3D NULL; Object *obj; =20 - obj =3D object_new(type_ics); + obj =3D object_new(TYPE_ICS_SIMPLE); object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort); object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr), &error_abort); @@ -98,14 +97,14 @@ static void spapr_irq_init_xics(sPAPRMachineState *spap= r, int nr_irqs, { MachineState *machine =3D MACHINE(spapr); Error *local_err =3D NULL; + bool xics_kvm =3D false; =20 if (kvm_enabled()) { if (machine_kernel_irqchip_allowed(machine) && !xics_kvm_init(spapr, &local_err)) { - spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs, - &local_err); + xics_kvm =3D true; } - if (machine_kernel_irqchip_required(machine) && !spapr->ics) { + if (machine_kernel_irqchip_required(machine) && !xics_kvm) { error_prepend(&local_err, "kernel_irqchip requested but unavailable: "); goto error; @@ -114,12 +113,12 @@ static void spapr_irq_init_xics(sPAPRMachineState *sp= apr, int nr_irqs, local_err =3D NULL; } =20 - if (!spapr->ics) { + if (!xics_kvm) { xics_spapr_init(spapr); - spapr->ics =3D spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs, - &local_err); } =20 + spapr->ics =3D spapr_ics_create(spapr, nr_irqs, &local_err); + error: error_propagate(errp, local_err); } --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502486321392.06749324700434; Mon, 18 Feb 2019 07:08:06 -0800 (PST) Received: from localhost ([127.0.0.1]:60154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkWZ-0001qG-9m for importer@patchew.org; Mon, 18 Feb 2019 10:08:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxw-0006d3-Qd for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003CM-OY for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:16 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:49295) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-000333-F8; Mon, 18 Feb 2019 09:32:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s00dknz9sRH; Tue, 19 Feb 2019 01:31:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500276; bh=yXWEErBs3uz1iFK+OtlnC0kxuWdUjl5EXqQfJNw/PD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=meg1QDOMaQnWJfcXlnuKWAyiDJP+vnSvwT+L7lQ/wYttkIM3846LydtF2cWl+3grV DUoRotxBK6D124wayBxfBYRwLN9dwIFLwrF5k+3qDkJth39LhHvvb0c2Q6qP7M13rM 7NVloJDppdHHHV6ySr3/W9XH/Ta8iKLmsYO/ZDEY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:32 +1100 Message-Id: <20190218143049.17142-27-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 26/43] xics: Drop the KVM ICS class 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The KVM ICS class isn't used anymore. Drop it. Signed-off-by: Greg Kurz Message-Id: <155023084177.1011724.14693955932559990358.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics_kvm.c | 40 ---------------------------------------- hw/ppc/spapr_irq.c | 2 +- include/hw/ppc/xics.h | 3 --- 3 files changed, 1 insertion(+), 44 deletions(-) diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index f34eacda03..a00d0a7962 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -279,39 +279,6 @@ void ics_kvm_set_irq(ICSState *ics, int srcno, int val) } } =20 -static void ics_kvm_realize(DeviceState *dev, Error **errp) -{ - ICSState *ics =3D ICS_KVM(dev); - ICSStateClass *icsc =3D ICS_BASE_GET_CLASS(ics); - Error *local_err =3D NULL; - - icsc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } -} - -static void ics_kvm_class_init(ObjectClass *klass, void *data) -{ - ICSStateClass *icsc =3D ICS_BASE_CLASS(klass); - DeviceClass *dc =3D DEVICE_CLASS(klass); - - device_class_set_parent_realize(dc, ics_kvm_realize, - &icsc->parent_realize); -} - -static const TypeInfo ics_kvm_info =3D { - .name =3D TYPE_ICS_KVM, - .parent =3D TYPE_ICS_BASE, - .instance_size =3D sizeof(ICSState), - .class_init =3D ics_kvm_class_init, -}; - -/* - * XICS-KVM - */ - static void rtas_dummy(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, @@ -381,10 +348,3 @@ fail: kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); return -1; } - -static void xics_kvm_register_types(void) -{ - type_register_static(&ics_kvm_info); -} - -type_init(xics_kvm_register_types) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 4aa8165307..4297eed600 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -208,7 +208,7 @@ static void spapr_irq_cpu_intc_create_xics(sPAPRMachine= State *spapr, =20 static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_= id) { - if (!object_dynamic_cast(OBJECT(spapr->ics), TYPE_ICS_KVM)) { + if (!kvm_irqchip_in_kernel()) { CPUState *cs; CPU_FOREACH(cs) { PowerPCCPU *cpu =3D POWERPC_CPU(cs); diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 61bd0fb978..d36bbe11ee 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -95,9 +95,6 @@ struct PnvICPState { #define TYPE_ICS_SIMPLE "ics" #define ICS_SIMPLE(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS_SIMPLE) =20 -#define TYPE_ICS_KVM "icskvm" -#define ICS_KVM(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS_KVM) - #define ICS_BASE_CLASS(klass) \ OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS_BASE) #define ICS_BASE_GET_CLASS(obj) \ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155050238246613.345405298365108; Mon, 18 Feb 2019 07:06:22 -0800 (PST) Received: from localhost ([127.0.0.1]:60128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkUq-0000Oe-7J for importer@patchew.org; Mon, 18 Feb 2019 10:06:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxr-0006Un-SC for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxq-00038l-1X for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:11 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:58651) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxo-00032z-Rk; Mon, 18 Feb 2019 09:32:09 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rz5jyZz9sRL; Tue, 19 Feb 2019 01:31:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500275; bh=51Kdb09oEtkTnZ9f/p90WUO7gcN94+0Bilb3m99acpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EykAbFSdfqyvrYatyZW2II6JG0/yd7xMvbazG7he7335Lgm8QVxO31cSWf+Ru5PI2 jBdFRhKYqE2Dx2WElvcRZgc04iT2OZeDBB1WaVobsnlUYfNO74rZpGcZHb4OaSNHF0 +DPQ9HynlZG7Eu2QtZCIWrVVzepAzaZ3jRbQjzJE= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:33 +1100 Message-Id: <20190218143049.17142-28-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 27/43] target/ppc: convert VMX logical instructions to use vector operations 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: Richard Henderson , Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate.c | 1 + target/ppc/translate/vmx-impl.inc.c | 47 ++++++++++------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index d5f29d3536..f4d70e725a 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -24,6 +24,7 @@ #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg-op.h" +#include "tcg-op-gvec.h" #include "qemu/host-utils.h" #include "exec/cpu_ldst.h" =20 diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index f99d0284c2..c74932e5ee 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -266,45 +266,30 @@ GEN_VX_VMUL10(vmul10euq, 1, 0); GEN_VX_VMUL10(vmul10cuq, 0, 1); GEN_VX_VMUL10(vmul10ecuq, 1, 1); =20 -/* Logical operations */ -#define GEN_VX_LOGICAL(name, tcg_op, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) = \ +#define GEN_VXFORM_V(name, vece, tcg_op, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ - TCGv_i64 t0; \ - TCGv_i64 t1; \ - TCGv_i64 avr; \ - \ if (unlikely(!ctx->altivec_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VPU); \ return; \ } \ - t0 =3D tcg_temp_new_i64(); \ - t1 =3D tcg_temp_new_i64(); \ - avr =3D tcg_temp_new_i64(); \ - \ - get_avr64(t0, rA(ctx->opcode), true); \ - get_avr64(t1, rB(ctx->opcode), true); \ - tcg_op(avr, t0, t1); \ - set_avr64(rD(ctx->opcode), avr, true); \ - \ - get_avr64(t0, rA(ctx->opcode), false); \ - get_avr64(t1, rB(ctx->opcode), false); \ - tcg_op(avr, t0, t1); \ - set_avr64(rD(ctx->opcode), avr, false); \ \ - tcg_temp_free_i64(t0); \ - tcg_temp_free_i64(t1); \ - tcg_temp_free_i64(avr); \ + tcg_op(vece, \ + avr64_offset(rD(ctx->opcode), true), \ + avr64_offset(rA(ctx->opcode), true), \ + avr64_offset(rB(ctx->opcode), true), \ + 16, 16); \ } =20 -GEN_VX_LOGICAL(vand, tcg_gen_and_i64, 2, 16); -GEN_VX_LOGICAL(vandc, tcg_gen_andc_i64, 2, 17); -GEN_VX_LOGICAL(vor, tcg_gen_or_i64, 2, 18); -GEN_VX_LOGICAL(vxor, tcg_gen_xor_i64, 2, 19); -GEN_VX_LOGICAL(vnor, tcg_gen_nor_i64, 2, 20); -GEN_VX_LOGICAL(veqv, tcg_gen_eqv_i64, 2, 26); -GEN_VX_LOGICAL(vnand, tcg_gen_nand_i64, 2, 22); -GEN_VX_LOGICAL(vorc, tcg_gen_orc_i64, 2, 21); +/* Logical operations */ +GEN_VXFORM_V(vand, MO_64, tcg_gen_gvec_and, 2, 16); +GEN_VXFORM_V(vandc, MO_64, tcg_gen_gvec_andc, 2, 17); +GEN_VXFORM_V(vor, MO_64, tcg_gen_gvec_or, 2, 18); +GEN_VXFORM_V(vxor, MO_64, tcg_gen_gvec_xor, 2, 19); +GEN_VXFORM_V(vnor, MO_64, tcg_gen_gvec_nor, 2, 20); +GEN_VXFORM_V(veqv, MO_64, tcg_gen_gvec_eqv, 2, 26); +GEN_VXFORM_V(vnand, MO_64, tcg_gen_gvec_nand, 2, 22); +GEN_VXFORM_V(vorc, MO_64, tcg_gen_gvec_orc, 2, 21); =20 #define GEN_VXFORM(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) = \ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503578834311.49257558436875; Mon, 18 Feb 2019 07:26:18 -0800 (PST) Received: from localhost ([127.0.0.1]:60496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvko9-0000Sd-Uq for importer@patchew.org; Mon, 18 Feb 2019 10:26:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxx-0006eK-VP for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003C0-Jr for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:17 -0500 Received: from ozlabs.org ([203.11.71.1]:46921) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-00036z-Ge; Mon, 18 Feb 2019 09:32:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s04kYfz9sR1; Tue, 19 Feb 2019 01:31:15 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500276; bh=ly05Dqm20TbRMPR4plo4LIfIz8MzqxTHZ3eDBXhz0xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ln5qw59NzrjYEHtPN6ZQMhC2PkZwDEPtQiWcKVmlyJcViJ5pVThkz3V0b09Jsm+A2 6mjmpxOn61lIfRwpg2RQNz4fomdRXlfyt6InXpHROd6CWmJYkAjSgIMWQmhqfcaCvo PtDDfvhObV88qOImQAhZ4QOsZygadUnq2HCRsGWM= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:34 +1100 Message-Id: <20190218143049.17142-29-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 28/43] target/ppc: convert vaddu[b, h, w, d] and vsubu[b, h, w, d] over to use vector operations 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: Richard Henderson , Mark Cave-Ayland , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 8 -------- target/ppc/int_helper.c | 7 ------- target/ppc/translate/vmx-impl.inc.c | 16 ++++++++-------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index c7de04e068..553ff500c8 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -108,14 +108,6 @@ DEF_HELPER_FLAGS_1(ftsqrt, TCG_CALL_NO_RWG_SE, i32, i6= 4) #define dh_ctype_avr ppc_avr_t * #define dh_is_signed_avr dh_is_signed_ptr =20 -DEF_HELPER_3(vaddubm, void, avr, avr, avr) -DEF_HELPER_3(vadduhm, void, avr, avr, avr) -DEF_HELPER_3(vadduwm, void, avr, avr, avr) -DEF_HELPER_3(vaddudm, void, avr, avr, avr) -DEF_HELPER_3(vsububm, void, avr, avr, avr) -DEF_HELPER_3(vsubuhm, void, avr, avr, avr) -DEF_HELPER_3(vsubuwm, void, avr, avr, avr) -DEF_HELPER_3(vsubudm, void, avr, avr, avr) DEF_HELPER_3(vavgub, void, avr, avr, avr) DEF_HELPER_3(vavguh, void, avr, avr, avr) DEF_HELPER_3(vavguw, void, avr, avr, avr) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 8efc283388..ffccda8b9b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -515,13 +515,6 @@ void helper_vprtybq(ppc_avr_t *r, ppc_avr_t *b) r->element[i] =3D a->element[i] op b->element[i]; \ } \ } -#define VARITH(suffix, element) \ - VARITH_DO(add##suffix, +, element) \ - VARITH_DO(sub##suffix, -, element) -VARITH(ubm, u8) -VARITH(uhm, u16) -VARITH(uwm, u32) -VARITH(udm, u64) VARITH_DO(muluwm, *, u32) #undef VARITH_DO #undef VARITH diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index c74932e5ee..b104c6e38e 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -395,18 +395,18 @@ static void glue(gen_, name)(DisasContext *ctx) = \ tcg_temp_free_ptr(rb); \ } =20 -GEN_VXFORM(vaddubm, 0, 0); +GEN_VXFORM_V(vaddubm, MO_8, tcg_gen_gvec_add, 0, 0); GEN_VXFORM_DUAL_EXT(vaddubm, PPC_ALTIVEC, PPC_NONE, 0, \ vmul10cuq, PPC_NONE, PPC2_ISA300, 0x0000F800) -GEN_VXFORM(vadduhm, 0, 1); +GEN_VXFORM_V(vadduhm, MO_16, tcg_gen_gvec_add, 0, 1); GEN_VXFORM_DUAL(vadduhm, PPC_ALTIVEC, PPC_NONE, \ vmul10ecuq, PPC_NONE, PPC2_ISA300) -GEN_VXFORM(vadduwm, 0, 2); -GEN_VXFORM(vaddudm, 0, 3); -GEN_VXFORM(vsububm, 0, 16); -GEN_VXFORM(vsubuhm, 0, 17); -GEN_VXFORM(vsubuwm, 0, 18); -GEN_VXFORM(vsubudm, 0, 19); +GEN_VXFORM_V(vadduwm, MO_32, tcg_gen_gvec_add, 0, 2); +GEN_VXFORM_V(vaddudm, MO_64, tcg_gen_gvec_add, 0, 3); +GEN_VXFORM_V(vsububm, MO_8, tcg_gen_gvec_sub, 0, 16); +GEN_VXFORM_V(vsubuhm, MO_16, tcg_gen_gvec_sub, 0, 17); +GEN_VXFORM_V(vsubuwm, MO_32, tcg_gen_gvec_sub, 0, 18); +GEN_VXFORM_V(vsubudm, MO_64, tcg_gen_gvec_sub, 0, 19); GEN_VXFORM(vmaxub, 1, 0); GEN_VXFORM(vmaxuh, 1, 1); GEN_VXFORM(vmaxuw, 1, 2); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502578094548.8107318725068; Mon, 18 Feb 2019 07:09:38 -0800 (PST) Received: from localhost ([127.0.0.1]:60170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkXz-00032R-Ur for importer@patchew.org; Mon, 18 Feb 2019 10:09:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxu-0006aV-Ie for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxs-0003Ak-Ty for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:14 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:48231) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxr-00034w-W7; Mon, 18 Feb 2019 09:32:12 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s02gYlz9sQt; Tue, 19 Feb 2019 01:31:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500276; bh=PlAcG9ajRT3vv+qMwO0vfunQnxHHh/SDrHvLStAJvQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngTy4ch4mxQSXwc8pMJzxjvhDIhNmnt/l/bSERtDWDXfKspZUdHLT6OZt/Dgs5CHB L5HmWxDUPOxusFe88qYqMaSbB/X8bVHhfbItXB0p8yaDEXoYFU8zCf9Y5CsesP9l/a hY1Z6fRFLfYYDwQPEChQVFUECXOrKaaYGK17AbXQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:35 +1100 Message-Id: <20190218143049.17142-30-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 29/43] target/ppc: convert vspltis[bhw] to use vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Message-Id: <20190215100058.20015-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 3 --- target/ppc/int_helper.c | 15 ------------ target/ppc/translate/vmx-impl.inc.c | 36 +++++++---------------------- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 553ff500c8..2aa60e5d36 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -246,9 +246,6 @@ DEF_HELPER_3(vrld, void, avr, avr, avr) DEF_HELPER_3(vsl, void, avr, avr, avr) DEF_HELPER_3(vsr, void, avr, avr, avr) DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) -DEF_HELPER_2(vspltisb, void, avr, i32) -DEF_HELPER_2(vspltish, void, avr, i32) -DEF_HELPER_2(vspltisw, void, avr, i32) DEF_HELPER_3(vspltb, void, avr, avr, i32) DEF_HELPER_3(vsplth, void, avr, avr, i32) DEF_HELPER_3(vspltw, void, avr, avr, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index ffccda8b9b..2f793a3543 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1998,21 +1998,6 @@ VNEG(vnegw, s32) VNEG(vnegd, s64) #undef VNEG =20 -#define VSPLTI(suffix, element, splat_type) \ - void helper_vspltis##suffix(ppc_avr_t *r, uint32_t splat) \ - { \ - splat_type x =3D (int8_t)(splat << 3) >> 3; \ - int i; \ - \ - for (i =3D 0; i < ARRAY_SIZE(r->element); i++) { \ - r->element[i] =3D x; \ - } \ - } -VSPLTI(b, s8, int8_t) -VSPLTI(h, s16, int16_t) -VSPLTI(w, s32, int32_t) -#undef VSPLTI - #define VSR(suffix, element, mask) \ void helper_vsr##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ { \ diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index b104c6e38e..c26c342e16 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -704,25 +704,21 @@ GEN_VXRFORM_DUAL(vcmpbfp, PPC_ALTIVEC, PPC_NONE, \ GEN_VXRFORM_DUAL(vcmpgtfp, PPC_ALTIVEC, PPC_NONE, \ vcmpgtud, PPC_NONE, PPC2_ALTIVEC_207) =20 -#define GEN_VXFORM_SIMM(name, opc2, opc3) \ +#define GEN_VXFORM_DUPI(name, tcg_op, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ { \ - TCGv_ptr rd; \ - TCGv_i32 simm; \ + int simm; \ if (unlikely(!ctx->altivec_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VPU); \ return; \ } \ - simm =3D tcg_const_i32(SIMM5(ctx->opcode)); \ - rd =3D gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, simm); \ - tcg_temp_free_i32(simm); \ - tcg_temp_free_ptr(rd); \ + simm =3D SIMM5(ctx->opcode); \ + tcg_op(avr64_offset(rD(ctx->opcode), true), 16, 16, simm); \ } =20 -GEN_VXFORM_SIMM(vspltisb, 6, 12); -GEN_VXFORM_SIMM(vspltish, 6, 13); -GEN_VXFORM_SIMM(vspltisw, 6, 14); +GEN_VXFORM_DUPI(vspltisb, tcg_gen_gvec_dup8i, 6, 12); +GEN_VXFORM_DUPI(vspltish, tcg_gen_gvec_dup16i, 6, 13); +GEN_VXFORM_DUPI(vspltisw, tcg_gen_gvec_dup32i, 6, 14); =20 #define GEN_VXFORM_NOA(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) = \ @@ -802,22 +798,6 @@ GEN_VXFORM_NOA(vprtybw, 1, 24); GEN_VXFORM_NOA(vprtybd, 1, 24); GEN_VXFORM_NOA(vprtybq, 1, 24); =20 -#define GEN_VXFORM_SIMM(name, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) = \ - { \ - TCGv_ptr rd; \ - TCGv_i32 simm; \ - if (unlikely(!ctx->altivec_enabled)) { \ - gen_exception(ctx, POWERPC_EXCP_VPU); \ - return; \ - } \ - simm =3D tcg_const_i32(SIMM5(ctx->opcode)); \ - rd =3D gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, simm); \ - tcg_temp_free_i32(simm); \ - tcg_temp_free_ptr(rd); \ - } - #define GEN_VXFORM_UIMM(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) = \ { \ @@ -1240,7 +1220,7 @@ GEN_VXFORM_DUAL(vsldoi, PPC_ALTIVEC, PPC_NONE, #undef GEN_VXRFORM_DUAL #undef GEN_VXRFORM1 #undef GEN_VXRFORM -#undef GEN_VXFORM_SIMM +#undef GEN_VXFORM_DUPI #undef GEN_VXFORM_NOA #undef GEN_VXFORM_UIMM #undef GEN_VAFORM_PAIRED --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503663962875.7576007535421; Mon, 18 Feb 2019 07:27:43 -0800 (PST) Received: from localhost ([127.0.0.1]:60554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkpX-0001g1-Ly for importer@patchew.org; Mon, 18 Feb 2019 10:27:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyF-0006qx-RR for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxw-0003GK-Mk for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:27 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:55463) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxv-0003BR-MX; Mon, 18 Feb 2019 09:32:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s10R1Wz9sRR; Tue, 19 Feb 2019 01:31:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500277; bh=WubUiDDXXur8qFHgUdiC67JJm1jDf1+DCdSvFn1QqUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kx07n7UwHo5HO2TEh2bpG6O+BTWuc0Aqy/opcsO86e+pNas7tPrHOp5cRubtc4/3k BmhHoYHpwiCHs47OXeFTRTjDssnKJKg7neatYpMQL9J7WIgnxrZLwQ4HUOUty2lTTD 7uRdt95ShlUSzGNJnbrmd0qXP25roKty/pEpkhNQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:36 +1100 Message-Id: <20190218143049.17142-31-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 30/43] target/ppc: convert vsplt[bhw] to use vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-5-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 3 -- target/ppc/int_helper.c | 19 ------------ target/ppc/translate/vmx-impl.inc.c | 46 +++++++++++++++++------------ 3 files changed, 27 insertions(+), 41 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 2aa60e5d36..069daa9883 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -246,9 +246,6 @@ DEF_HELPER_3(vrld, void, avr, avr, avr) DEF_HELPER_3(vsl, void, avr, avr, avr) DEF_HELPER_3(vsr, void, avr, avr, avr) DEF_HELPER_4(vsldoi, void, avr, avr, avr, i32) -DEF_HELPER_3(vspltb, void, avr, avr, i32) -DEF_HELPER_3(vsplth, void, avr, avr, i32) -DEF_HELPER_3(vspltw, void, avr, avr, i32) DEF_HELPER_3(vextractub, void, avr, avr, i32) DEF_HELPER_3(vextractuh, void, avr, avr, i32) DEF_HELPER_3(vextractuw, void, avr, avr, i32) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 2f793a3543..5c9623e952 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1869,25 +1869,6 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) #endif } =20 -/* Experimental testing shows that hardware masks the immediate. */ -#define _SPLAT_MASKED(element) (splat & (ARRAY_SIZE(r->element) - 1)) -#define SPLAT_ELEMENT(element) _SPLAT_MASKED(element) -#define VSPLT(suffix, element, access) \ - void helper_vsplt##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t splat) \ - { \ - uint32_t s =3D b->access(SPLAT_ELEMENT(element)); \ - int i; \ - \ - for (i =3D 0; i < ARRAY_SIZE(r->element); i++) { \ - r->access(i) =3D s; \ - } \ - } -VSPLT(b, u8, VsrB) -VSPLT(h, u16, VsrH) -VSPLT(w, u32, VsrW) -#undef VSPLT -#undef SPLAT_ELEMENT -#undef _SPLAT_MASKED #if defined(HOST_WORDS_BIGENDIAN) #define VINSERT(suffix, element) = \ void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index= ) \ diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index c26c342e16..41ddbd879f 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -798,24 +798,32 @@ GEN_VXFORM_NOA(vprtybw, 1, 24); GEN_VXFORM_NOA(vprtybd, 1, 24); GEN_VXFORM_NOA(vprtybq, 1, 24); =20 -#define GEN_VXFORM_UIMM(name, opc2, opc3) \ -static void glue(gen_, name)(DisasContext *ctx) = \ - { \ - TCGv_ptr rb, rd; \ - TCGv_i32 uimm; \ - if (unlikely(!ctx->altivec_enabled)) { \ - gen_exception(ctx, POWERPC_EXCP_VPU); \ - return; \ - } \ - uimm =3D tcg_const_i32(UIMM5(ctx->opcode)); \ - rb =3D gen_avr_ptr(rB(ctx->opcode)); \ - rd =3D gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, rb, uimm); \ - tcg_temp_free_i32(uimm); \ - tcg_temp_free_ptr(rb); \ - tcg_temp_free_ptr(rd); \ +static void gen_vsplt(DisasContext *ctx, int vece) +{ + int uimm, dofs, bofs; + + if (unlikely(!ctx->altivec_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VPU); + return; } =20 + uimm =3D UIMM5(ctx->opcode); + bofs =3D avr64_offset(rB(ctx->opcode), true); + dofs =3D avr64_offset(rD(ctx->opcode), true); + + /* Experimental testing shows that hardware masks the immediate. */ + bofs +=3D (uimm << vece) & 15; +#ifndef HOST_WORDS_BIGENDIAN + bofs ^=3D 15; + bofs &=3D ~((1 << vece) - 1); +#endif + + tcg_gen_gvec_dup_mem(vece, dofs, bofs, 16, 16); +} + +#define GEN_VXFORM_VSPLT(name, vece, opc2, opc3) \ +static void glue(gen_, name)(DisasContext *ctx) { gen_vsplt(ctx, vece); } + #define GEN_VXFORM_UIMM_ENV(name, opc2, opc3) \ static void glue(gen_, name)(DisasContext *ctx) \ { \ @@ -858,9 +866,9 @@ static void glue(gen_, name)(DisasContext *ctx) = \ tcg_temp_free_ptr(rd); \ } =20 -GEN_VXFORM_UIMM(vspltb, 6, 8); -GEN_VXFORM_UIMM(vsplth, 6, 9); -GEN_VXFORM_UIMM(vspltw, 6, 10); +GEN_VXFORM_VSPLT(vspltb, MO_8, 6, 8); +GEN_VXFORM_VSPLT(vsplth, MO_16, 6, 9); +GEN_VXFORM_VSPLT(vspltw, MO_32, 6, 10); GEN_VXFORM_UIMM_SPLAT(vextractub, 6, 8, 15); GEN_VXFORM_UIMM_SPLAT(vextractuh, 6, 9, 14); GEN_VXFORM_UIMM_SPLAT(vextractuw, 6, 10, 12); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503450788349.84161495115757; Mon, 18 Feb 2019 07:24:10 -0800 (PST) Received: from localhost ([127.0.0.1]:60441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkm4-00077X-Gh for importer@patchew.org; Mon, 18 Feb 2019 10:24:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxw-0006ch-Hk for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxt-0003Bg-Gu for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:16 -0500 Received: from ozlabs.org ([203.11.71.1]:35709) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxs-00038z-8g; Mon, 18 Feb 2019 09:32:13 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s05q6Xz9sRQ; Tue, 19 Feb 2019 01:31:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500276; bh=IpQLKVTonX96XBiQgzaJBL6YAZ1p1M2fpTVxrTKQlUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbxduOEKTjFzwytgxC3JkaeID+NSE+BXgmiKeaVNlnPJrZwwSZa6vUvKNP9tCaz1B 21b57ej1BX+WR6txs3BNKL9m6yuYn/evrgsIeERfiJZq9ORIls0W+bdT4fM282U2aF x1ZbPkNWLgIHuVimy66OgcAfY9fIEe4cJqb/g9sQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:37 +1100 Message-Id: <20190218143049.17142-32-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 31/43] target/ppc: convert VSX logical operations to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-6-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 43 ++++++++++++----------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index ed4fdceacf..2576d81ac5 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -10,6 +10,11 @@ static inline void set_vsr(int n, TCGv_i64 src) tcg_gen_st_i64(src, cpu_env, offsetof(CPUPPCState, vsr[n].u64[1])); } =20 +static inline int vsr_full_offset(int n) +{ + return offsetof(CPUPPCState, vsr[n].u64[0]); +} + static inline void get_cpu_vsrh(TCGv_i64 dst, int n) { if (n < 32) { @@ -1255,40 +1260,26 @@ static void gen_xxbrw(DisasContext *ctx) tcg_temp_free_i64(xbl); } =20 -#define VSX_LOGICAL(name, tcg_op) \ +#define VSX_LOGICAL(name, vece, tcg_op) \ static void glue(gen_, name)(DisasContext * ctx) \ { \ - TCGv_i64 t0; \ - TCGv_i64 t1; \ - TCGv_i64 t2; \ if (unlikely(!ctx->vsx_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VSXU); \ return; \ } \ - t0 =3D tcg_temp_new_i64(); \ - t1 =3D tcg_temp_new_i64(); \ - t2 =3D tcg_temp_new_i64(); \ - get_cpu_vsrh(t0, xA(ctx->opcode)); \ - get_cpu_vsrh(t1, xB(ctx->opcode)); \ - tcg_op(t2, t0, t1); \ - set_cpu_vsrh(xT(ctx->opcode), t2); \ - get_cpu_vsrl(t0, xA(ctx->opcode)); \ - get_cpu_vsrl(t1, xB(ctx->opcode)); \ - tcg_op(t2, t0, t1); \ - set_cpu_vsrl(xT(ctx->opcode), t2); \ - tcg_temp_free_i64(t0); \ - tcg_temp_free_i64(t1); \ - tcg_temp_free_i64(t2); \ + tcg_op(vece, vsr_full_offset(xT(ctx->opcode)), \ + vsr_full_offset(xA(ctx->opcode)), \ + vsr_full_offset(xB(ctx->opcode)), 16, 16); \ } =20 -VSX_LOGICAL(xxland, tcg_gen_and_i64) -VSX_LOGICAL(xxlandc, tcg_gen_andc_i64) -VSX_LOGICAL(xxlor, tcg_gen_or_i64) -VSX_LOGICAL(xxlxor, tcg_gen_xor_i64) -VSX_LOGICAL(xxlnor, tcg_gen_nor_i64) -VSX_LOGICAL(xxleqv, tcg_gen_eqv_i64) -VSX_LOGICAL(xxlnand, tcg_gen_nand_i64) -VSX_LOGICAL(xxlorc, tcg_gen_orc_i64) +VSX_LOGICAL(xxland, MO_64, tcg_gen_gvec_and) +VSX_LOGICAL(xxlandc, MO_64, tcg_gen_gvec_andc) +VSX_LOGICAL(xxlor, MO_64, tcg_gen_gvec_or) +VSX_LOGICAL(xxlxor, MO_64, tcg_gen_gvec_xor) +VSX_LOGICAL(xxlnor, MO_64, tcg_gen_gvec_nor) +VSX_LOGICAL(xxleqv, MO_64, tcg_gen_gvec_eqv) +VSX_LOGICAL(xxlnand, MO_64, tcg_gen_gvec_nand) +VSX_LOGICAL(xxlorc, MO_64, tcg_gen_gvec_orc) =20 #define VSX_XXMRG(name, high) \ static void glue(gen_, name)(DisasContext * ctx) \ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502944349847.2986886098088; Mon, 18 Feb 2019 07:15:44 -0800 (PST) Received: from localhost ([127.0.0.1]:60310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkdw-0000JA-7Y for importer@patchew.org; Mon, 18 Feb 2019 10:15:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-00078D-69 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003Ys-Hz for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:39379) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyW-0003C9-27; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s157Z1z9sRW; Tue, 19 Feb 2019 01:31:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500277; bh=l/uZnwapLXCAmSRW+SLynhpQG35UrcsG7sMrQKApUc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nM/aErQvBDHwAsTyQVEZ/ki8hIN4/dayJb0M15H+ZFfyWMMr6Ozg97v72YdHzjQeo Msefz9Q56mypIDsCvLP2BmkFI1txLHEWEO0AbBA3WQDMJXRTIB+TqpuO7hyQoPf8Qz rj1ZBmEv0ECEeexIJCwNH91dqTFG30l4LZxkYddc= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:38 +1100 Message-Id: <20190218143049.17142-33-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 32/43] target/ppc: convert xxspltib to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-7-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 2576d81ac5..944fc0608a 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1397,9 +1397,10 @@ static void gen_xxspltw(DisasContext *ctx) =20 static void gen_xxspltib(DisasContext *ctx) { - unsigned char uim8 =3D IMM8(ctx->opcode); - TCGv_i64 vsr; - if (xS(ctx->opcode) < 32) { + uint8_t uim8 =3D IMM8(ctx->opcode); + int rt =3D xT(ctx->opcode); + + if (rt < 32) { if (unlikely(!ctx->altivec_enabled)) { gen_exception(ctx, POWERPC_EXCP_VPU); return; @@ -1410,11 +1411,7 @@ static void gen_xxspltib(DisasContext *ctx) return; } } - vsr =3D tcg_temp_new_i64(); - tcg_gen_movi_i64(vsr, pattern(uim8)); - set_cpu_vsrh(xT(ctx->opcode), vsr); - set_cpu_vsrl(xT(ctx->opcode), vsr); - tcg_temp_free_i64(vsr); + tcg_gen_gvec_dup8i(vsr_full_offset(rt), 16, 16, uim8); } =20 static void gen_xxsldwi(DisasContext *ctx) --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502827820482.2154848440251; Mon, 18 Feb 2019 07:13:47 -0800 (PST) Received: from localhost ([127.0.0.1]:60248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkc2-0006mQ-OB for importer@patchew.org; Mon, 18 Feb 2019 10:13:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyD-0006oM-E6 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxv-0003Ff-RV for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:23 -0500 Received: from ozlabs.org ([203.11.71.1]:52887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxv-0003BL-CU; Mon, 18 Feb 2019 09:32:15 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s12hWRz9sPc; Tue, 19 Feb 2019 01:31:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500277; bh=9CbsTN7zMnIBmdU3wrzDYYYfH6VFlUgeu8hBq9gZFik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bCoqZ9uFDfknpDANdlxaSzs3o5/+X9SGgrpWH/P0z3i9EseX4Z8o2HuzemXB1XpbY q+LsivLuLzHNYlj1FTMEFbWSF5BpidWvZrLo5wTRlve3uBhin+tObaQLOGBEApYMg1 LkZ7ijBUvsZlaTzBlzySQZNoepcwh6VQOwHvWsAQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:39 +1100 Message-Id: <20190218143049.17142-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 33/43] target/ppc: convert xxspltw to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-8-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 36 +++++++++-------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 944fc0608a..0e8cecb00a 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1359,38 +1359,24 @@ static void gen_xxsel(DisasContext * ctx) =20 static void gen_xxspltw(DisasContext *ctx) { - TCGv_i64 b, b2; - TCGv_i64 vsr; + int rt =3D xT(ctx->opcode); + int rb =3D xB(ctx->opcode); + int uim =3D UIM(ctx->opcode); + int tofs, bofs; =20 if (unlikely(!ctx->vsx_enabled)) { gen_exception(ctx, POWERPC_EXCP_VSXU); return; } =20 - vsr =3D tcg_temp_new_i64(); - if (UIM(ctx->opcode) & 2) { - get_cpu_vsrl(vsr, xB(ctx->opcode)); - } else { - get_cpu_vsrh(vsr, xB(ctx->opcode)); - } - - b =3D tcg_temp_new_i64(); - b2 =3D tcg_temp_new_i64(); - - if (UIM(ctx->opcode) & 1) { - tcg_gen_ext32u_i64(b, vsr); - } else { - tcg_gen_shri_i64(b, vsr, 32); - } - - tcg_gen_shli_i64(b2, b, 32); - tcg_gen_or_i64(vsr, b, b2); - set_cpu_vsrh(xT(ctx->opcode), vsr); - set_cpu_vsrl(xT(ctx->opcode), vsr); + tofs =3D vsr_full_offset(rt); + bofs =3D vsr_full_offset(rb); + bofs +=3D uim << MO_32; +#ifndef HOST_WORDS_BIG_ENDIAN + bofs ^=3D 8 | 4; +#endif =20 - tcg_temp_free_i64(vsr); - tcg_temp_free_i64(b); - tcg_temp_free_i64(b2); + tcg_gen_gvec_dup_mem(MO_32, tofs, bofs, 16, 16); } =20 #define pattern(x) (((x) & 0xff) * (~(uint64_t)0 / 0xff)) --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503447186769.6011412049176; Mon, 18 Feb 2019 07:24:07 -0800 (PST) Received: from localhost ([127.0.0.1]:60437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkm1-00075C-1N for importer@patchew.org; Mon, 18 Feb 2019 10:24:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjye-0007Fe-P4 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:33:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyd-0003es-UY for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:33:00 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:34983) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyd-0003DA-H4; Mon, 18 Feb 2019 09:32:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s23BN7z9sRY; Tue, 19 Feb 2019 01:31:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500278; bh=euRyDtQkQGHZFeeOzuy1J579rlrETAxJoHQij8WW8uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqhpZcIKqTslv4a2MCzXBt6LzDDzfngKD/dK2JFxOqeo8CVAeY/luMtPgRpXakCo0 ovNXOT+G0oi1Y7mSCOZjMmQhzgCp6YoU6hwmdjTExbPQtCNjfjw7T2pU9n+I6ki2cg bwTwe4qu3FK3LWZlaQi7I86utfooZaBQAY8YJWmQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:40 +1100 Message-Id: <20190218143049.17142-35-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 34/43] target/ppc: convert xxsel to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-9-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate/vsx-impl.inc.c | 55 ++++++++++++++--------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 0e8cecb00a..e73197e717 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -1321,40 +1321,39 @@ static void glue(gen_, name)(DisasContext * ctx) = \ VSX_XXMRG(xxmrghw, 1) VSX_XXMRG(xxmrglw, 0) =20 -static void gen_xxsel(DisasContext * ctx) +static void xxsel_i64(TCGv_i64 t, TCGv_i64 a, TCGv_i64 b, TCGv_i64 c) { - TCGv_i64 a, b, c, tmp; - if (unlikely(!ctx->vsx_enabled)) { - gen_exception(ctx, POWERPC_EXCP_VSXU); - return; - } - a =3D tcg_temp_new_i64(); - b =3D tcg_temp_new_i64(); - c =3D tcg_temp_new_i64(); - tmp =3D tcg_temp_new_i64(); - - get_cpu_vsrh(a, xA(ctx->opcode)); - get_cpu_vsrh(b, xB(ctx->opcode)); - get_cpu_vsrh(c, xC(ctx->opcode)); - tcg_gen_and_i64(b, b, c); tcg_gen_andc_i64(a, a, c); - tcg_gen_or_i64(tmp, a, b); - set_cpu_vsrh(xT(ctx->opcode), tmp); + tcg_gen_or_i64(t, a, b); +} =20 - get_cpu_vsrl(a, xA(ctx->opcode)); - get_cpu_vsrl(b, xB(ctx->opcode)); - get_cpu_vsrl(c, xC(ctx->opcode)); +static void xxsel_vec(unsigned vece, TCGv_vec t, TCGv_vec a, + TCGv_vec b, TCGv_vec c) +{ + tcg_gen_and_vec(vece, b, b, c); + tcg_gen_andc_vec(vece, a, a, c); + tcg_gen_or_vec(vece, t, a, b); +} =20 - tcg_gen_and_i64(b, b, c); - tcg_gen_andc_i64(a, a, c); - tcg_gen_or_i64(tmp, a, b); - set_cpu_vsrl(xT(ctx->opcode), tmp); +static void gen_xxsel(DisasContext *ctx) +{ + static const GVecGen4 g =3D { + .fni8 =3D xxsel_i64, + .fniv =3D xxsel_vec, + .vece =3D MO_64, + }; + int rt =3D xT(ctx->opcode); + int ra =3D xA(ctx->opcode); + int rb =3D xB(ctx->opcode); + int rc =3D xC(ctx->opcode); =20 - tcg_temp_free_i64(a); - tcg_temp_free_i64(b); - tcg_temp_free_i64(c); - tcg_temp_free_i64(tmp); + if (unlikely(!ctx->vsx_enabled)) { + gen_exception(ctx, POWERPC_EXCP_VSXU); + return; + } + tcg_gen_gvec_4(vsr_full_offset(rt), vsr_full_offset(ra), + vsr_full_offset(rb), vsr_full_offset(rc), 16, 16, &g); } =20 static void gen_xxspltw(DisasContext *ctx) --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503099593179.57073300662648; Mon, 18 Feb 2019 07:18:19 -0800 (PST) Received: from localhost ([127.0.0.1]:60337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkgO-0002YC-7f for importer@patchew.org; Mon, 18 Feb 2019 10:18:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-000786-2a for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003YE-4P for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:40343) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyV-0003Cu-LU; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s223S0z9sRc; Tue, 19 Feb 2019 01:31:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500278; bh=wWeJX6kiKqIb3Z0jPOtU5580gOTCe1HMpkmz26Aj5tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nj8euyjraW6lgefnu6VsFGizwjDUDw98ee9FQCiMHfAqZZ89wuILTL6G+tGeJdsY2 pP/OyO1zFDp/lswAAvu0japBjqFPb5mBFKS+INqwrlXFr9WDycnPWD0NdbE/1k/Qh9 M7YNAfF1/tqgQq/9ZByz9LZYzxV0W3KPd5e2MzHk= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:41 +1100 Message-Id: <20190218143049.17142-36-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 35/43] target/ppc: Pass integer to helper_mtvscr 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson We can re-use this helper elsewhere if we're not passing in an entire vector register. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-10-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 2 +- target/ppc/int_helper.c | 6 +++--- target/ppc/translate/vmx-impl.inc.c | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 069daa9883..b3ffe28103 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -294,7 +294,7 @@ DEF_HELPER_5(vmsumuhs, void, env, avr, avr, avr, avr) DEF_HELPER_5(vmsumshm, void, env, avr, avr, avr, avr) DEF_HELPER_5(vmsumshs, void, env, avr, avr, avr, avr) DEF_HELPER_4(vmladduhm, void, avr, avr, avr, avr) -DEF_HELPER_2(mtvscr, void, env, avr) +DEF_HELPER_FLAGS_2(mtvscr, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_3(lvebx, void, env, avr, tl) DEF_HELPER_3(lvehx, void, env, avr, tl) DEF_HELPER_3(lvewx, void, env, avr, tl) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 5c9623e952..aa6ad2ce7e 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -457,10 +457,10 @@ void helper_lvsr(ppc_avr_t *r, target_ulong sh) } } =20 -void helper_mtvscr(CPUPPCState *env, ppc_avr_t *r) +void helper_mtvscr(CPUPPCState *env, uint32_t vscr) { - env->vscr =3D r->VsrW(3); - set_flush_to_zero(vscr_nj, &env->vec_status); + env->vscr =3D vscr; + set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status); } =20 void helper_vaddcuw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 41ddbd879f..182d3fc563 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -196,14 +196,23 @@ static void gen_mfvscr(DisasContext *ctx) =20 static void gen_mtvscr(DisasContext *ctx) { - TCGv_ptr p; + TCGv_i32 val; + int bofs; + if (unlikely(!ctx->altivec_enabled)) { gen_exception(ctx, POWERPC_EXCP_VPU); return; } - p =3D gen_avr_ptr(rB(ctx->opcode)); - gen_helper_mtvscr(cpu_env, p); - tcg_temp_free_ptr(p); + + val =3D tcg_temp_new_i32(); + bofs =3D avr64_offset(rB(ctx->opcode), true); +#ifdef HOST_WORDS_BIGENDIAN + bofs +=3D 3 * 4; +#endif + + tcg_gen_ld_i32(val, cpu_env, bofs); + gen_helper_mtvscr(cpu_env, val); + tcg_temp_free_i32(val); } =20 #define GEN_VX_VMUL10(name, add_cin, ret_carry) \ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502661076713.3688441240432; Mon, 18 Feb 2019 07:11:01 -0800 (PST) Received: from localhost ([127.0.0.1]:60211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkZL-0004Fz-QB for importer@patchew.org; Mon, 18 Feb 2019 10:10:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyD-0006oP-Eh for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxw-0003GP-NH for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:23 -0500 Received: from ozlabs.org ([203.11.71.1]:52421) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxw-0003CZ-0d; Mon, 18 Feb 2019 09:32:16 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s205yCz9sPd; Tue, 19 Feb 2019 01:31:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500278; bh=iEJRs2mtmGZ+SyiAKeopd4SgnrMyKKrs4KjGZTpPGbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAVCn2+AMWeRrEAyfo5E50IxkC8CHVFS7gyCUthvF5HNA6kS/Uopsp21xyHfjaJqz apcGmk+CSbSfB9e38TJtnyZepVQyXQWrO58CnM7QDnBmxpsIB86PuDjfA/KJn1yYrj fFFriH3yIzMfPpZstW1g3sFYf3u60CUY35ahh978= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:42 +1100 Message-Id: <20190218143049.17142-37-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 36/43] target/ppc: Use helper_mtvscr for reset and gdb 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Not setting flush_to_zero from gdb_set_avr_reg was a bug. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-11-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/translate_init.inc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index c9985c0d22..ee574b342e 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -601,10 +601,9 @@ static void spr_write_excp_vector(DisasContext *ctx, i= nt sprn, int gprn) =20 static inline void vscr_init(CPUPPCState *env, uint32_t val) { - env->vscr =3D val; /* Altivec always uses round-to-nearest */ set_float_rounding_mode(float_round_nearest_even, &env->vec_status); - set_flush_to_zero(vscr_nj, &env->vec_status); + helper_mtvscr(env, val); } =20 #ifdef CONFIG_USER_ONLY @@ -9603,7 +9602,7 @@ static int gdb_set_avr_reg(CPUPPCState *env, uint8_t = *mem_buf, int n) } if (n =3D=3D 32) { ppc_maybe_bswap_register(env, mem_buf, 4); - env->vscr =3D ldl_p(mem_buf); + helper_mtvscr(env, ldl_p(mem_buf)); return 4; } if (n =3D=3D 33) { --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15505031536171010.92398450902; Mon, 18 Feb 2019 07:19:13 -0800 (PST) Received: from localhost ([127.0.0.1]:60343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkhE-0003BA-R0 for importer@patchew.org; Mon, 18 Feb 2019 10:19:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-000789-5G for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003Z4-Jt for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:34139) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyV-0003Fw-Vm; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s33H50z9sRV; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=QZDF9bsVYmotPRYvh0MZNvS8Ocj2KcsIs8eeCe9JUQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZrd64iBaYlJ4IKTQlOCelqoXwnWg/kLPauMvB8QX7t1G/nFOnkZ5t7Gt6BMGYqIs 5wnDba9OMRyuDCX3jeeq7rv49fQ68mW0B1mxESTlcKDQLWDOYmK+8vJINnsxkjs7Da ZAH0aswGPbr3RIMpxIRlGwRJHvDImHZis5jeATMI= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:43 +1100 Message-Id: <20190218143049.17142-38-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 37/43] target/ppc: Remove vscr_nj and vscr_sat 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson These macros are no longer used. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-12-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/cpu.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 78af7e4608..1c883fa836 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -689,8 +689,6 @@ enum { /* Vector status and control register */ #define VSCR_NJ 16 /* Vector non-java */ #define VSCR_SAT 0 /* Vector saturation */ -#define vscr_nj (((env->vscr) >> VSCR_NJ) & 0x1) -#define vscr_sat (((env->vscr) >> VSCR_SAT) & 0x1) =20 /*************************************************************************= ****/ /* BookE e500 MMU registers */ --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503847662334.29696655291684; Mon, 18 Feb 2019 07:30:47 -0800 (PST) Received: from localhost ([127.0.0.1]:60620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvksV-0003iy-GQ for importer@patchew.org; Mon, 18 Feb 2019 10:30:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyZ-0007AH-Sk for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyY-0003af-H3 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:46273) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyX-0003Gg-OZ; Mon, 18 Feb 2019 09:32:54 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s35DG9z9sRd; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=qMVNghwDiAdQeTyLXZkLNEGqOtqDcvrhaUV15aEGm7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmtBb6p+HKuFiuy0XG0YgyvlIeY0G3ZuBQVBY+KNdFS9ALz/d76jKHGJneHjSOPJY tH435dlSjMVKmxiYalnvC74A7D6drre3XyWe7kj+kBP4iVXbKQUYwSxfowse/ahQHJ ceOTuRaRNWzwxk/5dUsKFyHmsiuu2x5o6WlKKkKA= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:44 +1100 Message-Id: <20190218143049.17142-39-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 38/43] target/ppc: Add helper_mfvscr 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson This is required before changing the representation of the register. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-13-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/arch_dump.c | 3 ++- target/ppc/helper.h | 1 + target/ppc/int_helper.c | 5 +++++ target/ppc/translate/vmx-impl.inc.c | 2 +- target/ppc/translate_init.inc.c | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index 3a00606d01..9ab04b2c38 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -17,6 +17,7 @@ #include "elf.h" #include "sysemu/dump.h" #include "sysemu/kvm.h" +#include "exec/helper-proto.h" =20 #ifdef TARGET_PPC64 #define ELFCLASS ELFCLASS64 @@ -175,7 +176,7 @@ static void ppc_write_elf_vmxregset(NoteFuncArg *arg, P= owerPCCPU *cpu) vmxregset->avr[i].u64[1] =3D avr->u64[1]; } } - vmxregset->vscr.u32[3] =3D cpu_to_dump32(s, cpu->env.vscr); + vmxregset->vscr.u32[3] =3D cpu_to_dump32(s, helper_mfvscr(&cpu->env)); } =20 static void ppc_write_elf_vsxregset(NoteFuncArg *arg, PowerPCCPU *cpu) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index b3ffe28103..7dbb08b9dd 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -295,6 +295,7 @@ DEF_HELPER_5(vmsumshm, void, env, avr, avr, avr, avr) DEF_HELPER_5(vmsumshs, void, env, avr, avr, avr, avr) DEF_HELPER_4(vmladduhm, void, avr, avr, avr, avr) DEF_HELPER_FLAGS_2(mtvscr, TCG_CALL_NO_RWG, void, env, i32) +DEF_HELPER_FLAGS_1(mfvscr, TCG_CALL_NO_RWG, i32, env) DEF_HELPER_3(lvebx, void, env, avr, tl) DEF_HELPER_3(lvehx, void, env, avr, tl) DEF_HELPER_3(lvewx, void, env, avr, tl) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index aa6ad2ce7e..ec3ef9ff3f 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -463,6 +463,11 @@ void helper_mtvscr(CPUPPCState *env, uint32_t vscr) set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status); } =20 +uint32_t helper_mfvscr(CPUPPCState *env) +{ + return env->vscr; +} + void helper_vaddcuw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 182d3fc563..5e13edbf53 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -187,7 +187,7 @@ static void gen_mfvscr(DisasContext *ctx) tcg_gen_movi_i64(avr, 0); set_avr64(rD(ctx->opcode), avr, true); t =3D tcg_temp_new_i32(); - tcg_gen_ld_i32(t, cpu_env, offsetof(CPUPPCState, vscr)); + gen_helper_mfvscr(t, cpu_env); tcg_gen_extu_i32_i64(avr, t); set_avr64(rD(ctx->opcode), avr, false); tcg_temp_free_i32(t); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index ee574b342e..1657d88341 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9573,7 +9573,7 @@ static int gdb_get_avr_reg(CPUPPCState *env, uint8_t = *mem_buf, int n) return 16; } if (n =3D=3D 32) { - stl_p(mem_buf, env->vscr); + stl_p(mem_buf, helper_mfvscr(env)); ppc_maybe_bswap_register(env, mem_buf, 4); return 4; } --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502964928785.1320868801853; Mon, 18 Feb 2019 07:16:04 -0800 (PST) Received: from localhost ([127.0.0.1]:60315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkeH-0000g7-KV for importer@patchew.org; Mon, 18 Feb 2019 10:16:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyF-0006qy-Ro for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxx-0003Gx-Gg for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:27 -0500 Received: from ozlabs.org ([203.11.71.1]:52461) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxw-0003Ds-QR; Mon, 18 Feb 2019 09:32:17 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s30k9Dz9sQm; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=3dZ+99kwfp6L+lvyxQtGfMWD/0+jLACIq9+NuLPc/dM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1v4W3Bv06d6KeBsQoW8dqjNqsW/h6O3mHCX1/koEnGKbKeaxlw36+eQ0NxQr3lkW FG2YZ2eHIrQa+4gqXuluJNDCh07Se6lhRb7CIAlYrFk6AFg9yjD4YtWYemyNVU0ETV 984otIMwCuJ7iUf5ZfievQfWDsNMYLcqX3Ag450Y= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:45 +1100 Message-Id: <20190218143049.17142-40-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 39/43] target/ppc: Use mtvscr/mfvscr for vmstate 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson This is required before changing the representation of the register. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-14-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/machine.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index eff30053b0..756b6d2971 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -10,6 +10,7 @@ #include "migration/cpu.h" #include "qapi/error.h" #include "kvm_ppc.h" +#include "exec/helper-proto.h" =20 static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) { @@ -17,7 +18,7 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int ve= rsion_id) CPUPPCState *env =3D &cpu->env; unsigned int i, j; target_ulong sdr1; - uint32_t fpscr; + uint32_t fpscr, vscr; #if defined(TARGET_PPC64) int32_t slb_nr; #endif @@ -84,7 +85,8 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int ve= rsion_id) if (!cpu->vhyp) { ppc_store_sdr1(env, sdr1); } - qemu_get_be32s(f, &env->vscr); + qemu_get_be32s(f, &vscr); + helper_mtvscr(env, vscr); qemu_get_be64s(f, &env->spe_acc); qemu_get_be32s(f, &env->spe_fscr); qemu_get_betls(f, &env->msr_mask); @@ -429,6 +431,28 @@ static bool altivec_needed(void *opaque) return (cpu->env.insns_flags & PPC_ALTIVEC); } =20 +static int get_vscr(QEMUFile *f, void *opaque, size_t size, + const VMStateField *field) +{ + PowerPCCPU *cpu =3D opaque; + helper_mtvscr(&cpu->env, qemu_get_be32(f)); + return 0; +} + +static int put_vscr(QEMUFile *f, void *opaque, size_t size, + const VMStateField *field, QJSON *vmdesc) +{ + PowerPCCPU *cpu =3D opaque; + qemu_put_be32(f, helper_mfvscr(&cpu->env)); + return 0; +} + +static const VMStateInfo vmstate_vscr =3D { + .name =3D "cpu/altivec/vscr", + .get =3D get_vscr, + .put =3D put_vscr, +}; + static const VMStateDescription vmstate_altivec =3D { .name =3D "cpu/altivec", .version_id =3D 1, @@ -436,7 +460,21 @@ static const VMStateDescription vmstate_altivec =3D { .needed =3D altivec_needed, .fields =3D (VMStateField[]) { VMSTATE_AVR_ARRAY(env.vsr, PowerPCCPU, 32), - VMSTATE_UINT32(env.vscr, PowerPCCPU), + /* + * Save the architecture value of the vscr, not the internally + * expanded version. Since this architecture value does not + * exist in memory to be stored, this requires a but of hoop + * jumping. We want OFFSET=3D0 so that we effectively pass CPU + * to the helper functions. + */ + { + .name =3D "vscr", + .version_id =3D 0, + .size =3D sizeof(uint32_t), + .info =3D &vmstate_vscr, + .flags =3D VMS_SINGLE, + .offset =3D 0 + }, VMSTATE_END_OF_LIST() }, }; --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503782565767.1074107773082; Mon, 18 Feb 2019 07:29:42 -0800 (PST) Received: from localhost ([127.0.0.1]:60580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkrP-0002z2-IU for importer@patchew.org; Mon, 18 Feb 2019 10:29:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-00078O-AX for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003YN-80 for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([203.11.71.1]:48193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyV-0003DB-I0; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s24KNzz9sPl; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500278; bh=4N9M6Jo+jUM9P9qqQvopfFA5r2bjZ607uhJzd7kzerM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m50U0aADGWjLCcxHuqUtn97RPIHzffQyVRPMIn+UGjX11tFIyZoQnAI6yWS5yFppc wm2m5818gfPkvwzsOrX1LDtTetqqxkLMP9r3yKUdJIwKikWkhyNElQj7fwS5Wqa7fF wojMO8aa1glTF6+UXwj9l3DTxl3nrjBHukI/9RF8= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:46 +1100 Message-Id: <20190218143049.17142-41-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 40/43] target/ppc: Add set_vscr_sat 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson This is required before changing the representation of the register. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-15-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/int_helper.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index ec3ef9ff3f..1d8a4b530b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -468,6 +468,11 @@ uint32_t helper_mfvscr(CPUPPCState *env) return env->vscr; } =20 +static inline void set_vscr_sat(CPUPPCState *env) +{ + env->vscr |=3D 1 << VSCR_SAT; +} + void helper_vaddcuw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { int i; @@ -581,7 +586,7 @@ VARITHFPFMA(nmsubfp, float_muladd_negate_result | float= _muladd_negate_c); } \ } \ if (sat) { \ - env->vscr |=3D (1 << VSCR_SAT); \ + set_vscr_sat(env); \ } \ } #define VARITHSAT_SIGNED(suffix, element, optype, cvt) \ @@ -853,7 +858,7 @@ void helper_vcmpbfp_dot(CPUPPCState *env, ppc_avr_t *r,= ppc_avr_t *a, } \ } \ if (sat) { \ - env->vscr |=3D (1 << VSCR_SAT); \ + set_vscr_sat(env); \ } \ } VCT(uxs, cvtsduw, u32) @@ -900,7 +905,7 @@ void helper_vmhaddshs(CPUPPCState *env, ppc_avr_t *r, p= pc_avr_t *a, } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -917,7 +922,7 @@ void helper_vmhraddshs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -1029,7 +1034,7 @@ void helper_vmsumshs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -1082,7 +1087,7 @@ void helper_vmsumuhs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -1599,7 +1604,7 @@ void helper_vpkpx(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) } \ *r =3D result; \ if (dosat && sat) { \ - env->vscr |=3D (1 << VSCR_SAT); \ + set_vscr_sat(env); \ } \ } #define I(x, y) (x) @@ -2043,7 +2048,7 @@ void helper_vsumsws(CPUPPCState *env, ppc_avr_t *r, p= pc_avr_t *a, ppc_avr_t *b) *r =3D result; =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -2066,7 +2071,7 @@ void helper_vsum2sws(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) =20 *r =3D result; if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -2085,7 +2090,7 @@ void helper_vsum4sbs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -2102,7 +2107,7 @@ void helper_vsum4shs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 @@ -2121,7 +2126,7 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) } =20 if (sat) { - env->vscr |=3D (1 << VSCR_SAT); + set_vscr_sat(env); } } =20 --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550502383790917.2576262548911; Mon, 18 Feb 2019 07:06:23 -0800 (PST) Received: from localhost ([127.0.0.1]:60130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkUt-0000Pk-Md for importer@patchew.org; Mon, 18 Feb 2019 10:06:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-00078K-9K for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003Yy-IR for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([2401:3900:2:1::2]:35565) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyV-0003HO-Ud; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s36xsCz9sNp; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=SbFTW5ArUtzfEMNfc+DBJyifayJX+tu5Lp1EoIkfjWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyMGAJOO8145/FO+/TMohslqmPc1pJeCtLPkhXCxAjZUUNvLNtnhKpmz+CMJUAvZm Dt0Pa+R/60ekrzBlMubxo+ws9hRVD7MLfLM1/5uU1mu488vnl4oFKRT79BXUp1UeHS taXECYcQonmS+2khgMUeZaIrl4xZCZGmn0rUVEsQ= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:47 +1100 Message-Id: <20190218143049.17142-42-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 41/43] target/ppc: Split out VSCR_SAT to a vector field 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Change the representation of VSCR_SAT such that it is easy to set from vector code. Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-16-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/cpu.h | 4 +++- target/ppc/int_helper.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 1c883fa836..325ebbeb98 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1052,10 +1052,12 @@ struct CPUPPCState { /* Special purpose registers */ target_ulong spr[1024]; ppc_spr_t spr_cb[1024]; - /* Vector status and control register */ + /* Vector status and control register, minus VSCR_SAT. */ uint32_t vscr; /* VSX registers (including FP and AVR) */ ppc_vsr_t vsr[64] QEMU_ALIGNED(16); + /* Non-zero if and only if VSCR_SAT should be set. */ + ppc_vsr_t vscr_sat QEMU_ALIGNED(16); /* SPE registers */ uint64_t spe_acc; uint32_t spe_fscr; diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 1d8a4b530b..6ad596a08b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -459,18 +459,23 @@ void helper_lvsr(ppc_avr_t *r, target_ulong sh) =20 void helper_mtvscr(CPUPPCState *env, uint32_t vscr) { - env->vscr =3D vscr; + env->vscr =3D vscr & ~(1u << VSCR_SAT); + /* Which bit we set is completely arbitrary, but clear the rest. */ + env->vscr_sat.u64[0] =3D vscr & (1u << VSCR_SAT); + env->vscr_sat.u64[1] =3D 0; set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status); } =20 uint32_t helper_mfvscr(CPUPPCState *env) { - return env->vscr; + uint32_t sat =3D (env->vscr_sat.u64[0] | env->vscr_sat.u64[1]) !=3D 0; + return env->vscr | (sat << VSCR_SAT); } =20 static inline void set_vscr_sat(CPUPPCState *env) { - env->vscr |=3D 1 << VSCR_SAT; + /* The choice of non-zero value is arbitrary. */ + env->vscr_sat.u32[0] =3D 1; } =20 void helper_vaddcuw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503297108765.568413040352; Mon, 18 Feb 2019 07:21:37 -0800 (PST) Received: from localhost ([127.0.0.1]:60393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkjd-00058E-UD for importer@patchew.org; Mon, 18 Feb 2019 10:21:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjya-0007Aw-Fy for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyY-0003b0-Vs for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:56 -0500 Received: from ozlabs.org ([203.11.71.1]:44225) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyY-0003Z2-Ae; Mon, 18 Feb 2019 09:32:54 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s41DKvz9sRX; Tue, 19 Feb 2019 01:31:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500280; bh=aNLFd4pqYxyS6EItpFZi9xkbP2RLyrTKOmdx8BIWqP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FALScLTq97+Ks+PE72Qhz5D94ARU1ir8MQL1cgtG8Vnzk1yYz/fs4uwoBB6G0Jvl9 hr0NWvVMaHG9CGJUFCAS41BU4rt9Xhma8z+HAYiQn81GZLfoODrxmg2AfvPi+SHOLM WAOSwIONRAz1YNh9uQ0tQquCAE5fbypa8M9RqHmw= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:48 +1100 Message-Id: <20190218143049.17142-43-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 42/43] target/ppc: convert vadd*s and vsub*s to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-17-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 24 ++++++------ target/ppc/int_helper.c | 18 ++------- target/ppc/translate/vmx-impl.inc.c | 57 +++++++++++++++++++++++------ 3 files changed, 61 insertions(+), 38 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 7dbb08b9dd..3daf6bf863 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -219,18 +219,18 @@ DEF_HELPER_2(vprtybq, void, avr, avr) DEF_HELPER_3(vsubcuw, void, avr, avr, avr) DEF_HELPER_2(lvsl, void, avr, tl) DEF_HELPER_2(lvsr, void, avr, tl) -DEF_HELPER_4(vaddsbs, void, env, avr, avr, avr) -DEF_HELPER_4(vaddshs, void, env, avr, avr, avr) -DEF_HELPER_4(vaddsws, void, env, avr, avr, avr) -DEF_HELPER_4(vsubsbs, void, env, avr, avr, avr) -DEF_HELPER_4(vsubshs, void, env, avr, avr, avr) -DEF_HELPER_4(vsubsws, void, env, avr, avr, avr) -DEF_HELPER_4(vaddubs, void, env, avr, avr, avr) -DEF_HELPER_4(vadduhs, void, env, avr, avr, avr) -DEF_HELPER_4(vadduws, void, env, avr, avr, avr) -DEF_HELPER_4(vsububs, void, env, avr, avr, avr) -DEF_HELPER_4(vsubuhs, void, env, avr, avr, avr) -DEF_HELPER_4(vsubuws, void, env, avr, avr, avr) +DEF_HELPER_FLAGS_5(vaddsbs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vaddshs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vaddsws, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsubsbs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsubshs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsubsws, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vaddubs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vadduhs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vadduws, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsububs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsubuhs, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) +DEF_HELPER_FLAGS_5(vsubuws, TCG_CALL_NO_RWG, void, avr, avr, avr, avr, i32) DEF_HELPER_3(vadduqm, void, avr, avr, avr) DEF_HELPER_4(vaddecuq, void, avr, avr, avr, avr) DEF_HELPER_4(vaddeuqm, void, avr, avr, avr, avr) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 6ad596a08b..4aeb375edd 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -571,27 +571,17 @@ VARITHFPFMA(nmsubfp, float_muladd_negate_result | flo= at_muladd_negate_c); } =20 #define VARITHSAT_DO(name, op, optype, cvt, element) \ - void helper_v##name(CPUPPCState *env, ppc_avr_t *r, ppc_avr_t *a, \ - ppc_avr_t *b) \ + void helper_v##name(ppc_avr_t *r, ppc_avr_t *vscr_sat, \ + ppc_avr_t *a, ppc_avr_t *b, uint32_t desc) \ { \ int sat =3D 0; \ int i; \ \ for (i =3D 0; i < ARRAY_SIZE(r->element); i++) { \ - switch (sizeof(r->element[0])) { \ - case 1: \ - VARITHSAT_CASE(optype, op, cvt, element); \ - break; \ - case 2: \ - VARITHSAT_CASE(optype, op, cvt, element); \ - break; \ - case 4: \ - VARITHSAT_CASE(optype, op, cvt, element); \ - break; \ - } \ + VARITHSAT_CASE(optype, op, cvt, element); \ } \ if (sat) { \ - set_vscr_sat(env); \ + vscr_sat->u32[0] =3D 1; \ } \ } #define VARITHSAT_SIGNED(suffix, element, optype, cvt) \ diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 5e13edbf53..62c5578070 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -552,22 +552,55 @@ GEN_VXFORM(vslo, 6, 16); GEN_VXFORM(vsro, 6, 17); GEN_VXFORM(vaddcuw, 0, 6); GEN_VXFORM(vsubcuw, 0, 22); -GEN_VXFORM_ENV(vaddubs, 0, 8); + +#define GEN_VXFORM_SAT(NAME, VECE, NORM, SAT, OPC2, OPC3) \ +static void glue(glue(gen_, NAME), _vec)(unsigned vece, TCGv_vec t, \ + TCGv_vec sat, TCGv_vec a, \ + TCGv_vec b) \ +{ \ + TCGv_vec x =3D tcg_temp_new_vec_matching(t); \ + glue(glue(tcg_gen_, NORM), _vec)(VECE, x, a, b); \ + glue(glue(tcg_gen_, SAT), _vec)(VECE, t, a, b); \ + tcg_gen_cmp_vec(TCG_COND_NE, VECE, x, x, t); \ + tcg_gen_or_vec(VECE, sat, sat, x); \ + tcg_temp_free_vec(x); \ +} \ +static void glue(gen_, NAME)(DisasContext *ctx) \ +{ \ + static const GVecGen4 g =3D { \ + .fniv =3D glue(glue(gen_, NAME), _vec), \ + .fno =3D glue(gen_helper_, NAME), \ + .opc =3D glue(glue(INDEX_op_, SAT), _vec), \ + .write_aofs =3D true, \ + .vece =3D VECE, \ + }; \ + if (unlikely(!ctx->altivec_enabled)) { \ + gen_exception(ctx, POWERPC_EXCP_VPU); \ + return; \ + } \ + tcg_gen_gvec_4(avr64_offset(rD(ctx->opcode), true), \ + offsetof(CPUPPCState, vscr_sat), \ + avr64_offset(rA(ctx->opcode), true), \ + avr64_offset(rB(ctx->opcode), true), \ + 16, 16, &g); \ +} + +GEN_VXFORM_SAT(vaddubs, MO_8, add, usadd, 0, 8); GEN_VXFORM_DUAL_EXT(vaddubs, PPC_ALTIVEC, PPC_NONE, 0, \ vmul10uq, PPC_NONE, PPC2_ISA300, 0x0000F800) -GEN_VXFORM_ENV(vadduhs, 0, 9); +GEN_VXFORM_SAT(vadduhs, MO_16, add, usadd, 0, 9); GEN_VXFORM_DUAL(vadduhs, PPC_ALTIVEC, PPC_NONE, \ vmul10euq, PPC_NONE, PPC2_ISA300) -GEN_VXFORM_ENV(vadduws, 0, 10); -GEN_VXFORM_ENV(vaddsbs, 0, 12); -GEN_VXFORM_ENV(vaddshs, 0, 13); -GEN_VXFORM_ENV(vaddsws, 0, 14); -GEN_VXFORM_ENV(vsububs, 0, 24); -GEN_VXFORM_ENV(vsubuhs, 0, 25); -GEN_VXFORM_ENV(vsubuws, 0, 26); -GEN_VXFORM_ENV(vsubsbs, 0, 28); -GEN_VXFORM_ENV(vsubshs, 0, 29); -GEN_VXFORM_ENV(vsubsws, 0, 30); +GEN_VXFORM_SAT(vadduws, MO_32, add, usadd, 0, 10); +GEN_VXFORM_SAT(vaddsbs, MO_8, add, ssadd, 0, 12); +GEN_VXFORM_SAT(vaddshs, MO_16, add, ssadd, 0, 13); +GEN_VXFORM_SAT(vaddsws, MO_32, add, ssadd, 0, 14); +GEN_VXFORM_SAT(vsububs, MO_8, sub, ussub, 0, 24); +GEN_VXFORM_SAT(vsubuhs, MO_16, sub, ussub, 0, 25); +GEN_VXFORM_SAT(vsubuws, MO_32, sub, ussub, 0, 26); +GEN_VXFORM_SAT(vsubsbs, MO_8, sub, sssub, 0, 28); +GEN_VXFORM_SAT(vsubshs, MO_16, sub, sssub, 0, 29); +GEN_VXFORM_SAT(vsubsws, MO_32, sub, sssub, 0, 30); GEN_VXFORM(vadduqm, 0, 4); GEN_VXFORM(vaddcuq, 0, 5); GEN_VXFORM3(vaddeuqm, 30, 0); --=20 2.20.1 From nobody Sun Dec 22 06:18:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550503240398233.36408463756572; Mon, 18 Feb 2019 07:20:40 -0800 (PST) Received: from localhost ([127.0.0.1]:60370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkii-0004SF-9P for importer@patchew.org; Mon, 18 Feb 2019 10:20:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjyY-00078n-MZ for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjyW-0003YV-9u for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:54 -0500 Received: from ozlabs.org ([203.11.71.1]:37345) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjyV-0003Gd-Ka; Mon, 18 Feb 2019 09:32:52 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435s35y9Xz9sP6; Tue, 19 Feb 2019 01:31:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500279; bh=xIjHaidE3XlcLM9BBPaNibCsVVy8yS+uIYwX5U6bAFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lH4w5lu3hk84bGG6ZOxAXCQOnSV5Y5zzXwG2UZJCciLgPZNLSM2XBUSUQhoo/fIWu 4aWpxZxypJicuaJjM3EQbTOIW/mvyXkYLE7GRfWZZn4upP6IkCT9eqkcPRgfRjchxM 3Go6QDe4qsocbqmQNiyoDAMUrvvcwKi9erZoREaA= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:49 +1100 Message-Id: <20190218143049.17142-44-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-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 43/43] target/ppc: convert vmin* and vmax* to vector operations 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: Richard Henderson , groug@kaod.org, qemu-devel@nongnu.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) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Signed-off-by: Richard Henderson Acked-by: David Gibson Message-Id: <20190215100058.20015-18-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/helper.h | 16 --------------- target/ppc/int_helper.c | 27 ------------------------ target/ppc/translate/vmx-impl.inc.c | 32 ++++++++++++++--------------- 3 files changed, 16 insertions(+), 59 deletions(-) diff --git a/target/ppc/helper.h b/target/ppc/helper.h index 3daf6bf863..18910d18a4 100644 --- a/target/ppc/helper.h +++ b/target/ppc/helper.h @@ -117,22 +117,6 @@ DEF_HELPER_3(vabsduw, void, avr, avr, avr) DEF_HELPER_3(vavgsb, void, avr, avr, avr) DEF_HELPER_3(vavgsh, void, avr, avr, avr) DEF_HELPER_3(vavgsw, void, avr, avr, avr) -DEF_HELPER_3(vminsb, void, avr, avr, avr) -DEF_HELPER_3(vminsh, void, avr, avr, avr) -DEF_HELPER_3(vminsw, void, avr, avr, avr) -DEF_HELPER_3(vminsd, void, avr, avr, avr) -DEF_HELPER_3(vmaxsb, void, avr, avr, avr) -DEF_HELPER_3(vmaxsh, void, avr, avr, avr) -DEF_HELPER_3(vmaxsw, void, avr, avr, avr) -DEF_HELPER_3(vmaxsd, void, avr, avr, avr) -DEF_HELPER_3(vminub, void, avr, avr, avr) -DEF_HELPER_3(vminuh, void, avr, avr, avr) -DEF_HELPER_3(vminuw, void, avr, avr, avr) -DEF_HELPER_3(vminud, void, avr, avr, avr) -DEF_HELPER_3(vmaxub, void, avr, avr, avr) -DEF_HELPER_3(vmaxuh, void, avr, avr, avr) -DEF_HELPER_3(vmaxuw, void, avr, avr, avr) -DEF_HELPER_3(vmaxud, void, avr, avr, avr) DEF_HELPER_4(vcmpequb, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequh, void, env, avr, avr, avr) DEF_HELPER_4(vcmpequw, void, env, avr, avr, avr) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 4aeb375edd..162add561e 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -921,33 +921,6 @@ void helper_vmhraddshs(CPUPPCState *env, ppc_avr_t *r,= ppc_avr_t *a, } } =20 -#define VMINMAX_DO(name, compare, element) \ - void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ - { \ - int i; \ - \ - for (i =3D 0; i < ARRAY_SIZE(r->element); i++) { \ - if (a->element[i] compare b->element[i]) { \ - r->element[i] =3D b->element[i]; \ - } else { \ - r->element[i] =3D a->element[i]; \ - } \ - } \ - } -#define VMINMAX(suffix, element) \ - VMINMAX_DO(min##suffix, >, element) \ - VMINMAX_DO(max##suffix, <, element) -VMINMAX(sb, s8) -VMINMAX(sh, s16) -VMINMAX(sw, s32) -VMINMAX(sd, s64) -VMINMAX(ub, u8) -VMINMAX(uh, u16) -VMINMAX(uw, u32) -VMINMAX(ud, u64) -#undef VMINMAX_DO -#undef VMINMAX - void helper_vmladduhm(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t = *c) { int i; diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index 62c5578070..f1b15ae2cb 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -416,22 +416,22 @@ GEN_VXFORM_V(vsububm, MO_8, tcg_gen_gvec_sub, 0, 16); GEN_VXFORM_V(vsubuhm, MO_16, tcg_gen_gvec_sub, 0, 17); GEN_VXFORM_V(vsubuwm, MO_32, tcg_gen_gvec_sub, 0, 18); GEN_VXFORM_V(vsubudm, MO_64, tcg_gen_gvec_sub, 0, 19); -GEN_VXFORM(vmaxub, 1, 0); -GEN_VXFORM(vmaxuh, 1, 1); -GEN_VXFORM(vmaxuw, 1, 2); -GEN_VXFORM(vmaxud, 1, 3); -GEN_VXFORM(vmaxsb, 1, 4); -GEN_VXFORM(vmaxsh, 1, 5); -GEN_VXFORM(vmaxsw, 1, 6); -GEN_VXFORM(vmaxsd, 1, 7); -GEN_VXFORM(vminub, 1, 8); -GEN_VXFORM(vminuh, 1, 9); -GEN_VXFORM(vminuw, 1, 10); -GEN_VXFORM(vminud, 1, 11); -GEN_VXFORM(vminsb, 1, 12); -GEN_VXFORM(vminsh, 1, 13); -GEN_VXFORM(vminsw, 1, 14); -GEN_VXFORM(vminsd, 1, 15); +GEN_VXFORM_V(vmaxub, MO_8, tcg_gen_gvec_umax, 1, 0); +GEN_VXFORM_V(vmaxuh, MO_16, tcg_gen_gvec_umax, 1, 1); +GEN_VXFORM_V(vmaxuw, MO_32, tcg_gen_gvec_umax, 1, 2); +GEN_VXFORM_V(vmaxud, MO_64, tcg_gen_gvec_umax, 1, 3); +GEN_VXFORM_V(vmaxsb, MO_8, tcg_gen_gvec_smax, 1, 4); +GEN_VXFORM_V(vmaxsh, MO_16, tcg_gen_gvec_smax, 1, 5); +GEN_VXFORM_V(vmaxsw, MO_32, tcg_gen_gvec_smax, 1, 6); +GEN_VXFORM_V(vmaxsd, MO_64, tcg_gen_gvec_smax, 1, 7); +GEN_VXFORM_V(vminub, MO_8, tcg_gen_gvec_umin, 1, 8); +GEN_VXFORM_V(vminuh, MO_16, tcg_gen_gvec_umin, 1, 9); +GEN_VXFORM_V(vminuw, MO_32, tcg_gen_gvec_umin, 1, 10); +GEN_VXFORM_V(vminud, MO_64, tcg_gen_gvec_umin, 1, 11); +GEN_VXFORM_V(vminsb, MO_8, tcg_gen_gvec_smin, 1, 12); +GEN_VXFORM_V(vminsh, MO_16, tcg_gen_gvec_smin, 1, 13); +GEN_VXFORM_V(vminsw, MO_32, tcg_gen_gvec_smin, 1, 14); +GEN_VXFORM_V(vminsd, MO_64, tcg_gen_gvec_smin, 1, 15); GEN_VXFORM(vavgub, 1, 16); GEN_VXFORM(vabsdub, 1, 16); GEN_VXFORM_DUAL(vavgub, PPC_ALTIVEC, PPC_NONE, \ --=20 2.20.1