From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259508; cv=none; d=zoho.com; s=zohoarc; b=W0z9MxfYGfZ3FZbFFI0vEAlyi4EQ515adZx18Y7DB2dG5T8gjA05pR3QR4mwUq3TIITVXrPSPIMGMWtLoumxSVkNe5Ur/e+T0dukCx+naDK4w+u/hNPn9qQFnv1vrut8bOC4z/7S3fr0rjF8iucKDChB4EL+F8A0QABuvLkEFSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259508; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=96cmLs1+vtoT6OGQCq1Y2XvQ71FcyQCIkvLFwk+8Lio=; b=ZL0GKVSD47SoHQs5qJUF1m+KGiCNNdcq9xyrlp1JF5Iox1/tjOw7TLMXRti+WeAH7Vg4TwdicB2dVQX7pJ0W/JTtRqX19BBEsQVhg2174K7KuBGEJmPV/5Gn2fSAnaQa1gcOWZYHHKaR6nTHEDdpOyTTVkQT8ZJsU6HXtAMNIGw= ARC-Authentication-Results: i=1; mx.zoho.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 155625950813495.53871626299076; Thu, 25 Apr 2019 23:18:28 -0700 (PDT) Received: from localhost ([127.0.0.1]:40042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuBm-0007wR-TX for importer@patchew.org; Fri, 26 Apr 2019 02:18:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0X-0005SX-NJ for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0T-0004Im-9A for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:49 -0400 Received: from ozlabs.org ([203.11.71.1]:37025) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0S-00042c-In; Fri, 26 Apr 2019 02:06:45 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tj47Qpz9s70; Fri, 26 Apr 2019 16:06:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258793; bh=Vqp+UUVZcNcufeM160DuaCcqBJMFkeTinRFy/CoGGxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/cNOIy7cBQEJ3xn2cuUHzOhrJeqkzZizXvuc4JQhSJ+Ag4qq/tobAsDjHTajC/By GY8iVUujl8x6KcQvrzjTDOEwjOkahqKq8kvcmC7ktmbyKg6qD1rtvPsGyYjn8tL7/t 14TGT10cx2ukmHb1DfYljkmLOeq4sMFnSENcA+KU= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:52 +1000 Message-Id: <20190426060627.18153-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 01/36] spapr: Support NVIDIA V100 GPU with NVLink2 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: Alexey Kardashevskiy , gkurz@kaod.org, qemu-devel@nongnu.org, Alex Williamson , 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: Alexey Kardashevskiy NVIDIA V100 GPUs have on-board RAM which is mapped into the host memory space and accessible as normal RAM via an NVLink bus. The VFIO-PCI driver implements special regions for such GPUs and emulates an NVLink bridge. NVLink2-enabled POWER9 CPUs also provide address translation services which includes an ATS shootdown (ATSD) register exported via the NVLink bridge device. This adds a quirk to VFIO to map the GPU memory and create an MR; the new MR is stored in a PCI device as a QOM link. The sPAPR PCI uses this to get the MR and map it to the system address space. Another quirk does the same for ATSD. This adds additional steps to sPAPR PHB setup: 1. Search for specific GPUs and NPUs, collect findings in sPAPRPHBState::nvgpus, manage system address space mappings; 2. Add device-specific properties such as "ibm,npu", "ibm,gpu", "memory-block", "link-speed" to advertise the NVLink2 function to the guest; 3. Add "mmio-atsd" to vPHB to advertise the ATSD capability; 4. Add new memory blocks (with extra "linux,memory-usable" to prevent the guest OS from accessing the new memory until it is onlined) and npuphb# nodes representing an NPU unit for every vPHB as the GPU driver uses it for link discovery. This allocates space for GPU RAM and ATSD like we do for MMIOs by adding 2 new parameters to the phb_placement() hook. Older machine types set these to zero. This puts new memory nodes in a separate NUMA node to as the GPU RAM needs to be configured equally distant from any other node in the system. Unlike the host setup which assigns numa ids from 255 downwards, this adds new NUMA nodes after the user configures nodes or from 1 if none were configured. This adds requirement similar to EEH - one IOMMU group per vPHB. The reason for this is that ATSD registers belong to a physical NPU so they cannot invalidate translations on GPUs attached to another NPU. It is guaranteed by the host platform as it does not mix NVLink bridges or GPUs from different NPU in the same IOMMU group. If more than one IOMMU group is detected on a vPHB, this disables ATSD support for that vPHB and prints a warning. Signed-off-by: Alexey Kardashevskiy [aw: for vfio portions] Acked-by: Alex Williamson Message-Id: <20190312082103.130561-1-aik@ozlabs.ru> Signed-off-by: David Gibson --- hw/ppc/Makefile.objs | 2 +- hw/ppc/spapr.c | 48 +++- hw/ppc/spapr_pci.c | 19 ++ hw/ppc/spapr_pci_nvlink2.c | 450 ++++++++++++++++++++++++++++++++++++ hw/vfio/pci-quirks.c | 131 +++++++++++ hw/vfio/pci.c | 14 ++ hw/vfio/pci.h | 2 + hw/vfio/trace-events | 4 + include/hw/pci-host/spapr.h | 45 ++++ include/hw/ppc/spapr.h | 5 +- 10 files changed, 711 insertions(+), 9 deletions(-) create mode 100644 hw/ppc/spapr_pci_nvlink2.c diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index 1111b218a0..636e717f20 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -9,7 +9,7 @@ obj-$(CONFIG_SPAPR_RNG) +=3D spapr_rng.o # IBM PowerNV obj-$(CONFIG_POWERNV) +=3D pnv.o pnv_xscom.o pnv_core.o pnv_lpc.o pnv_psi.= o pnv_occ.o pnv_bmc.o ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) -obj-y +=3D spapr_pci_vfio.o +obj-y +=3D spapr_pci_vfio.o spapr_pci_nvlink2.o endif obj-$(CONFIG_PSERIES) +=3D spapr_rtas_ddw.o # PowerPC 4xx boards diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b52b82d298..b81e237635 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1034,12 +1034,13 @@ static void spapr_dt_rtas(SpaprMachineState *spapr,= void *fdt) 0, cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE), cpu_to_be32(max_cpus / smp_threads), }; + uint32_t maxdomain =3D cpu_to_be32(spapr->gpu_numa_id > 1 ? 1 : 0); uint32_t maxdomains[] =3D { cpu_to_be32(4), - cpu_to_be32(0), - cpu_to_be32(0), - cpu_to_be32(0), - cpu_to_be32(nb_numa_nodes ? nb_numa_nodes : 1), + maxdomain, + maxdomain, + maxdomain, + cpu_to_be32(spapr->gpu_numa_id), }; =20 _FDT(rtas =3D fdt_add_subnode(fdt, 0, "rtas")); @@ -1698,6 +1699,16 @@ static void spapr_machine_reset(void) spapr_irq_msi_reset(spapr); } =20 + /* + * NVLink2-connected GPU RAM needs to be placed on a separate NUMA nod= e. + * We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which = is + * called from vPHB reset handler so we initialize the counter here. + * If no NUMA is configured from the QEMU side, we start from 1 as GPU= RAM + * must be equally distant from any other node. + * The final value of spapr->gpu_numa_id is going to be written to + * max-associativity-domains in spapr_build_fdt(). + */ + spapr->gpu_numa_id =3D MAX(1, nb_numa_nodes); qemu_devices_reset(); =20 /* @@ -3907,7 +3918,9 @@ static void spapr_phb_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, smc->phb_placement(spapr, sphb->index, &sphb->buid, &sphb->io_win_addr, &sphb->mem_win_addr, &sphb->mem64_win_addr, - windows_supported, sphb->dma_liobn, errp); + windows_supported, sphb->dma_liobn, + &sphb->nv2_gpa_win_addr, &sphb->nv2_atsd_win_addr, + errp); } =20 static void spapr_phb_plug(HotplugHandler *hotplug_dev, DeviceState *dev, @@ -4108,7 +4121,8 @@ static const CPUArchIdList *spapr_possible_cpu_arch_i= ds(MachineState *machine) static void spapr_phb_placement(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, - unsigned n_dma, uint32_t *liobns, Error **= errp) + unsigned n_dma, uint32_t *liobns, + hwaddr *nv2gpa, hwaddr *nv2atsd, Error **e= rrp) { /* * New-style PHB window placement. @@ -4153,6 +4167,9 @@ static void spapr_phb_placement(SpaprMachineState *sp= apr, uint32_t index, *pio =3D SPAPR_PCI_BASE + index * SPAPR_PCI_IO_WIN_SIZE; *mmio32 =3D SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM32_WIN_SIZE; *mmio64 =3D SPAPR_PCI_BASE + (index + 1) * SPAPR_PCI_MEM64_WIN_SIZE; + + *nv2gpa =3D SPAPR_PCI_NV2RAM64_WIN_BASE + index * SPAPR_PCI_NV2RAM64_W= IN_SIZE; + *nv2atsd =3D SPAPR_PCI_NV2ATSD_WIN_BASE + index * SPAPR_PCI_NV2ATSD_WI= N_SIZE; } =20 static ICSState *spapr_ics_get(XICSFabric *dev, int irq) @@ -4357,6 +4374,18 @@ DEFINE_SPAPR_MACHINE(4_0, "4.0", true); /* * pseries-3.1 */ +static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, + uint64_t *buid, hwaddr *pio, + hwaddr *mmio32, hwaddr *mmio64, + unsigned n_dma, uint32_t *liobns, + hwaddr *nv2gpa, hwaddr *nv2atsd, Error **err= p) +{ + spapr_phb_placement(spapr, index, buid, pio, mmio32, mmio64, n_dma, li= obns, + nv2gpa, nv2atsd, errp); + *nv2gpa =3D 0; + *nv2atsd =3D 0; +} + static void spapr_machine_3_1_class_options(MachineClass *mc) { SpaprMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); @@ -4372,6 +4401,7 @@ static void spapr_machine_3_1_class_options(MachineCl= ass *mc) smc->default_caps.caps[SPAPR_CAP_SBBC] =3D SPAPR_CAP_BROKEN; smc->default_caps.caps[SPAPR_CAP_IBS] =3D SPAPR_CAP_BROKEN; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] =3D SPAPR_CAP_OFF; + smc->phb_placement =3D phb_placement_3_1; } =20 DEFINE_SPAPR_MACHINE(3_1, "3.1", false); @@ -4503,7 +4533,8 @@ DEFINE_SPAPR_MACHINE(2_8, "2.8", false); static void phb_placement_2_7(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, - unsigned n_dma, uint32_t *liobns, Error **er= rp) + unsigned n_dma, uint32_t *liobns, + hwaddr *nv2gpa, hwaddr *nv2atsd, Error **err= p) { /* Legacy PHB placement for pseries-2.7 and earlier machine types */ const uint64_t base_buid =3D 0x800000020000000ULL; @@ -4547,6 +4578,9 @@ static void phb_placement_2_7(SpaprMachineState *spap= r, uint32_t index, * fallback behaviour of automatically splitting a large "32-bit" * window into contiguous 32-bit and 64-bit windows */ + + *nv2gpa =3D 0; + *nv2atsd =3D 0; } =20 static void spapr_machine_2_7_class_options(MachineClass *mc) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f62e6833b8..d6d0a7115c 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1355,6 +1355,8 @@ static void spapr_populate_pci_child_dt(PCIDevice *de= v, void *fdt, int offset, if (sphb->pcie_ecs && pci_is_express(dev)) { _FDT(fdt_setprop_cell(fdt, offset, "ibm,pci-config-space-type", 0x= 1)); } + + spapr_phb_nvgpu_populate_pcidev_dt(dev, fdt, offset, sphb); } =20 /* create OF node for pci device and required OF DT properties */ @@ -1587,6 +1589,8 @@ static void spapr_phb_unrealize(DeviceState *dev, Err= or **errp) int i; const unsigned windows_supported =3D spapr_phb_windows_supported(sphb); =20 + spapr_phb_nvgpu_free(sphb); + if (sphb->msi) { g_hash_table_unref(sphb->msi); sphb->msi =3D NULL; @@ -1898,8 +1902,14 @@ void spapr_phb_dma_reset(SpaprPhbState *sphb) static void spapr_phb_reset(DeviceState *qdev) { SpaprPhbState *sphb =3D SPAPR_PCI_HOST_BRIDGE(qdev); + Error *errp =3D NULL; =20 spapr_phb_dma_reset(sphb); + spapr_phb_nvgpu_free(sphb); + spapr_phb_nvgpu_setup(sphb, &errp); + if (errp) { + error_report_err(errp); + } =20 /* Reset the IOMMU state */ object_child_foreach(OBJECT(qdev), spapr_phb_children_reset, NULL); @@ -1932,6 +1942,8 @@ static Property spapr_phb_properties[] =3D { pre_2_8_migration, false), DEFINE_PROP_BOOL("pcie-extended-configuration-space", SpaprPhbState, pcie_ecs, true), + DEFINE_PROP_UINT64("gpa", SpaprPhbState, nv2_gpa_win_addr, 0), + DEFINE_PROP_UINT64("atsd", SpaprPhbState, nv2_atsd_win_addr, 0), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -2212,6 +2224,7 @@ int spapr_populate_pci_dt(SpaprPhbState *phb, uint32_= t intc_phandle, void *fdt, PCIBus *bus =3D PCI_HOST_BRIDGE(phb)->bus; SpaprFdt s_fdt; SpaprDrc *drc; + Error *errp =3D NULL; =20 /* Start populating the FDT */ nodename =3D g_strdup_printf("pci@%" PRIx64, phb->buid); @@ -2304,6 +2317,12 @@ int spapr_populate_pci_dt(SpaprPhbState *phb, uint32= _t intc_phandle, void *fdt, return ret; } =20 + spapr_phb_nvgpu_populate_dt(phb, fdt, bus_off, &errp); + if (errp) { + error_report_err(errp); + } + spapr_phb_nvgpu_ram_populate_dt(phb, fdt); + return 0; } =20 diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c new file mode 100644 index 0000000000..eda8c752aa --- /dev/null +++ b/hw/ppc/spapr_pci_nvlink2.c @@ -0,0 +1,450 @@ +/* + * QEMU sPAPR PCI for NVLink2 pass through + * + * Copyright (c) 2019 Alexey Kardashevskiy, IBM Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "hw/pci/pci.h" +#include "hw/pci-host/spapr.h" +#include "qemu/error-report.h" +#include "hw/ppc/fdt.h" +#include "hw/pci/pci_bridge.h" + +#define PHANDLE_PCIDEV(phb, pdev) (0x12000000 | \ + (((phb)->index) << 16) | ((pdev)->dev= fn)) +#define PHANDLE_GPURAM(phb, n) (0x110000FF | ((n) << 8) | \ + (((phb)->index) << 16)) +#define PHANDLE_NVLINK(phb, gn, nn) (0x00130000 | (((phb)->index) << 8) |= \ + ((gn) << 4) | (nn)) + +#define SPAPR_GPU_NUMA_ID (cpu_to_be32(1)) + +struct spapr_phb_pci_nvgpu_config { + uint64_t nv2_ram_current; + uint64_t nv2_atsd_current; + int num; /* number of non empty (i.e. tgt!=3D0) entries in slots[] */ + struct spapr_phb_pci_nvgpu_slot { + uint64_t tgt; + uint64_t gpa; + unsigned numa_id; + PCIDevice *gpdev; + int linknum; + struct { + uint64_t atsd_gpa; + PCIDevice *npdev; + uint32_t link_speed; + } links[NVGPU_MAX_LINKS]; + } slots[NVGPU_MAX_NUM]; + Error *errp; +}; + +static struct spapr_phb_pci_nvgpu_slot * +spapr_nvgpu_get_slot(struct spapr_phb_pci_nvgpu_config *nvgpus, uint64_t t= gt) +{ + int i; + + /* Search for partially collected "slot" */ + for (i =3D 0; i < nvgpus->num; ++i) { + if (nvgpus->slots[i].tgt =3D=3D tgt) { + return &nvgpus->slots[i]; + } + } + + if (nvgpus->num =3D=3D ARRAY_SIZE(nvgpus->slots)) { + return NULL; + } + + i =3D nvgpus->num; + nvgpus->slots[i].tgt =3D tgt; + ++nvgpus->num; + + return &nvgpus->slots[i]; +} + +static void spapr_pci_collect_nvgpu(struct spapr_phb_pci_nvgpu_config *nvg= pus, + PCIDevice *pdev, uint64_t tgt, + MemoryRegion *mr, Error **errp) +{ + MachineState *machine =3D MACHINE(qdev_get_machine()); + SpaprMachineState *spapr =3D SPAPR_MACHINE(machine); + struct spapr_phb_pci_nvgpu_slot *nvslot =3D spapr_nvgpu_get_slot(nvgpu= s, tgt); + + if (!nvslot) { + error_setg(errp, "Found too many GPUs per vPHB"); + return; + } + g_assert(!nvslot->gpdev); + nvslot->gpdev =3D pdev; + + nvslot->gpa =3D nvgpus->nv2_ram_current; + nvgpus->nv2_ram_current +=3D memory_region_size(mr); + nvslot->numa_id =3D spapr->gpu_numa_id; + ++spapr->gpu_numa_id; +} + +static void spapr_pci_collect_nvnpu(struct spapr_phb_pci_nvgpu_config *nvg= pus, + PCIDevice *pdev, uint64_t tgt, + MemoryRegion *mr, Error **errp) +{ + struct spapr_phb_pci_nvgpu_slot *nvslot =3D spapr_nvgpu_get_slot(nvgpu= s, tgt); + int j; + + if (!nvslot) { + error_setg(errp, "Found too many NVLink bridges per vPHB"); + return; + } + + j =3D nvslot->linknum; + if (j =3D=3D ARRAY_SIZE(nvslot->links)) { + error_setg(errp, "Found too many NVLink bridges per GPU"); + return; + } + ++nvslot->linknum; + + g_assert(!nvslot->links[j].npdev); + nvslot->links[j].npdev =3D pdev; + nvslot->links[j].atsd_gpa =3D nvgpus->nv2_atsd_current; + nvgpus->nv2_atsd_current +=3D memory_region_size(mr); + nvslot->links[j].link_speed =3D + object_property_get_uint(OBJECT(pdev), "nvlink2-link-speed", NULL); +} + +static void spapr_phb_pci_collect_nvgpu(PCIBus *bus, PCIDevice *pdev, + void *opaque) +{ + PCIBus *sec_bus; + Object *po =3D OBJECT(pdev); + uint64_t tgt =3D object_property_get_uint(po, "nvlink2-tgt", NULL); + + if (tgt) { + Error *local_err =3D NULL; + struct spapr_phb_pci_nvgpu_config *nvgpus =3D opaque; + Object *mr_gpu =3D object_property_get_link(po, "nvlink2-mr[0]", N= ULL); + Object *mr_npu =3D object_property_get_link(po, "nvlink2-atsd-mr[0= ]", + NULL); + + g_assert(mr_gpu || mr_npu); + if (mr_gpu) { + spapr_pci_collect_nvgpu(nvgpus, pdev, tgt, MEMORY_REGION(mr_gp= u), + &local_err); + } else { + spapr_pci_collect_nvnpu(nvgpus, pdev, tgt, MEMORY_REGION(mr_np= u), + &local_err); + } + error_propagate(&nvgpus->errp, local_err); + } + if ((pci_default_read_config(pdev, PCI_HEADER_TYPE, 1) !=3D + PCI_HEADER_TYPE_BRIDGE)) { + return; + } + + sec_bus =3D pci_bridge_get_sec_bus(PCI_BRIDGE(pdev)); + if (!sec_bus) { + return; + } + + pci_for_each_device(sec_bus, pci_bus_num(sec_bus), + spapr_phb_pci_collect_nvgpu, opaque); +} + +void spapr_phb_nvgpu_setup(SpaprPhbState *sphb, Error **errp) +{ + int i, j, valid_gpu_num; + PCIBus *bus; + + /* Search for GPUs and NPUs */ + if (!sphb->nv2_gpa_win_addr || !sphb->nv2_atsd_win_addr) { + return; + } + + sphb->nvgpus =3D g_new0(struct spapr_phb_pci_nvgpu_config, 1); + sphb->nvgpus->nv2_ram_current =3D sphb->nv2_gpa_win_addr; + sphb->nvgpus->nv2_atsd_current =3D sphb->nv2_atsd_win_addr; + + bus =3D PCI_HOST_BRIDGE(sphb)->bus; + pci_for_each_device(bus, pci_bus_num(bus), + spapr_phb_pci_collect_nvgpu, sphb->nvgpus); + + if (sphb->nvgpus->errp) { + error_propagate(errp, sphb->nvgpus->errp); + sphb->nvgpus->errp =3D NULL; + goto cleanup_exit; + } + + /* Add found GPU RAM and ATSD MRs if found */ + for (i =3D 0, valid_gpu_num =3D 0; i < sphb->nvgpus->num; ++i) { + Object *nvmrobj; + struct spapr_phb_pci_nvgpu_slot *nvslot =3D &sphb->nvgpus->slots[i= ]; + + if (!nvslot->gpdev) { + continue; + } + nvmrobj =3D object_property_get_link(OBJECT(nvslot->gpdev), + "nvlink2-mr[0]", NULL); + /* ATSD is pointless without GPU RAM MR so skip those */ + if (!nvmrobj) { + continue; + } + + ++valid_gpu_num; + memory_region_add_subregion(get_system_memory(), nvslot->gpa, + MEMORY_REGION(nvmrobj)); + + for (j =3D 0; j < nvslot->linknum; ++j) { + Object *atsdmrobj; + + atsdmrobj =3D object_property_get_link(OBJECT(nvslot->links[j]= .npdev), + "nvlink2-atsd-mr[0]", NUL= L); + if (!atsdmrobj) { + continue; + } + memory_region_add_subregion(get_system_memory(), + nvslot->links[j].atsd_gpa, + MEMORY_REGION(atsdmrobj)); + } + } + + if (valid_gpu_num) { + return; + } + /* We did not find any interesting GPU */ +cleanup_exit: + g_free(sphb->nvgpus); + sphb->nvgpus =3D NULL; +} + +void spapr_phb_nvgpu_free(SpaprPhbState *sphb) +{ + int i, j; + + if (!sphb->nvgpus) { + return; + } + + for (i =3D 0; i < sphb->nvgpus->num; ++i) { + struct spapr_phb_pci_nvgpu_slot *nvslot =3D &sphb->nvgpus->slots[i= ]; + Object *nv_mrobj =3D object_property_get_link(OBJECT(nvslot->gpdev= ), + "nvlink2-mr[0]", NULL); + + if (nv_mrobj) { + memory_region_del_subregion(get_system_memory(), + MEMORY_REGION(nv_mrobj)); + } + for (j =3D 0; j < nvslot->linknum; ++j) { + PCIDevice *npdev =3D nvslot->links[j].npdev; + Object *atsd_mrobj; + atsd_mrobj =3D object_property_get_link(OBJECT(npdev), + "nvlink2-atsd-mr[0]", NU= LL); + if (atsd_mrobj) { + memory_region_del_subregion(get_system_memory(), + MEMORY_REGION(atsd_mrobj)); + } + } + } + g_free(sphb->nvgpus); + sphb->nvgpus =3D NULL; +} + +void spapr_phb_nvgpu_populate_dt(SpaprPhbState *sphb, void *fdt, int bus_o= ff, + Error **errp) +{ + int i, j, atsdnum =3D 0; + uint64_t atsd[8]; /* The existing limitation of known guests */ + + if (!sphb->nvgpus) { + return; + } + + for (i =3D 0; (i < sphb->nvgpus->num) && (atsdnum < ARRAY_SIZE(atsd));= ++i) { + struct spapr_phb_pci_nvgpu_slot *nvslot =3D &sphb->nvgpus->slots[i= ]; + + if (!nvslot->gpdev) { + continue; + } + for (j =3D 0; j < nvslot->linknum; ++j) { + if (!nvslot->links[j].atsd_gpa) { + continue; + } + + if (atsdnum =3D=3D ARRAY_SIZE(atsd)) { + error_report("Only %"PRIuPTR" ATSD registers supported", + ARRAY_SIZE(atsd)); + break; + } + atsd[atsdnum] =3D cpu_to_be64(nvslot->links[j].atsd_gpa); + ++atsdnum; + } + } + + if (!atsdnum) { + error_setg(errp, "No ATSD registers found"); + return; + } + + if (!spapr_phb_eeh_available(sphb)) { + /* + * ibm,mmio-atsd contains ATSD registers; these belong to an NPU P= HB + * which we do not emulate as a separate device. Instead we put + * ibm,mmio-atsd to the vPHB with GPU and make sure that we do not + * put GPUs from different IOMMU groups to the same vPHB to ensure + * that the guest will use ATSDs from the corresponding NPU. + */ + error_setg(errp, "ATSD requires separate vPHB per GPU IOMMU group"= ); + return; + } + + _FDT((fdt_setprop(fdt, bus_off, "ibm,mmio-atsd", atsd, + atsdnum * sizeof(atsd[0])))); +} + +void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt) +{ + int i, j, linkidx, npuoff; + char *npuname; + + if (!sphb->nvgpus) { + return; + } + + npuname =3D g_strdup_printf("npuphb%d", sphb->index); + npuoff =3D fdt_add_subnode(fdt, 0, npuname); + _FDT(npuoff); + _FDT(fdt_setprop_cell(fdt, npuoff, "#address-cells", 1)); + _FDT(fdt_setprop_cell(fdt, npuoff, "#size-cells", 0)); + /* Advertise NPU as POWER9 so the guest can enable NPU2 contexts */ + _FDT((fdt_setprop_string(fdt, npuoff, "compatible", "ibm,power9-npu"))= ); + g_free(npuname); + + for (i =3D 0, linkidx =3D 0; i < sphb->nvgpus->num; ++i) { + for (j =3D 0; j < sphb->nvgpus->slots[i].linknum; ++j) { + char *linkname =3D g_strdup_printf("link@%d", linkidx); + int off =3D fdt_add_subnode(fdt, npuoff, linkname); + + _FDT(off); + /* _FDT((fdt_setprop_cell(fdt, off, "reg", linkidx))); */ + _FDT((fdt_setprop_string(fdt, off, "compatible", + "ibm,npu-link"))); + _FDT((fdt_setprop_cell(fdt, off, "phandle", + PHANDLE_NVLINK(sphb, i, j)))); + _FDT((fdt_setprop_cell(fdt, off, "ibm,npu-link-index", linkidx= ))); + g_free(linkname); + ++linkidx; + } + } + + /* Add memory nodes for GPU RAM and mark them unusable */ + for (i =3D 0; i < sphb->nvgpus->num; ++i) { + struct spapr_phb_pci_nvgpu_slot *nvslot =3D &sphb->nvgpus->slots[i= ]; + Object *nv_mrobj =3D object_property_get_link(OBJECT(nvslot->gpdev= ), + "nvlink2-mr[0]", NULL); + uint32_t associativity[] =3D { + cpu_to_be32(0x4), + SPAPR_GPU_NUMA_ID, + SPAPR_GPU_NUMA_ID, + SPAPR_GPU_NUMA_ID, + cpu_to_be32(nvslot->numa_id) + }; + uint64_t size =3D object_property_get_uint(nv_mrobj, "size", NULL); + uint64_t mem_reg[2] =3D { cpu_to_be64(nvslot->gpa), cpu_to_be64(si= ze) }; + char *mem_name =3D g_strdup_printf("memory@%"PRIx64, nvslot->gpa); + int off =3D fdt_add_subnode(fdt, 0, mem_name); + + _FDT(off); + _FDT((fdt_setprop_string(fdt, off, "device_type", "memory"))); + _FDT((fdt_setprop(fdt, off, "reg", mem_reg, sizeof(mem_reg)))); + _FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity, + sizeof(associativity)))); + + _FDT((fdt_setprop_string(fdt, off, "compatible", + "ibm,coherent-device-memory"))); + + mem_reg[1] =3D cpu_to_be64(0); + _FDT((fdt_setprop(fdt, off, "linux,usable-memory", mem_reg, + sizeof(mem_reg)))); + _FDT((fdt_setprop_cell(fdt, off, "phandle", + PHANDLE_GPURAM(sphb, i)))); + g_free(mem_name); + } + +} + +void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int off= set, + SpaprPhbState *sphb) +{ + int i, j; + + if (!sphb->nvgpus) { + return; + } + + for (i =3D 0; i < sphb->nvgpus->num; ++i) { + struct spapr_phb_pci_nvgpu_slot *nvslot =3D &sphb->nvgpus->slots[i= ]; + + /* Skip "slot" without attached GPU */ + if (!nvslot->gpdev) { + continue; + } + if (dev =3D=3D nvslot->gpdev) { + uint32_t npus[nvslot->linknum]; + + for (j =3D 0; j < nvslot->linknum; ++j) { + PCIDevice *npdev =3D nvslot->links[j].npdev; + + npus[j] =3D cpu_to_be32(PHANDLE_PCIDEV(sphb, npdev)); + } + _FDT(fdt_setprop(fdt, offset, "ibm,npu", npus, + j * sizeof(npus[0]))); + _FDT((fdt_setprop_cell(fdt, offset, "phandle", + PHANDLE_PCIDEV(sphb, dev)))); + continue; + } + + for (j =3D 0; j < nvslot->linknum; ++j) { + if (dev !=3D nvslot->links[j].npdev) { + continue; + } + + _FDT((fdt_setprop_cell(fdt, offset, "phandle", + PHANDLE_PCIDEV(sphb, dev)))); + _FDT(fdt_setprop_cell(fdt, offset, "ibm,gpu", + PHANDLE_PCIDEV(sphb, nvslot->gpdev))); + _FDT((fdt_setprop_cell(fdt, offset, "ibm,nvlink", + PHANDLE_NVLINK(sphb, i, j)))); + /* + * If we ever want to emulate GPU RAM at the same location as = on + * the host - here is the encoding GPA->TGT: + * + * gta =3D ((sphb->nv2_gpa >> 42) & 0x1) << 42; + * gta |=3D ((sphb->nv2_gpa >> 45) & 0x3) << 43; + * gta |=3D ((sphb->nv2_gpa >> 49) & 0x3) << 45; + * gta |=3D sphb->nv2_gpa & ((1UL << 43) - 1); + */ + _FDT(fdt_setprop_cell(fdt, offset, "memory-region", + PHANDLE_GPURAM(sphb, i))); + _FDT(fdt_setprop_u64(fdt, offset, "ibm,device-tgt-addr", + nvslot->tgt)); + _FDT(fdt_setprop_cell(fdt, offset, "ibm,nvlink-speed", + nvslot->links[j].link_speed)); + } + } +} diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 40a12001f5..29b2697fe1 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -2180,3 +2180,134 @@ int vfio_add_virt_caps(VFIOPCIDevice *vdev, Error *= *errp) =20 return 0; } + +static void vfio_pci_nvlink2_get_tgt(Object *obj, Visitor *v, + const char *name, + void *opaque, Error **errp) +{ + uint64_t tgt =3D (uintptr_t) opaque; + visit_type_uint64(v, name, &tgt, errp); +} + +static void vfio_pci_nvlink2_get_link_speed(Object *obj, Visitor *v, + const char *name, + void *opaque, Error **err= p) +{ + uint32_t link_speed =3D (uint32_t)(uintptr_t) opaque; + visit_type_uint32(v, name, &link_speed, errp); +} + +int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp) +{ + int ret; + void *p; + struct vfio_region_info *nv2reg =3D NULL; + struct vfio_info_cap_header *hdr; + struct vfio_region_info_cap_nvlink2_ssatgt *cap; + VFIOQuirk *quirk; + + ret =3D vfio_get_dev_region_info(&vdev->vbasedev, + VFIO_REGION_TYPE_PCI_VENDOR_TYPE | + PCI_VENDOR_ID_NVIDIA, + VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM, + &nv2reg); + if (ret) { + return ret; + } + + hdr =3D vfio_get_region_info_cap(nv2reg, VFIO_REGION_INFO_CAP_NVLINK2_= SSATGT); + if (!hdr) { + ret =3D -ENODEV; + goto free_exit; + } + cap =3D (void *) hdr; + + p =3D mmap(NULL, nv2reg->size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED, vdev->vbasedev.fd, nv2reg->offset); + if (p =3D=3D MAP_FAILED) { + ret =3D -errno; + goto free_exit; + } + + quirk =3D vfio_quirk_alloc(1); + memory_region_init_ram_ptr(&quirk->mem[0], OBJECT(vdev), "nvlink2-mr", + nv2reg->size, p); + QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); + + object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", + vfio_pci_nvlink2_get_tgt, NULL, NULL, + (void *) (uintptr_t) cap->tgt, NULL); + trace_vfio_pci_nvidia_gpu_setup_quirk(vdev->vbasedev.name, cap->tgt, + nv2reg->size); +free_exit: + g_free(nv2reg); + + return ret; +} + +int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Error **errp) +{ + int ret; + void *p; + struct vfio_region_info *atsdreg =3D NULL; + struct vfio_info_cap_header *hdr; + struct vfio_region_info_cap_nvlink2_ssatgt *captgt; + struct vfio_region_info_cap_nvlink2_lnkspd *capspeed; + VFIOQuirk *quirk; + + ret =3D vfio_get_dev_region_info(&vdev->vbasedev, + VFIO_REGION_TYPE_PCI_VENDOR_TYPE | + PCI_VENDOR_ID_IBM, + VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD, + &atsdreg); + if (ret) { + return ret; + } + + hdr =3D vfio_get_region_info_cap(atsdreg, + VFIO_REGION_INFO_CAP_NVLINK2_SSATGT); + if (!hdr) { + ret =3D -ENODEV; + goto free_exit; + } + captgt =3D (void *) hdr; + + hdr =3D vfio_get_region_info_cap(atsdreg, + VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD); + if (!hdr) { + ret =3D -ENODEV; + goto free_exit; + } + capspeed =3D (void *) hdr; + + /* Some NVLink bridges may not have assigned ATSD */ + if (atsdreg->size) { + p =3D mmap(NULL, atsdreg->size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED, vdev->vbasedev.fd, atsdreg->offset); + if (p =3D=3D MAP_FAILED) { + ret =3D -errno; + goto free_exit; + } + + quirk =3D vfio_quirk_alloc(1); + memory_region_init_ram_device_ptr(&quirk->mem[0], OBJECT(vdev), + "nvlink2-atsd-mr", atsdreg->size= , p); + QLIST_INSERT_HEAD(&vdev->bars[0].quirks, quirk, next); + } + + object_property_add(OBJECT(vdev), "nvlink2-tgt", "uint64", + vfio_pci_nvlink2_get_tgt, NULL, NULL, + (void *) (uintptr_t) captgt->tgt, NULL); + trace_vfio_pci_nvlink2_setup_quirk_ssatgt(vdev->vbasedev.name, captgt-= >tgt, + atsdreg->size); + + object_property_add(OBJECT(vdev), "nvlink2-link-speed", "uint32", + vfio_pci_nvlink2_get_link_speed, NULL, NULL, + (void *) (uintptr_t) capspeed->link_speed, NULL); + trace_vfio_pci_nvlink2_setup_quirk_lnkspd(vdev->vbasedev.name, + capspeed->link_speed); +free_exit: + g_free(atsdreg); + + return ret; +} diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0142819ea6..8cecb53d5c 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3086,6 +3086,20 @@ static void vfio_realize(PCIDevice *pdev, Error **er= rp) } } =20 + if (vdev->vendor_id =3D=3D PCI_VENDOR_ID_NVIDIA) { + ret =3D vfio_pci_nvidia_v100_ram_init(vdev, errp); + if (ret && ret !=3D -ENODEV) { + error_report("Failed to setup NVIDIA V100 GPU RAM"); + } + } + + if (vdev->vendor_id =3D=3D PCI_VENDOR_ID_IBM) { + ret =3D vfio_pci_nvlink2_init(vdev, errp); + if (ret && ret !=3D -ENODEV) { + error_report("Failed to setup NVlink2 bridge"); + } + } + vfio_register_err_notifier(vdev); vfio_register_req_notifier(vdev); vfio_setup_resetfn_quirk(vdev); diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index c11c3f1670..cfcd1a81b8 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -196,6 +196,8 @@ int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp= ); int vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev, struct vfio_region_info *info, Error **errp); +int vfio_pci_nvidia_v100_ram_init(VFIOPCIDevice *vdev, Error **errp); +int vfio_pci_nvlink2_init(VFIOPCIDevice *vdev, Error **errp); =20 void vfio_display_reset(VFIOPCIDevice *vdev); int vfio_display_probe(VFIOPCIDevice *vdev, Error **errp); diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index eb589930a5..b1ef55a33f 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -86,6 +86,10 @@ vfio_pci_igd_opregion_enabled(const char *name) "%s" vfio_pci_igd_host_bridge_enabled(const char *name) "%s" vfio_pci_igd_lpc_bridge_enabled(const char *name) "%s" =20 +vfio_pci_nvidia_gpu_setup_quirk(const char *name, uint64_t tgt, uint64_t s= ize) "%s tgt=3D0x%"PRIx64" size=3D0x%"PRIx64 +vfio_pci_nvlink2_setup_quirk_ssatgt(const char *name, uint64_t tgt, uint64= _t size) "%s tgt=3D0x%"PRIx64" size=3D0x%"PRIx64 +vfio_pci_nvlink2_setup_quirk_lnkspd(const char *name, uint32_t link_speed)= "%s link_speed=3D0x%x" + # common.c vfio_region_write(const char *name, int index, uint64_t addr, uint64_t dat= a, unsigned size) " (%s:region%d+0x%"PRIx64", 0x%"PRIx64 ", %d)" vfio_region_read(char *name, int index, uint64_t addr, unsigned size, uint= 64_t data) " (%s:region%d+0x%"PRIx64", %d) =3D 0x%"PRIx64 diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index b4aad26798..53519c835e 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -87,6 +87,9 @@ struct SpaprPhbState { uint32_t mig_liobn; hwaddr mig_mem_win_addr, mig_mem_win_size; hwaddr mig_io_win_addr, mig_io_win_size; + hwaddr nv2_gpa_win_addr; + hwaddr nv2_atsd_win_addr; + struct spapr_phb_pci_nvgpu_config *nvgpus; }; =20 #define SPAPR_PCI_MEM_WIN_BUS_OFFSET 0x80000000ULL @@ -105,6 +108,22 @@ struct SpaprPhbState { =20 #define SPAPR_PCI_MSI_WINDOW 0x40000000000ULL =20 +#define SPAPR_PCI_NV2RAM64_WIN_BASE SPAPR_PCI_LIMIT +#define SPAPR_PCI_NV2RAM64_WIN_SIZE (2 * TiB) /* For up to 6 GPUs 256GB e= ach */ + +/* Max number of these GPUsper a physical box */ +#define NVGPU_MAX_NUM 6 +/* Max number of NVLinks per GPU in any physical box */ +#define NVGPU_MAX_LINKS 3 + +/* + * GPU RAM starts at 64TiB so huge DMA window to cover it all ends at 128T= iB + * which is enough. We do not need DMA for ATSD so we put them at 128TiB. + */ +#define SPAPR_PCI_NV2ATSD_WIN_BASE (128 * TiB) +#define SPAPR_PCI_NV2ATSD_WIN_SIZE (NVGPU_MAX_NUM * NVGPU_MAX_LINKS * \ + 64 * KiB) + static inline qemu_irq spapr_phb_lsi_qirq(struct SpaprPhbState *phb, int p= in) { SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); @@ -135,6 +154,13 @@ int spapr_phb_vfio_eeh_get_state(SpaprPhbState *sphb, = int *state); int spapr_phb_vfio_eeh_reset(SpaprPhbState *sphb, int option); int spapr_phb_vfio_eeh_configure(SpaprPhbState *sphb); void spapr_phb_vfio_reset(DeviceState *qdev); +void spapr_phb_nvgpu_setup(SpaprPhbState *sphb, Error **errp); +void spapr_phb_nvgpu_free(SpaprPhbState *sphb); +void spapr_phb_nvgpu_populate_dt(SpaprPhbState *sphb, void *fdt, int bus_o= ff, + Error **errp); +void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt); +void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int off= set, + SpaprPhbState *sphb); #else static inline bool spapr_phb_eeh_available(SpaprPhbState *sphb) { @@ -161,6 +187,25 @@ static inline int spapr_phb_vfio_eeh_configure(SpaprPh= bState *sphb) static inline void spapr_phb_vfio_reset(DeviceState *qdev) { } +static inline void spapr_phb_nvgpu_setup(SpaprPhbState *sphb, Error **errp) +{ +} +static inline void spapr_phb_nvgpu_free(SpaprPhbState *sphb) +{ +} +static inline void spapr_phb_nvgpu_populate_dt(SpaprPhbState *sphb, void *= fdt, + int bus_off, Error **errp) +{ +} +static inline void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, + void *fdt) +{ +} +static inline void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void= *fdt, + int offset, + SpaprPhbState *sphb) +{ +} #endif =20 void spapr_phb_dma_reset(SpaprPhbState *sphb); diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 5ea8081041..02b5ce7e40 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -123,7 +123,8 @@ struct SpaprMachineClass { void (*phb_placement)(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio,=20 hwaddr *mmio32, hwaddr *mmio64, - unsigned n_dma, uint32_t *liobns, Error **errp); + unsigned n_dma, uint32_t *liobns, hwaddr *nv2gpa, + hwaddr *nv2atsd, Error **errp); SpaprResizeHpt resize_hpt_default; SpaprCapabilities default_caps; SpaprIrq *irq; @@ -199,6 +200,8 @@ struct SpaprMachineState { =20 bool cmd_line_caps[SPAPR_CAP_NUM]; SpaprCapabilities def, eff, mig; + + unsigned gpu_numa_id; }; =20 #define H_SUCCESS 0 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556258959; cv=none; d=zoho.com; s=zohoarc; b=D3/6et2bv9ZoJx5aH+VYiMd31hANciPZGzI7XGxXzziNmC7/feEvitjTWm4x/jLmc3fIxcady/WkDRnhzkRqXmoyzhpNSjSbGWPLjWboEkz9kIN/ei5Si4badeXCGjzc3nOF72Pvs2UqYsedclo1nNOGJ+tu4h6vAbCape3YHiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556258959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qad1YEjIr9zC4aV8lYx29MulUYKY7y/7uxYywbQ+IVQ=; b=J7xATZT4rmcH7hMeBr4vXEaxgT7QVh4GNftlNeYkVMa9JCLduRTrZkCGZ+TmmdmRuSjxeLC1ck9gbM8fbs1hzjAbZtBRvNpxiIn/WzN9qaeI/DSUYdnC6Z5I71tqM/D6vz/vcisQcVeSHbXZGhrrN4jgQLcWmjsChg8WMuWO49o= ARC-Authentication-Results: i=1; mx.zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556258958610265.2860778137318; Thu, 25 Apr 2019 23:09:18 -0700 (PDT) Received: from localhost ([127.0.0.1]:39883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu2e-00077I-1b for importer@patchew.org; Fri, 26 Apr 2019 02:09:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0T-0005Mw-Kz for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0S-0004GK-Em for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:45 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:53777 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0R-00042U-9E; Fri, 26 Apr 2019 02:06:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tj6ylGz9s9T; Fri, 26 Apr 2019 16:06:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258793; bh=4+ipr73sCxCSk1JgY8chJfZ8CeG8J2usGw/GcxUpe9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUD1fB373d7ModjGwr26qyGBwJ20KvCVkuVGENpruGKwz2C+xt8RQrRhvQzGkmHUW 1Lls/PCCEi/enVUipuwkKiOrhaTcXvYT7YkzrUP+fTmA83AxMeBZjC7Wzv6rwqeq47 rhJlcKoSrQLiOig3cSavK28ev5iUs3XHjgTmsthM= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:53 +1000 Message-Id: <20190426060627.18153-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 02/36] hw/ppc/prep: Drop useless inclusion of "hw/input/i8042.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: gkurz@kaod.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.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 commit 47973a2dbf we split the last generic chipset out of the PC board, but missed to remove the i8042 keyboard controller. This omission was later fixed in commit 7cb00357c1, but here we forgot to remove the "i8042.h" include. Do it now. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20190316201528.9140-1-philmd@redhat.com> 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 847d320465..b7f459d475 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -40,7 +40,6 @@ #include "hw/ide.h" #include "hw/loader.h" #include "hw/timer/mc146818rtc.h" -#include "hw/input/i8042.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/arch_init.h" --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556258959; cv=none; d=zoho.com; s=zohoarc; b=i9vEUFZVNF6dJQmIgaUlmIyWwVTEY4SNVvU3PsNVVODzG7shuZ6kj1y6W5X31rn97LsZtkQm1XKt4OYFqGFUUzdC9j1FTZ69OBK6gapnIg0SWAXhuq7V0NQobu9pAvlmd0Z30P1U2SP31LYwrkMk+8Qi6xJ3iQYDE1fUluoYGUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556258959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pY7x1QPbw1jJa0wwTZeVXAu0acMM4xPwjVWU78YeqZ4=; b=DWr7I31B4irsiG7Qztj9WhI4o0cPtnQEIjZdpHiIoaB9c/dkl/LQ8fO0x0pyrJ0+cOY7cy8ZJ7BsI7L815LNQaZb/WgKkKeAnrsas5aBRxlff+oXxRZboY1fY2792GryBI+sRMKkW0O/jF07k9WHd18jLNNQa4Qt5FezN42wtHo= ARC-Authentication-Results: i=1; mx.zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556258959357316.38588526234685; Thu, 25 Apr 2019 23:09:19 -0700 (PDT) Received: from localhost ([127.0.0.1]:39885 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu2f-00077P-8q for importer@patchew.org; Fri, 26 Apr 2019 02:09:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0T-0005Mv-8W for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0S-0004G3-8K for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:45 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:58051 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0R-00045S-6M; Fri, 26 Apr 2019 02:06:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tj5SW7z9s9G; Fri, 26 Apr 2019 16:06:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258793; bh=fVSArwuHjDtfx9MjMlmUyGKpSfM86wL2ccdo3lroxmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=huCZKcX5NvggzgCXgs6d8MW8n3fpWRfj/tuctVDRI3Kwwogrc7GkjocRWDxddzx35 hmSTxf5NxFDA8k3r4TeyjrmAR2XdAsbgu9he+sM56krGbfp3hB6ACfDcvMIY77O4dW eeqzf0Ds6e/GnhOY43073oLaNw6bEumDRbWeyIf8= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:54 +1000 Message-Id: <20190426060627.18153-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] spapr/rtas: modify spapr_rtas_register() to remove RTAS handlers 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: gkurz@kaod.org, David Gibson , qemu-ppc@nongnu.org, clg@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 Removing RTAS handlers will become necessary when the new pseries machine supporting multiple interrupt mode is introduced. Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190321144914.19934-9-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_rtas.c | 2 +- include/hw/ppc/spapr.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 24c45b12d4..ee24212765 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -404,7 +404,7 @@ void spapr_rtas_register(int token, const char *name, s= papr_rtas_fn fn) =20 token -=3D RTAS_TOKEN_BASE; =20 - assert(!rtas_table[token].name); + assert(!name || !rtas_table[token].name); =20 rtas_table[token].name =3D name; rtas_table[token].fn =3D fn; diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 02b5ce7e40..9331f5e0b9 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -675,6 +675,10 @@ typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, SpaprMa= chineState *sm, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets); void spapr_rtas_register(int token, const char *name, spapr_rtas_fn fn); +static inline void spapr_rtas_unregister(int token) +{ + spapr_rtas_register(token, NULL, NULL); +} target_ulong spapr_rtas_call(PowerPCCPU *cpu, SpaprMachineState *sm, uint32_t token, uint32_t nargs, target_ulong = args, uint32_t nret, target_ulong rets); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556258959; cv=none; d=zoho.com; s=zohoarc; b=G70ZGsi+lBNfu3s3+9tYO6n5PZefOe8EazD6Z4bXrBwJJkjGPXs430kzaMVv7xfvaSFl1Ypz1WfBJxa3oNTNrliyxB92g66zU7cZ4L5OCtiJV48MyeO6RKMRpfsEQvKv+bd6qJQ2ZsNXU3ONgh8W4nlhFmA41qkN7zkp0vXvdMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556258959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pbOBhE3Oem8jYlCK+Z6DJOT96dfOcsV/22ES/tfcyz8=; b=Rfhn3M/r7tpYNbvyq24+KvFdWMBKeE8htqsh3tTFWqxabFMX2Hw5Pp93tII19bPrJd/I3c0EyI+7j4433GirBOWSc8k0CZ773ZuoqCV//p7wKLCu7E/V8pP6acqxOs0sLIaXrTBJ+9HrowasUm/UMS//JrZa4cYTGIva9CboYEE= ARC-Authentication-Results: i=1; mx.zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556258958743253.60975270039705; Thu, 25 Apr 2019 23:09:18 -0700 (PDT) Received: from localhost ([127.0.0.1]:39887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu2g-00078t-Vb for importer@patchew.org; Fri, 26 Apr 2019 02:09:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0T-0005Mx-Qk for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0S-0004Gv-Nz for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:45 -0400 Received: from ozlabs.org ([203.11.71.1]:45171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0R-00042T-5z; Fri, 26 Apr 2019 02:06:44 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tk1kmRz9s9N; Fri, 26 Apr 2019 16:06:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258794; bh=6Ag/QVok6X8QbcCfqfvcwtXbf9oCeHbgRVcFV9il+Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATEStrUI4np4kfJK1xz36/2v9iDvOC7GFFREwl2ubJNeFFfV8kbFD0AeCTppK/fm9 sie8C52YNnR3NvDJPiFO//m07DfXb1vdol+Lnixlwg4jWVeCaGRMXUAePRbC2U456x ComzIwN8o7znq3OxpCwlL2D7aXGo31mXlLiN788c= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:55 +1000 Message-Id: <20190426060627.18153-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] spapr/irq: remove spapr_ics_create() 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: gkurz@kaod.org, David Gibson , qemu-ppc@nongnu.org, clg@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 spapr_ics_create() is only called once. Merge it in spapr_irq_init_xics() and simplify a bit the error handling by using 'error_fatal' . Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190321144914.19934-13-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_irq.c | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 0a84e4cf63..b1f79ea9de 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -67,36 +67,11 @@ void spapr_irq_msi_reset(SpaprMachineState *spapr) * XICS IRQ backend. */ =20 -static ICSState *spapr_ics_create(SpaprMachineState *spapr, - int nr_irqs, Error **errp) -{ - Error *local_err =3D NULL; - Object *obj; - - 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); - object_property_set_int(obj, nr_irqs, "nr-irqs", &local_err); - if (local_err) { - goto error; - } - object_property_set_bool(obj, true, "realized", &local_err); - if (local_err) { - goto error; - } - - return ICS_BASE(obj); - -error: - error_propagate(errp, local_err); - return NULL; -} - static void spapr_irq_init_xics(SpaprMachineState *spapr, int nr_irqs, Error **errp) { MachineState *machine =3D MACHINE(spapr); + Object *obj; Error *local_err =3D NULL; bool xics_kvm =3D false; =20 @@ -108,7 +83,8 @@ static void spapr_irq_init_xics(SpaprMachineState *spapr= , int nr_irqs, if (machine_kernel_irqchip_required(machine) && !xics_kvm) { error_prepend(&local_err, "kernel_irqchip requested but unavailable: "); - goto error; + error_propagate(errp, local_err); + return; } error_free(local_err); local_err =3D NULL; @@ -118,10 +94,18 @@ static void spapr_irq_init_xics(SpaprMachineState *spa= pr, int nr_irqs, xics_spapr_init(spapr); } =20 - spapr->ics =3D spapr_ics_create(spapr, nr_irqs, &local_err); + 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_fatal); + object_property_set_int(obj, nr_irqs, "nr-irqs", &error_fatal); + object_property_set_bool(obj, true, "realized", &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } =20 -error: - error_propagate(errp, local_err); + spapr->ics =3D ICS_BASE(obj); } =20 #define ICS_IRQ_FREE(ics, srcno) \ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259115; cv=none; d=zoho.com; s=zohoarc; b=V8qlQ2vvzjE992w/w6cGi1KdrmQk2K7tpQrcKbiIwVbjYtXJrd1A/9ELefHRryuhvMWDrCOM1HxDsUkdBt/4M4/P/g0t4XmB/6D17bqa/SMiIKsRe6khrAmPxHMJOVJKXAOo4DL4t5++zD0pjg6zhfjoLSAT5oxnqtkGmh4QuSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259115; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pw9cG39xfPxeMbafYb2bITZps9XAhFETjTTZ6VUfISw=; b=jfwNgiZR82nYfnIls/ZxVT/7Ics/JHEiKvh0MHI0JqpHyb5wP3jGyVolvbigV8glBS/1GBMxjEZLycqfy7+hSF76VJiVZqKPm79pMcwcsUlImrgXIMi3ZusYEK7cu73O93z7UqkHX+uCqhKigFGd1ca8Wj4TM5dgEM3RKHQX/4M= ARC-Authentication-Results: i=1; mx.zoho.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 1556259115238691.4756044816633; Thu, 25 Apr 2019 23:11:55 -0700 (PDT) Received: from localhost ([127.0.0.1]:39943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu5O-0001Zq-H6 for importer@patchew.org; Fri, 26 Apr 2019 02:11:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0W-0005RR-U6 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0V-0004Nh-Ic for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:48 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:51539 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0V-0004HP-4L; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tk3F80z9s9y; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258794; bh=XDsmwXKQA16CWcBgdsMKK7XbptEur2qFvW8ebcZpvN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=arV62c1iE02xfLgC/XOntY3nWe/3bw1ObZQyDO2sbzSsHSmqRD4BEvbaMtQKYS1VM fDVSFBQ2tEUxwqudAlVMAuxQwbwhb5Eb5IZXLhYJlAEGpsxeNCAeB7rLCWxVzUGfRA XzqLaHorfDJH8QvKynbIEf5IXg4BKLW7RzF73Mts= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:56 +1000 Message-Id: <20190426060627.18153-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 05/36] target/ppc: Style fixes for ppc-models.[ch] 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/cpu-models.c | 2 +- target/ppc/cpu-models.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index 7c75963e3c..9d7050b5fa 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -740,7 +740,7 @@ POWERPC_DEF("7457a_v1.2", CPU_POWERPC_74x7A_v12, 7455, "PowerPC 7457A v1.2 (G4)") /* 64 bits PowerPC = */ -#if defined (TARGET_PPC64) +#if defined(TARGET_PPC64) POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970, "PowerPC 970 v2.2") POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970, diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index efdb2fa53c..4fdb73034d 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -393,7 +393,8 @@ enum { CPU_POWERPC_RS64IV =3D 0x00370000, #endif /* defined(TARGET_PPC64) */ /* Original POWER */ - /* XXX: should be POWER (RIOS), RSC3308, RSC4608, + /* + * XXX: should be POWER (RIOS), RSC3308, RSC4608, * POWER2 (RIOS2) & RSC2 (P2SC) here */ /* PA Semi core */ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259560; cv=none; d=zoho.com; s=zohoarc; b=K1dkeorsUSg5lDUl+KRM8J9cle6EuVBvDCLpKdRs8r0IS1r/mkHuQ984XErn1/FFjwCkVaA4FXMci1nKYYjRV/WJhyEyA0wy+q3Pm0QsAitdANoZjfTrqSSQLU3h2ryf9D7xI4fbew6SpiTbwszgVzfA1N8wWCjQRYZ9Sdnt5IE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259560; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3Yv0Lqaw3yJ48JuojaHqTGxdavyed+NRURZWnUKv4Ik=; b=Tacct0qM0UfgzXjjQGw/LcyCvtQkCK3m1PDQJnC8fhJ7A/G9vNrNgiYVbXww+x6LlXHtuVpP854IKC6aItC12p9Det76N/lVwP/mGZQlW7FQOyKnLzjbB+Av6gLlAfwEwK2/Ph4X9GDJa/9Jn+DJvuxuArxufW8v5DFKOCmui7M= ARC-Authentication-Results: i=1; mx.zoho.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 1556259560107611.8399473793074; Thu, 25 Apr 2019 23:19:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:40049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuCc-00016D-Ue for importer@patchew.org; Fri, 26 Apr 2019 02:19:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0b-0005XH-OK for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0W-0004Oq-1S for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:53 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:47161 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0V-0004J1-9c; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tl2b3Vz9sMM; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258795; bh=pTipk64LxN7ayRuzZmvoDSAhllGfsZ6P4T7Nb4oEWDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mK454z3hWhriHGwOEoIG1hFtdX4pN9w78H69dN5xjh8urnyxGGsG2YV7dxiHv9QaS b60kwNkif2Yp5wTrn5SAU8mWZvBLg+2Fm7rnr4Xjm8S6FyqnYRr/3BvqdevR7ei1WG diGGrzfXtn/DSSm7k8CSV6I/6P09XflLVBxJC9eo= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:57 +1000 Message-Id: <20190426060627.18153-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 06/36] target/ppc: Style fixes for cpu.[ch] 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/cpu.h | 237 ++++++++++++++++++++++++++--------------------- 1 file changed, 129 insertions(+), 108 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index d5259f7dd3..8a79db0c43 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -23,23 +23,28 @@ #include "qemu-common.h" #include "qemu/int128.h" =20 -//#define PPC_EMULATE_32BITS_HYPV +/* #define PPC_EMULATE_32BITS_HYPV */ =20 -#if defined (TARGET_PPC64) +#if defined(TARGET_PPC64) /* PowerPC 64 definitions */ #define TARGET_LONG_BITS 64 #define TARGET_PAGE_BITS 12 =20 #define TCG_GUEST_DEFAULT_MO 0 =20 -/* Note that the official physical address space bits is 62-M where M - is implementation dependent. I've not looked up M for the set of - cpus we emulate at the system level. */ +/* + * Note that the official physical address space bits is 62-M where M + * is implementation dependent. I've not looked up M for the set of + * cpus we emulate at the system level. + */ #define TARGET_PHYS_ADDR_SPACE_BITS 62 =20 -/* Note that the PPC environment architecture talks about 80 bit virtual - addresses, with segmentation. Obviously that's not all visible to a - single process, which is all we're concerned with here. */ +/* + * Note that the PPC environment architecture talks about 80 bit + * virtual addresses, with segmentation. Obviously that's not all + * visible to a single process, which is all we're concerned with + * here. + */ #ifdef TARGET_ABI32 # define TARGET_VIRT_ADDR_SPACE_BITS 32 #else @@ -49,7 +54,7 @@ #define TARGET_PAGE_BITS_64K 16 #define TARGET_PAGE_BITS_16M 24 =20 -#else /* defined (TARGET_PPC64) */ +#else /* defined(TARGET_PPC64) */ /* PowerPC 32 definitions */ #define TARGET_LONG_BITS 32 #define TARGET_PAGE_BITS 12 @@ -57,14 +62,14 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 36 #define TARGET_VIRT_ADDR_SPACE_BITS 32 =20 -#endif /* defined (TARGET_PPC64) */ +#endif /* defined(TARGET_PPC64) */ =20 #define CPUArchState struct CPUPPCState =20 #include "exec/cpu-defs.h" #include "cpu-qom.h" =20 -#if defined (TARGET_PPC64) +#if defined(TARGET_PPC64) #define PPC_ELF_MACHINE EM_PPC64 #else #define PPC_ELF_MACHINE EM_PPC @@ -237,9 +242,11 @@ struct ppc_spr_t { const char *name; target_ulong default_value; #ifdef CONFIG_KVM - /* We (ab)use the fact that all the SPRs will have ids for the + /* + * We (ab)use the fact that all the SPRs will have ids for the * ONE_REG interface will have KVM_REG_PPC to use 0 as meaning, - * don't sync this */ + * don't sync this + */ uint64_t one_reg_id; #endif }; @@ -656,39 +663,39 @@ enum { #define fpscr_eex (((env->fpscr) >> FPSCR_XX) & ((env->fpscr) >> FPSCR_XE)= & \ 0x1F) =20 -#define FP_FX (1ull << FPSCR_FX) -#define FP_FEX (1ull << FPSCR_FEX) -#define FP_VX (1ull << FPSCR_VX) -#define FP_OX (1ull << FPSCR_OX) -#define FP_UX (1ull << FPSCR_UX) -#define FP_ZX (1ull << FPSCR_ZX) -#define FP_XX (1ull << FPSCR_XX) -#define FP_VXSNAN (1ull << FPSCR_VXSNAN) -#define FP_VXISI (1ull << FPSCR_VXISI) -#define FP_VXIDI (1ull << FPSCR_VXIDI) -#define FP_VXZDZ (1ull << FPSCR_VXZDZ) -#define FP_VXIMZ (1ull << FPSCR_VXIMZ) -#define FP_VXVC (1ull << FPSCR_VXVC) -#define FP_FR (1ull << FSPCR_FR) -#define FP_FI (1ull << FPSCR_FI) -#define FP_C (1ull << FPSCR_C) -#define FP_FL (1ull << FPSCR_FL) -#define FP_FG (1ull << FPSCR_FG) -#define FP_FE (1ull << FPSCR_FE) -#define FP_FU (1ull << FPSCR_FU) -#define FP_FPCC (FP_FL | FP_FG | FP_FE | FP_FU) -#define FP_FPRF (FP_C | FP_FL | FP_FG | FP_FE | FP_FU) -#define FP_VXSOFT (1ull << FPSCR_VXSOFT) -#define FP_VXSQRT (1ull << FPSCR_VXSQRT) -#define FP_VXCVI (1ull << FPSCR_VXCVI) -#define FP_VE (1ull << FPSCR_VE) -#define FP_OE (1ull << FPSCR_OE) -#define FP_UE (1ull << FPSCR_UE) -#define FP_ZE (1ull << FPSCR_ZE) -#define FP_XE (1ull << FPSCR_XE) -#define FP_NI (1ull << FPSCR_NI) -#define FP_RN1 (1ull << FPSCR_RN1) -#define FP_RN (1ull << FPSCR_RN) +#define FP_FX (1ull << FPSCR_FX) +#define FP_FEX (1ull << FPSCR_FEX) +#define FP_VX (1ull << FPSCR_VX) +#define FP_OX (1ull << FPSCR_OX) +#define FP_UX (1ull << FPSCR_UX) +#define FP_ZX (1ull << FPSCR_ZX) +#define FP_XX (1ull << FPSCR_XX) +#define FP_VXSNAN (1ull << FPSCR_VXSNAN) +#define FP_VXISI (1ull << FPSCR_VXISI) +#define FP_VXIDI (1ull << FPSCR_VXIDI) +#define FP_VXZDZ (1ull << FPSCR_VXZDZ) +#define FP_VXIMZ (1ull << FPSCR_VXIMZ) +#define FP_VXVC (1ull << FPSCR_VXVC) +#define FP_FR (1ull << FSPCR_FR) +#define FP_FI (1ull << FPSCR_FI) +#define FP_C (1ull << FPSCR_C) +#define FP_FL (1ull << FPSCR_FL) +#define FP_FG (1ull << FPSCR_FG) +#define FP_FE (1ull << FPSCR_FE) +#define FP_FU (1ull << FPSCR_FU) +#define FP_FPCC (FP_FL | FP_FG | FP_FE | FP_FU) +#define FP_FPRF (FP_C | FP_FL | FP_FG | FP_FE | FP_FU) +#define FP_VXSOFT (1ull << FPSCR_VXSOFT) +#define FP_VXSQRT (1ull << FPSCR_VXSQRT) +#define FP_VXCVI (1ull << FPSCR_VXCVI) +#define FP_VE (1ull << FPSCR_VE) +#define FP_OE (1ull << FPSCR_OE) +#define FP_UE (1ull << FPSCR_UE) +#define FP_ZE (1ull << FPSCR_ZE) +#define FP_XE (1ull << FPSCR_XE) +#define FP_NI (1ull << FPSCR_NI) +#define FP_RN1 (1ull << FPSCR_RN1) +#define FP_RN (1ull << FPSCR_RN) =20 /* the exception bits which can be cleared by mcrfs - includes FX */ #define FP_EX_CLEAR_BITS (FP_FX | FP_OX | FP_UX | FP_ZX | \ @@ -698,8 +705,8 @@ enum { =20 /*************************************************************************= ****/ /* Vector status and control register */ -#define VSCR_NJ 16 /* Vector non-java */ -#define VSCR_SAT 0 /* Vector saturation */ +#define VSCR_NJ 16 /* Vector non-java */ +#define VSCR_SAT 0 /* Vector saturation */ =20 /*************************************************************************= ****/ /* BookE e500 MMU registers */ @@ -962,9 +969,10 @@ struct ppc_radix_page_info { /*************************************************************************= ****/ /* The whole PowerPC CPU context */ =20 -/* PowerPC needs eight modes for different hypervisor/supervisor/guest + - * real/paged mode combinations. The other two modes are for external PID - * load/store. +/* + * PowerPC needs eight modes for different hypervisor/supervisor/guest + * + real/paged mode combinations. The other two modes are for + * external PID load/store. */ #define NB_MMU_MODES 10 #define MMU_MODE8_SUFFIX _epl @@ -976,8 +984,9 @@ struct ppc_radix_page_info { #define PPC_CPU_INDIRECT_OPCODES_LEN 0x20 =20 struct CPUPPCState { - /* First are the most commonly used resources - * during translated code execution + /* + * First are the most commonly used resources during translated + * code execution */ /* general purpose registers */ target_ulong gpr[32]; @@ -1023,8 +1032,8 @@ struct CPUPPCState { /* High part of 128-bit helper return. */ uint64_t retxh; =20 - int access_type; /* when a memory exception occurs, the access - type is stored here */ + /* when a memory exception occurs, the access type is stored here */ + int access_type; =20 CPU_COMMON =20 @@ -1072,8 +1081,10 @@ struct CPUPPCState { /* SPE registers */ uint64_t spe_acc; uint32_t spe_fscr; - /* SPE and Altivec can share a status since they will never be used - * simultaneously */ + /* + * SPE and Altivec can share a status since they will never be + * used simultaneously + */ float_status vec_status; =20 /* Internal devices resources */ @@ -1103,7 +1114,8 @@ struct CPUPPCState { int error_code; uint32_t pending_interrupts; #if !defined(CONFIG_USER_ONLY) - /* This is the IRQ controller, which is implementation dependent + /* + * This is the IRQ controller, which is implementation dependent * and only relevant when emulating a complete machine. */ uint32_t irq_input_state; @@ -1117,7 +1129,8 @@ struct CPUPPCState { hwaddr mpic_iack; /* true when the external proxy facility mode is enabled */ bool mpic_proxy; - /* set when the processor has an HV mode, thus HV priv + /* + * set when the processor has an HV mode, thus HV priv * instructions and SPRs are diallowed if MSR:HV is 0 */ bool has_hv_mode; @@ -1149,8 +1162,10 @@ struct CPUPPCState { =20 /* booke timers */ =20 - /* Specifies bit locations of the Time Base used to signal a fixed tim= er - * exception on a transition from 0 to 1. (watchdog or fixed-interval = timer) + /* + * Specifies bit locations of the Time Base used to signal a fixed + * timer exception on a transition from 0 to 1. (watchdog or + * fixed-interval timer) * * 0 selects the least significant bit. * 63 selects the most significant bit. @@ -1290,53 +1305,54 @@ extern const struct VMStateDescription vmstate_ppc_= cpu; =20 /*************************************************************************= ****/ void ppc_translate_init(void); -/* you can call this signal handler from your SIGBUS and SIGSEGV - signal handlers to inform the virtual CPU of exceptions. non zero - is returned if the signal was handled by the virtual CPU. */ -int cpu_ppc_signal_handler (int host_signum, void *pinfo, - void *puc); +/* + * you can call this signal handler from your SIGBUS and SIGSEGV + * signal handlers to inform the virtual CPU of exceptions. non zero + * is returned if the signal was handled by the virtual CPU. + */ +int cpu_ppc_signal_handler(int host_signum, void *pinfo, void *puc); #if defined(CONFIG_USER_ONLY) int ppc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int r= w, int mmu_idx); #endif =20 #if !defined(CONFIG_USER_ONLY) -void ppc_store_sdr1 (CPUPPCState *env, target_ulong value); +void ppc_store_sdr1(CPUPPCState *env, target_ulong value); void ppc_store_ptcr(CPUPPCState *env, target_ulong value); #endif /* !defined(CONFIG_USER_ONLY) */ -void ppc_store_msr (CPUPPCState *env, target_ulong value); +void ppc_store_msr(CPUPPCState *env, target_ulong value); =20 void ppc_cpu_list(void); =20 /* Time-base and decrementer management */ #ifndef NO_CPU_IO_DEFS -uint64_t cpu_ppc_load_tbl (CPUPPCState *env); -uint32_t cpu_ppc_load_tbu (CPUPPCState *env); -void cpu_ppc_store_tbu (CPUPPCState *env, uint32_t value); -void cpu_ppc_store_tbl (CPUPPCState *env, uint32_t value); -uint64_t cpu_ppc_load_atbl (CPUPPCState *env); -uint32_t cpu_ppc_load_atbu (CPUPPCState *env); -void cpu_ppc_store_atbl (CPUPPCState *env, uint32_t value); -void cpu_ppc_store_atbu (CPUPPCState *env, uint32_t value); +uint64_t cpu_ppc_load_tbl(CPUPPCState *env); +uint32_t cpu_ppc_load_tbu(CPUPPCState *env); +void cpu_ppc_store_tbu(CPUPPCState *env, uint32_t value); +void cpu_ppc_store_tbl(CPUPPCState *env, uint32_t value); +uint64_t cpu_ppc_load_atbl(CPUPPCState *env); +uint32_t cpu_ppc_load_atbu(CPUPPCState *env); +void cpu_ppc_store_atbl(CPUPPCState *env, uint32_t value); +void cpu_ppc_store_atbu(CPUPPCState *env, uint32_t value); bool ppc_decr_clear_on_delivery(CPUPPCState *env); target_ulong cpu_ppc_load_decr(CPUPPCState *env); void cpu_ppc_store_decr(CPUPPCState *env, target_ulong value); target_ulong cpu_ppc_load_hdecr(CPUPPCState *env); void cpu_ppc_store_hdecr(CPUPPCState *env, target_ulong value); -uint64_t cpu_ppc_load_purr (CPUPPCState *env); -uint32_t cpu_ppc601_load_rtcl (CPUPPCState *env); -uint32_t cpu_ppc601_load_rtcu (CPUPPCState *env); +uint64_t cpu_ppc_load_purr(CPUPPCState *env); +uint32_t cpu_ppc601_load_rtcl(CPUPPCState *env); +uint32_t cpu_ppc601_load_rtcu(CPUPPCState *env); #if !defined(CONFIG_USER_ONLY) -void cpu_ppc601_store_rtcl (CPUPPCState *env, uint32_t value); -void cpu_ppc601_store_rtcu (CPUPPCState *env, uint32_t value); -target_ulong load_40x_pit (CPUPPCState *env); -void store_40x_pit (CPUPPCState *env, target_ulong val); -void store_40x_dbcr0 (CPUPPCState *env, uint32_t val); -void store_40x_sler (CPUPPCState *env, uint32_t val); -void store_booke_tcr (CPUPPCState *env, target_ulong val); -void store_booke_tsr (CPUPPCState *env, target_ulong val); -void ppc_tlb_invalidate_all (CPUPPCState *env); -void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr); +void cpu_ppc601_store_rtcl(CPUPPCState *env, uint32_t value); +void cpu_ppc601_store_rtcu(CPUPPCState *env, uint32_t value); +target_ulong load_40x_pit(CPUPPCState *env); +void store_40x_pit(CPUPPCState *env, target_ulong val); +void store_40x_dbcr0(CPUPPCState *env, uint32_t val); +void store_40x_sler(CPUPPCState *env, uint32_t val); +void store_booke_tcr(CPUPPCState *env, target_ulong val); +void store_booke_tsr(CPUPPCState *env, target_ulong val); +void ppc_tlb_invalidate_all(CPUPPCState *env); +void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr); void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp); #endif #endif @@ -1349,7 +1365,8 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env,= int gprn) =20 gprv =3D env->gpr[gprn]; if (env->flags & POWERPC_FLAG_SPE) { - /* If the CPU implements the SPE extension, we have to get the + /* + * If the CPU implements the SPE extension, we have to get the * high bits of the GPR from the gprh storage area */ gprv &=3D 0xFFFFFFFFULL; @@ -1360,8 +1377,8 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *env,= int gprn) } =20 /* Device control registers */ -int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp); -int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val); +int ppc_dcr_read(ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp); +int ppc_dcr_write(ppc_dcr_t *dcr_env, int dcrn, uint32_t val); =20 #define POWERPC_CPU_TYPE_SUFFIX "-" TYPE_POWERPC_CPU #define POWERPC_CPU_TYPE_NAME(model) model POWERPC_CPU_TYPE_SUFFIX @@ -1372,7 +1389,7 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint= 32_t val); =20 /* MMU modes definitions */ #define MMU_USER_IDX 0 -static inline int cpu_mmu_index (CPUPPCState *env, bool ifetch) +static inline int cpu_mmu_index(CPUPPCState *env, bool ifetch) { return ifetch ? env->immu_idx : env->dmmu_idx; } @@ -1990,17 +2007,17 @@ void ppc_compat_add_property(Object *obj, const cha= r *name, /* External Input Interrupt Directed to Guest State */ #define EPCR_EXTGS (1 << 31) =20 -#define L1CSR0_CPE 0x00010000 /* Data Cache Parity Enable */ -#define L1CSR0_CUL 0x00000400 /* (D-)Cache Unable to Lock */ -#define L1CSR0_DCLFR 0x00000100 /* D-Cache Lock Flash Reset */ -#define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */ -#define L1CSR0_DCE 0x00000001 /* Data Cache Enable */ +#define L1CSR0_CPE 0x00010000 /* Data Cache Parity Enable */ +#define L1CSR0_CUL 0x00000400 /* (D-)Cache Unable to Lock */ +#define L1CSR0_DCLFR 0x00000100 /* D-Cache Lock Flash Reset */ +#define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */ +#define L1CSR0_DCE 0x00000001 /* Data Cache Enable */ =20 -#define L1CSR1_CPE 0x00010000 /* Instruction Cache Parity Enable */ -#define L1CSR1_ICUL 0x00000400 /* I-Cache Unable to Lock */ -#define L1CSR1_ICLFR 0x00000100 /* I-Cache Lock Flash Reset */ -#define L1CSR1_ICFI 0x00000002 /* Instruction Cache Flash Invalidate */ -#define L1CSR1_ICE 0x00000001 /* Instruction Cache Enable */ +#define L1CSR1_CPE 0x00010000 /* Instruction Cache Parity Enable */ +#define L1CSR1_ICUL 0x00000400 /* I-Cache Unable to Lock */ +#define L1CSR1_ICLFR 0x00000100 /* I-Cache Lock Flash Reset */ +#define L1CSR1_ICFI 0x00000002 /* Instruction Cache Flash Invalidate = */ +#define L1CSR1_ICE 0x00000001 /* Instruction Cache Enable */ =20 /* HID0 bits */ #define HID0_DEEPNAP (1 << 24) /* pre-2.06 */ @@ -2226,7 +2243,8 @@ enum { }; =20 /*************************************************************************= ****/ -/* Memory access type : +/* + * Memory access type : * may be needed for precise access rights control and precise exceptions. */ enum { @@ -2242,8 +2260,9 @@ enum { ACCESS_CACHE =3D 0x60, /* Cache manipulation */ }; =20 -/* Hardware interruption sources: - * all those exception can be raised simulteaneously +/* + * Hardware interrupt sources: + * all those exception can be raised simulteaneously */ /* Input pins definitions */ enum { @@ -2325,9 +2344,11 @@ enum { enum { /* POWER7 input pins */ POWER7_INPUT_INT =3D 0, - /* POWER7 probably has other inputs, but we don't care about them + /* + * POWER7 probably has other inputs, but we don't care about them * for any existing machine. We can wire these up when we need - * them */ + * them + */ POWER7_INPUT_NB, }; =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259466; cv=none; d=zoho.com; s=zohoarc; b=coe8cUmcEvEfDJUcdsGQlad/0lzOT7A4+8MNh9+S5UvJNP3coiBdvo5ogQu489vc3zyyX+SK2lbwgrGk5IRqRgzpZAcBfri6fdOy6JGCvaTu2t2k6g79NK3h6of3rZPq0Up07FC25roz3jYmdd6kJg2yx9q80o4KdpPllEbGNB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259466; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZWE3hShLKHORJy19iEqCuI/lqvWHiyg/VoxCHwPs3ho=; b=niGiYRmdWEQXRZCQiamvEDNBS8D361VcrWEQqGXBySzpIajWuvTPqRCB4rQcoCfV2qyGkNoO6/zM0wNxqu+kiVrFabSzOvn6GfZxzKiQ71Ka0TZreiK2nRcoUY/bqnKGMIl1qrexFj7h0sfDb7P2rf+X/8nOrm7EFR6HbspOnHs= ARC-Authentication-Results: i=1; mx.zoho.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 155625946647834.6269014792133; Thu, 25 Apr 2019 23:17:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:40036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuB7-0006xu-CR for importer@patchew.org; Fri, 26 Apr 2019 02:17:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0Y-0005Sb-CG for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0V-0004NI-EZ for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:50 -0400 Received: from ozlabs.org ([203.11.71.1]:41661) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0U-0004Hu-QW; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tl0vdTz9sNB; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258795; bh=s5x6nLldtW+eEu1q42TWtsIFw8+c6FDxhi8sXt/fsg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KainzyatPDzIpe9M0yZiQStZAh8Wy60eIYiOBoZbyNCc2K9thTJl/1N+jNBTQX7rz rdFPIUAsJLZYh3n1VSx707ON6kCx37uTJx3+O6zzRUD5hOZ+MAUd95ERZxwjKFgTzP 5CewNMahoA8ecEwAP68S1N1zREee28o95XP2fi50= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:58 +1000 Message-Id: <20190426060627.18153-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 07/36] target/ppc: Style fixes for int_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/int_helper.c | 70 +++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 162add561e..f6a088ac08 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -137,7 +137,8 @@ uint64_t helper_divde(CPUPPCState *env, uint64_t rau, u= int64_t rbu, uint32_t oe) /* if x =3D 0xab, returns 0xababababababababa */ #define pattern(x) (((x) & 0xff) * (~(target_ulong)0 / 0xff)) =20 -/* substract 1 from each byte, and with inverse, check if MSB is set at ea= ch +/* + * subtract 1 from each byte, and with inverse, check if MSB is set at each * byte. * i.e. ((0x00 - 0x01) & ~(0x00)) & 0x80 * (0xFF & 0xFF) & 0x80 =3D 0x80 (zero found) @@ -156,7 +157,8 @@ uint32_t helper_cmpeqb(target_ulong ra, target_ulong rb) #undef haszero #undef hasvalue =20 -/* Return invalid random number. +/* + * Return invalid random number. * * FIXME: Add rng backend or other mechanism to get cryptographically suit= able * random number @@ -181,7 +183,7 @@ uint64_t helper_bpermd(uint64_t rs, uint64_t rb) uint64_t ra =3D 0; =20 for (i =3D 0; i < 8; i++) { - int index =3D (rs >> (i*8)) & 0xFF; + int index =3D (rs >> (i * 8)) & 0xFF; if (index < 64) { if (rb & PPC_BIT(index)) { ra |=3D 1 << i; @@ -370,7 +372,8 @@ target_ulong helper_divso(CPUPPCState *env, target_ulon= g arg1, /* 602 specific instructions */ /* mfrom is the most crazy instruction ever seen, imho ! */ /* Real implementation uses a ROM table. Do the same */ -/* Extremely decomposed: +/* + * Extremely decomposed: * -arg / 256 * return 256 * log10(10 + 1.0) + 0.5 */ @@ -393,7 +396,7 @@ target_ulong helper_602_mfrom(target_ulong arg) for (index =3D 0; index < ARRAY_SIZE(r->element); index++) #else #define VECTOR_FOR_INORDER_I(index, element) \ - for (index =3D ARRAY_SIZE(r->element)-1; index >=3D 0; index--) + for (index =3D ARRAY_SIZE(r->element) - 1; index >=3D 0; index--) #endif =20 /* Saturating arithmetic helpers. */ @@ -634,7 +637,8 @@ void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) \ } \ } =20 -/* VABSDU - Vector absolute difference unsigned +/* + * VABSDU - Vector absolute difference unsigned * name - instruction mnemonic suffix (b: byte, h: halfword, w: word) * element - element type to access from vector */ @@ -739,7 +743,8 @@ void helper_vcmpne##suffix(CPUPPCState *env, ppc_avr_t = *r, \ } \ } =20 -/* VCMPNEZ - Vector compare not equal to zero +/* + * VCMPNEZ - Vector compare not equal to zero * suffix - instruction mnemonic suffix (b: byte, h: halfword, w: word) * element - element type to access from vector */ @@ -1138,7 +1143,7 @@ void helper_vpermr(CPUPPCState *env, ppc_avr_t *r, pp= c_avr_t *a, ppc_avr_t *b, #define VBPERMQ_DW(index) (((index) & 0x40) !=3D 0) #define EXTRACT_BIT(avr, i, index) (extract64((avr)->u64[i], index, 1)) #else -#define VBPERMQ_INDEX(avr, i) ((avr)->u8[15-(i)]) +#define VBPERMQ_INDEX(avr, i) ((avr)->u8[15 - (i)]) #define VBPERMD_INDEX(i) (1 - i) #define VBPERMQ_DW(index) (((index) & 0x40) =3D=3D 0) #define EXTRACT_BIT(avr, i, index) \ @@ -1169,7 +1174,7 @@ void helper_vbpermq(ppc_avr_t *r, ppc_avr_t *a, ppc_a= vr_t *b) int index =3D VBPERMQ_INDEX(b, i); =20 if (index < 128) { - uint64_t mask =3D (1ull << (63-(index & 0x3F))); + uint64_t mask =3D (1ull << (63 - (index & 0x3F))); if (a->u64[VBPERMQ_DW(index)] & mask) { perm |=3D (0x8000 >> i); } @@ -1449,9 +1454,9 @@ void helper_vgbbd(ppc_avr_t *r, ppc_avr_t *b) =20 VECTOR_FOR_INORDER_I(i, u8) { #if defined(HOST_WORDS_BIGENDIAN) - t[i>>3] |=3D VGBBD_MASKS[b->u8[i]] >> (i & 7); + t[i >> 3] |=3D VGBBD_MASKS[b->u8[i]] >> (i & 7); #else - t[i>>3] |=3D VGBBD_MASKS[b->u8[i]] >> (7-(i & 7)); + t[i >> 3] |=3D VGBBD_MASKS[b->u8[i]] >> (7 - (i & 7)); #endif } =20 @@ -1463,19 +1468,19 @@ void helper_vgbbd(ppc_avr_t *r, ppc_avr_t *b) void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ { \ int i, j; \ - trgtyp prod[sizeof(ppc_avr_t)/sizeof(a->srcfld[0])]; \ + trgtyp prod[sizeof(ppc_avr_t) / sizeof(a->srcfld[0])]; \ \ VECTOR_FOR_INORDER_I(i, srcfld) { \ prod[i] =3D 0; \ for (j =3D 0; j < sizeof(a->srcfld[0]) * 8; j++) { \ - if (a->srcfld[i] & (1ull<srcfld[i] & (1ull << j)) { \ prod[i] ^=3D ((trgtyp)b->srcfld[i] << j); \ } \ } \ } \ \ VECTOR_FOR_INORDER_I(i, trgfld) { \ - r->trgfld[i] =3D prod[2*i] ^ prod[2*i+1]; \ + r->trgfld[i] =3D prod[2 * i] ^ prod[2 * i + 1]; \ } \ } =20 @@ -1493,7 +1498,7 @@ void helper_vpmsumd(ppc_avr_t *r, ppc_avr_t *a, ppc_a= vr_t *b) VECTOR_FOR_INORDER_I(i, u64) { prod[i] =3D 0; for (j =3D 0; j < 64; j++) { - if (a->u64[i] & (1ull<u64[i] & (1ull << j)) { prod[i] ^=3D (((__uint128_t)b->u64[i]) << j); } } @@ -1508,7 +1513,7 @@ void helper_vpmsumd(ppc_avr_t *r, ppc_avr_t *a, ppc_a= vr_t *b) VECTOR_FOR_INORDER_I(i, u64) { prod[i].VsrD(1) =3D prod[i].VsrD(0) =3D 0; for (j =3D 0; j < 64; j++) { - if (a->u64[i] & (1ull<u64[i] & (1ull << j)) { ppc_avr_t bshift; if (j =3D=3D 0) { bshift.VsrD(0) =3D 0; @@ -1548,9 +1553,9 @@ void helper_vpkpx(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) VECTOR_FOR_INORDER_I(j, u32) { uint32_t e =3D x[i]->u32[j]; =20 - result.u16[4*i+j] =3D (((e >> 9) & 0xfc00) | - ((e >> 6) & 0x3e0) | - ((e >> 3) & 0x1f)); + result.u16[4 * i + j] =3D (((e >> 9) & 0xfc00) | + ((e >> 6) & 0x3e0) | + ((e >> 3) & 0x1f)); } } *r =3D result; @@ -1568,7 +1573,7 @@ void helper_vpkpx(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) \ VECTOR_FOR_INORDER_I(i, from) { \ result.to[i] =3D cvt(a0->from[i], &sat); \ - result.to[i+ARRAY_SIZE(r->from)] =3D cvt(a1->from[i], &sat); \ + result.to[i + ARRAY_SIZE(r->from)] =3D cvt(a1->from[i], &sat);\ } \ *r =3D result; \ if (dosat && sat) { \ @@ -1736,9 +1741,11 @@ VEXTU_X_DO(vextuhrx, 16, 0) VEXTU_X_DO(vextuwrx, 32, 0) #undef VEXTU_X_DO =20 -/* The specification says that the results are undefined if all of the - * shift counts are not identical. We check to make sure that they are - * to conform to what real hardware appears to do. */ +/* + * The specification says that the results are undefined if all of the + * shift counts are not identical. We check to make sure that they + * are to conform to what real hardware appears to do. + */ #define VSHIFT(suffix, leftp) \ void helper_vs##suffix(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ { \ @@ -1805,9 +1812,10 @@ void helper_vsrv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr= _t *b) int i; unsigned int shift, bytes; =20 - /* Use reverse order, as destination and source register can be same. = Its - * being modified in place saving temporary, reverse order will guaran= tee - * that computed result is not fed back. + /* + * Use reverse order, as destination and source register can be + * same. Its being modified in place saving temporary, reverse + * order will guarantee that computed result is not fed back. */ for (i =3D ARRAY_SIZE(r->u8) - 1; i >=3D 0; i--) { shift =3D b->u8[i] & 0x7; /* extract shift value */ @@ -1840,7 +1848,7 @@ void helper_vslo(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_= t *b) =20 #if defined(HOST_WORDS_BIGENDIAN) memmove(&r->u8[0], &a->u8[sh], 16 - sh); - memset(&r->u8[16-sh], 0, sh); + memset(&r->u8[16 - sh], 0, sh); #else memmove(&r->u8[sh], &a->u8[0], 16 - sh); memset(&r->u8[0], 0, sh); @@ -2112,7 +2120,7 @@ void helper_vsum4ubs(CPUPPCState *env, ppc_avr_t *r, = ppc_avr_t *a, ppc_avr_t *b) ppc_avr_t result; \ \ for (i =3D 0; i < ARRAY_SIZE(r->u32); i++) { \ - uint16_t e =3D b->u16[hi ? i : i+4]; \ + uint16_t e =3D b->u16[hi ? i : i + 4]; \ uint8_t a =3D (e >> 15) ? 0xff : 0; \ uint8_t r =3D (e >> 10) & 0x1f; \ uint8_t g =3D (e >> 5) & 0x1f; \ @@ -2463,7 +2471,7 @@ static void bcd_put_digit(ppc_avr_t *bcd, uint8_t dig= it, int n) { if (n & 1) { bcd->u8[BCD_DIG_BYTE(n)] &=3D 0x0F; - bcd->u8[BCD_DIG_BYTE(n)] |=3D (digit<<4); + bcd->u8[BCD_DIG_BYTE(n)] |=3D (digit << 4); } else { bcd->u8[BCD_DIG_BYTE(n)] &=3D 0xF0; bcd->u8[BCD_DIG_BYTE(n)] |=3D digit; @@ -3220,7 +3228,7 @@ void helper_vshasigmad(ppc_avr_t *r, ppc_avr_t *a, u= int32_t st_six) =20 for (i =3D 0; i < ARRAY_SIZE(r->u64); i++) { if (st =3D=3D 0) { - if ((six & (0x8 >> (2*i))) =3D=3D 0) { + if ((six & (0x8 >> (2 * i))) =3D=3D 0) { r->VsrD(i) =3D ror64(a->VsrD(i), 1) ^ ror64(a->VsrD(i), 8) ^ (a->VsrD(i) >> 7); @@ -3230,7 +3238,7 @@ void helper_vshasigmad(ppc_avr_t *r, ppc_avr_t *a, u= int32_t st_six) (a->VsrD(i) >> 6); } } else { /* st =3D=3D 1 */ - if ((six & (0x8 >> (2*i))) =3D=3D 0) { + if ((six & (0x8 >> (2 * i))) =3D=3D 0) { r->VsrD(i) =3D ror64(a->VsrD(i), 28) ^ ror64(a->VsrD(i), 34) ^ ror64(a->VsrD(i), 39); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259335; cv=none; d=zoho.com; s=zohoarc; b=cb4QSHtZ+o1CDwYuUm7hMpcHR30XpVjlGplZR4d2wzkZgnaPJV1AiktRbqzI798ZAbpzwG3GieRzA4kg3HaMvvL/0n6gRTjhDbNfnNi5Lhi7AuzckamdmOrwvG2NuVUqK32tVYB/FT0fZOqpXKoCgcc7mQNrG6z+846+7lQKTKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259335; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=729nlOtnwVrpjKvJijvFi/JuoroVGzSH+8WtjxKUD3c=; b=P/c7nEjp+cLaMZ7OBXieOJ9y79tMGwu6tqEKVIgl3VphmE+KCvVPDT6T/TGXkc5o0RsoP13+Tr6/xieExE2osesWJZ9N7wo6z9z2uGllFi0+1cqcEQJw027bLscBTkHQhPIAS1+lJVnesobpbGUd2uK2ClIrK2PtfBDS1MpSj4I= ARC-Authentication-Results: i=1; mx.zoho.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 1556259335465563.5624121745935; Thu, 25 Apr 2019 23:15:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:39980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu90-0004xi-6j for importer@patchew.org; Fri, 26 Apr 2019 02:15:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0Z-0005UE-Lh for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0V-0004OG-Qh for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:51 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:35989 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0V-0004HO-2P; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tk4j0gz9sBr; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258794; bh=XNckpG/gouMFRLclE2bybEtFxTI+8k+8aYpaeWNDa0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXrlh7EapzZ8zFSksON6ICDGx8o2C+4mpcUotIyoGXW1pjvyI/bofAw26BXMUzPq8 Zp6ktSJTof5MxdE6zKRo181iQbCQpFvNyiuK9tkEbX4GuLR/kYX5BYFeQJP5uQBCyA yAmNSDXQOA+TYBI5Rjfd2LQ/4LZxSva12aKuHjlo= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:05:59 +1000 Message-Id: <20190426060627.18153-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for fpu_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/fpu_helper.c | 134 +++++++++++++++++++++++++--------------- 1 file changed, 83 insertions(+), 51 deletions(-) diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c index 2ed4f42275..0b7308f539 100644 --- a/target/ppc/fpu_helper.c +++ b/target/ppc/fpu_helper.c @@ -90,10 +90,12 @@ uint32_t helper_tosingle(uint64_t arg) ret =3D extract64(arg, 62, 2) << 30; ret |=3D extract64(arg, 29, 30); } else { - /* Zero or Denormal result. If the exponent is in bounds for - * a single-precision denormal result, extract the proper bits. - * If the input is not zero, and the exponent is out of bounds, - * then the result is undefined; this underflows to zero. + /* + * Zero or Denormal result. If the exponent is in bounds for + * a single-precision denormal result, extract the proper + * bits. If the input is not zero, and the exponent is out of + * bounds, then the result is undefined; this underflows to + * zero. */ ret =3D extract64(arg, 63, 1) << 31; if (unlikely(exp >=3D 874)) { @@ -1090,7 +1092,7 @@ uint32_t helper_ftsqrt(uint64_t frb) fe_flag =3D 1; } else if (unlikely(float64_is_neg(frb))) { fe_flag =3D 1; - } else if (!float64_is_zero(frb) && (e_b <=3D (-1022+52))) { + } else if (!float64_is_zero(frb) && (e_b <=3D (-1022 + 52))) { fe_flag =3D 1; } =20 @@ -1789,7 +1791,8 @@ uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t o= p1, uint64_t op2) #define float64_to_float64(x, env) x =20 =20 -/* VSX_ADD_SUB - VSX floating point add/subract +/* + * VSX_ADD_SUB - VSX floating point add/subract * name - instruction mnemonic * op - operation (add or sub) * nels - number of elements (1, 2 or 4) @@ -1872,7 +1875,8 @@ void helper_xsaddqp(CPUPPCState *env, uint32_t opcode) do_float_check_status(env, GETPC()); } =20 -/* VSX_MUL - VSX floating point multiply +/* + * VSX_MUL - VSX floating point multiply * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -1950,7 +1954,8 @@ void helper_xsmulqp(CPUPPCState *env, uint32_t opcode) do_float_check_status(env, GETPC()); } =20 -/* VSX_DIV - VSX floating point divide +/* + * VSX_DIV - VSX floating point divide * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2034,7 +2039,8 @@ void helper_xsdivqp(CPUPPCState *env, uint32_t opcode) do_float_check_status(env, GETPC()); } =20 -/* VSX_RE - VSX floating point reciprocal estimate +/* + * VSX_RE - VSX floating point reciprocal estimate * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2075,7 +2081,8 @@ VSX_RE(xsresp, 1, float64, VsrD(0), 1, 1) VSX_RE(xvredp, 2, float64, VsrD(i), 0, 0) VSX_RE(xvresp, 4, float32, VsrW(i), 0, 0) =20 -/* VSX_SQRT - VSX floating point square root +/* + * VSX_SQRT - VSX floating point square root * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2124,7 +2131,8 @@ VSX_SQRT(xssqrtsp, 1, float64, VsrD(0), 1, 1) VSX_SQRT(xvsqrtdp, 2, float64, VsrD(i), 0, 0) VSX_SQRT(xvsqrtsp, 4, float32, VsrW(i), 0, 0) =20 -/* VSX_RSQRTE - VSX floating point reciprocal square root estimate +/* + *VSX_RSQRTE - VSX floating point reciprocal square root estimate * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2174,7 +2182,8 @@ VSX_RSQRTE(xsrsqrtesp, 1, float64, VsrD(0), 1, 1) VSX_RSQRTE(xvrsqrtedp, 2, float64, VsrD(i), 0, 0) VSX_RSQRTE(xvrsqrtesp, 4, float32, VsrW(i), 0, 0) =20 -/* VSX_TDIV - VSX floating point test for divide +/* + * VSX_TDIV - VSX floating point test for divide * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2207,18 +2216,20 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ if (unlikely(tp##_is_any_nan(xa.fld) || \ tp##_is_any_nan(xb.fld))) { \ fe_flag =3D 1; \ - } else if ((e_b <=3D emin) || (e_b >=3D (emax-2))) { = \ + } else if ((e_b <=3D emin) || (e_b >=3D (emax - 2))) { = \ fe_flag =3D 1; \ } else if (!tp##_is_zero(xa.fld) && \ (((e_a - e_b) >=3D emax) || \ - ((e_a - e_b) <=3D (emin+1)) || \ - (e_a <=3D (emin+nbits)))) { \ + ((e_a - e_b) <=3D (emin + 1)) || \ + (e_a <=3D (emin + nbits)))) { \ fe_flag =3D 1; \ } \ \ if (unlikely(tp##_is_zero_or_denormal(xb.fld))) { \ - /* XB is not zero because of the above check and */ \ - /* so must be denormalized. */ \ + /* \ + * XB is not zero because of the above check and so \ + * must be denormalized. \ + */ \ fg_flag =3D 1; \ } \ } \ @@ -2231,7 +2242,8 @@ VSX_TDIV(xstdivdp, 1, float64, VsrD(0), -1022, 1023, = 52) VSX_TDIV(xvtdivdp, 2, float64, VsrD(i), -1022, 1023, 52) VSX_TDIV(xvtdivsp, 4, float32, VsrW(i), -126, 127, 23) =20 -/* VSX_TSQRT - VSX floating point test for square root +/* + * VSX_TSQRT - VSX floating point test for square root * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2266,13 +2278,15 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ } else if (unlikely(tp##_is_neg(xb.fld))) { \ fe_flag =3D 1; \ } else if (!tp##_is_zero(xb.fld) && \ - (e_b <=3D (emin+nbits))) { \ + (e_b <=3D (emin + nbits))) { \ fe_flag =3D 1; \ } \ \ if (unlikely(tp##_is_zero_or_denormal(xb.fld))) { \ - /* XB is not zero because of the above check and */ \ - /* therefore must be denormalized. */ \ + /* \ + * XB is not zero because of the above check and \ + * therefore must be denormalized. \ + */ \ fg_flag =3D 1; \ } \ } \ @@ -2285,7 +2299,8 @@ VSX_TSQRT(xstsqrtdp, 1, float64, VsrD(0), -1022, 52) VSX_TSQRT(xvtsqrtdp, 2, float64, VsrD(i), -1022, 52) VSX_TSQRT(xvtsqrtsp, 4, float32, VsrW(i), -126, 23) =20 -/* VSX_MADD - VSX floating point muliply/add variations +/* + * VSX_MADD - VSX floating point muliply/add variations * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2322,8 +2337,10 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ float_status tstat =3D env->fp_status; = \ set_float_exception_flags(0, &tstat); = \ if (r2sp && (tstat.float_rounding_mode =3D=3D float_round_nearest_= even)) {\ - /* Avoid double rounding errors by rounding the intermediate *= / \ - /* result to odd. *= / \ + /* = \ + * Avoid double rounding errors by rounding the intermediate = \ + * result to odd. = \ + */ = \ set_float_rounding_mode(float_round_to_zero, &tstat); = \ xt_out.fld =3D tp##_muladd(xa.fld, b->fld, c->fld, = \ maddflgs, &tstat); = \ @@ -2388,7 +2405,8 @@ VSX_MADD(xvnmaddmsp, 4, float32, VsrW(i), NMADD_FLGS,= 0, 0, 0) VSX_MADD(xvnmsubasp, 4, float32, VsrW(i), NMSUB_FLGS, 1, 0, 0) VSX_MADD(xvnmsubmsp, 4, float32, VsrW(i), NMSUB_FLGS, 0, 0, 0) =20 -/* VSX_SCALAR_CMP_DP - VSX scalar floating point compare double precision +/* + * VSX_SCALAR_CMP_DP - VSX scalar floating point compare double precision * op - instruction mnemonic * cmp - comparison operation * exp - expected result of comparison @@ -2604,7 +2622,8 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ VSX_SCALAR_CMPQ(xscmpoqp, 1) VSX_SCALAR_CMPQ(xscmpuqp, 0) =20 -/* VSX_MAX_MIN - VSX floating point maximum/minimum +/* + * VSX_MAX_MIN - VSX floating point maximum/minimum * name - instruction mnemonic * op - operation (max or min) * nels - number of elements (1, 2 or 4) @@ -2733,7 +2752,8 @@ void helper_##name(CPUPPCState *env, uint32_t opcode)= \ VSX_MAX_MINJ(xsmaxjdp, 1); VSX_MAX_MINJ(xsminjdp, 0); =20 -/* VSX_CMP - VSX floating point compare +/* + * VSX_CMP - VSX floating point compare * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -2778,7 +2798,7 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } \ \ putVSR(xT(opcode), &xt, env); \ - if ((opcode >> (31-21)) & 1) { \ + if ((opcode >> (31 - 21)) & 1) { \ env->crf[6] =3D (all_true ? 0x8 : 0) | (all_false ? 0x2 : 0); = \ } \ do_float_check_status(env, GETPC()); \ @@ -2793,7 +2813,8 @@ VSX_CMP(xvcmpgesp, 4, float32, VsrW(i), le, 1, 1) VSX_CMP(xvcmpgtsp, 4, float32, VsrW(i), lt, 1, 1) VSX_CMP(xvcmpnesp, 4, float32, VsrW(i), eq, 0, 0) =20 -/* VSX_CVT_FP_TO_FP - VSX floating point/floating point conversion +/* + * VSX_CVT_FP_TO_FP - VSX floating point/floating point conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * stp - source type (float32 or float64) @@ -2829,10 +2850,11 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ =20 VSX_CVT_FP_TO_FP(xscvdpsp, 1, float64, float32, VsrD(0), VsrW(0), 1) VSX_CVT_FP_TO_FP(xscvspdp, 1, float32, float64, VsrW(0), VsrD(0), 1) -VSX_CVT_FP_TO_FP(xvcvdpsp, 2, float64, float32, VsrD(i), VsrW(2*i), 0) -VSX_CVT_FP_TO_FP(xvcvspdp, 2, float32, float64, VsrW(2*i), VsrD(i), 0) +VSX_CVT_FP_TO_FP(xvcvdpsp, 2, float64, float32, VsrD(i), VsrW(2 * i), 0) +VSX_CVT_FP_TO_FP(xvcvspdp, 2, float32, float64, VsrW(2 * i), VsrD(i), 0) =20 -/* VSX_CVT_FP_TO_FP_VECTOR - VSX floating point/floating point conversion +/* + * VSX_CVT_FP_TO_FP_VECTOR - VSX floating point/floating point conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * stp - source type (float32 or float64) @@ -2868,7 +2890,8 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ =20 VSX_CVT_FP_TO_FP_VECTOR(xscvdpqp, 1, float64, float128, VsrD(0), f128, 1) =20 -/* VSX_CVT_FP_TO_FP_HP - VSX floating point/floating point conversion +/* + * VSX_CVT_FP_TO_FP_HP - VSX floating point/floating point conversion * involving one half precision value * op - instruction mnemonic * nels - number of elements (1, 2 or 4) @@ -2953,7 +2976,8 @@ uint64_t helper_xscvspdpn(CPUPPCState *env, uint64_t = xb) return float32_to_float64(xb >> 32, &tstat); } =20 -/* VSX_CVT_FP_TO_INT - VSX floating point to integer conversion +/* + * VSX_CVT_FP_TO_INT - VSX floating point to integer conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * stp - source type (float32 or float64) @@ -2996,17 +3020,18 @@ VSX_CVT_FP_TO_INT(xscvdpuxds, 1, float64, uint64, V= srD(0), VsrD(0), 0ULL) VSX_CVT_FP_TO_INT(xscvdpuxws, 1, float64, uint32, VsrD(0), VsrW(1), 0U) VSX_CVT_FP_TO_INT(xvcvdpsxds, 2, float64, int64, VsrD(i), VsrD(i), \ 0x8000000000000000ULL) -VSX_CVT_FP_TO_INT(xvcvdpsxws, 2, float64, int32, VsrD(i), VsrW(2*i), \ +VSX_CVT_FP_TO_INT(xvcvdpsxws, 2, float64, int32, VsrD(i), VsrW(2 * i), \ 0x80000000U) VSX_CVT_FP_TO_INT(xvcvdpuxds, 2, float64, uint64, VsrD(i), VsrD(i), 0ULL) -VSX_CVT_FP_TO_INT(xvcvdpuxws, 2, float64, uint32, VsrD(i), VsrW(2*i), 0U) -VSX_CVT_FP_TO_INT(xvcvspsxds, 2, float32, int64, VsrW(2*i), VsrD(i), \ +VSX_CVT_FP_TO_INT(xvcvdpuxws, 2, float64, uint32, VsrD(i), VsrW(2 * i), 0U) +VSX_CVT_FP_TO_INT(xvcvspsxds, 2, float32, int64, VsrW(2 * i), VsrD(i), \ 0x8000000000000000ULL) VSX_CVT_FP_TO_INT(xvcvspsxws, 4, float32, int32, VsrW(i), VsrW(i), 0x80000= 000U) -VSX_CVT_FP_TO_INT(xvcvspuxds, 2, float32, uint64, VsrW(2*i), VsrD(i), 0ULL) +VSX_CVT_FP_TO_INT(xvcvspuxds, 2, float32, uint64, VsrW(2 * i), VsrD(i), 0U= LL) VSX_CVT_FP_TO_INT(xvcvspuxws, 4, float32, uint32, VsrW(i), VsrW(i), 0U) =20 -/* VSX_CVT_FP_TO_INT_VECTOR - VSX floating point to integer conversion +/* + * VSX_CVT_FP_TO_INT_VECTOR - VSX floating point to integer conversion * op - instruction mnemonic * stp - source type (float32 or float64) * ttp - target type (int32, uint32, int64 or uint64) @@ -3040,7 +3065,8 @@ VSX_CVT_FP_TO_INT_VECTOR(xscvqpswz, float128, int32, = f128, VsrD(0), \ VSX_CVT_FP_TO_INT_VECTOR(xscvqpudz, float128, uint64, f128, VsrD(0), 0x0UL= L) VSX_CVT_FP_TO_INT_VECTOR(xscvqpuwz, float128, uint32, f128, VsrD(0), 0x0UL= L) =20 -/* VSX_CVT_INT_TO_FP - VSX integer to floating point conversion +/* + * VSX_CVT_INT_TO_FP - VSX integer to floating point conversion * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * stp - source type (int32, uint32, int64 or uint64) @@ -3079,14 +3105,15 @@ VSX_CVT_INT_TO_FP(xscvsxdsp, 1, int64, float64, Vsr= D(0), VsrD(0), 1, 1) VSX_CVT_INT_TO_FP(xscvuxdsp, 1, uint64, float64, VsrD(0), VsrD(0), 1, 1) VSX_CVT_INT_TO_FP(xvcvsxddp, 2, int64, float64, VsrD(i), VsrD(i), 0, 0) VSX_CVT_INT_TO_FP(xvcvuxddp, 2, uint64, float64, VsrD(i), VsrD(i), 0, 0) -VSX_CVT_INT_TO_FP(xvcvsxwdp, 2, int32, float64, VsrW(2*i), VsrD(i), 0, 0) -VSX_CVT_INT_TO_FP(xvcvuxwdp, 2, uint64, float64, VsrW(2*i), VsrD(i), 0, 0) -VSX_CVT_INT_TO_FP(xvcvsxdsp, 2, int64, float32, VsrD(i), VsrW(2*i), 0, 0) -VSX_CVT_INT_TO_FP(xvcvuxdsp, 2, uint64, float32, VsrD(i), VsrW(2*i), 0, 0) +VSX_CVT_INT_TO_FP(xvcvsxwdp, 2, int32, float64, VsrW(2 * i), VsrD(i), 0, 0) +VSX_CVT_INT_TO_FP(xvcvuxwdp, 2, uint64, float64, VsrW(2 * i), VsrD(i), 0, = 0) +VSX_CVT_INT_TO_FP(xvcvsxdsp, 2, int64, float32, VsrD(i), VsrW(2 * i), 0, 0) +VSX_CVT_INT_TO_FP(xvcvuxdsp, 2, uint64, float32, VsrD(i), VsrW(2 * i), 0, = 0) VSX_CVT_INT_TO_FP(xvcvsxwsp, 4, int32, float32, VsrW(i), VsrW(i), 0, 0) VSX_CVT_INT_TO_FP(xvcvuxwsp, 4, uint32, float32, VsrW(i), VsrW(i), 0, 0) =20 -/* VSX_CVT_INT_TO_FP_VECTOR - VSX integer to floating point conversion +/* + * VSX_CVT_INT_TO_FP_VECTOR - VSX integer to floating point conversion * op - instruction mnemonic * stp - source type (int32, uint32, int64 or uint64) * ttp - target type (float32 or float64) @@ -3111,13 +3138,15 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)= \ VSX_CVT_INT_TO_FP_VECTOR(xscvsdqp, int64, float128, VsrD(0), f128) VSX_CVT_INT_TO_FP_VECTOR(xscvudqp, uint64, float128, VsrD(0), f128) =20 -/* For "use current rounding mode", define a value that will not be one of - * the existing rounding model enums. +/* + * For "use current rounding mode", define a value that will not be + * one of the existing rounding model enums. */ #define FLOAT_ROUND_CURRENT (float_round_nearest_even + float_round_down += \ float_round_up + float_round_to_zero) =20 -/* VSX_ROUND - VSX floating point round +/* + * VSX_ROUND - VSX floating point round * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * tp - type (float32 or float64) @@ -3150,9 +3179,11 @@ void helper_##op(CPUPPCState *env, uint32_t opcode) = \ } \ } \ \ - /* If this is not a "use current rounding mode" instruction, \ + /* \ + * If this is not a "use current rounding mode" instruction, \ * then inhibit setting of the XX bit and restore rounding \ - * mode from FPSCR */ \ + * mode from FPSCR \ + */ \ if (rmode !=3D FLOAT_ROUND_CURRENT) { \ fpscr_set_rounding_mode(env); \ env->fp_status.float_exception_flags &=3D ~float_flag_inexact; \ @@ -3234,7 +3265,8 @@ void helper_xvxsigsp(CPUPPCState *env, uint32_t opcod= e) putVSR(xT(opcode), &xt, env); } =20 -/* VSX_TEST_DC - VSX floating point test data class +/* + * VSX_TEST_DC - VSX floating point test data class * op - instruction mnemonic * nels - number of elements (1, 2 or 4) * xbn - VSR register number --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259291; cv=none; d=zoho.com; s=zohoarc; b=YwlDMIhwL4zD3mmN0m/yhFw0Sx9YmvGa3fN53hMXFRRJM1Elbq7SDaZCYk8IiGTxKPAaCCwDzmn+HdgQHUlmv7NqQzhf7IAH6N+XhX98tsQNsp/AvKOSYXh85XmgqUgyDC7h5rdMtS4aFzDZHaL4gR9/Hta1nR8lG8PvxquV1UM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259291; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=m6h7PtL5VHG54FsW9nuUUilRZgN0OZ/difd+CZ749OA=; b=k+B5MWhr2yysTPTFa1PiNweT44O7dd7Cqio1SEgGQ51Iqg7guEXK9uVReQCkD273xQPCWOTeboGsfguQ7aIMUFa4LLhdgtbfhjksRtJhLHENE8LWPFyA1Kckp1tyM5wBR0UufP/lu+3qunXG3+rhRE9as40+FEI0CGTngwWmwPI= ARC-Authentication-Results: i=1; mx.zoho.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 1556259291910731.4031236748287; Thu, 25 Apr 2019 23:14:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:39973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu88-00047O-Ck for importer@patchew.org; Fri, 26 Apr 2019 02:14:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0X-0005Rl-23 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0V-0004Na-HS for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:49 -0400 Received: from ozlabs.org ([203.11.71.1]:42015) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0U-0004Hz-Sq; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tk6TXHz9sMQ; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258794; bh=CpVDQft0uHqfW1Yh26ZLPa9IQjTyO3ExmmZG59YXhOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UN3tstHbpH9IGERbjehm3l6GqmVWwRG8uE4Cz8eodQlYvhlvhhz01v8aOENHs9fPT J+WGcYmzZk/INPefOPaakDNvGLrp2CUpqWPrGofLshFd5nXkQBjxlZAsthZOhRIK0M HOoLRZzzSRvm/Z3tvFOAGlx1vbk8obqYHxILaDKs= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:00 +1000 Message-Id: <20190426060627.18153-10-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 09/36] target/ppc: Style fixes for dfp_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/dfp_helper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c index 9164fe701b..f102177572 100644 --- a/target/ppc/dfp_helper.c +++ b/target/ppc/dfp_helper.c @@ -1104,19 +1104,19 @@ void helper_##op(CPUPPCState *env, uint64_t *t, uin= t64_t *b, uint32_t s) \ } = \ } = \ = \ - while (offset < (size)/4) { = \ + while (offset < (size) / 4) { = \ n++; = \ - digits[(size)/4-n] =3D dfp_get_bcd_digit_##size(dfp.b64, offset++)= ; \ - if (digits[(size)/4-n] > 10) { = \ + digits[(size) / 4 - n] =3D dfp_get_bcd_digit_##size(dfp.b64, offse= t++); \ + if (digits[(size) / 4 - n] > 10) { = \ dfp_set_FPSCR_flag(&dfp, FP_VX | FP_VXCVI, FPSCR_VE); = \ return; = \ } else { = \ - nonzero |=3D (digits[(size)/4-n] > 0); = \ + nonzero |=3D (digits[(size) / 4 - n] > 0); = \ } = \ } = \ = \ if (nonzero) { = \ - decNumberSetBCD(&dfp.t, digits+((size)/4)-n, n); = \ + decNumberSetBCD(&dfp.t, digits + ((size) / 4) - n, n); = \ } = \ = \ if (s && sgn) { = \ @@ -1170,13 +1170,13 @@ DFP_HELPER_XEX(dxexq, 128) static void dfp_set_raw_exp_64(uint64_t *t, uint64_t raw) { *t &=3D 0x8003ffffffffffffULL; - *t |=3D (raw << (63-13)); + *t |=3D (raw << (63 - 13)); } =20 static void dfp_set_raw_exp_128(uint64_t *t, uint64_t raw) { t[HI_IDX] &=3D 0x80003fffffffffffULL; - t[HI_IDX] |=3D (raw << (63-17)); + t[HI_IDX] |=3D (raw << (63 - 17)); } =20 #define DFP_HELPER_IEX(op, size) \ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259702; cv=none; d=zoho.com; s=zohoarc; b=aMKjMHVmBIz0AKuJ8V9hmb5+p0EAnYeXZy+MxZYj+RbrgU1iv+WUoGC1KAA/62qlOkeDX6eXE+YX5YZ3y6X046JEF0LZS5bwCRVATlqNWwbNfbVQseb2Beyn44oKlk7IEONbmsChUxIM4ZunCiyRfIN3Uk6L4B7D5ecSg8DH8uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259702; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Syvjb25ZC1f04H600ZHxcv59DClrb+UhdZvSQ/bmbKA=; b=KcIXBTS5IyRJ6cFJYF/bM6SgOgBoHYBcZEfqk8puFE/yn+640nYfWh5iKpSQDF9eBKPkN2o04sMhP5TZ3qrkrrnSScLGEyDzx9aRV9Epmtsw7j7Eu2fo6W/KhF92A0O8zOQ7KTzQCViVHDgyp6OGohKiZQD2DEQbAmbIBTbBZDI= ARC-Authentication-Results: i=1; mx.zoho.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 1556259702812758.9042525207128; Thu, 25 Apr 2019 23:21:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:40105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuEm-0003A0-Fd for importer@patchew.org; Fri, 26 Apr 2019 02:21:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0c-0005Z8-II for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0Y-0004UG-TA for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:54 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:58449 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0Y-0004Od-6F; Fri, 26 Apr 2019 02:06:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tm0bsrz9sNJ; Fri, 26 Apr 2019 16:06:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258796; bh=tex7puElr/hdrgW60sKFDFTqZBlhAKgaGYVO6K52Hp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJR24zGxoOSAc6lMT49QrV/LZHbew3MGKiUdGH94Xwk2bkwtOhloKDtzmEGS7hjuq nizv3gGA+Z54oFrktt5yDDstVKCs6fEvxMbNBf/QoKEJ+m0sWtvKb5BZYruyn7s4r6 TM78Ly+TuIK8n2KQGLMaVAjFrTfmM7IYI7PSIZAc= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:01 +1000 Message-Id: <20190426060627.18153-11-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 10/36] target/ppc: Style fixes for excp_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/excp_helper.c | 87 ++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index beafcf1ebd..ec2c177091 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -25,9 +25,9 @@ #include "internal.h" #include "helper_regs.h" =20 -//#define DEBUG_OP -//#define DEBUG_SOFTWARE_TLB -//#define DEBUG_EXCEPTIONS +/* #define DEBUG_OP */ +/* #define DEBUG_SOFTWARE_TLB */ +/* #define DEBUG_EXCEPTIONS */ =20 #ifdef DEBUG_EXCEPTIONS # define LOG_EXCP(...) qemu_log(__VA_ARGS__) @@ -126,8 +126,9 @@ static uint64_t ppc_excp_vector_offset(CPUState *cs, in= t ail) return offset; } =20 -/* Note that this function should be greatly optimized - * when called with a constant excp, from ppc_hw_interrupt +/* + * Note that this function should be greatly optimized when called + * with a constant excp, from ppc_hw_interrupt */ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) { @@ -147,7 +148,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) msr =3D env->msr & ~0x783f0000ULL; } =20 - /* new interrupt handler msr preserves existing HV and ME unless + /* + * new interrupt handler msr preserves existing HV and ME unless * explicitly overriden */ new_msr =3D env->msr & (((target_ulong)1 << MSR_ME) | MSR_HVB); @@ -166,7 +168,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) excp =3D powerpc_reset_wakeup(cs, env, excp, &msr); } =20 - /* Exception targetting modifiers + /* + * Exception targetting modifiers * * LPES0 is supported on POWER7/8/9 * LPES1 is not supported (old iSeries mode) @@ -194,7 +197,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) ail =3D 0; } =20 - /* Hypervisor emulation assistance interrupt only exists on server + /* + * Hypervisor emulation assistance interrupt only exists on server * arch 2.05 server or later. We also don't want to generate it if * we don't have HVB in msr_mask (PAPR mode). */ @@ -229,8 +233,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) break; case POWERPC_EXCP_MCHECK: /* Machine check exception = */ if (msr_me =3D=3D 0) { - /* Machine check exception is not enabled. - * Enter checkstop state. + /* + * Machine check exception is not enabled. Enter + * checkstop state. */ fprintf(stderr, "Machine check while not allowed. " "Entering checkstop state\n"); @@ -242,8 +247,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) cpu_interrupt_exittb(cs); } if (env->msr_mask & MSR_HVB) { - /* ISA specifies HV, but can be delivered to guest with HV cle= ar - * (e.g., see FWNMI in PAPR). + /* + * ISA specifies HV, but can be delivered to guest with HV + * clear (e.g., see FWNMI in PAPR). */ new_msr |=3D (target_ulong)MSR_HVB; } @@ -294,9 +300,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int e= xcp_model, int excp) break; case POWERPC_EXCP_ALIGN: /* Alignment exception = */ /* Get rS/rD and rA from faulting opcode */ - /* Note: the opcode fields will not be set properly for a direct - * store load/store, but nobody cares as nobody actually uses - * direct store segments. + /* + * Note: the opcode fields will not be set properly for a + * direct store load/store, but nobody cares as nobody + * actually uses direct store segments. */ env->spr[SPR_DSISR] |=3D (env->error_code & 0x03FF0000) >> 16; break; @@ -310,7 +317,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) return; } =20 - /* FP exceptions always have NIP pointing to the faulting + /* + * FP exceptions always have NIP pointing to the faulting * instruction, so always use store_next and claim we are * precise in the MSR. */ @@ -341,7 +349,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) dump_syscall(env); lev =3D env->error_code; =20 - /* We need to correct the NIP which in this case is supposed + /* + * We need to correct the NIP which in this case is supposed * to point to the next instruction */ env->nip +=3D 4; @@ -425,8 +434,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) new_msr |=3D ((target_ulong)1 << MSR_ME); } if (env->msr_mask & MSR_HVB) { - /* ISA specifies HV, but can be delivered to guest with HV cle= ar - * (e.g., see FWNMI in PAPR, NMI injection in QEMU). + /* + * ISA specifies HV, but can be delivered to guest with HV + * clear (e.g., see FWNMI in PAPR, NMI injection in QEMU). */ new_msr |=3D (target_ulong)MSR_HVB; } else { @@ -675,7 +685,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) env->spr[asrr1] =3D env->spr[srr1]; } =20 - /* Sort out endianness of interrupt, this differs depending on the + /* + * Sort out endianness of interrupt, this differs depending on the * CPU, the HV mode, etc... */ #ifdef TARGET_PPC64 @@ -716,8 +727,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) } vector |=3D env->excp_prefix; =20 - /* AIL only works if there is no HV transition and we are running with - * translations enabled + /* + * AIL only works if there is no HV transition and we are running + * with translations enabled */ if (!((msr >> MSR_IR) & 1) || !((msr >> MSR_DR) & 1) || ((new_msr & MSR_HVB) && !(msr & MSR_HVB))) { @@ -745,8 +757,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) } } #endif - /* We don't use hreg_store_msr here as already have treated - * any special case that could occur. Just store MSR and update hflags + /* + * We don't use hreg_store_msr here as already have treated any + * special case that could occur. Just store MSR and update hflags * * Note: We *MUST* not use hreg_store_msr() as-is anyway because it * will prevent setting of the HV bit which some exceptions might need @@ -762,8 +775,9 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int ex= cp_model, int excp) /* Reset the reservation */ env->reserve_addr =3D -1; =20 - /* Any interrupt is context synchronizing, check if TCG TLB - * needs a delayed flush on ppc64 + /* + * Any interrupt is context synchronizing, check if TCG TLB needs + * a delayed flush on ppc64 */ check_tlb_flush(env, false); } @@ -1015,8 +1029,9 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_= t insn) cs =3D CPU(ppc_env_get_cpu(env)); cs->halted =3D 1; =20 - /* The architecture specifies that HDEC interrupts are - * discarded in PM states + /* + * The architecture specifies that HDEC interrupts are discarded + * in PM states */ env->pending_interrupts &=3D ~(1 << PPC_INTERRUPT_HDECR); =20 @@ -1047,8 +1062,9 @@ static inline void do_rfi(CPUPPCState *env, target_ul= ong nip, target_ulong msr) #if defined(DEBUG_OP) cpu_dump_rfi(env->nip, env->msr); #endif - /* No need to raise an exception here, - * as rfi is always the last insn of a TB + /* + * No need to raise an exception here, as rfi is always the last + * insn of a TB */ cpu_interrupt_exittb(cs); /* Reset the reservation */ @@ -1067,8 +1083,9 @@ void helper_rfi(CPUPPCState *env) #if defined(TARGET_PPC64) void helper_rfid(CPUPPCState *env) { - /* The architeture defines a number of rules for which bits - * can change but in practice, we handle this in hreg_store_msr() + /* + * The architeture defines a number of rules for which bits can + * change but in practice, we handle this in hreg_store_msr() * which will be called by do_rfi(), so there is no need to filter * here */ @@ -1206,9 +1223,11 @@ static int book3s_dbell2irq(target_ulong rb) { int msg =3D rb & DBELL_TYPE_MASK; =20 - /* A Directed Hypervisor Doorbell message is sent only if the + /* + * A Directed Hypervisor Doorbell message is sent only if the * message type is 5. All other types are reserved and the - * instruction is a no-op */ + * instruction is a no-op + */ return msg =3D=3D DBELL_TYPE_DBELL_SERVER ? PPC_INTERRUPT_HDOORBELL : = -1; } =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259120; cv=none; d=zoho.com; s=zohoarc; b=FxJNOJDCu9w8900gFYb4Vm+l3Ke1+O7DDh+3WKzEB8PGtnglVzTzzv9GLwA2slig2KftLSxbFiOvJkfFPEALeNFAVgCyiFuScYLruvrBk3XcRlFfySOBk56Bc34mlub6iVLAetwLVVXG4UcOiYn7VLvk+a7aTzYt2Ns6C7D082c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259120; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/pifdfu4VgP5Z84EYMGA1gcTK2B41vMRtWFYoAXwNuk=; b=mbwJp7YHrL5iuOLSV2ttTLlZ0Rdh3WnGSHAfV0H0dmmEyx1r/5C3Q7W2nOUUldygCg8XedQnzJPeoKCIEcXFDThg6gdkLA7DLND7WOWzZBAAi/OttDTP1V0RpwIZ1NlLni9PmsYEiznczDpADztz0eHuTA/uZikRUBQIrVu+4Ls= ARC-Authentication-Results: i=1; mx.zoho.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 1556259120296240.54106778621394; Thu, 25 Apr 2019 23:12:00 -0700 (PDT) Received: from localhost ([127.0.0.1]:39941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu5T-0001Zn-6l for importer@patchew.org; Fri, 26 Apr 2019 02:11:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0X-0005Rm-45 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0V-0004NO-FE for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:49 -0400 Received: from ozlabs.org ([203.11.71.1]:44461) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0V-0004IM-2v; Fri, 26 Apr 2019 02:06:47 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tl4Tmfz9sDn; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258795; bh=+NSCKHsz7Epefi0fzIqxusInerJTGVGvLh4ho+rkMlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQ7xL+Q0R4YG/bdYQYQF4yo3QX+9tyoed1chkIROqBkgNKy/twoejln6koCLw3urO 227NoQMBEizAlpUsuiReNyieAmfTxKJO0OiChNyBqN5J+rN+zl7GD4WQJec5xlB5p8 jNNqUIn25Yv0RNhETPjaHChW452L4HbOcJA7a+ik= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:02 +1000 Message-Id: <20190426060627.18153-12-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for gdbstub.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/gdbstub.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index fbf3821f4b..ce3625f44e 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -33,14 +33,14 @@ static int ppc_gdb_register_len_apple(int n) return 8; case 64 ... 95: return 16; - case 64+32: /* nip */ - case 65+32: /* msr */ - case 67+32: /* lr */ - case 68+32: /* ctr */ - case 70+32: /* fpscr */ + case 64 + 32: /* nip */ + case 65 + 32: /* msr */ + case 67 + 32: /* lr */ + case 68 + 32: /* ctr */ + case 70 + 32: /* fpscr */ return 8; - case 66+32: /* cr */ - case 69+32: /* xer */ + case 66 + 32: /* cr */ + case 69 + 32: /* xer */ return 4; default: return 0; @@ -84,11 +84,14 @@ static int ppc_gdb_register_len(int n) } } =20 -/* We need to present the registers to gdb in the "current" memory orderin= g. - For user-only mode we get this for free; TARGET_WORDS_BIGENDIAN is set = to - the proper ordering for the binary, and cannot be changed. - For system mode, TARGET_WORDS_BIGENDIAN is always set, and we must check - the current mode of the chip to see if we're running in little-endian. = */ +/* + * We need to present the registers to gdb in the "current" memory + * ordering. For user-only mode we get this for free; + * TARGET_WORDS_BIGENDIAN is set to the proper ordering for the + * binary, and cannot be changed. For system mode, + * TARGET_WORDS_BIGENDIAN is always set, and we must check the current + * mode of the chip to see if we're running in little-endian. + */ void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len) { #ifndef CONFIG_USER_ONLY @@ -104,11 +107,12 @@ void ppc_maybe_bswap_register(CPUPPCState *env, uint8= _t *mem_buf, int len) #endif } =20 -/* Old gdb always expects FP registers. Newer (xml-aware) gdb only +/* + * Old gdb always expects FP registers. Newer (xml-aware) gdb only * expects whatever the target description contains. Due to a * historical mishap the FP registers appear in between core integer - * regs and PC, MSR, CR, and so forth. We hack round this by giving the - * FP regs zero size when talking to a newer gdb. + * regs and PC, MSR, CR, and so forth. We hack round this by giving + * the FP regs zero size when talking to a newer gdb. */ =20 int ppc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259133; cv=none; d=zoho.com; s=zohoarc; b=nDet9xgkQ4d4wOPkcgv6TXqX/47p839FEVjGM1yYI+3AP//P9l40gLhwQCsYOGQrJFFcNIw4XRCU5R6RBQ6QMG7ZumYrDvs1cnDTAgZAN9L1jBEVWut+bdFEPbt+QaEAb+4HUbgzvYZTgMY/kBhLWdj/gWSuCLC/uadXI39B6AM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259133; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3yIW10pr0RMQzLFBcFPHKXLSeXpFlZr1LZRv/NEC9mM=; b=VMcQGliXNCD4iXJ15PUuHec1ztwJh7mh4pzOw572YscKlvxxPou15CQGpJm6V06XlvMwkUZXlMH7OAHr/K9BUkCg2319IwF06rQa1mcbfLP/JdztiYc/mfcbzgkKO6Yp8BPzG3oGgYrGTNsFw1spKzRBP+d3nj45XCRAXbd3XRQ= ARC-Authentication-Results: i=1; mx.zoho.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 1556259133195631.6314720206791; Thu, 25 Apr 2019 23:12:13 -0700 (PDT) Received: from localhost ([127.0.0.1]:39947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu5k-0001qP-3o for importer@patchew.org; Fri, 26 Apr 2019 02:12:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0X-0005SY-Oj for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0W-0004Pa-Dp for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:49 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:52541 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0W-0004KA-0X; Fri, 26 Apr 2019 02:06:48 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tl64t7z9sNF; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258795; bh=nqNDqkW1fiFWpWPWQ7vYzgSIzPctpLlz0O+Uu0pu5gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oTubyzoebfNg5DQ52bwb1cyeEufMwyEIRLFqh5IGuAvRYOm2bR7o/6oPoGzPd71rQ Nnj2RBl1LYCPftYgis46oLMdKM1my3+CxHl7/zyqKilzlOqldIAOP1CoAja+ux1HVh kdtOkxpVVM58XroNySyM6SvbmVCiUCWTyOvQDUhc= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:03 +1000 Message-Id: <20190426060627.18153-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for helper_regs.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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/helper_regs.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h index c863abc0bf..922da76c6c 100644 --- a/target/ppc/helper_regs.h +++ b/target/ppc/helper_regs.h @@ -44,10 +44,11 @@ static inline void hreg_swap_gpr_tgpr(CPUPPCState *env) =20 static inline void hreg_compute_mem_idx(CPUPPCState *env) { - /* This is our encoding for server processors. The architecture + /* + * This is our encoding for server processors. The architecture * specifies that there is no such thing as userspace with - * translation off, however it appears that MacOS does it and - * some 32-bit CPUs support it. Weird... + * translation off, however it appears that MacOS does it and some + * 32-bit CPUs support it. Weird... * * 0 =3D Guest User space virtual mode * 1 =3D Guest Kernel space virtual mode @@ -143,7 +144,8 @@ static inline int hreg_store_msr(CPUPPCState *env, targ= et_ulong value, /* Change the exception prefix on PowerPC 601 */ env->excp_prefix =3D ((value >> MSR_EP) & 1) * 0xFFF00000; } - /* If PR=3D1 then EE, IR and DR must be 1 + /* + * If PR=3D1 then EE, IR and DR must be 1 * * Note: We only enforce this on 64-bit server processors. * It appears that: --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259571; cv=none; d=zoho.com; s=zohoarc; b=QVfxAqM9W3/nykB0xUwg26vX+prD3D+thD3ieI0YcCXRJwnLqI9PoLWMAmVxNmyJbmzDWCqKUU9qurFxDN8dFa7CYZRWXst/PZW8VPtEBBkO+ENSk+2GA0RiZPMr5vsshHHrBt0m5ugp4g4rp9y8CUYrrSlNw0H4UtsDor3fvI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259571; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hVnTNKo1J2eeL47vCOOl5bKHg7pRsDoMFlr0NjTUwaA=; b=C8cl/Pi7bU+lbrxO5EbaWa/71TxY8K8ZOsMnViAxydl+EiDr8f/u1bUVr+xs/ytFugazDTgxlx7Gmr3u6kSlc3bxPyvKZ8TK2YWgsLT6T+FmT+JOh0E0GqLCqQaeDX2h8rnGg72xWwbSDhqFRfGETrufjfxYksm4qmHO2HeAZG8= ARC-Authentication-Results: i=1; mx.zoho.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 155625957162647.606229062083; Thu, 25 Apr 2019 23:19:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:40051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuCo-0001HH-Ef for importer@patchew.org; Fri, 26 Apr 2019 02:19:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0c-0005ZQ-LX for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0X-0004Rp-Jl for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:54 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:50935 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0W-0004MK-Qv; Fri, 26 Apr 2019 02:06:49 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tl6xH0z9sNG; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258795; bh=djg3f0YX2q93WB+sBM32+0c5+4Gh01KYZt/pqAkv9hE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YqtcUCCgQQZX1oP3lJHQAQUmfG12OCypJKFbAFzryLi9loizUYFfV7mvWq0uUkciB R+uKJgyPY3SQTfKaSgkHXntuf+KoQXZelb5jWz9uwpdMNZVp48VXaMEOdFaB6IFg1e BXBE+KTI1qA+eYt8oogLeiFNVIXmma3Z2Nk8yyoA= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:04 +1000 Message-Id: <20190426060627.18153-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 13/36] target/ppc: Style fixes for kvm_ppc.h and kvm.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/kvm.c | 178 +++++++++++++++++++++++++++---------------- target/ppc/kvm_ppc.h | 3 +- 2 files changed, 115 insertions(+), 66 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 2427c8ee13..a1c223385d 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -49,7 +49,7 @@ #include "elf.h" #include "sysemu/kvm_int.h" =20 -//#define DEBUG_KVM +/* #define DEBUG_KVM */ =20 #ifdef DEBUG_KVM #define DPRINTF(fmt, ...) \ @@ -65,8 +65,8 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = =3D { KVM_CAP_LAST_INFO }; =20 -static int cap_interrupt_unset =3D false; -static int cap_interrupt_level =3D false; +static int cap_interrupt_unset; +static int cap_interrupt_level; static int cap_segstate; static int cap_booke_sregs; static int cap_ppc_smt; @@ -96,7 +96,8 @@ static int cap_large_decr; =20 static uint32_t debug_inst_opcode; =20 -/* XXX We have a race condition where we actually have a level triggered +/* + * XXX We have a race condition where we actually have a level triggered * interrupt, but the infrastructure can't expose that yet, so the gue= st * takes but ignores it, goes to sleep and never gets notified that th= ere's * still an interrupt pending. @@ -114,10 +115,12 @@ static void kvm_kick_cpu(void *opaque) qemu_cpu_kick(CPU(cpu)); } =20 -/* Check whether we are running with KVM-PR (instead of KVM-HV). This +/* + * Check whether we are running with KVM-PR (instead of KVM-HV). This * should only be used for fallback tests - generally we should use * explicit capabilities for the features we want, rather than - * assuming what is/isn't available depending on the KVM variant. */ + * assuming what is/isn't available depending on the KVM variant. + */ static bool kvmppc_is_pr(KVMState *ks) { /* Assume KVM-PR if the GET_PVINFO capability is available */ @@ -143,8 +146,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_hior =3D kvm_check_extension(s, KVM_CAP_PPC_HIOR); cap_epr =3D kvm_check_extension(s, KVM_CAP_PPC_EPR); cap_ppc_watchdog =3D kvm_check_extension(s, KVM_CAP_PPC_BOOKE_WATCHDOG= ); - /* Note: we don't set cap_papr here, because this capability is - * only activated after this by kvmppc_set_papr() */ + /* + * Note: we don't set cap_papr here, because this capability is + * only activated after this by kvmppc_set_papr() + */ cap_htab_fd =3D kvm_vm_check_extension(s, KVM_CAP_PPC_HTAB_FD); cap_fixup_hcalls =3D kvm_check_extension(s, KVM_CAP_PPC_FIXUP_HCALL); cap_ppc_smt =3D kvm_vm_check_extension(s, KVM_CAP_PPC_SMT); @@ -160,7 +165,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s) * in KVM at this moment. * * TODO: call kvm_vm_check_extension() with the right capability - * after the kernel starts implementing it.*/ + * after the kernel starts implementing it. + */ cap_ppc_pvr_compat =3D false; =20 if (!cap_interrupt_level) { @@ -186,10 +192,13 @@ static int kvm_arch_sync_sregs(PowerPCCPU *cpu) int ret; =20 if (cenv->excp_model =3D=3D POWERPC_EXCP_BOOKE) { - /* What we're really trying to say is "if we're on BookE, we use - the native PVR for now". This is the only sane way to check - it though, so we potentially confuse users that they can run - BookE guests on BookS. Let's hope nobody dares enough :) */ + /* + * What we're really trying to say is "if we're on BookE, we + * use the native PVR for now". This is the only sane way to + * check it though, so we potentially confuse users that they + * can run BookE guests on BookS. Let's hope nobody dares + * enough :) + */ return 0; } else { if (!cap_segstate) { @@ -421,12 +430,14 @@ void kvm_check_mmu(PowerPCCPU *cpu, Error **errp) } =20 if (ppc_hash64_has(cpu, PPC_HASH64_CI_LARGEPAGE)) { - /* Mostly what guest pagesizes we can use are related to the + /* + * Mostly what guest pagesizes we can use are related to the * host pages used to map guest RAM, which is handled in the * platform code. Cache-Inhibited largepages (64k) however are * used for I/O, so if they're mapped to the host at all it * will be a normal mapping, not a special hugepage one used - * for RAM. */ + * for RAM. + */ if (getpagesize() < 0x10000) { error_setg(errp, "KVM can't supply 64kiB CI pages, which guest expec= ts"); @@ -440,9 +451,9 @@ unsigned long kvm_arch_vcpu_id(CPUState *cpu) return POWERPC_CPU(cpu)->vcpu_id; } =20 -/* e500 supports 2 h/w breakpoint and 2 watchpoint. - * book3s supports only 1 watchpoint, so array size - * of 4 is sufficient for now. +/* + * e500 supports 2 h/w breakpoint and 2 watchpoint. book3s supports + * only 1 watchpoint, so array size of 4 is sufficient for now. */ #define MAX_HW_BKPTS 4 =20 @@ -497,9 +508,12 @@ int kvm_arch_init_vcpu(CPUState *cs) break; case POWERPC_MMU_2_07: if (!cap_htm && !kvmppc_is_pr(cs->kvm_state)) { - /* KVM-HV has transactional memory on POWER8 also without the - * KVM_CAP_PPC_HTM extension, so enable it here instead as - * long as it's availble to userspace on the host. */ + /* + * KVM-HV has transactional memory on POWER8 also without + * the KVM_CAP_PPC_HTM extension, so enable it here + * instead as long as it's availble to userspace on the + * host. + */ if (qemu_getauxval(AT_HWCAP2) & PPC_FEATURE2_HAS_HTM) { cap_htm =3D true; } @@ -800,10 +814,12 @@ static int kvm_put_vpa(CPUState *cs) struct kvm_one_reg reg; int ret; =20 - /* SLB shadow or DTL can't be registered unless a master VPA is + /* + * SLB shadow or DTL can't be registered unless a master VPA is * registered. That means when restoring state, if a VPA *is* * registered, we need to set that up first. If not, we need to - * deregister the others before deregistering the master VPA */ + * deregister the others before deregistering the master VPA + */ assert(spapr_cpu->vpa_addr || !(spapr_cpu->slb_shadow_addr || spapr_cpu->dtl_addr)); =20 @@ -929,8 +945,9 @@ int kvm_arch_put_registers(CPUState *cs, int level) =20 regs.pid =3D env->spr[SPR_BOOKE_PID]; =20 - for (i =3D 0;i < 32; i++) + for (i =3D 0; i < 32; i++) { regs.gpr[i] =3D env->gpr[i]; + } =20 regs.cr =3D 0; for (i =3D 0; i < 8; i++) { @@ -938,8 +955,9 @@ int kvm_arch_put_registers(CPUState *cs, int level) } =20 ret =3D kvm_vcpu_ioctl(cs, KVM_SET_REGS, ®s); - if (ret < 0) + if (ret < 0) { return ret; + } =20 kvm_put_fp(cs); =20 @@ -962,10 +980,12 @@ int kvm_arch_put_registers(CPUState *cs, int level) if (cap_one_reg) { int i; =20 - /* We deliberately ignore errors here, for kernels which have + /* + * We deliberately ignore errors here, for kernels which have * the ONE_REG calls, but don't support the specific * registers, there's a reasonable chance things will still - * work, at least until we try to migrate. */ + * work, at least until we try to migrate. + */ for (i =3D 0; i < 1024; i++) { uint64_t id =3D env->spr_cb[i].one_reg_id; =20 @@ -1207,8 +1227,9 @@ int kvm_arch_get_registers(CPUState *cs) int i, ret; =20 ret =3D kvm_vcpu_ioctl(cs, KVM_GET_REGS, ®s); - if (ret < 0) + if (ret < 0) { return ret; + } =20 cr =3D regs.cr; for (i =3D 7; i >=3D 0; i--) { @@ -1236,8 +1257,9 @@ int kvm_arch_get_registers(CPUState *cs) =20 env->spr[SPR_BOOKE_PID] =3D regs.pid; =20 - for (i =3D 0;i < 32; i++) + for (i =3D 0; i < 32; i++) { env->gpr[i] =3D regs.gpr[i]; + } =20 kvm_get_fp(cs); =20 @@ -1262,10 +1284,12 @@ int kvm_arch_get_registers(CPUState *cs) if (cap_one_reg) { int i; =20 - /* We deliberately ignore errors here, for kernels which have + /* + * We deliberately ignore errors here, for kernels which have * the ONE_REG calls, but don't support the specific * registers, there's a reasonable chance things will still - * work, at least until we try to migrate. */ + * work, at least until we try to migrate. + */ for (i =3D 0; i < 1024; i++) { uint64_t id =3D env->spr_cb[i].one_reg_id; =20 @@ -1339,16 +1363,20 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run = *run) =20 qemu_mutex_lock_iothread(); =20 - /* PowerPC QEMU tracks the various core input pins (interrupt, critical - * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ + /* + * PowerPC QEMU tracks the various core input pins (interrupt, + * critical interrupt, reset, etc) in PPC-specific + * env->irq_input_state. + */ if (!cap_interrupt_level && run->ready_for_interrupt_injection && (cs->interrupt_request & CPU_INTERRUPT_HARD) && - (env->irq_input_state & (1<irq_input_state & (1 << PPC_INPUT_INT))) { - /* For now KVM disregards the 'irq' argument. However, in the - * future KVM could cache it in-kernel to avoid a heavyweight exit - * when reading the UIC. + /* + * For now KVM disregards the 'irq' argument. However, in the + * future KVM could cache it in-kernel to avoid a heavyweight + * exit when reading the UIC. */ irq =3D KVM_INTERRUPT_SET; =20 @@ -1363,9 +1391,12 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *= run) (NANOSECONDS_PER_SECOND / 50)); } =20 - /* We don't know if there are more interrupts pending after this. Howe= ver, - * the guest will return to userspace in the course of handling this o= ne - * anyways, so we will get a chance to deliver the rest. */ + /* + * We don't know if there are more interrupts pending after + * this. However, the guest will return to userspace in the course + * of handling this one anyways, so we will get a chance to + * deliver the rest. + */ =20 qemu_mutex_unlock_iothread(); } @@ -1394,18 +1425,22 @@ static int kvmppc_handle_halt(PowerPCCPU *cpu) } =20 /* map dcr access to existing qemu dcr emulation */ -static int kvmppc_handle_dcr_read(CPUPPCState *env, uint32_t dcrn, uint32_= t *data) +static int kvmppc_handle_dcr_read(CPUPPCState *env, + uint32_t dcrn, uint32_t *data) { - if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0) + if (ppc_dcr_read(env->dcr_env, dcrn, data) < 0) { fprintf(stderr, "Read to unhandled DCR (0x%x)\n", dcrn); + } =20 return 0; } =20 -static int kvmppc_handle_dcr_write(CPUPPCState *env, uint32_t dcrn, uint32= _t data) +static int kvmppc_handle_dcr_write(CPUPPCState *env, + uint32_t dcrn, uint32_t data) { - if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0) + if (ppc_dcr_write(env->dcr_env, dcrn, data) < 0) { fprintf(stderr, "Write to unhandled DCR (0x%x)\n", dcrn); + } =20 return 0; } @@ -1832,7 +1867,7 @@ static int read_cpuinfo(const char *field, char *valu= e, int len) ret =3D 0; break; } - } while(*line); + } while (*line); =20 fclose(f); =20 @@ -1849,7 +1884,8 @@ uint32_t kvmppc_get_tbfreq(void) return retval; } =20 - if (!(ns =3D strchr(line, ':'))) { + ns =3D strchr(line, ':'); + if (!ns) { return retval; } =20 @@ -1875,7 +1911,8 @@ static int kvmppc_find_cpu_dt(char *buf, int buf_len) struct dirent *dirp; DIR *dp; =20 - if ((dp =3D opendir(PROC_DEVTREE_CPU)) =3D=3D NULL) { + dp =3D opendir(PROC_DEVTREE_CPU); + if (!dp) { printf("Can't open directory " PROC_DEVTREE_CPU "\n"); return -1; } @@ -1929,10 +1966,11 @@ static uint64_t kvmppc_read_int_dt(const char *file= name) return 0; } =20 -/* Read a CPU node property from the host device tree that's a single +/* + * Read a CPU node property from the host device tree that's a single * integer (32-bit or 64-bit). Returns 0 if anything goes wrong - * (can't find or open the property, or doesn't understand the - * format) */ + * (can't find or open the property, or doesn't understand the format) + */ static uint64_t kvmppc_read_int_cpu_dt(const char *propname) { char buf[PATH_MAX], *tmp; @@ -1991,7 +2029,7 @@ int kvmppc_get_hasidle(CPUPPCState *env) =20 int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len) { - uint32_t *hc =3D (uint32_t*)buf; + uint32_t *hc =3D (uint32_t *)buf; struct kvm_ppc_pvinfo pvinfo; =20 if (!kvmppc_get_pvinfo(env, &pvinfo)) { @@ -2064,8 +2102,10 @@ void kvmppc_set_papr(PowerPCCPU *cpu) exit(1); } =20 - /* Update the capability flag so we sync the right information - * with kvm */ + /* + * Update the capability flag so we sync the right information + * with kvm + */ cap_papr =3D 1; } =20 @@ -2133,8 +2173,10 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsi= gned int hash_shift) long rampagesize, best_page_shift; int i; =20 - /* Find the largest hardware supported page size that's less than - * or equal to the (logical) backing page size of guest RAM */ + /* + * Find the largest hardware supported page size that's less than + * or equal to the (logical) backing page size of guest RAM + */ kvm_get_smmu_info(&info, &error_fatal); rampagesize =3D qemu_getrampagesize(); best_page_shift =3D 0; @@ -2184,7 +2226,8 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_= t page_shift, int fd; void *table; =20 - /* Must set fd to -1 so we don't try to munmap when called for + /* + * Must set fd to -1 so we don't try to munmap when called for * destroying the table, which the upper layers -will- do */ *pfd =3D -1; @@ -2229,7 +2272,7 @@ void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_= t page_shift, len =3D nb_table * sizeof(uint64_t); /* FIXME: round this up to page size */ =20 - table =3D mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + table =3D mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (table =3D=3D MAP_FAILED) { fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n", liobn); @@ -2272,10 +2315,12 @@ int kvmppc_reset_htab(int shift_hint) int ret; ret =3D kvm_vm_ioctl(kvm_state, KVM_PPC_ALLOCATE_HTAB, &shift); if (ret =3D=3D -ENOTTY) { - /* At least some versions of PR KVM advertise the + /* + * At least some versions of PR KVM advertise the * capability, but don't implement the ioctl(). Oops. * Return 0 so that we allocate the htab in qemu, as is - * correct for PR. */ + * correct for PR. + */ return 0; } else if (ret < 0) { return ret; @@ -2283,9 +2328,12 @@ int kvmppc_reset_htab(int shift_hint) return shift; } =20 - /* We have a kernel that predates the htab reset calls. For PR + /* + * We have a kernel that predates the htab reset calls. For PR * KVM, we need to allocate the htab ourselves, for an HV KVM of - * this era, it has allocated a 16MB fixed size hash table already. */ + * this era, it has allocated a 16MB fixed size hash table + * already. + */ if (kvmppc_is_pr(kvm_state)) { /* PR - tell caller to allocate htab */ return 0; @@ -2667,8 +2715,8 @@ int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufs= ize, int64_t max_ns) } } } while ((rc !=3D 0) - && ((max_ns < 0) - || ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) = < max_ns))); + && ((max_ns < 0) || + ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) < m= ax_ns))); =20 return (rc =3D=3D 0) ? 1 : 0; } @@ -2677,7 +2725,7 @@ int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint3= 2_t index, uint16_t n_valid, uint16_t n_invalid) { struct kvm_get_htab_header *buf; - size_t chunksize =3D sizeof(*buf) + n_valid*HASH_PTE_SIZE_64; + size_t chunksize =3D sizeof(*buf) + n_valid * HASH_PTE_SIZE_64; ssize_t rc; =20 buf =3D alloca(chunksize); @@ -2685,7 +2733,7 @@ int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint3= 2_t index, buf->n_valid =3D n_valid; buf->n_invalid =3D n_invalid; =20 - qemu_get_buffer(f, (void *)(buf + 1), HASH_PTE_SIZE_64*n_valid); + qemu_get_buffer(f, (void *)(buf + 1), HASH_PTE_SIZE_64 * n_valid); =20 rc =3D write(fd, buf, chunksize); if (rc < 0) { diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index 2c2ea30e87..22385134b4 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -117,7 +117,8 @@ static inline int kvmppc_get_hasidle(CPUPPCState *env) return 0; } =20 -static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int= buf_len) +static inline int kvmppc_get_hypercall(CPUPPCState *env, + uint8_t *buf, int buf_len) { return -1; } --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260013; cv=none; d=zoho.com; s=zohoarc; b=ckPYvrhZ4Hyr1hK3rACz9934iX4QeKNvexfMEYe9mr0diFSAcHZoGj2OrX/Bxnqkaha1po83k+kzLPtC3i/D1HS0qnbqZQZa0456x5WxiGfpJmftrgQ3TJQVltPJz72mlpGp0HqOz1D9FyyJ1RPZ+j4X7cYl+N+ebOlJ2b6STAU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260013; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eNB4pAgAU+5MexFP6zfP0rSHsZc/TbEg83ckiBlGWQc=; b=eA/GbAQW2sRUm+8RluxNvUVSCQ2fv6I9xL8PxdGupmWJtnLye7FEaf/vc5/XtFsZ5tQZZOjaR+eKcbfwce+ZBsx4/NEuMGBUuOtPGvQejUMK06EfBhKXR7+v44viAYBc8IYfRvYqnk+IbwLRPYUcLp09+eHd6sKb5AhYzuWZpKE= ARC-Authentication-Results: i=1; mx.zoho.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 155626001300287.55611937886863; Thu, 25 Apr 2019 23:26:53 -0700 (PDT) Received: from localhost ([127.0.0.1]:40210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuJu-0000Ia-0T for importer@patchew.org; Fri, 26 Apr 2019 02:26:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0c-0005ZU-Ou for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0Z-0004Ue-3l for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:54 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:50549 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0Y-0004P3-BB; Fri, 26 Apr 2019 02:06:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tm5YrQz9sNN; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258796; bh=309aFk9SXYG7E9iwhdtgcB8ry2sYHaMEp12uAsQ7BGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3yqn0EhLbeAhrqo7AaUgOYD4r9CYvVIQoxFXaoGNs82K+uqu/nBpz0lqtEADjIn0 Cac5EOQGZutkM32HdqLXn+G4DCP3THstPhZlUJeExUOLse+/F0PKF++QN4qmib74p5 P4+i0deDFK3aVm+gIPei20mHYN3ARIj5oRLEqRl8= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:05 +1000 Message-Id: <20190426060627.18153-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 14/36] target/ppc: Style fixes for machine.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/machine.c | 106 +++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 43 deletions(-) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index a92d0ad3a3..25cdb9088b 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -24,22 +24,26 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int = version_id) #endif target_ulong xer; =20 - for (i =3D 0; i < 32; i++) + for (i =3D 0; i < 32; i++) { qemu_get_betls(f, &env->gpr[i]); + } #if !defined(TARGET_PPC64) - for (i =3D 0; i < 32; i++) + for (i =3D 0; i < 32; i++) { qemu_get_betls(f, &env->gprh[i]); + } #endif qemu_get_betls(f, &env->lr); qemu_get_betls(f, &env->ctr); - for (i =3D 0; i < 8; i++) + for (i =3D 0; i < 8; i++) { qemu_get_be32s(f, &env->crf[i]); + } qemu_get_betls(f, &xer); cpu_write_xer(env, xer); qemu_get_betls(f, &env->reserve_addr); qemu_get_betls(f, &env->msr); - for (i =3D 0; i < 4; i++) + for (i =3D 0; i < 4; i++) { qemu_get_betls(f, &env->tgpr[i]); + } for (i =3D 0; i < 32; i++) { union { float64 d; @@ -56,14 +60,19 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int = version_id) qemu_get_sbe32s(f, &slb_nr); #endif qemu_get_betls(f, &sdr1); - for (i =3D 0; i < 32; i++) + for (i =3D 0; i < 32; i++) { qemu_get_betls(f, &env->sr[i]); - for (i =3D 0; i < 2; i++) - for (j =3D 0; j < 8; j++) + } + for (i =3D 0; i < 2; i++) { + for (j =3D 0; j < 8; j++) { qemu_get_betls(f, &env->DBAT[i][j]); - for (i =3D 0; i < 2; i++) - for (j =3D 0; j < 8; j++) + } + } + for (i =3D 0; i < 2; i++) { + for (j =3D 0; j < 8; j++) { qemu_get_betls(f, &env->IBAT[i][j]); + } + } qemu_get_sbe32s(f, &env->nb_tlb); qemu_get_sbe32s(f, &env->tlb_per_way); qemu_get_sbe32s(f, &env->nb_ways); @@ -71,17 +80,19 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int = version_id) qemu_get_sbe32s(f, &env->id_tlbs); qemu_get_sbe32s(f, &env->nb_pids); if (env->tlb.tlb6) { - // XXX assumes 6xx + /* XXX assumes 6xx */ for (i =3D 0; i < env->nb_tlb; i++) { qemu_get_betls(f, &env->tlb.tlb6[i].pte0); qemu_get_betls(f, &env->tlb.tlb6[i].pte1); qemu_get_betls(f, &env->tlb.tlb6[i].EPN); } } - for (i =3D 0; i < 4; i++) + for (i =3D 0; i < 4; i++) { qemu_get_betls(f, &env->pb[i]); - for (i =3D 0; i < 1024; i++) + } + for (i =3D 0; i < 1024; i++) { qemu_get_betls(f, &env->spr[i]); + } if (!cpu->vhyp) { ppc_store_sdr1(env, sdr1); } @@ -94,8 +105,9 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int v= ersion_id) qemu_get_sbe32s(f, &env->error_code); qemu_get_be32s(f, &env->pending_interrupts); qemu_get_be32s(f, &env->irq_input_state); - for (i =3D 0; i < POWERPC_EXCP_NB; i++) + for (i =3D 0; i < POWERPC_EXCP_NB; i++) { qemu_get_betls(f, &env->excp_vectors[i]); + } qemu_get_betls(f, &env->excp_prefix); qemu_get_betls(f, &env->ivor_mask); qemu_get_betls(f, &env->ivpr_mask); @@ -253,22 +265,24 @@ static int cpu_pre_save(void *opaque) env->spr[SPR_BOOKE_SPEFSCR] =3D env->spe_fscr; =20 for (i =3D 0; (i < 4) && (i < env->nb_BATs); i++) { - env->spr[SPR_DBAT0U + 2*i] =3D env->DBAT[0][i]; - env->spr[SPR_DBAT0U + 2*i + 1] =3D env->DBAT[1][i]; - env->spr[SPR_IBAT0U + 2*i] =3D env->IBAT[0][i]; - env->spr[SPR_IBAT0U + 2*i + 1] =3D env->IBAT[1][i]; + env->spr[SPR_DBAT0U + 2 * i] =3D env->DBAT[0][i]; + env->spr[SPR_DBAT0U + 2 * i + 1] =3D env->DBAT[1][i]; + env->spr[SPR_IBAT0U + 2 * i] =3D env->IBAT[0][i]; + env->spr[SPR_IBAT0U + 2 * i + 1] =3D env->IBAT[1][i]; } - for (i =3D 0; (i < 4) && ((i+4) < env->nb_BATs); i++) { - env->spr[SPR_DBAT4U + 2*i] =3D env->DBAT[0][i+4]; - env->spr[SPR_DBAT4U + 2*i + 1] =3D env->DBAT[1][i+4]; - env->spr[SPR_IBAT4U + 2*i] =3D env->IBAT[0][i+4]; - env->spr[SPR_IBAT4U + 2*i + 1] =3D env->IBAT[1][i+4]; + for (i =3D 0; (i < 4) && ((i + 4) < env->nb_BATs); i++) { + env->spr[SPR_DBAT4U + 2 * i] =3D env->DBAT[0][i + 4]; + env->spr[SPR_DBAT4U + 2 * i + 1] =3D env->DBAT[1][i + 4]; + env->spr[SPR_IBAT4U + 2 * i] =3D env->IBAT[0][i + 4]; + env->spr[SPR_IBAT4U + 2 * i + 1] =3D env->IBAT[1][i + 4]; } =20 /* Hacks for migration compatibility between 2.6, 2.7 & 2.8 */ if (cpu->pre_2_8_migration) { - /* Mask out bits that got added to msr_mask since the versions - * which stupidly included it in the migration stream. */ + /* + * Mask out bits that got added to msr_mask since the versions + * which stupidly included it in the migration stream. + */ target_ulong metamask =3D 0 #if defined(TARGET_PPC64) | (1ULL << MSR_TS0) @@ -277,9 +291,10 @@ static int cpu_pre_save(void *opaque) ; cpu->mig_msr_mask =3D env->msr_mask & ~metamask; cpu->mig_insns_flags =3D env->insns_flags & insns_compat_mask; - /* CPU models supported by old machines all have PPC_MEM_TLBIE, - * so we set it unconditionally to allow backward migration from - * a POWER9 host to a POWER8 host. + /* + * CPU models supported by old machines all have + * PPC_MEM_TLBIE, so we set it unconditionally to allow + * backward migration from a POWER9 host to a POWER8 host. */ cpu->mig_insns_flags |=3D PPC_MEM_TLBIE; cpu->mig_insns_flags2 =3D env->insns_flags2 & insns_compat_mask2; @@ -379,23 +394,26 @@ static int cpu_post_load(void *opaque, int version_id) env->spe_fscr =3D env->spr[SPR_BOOKE_SPEFSCR]; =20 for (i =3D 0; (i < 4) && (i < env->nb_BATs); i++) { - env->DBAT[0][i] =3D env->spr[SPR_DBAT0U + 2*i]; - env->DBAT[1][i] =3D env->spr[SPR_DBAT0U + 2*i + 1]; - env->IBAT[0][i] =3D env->spr[SPR_IBAT0U + 2*i]; - env->IBAT[1][i] =3D env->spr[SPR_IBAT0U + 2*i + 1]; + env->DBAT[0][i] =3D env->spr[SPR_DBAT0U + 2 * i]; + env->DBAT[1][i] =3D env->spr[SPR_DBAT0U + 2 * i + 1]; + env->IBAT[0][i] =3D env->spr[SPR_IBAT0U + 2 * i]; + env->IBAT[1][i] =3D env->spr[SPR_IBAT0U + 2 * i + 1]; } - for (i =3D 0; (i < 4) && ((i+4) < env->nb_BATs); i++) { - env->DBAT[0][i+4] =3D env->spr[SPR_DBAT4U + 2*i]; - env->DBAT[1][i+4] =3D env->spr[SPR_DBAT4U + 2*i + 1]; - env->IBAT[0][i+4] =3D env->spr[SPR_IBAT4U + 2*i]; - env->IBAT[1][i+4] =3D env->spr[SPR_IBAT4U + 2*i + 1]; + for (i =3D 0; (i < 4) && ((i + 4) < env->nb_BATs); i++) { + env->DBAT[0][i + 4] =3D env->spr[SPR_DBAT4U + 2 * i]; + env->DBAT[1][i + 4] =3D env->spr[SPR_DBAT4U + 2 * i + 1]; + env->IBAT[0][i + 4] =3D env->spr[SPR_IBAT4U + 2 * i]; + env->IBAT[1][i + 4] =3D env->spr[SPR_IBAT4U + 2 * i + 1]; } =20 if (!cpu->vhyp) { ppc_store_sdr1(env, env->spr[SPR_SDR1]); } =20 - /* Invalidate all supported msr bits except MSR_TGPR/MSR_HVB before re= storing */ + /* + * Invalidate all supported msr bits except MSR_TGPR/MSR_HVB + * before restoring + */ msr =3D env->msr; env->msr ^=3D env->msr_mask & ~((1ULL << MSR_TGPR) | MSR_HVB); ppc_store_msr(env, msr); @@ -409,7 +427,7 @@ static bool fpu_needed(void *opaque) { PowerPCCPU *cpu =3D opaque; =20 - return (cpu->env.insns_flags & PPC_FLOAT); + return cpu->env.insns_flags & PPC_FLOAT; } =20 static const VMStateDescription vmstate_fpu =3D { @@ -428,7 +446,7 @@ static bool altivec_needed(void *opaque) { PowerPCCPU *cpu =3D opaque; =20 - return (cpu->env.insns_flags & PPC_ALTIVEC); + return cpu->env.insns_flags & PPC_ALTIVEC; } =20 static int get_vscr(QEMUFile *f, void *opaque, size_t size, @@ -483,7 +501,7 @@ static bool vsx_needed(void *opaque) { PowerPCCPU *cpu =3D opaque; =20 - return (cpu->env.insns_flags2 & PPC2_VSX); + return cpu->env.insns_flags2 & PPC2_VSX; } =20 static const VMStateDescription vmstate_vsx =3D { @@ -591,7 +609,7 @@ static bool slb_needed(void *opaque) PowerPCCPU *cpu =3D opaque; =20 /* We don't support any of the old segment table based 64-bit CPUs */ - return (cpu->env.mmu_model & POWERPC_MMU_64); + return cpu->env.mmu_model & POWERPC_MMU_64; } =20 static int slb_post_load(void *opaque, int version_id) @@ -600,8 +618,10 @@ static int slb_post_load(void *opaque, int version_id) CPUPPCState *env =3D &cpu->env; int i; =20 - /* We've pulled in the raw esid and vsid values from the migration - * stream, but we need to recompute the page size pointers */ + /* + * We've pulled in the raw esid and vsid values from the migration + * stream, but we need to recompute the page size pointers + */ for (i =3D 0; i < cpu->hash64_opts->slb_size; i++) { if (ppc_store_slb(cpu, i, env->slb[i].esid, env->slb[i].vsid) < 0)= { /* Migration source had bad values in its SLB */ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259817; cv=none; d=zoho.com; s=zohoarc; b=TFOxYJ23S1nlr0motftIN8W3ZcNzAQ+CXa0NCZhw7mYgXGglwBygfzq116VDBFi3FU5FGI5u5CsYxp5BjH6ip4BYjfwkJw+j/U9bGVfwQ1Ksa68f/c5cctC6xNoi1uDoaW/fY4RSMmE6tSGYMJArxPEd5JitIP4LCC0ZEor2A4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259817; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=l5uzHi2dh0kc/RDL4zUG5AvKiL5YKRfazMnSUuYfjKw=; b=F2n6Zr8GQD4N8KhF3Qh2/nT0rRcq256LMVIboKfwcBysGUwsYOboGfjRL13IknNHHSRR4MJscrIFK1bGXnesHrDW8ocTSRR6T58Ao3ZdwVBRYxTFqp4DrL5UplBG2m9X34ITd7b89hPccYgTzEkCrHAK3h/grjEiRVWmzLuSyC0= ARC-Authentication-Results: i=1; mx.zoho.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 1556259817273614.2432249929237; Thu, 25 Apr 2019 23:23:37 -0700 (PDT) Received: from localhost ([127.0.0.1]:40135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuGh-0005as-6b for importer@patchew.org; Fri, 26 Apr 2019 02:23:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0u-0005w8-BN for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0t-00050I-5S for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:12 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:54589 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0s-0004PT-FC; Fri, 26 Apr 2019 02:07:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tm75fHz9sNK; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258797; bh=71hNapxXxJkb7FPRMtgPHqs6/xQm5Ig6vi2upazg1nU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHwuYmN8EJgvuJpmwKBft0GCCAxyQx1+R2kUQOL8P84GrPimRd0cbqmYoQT3uEalu TSFLzeteLJ47j2tHrNNL3lfLpBjFxz8LHLq8w8ciKkLaZP2BuGNxA+Q9G4xZ8ndzla EHqS4zJAuy2iCpscY8Ap4HP0HgzfzjH8gm447ArA= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:06 +1000 Message-Id: <20190426060627.18153-16-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for mem_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/mem_helper.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c index 9c5a68579e..5b0f9ee50d 100644 --- a/target/ppc/mem_helper.c +++ b/target/ppc/mem_helper.c @@ -27,7 +27,7 @@ #include "internal.h" #include "qemu/atomic128.h" =20 -//#define DEBUG_OP +/* #define DEBUG_OP */ =20 static inline bool needs_byteswap(const CPUPPCState *env) { @@ -103,10 +103,11 @@ void helper_lsw(CPUPPCState *env, target_ulong addr, = uint32_t nb, uint32_t reg) do_lsw(env, addr, nb, reg, GETPC()); } =20 -/* PPC32 specification says we must generate an exception if - * rA is in the range of registers to be loaded. - * In an other hand, IBM says this is valid, but rA won't be loaded. - * For now, I'll follow the spec... +/* + * PPC32 specification says we must generate an exception if rA is in + * the range of registers to be loaded. In an other hand, IBM says + * this is valid, but rA won't be loaded. For now, I'll follow the + * spec... */ void helper_lswx(CPUPPCState *env, target_ulong addr, uint32_t reg, uint32_t ra, uint32_t rb) @@ -199,7 +200,8 @@ void helper_dcbzep(CPUPPCState *env, target_ulong addr,= uint32_t opcode) void helper_icbi(CPUPPCState *env, target_ulong addr) { addr &=3D ~(env->dcache_line_size - 1); - /* Invalidate one cache line : + /* + * Invalidate one cache line : * PowerPC specification says this is to be treated like a load * (not a fetch) by the MMU. To be sure it will be so, * do the load "by hand". @@ -346,17 +348,19 @@ uint32_t helper_stqcx_be_parallel(CPUPPCState *env, t= arget_ulong addr, #define LO_IDX 0 #endif =20 -/* We use msr_le to determine index ordering in a vector. However, - byteswapping is not simply controlled by msr_le. We also need to take - into account endianness of the target. This is done for the little-end= ian - PPC64 user-mode target. */ +/* + * We use msr_le to determine index ordering in a vector. However, + * byteswapping is not simply controlled by msr_le. We also need to + * take into account endianness of the target. This is done for the + * little-endian PPC64 user-mode target. + */ =20 #define LVE(name, access, swap, element) \ void helper_##name(CPUPPCState *env, ppc_avr_t *r, \ target_ulong addr) \ { \ size_t n_elems =3D ARRAY_SIZE(r->element); \ - int adjust =3D HI_IDX*(n_elems - 1); \ + int adjust =3D HI_IDX * (n_elems - 1); \ int sh =3D sizeof(r->element[0]) >> 1; \ int index =3D (addr & 0xf) >> sh; \ if (msr_le) { \ @@ -476,12 +480,13 @@ VSX_STXVL(stxvll, 1) =20 void helper_tbegin(CPUPPCState *env) { - /* As a degenerate implementation, always fail tbegin. The reason + /* + * As a degenerate implementation, always fail tbegin. The reason * given is "Nesting overflow". The "persistent" bit is set, * providing a hint to the error handler to not retry. The TFIAR * captures the address of the failure, which is this tbegin - * instruction. Instruction execution will continue with the - * next instruction in memory, which is precisely what we want. + * instruction. Instruction execution will continue with the next + * instruction in memory, which is precisely what we want. */ =20 env->spr[SPR_TEXASR] =3D --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259291; cv=none; d=zoho.com; s=zohoarc; b=olI7hZYLishwrO//9NNtq9A6BAdrKJIwm/s7sjsk04UDXmYzZxaPdKnscLp7CJ5g3lWl/mqjpJGVHgiShtNofMERAMYiJHAGpZC4LqDCwszYrpwBZZGBd4tekgUWPHceXKWGJI2TTk4S0v9iZlbWOz5i9xac6xpTK+M8M4cvVnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259291; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zqBSqho70MsgjIhTx35IFwKaBdLjY81bMBok8isL7V8=; b=CYQ/vVdJ5+eJ4O/aHSAT+QAUEjdovuxWlTJHMe9lJDTcsRrK2v15AR8Q0LxBymJu59vRzATZDOOuLLPXBt9SyHNrHvdx2n2rbkwdeqX4zOVkEP4Y+JqzKBB5wjWFV9KvIXt5WGQ5sh+KW5B1Uh+JsQ0Cv/WBHwgF4z+VE8fO3cg= ARC-Authentication-Results: i=1; mx.zoho.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 1556259291848324.33185107013617; Thu, 25 Apr 2019 23:14:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:39975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu89-00049p-DC for importer@patchew.org; Fri, 26 Apr 2019 02:14:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0Z-0005U9-Jq for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0Y-0004St-6k for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:51 -0400 Received: from ozlabs.org ([203.11.71.1]:32789) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0X-0004Oc-P0; Fri, 26 Apr 2019 02:06:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tm3ll9z9sNR; Fri, 26 Apr 2019 16:06:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258796; bh=9WvZ+VQECcATx4JUjFGZZCSnDpliNllpd9YyTPcrgXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sr6bYK6B4X892fOSswPa5tJPT7odhMTKG8JBsZJnXFuSpa0lr9vmwKJCchdLEPrJ/ g/ibSNz6lOGDZt0GdczmCO4l1UHTEg7mPOwC4OT+m4DrqQn3qxB782j92GA/w/nFan vN2HgbuU2u03+x1znhRSGMr9XC/kS789MlyyWOo0= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:07 +1000 Message-Id: <20190426060627.18153-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 16/36] target/ppc: Style fixes for mfrom_table.inc.c & mfrom_table_gen.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/mfrom_table.inc.c | 3 +-- target/ppc/mfrom_table_gen.c | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/target/ppc/mfrom_table.inc.c b/target/ppc/mfrom_table.inc.c index 6a1fa375c9..1653b974a4 100644 --- a/target/ppc/mfrom_table.inc.c +++ b/target/ppc/mfrom_table.inc.c @@ -1,5 +1,4 @@ -static const uint8_t mfrom_ROM_table[602] =3D -{ +static const uint8_t mfrom_ROM_table[602] =3D { 77, 77, 76, 76, 75, 75, 74, 74, 73, 73, 72, 72, 71, 71, 70, 70, 69, 69, 68, 68, 68, 67, 67, 66, diff --git a/target/ppc/mfrom_table_gen.c b/target/ppc/mfrom_table_gen.c index 631791808e..f96c4268ba 100644 --- a/target/ppc/mfrom_table_gen.c +++ b/target/ppc/mfrom_table_gen.c @@ -2,7 +2,7 @@ #include "qemu/osdep.h" #include =20 -int main (void) +int main(void) { double d; uint8_t n; @@ -10,7 +10,8 @@ int main (void) =20 printf("static const uint8_t mfrom_ROM_table[602] =3D\n{\n "); for (i =3D 0; i < 602; i++) { - /* Extremely decomposed: + /* + * Extremely decomposed: * -T0 / 256 * T0 =3D 256 * log10(10 + 1.0) + 0.5 */ @@ -23,8 +24,9 @@ int main (void) d +=3D 0.5; n =3D d; printf("%3d, ", n); - if ((i & 7) =3D=3D 7) + if ((i & 7) =3D=3D 7) { printf("\n "); + } } printf("\n};\n"); =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259131; cv=none; d=zoho.com; s=zohoarc; b=Mt0XoTVbDroyThz2uSsHaKiOE7onXi+Fpzb0yoGxS0CSCqWhwDFCI2i30r4oxzGYs+1LHBHk+ISLE1SmEB0nkZ4SjK0fb8eu607PTLn09hhhh5ix2w59osRlQEb41J734egxgrDJPCClYNbPAVoPVw/o8G6yOiWnC3DNugKfMP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259131; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5mMH1NNdwkwF8TndbVFmm2Y31Ke1wJymxmuqAfQHads=; b=M7XgjJSovZn+k8rOooe4W7lfE6sD2c0CIb+pfg2oajmeT+/xS5ejsfCRIL22+ckhh1odIf8ZKemvelf9QnU7uu/JNR9xIf6y5y8Wk/M6SpxIo9bkXmTDxTB/KhhNxDrvy4KHMkgRAEzVIuFvJBkpVrwDtNAqwmLd1ot2eLW+J1U= ARC-Authentication-Results: i=1; mx.zoho.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 1556259131948446.957486035943; Thu, 25 Apr 2019 23:12:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:39945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu5j-0001p8-0J for importer@patchew.org; Fri, 26 Apr 2019 02:12:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0Z-0005UU-Vp for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0Y-0004TT-IW for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:51 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:54761 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0Y-0004Of-4W; Fri, 26 Apr 2019 02:06:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tm2Gf8z9sNC; Fri, 26 Apr 2019 16:06:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258796; bh=6Bi/FEKdFLeLFSqWxVnBjr69I/R0vsKiuX5lnlTia8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YXF4lD2SZeODoq4PyWfXEmVGSwEisz1sZ74vvgJz/j0D+9qu9Nffnm+JYtdezo3VG 1u6zeWHadkiHN5EuVdKLDmUQUFKBqXdQwcoSaaPb1IcklyJqeDS7pcNg3I+sphlli8 UqC3K8HZIq9jPGczl8tyv0Np7pb8nsV5Ci7uoPyY= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:08 +1000 Message-Id: <20190426060627.18153-18-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for misc_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/misc_helper.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c index c65d1ade15..0a81e98ee9 100644 --- a/target/ppc/misc_helper.c +++ b/target/ppc/misc_helper.c @@ -210,10 +210,11 @@ void ppc_store_msr(CPUPPCState *env, target_ulong val= ue) hreg_store_msr(env, value, 0); } =20 -/* This code is lifted from MacOnLinux. It is called whenever - * THRM1,2 or 3 is read an fixes up the values in such a way - * that will make MacOS not hang. These registers exist on some - * 75x and 74xx processors. +/* + * This code is lifted from MacOnLinux. It is called whenever THRM1,2 + * or 3 is read an fixes up the values in such a way that will make + * MacOS not hang. These registers exist on some 75x and 74xx + * processors. */ void helper_fixup_thrm(CPUPPCState *env) { --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259371; cv=none; d=zoho.com; s=zohoarc; b=htrHoo7GHebhCHPTXtDq5w4JiXu8/KSutYPcQNaG6eXalAkqctMEYLDhXmFbLfcPzW2nu1ys97+PNKG46ttpW7nvJIqA25Z4vrk/Gk0TmZ/2Djsjtijn5aPDGhOW/rPgqAySt9cxxLpjKuTaCJh86qAUG2AFzRsuKQNPGE2R5ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259371; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=LMDQyJRSDr/y92LOZPPDIh5gcFyXFPAv6e4GyR6iumo=; b=IZoSOy1pdzVLFY9P5PtaflmlVKSjXpafRjBN5+r+1JxyZYN3860JsUxcCZLvf0SiJo0OWY/Mr89B7xpw8x6Tw87uJd6o+L33Z/HZ0C8S96tCtbPTJ9lvHLaZR+k+xnWAgWDlr4BtiQ5zTt61bvV9CxhODPm7oVvUe1yDRgQq9+Y= ARC-Authentication-Results: i=1; mx.zoho.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 1556259371079423.49352223405344; Thu, 25 Apr 2019 23:16:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:40013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu9a-0005OT-3p for importer@patchew.org; Fri, 26 Apr 2019 02:16:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0a-0005Uk-7D for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0Y-0004Tj-Lh for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:52 -0400 Received: from ozlabs.org ([203.11.71.1]:50607) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0Y-0004Pf-8t; Fri, 26 Apr 2019 02:06:50 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tn1NdQz9sNM; Fri, 26 Apr 2019 16:06:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258797; bh=kDfYjlvVQdJieRr+Nh8b7xVvL3ct73J87Iz8hXJMJNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oU4uuH3gfyTgT/HGaQVCem7+8Fp+MWNxwwJ3buPOf9QQWtoqYkMeOKoKqZqdMUldZ zJnmknbxc0xz/+B4o57UcpV6kxoHViVEs5w4cFAwIbL5aJQRmX4qUl8TQL6nzN3b0B kLD2Qfv9ofeDHmx3JhqnBlc2p6dHvjafSem9qK7o= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:09 +1000 Message-Id: <20190426060627.18153-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for mmu-hash32.[ch] 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/mmu-hash32.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index e8562a7c87..3f4dee835e 100644 --- a/target/ppc/mmu-hash32.c +++ b/target/ppc/mmu-hash32.c @@ -27,7 +27,7 @@ #include "mmu-hash32.h" #include "exec/log.h" =20 -//#define DEBUG_BAT +/* #define DEBUG_BAT */ =20 #ifdef DEBUG_BATS # define LOG_BATS(...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__) @@ -228,8 +228,10 @@ static int ppc_hash32_direct_store(PowerPCCPU *cpu, ta= rget_ulong sr, qemu_log_mask(CPU_LOG_MMU, "direct store...\n"); =20 if ((sr & 0x1FF00000) >> 20 =3D=3D 0x07f) { - /* Memory-forced I/O controller interface access */ - /* If T=3D1 and BUID=3Dx'07F', the 601 performs a memory access + /* + * Memory-forced I/O controller interface access + * + * If T=3D1 and BUID=3Dx'07F', the 601 performs a memory access * to SR[28-31] LA[4-31], bypassing all protection mechanisms. */ *raddr =3D ((sr & 0xF) << 28) | (eaddr & 0x0FFFFFFF); @@ -265,9 +267,11 @@ static int ppc_hash32_direct_store(PowerPCCPU *cpu, ta= rget_ulong sr, } return 1; case ACCESS_CACHE: - /* dcba, dcbt, dcbtst, dcbf, dcbi, dcbst, dcbz, or icbi */ - /* Should make the instruction do no-op. - * As it already do no-op, it's quite easy :-) + /* + * dcba, dcbt, dcbtst, dcbf, dcbi, dcbst, dcbz, or icbi + * + * Should make the instruction do no-op. As it already do + * no-op, it's quite easy :-) */ *raddr =3D eaddr; return 0; @@ -519,8 +523,10 @@ int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr= eaddr, int rwx, if (rwx =3D=3D 1) { new_pte1 |=3D HPTE32_R_C; /* set changed (dirty) bit */ } else { - /* Treat the page as read-only for now, so that a later write - * will pass through this function again to set the C bit */ + /* + * Treat the page as read-only for now, so that a later write + * will pass through this function again to set the C bit + */ prot &=3D ~PAGE_WRITE; } =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260001; cv=none; d=zoho.com; s=zohoarc; b=UxPfwIuWUiobUwyLbyYIIstfhlc+Apnw6HIXyUiIgTDUO8B5NVmTsnLifgPpc1dMUro6YDvYwI69pED2ZSVHffPaj729NZi4nlrkRqgv4nT/xBueT9KkNUbJEZGeU8ywoBWF+5Zx8USsvFgEgy8UrHIpW4Yy7PtT3unmSfAoP7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260001; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=u5uBsKNgZbz7GGty6pTSq9z+sH3GBskVUjkv2UCeqn8=; b=h9ok+NB8mqZBJKv0EIVaFqkLrvSTzu747BgPxJqt5e0Oan/rCEqDH/ZJSm4nlBxqXAEHUxxJCzaaeS4WKgpDe+HFyJmrfJIsfGNvhS0z9xfIpsfIfZ8PttAjKHlkrBLIQHk1HNeSo2ONhTRJAhHRyqMFIRHYsOgOGcTQpFcGhOk= ARC-Authentication-Results: i=1; mx.zoho.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 1556260001048272.7436062936687; Thu, 25 Apr 2019 23:26:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:40206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuJb-0008Ij-30 for importer@patchew.org; Fri, 26 Apr 2019 02:26:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0x-0005zx-R3 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0t-00051H-TS for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:14 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:54057 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0t-0004QE-7y; Fri, 26 Apr 2019 02:07:11 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tn3bgCz9sNd; Fri, 26 Apr 2019 16:06:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258797; bh=is5dGuFEToTkSsfunuJwecq+HsApUZ8X/TgEZDIK2X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+Pnd6VILAYpphJsJJNQsk1gJbiF0JhFC+SOxy5HEQa08TxfQEDyKa0ZNR6MNfzq6 qkpUIymxdFJx5OOBa1VuwJ1gT2j5XHT0aob5cfnm9Q2rIlOb05fnLydphZiw5V3rX6 ZMmT32QEHmRmn7lJI5NmuKdiFzIMALZ42ZOsKT0A= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:10 +1000 Message-Id: <20190426060627.18153-20-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for mmu-hash64.[ch] 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/mmu-hash64.c | 68 +++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 214149f65b..c74818b2e7 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -30,7 +30,7 @@ #include "hw/hw.h" #include "mmu-book3s-v3.h" =20 -//#define DEBUG_SLB +/* #define DEBUG_SLB */ =20 #ifdef DEBUG_SLB # define LOG_SLB(...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__) @@ -58,9 +58,11 @@ static ppc_slb_t *slb_lookup(PowerPCCPU *cpu, target_ulo= ng eaddr) =20 LOG_SLB("%s: slot %d %016" PRIx64 " %016" PRIx64 "\n", __func__, n, slb->esid, slb->vsid); - /* We check for 1T matches on all MMUs here - if the MMU + /* + * We check for 1T matches on all MMUs here - if the MMU * doesn't have 1T segment support, we will have prevented 1T - * entries from being inserted in the slbmte code. */ + * entries from being inserted in the slbmte code. + */ if (((slb->esid =3D=3D esid_256M) && ((slb->vsid & SLB_VSID_B) =3D=3D SLB_VSID_B_256M)) || ((slb->esid =3D=3D esid_1T) && @@ -103,7 +105,8 @@ void helper_slbia(CPUPPCState *env) =20 if (slb->esid & SLB_ESID_V) { slb->esid &=3D ~SLB_ESID_V; - /* XXX: given the fact that segment size is 256 MB or 1TB, + /* + * XXX: given the fact that segment size is 256 MB or 1TB, * and we still don't have a tlb_flush_mask(env, n, mask) * in QEMU, we just invalidate all TLBs */ @@ -126,7 +129,8 @@ static void __helper_slbie(CPUPPCState *env, target_ulo= ng addr, if (slb->esid & SLB_ESID_V) { slb->esid &=3D ~SLB_ESID_V; =20 - /* XXX: given the fact that segment size is 256 MB or 1TB, + /* + * XXX: given the fact that segment size is 256 MB or 1TB, * and we still don't have a tlb_flush_mask(env, n, mask) * in QEMU, we just invalidate all TLBs */ @@ -306,8 +310,10 @@ static int ppc_hash64_pte_prot(PowerPCCPU *cpu, { CPUPPCState *env =3D &cpu->env; unsigned pp, key; - /* Some pp bit combinations have undefined behaviour, so default - * to no access in those cases */ + /* + * Some pp bit combinations have undefined behaviour, so default + * to no access in those cases + */ int prot =3D 0; =20 key =3D !!(msr_pr ? (slb->vsid & SLB_VSID_KP) @@ -376,7 +382,7 @@ static int ppc_hash64_amr_prot(PowerPCCPU *cpu, ppc_has= h_pte64_t pte) } =20 key =3D HPTE64_R_KEY(pte.pte1); - amrbits =3D (env->spr[SPR_AMR] >> 2*(31 - key)) & 0x3; + amrbits =3D (env->spr[SPR_AMR] >> 2 * (31 - key)) & 0x3; =20 /* fprintf(stderr, "AMR protection: key=3D%d AMR=3D0x%" PRIx64 "\n", k= ey, */ /* env->spr[SPR_AMR]); */ @@ -547,8 +553,9 @@ static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, h= waddr hash, if (*pshift =3D=3D 0) { continue; } - /* We don't do anything with pshift yet as qemu TLB only deals - * with 4K pages anyway + /* + * We don't do anything with pshift yet as qemu TLB only + * deals with 4K pages anyway */ pte->pte0 =3D pte0; pte->pte1 =3D pte1; @@ -572,8 +579,10 @@ static hwaddr ppc_hash64_htab_lookup(PowerPCCPU *cpu, uint64_t vsid, epnmask, epn, ptem; const PPCHash64SegmentPageSizes *sps =3D slb->sps; =20 - /* The SLB store path should prevent any bad page size encodings - * getting in there, so: */ + /* + * The SLB store path should prevent any bad page size encodings + * getting in there, so: + */ assert(sps); =20 /* If ISL is set in LPCR we need to clamp the page size to 4K */ @@ -732,17 +741,20 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vadd= r eaddr, =20 assert((rwx =3D=3D 0) || (rwx =3D=3D 1) || (rwx =3D=3D 2)); =20 - /* Note on LPCR usage: 970 uses HID4, but our special variant - * of store_spr copies relevant fields into env->spr[SPR_LPCR]. - * Similarily we filter unimplemented bits when storing into - * LPCR depending on the MMU version. This code can thus just - * use the LPCR "as-is". + /* + * Note on LPCR usage: 970 uses HID4, but our special variant of + * store_spr copies relevant fields into env->spr[SPR_LPCR]. + * Similarily we filter unimplemented bits when storing into LPCR + * depending on the MMU version. This code can thus just use the + * LPCR "as-is". */ =20 /* 1. Handle real mode accesses */ if (((rwx =3D=3D 2) && (msr_ir =3D=3D 0)) || ((rwx !=3D 2) && (msr_dr = =3D=3D 0))) { - /* Translation is supposedly "off" */ - /* In real mode the top 4 effective address bits are (mostly) igno= red */ + /* + * Translation is supposedly "off", but in real mode the top 4 + * effective address bits are (mostly) ignored + */ raddr =3D eaddr & 0x0FFFFFFFFFFFFFFFULL; =20 /* In HV mode, add HRMOR if top EA bit is clear */ @@ -875,8 +887,10 @@ skip_slb_search: if (rwx =3D=3D 1) { new_pte1 |=3D HPTE64_R_C; /* set changed (dirty) bit */ } else { - /* Treat the page as read-only for now, so that a later write - * will pass through this function again to set the C bit */ + /* + * Treat the page as read-only for now, so that a later write + * will pass through this function again to set the C bit + */ prot &=3D ~PAGE_WRITE; } =20 @@ -1023,8 +1037,9 @@ static void ppc_hash64_update_vrma(PowerPCCPU *cpu) return; } =20 - /* Make one up. Mostly ignore the ESID which will not be - * needed for translation + /* + * Make one up. Mostly ignore the ESID which will not be needed + * for translation */ vsid =3D SLB_VSID_VRMA; vrmasd =3D (lpcr & LPCR_VRMASD) >> LPCR_VRMASD_SHIFT; @@ -1080,11 +1095,12 @@ void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong v= al) } env->spr[SPR_RMOR] =3D ((lpcr >> 41) & 0xffffull) << 26; =20 - /* XXX We could also write LPID from HID4 here + /* + * XXX We could also write LPID from HID4 here * but since we don't tag any translation on it * it doesn't actually matter - */ - /* XXX For proper emulation of 970 we also need + * + * XXX For proper emulation of 970 we also need * to dig HRMOR out of HID5 */ break; --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260576; cv=none; d=zoho.com; s=zohoarc; b=blFYLjDZcDCOwCZxaC2ye9/uk9fOs/06EGjaBotWsHQm54l8qk9XogJo08oLu3wUJ13/lMhkJulJrFTzLewf2r+8n3PZ7QYl2wb+17XZmXMIq9w22rqcYB5yk2NvMf0sDtwQl4FrI3esWCiHcHxoOk38tSCmGqd2hFR8j8bJldM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260576; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QwScRAiJhmXV2eahcyzxVpXD+EEfpqjGJ6GKfE5j2XM=; b=nUQxmqHCDA2P+yLDjMmmOjM/cVPfxfOUJ5TAPsd1+RcSqoThPSVj2dDMyHL/1sAVdvKe4KWO1x6TDYsgusC5lw4UZV0HOPDe7p0YoO2B8FVrYCK8B2FtcJw6N7tbRZyUr6fYTHwITV4UzlVY6u1g6FQSLbVSP08WX0syDNuiXeY= ARC-Authentication-Results: i=1; mx.zoho.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 155626057607115.54365134998045; Thu, 25 Apr 2019 23:36:16 -0700 (PDT) Received: from localhost ([127.0.0.1]:40372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuSw-00016S-1v for importer@patchew.org; Fri, 26 Apr 2019 02:36:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu12-00065T-1s for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0y-00056S-4c for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:44319 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0u-0004Tq-QU; Fri, 26 Apr 2019 02:07:14 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tn6zRyz9sNm; Fri, 26 Apr 2019 16:06:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258797; bh=8lYBXpN7Qe0ABRvCl8tg5gJLiygRDm5+zMmDAYCdOkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xk9RVmRPh7K9PsIp8yYVoWddgdBJDDbW/v9HcmGjzPgbCFy/skpYZr+PY5H5ckOuL iUlKJ3XLXW8sCCr0uwDK+I8mlcPehY+qF/4dnCFIYzbUvUPOeP0W1kC0Lf98tDI44n orU9c21gmU8xlAJBR8bhimVOa44tWV3TyJVY+o3Q= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:11 +1000 Message-Id: <20190426060627.18153-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for mmu_helper.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/mmu_helper.c | 137 ++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 53 deletions(-) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index ab72473eeb..d226b35739 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -33,11 +33,11 @@ #include "mmu-book3s-v3.h" #include "mmu-radix64.h" =20 -//#define DEBUG_MMU -//#define DEBUG_BATS -//#define DEBUG_SOFTWARE_TLB -//#define DUMP_PAGE_TABLES -//#define FLUSH_ALL_TLBS +/* #define DEBUG_MMU */ +/* #define DEBUG_BATS */ +/* #define DEBUG_SOFTWARE_TLB */ +/* #define DUMP_PAGE_TABLES */ +/* #define FLUSH_ALL_TLBS */ =20 #ifdef DEBUG_MMU # define LOG_MMU_STATE(cpu) log_cpu_state_mask(CPU_LOG_MMU, (cpu), 0) @@ -152,7 +152,8 @@ static int check_prot(int prot, int rw, int access_type) } =20 static inline int ppc6xx_tlb_pte_check(mmu_ctx_t *ctx, target_ulong pte0, - target_ulong pte1, int h, int rw, i= nt type) + target_ulong pte1, int h, + int rw, int type) { target_ulong ptem, mmask; int access, ret, pteh, ptev, pp; @@ -332,7 +333,8 @@ static inline int ppc6xx_tlb_check(CPUPPCState *env, mm= u_ctx_t *ctx, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, eaddr, tlb->pte1, rw ? 'S' : 'L', access_type =3D=3D ACCESS_CODE ? 'I' : '= D'); - switch (ppc6xx_tlb_pte_check(ctx, tlb->pte0, tlb->pte1, 0, rw, acc= ess_type)) { + switch (ppc6xx_tlb_pte_check(ctx, tlb->pte0, tlb->pte1, + 0, rw, access_type)) { case -3: /* TLB inconsistency */ return -1; @@ -347,9 +349,11 @@ static inline int ppc6xx_tlb_check(CPUPPCState *env, m= mu_ctx_t *ctx, break; case 0: /* access granted */ - /* XXX: we should go on looping to check all TLBs consistency - * but we can speed-up the whole thing as the - * result would be undefined if TLBs are not consistent. + /* + * XXX: we should go on looping to check all TLBs + * consistency but we can speed-up the whole thing as + * the result would be undefined if TLBs are not + * consistent. */ ret =3D 0; best =3D nr; @@ -550,14 +554,18 @@ static inline int get_segment_6xx_tlb(CPUPPCState *en= v, mmu_ctx_t *ctx, qemu_log_mask(CPU_LOG_MMU, "direct store...\n"); /* Direct-store segment : absolutely *BUGGY* for now */ =20 - /* Direct-store implies a 32-bit MMU. + /* + * Direct-store implies a 32-bit MMU. * Check the Segment Register's bus unit ID (BUID). */ sr =3D env->sr[eaddr >> 28]; if ((sr & 0x1FF00000) >> 20 =3D=3D 0x07f) { - /* Memory-forced I/O controller interface access */ - /* If T=3D1 and BUID=3Dx'07F', the 601 performs a memory access - * to SR[28-31] LA[4-31], bypassing all protection mechanisms. + /* + * Memory-forced I/O controller interface access + * + * If T=3D1 and BUID=3Dx'07F', the 601 performs a memory + * access to SR[28-31] LA[4-31], bypassing all protection + * mechanisms. */ ctx->raddr =3D ((sr & 0xF) << 28) | (eaddr & 0x0FFFFFFF); ctx->prot =3D PAGE_READ | PAGE_WRITE | PAGE_EXEC; @@ -578,9 +586,11 @@ static inline int get_segment_6xx_tlb(CPUPPCState *env= , mmu_ctx_t *ctx, /* lwarx, ldarx or srwcx. */ return -4; case ACCESS_CACHE: - /* dcba, dcbt, dcbtst, dcbf, dcbi, dcbst, dcbz, or icbi */ - /* Should make the instruction do no-op. - * As it already do no-op, it's quite easy :-) + /* + * dcba, dcbt, dcbtst, dcbf, dcbi, dcbst, dcbz, or icbi + * + * Should make the instruction do no-op. As it already do + * no-op, it's quite easy :-) */ ctx->raddr =3D eaddr; return 0; @@ -942,12 +952,14 @@ static uint32_t mmubooke206_esr(int mmu_idx, bool rw) return esr; } =20 -/* Get EPID register given the mmu_idx. If this is regular load, - * construct the EPID access bits from current processor state */ - -/* Get the effective AS and PR bits and the PID. The PID is returned only = if - * EPID load is requested, otherwise the caller must detect the correct EP= ID. - * Return true if valid EPID is returned. */ +/* + * Get EPID register given the mmu_idx. If this is regular load, + * construct the EPID access bits from current processor state + * + * Get the effective AS and PR bits and the PID. The PID is returned + * only if EPID load is requested, otherwise the caller must detect + * the correct EPID. Return true if valid EPID is returned. + */ static bool mmubooke206_get_as(CPUPPCState *env, int mmu_idx, uint32_t *epid_out, bool *as_out, bool *pr_out) @@ -1369,8 +1381,9 @@ static inline int check_physical(CPUPPCState *env, mm= u_ctx_t *ctx, =20 case POWERPC_MMU_SOFT_4xx_Z: if (unlikely(msr_pe !=3D 0)) { - /* 403 family add some particular protections, - * using PBL/PBU registers for accesses with no translation. + /* + * 403 family add some particular protections, using + * PBL/PBU registers for accesses with no translation. */ in_plb =3D /* Check PLB validity */ @@ -1453,7 +1466,8 @@ static int get_physical_address_wtlb( if (real_mode) { ret =3D check_physical(env, ctx, eaddr, rw); } else { - cpu_abort(CPU(cpu), "PowerPC in real mode do not do any transl= ation\n"); + cpu_abort(CPU(cpu), + "PowerPC in real mode do not do any translation\n"); } return -1; default: @@ -1498,9 +1512,10 @@ hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vad= dr addr) =20 if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT) !=3D= 0)) { =20 - /* Some MMUs have separate TLBs for code and data. If we only try = an - * ACCESS_INT, we may not be able to read instructions mapped by c= ode - * TLBs, so we also try a ACCESS_CODE. + /* + * Some MMUs have separate TLBs for code and data. If we only + * try an ACCESS_INT, we may not be able to read instructions + * mapped by code TLBs, so we also try a ACCESS_CODE. */ if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_CODE) !=3D 0)) { @@ -1834,8 +1849,9 @@ void helper_store_ibatu(CPUPPCState *env, uint32_t nr= , target_ulong value) #if !defined(FLUSH_ALL_TLBS) do_invalidate_BAT(env, env->IBAT[0][nr], mask); #endif - /* When storing valid upper BAT, mask BEPI and BRPN - * and invalidate all TLBs covered by this BAT + /* + * When storing valid upper BAT, mask BEPI and BRPN and + * invalidate all TLBs covered by this BAT */ mask =3D (value << 15) & 0x0FFE0000UL; env->IBAT[0][nr] =3D (value & 0x00001FFFUL) | @@ -1865,8 +1881,9 @@ void helper_store_dbatu(CPUPPCState *env, uint32_t nr= , target_ulong value) =20 dump_store_bat(env, 'D', 0, nr, value); if (env->DBAT[0][nr] !=3D value) { - /* When storing valid upper BAT, mask BEPI and BRPN - * and invalidate all TLBs covered by this BAT + /* + * When storing valid upper BAT, mask BEPI and BRPN and + * invalidate all TLBs covered by this BAT */ mask =3D (value << 15) & 0x0FFE0000UL; #if !defined(FLUSH_ALL_TLBS) @@ -1913,8 +1930,9 @@ void helper_store_601_batu(CPUPPCState *env, uint32_t= nr, target_ulong value) do_inval =3D 1; #endif } - /* When storing valid upper BAT, mask BEPI and BRPN - * and invalidate all TLBs covered by this BAT + /* + * When storing valid upper BAT, mask BEPI and BRPN and + * invalidate all TLBs covered by this BAT */ env->IBAT[0][nr] =3D (value & 0x00001FFFUL) | (value & ~0x0001FFFFUL & ~mask); @@ -2027,7 +2045,8 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_= ulong addr) #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { /* tlbie invalidate TLBs for all segments */ - /* XXX: given the fact that there are too many segments to invalid= ate, + /* + * XXX: given the fact that there are too many segments to invalid= ate, * and we still don't have a tlb_flush_mask(env, n, mask) in = QEMU, * we just invalidate all TLBs */ @@ -2044,10 +2063,11 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, targe= t_ulong addr) break; case POWERPC_MMU_32B: case POWERPC_MMU_601: - /* Actual CPUs invalidate entire congruence classes based on the - * geometry of their TLBs and some OSes take that into account, - * we just mark the TLB to be flushed later (context synchronizing - * event or sync instruction on 32-bit). + /* + * Actual CPUs invalidate entire congruence classes based on + * the geometry of their TLBs and some OSes take that into + * account, we just mark the TLB to be flushed later (context + * synchronizing event or sync instruction on 32-bit). */ env->tlb_need_flush |=3D TLB_NEED_LOCAL_FLUSH; break; @@ -2152,8 +2172,10 @@ void helper_store_sr(CPUPPCState *env, target_ulong = srnum, target_ulong value) #endif if (env->sr[srnum] !=3D value) { env->sr[srnum] =3D value; -/* Invalidating 256MB of virtual memory in 4kB pages is way longer than - flusing the whole TLB. */ + /* + * Invalidating 256MB of virtual memory in 4kB pages is way + * longer than flusing the whole TLB. + */ #if !defined(FLUSH_ALL_TLBS) && 0 { target_ulong page, end; @@ -2264,10 +2286,12 @@ target_ulong helper_rac(CPUPPCState *env, target_ul= ong addr) int nb_BATs; target_ulong ret =3D 0; =20 - /* We don't have to generate many instances of this instruction, + /* + * We don't have to generate many instances of this instruction, * as rac is supervisor only. + * + * XXX: FIX THIS: Pretend we have no BAT */ - /* XXX: FIX THIS: Pretend we have no BAT */ nb_BATs =3D env->nb_BATs; env->nb_BATs =3D 0; if (get_physical_address(env, &ctx, addr, 0, ACCESS_INT) =3D=3D 0) { @@ -2422,7 +2446,8 @@ void helper_4xx_tlbwe_hi(CPUPPCState *env, target_ulo= ng entry, } tlb->size =3D booke_tlb_to_page_size((val >> PPC4XX_TLBHI_SIZE_SHIFT) & PPC4XX_TLBHI_SIZE_MASK); - /* We cannot handle TLB size < TARGET_PAGE_SIZE. + /* + * We cannot handle TLB size < TARGET_PAGE_SIZE. * If this ever occurs, we should implement TARGET_PAGE_BITS_VARY */ if ((val & PPC4XX_TLBHI_V) && tlb->size < TARGET_PAGE_SIZE) { @@ -2742,7 +2767,8 @@ void helper_booke206_tlbwe(CPUPPCState *env) } =20 if (tlb->mas1 & MAS1_VALID) { - /* Invalidate the page in QEMU TLB if it was a valid entry. + /* + * Invalidate the page in QEMU TLB if it was a valid entry. * * In "PowerPC e500 Core Family Reference Manual, Rev. 1", * Section "12.4.2 TLB Write Entry (tlbwe) Instruction": @@ -2751,7 +2777,8 @@ void helper_booke206_tlbwe(CPUPPCState *env) * "Note that when an L2 TLB entry is written, it may be displacin= g an * already valid entry in the same L2 TLB location (a victim). If a * valid L1 TLB entry corresponds to the L2 MMU victim entry, that= L1 - * TLB entry is automatically invalidated." */ + * TLB entry is automatically invalidated." + */ flush_page(env, tlb); } =20 @@ -2777,8 +2804,9 @@ void helper_booke206_tlbwe(CPUPPCState *env) mask |=3D MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MA= S2_E; =20 if (!msr_cm) { - /* Executing a tlbwe instruction in 32-bit mode will set - * bits 0:31 of the TLB EPN field to zero. + /* + * Executing a tlbwe instruction in 32-bit mode will set bits + * 0:31 of the TLB EPN field to zero. */ mask &=3D 0xffffffff; } @@ -3022,10 +3050,13 @@ void helper_check_tlb_flush_global(CPUPPCState *env) =20 /*************************************************************************= ****/ =20 -/* try to fill the TLB and return an exception if error. If retaddr is - NULL, it means that the function was called in C code (i.e. not - from generated code or from helper.c) */ -/* XXX: fix it to restore all registers */ +/* + * try to fill the TLB and return an exception if error. If retaddr is + * NULL, it means that the function was called in C code (i.e. not + * from generated code or from helper.c) + * + * XXX: fix it to restore all registers + */ void tlb_fill(CPUState *cs, target_ulong addr, int size, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259651; cv=none; d=zoho.com; s=zohoarc; b=bpshapgAWMoUkmjksAJ7Fv40zcCCY0VJg9kcjBJDm6oMfJ2RgObukzY8SBF1Gx+ulR2j6Jgrs9RLXaDNe3y/6uS7i96M+Lz10iAZsxydhpN+AaKm3zb8IIQ7GfCDyXG9woa0i3FJiEA01kmq4hobGWC7g/ytvH+cbVLV8Qi8wfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259651; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PBy0VOYCeWdipm+JYm+Gfw7zKVBRx9yYWqjVkNnswJY=; b=nW1qypcW/cLB73jUi1VTTRewPcyfnDAvG8SJZc5lMeQcBJMgqEFjROnJJqE53KHgVUc5wk5ArdXCvCbCznzAzfIbdKDFTGbevqQhZp8FXjew6N1RYplFYrkgwPitmRe1qFv2ExmDGjam3mVePcSdQp+nFElDYR4OFXqiLgBsAlo= ARC-Authentication-Results: i=1; mx.zoho.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 1556259651831537.784439774536; Thu, 25 Apr 2019 23:20:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:40069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuE3-0002Na-NN for importer@patchew.org; Fri, 26 Apr 2019 02:20:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0d-0005aE-6Z for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0b-0004YP-B3 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:55 -0400 Received: from ozlabs.org ([203.11.71.1]:60495) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0a-0004Uj-RV; Fri, 26 Apr 2019 02:06:53 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tp2qxfz9sNp; Fri, 26 Apr 2019 16:06:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258798; bh=67lUhJOkF+kaNKYUQ3C7NYOWQl/IDjKx+6R9ClWRpe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZFv0pRfiPBnTkopyVdZ7t+bROVR9TE9OCyRAKK0c+OJ5T/RV/8HPk+f8lKXLLC7v oErzY5Z2QHhw0FYH0Dmhs0wRulQBRP0CCjvdeI2uPgVcPOXnufvRf2hAJR+prddgG2 xPBs8dKGONGdiVKOWszVFMiBwjy5HrzGy3oNkcuY= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:12 +1000 Message-Id: <20190426060627.18153-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 21/36] target/ppc: Style fixes for monitor.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/monitor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 42e58163fc..ee9d6e81d2 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -27,32 +27,33 @@ #include "monitor/hmp-target.h" #include "hmp.h" =20 -static target_long monitor_get_ccr (const struct MonitorDef *md, int val) +static target_long monitor_get_ccr(const struct MonitorDef *md, int val) { CPUArchState *env =3D mon_get_cpu_env(); unsigned int u; int i; =20 u =3D 0; - for (i =3D 0; i < 8; i++) + for (i =3D 0; i < 8; i++) { u |=3D env->crf[i] << (32 - (4 * (i + 1))); + } =20 return u; } =20 -static target_long monitor_get_decr (const struct MonitorDef *md, int val) +static target_long monitor_get_decr(const struct MonitorDef *md, int val) { CPUArchState *env =3D mon_get_cpu_env(); return cpu_ppc_load_decr(env); } =20 -static target_long monitor_get_tbu (const struct MonitorDef *md, int val) +static target_long monitor_get_tbu(const struct MonitorDef *md, int val) { CPUArchState *env =3D mon_get_cpu_env(); return cpu_ppc_load_tbu(env); } =20 -static target_long monitor_get_tbl (const struct MonitorDef *md, int val) +static target_long monitor_get_tbl(const struct MonitorDef *md, int val) { CPUArchState *env =3D mon_get_cpu_env(); return cpu_ppc_load_tbl(env); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260685; cv=none; d=zoho.com; s=zohoarc; b=eXs48dLbFjGx0sASZa7Bw9PqoJpua+h04TrApl7oIasvAONAIBVb3u06lrME0GA0sJFTNSZ6l9RGX30ajvyejN4u9+16rdXxTMgQHAx83M815lnHk8unjiLRkGKET6zbHfzjbHvCoE9salNmedRj7K02O38PnD1MoER6jKFMkvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260685; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+GtDTu6PEYglEN6VGcZojJEE4WN6Rh9Q8jrRSONVZHY=; b=QI8v1xkXUnD/J7J9fgkzBAhrVtcJ/Vnhh2z/a+7rUQECpvLcjaah9iKTwuk0LuTwAVJfLGr2WrpX3WXaX5C0KfmuC7vxs5PkOE8bkS6ozLd7L0L5TgNRMhx2W9lvdlOfkTqvJGWwXex6rrPCzsQUIVPVrgWlGXRVlnFa5Inioj8= ARC-Authentication-Results: i=1; mx.zoho.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 1556260685750167.11990155914214; Thu, 25 Apr 2019 23:38:05 -0700 (PDT) Received: from localhost ([127.0.0.1]:40386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuUj-0002Tj-N4 for importer@patchew.org; Fri, 26 Apr 2019 02:38:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu12-00065S-1l for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0y-00056Y-4v for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:43333 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0u-0004So-8F; Fri, 26 Apr 2019 02:07:14 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tn5Kswz9sNf; Fri, 26 Apr 2019 16:06:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258797; bh=s7GIO6ynTQuU/cG4Jan27WwIvfD2wDdPKZx0rnca6oY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZcJAk1MqP0TQwBG/LQtYNme2lfp+gVFi3vfovuyFUMOrhjTQ/NqVc5+srxgU+NkL ZJVuv4mKmRvhWqs//L3Lags0d5SvdSrMf/Nb+TbfI/qU3Vq6UlRTNNG4BibkhxlY7A RO+D9Pso7dlplG7Ad8VwfUstnG1af7gUNc31UNVM= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:13 +1000 Message-Id: <20190426060627.18153-23-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for translate_init.inc.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate_init.inc.c | 243 +++++++++++++++++++------------- 1 file changed, 148 insertions(+), 95 deletions(-) diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index 20a64f3b77..0394a9ddad 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -41,12 +41,13 @@ #include "fpu/softfloat.h" #include "qapi/qapi-commands-target.h" =20 -//#define PPC_DUMP_CPU -//#define PPC_DEBUG_SPR -//#define PPC_DUMP_SPR_ACCESSES +/* #define PPC_DUMP_CPU */ +/* #define PPC_DEBUG_SPR */ +/* #define PPC_DUMP_SPR_ACCESSES */ /* #define USE_APPLE_GDB */ =20 -/* Generic callbacks: +/* + * Generic callbacks: * do nothing but store/retrieve spr value */ static void spr_load_dump_spr(int sprn) @@ -58,7 +59,7 @@ static void spr_load_dump_spr(int sprn) #endif } =20 -static void spr_read_generic (DisasContext *ctx, int gprn, int sprn) +static void spr_read_generic(DisasContext *ctx, int gprn, int sprn) { gen_load_spr(cpu_gpr[gprn], sprn); spr_load_dump_spr(sprn); @@ -230,13 +231,13 @@ static void spr_read_tbu(DisasContext *ctx, int gprn,= int sprn) } } =20 -__attribute__ (( unused )) +ATTRIBUTE_UNUSED static void spr_read_atbl(DisasContext *ctx, int gprn, int sprn) { gen_helper_load_atbl(cpu_gpr[gprn], cpu_env); } =20 -__attribute__ (( unused )) +ATTRIBUTE_UNUSED static void spr_read_atbu(DisasContext *ctx, int gprn, int sprn) { gen_helper_load_atbu(cpu_gpr[gprn], cpu_env); @@ -267,20 +268,20 @@ static void spr_write_tbu(DisasContext *ctx, int sprn= , int gprn) } } =20 -__attribute__ (( unused )) +ATTRIBUTE_UNUSED static void spr_write_atbl(DisasContext *ctx, int sprn, int gprn) { gen_helper_store_atbl(cpu_env, cpu_gpr[gprn]); } =20 -__attribute__ (( unused )) +ATTRIBUTE_UNUSED static void spr_write_atbu(DisasContext *ctx, int sprn, int gprn) { gen_helper_store_atbu(cpu_env, cpu_gpr[gprn]); } =20 #if defined(TARGET_PPC64) -__attribute__ (( unused )) +ATTRIBUTE_UNUSED static void spr_read_purr(DisasContext *ctx, int gprn, int sprn) { gen_helper_load_purr(cpu_gpr[gprn], cpu_env); @@ -319,12 +320,16 @@ static void spr_write_hdecr(DisasContext *ctx, int sp= rn, int gprn) /* IBAT0L...IBAT7L */ static void spr_read_ibat(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, IBAT[sprn = & 1][(sprn - SPR_IBAT0U) / 2])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, + IBAT[sprn & 1][(sprn - SPR_IBAT0U) / 2])); } =20 static void spr_read_ibat_h(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, IBAT[sprn = & 1][((sprn - SPR_IBAT4U) / 2) + 4])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, + IBAT[sprn & 1][((sprn - SPR_IBAT4U) / 2) + 4])); } =20 static void spr_write_ibatu(DisasContext *ctx, int sprn, int gprn) @@ -359,12 +364,16 @@ static void spr_write_ibatl_h(DisasContext *ctx, int = sprn, int gprn) /* DBAT0L...DBAT7L */ static void spr_read_dbat(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, DBAT[sprn = & 1][(sprn - SPR_DBAT0U) / 2])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, + DBAT[sprn & 1][(sprn - SPR_DBAT0U) / 2])); } =20 static void spr_read_dbat_h(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, DBAT[sprn = & 1][((sprn - SPR_DBAT4U) / 2) + 4])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, + DBAT[sprn & 1][((sprn - SPR_DBAT4U) / 2) + 4])); } =20 static void spr_write_dbatu(DisasContext *ctx, int sprn, int gprn) @@ -473,7 +482,9 @@ static void spr_write_hid0_601(DisasContext *ctx, int s= prn, int gprn) #if !defined(CONFIG_USER_ONLY) static void spr_read_601_ubat(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, IBAT[sprn = & 1][(sprn - SPR_IBAT0U) / 2])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, + IBAT[sprn & 1][(sprn - SPR_IBAT0U) / 2])); } =20 static void spr_write_601_ubatu(DisasContext *ctx, int sprn, int gprn) @@ -532,7 +543,8 @@ static void spr_write_booke_tsr(DisasContext *ctx, int = sprn, int gprn) #if !defined(CONFIG_USER_ONLY) static void spr_read_403_pbr(DisasContext *ctx, int gprn, int sprn) { - tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUPPCState, pb[sprn - = SPR_403_PBL1])); + tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, + offsetof(CPUPPCState, pb[sprn - SPR_403_PBL1])); } =20 static void spr_write_403_pbr(DisasContext *ctx, int sprn, int gprn) @@ -661,14 +673,20 @@ static inline void vscr_init(CPUPPCState *env, uint32= _t val) =20 static inline void _spr_register(CPUPPCState *env, int num, const char *name, - void (*uea_read)(DisasContext *ctx, int g= prn, int sprn), - void (*uea_write)(DisasContext *ctx, int = sprn, int gprn), + void (*uea_read)(DisasContext *ctx, + int gprn, int sprn), + void (*uea_write)(DisasContext *ctx, + int sprn, int gprn), #if !defined(CONFIG_USER_ONLY) =20 - void (*oea_read)(DisasContext *ctx, int g= prn, int sprn), - void (*oea_write)(DisasContext *ctx, int = sprn, int gprn), - void (*hea_read)(DisasContext *opaque, in= t gprn, int sprn), - void (*hea_write)(DisasContext *opaque, i= nt sprn, int gprn), + void (*oea_read)(DisasContext *ctx, + int gprn, int sprn), + void (*oea_write)(DisasContext *ctx, + int sprn, int gprn), + void (*hea_read)(DisasContext *opaque, + int gprn, int sprn), + void (*hea_write)(DisasContext *opaque, + int sprn, int gprn), #endif #if defined(CONFIG_KVM) uint64_t one_reg_id, @@ -678,7 +696,7 @@ static inline void _spr_register(CPUPPCState *env, int = num, ppc_spr_t *spr; =20 spr =3D &env->spr_cb[num]; - if (spr->name !=3D NULL ||env-> spr[num] !=3D 0x00000000 || + if (spr->name !=3D NULL || env->spr[num] !=3D 0x00000000 || #if !defined(CONFIG_USER_ONLY) spr->oea_read !=3D NULL || spr->oea_write !=3D NULL || #endif @@ -774,8 +792,10 @@ static void gen_spr_sdr1(CPUPPCState *env) { #ifndef CONFIG_USER_ONLY if (env->has_hv_mode) { - /* SDR1 is a hypervisor resource on CPUs which have a - * hypervisor mode */ + /* + * SDR1 is a hypervisor resource on CPUs which have a + * hypervisor mode + */ spr_register_hv(env, SPR_SDR1, "SDR1", SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, @@ -1123,7 +1143,8 @@ static void spr_write_amr(DisasContext *ctx, int sprn= , int gprn) TCGv t1 =3D tcg_temp_new(); TCGv t2 =3D tcg_temp_new(); =20 - /* Note, the HV=3D1 PR=3D0 case is handled earlier by simply using + /* + * Note, the HV=3D1 PR=3D0 case is handled earlier by simply using * spr_write_generic for HV mode in the SPR table */ =20 @@ -1157,7 +1178,8 @@ static void spr_write_uamor(DisasContext *ctx, int sp= rn, int gprn) TCGv t1 =3D tcg_temp_new(); TCGv t2 =3D tcg_temp_new(); =20 - /* Note, the HV=3D1 case is handled earlier by simply using + /* + * Note, the HV=3D1 case is handled earlier by simply using * spr_write_generic for HV mode in the SPR table */ =20 @@ -1187,7 +1209,8 @@ static void spr_write_iamr(DisasContext *ctx, int spr= n, int gprn) TCGv t1 =3D tcg_temp_new(); TCGv t2 =3D tcg_temp_new(); =20 - /* Note, the HV=3D1 case is handled earlier by simply using + /* + * Note, the HV=3D1 case is handled earlier by simply using * spr_write_generic for HV mode in the SPR table */ =20 @@ -1215,10 +1238,13 @@ static void spr_write_iamr(DisasContext *ctx, int s= prn, int gprn) static void gen_spr_amr(CPUPPCState *env) { #ifndef CONFIG_USER_ONLY - /* Virtual Page Class Key protection */ - /* The AMR is accessible either via SPR 13 or SPR 29. 13 is + /* + * Virtual Page Class Key protection + * + * The AMR is accessible either via SPR 13 or SPR 29. 13 is * userspace accessible, 29 is privileged. So we only need to set - * the kvm ONE_REG id on one of them, we use 29 */ + * the kvm ONE_REG id on one of them, we use 29 + */ spr_register(env, SPR_UAMR, "UAMR", &spr_read_generic, &spr_write_amr, &spr_read_generic, &spr_write_amr, @@ -1902,7 +1928,8 @@ static void gen_spr_BookE206(CPUPPCState *env, uint32= _t mas_mask, /* TLB assist registers */ /* XXX : not implemented */ for (i =3D 0; i < 8; i++) { - void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =3D &spr_= write_generic32; + void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =3D + &spr_write_generic32; if (i =3D=3D 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC= _64B)) { uea_write =3D &spr_write_generic; } @@ -2798,7 +2825,6 @@ static void gen_spr_8xx(CPUPPCState *env) 0x00000000); } =20 -// XXX: TODO /* * AMR =3D> SPR 29 (Power 2.04) * CTRL =3D> SPR 136 (Power 2.04) @@ -3344,16 +3370,18 @@ static int check_pow_nocheck(CPUPPCState *env) =20 static int check_pow_hid0(CPUPPCState *env) { - if (env->spr[SPR_HID0] & 0x00E00000) + if (env->spr[SPR_HID0] & 0x00E00000) { return 1; + } =20 return 0; } =20 static int check_pow_hid0_74xx(CPUPPCState *env) { - if (env->spr[SPR_HID0] & 0x00600000) + if (env->spr[SPR_HID0] & 0x00600000) { return 1; + } =20 return 0; } @@ -4602,7 +4630,8 @@ POWERPC_FAMILY(e200)(ObjectClass *oc, void *data) dc->desc =3D "e200 core"; pcc->init_proc =3D init_proc_e200; pcc->check_pow =3D check_pow_hid0; - /* XXX: unimplemented instructions: + /* + * XXX: unimplemented instructions: * dcblc * dcbtlst * dcbtstls @@ -4797,18 +4826,18 @@ static void init_proc_e500(CPUPPCState *env, int ve= rsion) * gen_spr_BookE(env, 0x0000000F0000FD7FULL); */ switch (version) { - case fsl_e500v1: - case fsl_e500v2: - default: - ivor_mask =3D 0x0000000F0000FFFFULL; - break; - case fsl_e500mc: - case fsl_e5500: - ivor_mask =3D 0x000003FE0000FFFFULL; - break; - case fsl_e6500: - ivor_mask =3D 0x000003FF0000FFFFULL; - break; + case fsl_e500v1: + case fsl_e500v2: + default: + ivor_mask =3D 0x0000000F0000FFFFULL; + break; + case fsl_e500mc: + case fsl_e5500: + ivor_mask =3D 0x000003FE0000FFFFULL; + break; + case fsl_e6500: + ivor_mask =3D 0x000003FF0000FFFFULL; + break; } gen_spr_BookE(env, ivor_mask); gen_spr_usprg3(env); @@ -4848,7 +4877,8 @@ static void init_proc_e500(CPUPPCState *env, int vers= ion) tlbncfg[1] =3D 0x40028040; break; default: - cpu_abort(CPU(cpu), "Unknown CPU: " TARGET_FMT_lx "\n", env->spr[S= PR_PVR]); + cpu_abort(CPU(cpu), "Unknown CPU: " TARGET_FMT_lx "\n", + env->spr[SPR_PVR]); } #endif /* Cache sizes */ @@ -4872,7 +4902,8 @@ static void init_proc_e500(CPUPPCState *env, int vers= ion) l1cfg1 |=3D 0x0B83820; break; default: - cpu_abort(CPU(cpu), "Unknown CPU: " TARGET_FMT_lx "\n", env->spr[S= PR_PVR]); + cpu_abort(CPU(cpu), "Unknown CPU: " TARGET_FMT_lx "\n", + env->spr[SPR_PVR]); } gen_spr_BookE206(env, 0x000000DF, tlbncfg, mmucfg); /* XXX : not implemented */ @@ -5252,7 +5283,8 @@ static void init_proc_601(CPUPPCState *env) 0x00000000); /* Memory management */ init_excp_601(env); - /* XXX: beware that dcache line size is 64=20 + /* + * XXX: beware that dcache line size is 64 * but dcbz uses 32 bytes "sectors" * XXX: this breaks clcs instruction ! */ @@ -5789,7 +5821,8 @@ static void init_proc_750(CPUPPCState *env) 0x00000000); /* Memory management */ gen_low_BATs(env); - /* XXX: high BATs are also present but are known to be bugged on + /* + * XXX: high BATs are also present but are known to be bugged on * die version 1.x */ init_excp_7x0(env); @@ -5971,7 +6004,8 @@ POWERPC_FAMILY(750cl)(ObjectClass *oc, void *data) dc->desc =3D "PowerPC 750 CL"; pcc->init_proc =3D init_proc_750cl; pcc->check_pow =3D check_pow_hid0; - /* XXX: not implemented: + /* + * XXX: not implemented: * cache lock instructions: * dcbz_l * floating point paired instructions @@ -7569,8 +7603,10 @@ static void gen_spr_book3s_altivec(CPUPPCState *env) &spr_read_generic, &spr_write_generic, KVM_REG_PPC_VRSAVE, 0x00000000); =20 - /* Can't find information on what this should be on reset. This - * value is the one used by 74xx processors. */ + /* + * Can't find information on what this should be on reset. This + * value is the one used by 74xx processors. + */ vscr_init(env, 0x00010000); } =20 @@ -8975,8 +9011,9 @@ static void init_ppc_proc(PowerPCCPU *cpu) =20 env->irq_inputs =3D NULL; /* Set all exception vectors to an invalid address */ - for (i =3D 0; i < POWERPC_EXCP_NB; i++) + for (i =3D 0; i < POWERPC_EXCP_NB; i++) { env->excp_vectors[i] =3D (target_ulong)(-1ULL); + } env->ivor_mask =3D 0x00000000; env->ivpr_mask =3D 0x00000000; /* Default MMU definitions */ @@ -9108,8 +9145,9 @@ static void init_ppc_proc(PowerPCCPU *cpu) #if !defined(CONFIG_USER_ONLY) if (env->nb_tlb !=3D 0) { int nb_tlb =3D env->nb_tlb; - if (env->id_tlbs !=3D 0) + if (env->id_tlbs !=3D 0) { nb_tlb *=3D 2; + } switch (env->tlb_type) { case TLB_6XX: env->tlb.tlb6 =3D g_new0(ppc6xx_tlb_t, nb_tlb); @@ -9201,8 +9239,9 @@ static void fill_new_table(opc_handler_t **table, int= len) { int i; =20 - for (i =3D 0; i < len; i++) + for (i =3D 0; i < len; i++) { table[i] =3D &invalid_handler; + } } =20 static int create_new_table(opc_handler_t **table, unsigned char idx) @@ -9219,8 +9258,9 @@ static int create_new_table(opc_handler_t **table, un= signed char idx) static int insert_in_table(opc_handler_t **table, unsigned char idx, opc_handler_t *handler) { - if (table[idx] !=3D &invalid_handler) + if (table[idx] !=3D &invalid_handler) { return -1; + } table[idx] =3D handler; =20 return 0; @@ -9341,17 +9381,20 @@ static int register_insn(opc_handler_t **ppc_opcode= s, opcode_t *insn) } } else { if (register_dblind_insn(ppc_opcodes, insn->opc1, insn->op= c2, - insn->opc3, &insn->handler) < 0) + insn->opc3, &insn->handler) < 0) { return -1; + } } } else { if (register_ind_insn(ppc_opcodes, insn->opc1, - insn->opc2, &insn->handler) < 0) + insn->opc2, &insn->handler) < 0) { return -1; + } } } else { - if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) = < 0) + if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) = < 0) { return -1; + } } =20 return 0; @@ -9363,8 +9406,9 @@ static int test_opcode_table(opc_handler_t **table, i= nt len) =20 for (i =3D 0, count =3D 0; i < len; i++) { /* Consistency fixup */ - if (table[i] =3D=3D NULL) + if (table[i] =3D=3D NULL) { table[i] =3D &invalid_handler; + } if (table[i] !=3D &invalid_handler) { if (is_indirect_opcode(table[i])) { tmp =3D test_opcode_table(ind_table(table[i]), @@ -9386,8 +9430,9 @@ static int test_opcode_table(opc_handler_t **table, i= nt len) =20 static void fix_opcode_tables(opc_handler_t **ppc_opcodes) { - if (test_opcode_table(ppc_opcodes, PPC_CPU_OPCODES_LEN) =3D=3D 0) + if (test_opcode_table(ppc_opcodes, PPC_CPU_OPCODES_LEN) =3D=3D 0) { printf("*** WARNING: no opcode defined !\n"); + } } =20 /*************************************************************************= ****/ @@ -9726,14 +9771,15 @@ static int ppc_fixup_cpu(PowerPCCPU *cpu) { CPUPPCState *env =3D &cpu->env; =20 - /* TCG doesn't (yet) emulate some groups of instructions that - * are implemented on some otherwise supported CPUs (e.g. VSX - * and decimal floating point instructions on POWER7). We - * remove unsupported instruction groups from the cpu state's - * instruction masks and hope the guest can cope. For at - * least the pseries machine, the unavailability of these - * instructions can be advertised to the guest via the device - * tree. */ + /* + * TCG doesn't (yet) emulate some groups of instructions that are + * implemented on some otherwise supported CPUs (e.g. VSX and + * decimal floating point instructions on POWER7). We remove + * unsupported instruction groups from the cpu state's instruction + * masks and hope the guest can cope. For at least the pseries + * machine, the unavailability of these instructions can be + * advertised to the guest via the device tree. + */ if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { warn_report("Disabling some instructions which are not " @@ -9928,31 +9974,37 @@ static void ppc_cpu_realize(DeviceState *dev, Error= **errp) " Bus model : %s\n", excp_model, bus_model); printf(" MSR features :\n"); - if (env->flags & POWERPC_FLAG_SPE) + if (env->flags & POWERPC_FLAG_SPE) { printf(" signal processing engine enabl= e" "\n"); - else if (env->flags & POWERPC_FLAG_VRE) + } else if (env->flags & POWERPC_FLAG_VRE) { printf(" vector processor enable\n"); - if (env->flags & POWERPC_FLAG_TGPR) + } + if (env->flags & POWERPC_FLAG_TGPR) { printf(" temporary GPRs\n"); - else if (env->flags & POWERPC_FLAG_CE) + } else if (env->flags & POWERPC_FLAG_CE) { printf(" critical input enable\n"); - if (env->flags & POWERPC_FLAG_SE) + } + if (env->flags & POWERPC_FLAG_SE) { printf(" single-step trace mode\n"); - else if (env->flags & POWERPC_FLAG_DWE) + } else if (env->flags & POWERPC_FLAG_DWE) { printf(" debug wait enable\n"); - else if (env->flags & POWERPC_FLAG_UBLE) + } else if (env->flags & POWERPC_FLAG_UBLE) { printf(" user BTB lock enable\n"); - if (env->flags & POWERPC_FLAG_BE) + } + if (env->flags & POWERPC_FLAG_BE) { printf(" branch-step trace mode\n"); - else if (env->flags & POWERPC_FLAG_DE) + } else if (env->flags & POWERPC_FLAG_DE) { printf(" debug interrupt enable\n"); - if (env->flags & POWERPC_FLAG_PX) + } + if (env->flags & POWERPC_FLAG_PX) { printf(" inclusive protection\n"); - else if (env->flags & POWERPC_FLAG_PMM) + } else if (env->flags & POWERPC_FLAG_PMM) { printf(" performance monitor mark\n"); - if (env->flags =3D=3D POWERPC_FLAG_NONE) + } + if (env->flags =3D=3D POWERPC_FLAG_NONE) { printf(" none\n"); + } printf(" Time-base/decrementer clock source: %s\n", env->flags & POWERPC_FLAG_RTC_CLK ? "RTC clock" : "bus cloc= k"); dump_ppc_insns(env); @@ -10094,8 +10146,9 @@ static ObjectClass *ppc_cpu_class_by_name(const cha= r *name) const char *p; unsigned long pvr; =20 - /* Lookup by PVR if cpu_model is valid 8 digit hex number - * (excl: 0x prefix if present) + /* + * Lookup by PVR if cpu_model is valid 8 digit hex number (excl: + * 0x prefix if present) */ if (!qemu_strtoul(name, &p, 16, &pvr)) { int len =3D p - name; @@ -10439,14 +10492,14 @@ static void ppc_cpu_instance_init(Object *obj) env->bfd_mach =3D pcc->bfd_mach; env->check_pow =3D pcc->check_pow; =20 - /* Mark HV mode as supported if the CPU has an MSR_HV bit - * in the msr_mask. The mask can later be cleared by PAPR - * mode but the hv mode support will remain, thus enforcing - * that we cannot use priv. instructions in guest in PAPR - * mode. For 970 we currently simply don't set HV in msr_mask - * thus simulating an "Apple mode" 970. If we ever want to - * support 970 HV mode, we'll have to add a processor attribute - * of some sort. + /* + * Mark HV mode as supported if the CPU has an MSR_HV bit in the + * msr_mask. The mask can later be cleared by PAPR mode but the hv + * mode support will remain, thus enforcing that we cannot use + * priv. instructions in guest in PAPR mode. For 970 we currently + * simply don't set HV in msr_mask thus simulating an "Apple mode" + * 970. If we ever want to support 970 HV mode, we'll have to add + * a processor attribute of some sort. */ #if !defined(CONFIG_USER_ONLY) env->has_hv_mode =3D !!(env->msr_mask & MSR_HVB); @@ -10573,7 +10626,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, voi= d *data) cc->tcg_initialize =3D ppc_translate_init; #endif cc->disas_set_info =3D ppc_disas_set_info; -=20 + dc->fw_name =3D "PowerPC,UNKNOWN"; } =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260197; cv=none; d=zoho.com; s=zohoarc; b=UtwzBf0sv2f0qIlOToS2wf54aOZneck+dqgfn/SlUl/tcgFFbAZbIiTPzRzaWI8f/Y/ewyzmNJxb9bD7shhjJQaBqoy2MoZsmXkG8KrfOsU6XsmJzC266bJldmI3YFZMVtPET7ptcLVkXZo7pN0SJfiUNjPzDz43OwM+t/YuO/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260197; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VyP9pnGQHtMY3biC5ono4TmahQ/0fcFspwNhzlwCZ+0=; b=OFoRspqErn7R/3+y2MzJ1RyJ+mcw4UKTwR6Y/njZF8iqEo4Krli+wwJvk+JESjKGDsNYg62q9K5z2+xs3CE8aejF6+fZ+zv5yEcJ6JGRghaRSsnGZZaG0auZQKN+1rjFfmw0QG/L69SIVmFb4IXz5gg8WGUc/YWVnrUcrRlqK4U= ARC-Authentication-Results: i=1; mx.zoho.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 1556260196995202.8097450313286; Thu, 25 Apr 2019 23:29:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:40249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuMr-00043R-NE for importer@patchew.org; Fri, 26 Apr 2019 02:29:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0i-0005dF-JV for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0b-0004ZP-QF for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from ozlabs.org ([203.11.71.1]:41021) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0a-0004UQ-Q3; Fri, 26 Apr 2019 02:06:53 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tp11ZWz9sNg; Fri, 26 Apr 2019 16:06:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258798; bh=cR4MZi7j5z0vqh5nz9P73pZwCkCQ1Xn3uVTVnswyk0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igKWGBMqsVkNdQI0V4t1WDdo42EeWpS2qq+isXtvVDDuTBpc0vNgKyOfUmLrJD4Ov J/MOEINwybJvN4q8HWHr3RHRke2kiDCni1rBYV7GFDkzsG0MOVL1CNG71J0/gQCdz5 jc7f+8NTceZvflSHp+A0xNJ7IKOhwkBFhGS7zpoc= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:14 +1000 Message-Id: <20190426060627.18153-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for translate.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate.c | 504 +++++++++++++++++++++++++---------------- 1 file changed, 313 insertions(+), 191 deletions(-) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 93d77a2626..c280e0d306 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -42,8 +42,8 @@ #define GDBSTUB_SINGLE_STEP 0x4 =20 /* Include definitions for instructions classes and implementations flags = */ -//#define PPC_DEBUG_DISAS -//#define DO_PPC_STATISTICS +/* #define PPC_DEBUG_DISAS */ +/* #define DO_PPC_STATISTICS */ =20 #ifdef PPC_DEBUG_DISAS # define LOG_DISAS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__) @@ -54,9 +54,9 @@ /* Code translation helpers = */ =20 /* global register indexes */ -static char cpu_reg_names[10*3 + 22*4 /* GPR */ - + 10*4 + 22*5 /* SPE GPRh */ - + 8*5 /* CRF */]; +static char cpu_reg_names[10 * 3 + 22 * 4 /* GPR */ + + 10 * 4 + 22 * 5 /* SPE GPRh */ + + 8 * 5 /* CRF */]; static TCGv cpu_gpr[32]; static TCGv cpu_gprh[32]; static TCGv_i32 cpu_crf[8]; @@ -78,7 +78,7 @@ static TCGv_i32 cpu_access_type; void ppc_translate_init(void) { int i; - char* p; + char *p; size_t cpu_reg_names_size; =20 p =3D cpu_reg_names; @@ -146,7 +146,8 @@ void ppc_translate_init(void) offsetof(CPUPPCState, fpscr), "fpscr"); =20 cpu_access_type =3D tcg_global_mem_new_i32(cpu_env, - offsetof(CPUPPCState, access_= type), "access_type"); + offsetof(CPUPPCState, access_= type), + "access_type"); } =20 /* internal defines */ @@ -246,8 +247,9 @@ static void gen_exception_err(DisasContext *ctx, uint32= _t excp, uint32_t error) { TCGv_i32 t0, t1; =20 - /* These are all synchronous exceptions, we set the PC back to - * the faulting instruction + /* + * These are all synchronous exceptions, we set the PC back to the + * faulting instruction */ if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { gen_update_nip(ctx, ctx->base.pc_next - 4); @@ -264,8 +266,9 @@ static void gen_exception(DisasContext *ctx, uint32_t e= xcp) { TCGv_i32 t0; =20 - /* These are all synchronous exceptions, we set the PC back to - * the faulting instruction + /* + * These are all synchronous exceptions, we set the PC back to the + * faulting instruction */ if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { gen_update_nip(ctx, ctx->base.pc_next - 4); @@ -320,8 +323,9 @@ static void gen_debug_exception(DisasContext *ctx) { TCGv_i32 t0; =20 - /* These are all synchronous exceptions, we set the PC back to - * the faulting instruction + /* + * These are all synchronous exceptions, we set the PC back to the + * faulting instruction */ if ((ctx->exception !=3D POWERPC_EXCP_BRANCH) && (ctx->exception !=3D POWERPC_EXCP_SYNC)) { @@ -602,9 +606,11 @@ static inline void gen_op_cmp(TCGv arg0, TCGv arg1, in= t s, int crf) =20 tcg_gen_movi_tl(t0, CRF_EQ); tcg_gen_movi_tl(t1, CRF_LT); - tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU), t0, arg0, arg1, t= 1, t0); + tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU), + t0, arg0, arg1, t1, t0); tcg_gen_movi_tl(t1, CRF_GT); - tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU), t0, arg0, arg1, t= 1, t0); + tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU), + t0, arg0, arg1, t1, t0); =20 tcg_gen_trunc_tl_i32(t, t0); tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so); @@ -840,9 +846,11 @@ static inline void gen_op_arith_add(DisasContext *ctx,= TCGv ret, TCGv arg1, =20 if (compute_ca) { if (NARROW_MODE(ctx)) { - /* Caution: a non-obvious corner case of the spec is that we - must produce the *entire* 64-bit addition, but produce the - carry into bit 32. */ + /* + * Caution: a non-obvious corner case of the spec is that + * we must produce the *entire* 64-bit addition, but + * produce the carry into bit 32. + */ TCGv t1 =3D tcg_temp_new(); tcg_gen_xor_tl(t1, arg1, arg2); /* add without carry */ tcg_gen_add_tl(t0, arg1, arg2); @@ -1017,12 +1025,13 @@ static inline void gen_op_arith_divw(DisasContext *= ctx, TCGv ret, TCGv arg1, tcg_temp_free_i32(t2); tcg_temp_free_i32(t3); =20 - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, ret); + } } /* Div functions */ #define GEN_INT_ARITH_DIVW(name, opc3, sign, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ gen_op_arith_divw(ctx, cpu_gpr[rD(ctx->opcode)], = \ cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], = \ @@ -1091,12 +1100,13 @@ static inline void gen_op_arith_divd(DisasContext *= ctx, TCGv ret, TCGv arg1, tcg_temp_free_i64(t2); tcg_temp_free_i64(t3); =20 - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, ret); + } } =20 #define GEN_INT_ARITH_DIVD(name, opc3, sign, compute_ov) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ gen_op_arith_divd(ctx, cpu_gpr[rD(ctx->opcode)], = \ cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], = \ @@ -1219,8 +1229,9 @@ static void gen_mulhw(DisasContext *ctx) tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], t1); tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mulhwu mulhwu. */ @@ -1235,8 +1246,9 @@ static void gen_mulhwu(DisasContext *ctx) tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], t1); tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mullw mullw. */ @@ -1255,8 +1267,9 @@ static void gen_mullw(DisasContext *ctx) tcg_gen_mul_i32(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); #endif - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mullwo mullwo. */ @@ -1284,8 +1297,9 @@ static void gen_mullwo(DisasContext *ctx) =20 tcg_temp_free_i32(t0); tcg_temp_free_i32(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mulli */ @@ -1325,8 +1339,9 @@ static void gen_mulld(DisasContext *ctx) { tcg_gen_mul_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mulldo mulldo. */ @@ -1369,9 +1384,11 @@ static inline void gen_op_arith_subf(DisasContext *c= tx, TCGv ret, TCGv arg1, if (compute_ca) { /* dest =3D ~arg1 + arg2 [+ ca]. */ if (NARROW_MODE(ctx)) { - /* Caution: a non-obvious corner case of the spec is that we - must produce the *entire* 64-bit addition, but produce the - carry into bit 32. */ + /* + * Caution: a non-obvious corner case of the spec is that + * we must produce the *entire* 64-bit addition, but + * produce the carry into bit 32. + */ TCGv inv1 =3D tcg_temp_new(); TCGv t1 =3D tcg_temp_new(); tcg_gen_not_tl(inv1, arg1); @@ -1404,8 +1421,10 @@ static inline void gen_op_arith_subf(DisasContext *c= tx, TCGv ret, TCGv arg1, gen_op_arith_compute_ca32(ctx, t0, arg1, arg2, cpu_ca32, 1); } } else if (add_ca) { - /* Since we're ignoring carry-out, we can simplify the - standard ~arg1 + arg2 + ca to arg2 - arg1 + ca - 1. */ + /* + * Since we're ignoring carry-out, we can simplify the + * standard ~arg1 + arg2 + ca to arg2 - arg1 + ca - 1. + */ tcg_gen_sub_tl(t0, arg2, arg1); tcg_gen_add_tl(t0, t0, cpu_ca); tcg_gen_subi_tl(t0, t0, 1); @@ -1493,7 +1512,7 @@ static void gen_nego(DisasContext *ctx) =20 /*** Integer logical = ***/ #define GEN_LOGICAL2(name, tcg_op, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ tcg_op(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], = \ cpu_gpr[rB(ctx->opcode)]); = \ @@ -1502,7 +1521,7 @@ static void glue(gen_, name)(DisasContext *ctx) } =20 #define GEN_LOGICAL1(name, tcg_op, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ tcg_op(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); = \ if (unlikely(Rc(ctx->opcode) !=3D 0)) = \ @@ -1517,14 +1536,16 @@ GEN_LOGICAL2(andc, tcg_gen_andc_tl, 0x01, PPC_INTEG= ER); /* andi. */ static void gen_andi_(DisasContext *ctx) { - tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], UI= MM(ctx->opcode)); + tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + UIMM(ctx->opcode)); gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } =20 /* andis. */ static void gen_andis_(DisasContext *ctx) { - tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], UI= MM(ctx->opcode) << 16); + tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + UIMM(ctx->opcode) << 16); gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); } =20 @@ -1538,8 +1559,9 @@ static void gen_cntlzw(DisasContext *ctx) tcg_gen_extu_i32_tl(cpu_gpr[rA(ctx->opcode)], t); tcg_temp_free_i32(t); =20 - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* cnttzw */ @@ -1591,12 +1613,14 @@ static void gen_or(DisasContext *ctx) rb =3D rB(ctx->opcode); /* Optimisation for mr. ri case */ if (rs !=3D ra || rs !=3D rb) { - if (rs !=3D rb) + if (rs !=3D rb) { tcg_gen_or_tl(cpu_gpr[ra], cpu_gpr[rs], cpu_gpr[rb]); - else + } else { tcg_gen_mov_tl(cpu_gpr[ra], cpu_gpr[rs]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + } + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[ra]); + } } else if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rs]); #if defined(TARGET_PPC64) @@ -1654,10 +1678,11 @@ static void gen_or(DisasContext *ctx) tcg_temp_free(t0); } #if !defined(CONFIG_USER_ONLY) - /* Pause out of TCG otherwise spin loops with smt_low eat too much - * CPU and the kernel hangs. This applies to all encodings other - * than no-op, e.g., miso(rs=3D26), yield(27), mdoio(29), mdoom(30= ), - * and all currently undefined. + /* + * Pause out of TCG otherwise spin loops with smt_low eat too + * much CPU and the kernel hangs. This applies to all + * encodings other than no-op, e.g., miso(rs=3D26), yield(27), + * mdoio(29), mdoom(30), and all currently undefined. */ gen_pause(ctx); #endif @@ -1671,12 +1696,15 @@ GEN_LOGICAL2(orc, tcg_gen_orc_tl, 0x0C, PPC_INTEGER= ); static void gen_xor(DisasContext *ctx) { /* Optimisation for "set to zero" case */ - if (rS(ctx->opcode) !=3D rB(ctx->opcode)) - tcg_gen_xor_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)],= cpu_gpr[rB(ctx->opcode)]); - else + if (rS(ctx->opcode) !=3D rB(ctx->opcode)) { + tcg_gen_xor_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + cpu_gpr[rB(ctx->opcode)]); + } else { tcg_gen_movi_tl(cpu_gpr[rA(ctx->opcode)], 0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + } + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* ori */ @@ -1699,7 +1727,8 @@ static void gen_oris(DisasContext *ctx) /* NOP */ return; } - tcg_gen_ori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], uim= m << 16); + tcg_gen_ori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + uimm << 16); } =20 /* xori */ @@ -1723,7 +1752,8 @@ static void gen_xoris(DisasContext *ctx) /* NOP */ return; } - tcg_gen_xori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], ui= mm << 16); + tcg_gen_xori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], + uimm << 16); } =20 /* popcntb : PowerPC 2.03 specification */ @@ -1798,8 +1828,9 @@ GEN_LOGICAL1(extsw, tcg_gen_ext32s_tl, 0x1E, PPC_64B); static void gen_cntlzd(DisasContext *ctx) { tcg_gen_clzi_i64(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], 6= 4); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* cnttzd */ @@ -1838,7 +1869,7 @@ static void gen_rlwimi(DisasContext *ctx) uint32_t mb =3D MB(ctx->opcode); uint32_t me =3D ME(ctx->opcode); =20 - if (sh =3D=3D (31-me) && mb <=3D me) { + if (sh =3D=3D (31 - me) && mb <=3D me) { tcg_gen_deposit_tl(t_ra, t_ra, t_rs, sh, me - mb + 1); } else { target_ulong mask; @@ -2141,8 +2172,9 @@ static void gen_slw(DisasContext *ctx) tcg_temp_free(t1); tcg_temp_free(t0); tcg_gen_ext32u_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sraw & sraw. */ @@ -2150,8 +2182,9 @@ static void gen_sraw(DisasContext *ctx) { gen_helper_sraw(cpu_gpr[rA(ctx->opcode)], cpu_env, cpu_gpr[rS(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srawi & srawi. */ @@ -2206,8 +2239,9 @@ static void gen_srw(DisasContext *ctx) tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t1); tcg_temp_free(t0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 #if defined(TARGET_PPC64) @@ -2226,8 +2260,9 @@ static void gen_sld(DisasContext *ctx) tcg_gen_shl_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t1); tcg_temp_free(t0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srad & srad. */ @@ -2235,8 +2270,9 @@ static void gen_srad(DisasContext *ctx) { gen_helper_srad(cpu_gpr[rA(ctx->opcode)], cpu_env, cpu_gpr[rS(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } /* sradi & sradi. */ static inline void gen_sradi(DisasContext *ctx, int n) @@ -2317,8 +2353,9 @@ static void gen_srd(DisasContext *ctx) tcg_gen_shr_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t1); tcg_temp_free(t0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } #endif =20 @@ -2463,7 +2500,7 @@ GEN_QEMU_STORE_64(st64r, BSWAP_MEMOP(MO_Q)) #endif =20 #define GEN_LD(name, ldop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv EA; = \ gen_set_access_type(ctx, ACCESS_INT); = \ @@ -2474,7 +2511,7 @@ static void glue(gen_, name)(DisasContext *ctx) } =20 #define GEN_LDU(name, ldop, opc, type) = \ -static void glue(gen_, name##u)(DisasContext *ctx) = \ +static void glue(gen_, name##u)(DisasContext *ctx) = \ { = \ TCGv EA; = \ if (unlikely(rA(ctx->opcode) =3D=3D 0 || = \ @@ -2494,7 +2531,7 @@ static void glue(gen_, name##u)(DisasContext *ctx) } =20 #define GEN_LDUX(name, ldop, opc2, opc3, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ +static void glue(gen_, name##ux)(DisasContext *ctx) = \ { = \ TCGv EA; = \ if (unlikely(rA(ctx->opcode) =3D=3D 0 || = \ @@ -2598,8 +2635,9 @@ static void gen_ld(DisasContext *ctx) /* ld - ldu */ gen_qemu_ld64_i64(ctx, cpu_gpr[rD(ctx->opcode)], EA); } - if (Rc(ctx->opcode)) + if (Rc(ctx->opcode)) { tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); + } tcg_temp_free(EA); } =20 @@ -2669,7 +2707,7 @@ static void gen_lq(DisasContext *ctx) =20 /*** Integer store = ***/ #define GEN_ST(name, stop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv EA; = \ gen_set_access_type(ctx, ACCESS_INT); = \ @@ -2680,7 +2718,7 @@ static void glue(gen_, name)(DisasContext *ctx) } =20 #define GEN_STU(name, stop, opc, type) = \ -static void glue(gen_, stop##u)(DisasContext *ctx) = \ +static void glue(gen_, stop##u)(DisasContext *ctx) = \ { = \ TCGv EA; = \ if (unlikely(rA(ctx->opcode) =3D=3D 0)) { = \ @@ -2699,7 +2737,7 @@ static void glue(gen_, stop##u)(DisasContext *ctx) } =20 #define GEN_STUX(name, stop, opc2, opc3, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ +static void glue(gen_, name##ux)(DisasContext *ctx) = \ { = \ TCGv EA; = \ if (unlikely(rA(ctx->opcode) =3D=3D 0)) { = \ @@ -2847,8 +2885,9 @@ static void gen_std(DisasContext *ctx) EA =3D tcg_temp_new(); gen_addr_imm_index(ctx, EA, 0x03); gen_qemu_st64_i64(ctx, cpu_gpr[rs], EA); - if (Rc(ctx->opcode)) + if (Rc(ctx->opcode)) { tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); + } tcg_temp_free(EA); } } @@ -2916,10 +2955,11 @@ static void gen_stmw(DisasContext *ctx) /*** Integer load and store strings = ***/ =20 /* lswi */ -/* PowerPC32 specification says we must generate an exception if - * rA is in the range of registers to be loaded. - * In an other hand, IBM says this is valid, but rA won't be loaded. - * For now, I'll follow the spec... +/* + * PowerPC32 specification says we must generate an exception if rA is + * in the range of registers to be loaded. In an other hand, IBM says + * this is valid, but rA won't be loaded. For now, I'll follow the + * spec... */ static void gen_lswi(DisasContext *ctx) { @@ -2934,8 +2974,9 @@ static void gen_lswi(DisasContext *ctx) gen_align_no_le(ctx); return; } - if (nb =3D=3D 0) + if (nb =3D=3D 0) { nb =3D 32; + } nr =3D DIV_ROUND_UP(nb, 4); if (unlikely(lsw_reg_in_range(start, nr, ra))) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_LSWX); @@ -2989,8 +3030,9 @@ static void gen_stswi(DisasContext *ctx) gen_set_access_type(ctx, ACCESS_INT); t0 =3D tcg_temp_new(); gen_addr_register(ctx, t0); - if (nb =3D=3D 0) + if (nb =3D=3D 0) { nb =3D 32; + } t1 =3D tcg_const_i32(nb); t2 =3D tcg_const_i32(rS(ctx->opcode)); gen_helper_stsw(cpu_env, t0, t1, t2); @@ -3363,8 +3405,10 @@ static void gen_conditional_store(DisasContext *ctx,= TCGMemOp memop) =20 gen_set_label(l1); =20 - /* Address mismatch implies failure. But we still need to provide the - memory barrier semantics of the instruction. */ + /* + * Address mismatch implies failure. But we still need to provide + * the memory barrier semantics of the instruction. + */ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); =20 @@ -3639,8 +3683,9 @@ static void gen_rvwinkle(DisasContext *ctx) static inline void gen_update_cfar(DisasContext *ctx, target_ulong nip) { #if defined(TARGET_PPC64) - if (ctx->has_cfar) + if (ctx->has_cfar) { tcg_gen_movi_tl(cpu_cfar, nip); + } #endif } =20 @@ -3732,17 +3777,19 @@ static void gen_bcond(DisasContext *ctx, int type) =20 if (type =3D=3D BCOND_LR || type =3D=3D BCOND_CTR || type =3D=3D BCOND= _TAR) { target =3D tcg_temp_local_new(); - if (type =3D=3D BCOND_CTR) + if (type =3D=3D BCOND_CTR) { tcg_gen_mov_tl(target, cpu_ctr); - else if (type =3D=3D BCOND_TAR) + } else if (type =3D=3D BCOND_TAR) { gen_load_spr(target, SPR_TAR); - else + } else { tcg_gen_mov_tl(target, cpu_lr); + } } else { target =3D NULL; } - if (LK(ctx->opcode)) + if (LK(ctx->opcode)) { gen_setlr(ctx, ctx->base.pc_next); + } l1 =3D gen_new_label(); if ((bo & 0x4) =3D=3D 0) { /* Decrement and test CTR */ @@ -3857,7 +3904,7 @@ static void gen_bctar(DisasContext *ctx) =20 /*** Condition register logical = ***/ #define GEN_CRLOGIC(name, tcg_op, opc) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ uint8_t bitmask; = \ int sh; = \ @@ -3918,7 +3965,8 @@ static void gen_rfi(DisasContext *ctx) #if defined(CONFIG_USER_ONLY) GEN_PRIV; #else - /* This instruction doesn't exist anymore on 64-bit server + /* + * This instruction doesn't exist anymore on 64-bit server * processors compliant with arch 2.x */ if (is_book3s_arch2x(ctx)) { @@ -4157,7 +4205,7 @@ static void gen_mfcr(DisasContext *ctx) if (likely(ctx->opcode & 0x00100000)) { crm =3D CRM(ctx->opcode); if (likely(crm && ((crm & (crm - 1)) =3D=3D 0))) { - crn =3D ctz32 (crm); + crn =3D ctz32(crm); tcg_gen_extu_i32_tl(cpu_gpr[rD(ctx->opcode)], cpu_crf[7 - crn]= ); tcg_gen_shli_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rD(ctx->opcode)], crn * 4); @@ -4222,7 +4270,8 @@ static inline void gen_op_mfspr(DisasContext *ctx) (*read_cb)(ctx, rD(ctx->opcode), sprn); } else { /* Privilege exception */ - /* This is a hack to avoid warnings when running Linux: + /* + * This is a hack to avoid warnings when running Linux: * this OS breaks the PowerPC virtualisation model, * allowing userland application to read the PVR */ @@ -4245,8 +4294,9 @@ static inline void gen_op_mfspr(DisasContext *ctx) "Trying to read invalid spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - = 4); =20 - /* The behaviour depends on MSR:PR and SPR# bit 0x10, - * it can generate a priv, a hv emu or a no-op + /* + * The behaviour depends on MSR:PR and SPR# bit 0x10, it can + * generate a priv, a hv emu or a no-op */ if (sprn & 0x10) { if (ctx->pr) { @@ -4280,7 +4330,7 @@ static void gen_mtcrf(DisasContext *ctx) if (likely((ctx->opcode & 0x00100000))) { if (crm && ((crm & (crm - 1)) =3D=3D 0)) { TCGv_i32 temp =3D tcg_temp_new_i32(); - crn =3D ctz32 (crm); + crn =3D ctz32(crm); tcg_gen_trunc_tl_i32(temp, cpu_gpr[rS(ctx->opcode)]); tcg_gen_shri_i32(temp, temp, crn * 4); tcg_gen_andi_i32(cpu_crf[7 - crn], temp, 0xf); @@ -4309,14 +4359,17 @@ static void gen_mtmsrd(DisasContext *ctx) if (ctx->opcode & 0x00010000) { /* Special form that does not need any synchronisation */ TCGv t0 =3D tcg_temp_new(); - tcg_gen_andi_tl(t0, cpu_gpr[rS(ctx->opcode)], (1 << MSR_RI) | (1 <= < MSR_EE)); - tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(target_ulong)((1 << MSR_RI) | = (1 << MSR_EE))); + tcg_gen_andi_tl(t0, cpu_gpr[rS(ctx->opcode)], + (1 << MSR_RI) | (1 << MSR_EE)); + tcg_gen_andi_tl(cpu_msr, cpu_msr, + ~(target_ulong)((1 << MSR_RI) | (1 << MSR_EE))); tcg_gen_or_tl(cpu_msr, cpu_msr, t0); tcg_temp_free(t0); } else { - /* XXX: we need to update nip before the store - * if we enter power saving mode, we will exit the loop - * directly from ppc_store_msr + /* + * XXX: we need to update nip before the store if we enter + * power saving mode, we will exit the loop directly from + * ppc_store_msr */ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); @@ -4342,16 +4395,19 @@ static void gen_mtmsr(DisasContext *ctx) if (ctx->opcode & 0x00010000) { /* Special form that does not need any synchronisation */ TCGv t0 =3D tcg_temp_new(); - tcg_gen_andi_tl(t0, cpu_gpr[rS(ctx->opcode)], (1 << MSR_RI) | (1 <= < MSR_EE)); - tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(target_ulong)((1 << MSR_RI) | = (1 << MSR_EE))); + tcg_gen_andi_tl(t0, cpu_gpr[rS(ctx->opcode)], + (1 << MSR_RI) | (1 << MSR_EE)); + tcg_gen_andi_tl(cpu_msr, cpu_msr, + ~(target_ulong)((1 << MSR_RI) | (1 << MSR_EE))); tcg_gen_or_tl(cpu_msr, cpu_msr, t0); tcg_temp_free(t0); } else { TCGv msr =3D tcg_temp_new(); =20 - /* XXX: we need to update nip before the store - * if we enter power saving mode, we will exit the loop - * directly from ppc_store_msr + /* + * XXX: we need to update nip before the store if we enter + * power saving mode, we will exit the loop directly from + * ppc_store_msr */ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); @@ -4415,8 +4471,9 @@ static void gen_mtspr(DisasContext *ctx) TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - = 4); =20 =20 - /* The behaviour depends on MSR:PR and SPR# bit 0x10, - * it can generate a priv, a hv emu or a no-op + /* + * The behaviour depends on MSR:PR and SPR# bit 0x10, it can + * generate a priv, a hv emu or a no-op */ if (sprn & 0x10) { if (ctx->pr) { @@ -4526,36 +4583,40 @@ static void gen_dcbstep(DisasContext *ctx) /* dcbt */ static void gen_dcbt(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 /* dcbtep */ static void gen_dcbtep(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 /* dcbtst */ static void gen_dcbtst(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 /* dcbtstep */ static void gen_dcbtstep(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 @@ -4653,8 +4714,9 @@ static void gen_icbiep(DisasContext *ctx) /* dcba */ static void gen_dcba(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a store by the MMU + /* + * interpreted as no-op + * XXX: specification say this is treated as a store by the MMU * but does not generate any exception */ } @@ -5021,8 +5083,9 @@ static void gen_abs(DisasContext *ctx) gen_set_label(l1); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* abso - abso. */ @@ -5044,8 +5107,9 @@ static void gen_abso(DisasContext *ctx) gen_set_label(l2); tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l3); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* clcs */ @@ -5062,8 +5126,9 @@ static void gen_div(DisasContext *ctx) { gen_helper_div(cpu_gpr[rD(ctx->opcode)], cpu_env, cpu_gpr[rA(ctx->opco= de)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* divo - divo. */ @@ -5071,8 +5136,9 @@ static void gen_divo(DisasContext *ctx) { gen_helper_divo(cpu_gpr[rD(ctx->opcode)], cpu_env, cpu_gpr[rA(ctx->opc= ode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* divs - divs. */ @@ -5080,8 +5146,9 @@ static void gen_divs(DisasContext *ctx) { gen_helper_divs(cpu_gpr[rD(ctx->opcode)], cpu_env, cpu_gpr[rA(ctx->opc= ode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* divso - divso. */ @@ -5089,8 +5156,9 @@ static void gen_divso(DisasContext *ctx) { gen_helper_divso(cpu_gpr[rD(ctx->opcode)], cpu_env, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)]); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* doz - doz. */ @@ -5098,14 +5166,17 @@ static void gen_doz(DisasContext *ctx) { TCGLabel *l1 =3D gen_new_label(); TCGLabel *l2 =3D gen_new_label(); - tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ct= x->opcode)], l1); - tcg_gen_sub_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], cpu= _gpr[rA(ctx->opcode)]); + tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], + cpu_gpr[rA(ctx->opcode)], l1); + tcg_gen_sub_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], + cpu_gpr[rA(ctx->opcode)]); tcg_gen_br(l2); gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* dozo - dozo. */ @@ -5118,7 +5189,8 @@ static void gen_dozo(DisasContext *ctx) TCGv t2 =3D tcg_temp_new(); /* Start with XER OV disabled, the most likely case */ tcg_gen_movi_tl(cpu_ov, 0); - tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ct= x->opcode)], l1); + tcg_gen_brcond_tl(TCG_COND_GE, cpu_gpr[rB(ctx->opcode)], + cpu_gpr[rA(ctx->opcode)], l1); tcg_gen_sub_tl(t0, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_xor_tl(t1, cpu_gpr[rB(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_xor_tl(t2, cpu_gpr[rA(ctx->opcode)], t0); @@ -5134,8 +5206,9 @@ static void gen_dozo(DisasContext *ctx) tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* dozi */ @@ -5150,8 +5223,9 @@ static void gen_dozi(DisasContext *ctx) gen_set_label(l1); tcg_gen_movi_tl(cpu_gpr[rD(ctx->opcode)], 0); gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* lscbx - lscbx. */ @@ -5169,8 +5243,9 @@ static void gen_lscbx(DisasContext *ctx) tcg_temp_free_i32(t3); tcg_gen_andi_tl(cpu_xer, cpu_xer, ~0x7F); tcg_gen_or_tl(cpu_xer, cpu_xer, t0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, t0); + } tcg_temp_free(t0); } =20 @@ -5196,8 +5271,9 @@ static void gen_maskg(DisasContext *ctx) tcg_temp_free(t1); tcg_temp_free(t2); tcg_temp_free(t3); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* maskir - maskir. */ @@ -5210,8 +5286,9 @@ static void gen_maskir(DisasContext *ctx) tcg_gen_or_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* mul - mul. */ @@ -5230,8 +5307,9 @@ static void gen_mul(DisasContext *ctx) tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* mulo - mulo. */ @@ -5258,8 +5336,9 @@ static void gen_mulo(DisasContext *ctx) tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* nabs - nabs. */ @@ -5273,8 +5352,9 @@ static void gen_nabs(DisasContext *ctx) gen_set_label(l1); tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); gen_set_label(l2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* nabso - nabso. */ @@ -5290,8 +5370,9 @@ static void gen_nabso(DisasContext *ctx) gen_set_label(l2); /* nabs never overflows */ tcg_gen_movi_tl(cpu_ov, 0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]); + } } =20 /* rlmi - rlmi. */ @@ -5303,11 +5384,13 @@ static void gen_rlmi(DisasContext *ctx) tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x1F); tcg_gen_rotl_tl(t0, cpu_gpr[rS(ctx->opcode)], t0); tcg_gen_andi_tl(t0, t0, MASK(mb, me)); - tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], ~M= ASK(mb, me)); + tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], + ~MASK(mb, me)); tcg_gen_or_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], t0); tcg_temp_free(t0); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* rrib - rrib. */ @@ -5324,8 +5407,9 @@ static void gen_rrib(DisasContext *ctx) tcg_gen_or_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sle - sle. */ @@ -5342,8 +5426,9 @@ static void gen_sle(DisasContext *ctx) gen_store_spr(SPR_MQ, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sleq - sleq. */ @@ -5364,8 +5449,9 @@ static void gen_sleq(DisasContext *ctx) tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sliq - sliq. */ @@ -5381,8 +5467,9 @@ static void gen_sliq(DisasContext *ctx) gen_store_spr(SPR_MQ, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* slliq - slliq. */ @@ -5399,8 +5486,9 @@ static void gen_slliq(DisasContext *ctx) tcg_gen_or_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sllq - sllq. */ @@ -5428,8 +5516,9 @@ static void gen_sllq(DisasContext *ctx) tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* slq - slq. */ @@ -5451,8 +5540,9 @@ static void gen_slq(DisasContext *ctx) gen_set_label(l1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sraiq - sraiq. */ @@ -5474,8 +5564,9 @@ static void gen_sraiq(DisasContext *ctx) tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh= ); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sraq - sraq. */ @@ -5507,8 +5598,9 @@ static void gen_sraq(DisasContext *ctx) gen_set_label(l2); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sre - sre. */ @@ -5525,8 +5617,9 @@ static void gen_sre(DisasContext *ctx) gen_store_spr(SPR_MQ, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srea - srea. */ @@ -5540,8 +5633,9 @@ static void gen_srea(DisasContext *ctx) tcg_gen_sar_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sreq */ @@ -5562,8 +5656,9 @@ static void gen_sreq(DisasContext *ctx) tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* sriq */ @@ -5579,8 +5674,9 @@ static void gen_sriq(DisasContext *ctx) gen_store_spr(SPR_MQ, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srliq */ @@ -5597,8 +5693,9 @@ static void gen_srliq(DisasContext *ctx) tcg_gen_or_tl(cpu_gpr[rA(ctx->opcode)], t0, t1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srlq */ @@ -5627,8 +5724,9 @@ static void gen_srlq(DisasContext *ctx) tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* srq */ @@ -5650,8 +5748,9 @@ static void gen_srq(DisasContext *ctx) gen_set_label(l1); tcg_temp_free(t0); tcg_temp_free(t1); - if (unlikely(Rc(ctx->opcode) !=3D 0)) + if (unlikely(Rc(ctx->opcode) !=3D 0)) { gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); + } } =20 /* PowerPC 602 specific instructions */ @@ -5769,8 +5868,9 @@ static void gen_mfsri(DisasContext *ctx) tcg_gen_extract_tl(t0, t0, 28, 4); gen_helper_load_sr(cpu_gpr[rd], cpu_env, t0); tcg_temp_free(t0); - if (ra !=3D 0 && ra !=3D rd) + if (ra !=3D 0 && ra !=3D rd) { tcg_gen_mov_tl(cpu_gpr[ra], cpu_gpr[rd]); + } #endif /* defined(CONFIG_USER_ONLY) */ } =20 @@ -6147,9 +6247,10 @@ static void gen_dcread(DisasContext *ctx) /* icbt */ static void gen_icbt_40x(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 @@ -6440,7 +6541,7 @@ static void gen_tlbilx_booke206(DisasContext *ctx) t0 =3D tcg_temp_new(); gen_addr_reg_index(ctx, t0); =20 - switch((ctx->opcode >> 21) & 0x3) { + switch ((ctx->opcode >> 21) & 0x3) { case 0: gen_helper_booke206_tlbilx0(cpu_env, t0); break; @@ -6474,8 +6575,9 @@ static void gen_wrtee(DisasContext *ctx) tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(1 << MSR_EE)); tcg_gen_or_tl(cpu_msr, cpu_msr, t0); tcg_temp_free(t0); - /* Stop translation to have a chance to raise an exception - * if we just set msr_ee to 1 + /* + * Stop translation to have a chance to raise an exception if we + * just set msr_ee to 1 */ gen_stop_exception(ctx); #endif /* defined(CONFIG_USER_ONLY) */ @@ -6529,9 +6631,10 @@ static void gen_msync_4xx(DisasContext *ctx) /* icbt */ static void gen_icbt_440(DisasContext *ctx) { - /* interpreted as no-op */ - /* XXX: specification say this is treated as a load by the MMU - * but does not generate any exception + /* + * interpreted as no-op + * XXX: specification say this is treated as a load by the MMU but + * does not generate any exception */ } =20 @@ -6625,7 +6728,8 @@ static inline void gen_##name(DisasContext *ctx) = \ gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_TM); \ return; \ } \ - /* Because tbegin always fails in QEMU, these user \ + /* \ + * Because tbegin always fails in QEMU, these user \ * space instructions all have a simple implementation: \ * \ * CR[0] =3D 0b0 || MSR[TS] || 0b0 \ @@ -6641,17 +6745,18 @@ GEN_TM_NOOP(tabortwci); GEN_TM_NOOP(tabortdc); GEN_TM_NOOP(tabortdci); GEN_TM_NOOP(tsr); + static inline void gen_cp_abort(DisasContext *ctx) { - // Do Nothing + /* Do Nothing */ } =20 #define GEN_CP_PASTE_NOOP(name) \ static inline void gen_##name(DisasContext *ctx) \ { \ - /* Generate invalid exception until \ - * we have an implementation of the copy \ - * paste facility \ + /* \ + * Generate invalid exception until we have an \ + * implementation of the copy paste facility \ */ \ gen_invalid(ctx); \ } @@ -6665,8 +6770,9 @@ static void gen_tcheck(DisasContext *ctx) gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_TM); return; } - /* Because tbegin always fails, the tcheck implementation - * is simple: + /* + * Because tbegin always fails, the tcheck implementation is + * simple: * * CR[CRF] =3D TDOOMED || MSR[TS] || 0b0 * =3D 0b1 || 0b00 || 0b0 @@ -6678,7 +6784,7 @@ static void gen_tcheck(DisasContext *ctx) #define GEN_TM_PRIV_NOOP(name) \ static inline void gen_##name(DisasContext *ctx) \ { \ - gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); \ + gen_priv_exception(ctx, POWERPC_EXCP_PRIV_OPC); \ } =20 #else @@ -6691,7 +6797,8 @@ static inline void gen_##name(DisasContext *ctx) = \ gen_exception_err(ctx, POWERPC_EXCP_FU, FSCR_IC_TM); \ return; \ } \ - /* Because tbegin always fails, the implementation is \ + /* \ + * Because tbegin always fails, the implementation is \ * simple: \ * \ * CR[0] =3D 0b0 || MSR[TS] || 0b0 \ @@ -6973,8 +7080,10 @@ GEN_HANDLER2(slbmfev, "slbmfev", 0x1F, 0x13, 0x1A, 0= x001F0001, PPC_SEGMENT_64B), GEN_HANDLER2(slbfee_, "slbfee.", 0x1F, 0x13, 0x1E, 0x001F0000, PPC_SEGMENT= _64B), #endif GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA), -/* XXX Those instructions will need to be handled differently for - * different ISA versions */ +/* + * XXX Those instructions will need to be handled differently for + * different ISA versions + */ GEN_HANDLER(tlbiel, 0x1F, 0x12, 0x08, 0x001F0001, PPC_MEM_TLBIE), GEN_HANDLER(tlbie, 0x1F, 0x12, 0x09, 0x001F0001, PPC_MEM_TLBIE), GEN_HANDLER_E(tlbiel, 0x1F, 0x12, 0x08, 0x00100001, PPC_NONE, PPC2_ISA300), @@ -7444,11 +7553,13 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int = flags) ); #endif for (i =3D 0; i < 32; i++) { - if ((i & (RGPL - 1)) =3D=3D 0) + if ((i & (RGPL - 1)) =3D=3D 0) { qemu_fprintf(f, "GPR%02d", i); + } qemu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i)); - if ((i & (RGPL - 1)) =3D=3D (RGPL - 1)) + if ((i & (RGPL - 1)) =3D=3D (RGPL - 1)) { qemu_fprintf(f, "\n"); + } } qemu_fprintf(f, "CR "); for (i =3D 0; i < 8; i++) @@ -7456,12 +7567,13 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int = flags) qemu_fprintf(f, " ["); for (i =3D 0; i < 8; i++) { char a =3D '-'; - if (env->crf[i] & 0x08) + if (env->crf[i] & 0x08) { a =3D 'L'; - else if (env->crf[i] & 0x04) + } else if (env->crf[i] & 0x04) { a =3D 'G'; - else if (env->crf[i] & 0x02) + } else if (env->crf[i] & 0x02) { a =3D 'E'; + } qemu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' '); } qemu_fprintf(f, " ] RES " TARGET_FMT_lx "\n", @@ -7543,8 +7655,9 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, int fl= ags) } #endif =20 - if (env->spr_cb[SPR_LPCR].name) + if (env->spr_cb[SPR_LPCR].name) { qemu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]); + } =20 switch (env->mmu_model) { case POWERPC_MMU_32B: @@ -7610,8 +7723,9 @@ void ppc_cpu_dump_statistics(CPUState *cs, int flags) t3 =3D ind_table(handler); for (op3 =3D 0; op3 < 32; op3++) { handler =3D t3[op3]; - if (handler->count =3D=3D 0) + if (handler->count =3D=3D 0) { continue; + } qemu_printf("%02x %02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op3, op1, (op3 << 5) | op2, @@ -7619,8 +7733,9 @@ void ppc_cpu_dump_statistics(CPUState *cs, int flags) handler->count, handler->count); } } else { - if (handler->count =3D=3D 0) + if (handler->count =3D=3D 0) { continue; + } qemu_printf("%02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op1, op2, handler->oname, @@ -7628,8 +7743,9 @@ void ppc_cpu_dump_statistics(CPUState *cs, int flags) } } } else { - if (handler->count =3D=3D 0) + if (handler->count =3D=3D 0) { continue; + } qemu_printf("%02x (%02x ) %16s: %016" PRIx64 " %" PRId64 "\n", op1, op1, handler->oname, @@ -7669,14 +7785,16 @@ static void ppc_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cs) || (env->mmu_model & POWERPC_MMU_64B); =20 ctx->fpu_enabled =3D !!msr_fp; - if ((env->flags & POWERPC_FLAG_SPE) && msr_spe) + if ((env->flags & POWERPC_FLAG_SPE) && msr_spe) { ctx->spe_enabled =3D !!msr_spe; - else + } else { ctx->spe_enabled =3D false; - if ((env->flags & POWERPC_FLAG_VRE) && msr_vr) + } + if ((env->flags & POWERPC_FLAG_VRE) && msr_vr) { ctx->altivec_enabled =3D !!msr_vr; - else + } else { ctx->altivec_enabled =3D false; + } if ((env->flags & POWERPC_FLAG_VSX) && msr_vsx) { ctx->vsx_enabled =3D !!msr_vsx; } else { @@ -7690,12 +7808,14 @@ static void ppc_tr_init_disas_context(DisasContextB= ase *dcbase, CPUState *cs) } #endif ctx->gtse =3D !!(env->spr[SPR_LPCR] & LPCR_GTSE); - if ((env->flags & POWERPC_FLAG_SE) && msr_se) + if ((env->flags & POWERPC_FLAG_SE) && msr_se) { ctx->singlestep_enabled =3D CPU_SINGLE_STEP; - else + } else { ctx->singlestep_enabled =3D 0; - if ((env->flags & POWERPC_FLAG_BE) && msr_be) + } + if ((env->flags & POWERPC_FLAG_BE) && msr_be) { ctx->singlestep_enabled |=3D CPU_BRANCH_STEP; + } if ((env->flags & POWERPC_FLAG_DE) && msr_de) { ctx->singlestep_enabled =3D 0; target_ulong dbcr0 =3D env->spr[SPR_BOOKE_DBCR0]; @@ -7710,7 +7830,7 @@ static void ppc_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) if (unlikely(ctx->base.singlestep_enabled)) { ctx->singlestep_enabled |=3D GDBSTUB_SINGLE_STEP; } -#if defined (DO_SINGLE_STEP) && 0 +#if defined(DO_SINGLE_STEP) && 0 /* Single step trace mode */ msr_se =3D 1; #endif @@ -7735,10 +7855,12 @@ static bool ppc_tr_breakpoint_check(DisasContextBas= e *dcbase, CPUState *cs, =20 gen_debug_exception(ctx); dcbase->is_jmp =3D DISAS_NORETURN; - /* The address covered by the breakpoint must be included in - [tb->pc, tb->pc + tb->size) in order to for it to be - properly cleared -- thus we increment the PC here so that - the logic setting tb->size below does the right thing. */ + /* + * The address covered by the breakpoint must be included in + * [tb->pc, tb->pc + tb->size) in order to for it to be properly + * cleared -- thus we increment the PC here so that the logic + * setting tb->size below does the right thing. + */ ctx->base.pc_next +=3D 4; return true; } --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260468; cv=none; d=zoho.com; s=zohoarc; b=Nxc8OBHmtP8m2sc/eVeVtBR7TwpFHcpfC84EpsY7vopCPaNKCf/CV1ZaeAxkKagH6y6HaE0Vst4W8j8P7N/YZhrNU7ClEqVgr7oQKlXx0OGFSnklXksIj85TUTbPdU7i3SgJPDlt+BBZ2peSFUM/kUJRt8BWtmlIwmQS96IEEuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260468; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3EaPjjExWhh8rj/t4KtwkDnw8ZQsw0N11u77oh0p/4o=; b=KYxDpydkH6l2hTCOadGWhqyC1MIC/r7DphaD5CDDKb0VjGO7mX2ptzQDVxRmHtvF6xOX+XK+0vthT5woeot4pc2XA0LSbTSsYeePmUtmOIQDQQ/bnJoe5Osh5QQdPOuHLFSWLgtO1R8pwHoh3ejAMehIhRtAenzwFoueuUPKWqc= ARC-Authentication-Results: i=1; mx.zoho.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 1556260468131511.75787804103857; Thu, 25 Apr 2019 23:34:28 -0700 (PDT) Received: from localhost ([127.0.0.1]:40322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuRC-0007vP-2V for importer@patchew.org; Fri, 26 Apr 2019 02:34:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu12-00065V-25 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu10-00059e-47 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:51167 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0y-0004aJ-6x; Fri, 26 Apr 2019 02:07:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq2Tttz9sNx; Fri, 26 Apr 2019 16:06:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=MgDowlJQQEQCvGIHI/vGXoXDkAhhSrhzg1uosH+m9Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxlrspVh+OezBSNSRotrrpMyhQrY8CuKSJJCC4Jibp3VmXSqCah+qHgG9tWU3dLqT 7WuoPQi3tudjlKOlVYy4r9Eqh94/U2SIV3OrgMUSL7srev0WzlcQjuG6/V6h+jV96o zMB6FATHfcQ77Soivl+46fcy5KLhHVlV1AfExzV8= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:15 +1000 Message-Id: <20190426060627.18153-25-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for translate/fp-impl.inc.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate/fp-impl.inc.c | 52 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/target/ppc/translate/fp-impl.inc.c b/target/ppc/translate/fp-i= mpl.inc.c index 0f21a4e477..9dcff947c0 100644 --- a/target/ppc/translate/fp-impl.inc.c +++ b/target/ppc/translate/fp-impl.inc.c @@ -585,11 +585,13 @@ static void gen_mcrfs(DisasContext *ctx) shift =3D 4 * nibble; tcg_gen_shri_tl(tmp, cpu_fpscr, shift); tcg_gen_trunc_tl_i32(cpu_crf[crfD(ctx->opcode)], tmp); - tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)= ], 0xf); + tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfD(ctx->opcode)= ], + 0xf); tcg_temp_free(tmp); tcg_gen_extu_tl_i64(tnew_fpscr, cpu_fpscr); /* Only the exception bits (including FX) should be cleared if read */ - tcg_gen_andi_i64(tnew_fpscr, tnew_fpscr, ~((0xF << shift) & FP_EX_CLEA= R_BITS)); + tcg_gen_andi_i64(tnew_fpscr, tnew_fpscr, + ~((0xF << shift) & FP_EX_CLEAR_BITS)); /* FEX and VX need to be updated, so don't set fpscr directly */ tmask =3D tcg_const_i32(1 << nibble); gen_helper_store_fpscr(cpu_env, tnew_fpscr, tmask); @@ -735,7 +737,7 @@ static void gen_mtfsfi(DisasContext *ctx) =20 /*** Floating-point load = ***/ #define GEN_LDF(name, ldop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -754,7 +756,7 @@ static void glue(gen_, name)(DisasContext *ctx) } =20 #define GEN_LDUF(name, ldop, opc, type) = \ -static void glue(gen_, name##u)(DisasContext *ctx) = \ +static void glue(gen_, name##u)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -778,7 +780,7 @@ static void glue(gen_, name##u)(DisasContext *ctx) } =20 #define GEN_LDUXF(name, ldop, opc, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ +static void glue(gen_, name##ux)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -802,7 +804,7 @@ static void glue(gen_, name##ux)(DisasContext *ctx) } =20 #define GEN_LDXF(name, ldop, opc2, opc3, type) = \ -static void glue(gen_, name##x)(DisasContext *ctx) = \ +static void glue(gen_, name##x)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -872,8 +874,10 @@ static void gen_lfdp(DisasContext *ctx) EA =3D tcg_temp_new(); gen_addr_imm_index(ctx, EA, 0); t0 =3D tcg_temp_new_i64(); - /* We only need to swap high and low halves. gen_qemu_ld64_i64 does - necessary 64-bit byteswap already. */ + /* + * We only need to swap high and low halves. gen_qemu_ld64_i64 + * does necessary 64-bit byteswap already. + */ if (unlikely(ctx->le_mode)) { gen_qemu_ld64_i64(ctx, t0, EA); set_fpr(rD(ctx->opcode) + 1, t0); @@ -904,8 +908,10 @@ static void gen_lfdpx(DisasContext *ctx) EA =3D tcg_temp_new(); gen_addr_reg_index(ctx, EA); t0 =3D tcg_temp_new_i64(); - /* We only need to swap high and low halves. gen_qemu_ld64_i64 does - necessary 64-bit byteswap already. */ + /* + * We only need to swap high and low halves. gen_qemu_ld64_i64 + * does necessary 64-bit byteswap already. + */ if (unlikely(ctx->le_mode)) { gen_qemu_ld64_i64(ctx, t0, EA); set_fpr(rD(ctx->opcode) + 1, t0); @@ -966,7 +972,7 @@ static void gen_lfiwzx(DisasContext *ctx) } /*** Floating-point store = ***/ #define GEN_STF(name, stop, opc, type) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -985,7 +991,7 @@ static void glue(gen_, name)(DisasContext *ctx) } =20 #define GEN_STUF(name, stop, opc, type) = \ -static void glue(gen_, name##u)(DisasContext *ctx) = \ +static void glue(gen_, name##u)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -1009,7 +1015,7 @@ static void glue(gen_, name##u)(DisasContext *ctx) } =20 #define GEN_STUXF(name, stop, opc, type) = \ -static void glue(gen_, name##ux)(DisasContext *ctx) = \ +static void glue(gen_, name##ux)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -1033,7 +1039,7 @@ static void glue(gen_, name##ux)(DisasContext *ctx) } =20 #define GEN_STXF(name, stop, opc2, opc3, type) = \ -static void glue(gen_, name##x)(DisasContext *ctx) = \ +static void glue(gen_, name##x)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 t0; = \ @@ -1103,8 +1109,10 @@ static void gen_stfdp(DisasContext *ctx) EA =3D tcg_temp_new(); t0 =3D tcg_temp_new_i64(); gen_addr_imm_index(ctx, EA, 0); - /* We only need to swap high and low halves. gen_qemu_st64_i64 does - necessary 64-bit byteswap already. */ + /* + * We only need to swap high and low halves. gen_qemu_st64_i64 + * does necessary 64-bit byteswap already. + */ if (unlikely(ctx->le_mode)) { get_fpr(t0, rD(ctx->opcode) + 1); gen_qemu_st64_i64(ctx, t0, EA); @@ -1135,8 +1143,10 @@ static void gen_stfdpx(DisasContext *ctx) EA =3D tcg_temp_new(); t0 =3D tcg_temp_new_i64(); gen_addr_reg_index(ctx, EA); - /* We only need to swap high and low halves. gen_qemu_st64_i64 does - necessary 64-bit byteswap already. */ + /* + * We only need to swap high and low halves. gen_qemu_st64_i64 + * does necessary 64-bit byteswap already. + */ if (unlikely(ctx->le_mode)) { get_fpr(t0, rD(ctx->opcode) + 1); gen_qemu_st64_i64(ctx, t0, EA); @@ -1204,8 +1214,9 @@ static void gen_lfqu(DisasContext *ctx) gen_addr_add(ctx, t1, t0, 8); gen_qemu_ld64_i64(ctx, t2, t1); set_fpr((rd + 1) % 32, t2); - if (ra !=3D 0) + if (ra !=3D 0) { tcg_gen_mov_tl(cpu_gpr[ra], t0); + } tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free_i64(t2); @@ -1229,8 +1240,9 @@ static void gen_lfqux(DisasContext *ctx) gen_qemu_ld64_i64(ctx, t2, t1); set_fpr((rd + 1) % 32, t2); tcg_temp_free(t1); - if (ra !=3D 0) + if (ra !=3D 0) { tcg_gen_mov_tl(cpu_gpr[ra], t0); + } tcg_temp_free(t0); tcg_temp_free_i64(t2); } --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260848; cv=none; d=zoho.com; s=zohoarc; b=PXX4wyI8mApJZR+t9Q2MjqL1vaVg4c8CmoIFjzDpKaFYO7rbeenlakM0Nvp1tSzuQAPg9VTQ0WZT7nZ/wJiaKqKzeaEGODX9H9dkYIp8afrhXz9jSaKKFWvFLNwNfFeCHpLYs4mvhX0+SxGSATLCj1a/Zm8OEbwZu0A3Cl+3uMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hI8Os0CRtyjU1g6IBBjoVW/B2lH4GMuc7jqwsr28RgQ=; b=lEbYWCOt1kSoeFb310MlOJ9V5p9CCUkCHdbB2hPA1QZkdeExo6N5d1vXb5/j2OlWhbwzZhm6Q3CkWOhdetWlbE0f3Ci0Ogcvxbf0IDPqm2pnRgPruuHRssjTmL/q2CmgIYtOLK2DN93nyEH/4cZGH1TYbaQxOXGDMPGDwdttuXQ= ARC-Authentication-Results: i=1; mx.zoho.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 1556260848738950.8913689323845; Thu, 25 Apr 2019 23:40:48 -0700 (PDT) Received: from localhost ([127.0.0.1]:40444 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuXJ-0004Ym-IY for importer@patchew.org; Fri, 26 Apr 2019 02:40:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1J-0006QO-8w for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1I-0005bx-87 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:37 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:60563 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1H-00050u-Ii; Fri, 26 Apr 2019 02:07:36 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq3TK9z9sNq; Fri, 26 Apr 2019 16:06:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=G3nunOIA/V2+aFWTwHvGJIidNGFYxp04mZ7Q+2kZLJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fw9yEwTHaLiN5Z7yFNiYKo7EvmWU4onkIVBxcR/iBHeUKDo7vKwUna2vg5BK9ezX6 nWciczeXlpqaZLocHDI+PST5kXdlJOXjtqrnqTmSJoE21c7AYUiAeaxLd5mAbHQ9JZ fn5rOH2wikiCF4GLOMO7sABVhjTrUNOZ5uXgJwRw= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:16 +1000 Message-Id: <20190426060627.18153-26-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 25/36] target/ppc: Style fixes for translate/vsx-impl.inc.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate/vsx-impl.inc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx= -impl.inc.c index 489b2436e4..11d9b75d01 100644 --- a/target/ppc/translate/vsx-impl.inc.c +++ b/target/ppc/translate/vsx-impl.inc.c @@ -751,7 +751,7 @@ static void gen_xxpermdi(DisasContext *ctx) #define SGN_MASK_SP 0x8000000080000000ull =20 #define VSX_SCALAR_MOVE(name, op, sgn_mask) \ -static void glue(gen_, name)(DisasContext * ctx) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ TCGv_i64 xb, sgm; \ if (unlikely(!ctx->vsx_enabled)) { \ @@ -848,7 +848,7 @@ VSX_SCALAR_MOVE_QP(xsnegqp, OP_NEG, SGN_MASK_DP) VSX_SCALAR_MOVE_QP(xscpsgnqp, OP_CPSGN, SGN_MASK_DP) =20 #define VSX_VECTOR_MOVE(name, op, sgn_mask) \ -static void glue(gen_, name)(DisasContext * ctx) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ TCGv_i64 xbh, xbl, sgm; \ if (unlikely(!ctx->vsx_enabled)) { \ @@ -910,7 +910,7 @@ VSX_VECTOR_MOVE(xvnegsp, OP_NEG, SGN_MASK_SP) VSX_VECTOR_MOVE(xvcpsgnsp, OP_CPSGN, SGN_MASK_SP) =20 #define GEN_VSX_HELPER_2(name, op1, op2, inval, type) = \ -static void gen_##name(DisasContext * ctx) = \ +static void gen_##name(DisasContext *ctx) = \ { = \ TCGv_i32 opc; = \ if (unlikely(!ctx->vsx_enabled)) { = \ @@ -923,7 +923,7 @@ static void gen_##name(DisasContext * ctx) = \ } =20 #define GEN_VSX_HELPER_XT_XB_ENV(name, op1, op2, inval, type) \ -static void gen_##name(DisasContext * ctx) \ +static void gen_##name(DisasContext *ctx) \ { \ TCGv_i64 t0; \ TCGv_i64 t1; \ @@ -1230,7 +1230,7 @@ static void gen_xxbrw(DisasContext *ctx) } =20 #define VSX_LOGICAL(name, vece, tcg_op) \ -static void glue(gen_, name)(DisasContext * ctx) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ if (unlikely(!ctx->vsx_enabled)) { \ gen_exception(ctx, POWERPC_EXCP_VSXU); \ @@ -1251,7 +1251,7 @@ 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) \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ TCGv_i64 a0, a1, b0, b1, tmp; \ if (unlikely(!ctx->vsx_enabled)) { \ @@ -1444,7 +1444,8 @@ static void gen_##name(DisasContext *ctx) = \ xb =3D tcg_const_tl(xB(ctx->opcode)); \ t0 =3D tcg_temp_new_i32(); \ t1 =3D tcg_temp_new_i64(); \ - /* uimm > 15 out of bound and for \ + /* \ + * uimm > 15 out of bound and for \ * uimm > 12 handle as per hardware in helper \ */ \ if (uimm > 15) { \ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259830; cv=none; d=zoho.com; s=zohoarc; b=Pt5AbWDW+FSKykcXcoXXgX7jV03UD1gSBauMHLMZycqbd1pPwxw6ydPjnz659YJUOAAi+loO48e+q6SQnqHjUSnwD7JaxBKMVck0zhwjMpDkS840BHXP4jSSZefYkg+G4ez/rjMaZGy+8xFbaByDJXLjf+jdMnQ8BDWznrx1haw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259830; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NafF6FNnwo0sG7rZb7YQHJiVnCEhNeBrSdBqZe+ZRwY=; b=Y7XnTQC+ZIX40uEd3okf6gfO3D8iaPhw6evIiDpOvEaPxt0+SMEg/hReVsrWbeo2B/wkxD4JyLT3JPITvFKpsuy+BZquYi8mHkjzoqTTB+eMozR1oB/ZYxQrThFSaALfBcepAy5U9q4C65EPYmkYjRjxEI1r0mGyR3VYzuARMog= ARC-Authentication-Results: i=1; mx.zoho.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 1556259830810105.64679338045858; Thu, 25 Apr 2019 23:23:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:40140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuGz-0005q3-Lu for importer@patchew.org; Fri, 26 Apr 2019 02:23:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu0d-0005aR-LK for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0b-0004ZK-P9 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:06:55 -0400 Received: from ozlabs.org ([203.11.71.1]:53953) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0b-0004VB-2b; Fri, 26 Apr 2019 02:06:53 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tp4vWcz9sNl; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258798; bh=W9sQhKyJrQXMj/mZuUVkZXbL5uKfz7ioG1dbmzOxLGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvYzw0u/sfJ2xd93yE8Rkc1qivvg+e47X6/ccxrFq7SJZ3IIzJsdaj0Qd3+NTB50L 0oXobs8vZfbr4t4mI62A7gnsCQ5ELTBeK/SuhS6AgjZMoeJesG5sjH5BwCMM4KSpn9 Fty8AKGc5gh+lQVfiQZpE2XyTkiwp5X1Tg11zn4A= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:17 +1000 Message-Id: <20190426060627.18153-27-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 26/36] target/ppc: Style fixes for translate/vmx-impl.inc.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate/vmx-impl.inc.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/target/ppc/translate/vmx-impl.inc.c b/target/ppc/translate/vmx= -impl.inc.c index eb10c533ca..bd3ff40e68 100644 --- a/target/ppc/translate/vmx-impl.inc.c +++ b/target/ppc/translate/vmx-impl.inc.c @@ -15,7 +15,7 @@ static inline TCGv_ptr gen_avr_ptr(int reg) } =20 #define GEN_VR_LDX(name, opc2, opc3) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv EA; = \ TCGv_i64 avr; = \ @@ -28,8 +28,10 @@ static void glue(gen_, name)(DisasContext *ctx) EA =3D tcg_temp_new(); = \ gen_addr_reg_index(ctx, EA); = \ tcg_gen_andi_tl(EA, EA, ~0xf); = \ - /* We only need to swap high and low halves. gen_qemu_ld64_i64 does = \ - necessary 64-bit byteswap already. */ = \ + /* = \ + * We only need to swap high and low halves. gen_qemu_ld64_i64 = \ + * does necessary 64-bit byteswap already. = \ + */ = \ if (ctx->le_mode) { = \ gen_qemu_ld64_i64(ctx, avr, EA); = \ set_avr64(rD(ctx->opcode), avr, false); = \ @@ -61,8 +63,10 @@ static void gen_st##name(DisasContext *ctx) = \ EA =3D tcg_temp_new(); = \ gen_addr_reg_index(ctx, EA); = \ tcg_gen_andi_tl(EA, EA, ~0xf); = \ - /* We only need to swap high and low halves. gen_qemu_st64_i64 does = \ - necessary 64-bit byteswap already. */ = \ + /* = \ + * We only need to swap high and low halves. gen_qemu_st64_i64 = \ + * does necessary 64-bit byteswap already. = \ + */ = \ if (ctx->le_mode) { = \ get_avr64(avr, rD(ctx->opcode), false); = \ gen_qemu_st64_i64(ctx, avr, EA); = \ @@ -296,7 +300,7 @@ 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) = \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ TCGv_ptr ra, rb, rd; \ if (unlikely(!ctx->altivec_enabled)) { \ @@ -306,7 +310,7 @@ static void glue(gen_, name)(DisasContext *ctx) ra =3D gen_avr_ptr(rA(ctx->opcode)); \ rb =3D gen_avr_ptr(rB(ctx->opcode)); \ rd =3D gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, ra, rb); \ + gen_helper_##name(rd, ra, rb); \ tcg_temp_free_ptr(ra); \ tcg_temp_free_ptr(rb); \ tcg_temp_free_ptr(rd); \ @@ -758,7 +762,7 @@ 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) = \ +static void glue(gen_, name)(DisasContext *ctx) \ { \ TCGv_ptr rb, rd; \ if (unlikely(!ctx->altivec_enabled)) { \ @@ -767,9 +771,9 @@ static void glue(gen_, name)(DisasContext *ctx) } \ rb =3D gen_avr_ptr(rB(ctx->opcode)); \ rd =3D gen_avr_ptr(rD(ctx->opcode)); \ - gen_helper_##name (rd, rb); \ + gen_helper_##name(rd, rb); \ tcg_temp_free_ptr(rb); \ - tcg_temp_free_ptr(rd); \ + tcg_temp_free_ptr(rd); \ } =20 #define GEN_VXFORM_NOA_ENV(name, opc2, opc3) \ @@ -943,7 +947,7 @@ static void gen_vsldoi(DisasContext *ctx) rb =3D gen_avr_ptr(rB(ctx->opcode)); rd =3D gen_avr_ptr(rD(ctx->opcode)); sh =3D tcg_const_i32(VSH(ctx->opcode)); - gen_helper_vsldoi (rd, ra, rb, sh); + gen_helper_vsldoi(rd, ra, rb, sh); tcg_temp_free_ptr(ra); tcg_temp_free_ptr(rb); tcg_temp_free_ptr(rd); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556259844; cv=none; d=zoho.com; s=zohoarc; b=I/CcImtoyoxh0Z6u1HC8+YEPBaCF85Y1PG6ewb8R2KQTx/fdxWYan8H+a0MQR317yhxfqgIUZqwFsRsAivB+VyGeOFPj38ZbCpHZYHVN/uyF0ujSR1NG5fzNu3DsACuN6fe61aVKhB7oKmSdKC4yzFv6Dc1QeXr1YEiuPJDo3U0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556259844; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VO4vJnFdrHqs19oOSqICsCoWNp01kaB1L11oaXJz4EA=; b=Yx2yqiDKC18ca/X4oomk88MG3LH+W2QxW38FWNtdRCjl1PJCYZ1+Ply2M6lUMEr/tJNjrrUoIOQDbxSb9gBCRBwNl1s/ol8TwXH9k4/ICeNuOvFAROf0NpJiGsx5NuukyI665rOvNKyCnkuVv+pGx/CBWWMnsQmiY+dQ8pRpKAE= ARC-Authentication-Results: i=1; mx.zoho.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 1556259844485379.6581410505971; Thu, 25 Apr 2019 23:24:04 -0700 (PDT) Received: from localhost ([127.0.0.1]:40144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuHB-00061o-Aq for importer@patchew.org; Fri, 26 Apr 2019 02:24:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu10-00063D-2D for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu0y-00056m-7P for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:18 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:60491 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0w-0004Vk-4d; Fri, 26 Apr 2019 02:07:16 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tp5vfKz9sNs; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258798; bh=7nqWASjgaSD9sIm7A3aZFRTFfvHArAZgUMaAEXJMIjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFPWVisHQCsMkMa85EgVCsiTNPOX87Y4U/E3bzom46bN+Qxb4+u8BAzun3L7uoWaV GqjJY2U6smVnsRniu75u5jj1CwDC3+h/39Z91GkjLwhxNx8dvH+GjGAz1Bo1azS2jw /I0AVNyQKRFWqSqWNKRwQCbf6pmAsy4mVFebTkdI= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:18 +1000 Message-Id: <20190426060627.18153-28-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc: Style fixes for translate/spe-impl.inc.c 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: gkurz@kaod.org, Greg Kurz , 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" Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- target/ppc/translate/spe-impl.inc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/target/ppc/translate/spe-impl.inc.c b/target/ppc/translate/spe= -impl.inc.c index 8c1c16c63e..7ab0a29b5f 100644 --- a/target/ppc/translate/spe-impl.inc.c +++ b/target/ppc/translate/spe-impl.inc.c @@ -18,7 +18,8 @@ static inline void gen_evmra(DisasContext *ctx) TCGv_i64 tmp =3D tcg_temp_new_i64(); =20 /* tmp :=3D rA_lo + rA_hi << 32 */ - tcg_gen_concat_tl_i64(tmp, cpu_gpr[rA(ctx->opcode)], cpu_gprh[rA(ctx->= opcode)]); + tcg_gen_concat_tl_i64(tmp, cpu_gpr[rA(ctx->opcode)], + cpu_gprh[rA(ctx->opcode)]); =20 /* spe_acc :=3D tmp */ tcg_gen_st_i64(tmp, cpu_env, offsetof(CPUPPCState, spe_acc)); @@ -780,7 +781,7 @@ static inline void gen_op_evstwwo(DisasContext *ctx, TC= Gv addr) } =20 #define GEN_SPEOP_LDST(name, opc2, sh) = \ -static void glue(gen_, name)(DisasContext *ctx) = \ +static void glue(gen_, name)(DisasContext *ctx) = \ { = \ TCGv t0; = \ if (unlikely(!ctx->spe_enabled)) { = \ @@ -1089,7 +1090,8 @@ static inline void gen_efsabs(DisasContext *ctx) gen_exception(ctx, POWERPC_EXCP_SPEU); return; } - tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], (t= arget_long)~0x80000000LL); + tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], + (target_long)~0x80000000LL); } static inline void gen_efsnabs(DisasContext *ctx) { @@ -1097,7 +1099,8 @@ static inline void gen_efsnabs(DisasContext *ctx) gen_exception(ctx, POWERPC_EXCP_SPEU); return; } - tcg_gen_ori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], 0x8= 0000000); + tcg_gen_ori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], + 0x80000000); } static inline void gen_efsneg(DisasContext *ctx) { @@ -1105,7 +1108,8 @@ static inline void gen_efsneg(DisasContext *ctx) gen_exception(ctx, POWERPC_EXCP_SPEU); return; } - tcg_gen_xori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], 0x= 80000000); + tcg_gen_xori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], + 0x80000000); } =20 /* Conversion */ --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260167; cv=none; d=zoho.com; s=zohoarc; b=XZqfKVB1CRF5Il5TZxkaMiqYSfLQ6tWPx+VU7n1DP1v6GheF+UgaMELGk466+f2rkdvf7l+fZoXt6tJcAgk2B4TRI5ABp8BrWDGY+bBUoeqr1+mCZrYr7mGFGv/Fmx0pCTV/xF9Wq7bFqZWnF2ebwW+vWHtv4eWZXogm6hKkacs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260167; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=StNAPkyCuixK1aZiS0DTXeuRZpX8PmJwxx2h+bhrMKQ=; b=MkrkNX+u1ncWrvsNQ6NYpPVbek3/J2XVHIrcamzusRr8RmVRxGVyvqPnS8n7xZrDRNGOsYP/v+1Br1St0C4/QvRKisxItm0VynuVMYf0JMCbUcl6l9i5zEybtn9pZzKPGuMHLSLclDCc0x42x0x4ueDkiHFn5IRdYE3mUGj29Y0= ARC-Authentication-Results: i=1; mx.zoho.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 1556260167152720.181087028617; Thu, 25 Apr 2019 23:29:27 -0700 (PDT) Received: from localhost ([127.0.0.1]:40239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuMN-0003Jq-0g for importer@patchew.org; Fri, 26 Apr 2019 02:29:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu12-00065U-2D for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu10-00059Y-3S for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:49939 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0y-0004aF-8W; Fri, 26 Apr 2019 02:07:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq1bynz9sNy; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=oH/M0pCY9v8xQ/LPkDyH0fYeWSAbMZJyivCSW4mRds0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WG/48ccfAb3ZeaRQIw+QsW6vIMSgpPJ1DqUbn25DY3K8l5B+niR58yWt3dc/kgwdV 0Vsx+xW7OarlsPEOmkIw1oSI4uBtiCJuXkr5rfG7EsoxfiL6RHLEIYzYWLgMP3w9Ei F70tpx7i1MeCSLrCE4fBhZaXJRHihedF+3MLLYtU= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:19 +1000 Message-Id: <20190426060627.18153-29-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 28/36] spapr_pci: Get rid of duplicate code for node name creation 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: gkurz@kaod.org, Greg Kurz , 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: Greg Kurz According to the changelog of 298a971024534, SpaprPhbState::dtbusname was introduced to "make it easier to relate the guest and qemu views of memory to each other", hence its name. Use it when creating the PHB node to avoid code duplication. Signed-off-by: Greg Kurz Message-Id: <155448184292.8446.8225650773162648595.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index d6d0a7115c..f005854dec 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2176,7 +2176,6 @@ int spapr_populate_pci_dt(SpaprPhbState *phb, uint32_= t intc_phandle, void *fdt, uint32_t nr_msis, int *node_offset) { int bus_off, i, j, ret; - gchar *nodename; uint32_t bus_range[] =3D { cpu_to_be32(0), cpu_to_be32(0xff) }; struct { uint32_t hi; @@ -2227,9 +2226,7 @@ int spapr_populate_pci_dt(SpaprPhbState *phb, uint32_= t intc_phandle, void *fdt, Error *errp =3D NULL; =20 /* Start populating the FDT */ - nodename =3D g_strdup_printf("pci@%" PRIx64, phb->buid); - _FDT(bus_off =3D fdt_add_subnode(fdt, 0, nodename)); - g_free(nodename); + _FDT(bus_off =3D fdt_add_subnode(fdt, 0, phb->dtbusname)); if (node_offset) { *node_offset =3D bus_off; } --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260349; cv=none; d=zoho.com; s=zohoarc; b=ij6qio8tpoHensuaLxf/4C+nX/LvqbIY6IH0zz7ehmqsdPVakzuZa3kloyQE94CcNvxsnA3li/HdxjFiEg8HOBewfB/SNQ2V6ZdsDMHF9DvosIKgBG8mn4GLRJS97iqU7/rqR82bHNe6eSh70O9//eI3Qu9CaIiyrXzSJEKFbE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260349; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zP39pxsrOJvggt4HqIglZXnG/5BenOsT+7dZ6lmV5Wc=; b=oov+SCducjLxhpBnvVwnSDJFBzsPCuFgT5hcxyG9c7vLscgEnZu7/CPqr+1kOgn32lNp54wAzkgA0vOTRSaTPb6hu3aD4XmqlYAYw5Xxzaz8WOckeBFuF7vjfWAfGORVX3tw/nHEmsya8VwGTuTlSdj9W+gCXpcViixSE5fKN78= ARC-Authentication-Results: i=1; mx.zoho.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 1556260349963669.9572073368955; Thu, 25 Apr 2019 23:32:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:40300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuPI-0006Ej-T8 for importer@patchew.org; Fri, 26 Apr 2019 02:32:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu12-00065W-2S for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu10-00059T-3X for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:19 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:42943 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu0x-0004Ze-Pq; Fri, 26 Apr 2019 02:07:16 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq0fPLz9sNt; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=vTIFUkhmMQmRw6tWDIgNcy6jReNv21XZDJLpOnXpEM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VtQh0QLMyl5qvlfpVN0gJ/nMbhEz2gqu1bSWF0+CAtsKe68C5/d/XW9nHW3xjuGGZ b7JXO2N3phipz2PYdv9uoOauv6BVPLgNr7ohCyGYNePMvFJkn3HEgEDd5SQfLH/Vlr R6jXNqv2jm/Aq0A6HsYI03s7dUggqYjmXBAwaxTQ= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:20 +1000 Message-Id: <20190426060627.18153-30-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] spapr: Drop duplicate PCI swizzle 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: gkurz@kaod.org, Greg Kurz , 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: Greg Kurz LSI mapping in spapr currently open-codes standard PCI swizzling. It thus duplicates the code of pci_swizzle_map_irq_fn(). Expose the swizzling formula so that it can be used with a slot number when building the device tree. Simply drop pci_spapr_map_irq() and call pci_swizzle_map_irq_fn() instead. Signed-off-by: Greg Kurz Message-Id: <155448184841.8446.13959787238854054119.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/pci/pci.c | 2 +- hw/ppc/spapr_pci.c | 24 ++++-------------------- include/hw/pci/pci.h | 4 ++++ 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 1808b242dd..a78023f669 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1556,7 +1556,7 @@ void pci_device_set_intx_routing_notifier(PCIDevice *= dev, */ int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin) { - return (pin + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS; + return pci_swizzle(PCI_SLOT(pci_dev->devfn), pin); } =20 /***********************************************************/ diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f005854dec..97961b0128 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -719,26 +719,10 @@ param_error_exit: rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); } =20 -static int pci_spapr_swizzle(int slot, int pin) -{ - return (slot + pin) % PCI_NUM_PINS; -} - -static int pci_spapr_map_irq(PCIDevice *pci_dev, int irq_num) -{ - /* - * Here we need to convert pci_dev + irq_num to some unique value - * which is less than number of IRQs on the specific bus (4). We - * use standard PCI swizzling, that is (slot number + pin number) - * % 4. - */ - return pci_spapr_swizzle(PCI_SLOT(pci_dev->devfn), irq_num); -} - static void pci_spapr_set_irq(void *opaque, int irq_num, int level) { /* - * Here we use the number returned by pci_spapr_map_irq to find a + * Here we use the number returned by pci_swizzle_map_irq_fn to find a * corresponding qemu_irq. */ SpaprPhbState *phb =3D opaque; @@ -1766,7 +1750,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) &sphb->iowindow); =20 bus =3D pci_register_root_bus(dev, NULL, - pci_spapr_set_irq, pci_spapr_map_irq, sphb, + pci_spapr_set_irq, pci_swizzle_map_irq_fn,= sphb, &sphb->memspace, &sphb->iospace, PCI_DEVFN(0, 0), PCI_NUM_PINS, TYPE_SPAPR_PHB_ROOT_BUS); @@ -2259,14 +2243,14 @@ int spapr_populate_pci_dt(SpaprPhbState *phb, uint3= 2_t intc_phandle, void *fdt, } =20 /* Build the interrupt-map, this must matches what is done - * in pci_spapr_map_irq + * in pci_swizzle_map_irq_fn */ _FDT(fdt_setprop(fdt, bus_off, "interrupt-map-mask", &interrupt_map_mask, sizeof(interrupt_map_mask))); for (i =3D 0; i < PCI_SLOT_MAX; i++) { for (j =3D 0; j < PCI_NUM_PINS; j++) { uint32_t *irqmap =3D interrupt_map[i*PCI_NUM_PINS + j]; - int lsi_num =3D pci_spapr_swizzle(i, j); + int lsi_num =3D pci_swizzle(i, j); =20 irqmap[0] =3D cpu_to_be32(b_ddddd(i)|b_fff(0)); irqmap[1] =3D 0; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 0abb06b357..fdd4c43d3a 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -413,6 +413,10 @@ void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq,= pci_map_irq_fn map_irq, void pci_bus_irqs_cleanup(PCIBus *bus); int pci_bus_get_irq_level(PCIBus *bus, int irq_num); /* 0 <=3D pin <=3D 3 0 =3D INTA, 1 =3D INTB, 2 =3D INTC, 3 =3D INTD */ +static inline int pci_swizzle(int slot, int pin) +{ + return (slot + pin) % PCI_NUM_PINS; +} int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin); PCIBus *pci_register_root_bus(DeviceState *parent, const char *name, pci_set_irq_fn set_irq, pci_map_irq_fn map_i= rq, --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260261; cv=none; d=zoho.com; s=zohoarc; b=F61t0tmXDerSb9DXg4iPMsQq3U0qYaGR+V7EaztIzm8uqHRxVB37yQvW+95ZPxdqYVcJ6+RZAvePFcYMj92s5jpwyiym+hFrLscvK1520H+/UH7eYOSaaNxV+aYYy7/rHeM53XWbw+M1TQzeIGdPAHYdx0Aa33+f7e2DReC/XtM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260261; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/5vHST+yxT+Vf0Nut5grD5+GIJ5GBlrmPDeJdQtgZqA=; b=er8VH3gVIT1hNofierL4OPcJ44qwBqbK73voOlEK1EsNhBuEJrOEazI95BGbYNoa7ZyRKm9bw1/YlfdB3uI4y27f0fQ7uWASy1pLq44nYbd4pOeNhy8l41iKFVhWRtiRMh5JdYT2csjENIGE8Z3nn5OPIQKh+kqLNX1bS9ymv/0= ARC-Authentication-Results: i=1; mx.zoho.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 1556260261880495.72183693419595; Thu, 25 Apr 2019 23:31:01 -0700 (PDT) Received: from localhost ([127.0.0.1]:40282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuNm-0004xV-EF for importer@patchew.org; Fri, 26 Apr 2019 02:30:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1N-0006TE-Db for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1M-0005hv-ET for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:41 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:43479 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1M-00057Q-2K; Fri, 26 Apr 2019 02:07:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq6vkhz9sP6; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=r6JNa1prXyLYVctVx2AwTgsbKg4g21LB0JfRL3C1tXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQx8GD+/A5y3Qv4J2pH7yVeS99mSmtheTlumgXdwGarG1oonFMiiOfa6HMc+gfzGP 6Tw7w2UMJZpPa/Z1IWyHKeSi7KZXAGFc4+cFcFmBWRpvhIRb6FzAfP0jwnMnuqEbpM wMtejEhXCCkcZbRUCIgnWdporbJhceIMpt64Sric= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:21 +1000 Message-Id: <20190426060627.18153-31-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] target/ppc/trace-events: Fix trivial typo 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: gkurz@kaod.org, Greg Kurz , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.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: Greg Kurz Signed-off-by: Greg Kurz Message-Id: <155445151931.302073.18436485925081597460.stgit@bahia.lan> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- target/ppc/trace-events | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/trace-events b/target/ppc/trace-events index 3858f97dff..ed4d57c6d9 100644 --- a/target/ppc/trace-events +++ b/target/ppc/trace-events @@ -1,5 +1,5 @@ # See docs/devel/tracing.txt for syntax documentation. =20 # kvm.c -kvm_failed_spr_set(int str, const char *msg) "Warning: Unable to set SPR %= d to KVM: %s" -kvm_failed_spr_get(int str, const char *msg) "Warning: Unable to retrieve = SPR %d from KVM: %s" +kvm_failed_spr_set(int spr, const char *msg) "Warning: Unable to set SPR %= d to KVM: %s" +kvm_failed_spr_get(int spr, const char *msg) "Warning: Unable to retrieve = SPR %d from KVM: %s" --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260931; cv=none; d=zoho.com; s=zohoarc; b=Jrzw8cK/1a3hpve+QZqrVx6HQ9RdImMv1+nFvD2r7ZW4kCNccaLEXWjTPQ9Xr/tMdYSq1+S91VqMObh/aaeKWhBh4QEmlClHUad2bM52PnLoqi7y1HDrnH0WyVmFkWK5XJ67ABtTwLjAOOBeZA4bcfb78PuhTkAs8djSllCdCVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260931; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ws2BcU3ArCi5NyI2pkbYUJOEo1BrIyzyqKMepVvXIV4=; b=NJFFI9ckhxUXA2LVK5LOnSbC6Oje3hMiEAyi1wUWxpur04+XAmModGhWtG2AVOdMTVkvX8mRbp6qlBjVJon1Y1f9ymeWMNZGlbQk5jf5Th1Ftbddod+qfk6UX4+mi7fmjkhUUGJZdsRnmbvOziIOm8BKn/k1iixtaeUNhO8sIN4= ARC-Authentication-Results: i=1; mx.zoho.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 1556260930659290.6282315193155; Thu, 25 Apr 2019 23:42:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:40471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuYd-0005Xx-LD for importer@patchew.org; Fri, 26 Apr 2019 02:42:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1Q-0006Ub-AG for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1O-0005lY-IC for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:44 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:52013 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1N-0005AR-RV; Fri, 26 Apr 2019 02:07:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tr4j0bz9sP4; Fri, 26 Apr 2019 16:06:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258800; bh=eo1W3BBkcK0umHtImvmpNMmnbZhw72JvV8OqIl0+Iog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAsX0w6A0c8W29UH+0/yHhM9IQQn5QEmVcaIa2ZvlvB1BedCx7dPExmnaJLA7cr5b NqZoZF2v4TqDWa/N7NGyV4GxxvwGZ18ViCDDG92SkeuTgMgR2lTmLMcLb/wFa4LS1x 90piEYmNPze7QcrAnDdWQr9ZJnxPBYh76rAAA9mg= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:22 +1000 Message-Id: <20190426060627.18153-32-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 31/36] target/ppc/kvm: Convert DPRINTF to traces 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: gkurz@kaod.org, Greg Kurz , 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: Greg Kurz Signed-off-by: Greg Kurz Message-Id: <155445152490.302073.17033451726459859333.stgit@bahia.lan> Signed-off-by: David Gibson --- target/ppc/kvm.c | 68 ++++++++++++++++------------------------- target/ppc/trace-events | 25 +++++++++++++++ 2 files changed, 52 insertions(+), 41 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index a1c223385d..9e86db0963 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -49,16 +49,6 @@ #include "elf.h" #include "sysemu/kvm_int.h" =20 -/* #define DEBUG_KVM */ - -#ifdef DEBUG_KVM -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif - #define PROC_DEVTREE_CPU "/proc/device-tree/cpus/" =20 const KVMCapabilityInfo kvm_arch_required_capabilities[] =3D { @@ -640,7 +630,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr =3D (uintptr_t)&fpscr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set FPSCR to KVM: %s\n", strerror(errno)); + trace_kvm_failed_fpscr_set(strerror(errno)); return ret; } =20 @@ -661,8 +651,8 @@ static int kvm_put_fp(CPUState *cs) =20 ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set %s%d to KVM: %s\n", vsx ? "VSR" : "= FPR", - i, strerror(errno)); + trace_kvm_failed_fp_set(vsx ? "VSR" : "FPR", i, + strerror(errno)); return ret; } } @@ -673,7 +663,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr =3D (uintptr_t)&env->vscr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set VSCR to KVM: %s\n", strerror(errno)); + trace_kvm_failed_vscr_set(strerror(errno)); return ret; } =20 @@ -682,7 +672,7 @@ static int kvm_put_fp(CPUState *cs) reg.addr =3D (uintptr_t)cpu_avr_ptr(env, i); ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set VR%d to KVM: %s\n", i, strerror(err= no)); + trace_kvm_failed_vr_set(i, strerror(errno)); return ret; } } @@ -707,7 +697,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr =3D (uintptr_t)&fpscr; ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get FPSCR from KVM: %s\n", strerror(errno)); + trace_kvm_failed_fpscr_get(strerror(errno)); return ret; } else { env->fpscr =3D fpscr; @@ -723,8 +713,8 @@ static int kvm_get_fp(CPUState *cs) =20 ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get %s%d from KVM: %s\n", - vsx ? "VSR" : "FPR", i, strerror(errno)); + trace_kvm_failed_fp_get(vsx ? "VSR" : "FPR", i, + strerror(errno)); return ret; } else { #ifdef HOST_WORDS_BIGENDIAN @@ -747,7 +737,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr =3D (uintptr_t)&env->vscr; ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get VSCR from KVM: %s\n", strerror(errno)); + trace_kvm_failed_vscr_get(strerror(errno)); return ret; } =20 @@ -756,8 +746,7 @@ static int kvm_get_fp(CPUState *cs) reg.addr =3D (uintptr_t)cpu_avr_ptr(env, i); ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get VR%d from KVM: %s\n", - i, strerror(errno)); + trace_kvm_failed_vr_get(i, strerror(errno)); return ret; } } @@ -778,7 +767,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->vpa_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get VPA address from KVM: %s\n", strerror(errno= )); + trace_kvm_failed_vpa_addr_get(strerror(errno)); return ret; } =20 @@ -788,8 +777,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->slb_shadow_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get SLB shadow state from KVM: %s\n", - strerror(errno)); + trace_kvm_failed_slb_get(strerror(errno)); return ret; } =20 @@ -799,8 +787,7 @@ static int kvm_get_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->dtl_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to get dispatch trace log state from KVM: %s\n", - strerror(errno)); + trace_kvm_failed_dtl_get(strerror(errno)); return ret; } =20 @@ -828,7 +815,7 @@ static int kvm_put_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->vpa_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set VPA address to KVM: %s\n", strerror(err= no)); + trace_kvm_failed_vpa_addr_set(strerror(errno)); return ret; } } @@ -839,7 +826,7 @@ static int kvm_put_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->slb_shadow_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set SLB shadow state to KVM: %s\n", strerror(er= rno)); + trace_kvm_failed_slb_set(strerror(errno)); return ret; } =20 @@ -849,8 +836,7 @@ static int kvm_put_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->dtl_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set dispatch trace log state to KVM: %s\n", - strerror(errno)); + trace_kvm_failed_dtl_set(strerror(errno)); return ret; } =20 @@ -859,7 +845,7 @@ static int kvm_put_vpa(CPUState *cs) reg.addr =3D (uintptr_t)&spapr_cpu->vpa_addr; ret =3D kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); if (ret < 0) { - DPRINTF("Unable to set VPA address to KVM: %s\n", strerror(err= no)); + trace_kvm_failed_null_vpa_addr_set(strerror(errno)); return ret; } } @@ -1016,7 +1002,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) =20 if (cap_papr) { if (kvm_put_vpa(cs) < 0) { - DPRINTF("Warning: Unable to set VPA information to KVM\n"); + trace_kvm_failed_put_vpa(); } } =20 @@ -1320,7 +1306,7 @@ int kvm_arch_get_registers(CPUState *cs) =20 if (cap_papr) { if (kvm_get_vpa(cs) < 0) { - DPRINTF("Warning: Unable to get VPA information from KVM\n= "); + trace_kvm_failed_get_vpa(); } } =20 @@ -1380,7 +1366,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *r= un) */ irq =3D KVM_INTERRUPT_SET; =20 - DPRINTF("injected interrupt %d\n", irq); + trace_kvm_injected_interrupt(irq); r =3D kvm_vcpu_ioctl(cs, KVM_INTERRUPT, &irq); if (r < 0) { printf("cpu %d fail inject %x\n", cs->cpu_index, irq); @@ -1732,20 +1718,20 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_r= un *run) switch (run->exit_reason) { case KVM_EXIT_DCR: if (run->dcr.is_write) { - DPRINTF("handle dcr write\n"); + trace_kvm_handle_dcr_write(); ret =3D kvmppc_handle_dcr_write(env, run->dcr.dcrn, run->dcr.d= ata); } else { - DPRINTF("handle dcr read\n"); + trace_kvm_handle_drc_read(); ret =3D kvmppc_handle_dcr_read(env, run->dcr.dcrn, &run->dcr.d= ata); } break; case KVM_EXIT_HLT: - DPRINTF("handle halt\n"); + trace_kvm_handle_halt(); ret =3D kvmppc_handle_halt(cpu); break; #if defined(TARGET_PPC64) case KVM_EXIT_PAPR_HCALL: - DPRINTF("handle PAPR hypercall\n"); + trace_kvm_handle_papr_hcall(); run->papr_hcall.ret =3D spapr_hypercall(cpu, run->papr_hcall.nr, run->papr_hcall.args); @@ -1753,18 +1739,18 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_r= un *run) break; #endif case KVM_EXIT_EPR: - DPRINTF("handle epr\n"); + trace_kvm_handle_epr(); run->epr.epr =3D ldl_phys(cs->as, env->mpic_iack); ret =3D 0; break; case KVM_EXIT_WATCHDOG: - DPRINTF("handle watchdog expiry\n"); + trace_kvm_handle_watchdog_expiry(); watchdog_perform_action(); ret =3D 0; break; =20 case KVM_EXIT_DEBUG: - DPRINTF("handle debug exception\n"); + trace_kvm_handle_debug_exception(); if (kvm_handle_debug(cpu, run)) { ret =3D EXCP_DEBUG; break; diff --git a/target/ppc/trace-events b/target/ppc/trace-events index ed4d57c6d9..7b3cfe11fd 100644 --- a/target/ppc/trace-events +++ b/target/ppc/trace-events @@ -3,3 +3,28 @@ # kvm.c kvm_failed_spr_set(int spr, const char *msg) "Warning: Unable to set SPR %= d to KVM: %s" kvm_failed_spr_get(int spr, const char *msg) "Warning: Unable to retrieve = SPR %d from KVM: %s" +kvm_failed_fpscr_set(const char *msg) "Unable to set FPSCR to KVM: %s" +kvm_failed_fp_set(const char *fpname, int fpnum, const char *msg) "Unable = to set %s%d to KVM: %s" +kvm_failed_vscr_set(const char *msg) "Unable to set VSCR to KVM: %s" +kvm_failed_vr_set(int vr, const char *msg) "Unable to set VR%d to KVM: %s" +kvm_failed_fpscr_get(const char *msg) "Unable to get FPSCR from KVM: %s" +kvm_failed_fp_get(const char *fpname, int fpnum, const char *msg) "Unable = to get %s%d from KVM: %s" +kvm_failed_vscr_get(const char *msg) "Unable to get VSCR from KVM: %s" +kvm_failed_vr_get(int vr, const char *msg) "Unable to get VR%d from KVM: %= s" +kvm_failed_vpa_addr_get(const char *msg) "Unable to get VPA address from K= VM: %s" +kvm_failed_slb_get(const char *msg) "Unable to get SLB shadow state from K= VM: %s" +kvm_failed_dtl_get(const char *msg) "Unable to get dispatch trace log stat= e from KVM: %s" +kvm_failed_vpa_addr_set(const char *msg) "Unable to set VPA address to KVM= : %s" +kvm_failed_slb_set(const char *msg) "Unable to set SLB shadow state to KVM= : %s" +kvm_failed_dtl_set(const char *msg) "Unable to set dispatch trace log stat= e to KVM: %s" +kvm_failed_null_vpa_addr_set(const char *msg) "Unable to set VPA address t= o KVM: %s" +kvm_failed_put_vpa(void) "Warning: Unable to set VPA information to KVM" +kvm_failed_get_vpa(void) "Warning: Unable to get VPA information from KVM" +kvm_injected_interrupt(int irq) "injected interrupt %d" +kvm_handle_dcr_write(void) "handle dcr write" +kvm_handle_drc_read(void) "handle dcr read" +kvm_handle_halt(void) "handle halt" +kvm_handle_papr_hcall(void) "handle PAPR hypercall" +kvm_handle_epr(void) "handle epr" +kvm_handle_watchdog_expiry(void) "handle watchdog expiry" +kvm_handle_debug_exception(void) "handle debug exception" --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260646; cv=none; d=zoho.com; s=zohoarc; b=QNC4fjZRbm8TNtO+DwyJruWSaX7V8G/8lsl2qpretWYB7AwG++qR7Da0u7AmW9egKxpVENE2tEWD7Nv7ZW409orsRWciG82rv0/vi3XtsSDIFeqRIaal0WcMvrYMDq2zbZ9ahWhLTm1gl57ZwyhxI+l70MTg3qfYiB20SH1SGrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260646; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1Gch8J0kNlyK8lTrxqvKzZN+Al6+PVRpDRLkfgWPnV4=; b=LgIPegxU6ao+fTb6+KCV6wzKHLd4694QATNO0pJZXr4hHB7EgLJY0UQFRoCzNMllWvvCJCnGKiTitU1vgpM4e26wAsOBbXYeqnUaQEwiW2BTLKo+69kD3S0tdw4uQNRAqI67ka+l7gvHqcJF5jPspBs6GGQs5FSr8/LTQ6AVqWM= ARC-Authentication-Results: i=1; mx.zoho.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 155626064687590.69473877324776; Thu, 25 Apr 2019 23:37:26 -0700 (PDT) Received: from localhost ([127.0.0.1]:40384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuTy-0001ui-OB for importer@patchew.org; Fri, 26 Apr 2019 02:37:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu19-0006F4-HO for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu17-0005K5-JP for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:27 -0400 Received: from ozlabs.org ([203.11.71.1]:42197) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu13-0005AE-SU; Fri, 26 Apr 2019 02:07:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tr5kQTz9sP2; Fri, 26 Apr 2019 16:06:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258800; bh=4SF6Qz690a2Klih/QbUrTHpCEcnykbkSd2N349hfpFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jtj+Zv1wBmzfEvIS//+r2/BgOnp608Vs/I18RWPwAVN0OyDo6iUpevjC4e9Yg0uEm 1r2vUpxnoALswKKk/+DQoqM1R9dN2OQpJQPLC+uoKDxBINCu1ZTksOx+jzfBAL9QAA 1GhdgyXMRnq9FTkpNZP6PoA1qNNTbHIa8KbGRQDg= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:23 +1000 Message-Id: <20190426060627.18153-33-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 32/36] target/ppc: Don't check UPRT in radix mode when in HV real mode 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: gkurz@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 It appears that during kexec, we run for a while in hypervisor real mode with LPCR:HR set and LPCR:UPRT clear, which trips the assertion in ppc_radix64_handle_mmu_fault(). First this shouldn't be an assertion, it's a guest error. Then we shouldn't be checking these things in hypervisor real mode (or in virtual hypervisor guest real mode which is similar) as the real HW won't use those LPCR bits in those cases anyway, so technically it's ok to have this discrepancy. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190411080004.8690-2-clg@kaod.org> [dwg: Fix for 32-bit builds] Signed-off-by: David Gibson --- target/ppc/mmu-radix64.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/target/ppc/mmu-radix64.c b/target/ppc/mmu-radix64.c index ca1fb2673f..066e324464 100644 --- a/target/ppc/mmu-radix64.c +++ b/target/ppc/mmu-radix64.c @@ -228,10 +228,10 @@ int ppc_radix64_handle_mmu_fault(PowerPCCPU *cpu, vad= dr eaddr, int rwx, ppc_v3_pate_t pate; =20 assert((rwx =3D=3D 0) || (rwx =3D=3D 1) || (rwx =3D=3D 2)); - assert(ppc64_use_proc_tbl(cpu)); =20 - /* Real Mode Access */ - if (((rwx =3D=3D 2) && (msr_ir =3D=3D 0)) || ((rwx !=3D 2) && (msr_dr = =3D=3D 0))) { + /* HV or virtual hypervisor Real Mode Access */ + if ((msr_hv || cpu->vhyp) && + (((rwx =3D=3D 2) && (msr_ir =3D=3D 0)) || ((rwx !=3D 2) && (msr_dr= =3D=3D 0)))) { /* In real mode top 4 effective addr bits (mostly) ignored */ raddr =3D eaddr & 0x0FFFFFFFFFFFFFFFULL; =20 @@ -241,6 +241,16 @@ int ppc_radix64_handle_mmu_fault(PowerPCCPU *cpu, vadd= r eaddr, int rwx, return 0; } =20 + /* + * Check UPRT (we avoid the check in real mode to deal with + * transitional states during kexec. + */ + if (!ppc64_use_proc_tbl(cpu)) { + qemu_log_mask(LOG_GUEST_ERROR, + "LPCR:UPRT not set in radix mode ! LPCR=3D" + TARGET_FMT_lx "\n", env->spr[SPR_LPCR]); + } + /* Virtual Mode Access - get the fully qualified address */ if (!ppc_radix64_get_fully_qualified_addr(env, eaddr, &lpid, &pid)) { ppc_radix64_raise_segi(cpu, rwx, eaddr); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260746; cv=none; d=zoho.com; s=zohoarc; b=UMhaLSeSC5LfkTh3Fwl+wTHG7/i7pM6oToRiM8zuKg8IdpR2cMN4Ra34MuAMEhKprxuadyCPQT1qdqi3hLVQVzfBKNNiZwyJid9QJ1qOPRf6y+V4v8cVOcS04LtmdVlrAMtkyVXvwCDGqIaxCe83kdoECL2jH8wDHFIXF5L3Zxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260746; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dajqUS0LulY5iwZHcmvFij6qP1tfxXeUD33l5Ivt9IY=; b=lgY4PszicozpO6q89J69VVDQv62i25FbOw7Fel1cN1JWr/q+iBqvn5mX/bTeu4/O001iVI4GvcV5YCzSLcs5zyFsU5W9JQ4PJwoetJz3JY2HzjrR6p0zs2IVQS8s2A/To12pKBtPdpNeB2fVToH+85RKjQ0LxGgLcHu8tK9l7xM= ARC-Authentication-Results: i=1; mx.zoho.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 1556260746176647.2955670255025; Thu, 25 Apr 2019 23:39:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:40396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuVi-0003Gs-6r for importer@patchew.org; Fri, 26 Apr 2019 02:39:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1P-0006TO-9m for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1O-0005ks-7n for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:43 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:46241 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1N-0005AP-RF; Fri, 26 Apr 2019 02:07:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tr2vFVz9sP7; Fri, 26 Apr 2019 16:06:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258800; bh=BGUxo+69DyxWOcoYW0v+TrohW3b5SGY5IZ68jpOhStM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTGzGbedQ+PzgKasO/vdbhEELR4cCBVnkjItpDnAvpfLWSA3QpC1th9zNBL2NcMbp wj4+ACrw1kwtRWvxiRrZxE0kZVhuc/GEtHkfc2uuFi8Shsm9y5D8NUIte7zz5Oklnk 3A3z/0mjZ4aL51S2KKYN/z5VcLMdutnnooxqlcPc= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:24 +1000 Message-Id: <20190426060627.18153-34-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 33/36] ppc/spapr: Use proper HPTE accessors for H_READ 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: gkurz@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 Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190411080004.8690-3-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 8a736797b9..3534079777 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -304,8 +304,8 @@ static target_ulong h_read(PowerPCCPU *cpu, SpaprMachin= eState *spapr, { target_ulong flags =3D args[0]; target_ulong ptex =3D args[1]; - uint8_t *hpte; int i, ridx, n_entries =3D 1; + const ppc_hash_pte64_t *hptes; =20 if (!valid_ptex(cpu, ptex)) { return H_PARAMETER; @@ -317,13 +317,12 @@ static target_ulong h_read(PowerPCCPU *cpu, SpaprMach= ineState *spapr, n_entries =3D 4; } =20 - hpte =3D spapr->htab + (ptex * HASH_PTE_SIZE_64); - + hptes =3D ppc_hash64_map_hptes(cpu, ptex, n_entries); for (i =3D 0, ridx =3D 0; i < n_entries; i++) { - args[ridx++] =3D ldq_p(hpte); - args[ridx++] =3D ldq_p(hpte + (HASH_PTE_SIZE_64/2)); - hpte +=3D HASH_PTE_SIZE_64; + args[ridx++] =3D ppc_hash64_hpte0(cpu, hptes, i); + args[ridx++] =3D ppc_hash64_hpte1(cpu, hptes, i); } + ppc_hash64_unmap_hptes(cpu, hptes, ptex, n_entries); =20 return H_SUCCESS; } --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260530; cv=none; d=zoho.com; s=zohoarc; b=JlkAfgd9PchiE7pV2MdAmkqTsiwFyrHdbbZcarsdWKZEkljcpgweOZf2fzh2FosCxFfzdY5VwWjr8z6q5ObEZ6/KyWzIQnF73kwUcKkW5bx+cSj/dm+hDieFki/t1vuoGwvisjWjyzl0jUz/7A5Z2YKpvV/Kl22OXaSf6MruZjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260530; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1Q1v/jOT4MVGa9QBcV78EBTecfdK8aVaAm0zzkW6SnU=; b=d9rz9lqiZhT+Io431W4BLG5hwjCdNg3j96SO9uHDJIAX7cSrl0RZ5rL4CTRsYf6SwPNct7NxJ1A012aj/YYSXSJDadD7BnYWGEpBB2AxHl/Tb3ko34NcTVSkW/Odj02SA+UD/s1RwOAIGPRtHlvZ7T3KAtY+M65JEqXl3cLpQ6Q= ARC-Authentication-Results: i=1; mx.zoho.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 1556260530934698.1685338273594; Thu, 25 Apr 2019 23:35:30 -0700 (PDT) Received: from localhost ([127.0.0.1]:40346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuSE-0000Rr-V7 for importer@patchew.org; Fri, 26 Apr 2019 02:35:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu17-0006CB-K9 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu15-0005HY-OD for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:25 -0400 Received: from ozlabs.org ([203.11.71.1]:38109) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu12-00057G-2H; Fri, 26 Apr 2019 02:07:21 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq5Lh6z9sP8; Fri, 26 Apr 2019 16:06:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=cd5Bs8tZ7TldERfRIdDDGoFRY3we0kFl+mxhdqOePgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=anoFuMpe7RykRn1/bMvejsfZlnkwPodCG5M+mZQzczVqHqgmJSacmXSewip/wZfxC HfbUmkW8yyp8bv37WsLIaa0dxM6oJoSKMFbv+2xsaQuDCfHyw3XzvIQYszAr0T701I sMH3jdhJ6w6gvvMWxXLo9VAZSXknQpNSsjJcXYWA= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:25 +1000 Message-Id: <20190426060627.18153-35-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 34/36] ppc/hash64: Rework R and C bit updates 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: gkurz@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 With MT-TCG, we are now running translation in a racy way, thus we need to mimic hardware when it comes to updating the R and C bits, by doing byte stores. The current "store_hpte" abstraction is ill suited for this, we replace it with two separate callbacks for setting R and C. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190411080004.8690-4-clg@kaod.org> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 41 +++++++++++++++++++--- hw/ppc/spapr_hcall.c | 13 +++---- include/hw/ppc/spapr.h | 2 ++ target/ppc/cpu.h | 4 +-- target/ppc/mmu-hash64.c | 76 ++++++++++++++++++++++++----------------- target/ppc/mmu-hash64.h | 2 -- 6 files changed, 93 insertions(+), 45 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b81e237635..c56939a43b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1520,10 +1520,10 @@ static void spapr_unmap_hptes(PPCVirtualHypervisor = *vhyp, /* Nothing to do for qemu managed HPT */ } =20 -static void spapr_store_hpte(PPCVirtualHypervisor *vhyp, hwaddr ptex, - uint64_t pte0, uint64_t pte1) +void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex, + uint64_t pte0, uint64_t pte1) { - SpaprMachineState *spapr =3D SPAPR_MACHINE(vhyp); + SpaprMachineState *spapr =3D SPAPR_MACHINE(cpu->vhyp); hwaddr offset =3D ptex * HASH_PTE_SIZE_64; =20 if (!spapr->htab) { @@ -1551,6 +1551,38 @@ static void spapr_store_hpte(PPCVirtualHypervisor *v= hyp, hwaddr ptex, } } =20 +static void spapr_hpte_set_c(PPCVirtualHypervisor *vhyp, hwaddr ptex, + uint64_t pte1) +{ + hwaddr offset =3D ptex * HASH_PTE_SIZE_64 + 15; + SpaprMachineState *spapr =3D SPAPR_MACHINE(vhyp); + + if (!spapr->htab) { + /* There should always be a hash table when this is called */ + error_report("spapr_hpte_set_c called with no hash table !"); + return; + } + + /* The HW performs a non-atomic byte update */ + stb_p(spapr->htab + offset, (pte1 & 0xff) | 0x80); +} + +static void spapr_hpte_set_r(PPCVirtualHypervisor *vhyp, hwaddr ptex, + uint64_t pte1) +{ + hwaddr offset =3D ptex * HASH_PTE_SIZE_64 + 14; + SpaprMachineState *spapr =3D SPAPR_MACHINE(vhyp); + + if (!spapr->htab) { + /* There should always be a hash table when this is called */ + error_report("spapr_hpte_set_r called with no hash table !"); + return; + } + + /* The HW performs a non-atomic byte update */ + stb_p(spapr->htab + offset, ((pte1 >> 8) & 0xff) | 0x01); +} + int spapr_hpt_shift_for_ramsize(uint64_t ramsize) { int shift; @@ -4291,7 +4323,8 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) vhc->hpt_mask =3D spapr_hpt_mask; vhc->map_hptes =3D spapr_map_hptes; vhc->unmap_hptes =3D spapr_unmap_hptes; - vhc->store_hpte =3D spapr_store_hpte; + vhc->hpte_set_c =3D spapr_hpte_set_c; + vhc->hpte_set_r =3D spapr_hpte_set_r; vhc->get_pate =3D spapr_get_pate; vhc->encode_hpt_for_kvm_pr =3D spapr_encode_hpt_for_kvm_pr; xic->ics_get =3D spapr_ics_get; diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 3534079777..6c16d2b120 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -118,7 +118,7 @@ static target_ulong h_enter(PowerPCCPU *cpu, SpaprMachi= neState *spapr, ppc_hash64_unmap_hptes(cpu, hptes, ptex, 1); } =20 - ppc_hash64_store_hpte(cpu, ptex + slot, pteh | HPTE64_V_HPTE_DIRTY, pt= el); + spapr_store_hpte(cpu, ptex + slot, pteh | HPTE64_V_HPTE_DIRTY, ptel); =20 args[0] =3D ptex + slot; return H_SUCCESS; @@ -131,7 +131,8 @@ typedef enum { REMOVE_HW =3D 3, } RemoveResult; =20 -static RemoveResult remove_hpte(PowerPCCPU *cpu, target_ulong ptex, +static RemoveResult remove_hpte(PowerPCCPU *cpu + , target_ulong ptex, target_ulong avpn, target_ulong flags, target_ulong *vp, target_ulong *rp) @@ -155,7 +156,7 @@ static RemoveResult remove_hpte(PowerPCCPU *cpu, target= _ulong ptex, } *vp =3D v; *rp =3D r; - ppc_hash64_store_hpte(cpu, ptex, HPTE64_V_HPTE_DIRTY, 0); + spapr_store_hpte(cpu, ptex, HPTE64_V_HPTE_DIRTY, 0); ppc_hash64_tlb_flush_hpte(cpu, ptex, v, r); return REMOVE_SUCCESS; } @@ -289,13 +290,13 @@ static target_ulong h_protect(PowerPCCPU *cpu, SpaprM= achineState *spapr, r |=3D (flags << 55) & HPTE64_R_PP0; r |=3D (flags << 48) & HPTE64_R_KEY_HI; r |=3D flags & (HPTE64_R_PP | HPTE64_R_N | HPTE64_R_KEY_LO); - ppc_hash64_store_hpte(cpu, ptex, - (v & ~HPTE64_V_VALID) | HPTE64_V_HPTE_DIRTY, 0); + spapr_store_hpte(cpu, ptex, + (v & ~HPTE64_V_VALID) | HPTE64_V_HPTE_DIRTY, 0); ppc_hash64_tlb_flush_hpte(cpu, ptex, v, r); /* Flush the tlb */ check_tlb_flush(env, true); /* Don't need a memory barrier, due to qemu's global lock */ - ppc_hash64_store_hpte(cpu, ptex, v | HPTE64_V_HPTE_DIRTY, r); + spapr_store_hpte(cpu, ptex, v | HPTE64_V_HPTE_DIRTY, r); return H_SUCCESS; } =20 diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 9331f5e0b9..7e32f309c2 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -784,6 +784,8 @@ void spapr_reallocate_hpt(SpaprMachineState *spapr, int= shift, Error **errp); void spapr_clear_pending_events(SpaprMachineState *spapr); int spapr_max_server_number(SpaprMachineState *spapr); +void spapr_store_hpte(PowerPCCPU *cpu, hwaddr ptex, + uint64_t pte0, uint64_t pte1); =20 /* DRC callbacks. */ void spapr_core_release(DeviceState *dev); diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 8a79db0c43..5e7cf54b2f 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1265,8 +1265,8 @@ struct PPCVirtualHypervisorClass { void (*unmap_hptes)(PPCVirtualHypervisor *vhyp, const ppc_hash_pte64_t *hptes, hwaddr ptex, int n); - void (*store_hpte)(PPCVirtualHypervisor *vhyp, hwaddr ptex, - uint64_t pte0, uint64_t pte1); + void (*hpte_set_c)(PPCVirtualHypervisor *vhyp, hwaddr ptex, uint64_t p= te1); + void (*hpte_set_r)(PPCVirtualHypervisor *vhyp, hwaddr ptex, uint64_t p= te1); void (*get_pate)(PPCVirtualHypervisor *vhyp, ppc_v3_pate_t *entry); target_ulong (*encode_hpt_for_kvm_pr)(PPCVirtualHypervisor *vhyp); }; diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index c74818b2e7..7899eb2918 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -725,6 +725,39 @@ static void ppc_hash64_set_dsi(CPUState *cs, uint64_t = dar, uint64_t dsisr) } =20 =20 +static void ppc_hash64_set_r(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte1) +{ + hwaddr base, offset =3D ptex * HASH_PTE_SIZE_64 + 16; + + if (cpu->vhyp) { + PPCVirtualHypervisorClass *vhc =3D + PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); + vhc->hpte_set_r(cpu->vhyp, ptex, pte1); + return; + } + base =3D ppc_hash64_hpt_base(cpu); + + + /* The HW performs a non-atomic byte update */ + stb_phys(CPU(cpu)->as, base + offset, ((pte1 >> 8) & 0xff) | 0x01); +} + +static void ppc_hash64_set_c(PowerPCCPU *cpu, hwaddr ptex, uint64_t pte1) +{ + hwaddr base, offset =3D ptex * HASH_PTE_SIZE_64 + 15; + + if (cpu->vhyp) { + PPCVirtualHypervisorClass *vhc =3D + PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); + vhc->hpte_set_c(cpu->vhyp, ptex, pte1); + return; + } + base =3D ppc_hash64_hpt_base(cpu); + + /* The HW performs a non-atomic byte update */ + stb_phys(CPU(cpu)->as, base + offset, (pte1 & 0xff) | 0x80); +} + int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx) { @@ -735,7 +768,6 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr = eaddr, hwaddr ptex; ppc_hash_pte64_t pte; int exec_prot, pp_prot, amr_prot, prot; - uint64_t new_pte1; const int need_prot[] =3D {PAGE_READ, PAGE_WRITE, PAGE_EXEC}; hwaddr raddr; =20 @@ -883,19 +915,19 @@ skip_slb_search: =20 /* 6. Update PTE referenced and changed bits if necessary */ =20 - new_pte1 =3D pte.pte1 | HPTE64_R_R; /* set referenced bit */ - if (rwx =3D=3D 1) { - new_pte1 |=3D HPTE64_R_C; /* set changed (dirty) bit */ - } else { - /* - * Treat the page as read-only for now, so that a later write - * will pass through this function again to set the C bit - */ - prot &=3D ~PAGE_WRITE; + if (!(pte.pte1 & HPTE64_R_R)) { + ppc_hash64_set_r(cpu, ptex, pte.pte1); } - - if (new_pte1 !=3D pte.pte1) { - ppc_hash64_store_hpte(cpu, ptex, pte.pte0, new_pte1); + if (!(pte.pte1 & HPTE64_R_C)) { + if (rwx =3D=3D 1) { + ppc_hash64_set_c(cpu, ptex, pte.pte1); + } else { + /* + * Treat the page as read-only for now, so that a later write + * will pass through this function again to set the C bit + */ + prot &=3D ~PAGE_WRITE; + } } =20 /* 7. Determine the real address from the PTE */ @@ -954,24 +986,6 @@ hwaddr ppc_hash64_get_phys_page_debug(PowerPCCPU *cpu,= target_ulong addr) & TARGET_PAGE_MASK; } =20 -void ppc_hash64_store_hpte(PowerPCCPU *cpu, hwaddr ptex, - uint64_t pte0, uint64_t pte1) -{ - hwaddr base; - hwaddr offset =3D ptex * HASH_PTE_SIZE_64; - - if (cpu->vhyp) { - PPCVirtualHypervisorClass *vhc =3D - PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); - vhc->store_hpte(cpu->vhyp, ptex, pte0, pte1); - return; - } - base =3D ppc_hash64_hpt_base(cpu); - - stq_phys(CPU(cpu)->as, base + offset, pte0); - stq_phys(CPU(cpu)->as, base + offset + HASH_PTE_SIZE_64 / 2, pte1); -} - void ppc_hash64_tlb_flush_hpte(PowerPCCPU *cpu, target_ulong ptex, target_ulong pte0, target_ulong pte1) { diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h index 5be7ad86db..87729d48b3 100644 --- a/target/ppc/mmu-hash64.h +++ b/target/ppc/mmu-hash64.h @@ -10,8 +10,6 @@ int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot, hwaddr ppc_hash64_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr); int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr address, int rw, int mmu_idx); -void ppc_hash64_store_hpte(PowerPCCPU *cpu, hwaddr ptex, - uint64_t pte0, uint64_t pte1); void ppc_hash64_tlb_flush_hpte(PowerPCCPU *cpu, target_ulong pte_index, target_ulong pte0, target_ulong pte1); --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260086; cv=none; d=zoho.com; s=zohoarc; b=iktY5jxMb4nvCvKiIej2vDyi1yfvA0S5+X3QTmXTgLiorI/13AZ7BZ7PrHHON0Yosrzvbm/8eTxSIB2H9ebMsSSDdU/hvG8gg6IR3enceKtBb/1+vHXXaS7EO1ZgUBM8H8HgobkC+/zj1ryyO6mx1F4z3gG0Anr1XXaFfTbvWEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260086; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NlgQ714Ojampl9ulaZWChDSJs9qSz/PrAIzKZjUuG7U=; b=Pkw87irLCO9Dw8zlc3OuY4GUMIKQPwqYMQ9iSnlmTYZePM2mm7jOnpRUfbNI852aPdwiRm1Hmfop8o8zQ2VDNuNdg4A6+VQ+Ff/rpck8RP7BvkUS7tk4jf3dGdSeXpW9r+N6bejDwENIGNkC/cpLiDETu36e11oKgC8wKXZ8rFE= ARC-Authentication-Results: i=1; mx.zoho.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 1556260086020411.0125592809287; Thu, 25 Apr 2019 23:28:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:40223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuL1-0001hh-RS for importer@patchew.org; Fri, 26 Apr 2019 02:27:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1N-0006TH-Pu for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1M-0005iA-N0 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:41 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:35301 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1M-00057V-1N; Fri, 26 Apr 2019 02:07:40 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tr1VGkz9sP1; Fri, 26 Apr 2019 16:06:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258800; bh=CrJ6LiThzdFhZvdEPZF9mDmfrXA+5OXeE4aXebuaLcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpcT5FtwJSyT1jbEUy1ye7QOiKdeMXWRyL2shhrIobv6cB3r2K6V3lX8anE9fsdgW ulOm5Ycn4iH+CY7VrvY/pPlRyaPTDdpgKQ2jmYixyLtDW17Pg6kfwwTPlr6Cv8rpVV PRUbwSrd1yUE0PZ6raH9O4FQXD32OiQoZs1xC+QA= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:26 +1000 Message-Id: <20190426060627.18153-36-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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/36] ppc/hash32: Rework R and C bit updates 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: gkurz@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 With MT-TCG, we are now running translation in a racy way, thus we need to mimic hardware when it comes to updating the R and C bits, by doing byte stores. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190411080004.8690-5-clg@kaod.org> Signed-off-by: David Gibson --- target/ppc/mmu-hash32.c | 45 ++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/target/ppc/mmu-hash32.c b/target/ppc/mmu-hash32.c index 3f4dee835e..55cf156a0b 100644 --- a/target/ppc/mmu-hash32.c +++ b/target/ppc/mmu-hash32.c @@ -345,6 +345,24 @@ static hwaddr ppc_hash32_pteg_search(PowerPCCPU *cpu, = hwaddr pteg_off, return -1; } =20 +static void ppc_hash32_set_r(PowerPCCPU *cpu, hwaddr pte_offset, uint32_t = pte1) +{ + target_ulong base =3D ppc_hash32_hpt_base(cpu); + hwaddr offset =3D pte_offset + 6; + + /* The HW performs a non-atomic byte update */ + stb_phys(CPU(cpu)->as, base + offset, ((pte1 >> 8) & 0xff) | 0x01); +} + +static void ppc_hash32_set_c(PowerPCCPU *cpu, hwaddr pte_offset, uint64_t = pte1) +{ + target_ulong base =3D ppc_hash32_hpt_base(cpu); + hwaddr offset =3D pte_offset + 7; + + /* The HW performs a non-atomic byte update */ + stb_phys(CPU(cpu)->as, base + offset, (pte1 & 0xff) | 0x80); +} + static hwaddr ppc_hash32_htab_lookup(PowerPCCPU *cpu, target_ulong sr, target_ulong eaddr, ppc_hash_pte32_t *pte) @@ -403,7 +421,6 @@ int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr = eaddr, int rwx, hwaddr pte_offset; ppc_hash_pte32_t pte; int prot; - uint32_t new_pte1; const int need_prot[] =3D {PAGE_READ, PAGE_WRITE, PAGE_EXEC}; hwaddr raddr; =20 @@ -519,20 +536,20 @@ int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vadd= r eaddr, int rwx, =20 /* 8. Update PTE referenced and changed bits if necessary */ =20 - new_pte1 =3D pte.pte1 | HPTE32_R_R; /* set referenced bit */ - if (rwx =3D=3D 1) { - new_pte1 |=3D HPTE32_R_C; /* set changed (dirty) bit */ - } else { - /* - * Treat the page as read-only for now, so that a later write - * will pass through this function again to set the C bit - */ - prot &=3D ~PAGE_WRITE; - } - - if (new_pte1 !=3D pte.pte1) { - ppc_hash32_store_hpte1(cpu, pte_offset, new_pte1); + if (!(pte.pte1 & HPTE32_R_R)) { + ppc_hash32_set_r(cpu, pte_offset, pte.pte1); } + if (!(pte.pte1 & HPTE32_R_C)) { + if (rwx =3D=3D 1) { + ppc_hash32_set_c(cpu, pte_offset, pte.pte1); + } else { + /* + * Treat the page as read-only for now, so that a later write + * will pass through this function again to set the C bit + */ + prot &=3D ~PAGE_WRITE; + } + } =20 /* 9. Determine the real address from the PTE */ =20 --=20 2.20.1 From nobody Mon Feb 9 08:15:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1556260001; cv=none; d=zoho.com; s=zohoarc; b=mjJIm+Xk/x4d+Dps3pIOI5phYDRRTCETauAOI3xDd1TR4Ru7kMGVonjixxMQiyKtQkEE5iR/HK41TF0jYU/SqP8zuZzyOocpFOv0dI74snNuFbK251fZx2mz7hyL1hMV1x7X3rqLVpWUzFr57LFXj8cojt92cbVlPTKswPO8Oqg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556260001; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9ah+NO0sDbqt5wkbA3I7tTHWe7FF6X+7Ie3jO0hUj6g=; b=d9W7e3aCBrMhoDJd+bmniAYCuuaBXxaU+LmLbcFr+Ku4NF//QU7VLUz0PeyjVmV85jY+y5/vF8A3MUXTZ26Zf8CveLk8SJMAzigPPQ7qYQ3H95qcdST0a4F/jAanOdbEtPRB58V9UfZC/4J3ryahjTeIg7QsvOiyhyiXkRH0RxA= ARC-Authentication-Results: i=1; mx.zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556260000721375.94197761035275; Thu, 25 Apr 2019 23:26:40 -0700 (PDT) Received: from localhost ([127.0.0.1]:40204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJuJR-00083c-Fo for importer@patchew.org; Fri, 26 Apr 2019 02:26:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJu1K-0006Rx-Vf for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJu1J-0005ed-Vs for qemu-devel@nongnu.org; Fri, 26 Apr 2019 02:07:38 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:47081 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJu1J-00051z-IY; Fri, 26 Apr 2019 02:07:37 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44r3Tq4TZ6z9sNr; Fri, 26 Apr 2019 16:06:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1556258799; bh=M9tGNO0CMBlakuYj8vyjTCfUIkj2mawnuCKyR78PxHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtfV+qHJqaUc0YgHAp7Do9Hzehx3XGJwIlwAKAoZJ9nyj5WyQcE88YUWOxsYNMIoc ov33HhDnAdTNzuWwWX9ZJ+0GEKfrjuZXdc73Jv8OIsBwDTH502YKgj8+6/JIZ5VKHk ujRta+8jYUzi5LqzjVxJ9tJgQNTYQ7Cflt34UfD0= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 26 Apr 2019 16:06:27 +1000 Message-Id: <20190426060627.18153-37-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426060627.18153-1-david@gibson.dropbear.id.au> References: <20190426060627.18153-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 36/36] target/ppc: improve performance of large BAT invalidations 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: gkurz@kaod.org, qemu-devel@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , clg@kaod.org, qemu-ppc@nongnu.org, Artyom Tarasenko , 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: Artyom Tarasenko Performing a complete flush is ~ 100 times faster than flushing 256MiB of 4KiB pages. Set a limit of 1024 pages and perform a complete flush afterwards. This patch significantly speeds up AIX 5.1 and NetBSD-ofppc. Signed-off-by: Artyom Tarasenko Message-Id: <1555103178-21894-4-git-send-email-atar4qemu@gmail.com> Reviewed-by: Herv=C3=A9 Poussineau Signed-off-by: David Gibson --- target/ppc/mmu_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index d226b35739..1dbc9acb75 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -1820,6 +1820,13 @@ static inline void do_invalidate_BAT(CPUPPCState *en= v, target_ulong BATu, =20 base =3D BATu & ~0x0001FFFF; end =3D base + mask + 0x00020000; + if (((end - base) >> TARGET_PAGE_BITS) > 1024) { + /* Flushing 1024 4K pages is slower than a complete flush */ + LOG_BATS("Flush all BATs\n"); + tlb_flush(CPU(cs)); + LOG_BATS("Flush done\n"); + return; + } LOG_BATS("Flush BAT from " TARGET_FMT_lx " to " TARGET_FMT_lx " (" TARGET_FMT_lx ")\n", base, end, mask); for (page =3D base; page !=3D end; page +=3D TARGET_PAGE_SIZE) { --=20 2.20.1